nRF51 SDK - S120 SoftDevice
|
ADNS2080 mouse sensor driver. More...
Enumerations | |
enum | adns2080_status_t { ADNS2080_OK, ADNS2080_SERIAL_COMM_FAILURE, ADNS2080_CHIP_NOT_DETECTED, ADNS2080_INVALID_PARAMETER } |
enum | motion_output_polarity_t { ADNS2080_MOTION_OUTPUT_POLARITY_LOW = 0, ADNS2080_MOTION_OUTPUT_POLARITY_HIGH = 1 } |
enum | motion_output_sensitivity_t { ADNS2080_MOTION_OUTPUT_SENSITIVITY_LEVEL = 0, ADNS2080_MOTION_OUTPUT_SENSITIVITY_EDGE = 1 } |
enum | adns2080_resolution_t { ADNS2080_RESOLUTION_250DPI = 1, ADNS2080_RESOLUTION_500DPI = 2, ADNS2080_RESOLUTION_1000DPI = 0, ADNS2080_RESOLUTION_1250DPI = 3, ADNS2080_RESOLUTION_1500DPI = 4, ADNS2080_RESOLUTION_1750DPI = 5, ADNS2080_RESOLUTION_2000DPI = 6 } |
enum | adns2080_mode_t { ADNS2080_MODE_NORMAL = 0, ADNS2080_MODE_REST1 = 1, ADNS2080_MODE_REST2 = 2, ADNS2080_MODE_REST3 = 3, ADNS2080_MODE_RUN1 = 4, ADNS2080_MODE_RUN2 = 5, ADNS2080_MODE_IDLE = 6 } |
enum | adns2080_motion_bits_t { ADNS2080_MOTION_BITS_8 = 0, ADNS2080_MOTION_BITS_12 = 1 } |
Functions | |
adns2080_status_t | adns2080_init (void) |
Function for initializing the mouse sensor chip. More... | |
void | adns2080_reset (void) |
Function for resetting the mouse sensor chip. More... | |
uint8_t | adns2080_product_id_read (void) |
Function for reading mouse sensor product ID. More... | |
uint8_t | adns2080_revision_id_read (void) |
Function for reading mouse sensor revision ID. More... | |
void | adns2080_powerdown (void) |
Function for powering down the mouse sensor. More... | |
void | adns2080_wakeup (void) |
Function for waking up the mouse sensor. More... | |
adns2080_status_t | adns2080_motion_interrupt_set (motion_output_polarity_t polarity, motion_output_sensitivity_t sensitivity) |
Function for configuring the MOTION interrupt output pin. More... | |
adns2080_status_t | adns2080_resolution_set (adns2080_resolution_t resolution) |
Function for setting mouse sensor resolution. More... | |
adns2080_status_t | adns2080_motion_bits_set (adns2080_motion_bits_t motion_bits) |
Function for setting number of bits used for mouse sensor motion reporting. More... | |
adns2080_motion_bits_t | adns2080_motion_bits_read (void) |
Function for reading number of bits used for mouse sensor motion reporting. More... | |
void | adns2080_movement_read (int16_t *p_delta_x, int16_t *p_delta_y) |
Function for reading X- and Y-axis movement (in counts) since last report. More... | |
bool | adns2080_is_motion_detected (void) |
Function for checking if motion has been detected since last call. More... | |
void | adns2080_rest_periods_set (uint8_t rest1_period, uint8_t rest2_period, uint8_t rest3_period) |
Function for setting mouse sensor Rest1, Rest2 and Rest3 mode motion detection time period. More... | |
void | adns2080_downshift_times_set (uint8_t run_to_rest1_mode_time, uint8_t rest1_to_rest2_mode_time, uint8_t rest2_to_rest3_mode_time) |
Function for setting mouse sensor mode downshift time periods. More... | |
void | adns2080_force_mode_set (adns2080_mode_t mode) |
Function for forcing mouse sensor to a certain operating mode. More... | |
adns2080_mode_t | adns2080_force_mode_read (void) |
Function for reading the current forced operating mode. More... | |
ADNS2080 mouse sensor driver.
enum adns2080_mode_t |
Mouse sensor forced mode options.
Mouse sensor resolution values.
enum adns2080_status_t |
Describes return values for adns2080_init.
Motion output pin configuration.
void adns2080_downshift_times_set | ( | uint8_t | run_to_rest1_mode_time, |
uint8_t | rest1_to_rest2_mode_time, | ||
uint8_t | rest2_to_rest3_mode_time | ||
) |
Function for setting mouse sensor mode downshift time periods.
Allowed range for run_to_rest1_mode_time period is 0x00 to 0xFF. Allowed range for rest1_to_rest2_mode_time period is 0x01 to 0xFF. Allowed range for rest2_to_rest3_mode_time period is 0x01 to 0xFF.
Chip is expected to be initialized before calling this function.
run_to_rest1_mode_time | Run mode to Rest1 mode downshift time period (Time = run_to_rest1_mode_time * 8 * 4) |
rest1_to_rest2_mode_time | Rest1 mode to Rest2 mode downshift time period (Time = rest1_to_rest2_mode_time * rest1_period * 16) |
rest2_to_rest3_mode_time | Rest2 mode to Rest3 mode downshift time period (Time = rest2_to_rest3_mode_time * rest2_period * 128) |
adns2080_mode_t adns2080_force_mode_read | ( | void | ) |
Function for reading the current forced operating mode.
Chip is expected to be initialized before calling this function.
void adns2080_force_mode_set | ( | adns2080_mode_t | mode | ) |
Function for forcing mouse sensor to a certain operating mode.
Chip is expected to be initialized before calling this function. Normal operation will not continue until this function is called with ADNS2080_MODE_NORMAL parameter.
mode | Mode to force the sensor to. |
adns2080_status_t adns2080_init | ( | void | ) |
Function for initializing the mouse sensor chip.
Valid mouse sensor information will be available 50 milliseconds after this function finishes.
ADNS2080_OK | Mouse sensor was initialized succesfully. |
ADNS2080_SERIAL_COMM_FAILURE | Serial communications failure. |
ADNS2080_CHIP_NOT_DETECTED | Could not find revision 0 ADNS2080 chip. |
bool adns2080_is_motion_detected | ( | void | ) |
Function for checking if motion has been detected since last call.
Chip is expected to be initialized before calling this function.
true,if | movement has been detected |
false,if | no movement has been detected |
adns2080_motion_bits_t adns2080_motion_bits_read | ( | void | ) |
Function for reading number of bits used for mouse sensor motion reporting.
Chip is expected to be initialized before calling this function.
adns2080_status_t adns2080_motion_bits_set | ( | adns2080_motion_bits_t | motion_bits | ) |
Function for setting number of bits used for mouse sensor motion reporting.
Chip is expected to be initialized before calling this function.
motion_bits | Desired number of bits. |
ADNS2080_OK | Operation succeeded. |
ADNS2080_INVALID_PARAMETER | One of the parameters was not within valid range. |
adns2080_status_t adns2080_motion_interrupt_set | ( | motion_output_polarity_t | polarity, |
motion_output_sensitivity_t | sensitivity | ||
) |
Function for configuring the MOTION interrupt output pin.
When motion is detected by the mouse sensor, the chip has a MOTION pin indicating there is motion data in DELTA_X and DELTA_Y registers. This function configures the polarity and sensitivity of that pin.
Chip is expected to be initialized before calling this function.
polarity | MOTION output pin is either active LOW (default) or active HIGH |
sensitivity | Level or Edge (default) sensitive |
ADNS2080_OK | Operation succeeded. |
ADNS2080_INVALID_PARAMETER | One of the parameters was not within valid range. |
void adns2080_movement_read | ( | int16_t * | p_delta_x, |
int16_t * | p_delta_y | ||
) |
Function for reading X- and Y-axis movement (in counts) since last report.
Absolute value is determined by resolution. Chip is expected to be initialized before calling this function.
p_delta_x | Location to store X-axis movement |
p_delta_y | Location to store Y-axis movement |
void adns2080_powerdown | ( | void | ) |
Function for powering down the mouse sensor.
Chip is expected to be initialized before calling this function. Serial port should not be accessed during the power down. To exit the power down mode, adns2080_wakeup must be called.
uint8_t adns2080_product_id_read | ( | void | ) |
Function for reading mouse sensor product ID.
Chip is expected to be initialized before calling this function. Returned product ID should always be 0x2A.
void adns2080_reset | ( | void | ) |
Function for resetting the mouse sensor chip.
Valid mouse sensor information will be available 50 milliseconds after this function finishes. All register settings will be lost and need to be reloaded.
adns2080_status_t adns2080_resolution_set | ( | adns2080_resolution_t | resolution | ) |
Function for setting mouse sensor resolution.
Chip is expected to be initialized before calling this function.
resolution | Desired resolution. |
ADNS2080_OK | Operation succeeded. |
ADNS2080_INVALID_PARAMETER | One of the parameters was not within valid range. |
void adns2080_rest_periods_set | ( | uint8_t | rest1_period, |
uint8_t | rest2_period, | ||
uint8_t | rest3_period | ||
) |
Function for setting mouse sensor Rest1, Rest2 and Rest3 mode motion detection time period.
Allowed range for the periods is 0x01 to 0xFD. Resulting period is derived from the following equation : Period = (Rest period + 1) * 10 milliseconds Chip is expected to be initialized before calling this function.
rest1_period | Rest1 period |
rest2_period | Rest2 period |
rest3_period | Rest3 period |
uint8_t adns2080_revision_id_read | ( | void | ) |
Function for reading mouse sensor revision ID.
Chip is expected to be initialized before calling this function.
void adns2080_wakeup | ( | void | ) |
Function for waking up the mouse sensor.
After wakeup, all mouse sensor settings must be reloaded. Valid mouse sensor information will be available 55 milliseconds after this function finishes.