nRF51 SDK - S110 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
HID Mouse Application
PC-Peripherals.jpg

HID Mouse Application

The HID Mouse Application is a firmware example that implements the HID over GATT profile for mouse using the hardware delivered in the nRF51822 Development Kit.

The source code and project file can be found in the <InstallFolder>\Nordic\nrf51822\Board\nrf6310\s110\ble_app_hids_mouse folder.

The application includes the three mandatory services needed for the HID over GATT profile:

Note
This application is not power optimised!
The application will stop advertising and go to system-off mode after
  • 3 minutes and 30 seconds, if no advertising with whitelist was done OR
  • 4 minutes, if advertising with whitelist was done.

    Push the button 0 to restart advertising.

Setup

Instructions on how to set up the nRFgo Motherboard: nRFgo Motherboard Setup (nRF6310).

LED assignments:

  • LED 0: Advertising
  • LED 1: Connected
  • LED 4: Directed advertising.
  • LED 5: Advertising with Whitelist.
  • LED 6: Slow advertising mode
  • LED 7: Asserted (i.e. an assert check in the application has failed)

Buttons assignments when in system-off:

  • Button 0: Wake-up and start advertising.
  • Button 1: Wake up, erase all bonds and restart advertising.

Buttons assignments when connected:

  • Button 0: Move mouse pointer 5 pixels to the left
  • Button 1: Move mouse pointer 5 pixels to the right
  • Button 2: Move mouse pointer 5 pixels upward
  • Button 3: Move mouse pointer 5 pixels downward

Testing

The HID Mouse Application can be connected to a Windows 8 PC with a Bluetooth radio. When connected, the application will act as a mouse, enabling the user to move the PC's mouse pointer using four push buttons on the nRFgo board:

  1. Compile and program the application. Observe that the Advertising LED is lit.
  2. On the Windows 8 PC, search for Bluetooth devices, and connect to the device named 'Nordic_Mouse'. Observe that the Connected LED is lit, and the Advertising LED is off.
  3. Push Button 0 on the nRFgo board. Observe that the mouse pointer on the Windows 8 PC moves to the left.
  4. Push Button 1. Observe that the mouse pointer on the Windows 8 PC moves to the right.
  5. Push Button 2. Observe that the mouse pointer on the Windows 8 PC moves up.
  6. Push Button 3. Observe that the mouse pointer on the Windows 8 PC moves down.
  7. Disconnect the PC from the device by removing the device from the PC's devices list. Observe that the advertising LED is lit and, for the first period the Directed advertising LED is lit also, the that it switches to Whitelist LED, then to only advertising LED, then to advertising and Slow advertising mode LEDs and then all off.
  8. Reset the device while pressing Button 1 to erase bond info. Repeat Step 2, and check if the device can control the mouse pointer on the PC.
  9. Disconnect the device from Windows 8, thereby removing the bond info from the PC. Start a search for Bluetooth devices and observe that while the device is advertising with Whitelist (LED 5 is on), Windows 8 is not able to discover the device.
  10. The device should be discoverable again after it switches to advertising mode.

The HID Mouse Application can also be tested using the Master Control Panel as follows:

  1. Compile and program the application. Observe that the Advertising LED is lit.
  2. Connect to the device from Master Control Panel (the device will be advertising as 'Nordic_Mouse'), then bond and perform service discovery. Observe that the Connected LED is lit, and the Advertising LED is off.
  3. Click the 'Enable services' button on Master Control Panel, and observe that Battery Level notifications are being received every two seconds.
  4. Push Button 0 on the nRFgo board. Observe that a notification on one of the HID Report characteristics is received, containing the value 'FB0F00'.
  5. Push Button 1. Observe that a notification on the same HID Report characteristic is received, containing the value '050000'.
  6. Push Button 2. Observe that a notification on the same HID Report characteristic is received, containing the value '00B0FF'.
  7. Push Button 3. Observe that a notification on the same HID Report characteristic is received, containing the value '005000'.
  8. Click on the Disconnect button in Master Control Panel. Observe that no new notifications are received, and the device is advertising with Whitelist (LED 5 is on).
  9. As bond info is preserved by Master Control Panel, it should be possible to immediately reconnect to the device by clicking on the Connect button again. Observe that Battery Level notifications are being received every two seconds.