All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
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(* stmpe811_event_cb_t) (void *arg)
 Signature of touch event callback triggered from interrupt.
 

Enumerations

enum  stmpe811_touch_state_t { STMPE811_TOUCH_STATE_PRESSED , STMPE811_TOUCH_STATE_RELEASED }
 Touch state enum. More...
 
enum  stmpe811_touch_conv_t { STMPE811_NO_CONV = 0x00 , STMPE811_MIRROR_X = 0x01 , STMPE811_MIRROR_Y = 0x02 , STMPE811_SWAP_XY = 0x04 }
 Touch screen coordinate conversions. More...
 

Functions

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

Typedef Documentation

◆ stmpe811_event_cb_t

typedef void(* stmpe811_event_cb_t) (void *arg)

Signature of touch event callback triggered from interrupt.

Parameters
[in]argoptional context for the callback

Definition at line 81 of file stmpe811.h.

Enumeration Type Documentation

◆ stmpe811_touch_conv_t

Touch screen coordinate conversions.

Normally the coordinates of the touch device must be converted to the screen coordinates by swapping and/or mirroring. The flags defined by this enumeration can be ORed for a combined conversion. In this case, the swapping is performed before the mirroring.

Note
The maximum X and Y screen coordinates defined by stmpe811_params_t::xmax and stmpe811_params_t::ymax define the dimension of the touch device in screen coordinates, i.e. after conversion.
Enumerator
STMPE811_NO_CONV 

No conversion.

STMPE811_MIRROR_X 

Mirror X, applied after optional swapping.

STMPE811_MIRROR_Y 

Mirror Y, applied after optional swapping.

STMPE811_SWAP_XY 

Swap XY, applied before optional mirroring.

Definition at line 61 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 43 of file stmpe811.h.

Function Documentation

◆ stmpe811_init()

int stmpe811_init ( stmpe811_t * dev,
const stmpe811_params_t * params,
stmpe811_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
0 on success
-ENODEV when no valid device
-EIO when software reset failed
-EPROTO on any bus 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
0 on success
-EPROTO on any bus 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
0 on success
-EPROTO on any busI2aC error