46#include "drv_digital_out.h"
47#include "drv_digital_in.h"
56 { 0x00, TP_EVENT_GEST_NONE },
57 { 0x10, TP_EVENT_GEST_LEFT },
58 { 0x18, TP_EVENT_GEST_RIGHT },
59 { 0x1C, TP_EVENT_GEST_UP },
60 { 0x14, TP_EVENT_GEST_DOWN },
61 { 0x48, TP_EVENT_GEST_ZOOM_IN },
62 { 0x49, TP_EVENT_GEST_ZOOM_OUT }
69 { 0x00, TP_EVENT_GEST_NONE },
70 { 0x10, TP_EVENT_GEST_LEFT },
71 { 0x18, TP_EVENT_GEST_RIGHT },
72 { 0x1C, TP_EVENT_GEST_UP },
73 { 0x14, TP_EVENT_GEST_DOWN },
74 { 0x48, TP_EVENT_GEST_ZOOM_IN },
75 { 0x49, TP_EVENT_GEST_ZOOM_OUT }
82 { 0x00, TP_EVENT_GEST_NONE },
83 { 0x1C, TP_EVENT_GEST_LEFT },
84 { 0x14, TP_EVENT_GEST_RIGHT },
85 { 0x10, TP_EVENT_GEST_UP },
86 { 0x18, TP_EVENT_GEST_DOWN },
87 { 0x48, TP_EVENT_GEST_ZOOM_IN },
88 { 0x49, TP_EVENT_GEST_ZOOM_OUT }
95 { 0x00, TP_EVENT_GEST_NONE },
96 { 0x1C, TP_EVENT_GEST_LEFT },
97 { 0x14, TP_EVENT_GEST_RIGHT },
98 { 0x10, TP_EVENT_GEST_UP },
99 { 0x18, TP_EVENT_GEST_DOWN },
100 { 0x48, TP_EVENT_GEST_ZOOM_IN },
101 { 0x49, TP_EVENT_GEST_ZOOM_OUT }
115ft5xx6_read_press_coordinates(
ft5xx6_t * ctx );
126ft5xx6_read_gesture(
ft5xx6_t * ctx );
131 i2c_master_configure_default( &cfg->
i2c_cfg );
144 tp_event_t ( * tmp_ptr1 )(
ft5xx6_t * );
145 void ( * tmp_ptr2 )(
ft5xx6_t *, tp_touch_item_t * );
146 void ( * tmp_ptr3 )(
ft5xx6_t *, tp_event_t * );
147 tp_err_t ( * tmp_ptr4 )(
ft5xx6_t * );
161 if ( i2c_master_open( &ctx->
i2c, &cfg->
i2c_cfg ) == I2C_MASTER_ERROR )
163 return TP_ERR_INIT_DRV;
167 i2c_master_set_speed( &ctx->
i2c, I2C_MASTER_SPEED_STANDARD );
168 i2c_master_set_timeout( &ctx->
i2c, 0 );
170 if ( digital_in_init( &ctx->
int_pin, cfg->
int_pin ) == DIGITAL_IN_UNSUPPORTED_PIN )
172 return TP_ERR_UNSUPPORTED_PIN;
186 tmp_ptr2( NULL, NULL );
187 tmp_ptr3( NULL, NULL );
203 uint8_t tmp_data[ 2 ];
205 tmp_data[ 0 ] = reg_addr;
206 tmp_data[ 1 ] = data_in;
208 i2c_master_write( &ctx->
i2c, tmp_data, 2 );
218 i2c_master_write_then_read( &ctx->
i2c, &tmp_data, 1, &tmp_data, 1 );
225 uint8_t * data_out, uint16_t n_bytes )
232 return TP_ERR_N_DATA;
237 i2c_master_write_then_read( &ctx->
i2c, &tmp_data, 1, data_out, n_bytes );
263 touch_item->n_touches = ctx->
touch.n_touches;
265 for ( uint8_t idx = 0; idx < ctx->
touch.n_touches; idx++ )
267 touch_item->point[ idx ].coord_x = ctx->
touch.point[ idx ].coord_x;
268 touch_item->point[ idx ].coord_y = ctx->
touch.point[ idx ].coord_y;
270 touch_item->point[ idx ].event = ctx->
touch.point[ idx ].event;
271 touch_item->point[ idx ].id = ctx->
touch.point[ idx ].id;
286 status = ft5xx6_read_press_coordinates( ctx );
288 if ( ( status == TP_OK ) && ( ctx->
press_det == TP_EVENT_PRESS_DET ) )
290 ft5xx6_read_gesture( ctx );
297ft5xx6_read_press_coordinates(
ft5xx6_t * ctx )
299 if ( !digital_in_read( &ctx->
int_pin ) )
303 if ( ctx->
touch.n_touches > TP_N_TOUCHES_MAX )
305 return TP_ERR_N_TOUCHES;
309 uint8_t read_data[ 4 ];
312 for ( uint8_t idx = 0; idx < ctx->
touch.n_touches; idx++ )
316 ctx->
touch.point[ idx ].coord_x = read_data[ 0 ];
317 ctx->
touch.point[ idx ].coord_x <<= 8;
318 ctx->
touch.point[ idx ].coord_x |= read_data[ 1 ];
321 ctx->
touch.point[ idx ].coord_y = read_data[ 2 ];
322 ctx->
touch.point[ idx ].coord_y <<= 8;
323 ctx->
touch.point[ idx ].coord_y |= read_data[ 3 ];
344ft5xx6_read_gesture(
ft5xx6_t * ctx )
const ft5xx6_controller_t FT5X26_CONTROLLER
FT5x26 Touch Controllers Descriptor.
const ft5xx6_controller_t FT5X16_CONTROLLER
FT5x16 Touch Controllers Descriptor.
const ft5xx6_controller_t FT5X46_CONTROLLER
FT5x46 Touch Controllers Descriptor.
const ft5xx6_controller_t FT5X06_CONTROLLER
FT5xx6 Events Definition.
FT5xx6 Touch Controller Driver.
ft5xx6_run_mode_t
FT5xx6 Run Mode Settings.
ft5xx6_dev_mode_t
FT5xx6 Device Mode Settings.
#define FT5XX6_MASK_PRESS_COORD
FT5xx6 Touch Coordinates Mask.
#define FT5XX6_OFFSET_TOUCH_READING
FT5xx6 Touch Reading Offset.
#define FT5XX6_OFFSET_DEV_MODE
FT5xx6 Device Mode Offset.
#define FT5XX6_OFFSET_PRESS_ID
FT5xx6 Touch ID Offset.
#define FT5XX6_OFFSET_PRESS_EVENT
FT5xx6 Touch Event Offset.
#define FT5XX6_REG_TD_STATUS
FT5xx6 Status Register.
#define FT5XX6_REG_GEST_ID
FT5xx6 Gesture ID Register.
#define FT5XX6_REG_DEVICE_MODE
FT5xx6 Device Mode Register.
#define FT5XX6_REG_RUNNING_STATE
FT5xx6 Running State Register.
#define FT5XX6_REG_IVT_TO_HOST_STATUS
FT5xx6 IVT To Host Status Register.
#define FT5XX6_REG_TOUCH1_XH
FT5xx6 Touch1 X-coord MSB Register.
#define FT5XX6_N_DATA_TRANSFER_MAX
#define FT5XX6_INT_MODE_POLLING
FT5xx6 Interrupt Polling Mode Setting.
#define FT5XX6_I2C_ADDR
FT5xx6 Slave Address Setting.
#define FT5XX6_N_DATA_TRANSFER_MIN
FT5xx6 Data Transfer Limits Setting.
#define FT5XX6_GESTURE_ITEMS_MAX
FT5xx6 Gesture Items Limit Setting.
void ft5xx6_run_mode_setup(ft5xx6_t *ctx, ft5xx6_run_mode_t mode)
FT5xx6 Run Mode Setup Function.
uint8_t ft5xx6_generic_read_single(ft5xx6_t *ctx, uint8_t reg_addr)
FT5xx6 Generic Single Read Function.
void ft5xx6_press_coordinates(ft5xx6_t *ctx, tp_touch_item_t *touch_item)
FT5xx6 Pressure Coordinates Check Function.
tp_err_t ft5xx6_init(ft5xx6_t *ctx, ft5xx6_cfg_t *cfg, tp_drv_t *drv)
FT5xx6 Initialization Function.
void ft5xx6_cfg_setup(ft5xx6_cfg_t *cfg, const ft5xx6_controller_t *controller)
FT5xx6 Configuration Object Setup Function.
tp_event_t ft5xx6_press_detect(ft5xx6_t *ctx)
FT5xx6 Touch Pressure Detect Function.
void ft5xx6_dev_mode_setup(ft5xx6_t *ctx, ft5xx6_dev_mode_t mode)
FT5xx6 Device Mode Setup Function.
void ft5xx6_gesture(ft5xx6_t *ctx, tp_event_t *event)
FT5xx6 Gesture Check Function.
void ft5xx6_generic_write(ft5xx6_t *ctx, uint8_t reg_addr, uint8_t data_in)
FT5xx6 Generic Write Function.
void ft5xx6_default_cfg(ft5xx6_t *ctx)
FT5xx6 Default Configuration Function.
tp_err_t ft5xx6_process(ft5xx6_t *ctx)
FT5xx6 Process Function.
tp_err_t ft5xx6_generic_read_multiple(ft5xx6_t *ctx, uint8_t reg_addr, uint8_t *data_out, uint16_t n_bytes)
FT5xx6 Generic Multiple Read Function.
FT5xx6 Configuration Object.
const ft5xx6_controller_t * controller
i2c_master_config_t i2c_cfg
ft5xx6_gest_item_t gest_items[FT5XX6_GESTURE_ITEMS_MAX]
const ft5xx6_controller_t * controller