discoverpixy
Data Structures | Typedefs | Enumerations | Functions
Touch

Data Structures

struct  TOUCH_AREA_STRUCT
 
struct  POINT_STRUCT
 

Typedefs

typedef void(* TOUCH_CALLBACK) (void *touchArea, TOUCH_ACTION triggeredAction)
 

Enumerations

enum  TOUCH_STATE { TOUCH_UP, TOUCH_DOWN }
 
enum  TOUCH_ACTION {
  NONE =0x00, PEN_DOWN =0x01, PEN_UP =0x02, PEN_ENTER =0x04,
  PEN_LEAVE =0x08, PEN_MOVE =0x10
}
 

Functions

bool touch_init ()
 
bool touch_add_raw_event (uint16_t x, uint16_t y, TOUCH_STATE state)
 
bool touch_have_empty (unsigned char num)
 
bool touch_register_area (TOUCH_AREA_STRUCT *area)
 
void touch_unregister_area (TOUCH_AREA_STRUCT *area)
 
POINT_STRUCT touch_get_last_point ()
 

Detailed Description

The Touch module provides access to the touch controller, and executes a callback if a certain region is touched

Typedef Documentation

typedef void(* TOUCH_CALLBACK) (void *touchArea, TOUCH_ACTION triggeredAction)

Prototype for Event Listeners (called for every occurring, hooked action)

Parameters
touchAreaThe pointer to the TOUCH_AREA_STRUCT in which the event occurred
triggeredActionThe Action which occurred

Enumeration Type Documentation

Enum to describe the hooked actions for which you want to receive events for. You can OR-combine them.

See also
touch_register_area
Enumerator
NONE 

Do not receive any events.

PEN_DOWN 

Receive an event when the pen goes down inside the region.

PEN_UP 

Receive an event when the pen goes up inside the region.

PEN_ENTER 

Receive an event when the pen enters the region (pen was down before)

PEN_LEAVE 

Receive an event when the pen leaves the region (pen was inside region before)

PEN_MOVE 

Receive an event when the pen moves inside the region (pen is down)

Enum to describe the current Touch State.

See also
touch_add_raw_event
Enumerator
TOUCH_UP 

The display is currently not touched.

TOUCH_DOWN 

The display is currently touched at some point.

Function Documentation

bool touch_add_raw_event ( uint16_t  x,
uint16_t  y,
TOUCH_STATE  state 
)

Processes a native touch event. Call this function when the pen goes down (TOUCH_DOWN), when it moves (TOUCH_DOWN) and also when it goes up again (TOUCH_UP)! It's safe to call this function from an (SPI)-Interrupt.

Parameters
xThe x-Coordinate of the touch event
yThe y-Coordinate of the touch event
stateWhether the pen is up or down
Returns
True on success
POINT_STRUCT touch_get_last_point ( )

Gets the last touched point

Returns
The Coordinates of the last touched points

Here is the caller graph for this function:

bool touch_have_empty ( unsigned char  num)

Checks whether or not we have memory to manage and track additional num TOUCH_AREA_STRUCTs

Parameters
numThe number of touch areas you would like to allocate
Returns
True if there's enough memory to allocate num TOUCH_AREAs

Here is the caller graph for this function:

bool touch_init ( )

Initializes the Touch Controller. Call this method before using any touch_* functions

Returns
true on success

Here is the call graph for this function:

Here is the caller graph for this function:

bool touch_register_area ( TOUCH_AREA_STRUCT area)

Registers a new touch Area. You will receive events for this area from now on.

Parameters
areaA pointer to the configured TOUCH_AREA_STRUCT
Returns
True if everything was successful and the corresponding Touch Area will be monitored from now on

Here is the caller graph for this function:

void touch_unregister_area ( TOUCH_AREA_STRUCT area)

Unregisters a touch area. You will no longer receive events for this area

Parameters
areaA pointer to the TOUCH_AREA_STRUCT instance

Here is the caller graph for this function: