PIC software documentation
|
A simple driver for the FT5x06 touch controller using I²C. More...
Files | |
file | ft5x06.h |
Classes | |
struct | touchCoor |
Information about where the touch occurred on the touch surface and what kind of event it is. More... | |
struct | touchInfo |
Information about gesture (if recognised) and the registered touch points. More... |
Macros | |
#define | FT5X06_I2C_ADDR 0x38 |
FT5x06 I²C address. |
Enumerations | |
enum | ft5x06_gesture { FT5X06_GESTURE_none = 0x00, FT5X06_GESTURE_up = 0x10, FT5X06_GESTURE_left = 0x14, FT5X06_GESTURE_down = 0x18, FT5X06_GESTURE_right = 0x1c, FT5X06_GESTURE_zoomIn = 0x48, FT5X06_GESTURE_zoomOut = 0x49 } |
Types of gestures the FT5x06 can recognise. More... | |
enum | ft5x06_touchEvent { FT5X06_EVENT_putDown = 0, FT5X06_EVENT_putUp = 1, FT5X06_EVENT_contact = 2, FT5X06_EVENT_invalid = 3 } |
Type of touch event. More... | |
enum | ft5x06_retrieveTouchInfoRetVal { FT5X06_RETTOUCH_OK = 0, FT5X06_RETTOUCH_ERR_I2C_ERROR = 1, FT5X06_RETTOUCH_NULL_ARG = 2, FT5X06_RETTOUCH_ERR_NUM_POINTS = 3, FT5X06_RETTOUCH_ERR_EVENT = 4 } |
ft5x06_queryTouchInfo() return values More... |
Functions | |
void | ft5x06_queryTouchInfo (int numPoints) |
Query the FT5x06 chip on the I²C bus for touch data. | |
int | ft5x06_retrieveTouchInfo (struct touchInfo *touchInfo) |
Parse touch data from I²C RX buffer. |
A simple driver for the FT5x06 touch controller using I²C.
Implementation is based on the I²C driver and requires the user to query for touch data, wait until the I²C driver has finished receiving and then retrieve the data from the I²C RX buffer. Touch data should only be queried when the FT5x06 controller has sent an interrupt.
struct touchCoor |
Information about where the touch occurred on the touch surface and what kind of event it is.
As long as the FT5x06 touch controller is correctly configured, coordinates will be within the defined width and height. Origo is top-left corner. Coordinates are not valid when event is FT5X06_EVENT_putUp. See ft5x06_touchEvent.
Class Members | ||
---|---|---|
enum ft5x06_touchEvent | event | Touch event (see ft5x06_touchEvent ) |
unsigned int | x | X coordinate |
unsigned int | y | Y coordinate |
struct touchInfo |
Information about gesture (if recognised) and the registered touch points.
Note that touch points with the FT5X06_EVENT_putUp event are not included in the numPoints count (see ft5x06_touchEvent).
Class Members | ||
---|---|---|
unsigned char | gesture | Gesture (if any recognised) (see ft5x06_gesture) |
unsigned char | numPoints | Number of touch points registered |
struct touchCoor | points | Array of registered touch points. If numPoints is not 5, the remaining touchCoor objects in the array have undefined values. |
enum ft5x06_gesture |
Types of gestures the FT5x06 can recognise.
ft5x06_queryTouchInfo() return values
FT5X06_RETTOUCH_OK |
Everything went fine |
FT5X06_RETTOUCH_ERR_I2C_ERROR |
An I²C error occurred. Check i2c_error for more information about the error |
FT5X06_RETTOUCH_NULL_ARG |
touchInfo was NULL |
FT5X06_RETTOUCH_ERR_NUM_POINTS |
The number of points reported from the I²C data was incorrect. This may indicate corrupt I²C data or a bug. |
FT5X06_RETTOUCH_ERR_EVENT |
This is guaranteed to be a bug |
enum ft5x06_touchEvent |
Type of touch event.
void ft5x06_queryTouchInfo | ( | int | numPoints | ) |
Query the FT5x06 chip on the I²C bus for touch data.
The I²C driver must be initialised and idle.
numPoints | number of touch points to query |
int ft5x06_retrieveTouchInfo | ( | struct touchInfo * | touchInfo | ) |
Parse touch data from I²C RX buffer.
Events will stored for all points queried by ft5x06_queryTouchInfo(), but coordinates will only be stored for active points. The I²Cdriver" must be initialised and idle.
touchInfo | object to populate |