thumbstick  2.0.0.0
Functions

Functions

void thumbstick_cfg_setup (thumbstick_cfg_t *cfg)
 Config Object Initialization function. More...
 
THUMBSTICK_RETVAL thumbstick_init (thumbstick_t *ctx, thumbstick_cfg_t *cfg)
 Initialization function. More...
 
void thumbstick_generic_transfer (thumbstick_t *ctx, spi_master_transfer_data_t *block)
 Generic transfer function. More...
 
uint16_t thumbstick_read_data (thumbstick_t *ctx, uint8_t channel)
 Generic read 2 byte of data function. More...
 
uint8_t thumbstick_get_position (thumbstick_t *ctx)
 Get thumbstick position function. More...
 
uint8_t thumbstick_button_state (thumbstick_t *ctx)
 Get state of thumbstick button function. More...
 

Detailed Description

Function Documentation

◆ thumbstick_button_state()

uint8_t thumbstick_button_state ( thumbstick_t ctx)

Get state of thumbstick button function.

Returns
state of thumbstick button:
  • 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.

◆ thumbstick_cfg_setup()

void thumbstick_cfg_setup ( thumbstick_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ thumbstick_generic_transfer()

void thumbstick_generic_transfer ( thumbstick_t ctx,
spi_master_transfer_data_t *  block 
)

Generic transfer function.

Parameters
ctxClick object.
blockTransfer block structure.

@description Generic SPI transfer, for sending and receiving packages

◆ thumbstick_get_position()

uint8_t thumbstick_get_position ( thumbstick_t ctx)

Get thumbstick position function.

Returns
8-bit data of position
  • 0 : Start Position;
  • 1 : Top Position;
  • 2 : Right Position;
  • 3 : Bottom Position;
  • 4 : Left Position; *

@description Function get position of thumbstick, return position state value from 0 to 5 that calculeted by the value read ADC value from the MCP3204 chip.

◆ thumbstick_init()

THUMBSTICK_RETVAL thumbstick_init ( thumbstick_t ctx,
thumbstick_cfg_t cfg 
)

Initialization function.

Parameters
thumbstickClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ thumbstick_read_data()

uint16_t thumbstick_read_data ( thumbstick_t ctx,
uint8_t  channel 
)

Generic read 2 byte of data function.

Parameters
read_channel
  • Channel:
  • 1 : first channel;
  • 2 : secound channel; *
Returns
 14-bit read ADC data

@description Function read 14-bit ADC data from selected channel from MCP3204 chip of the Thumbstick Click.