nRF51 SDK
|
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.
Instructions on how to set up the nRFgo Motherboard: nRFgo Motherboard Setup (nRF6310).
LED assignments :
The ADNS2080 Mouse Sensor Driver Example Application can be tested as follows: