thumbstick 2.0.0.0
thumbstick.h File Reference

This file contains API for Thumbstick Click driver. More...

#include "drv_digital_in.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  thumbstick_t
 Click ctx object definition. More...
 
struct  thumbstick_cfg_t
 Click configuration structure definition. More...
 
struct  thumbstick_position_t
 Click configuration structure definition. More...
 

Macros

#define THUMBSTICK_MAP_MIKROBUS(cfg, mikrobus)
 
#define THUMBSTICK_RETVAL   uint8_t
 
#define THUMBSTICK_OK   0x00
 
#define THUMBSTICK_INIT_ERROR   0xFF
 
#define THUMBSTICK_FUNCTION_ERROR   0xEE
 
#define THUMBSTICK_START_SINGLE_CONV   0x06
 
#define THUMBSTICK_START_DIFF_CONV   0x04
 
#define THUMBSTICK_VERTICAL   0x00
 
#define THUMBSTICK_HORIZONTAL   0x60
 
#define THUMBSTICK_POSITION_DEFAULT   0x01
 
#define THUMBSTICK_POSITION_TOP   0x02
 
#define THUMBSTICK_POSITION_RIGHT   0x03
 
#define THUMBSTICK_POSITION_BOTTOM   0x04
 
#define THUMBSTICK_POSITION_LEFT   0x05
 
#define THUMBSTICK_BUTTON_INACTIVE   0x00
 
#define THUMBSTICK_BUTTON_ACTIVE   0x01
 
#define POSTION_SENS_DEFAULT   500
 
#define THUMBSTICK_PRESS_BUTTON   0x00
 

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.
 

Detailed Description

This file contains API for Thumbstick Click driver.