thumbstick 2.0.0.0
|
Functions | |
void | thumbstick_cfg_setup (thumbstick_cfg_t *cfg) |
Config Object Initialization function. | |
THUMBSTICK_RETVAL | thumbstick_init (thumbstick_t *ctx, thumbstick_cfg_t *cfg) |
Initialization function. | |
void | thumbstick_generic_transfer (thumbstick_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len) |
Generic transfer function. | |
uint16_t | thumbstick_read_rawadc (thumbstick_t *ctx, uint8_t type, uint8_t channel) |
Generic read 2 byte of data function. | |
uint8_t | thumbstick_get_single_axis_postion (thumbstick_t *ctx, uint8_t axis) |
Get thumbstick position by axis function. | |
void | thumbstick_get_position (thumbstick_t *ctx, thumbstick_position_t *position) |
Get thumbstick position by axis function. | |
uint8_t | thumbstick_button_state (thumbstick_t *ctx) |
Get state of thumbstick button function. | |
uint8_t | thumbstick_set_sensitivity (uint16_t sensitivity) |
Set thumbstick sensitivity. | |
uint8_t thumbstick_button_state | ( | thumbstick_t * | ctx | ) |
Get state of thumbstick button function.
- 1 : not active; - 0 : active; *
@description Function return state of thumbstick button 0 or 1 by read state of INT pin from MCP3204 chip of the Thumbstick Click.
void thumbstick_cfg_setup | ( | thumbstick_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
@description This function initializes click configuration structure to init state.
void thumbstick_generic_transfer | ( | thumbstick_t * | ctx, |
uint8_t * | wr_buf, | ||
uint16_t | wr_len, | ||
uint8_t * | rd_buf, | ||
uint16_t | rd_len ) |
Generic transfer function.
ctx | Click object. |
wr_buf | Write data buffer |
wr_len | Number of byte in write data buffer |
rd_buf | Read data buffer |
rd_len | Number of byte in read data buffer |
@description Generic SPI transfer, for sending and receiving packages
void thumbstick_get_position | ( | thumbstick_t * | ctx, |
thumbstick_position_t * | position ) |
Get thumbstick position by axis function.
postion | Potion data struct that stores data of axis thumbstic postion |
@description Function get position of thumbstick.
uint8_t thumbstick_get_single_axis_postion | ( | thumbstick_t * | ctx, |
uint8_t | axis ) |
Get thumbstick position by axis function.
axis | - Channel: - 0x00 : horizontal axis; - 0x60 : vertical axis; * |
- 1 : Default Position; - 2 : Top Position; - 3 : Right Position; - 4 : Bottom Position; - 5 : Left Position; - 0xEE: Error Parameter; *
@description Function get position of thumbstick, return position state value from 1 to 5 that calculeted by the value read ADC value from the MCP3204 chip.
THUMBSTICK_RETVAL thumbstick_init | ( | thumbstick_t * | ctx, |
thumbstick_cfg_t * | cfg ) |
Initialization function.
thumbstick | Click object. |
cfg | Click configuration structure. |
@description This function initializes all necessary pins and peripherals used for this click.
uint16_t thumbstick_read_rawadc | ( | thumbstick_t * | ctx, |
uint8_t | type, | ||
uint8_t | channel ) |
Generic read 2 byte of data function.
type | - Channel: - 0x06 : single channel adc; - 0x04 : difference channell adc; * |
channel | - Channel: - 0x00 : horizontal channel; - 0x60 : vertical channel; * |
@description Function read 12-bit ADC data from selected channel from MCP3204 chip of the Thumbstick Click.
uint8_t thumbstick_set_sensitivity | ( | uint16_t | sensitivity | ) |
Set thumbstick sensitivity.
sensitivity | variable that offsets changeing state of thumbstick sensing state |
- 0x00: OK - 0xEE: Error *
@description Function for setting sensitivity that state of thumbstick changes states.