nRF51 SDK - S310 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ADNS2080 Mouse Sensor Driver Application

The ADNS2080 Mouse Sensor Driver Example demonstrates how to use ADNS2080 mouse sensor (and driver) to read mouse movement. The movements of the mouse are indicated by different LEDs depending on the direction of the movement.

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

The application starts by configuring the GPIO-pins 8-15 to output (LEDs). The motion interrupt from the mouse is configured to the correct pin, and the GPIOTE channel 0 is set to generate an interrupt when the pin goes from low to high. The ADNS2080 mouse sensor is initialized and configured, and the interrupts are enabled. The main loop will check if the motion interrupt has detected a movement, and toggle LED 4 if there was a movement. The loop will then turn on LED 4-7 if the movement direction was left, or turn on LED 0-3 if the movement direction was right. The sensitivity for the mouse movement can be optimized by changing the MOUSE_MOVEMENT_THRESHOLD macro in the main.c file.

Setup

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

  • The two black jumpers on the PCA10004/PCA10005 boards must be coupled to IO.
  • PIN 24 is connected to the ADNS2080 Clock line.
  • PIN 25 is connected to the ADNS2080 Data line.
  • PIN 26 is connected to the ADNS2080 Interrupt request line.

LED assignments :

  • LED 4 is toggled when a motion interrupt is detected.
  • LED 0-3 is turned on when the mouse is moved in the left direction.
  • LED 4-7 is turned on when the mouse is moved in the right direction.

Testing

The ADNS2080 Mouse Sensor Driver Example Application can be tested as follows:

  1. Compile and program the application.
  2. By slightly moving the mouse, LED 4 should toggle.
  3. By moving the mouse in the left direction, LED 0-3 should turn on.
  4. By moving the mouse in the right direction, LED 4-7 should turn on.