STMPE811 Touchscreen Controller

Device driver interface for the STMPE811 touchscreen controller. More...

Detailed Description

Device driver interface for the STMPE811 touchscreen controller.

Files

file  stmpe811.h
 
file  stmpe811_constants.h
 Constants for STMPE811.
 
file  stmpe811_params.h
 Default configuration for STMPE811.
 
file  stmpe811_touch_dev.h
 Definition of the driver for the touch_dev generic interface.
 

Data Structures

struct  stmpe811_touch_position_t
 Touch position structure. More...
 
struct  stmpe811_params_t
 Device initialization parameters. More...
 
struct  stmpe811_t
 Device descriptor for the STMPE811 sensor. More...
 

Typedefs

typedef void(* touch_event_cb_t) (void *arg)
 Signature of touch event callback triggered from interrupt. More...
 

Enumerations

enum  { STMPE811_OK = 0, STMPE811_ERR_I2C, STMPE811_ERR_NODEV, STMPE811_ERR_RESET }
 Return codes. More...
 
enum  stmpe811_touch_state_t { STMPE811_TOUCH_STATE_PRESSED, STMPE811_TOUCH_STATE_RELEASED }
 Touch state enum. More...
 

Functions

int stmpe811_init (stmpe811_t *dev, const stmpe811_params_t *params, touch_event_cb_t cb, void *arg)
 Initialize the given STMPE811 device. More...
 
int stmpe811_read_touch_position (stmpe811_t *dev, stmpe811_touch_position_t *position)
 Read the touch position. More...
 
int stmpe811_read_touch_state (const stmpe811_t *dev, stmpe811_touch_state_t *state)
 Read the touch state (pressed or released) More...
 

Typedef Documentation

◆ touch_event_cb_t

typedef void(* touch_event_cb_t) (void *arg)

Signature of touch event callback triggered from interrupt.

Parameters
[in]argoptional context for the callback

Definition at line 67 of file stmpe811.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Return codes.

Enumerator
STMPE811_OK 

Everything was fine.

STMPE811_ERR_I2C 

Error on the I2C bus.

STMPE811_ERR_NODEV 

No valid device on I2C bus.

STMPE811_ERR_RESET 

Software reset failed.

Definition at line 39 of file stmpe811.h.

◆ stmpe811_touch_state_t

Touch state enum.

Enumerator
STMPE811_TOUCH_STATE_PRESSED 

Touchscreen is pressed.

STMPE811_TOUCH_STATE_RELEASED 

Touchscreen is released.

Definition at line 49 of file stmpe811.h.

Function Documentation

◆ stmpe811_init()

int stmpe811_init ( stmpe811_t dev,
const stmpe811_params_t params,
touch_event_cb_t  cb,
void *  arg 
)

Initialize the given STMPE811 device.

Parameters
[in,out]devDevice descriptor of the STMPE811
[in]paramsInitialization parameters of the STMPE811 device
[in]cbCallback function called on touch interrupts
[in]argContext argument used in callback function
Returns
STMPE811_OK on success
-STMPE811_ERR_NODEV when no valid device
-STMPE811_ERR_RESET when software reset failed
-STMPE811_ERR_I2C on any I2C error

◆ stmpe811_read_touch_position()

int stmpe811_read_touch_position ( stmpe811_t dev,
stmpe811_touch_position_t position 
)

Read the touch position.

Parameters
[in]devDevice descriptor of the STMPE811
[out]positionTouch position
Returns
STMPE811_OK on success
-STMPE811_ERR_I2C on any I2C error

◆ stmpe811_read_touch_state()

int stmpe811_read_touch_state ( const stmpe811_t dev,
stmpe811_touch_state_t state 
)

Read the touch state (pressed or released)

Parameters
[in]devDevice descriptor of the STMPE811
[out]stateTouch state
Returns
STMPE811_OK on success
-STMPE811_ERR_I2C on any I2C error