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

Modules

 main.c
 ADNS2080 Mouse Sensor Driver Application main file.
 

Detailed Description

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).

LED assignments :

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.