Touch device generic API

Define the generic API of a touch device. More...

Detailed Description

Define the generic API of a touch device.

Warning
This feature is experimental! This API is experimental and in an early state - expect changes!
Author
Alexandre Abadie alexa.nosp@m.ndre.nosp@m..abad.nosp@m.ie@i.nosp@m.nria..nosp@m.fr

Data Structures

struct  touch_t
 Touch coordinates. More...
 
struct  touch_dev_driver_t
 Generic type for a touch driver. More...
 
struct  touch_dev
 Generic type for a touch device. More...
 
struct  touch_dev_reg
 Touch dev registry entry. More...
 

Typedefs

typedef struct touch_dev touch_dev_t
 Forward declaration for touch device struct.
 
typedef void(* touch_event_cb_t) (void *arg)
 Signature of touch event callback triggered from interrupt. More...
 
typedef struct touch_dev_reg touch_dev_reg_t
 Touch dev registry entry.
 

Functions

int touch_dev_reg_add (touch_dev_reg_t *dev)
 Add pointer to a touch device item to the list of touch items. More...
 
touch_dev_reg_ttouch_dev_reg_find_screen (uint8_t screen_id)
 Find the touch device that is attached to a given screen. More...
 
uint16_t touch_dev_height (const touch_dev_t *dev)
 Get the height of the touch device. More...
 
uint16_t touch_dev_width (const touch_dev_t *dev)
 Get the width of the touch device. More...
 
uint8_t touch_dev_touches (const touch_dev_t *dev, touch_t *touches, size_t len)
 Get the current touches on the touch device. More...
 
void touch_dev_set_touch_event_callback (const touch_dev_t *dev, touch_event_cb_t cb, void *arg)
 Set and configure the touch event callback. More...
 

Variables

touch_dev_reg_ttouch_dev_reg
 Export the touch device registry as global variable.
 

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 49 of file touch_dev.h.

Function Documentation

◆ touch_dev_height()

uint16_t touch_dev_height ( const touch_dev_t dev)

Get the height of the touch device.

Parameters
[in]devPointer to the touch device
Returns
Height in points

◆ touch_dev_reg_add()

int touch_dev_reg_add ( touch_dev_reg_t dev)

Add pointer to a touch device item to the list of touch items.

Parameters
[in]devPointer to the touch device
Returns
0 on success
-ENODEV on invalid entry

◆ touch_dev_reg_find_screen()

touch_dev_reg_t* touch_dev_reg_find_screen ( uint8_t  screen_id)

Find the touch device that is attached to a given screen.

Parameters
[in]screen_idIdentifier (number) of the screen
Returns
pointer to the touch device in the registry
NULL if there's no match

◆ touch_dev_set_touch_event_callback()

void touch_dev_set_touch_event_callback ( const touch_dev_t dev,
touch_event_cb_t  cb,
void *  arg 
)

Set and configure the touch event callback.

Parameters
[in]devPointer to the touch device
[in]cbThe callback function
[in]argContext argument

◆ touch_dev_touches()

uint8_t touch_dev_touches ( const touch_dev_t dev,
touch_t touches,
size_t  len 
)

Get the current touches on the touch device.

If touches is NULL, this function only returns the number of touches.

Touch position coordinates use the top left corner as origin.

Parameters
[in]devPointer to the touch device
[out]touchesThe array of touches
[in]lenThe touches array len
Returns
number of touch positions, 0 means no touch

◆ touch_dev_width()

uint16_t touch_dev_width ( const touch_dev_t dev)

Get the width of the touch device.

Parameters
[in]devPointer to the touch device
Returns
Width in points