IPAB Neuromorphic / ADNS5020EN
Embed: (wiki syntax)

« Back to documentation index

ADNS5020EN Class Reference

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:
mosiA SPI(mosi) pin, for the spi interface of the mouse chip (SDIO)
misoA SPI(miso) pin, for the spi interface of the mouse chip (SDIO)
sclkA SPI(sclk) pin, for the spi interface of the mouse chip (SCLK)
csA DigitalOut, set low for chip select
crA DigitalOut, set los for chip reset
freqA 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:
cpiA 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_dxA pointer to an integer, to return the value of the deltaX register in reading counts
a_dyA 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_dxA pointer to a float, to return the value of the deltaX register in mm
a_dyA 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:
freqA float value between 1.0 and 0.1 for the SPI frequency(in MHz)

Definition at line 71 of file ADNS5020EN.cpp.