Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ADNS5020EN Class Reference
Interface to control a ADNS-5020-EN Avago mouse chip using a SPI and 2 DigitalOuts. More...
#include <ADNS5020EN.h>
Public Member Functions | |
| ADNS5020EN (PinName mosi, PinName miso, PinName sclk, PinName cs, PinName cr, float freq) | |
| Create the mouse chip control interface. | |
| void | read_deltas (int *a_dx, int *a_dy) |
| Read the deltaX and deltaY registers and assign to the input variable the counts for the previous read. | |
| void | read_deltas_mm (float *dx, float *dy) |
| Same as the read_deltas() function but the return is the movement in mm according to the working resolution. | |
| void | end () |
| Chip Power Down. | |
| void | set_freq (float freq) |
| Set new operating frequency to the mouse chip. | |
| int | falser () |
| Get the false readings of the mouse chip. | |
| int | changeCPI (bool cpi) |
| Change the resolution of the mouse chip. | |
Detailed Description
Interface to control a ADNS-5020-EN Avago mouse chip using a SPI and 2 DigitalOuts.
Definition at line 10 of file ADNS5020EN.h.
Constructor & Destructor Documentation
| ADNS5020EN | ( | PinName | mosi, |
| PinName | miso, | ||
| PinName | sclk, | ||
| PinName | cs, | ||
| PinName | cr, | ||
| float | freq | ||
| ) |
Create the mouse chip control interface.
Returns Error if the connection is not established.
- Parameters:
-
mosi A SPI(mosi) pin, for the spi interface of the mouse chip (SDIO) miso A SPI(miso) pin, for the spi interface of the mouse chip (SDIO) sclk A SPI(sclk) pin, for the spi interface of the mouse chip (SCLK) cs A DigitalOut, set low for chip select cr A DigitalOut, set los for chip reset freq A float value between 1.0 and 0.1 for the SPI frequency(in MHz)
Definition at line 3 of file ADNS5020EN.cpp.
Member Function Documentation
| int changeCPI | ( | bool | cpi = 0 ) |
Change the resolution of the mouse chip.
- Parameters:
-
cpi A bool value where 0 is 500cpi (default) and 1 is 1000cpi
- Returns:
- The mouse control register value
Definition at line 96 of file ADNS5020EN.cpp.
| void end | ( | ) |
Chip Power Down.
Definition at line 83 of file ADNS5020EN.cpp.
| int falser | ( | ) |
Get the false readings of the mouse chip.
- Returns:
- The false readings
Definition at line 77 of file ADNS5020EN.cpp.
| void read_deltas | ( | int * | a_dx, |
| int * | a_dy | ||
| ) |
Read the deltaX and deltaY registers and assign to the input variable the counts for the previous read.
- Parameters:
-
a_dx A pointer to an integer, to return the value of the deltaX register in reading counts a_dy A pointer to an integer, to return the value of the deltaY register in reading counts
Definition at line 30 of file ADNS5020EN.cpp.
| void read_deltas_mm | ( | float * | dx, |
| float * | dy | ||
| ) |
Same as the read_deltas() function but the return is the movement in mm according to the working resolution.
- Parameters:
-
a_dx A pointer to a float, to return the value of the deltaX register in mm a_dy A pointer to a float, to return the value of the deltaY register in mm
- See also:
- read_deltas()
- changeCPI()
Definition at line 55 of file ADNS5020EN.cpp.
| void set_freq | ( | float | freq ) |
Set new operating frequency to the mouse chip.
- Parameters:
-
freq A float value between 1.0 and 0.1 for the SPI frequency(in MHz)
Definition at line 71 of file ADNS5020EN.cpp.
Generated on Mon Aug 1 2022 10:22:01 by
1.7.2