mikroSDK Reference Manual
FT5xx6 Touch Controllers Driver

FT5xx6 Touch Controller Driver API Reference. More...

Topics

 FT5xx6 Registers
 FT5xx6 Registers List.
 
 FT5xx6 Settings
 FT5xx6 Settings List.
 

Functions list

void ft5xx6_cfg_setup (ft5xx6_cfg_t *cfg, const ft5xx6_controller_t *controller)
 FT5xx6 Configuration Object Setup Function.
 
tp_err_t ft5xx6_init (ft5xx6_t *ctx, ft5xx6_cfg_t *cfg, tp_drv_t *drv)
 FT5xx6 Initialization Function.
 
void ft5xx6_default_cfg (ft5xx6_t *ctx)
 FT5xx6 Default Configuration Function.
 
void ft5xx6_generic_write (ft5xx6_t *ctx, uint8_t reg_addr, uint8_t data_in)
 FT5xx6 Generic Write Function.
 
uint8_t ft5xx6_generic_read_single (ft5xx6_t *ctx, uint8_t reg_addr)
 FT5xx6 Generic Single Read 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.
 
void ft5xx6_dev_mode_setup (ft5xx6_t *ctx, ft5xx6_dev_mode_t mode)
 FT5xx6 Device Mode Setup Function.
 
void ft5xx6_run_mode_setup (ft5xx6_t *ctx, ft5xx6_run_mode_t mode)
 FT5xx6 Run Mode Setup Function.
 
tp_event_t ft5xx6_press_detect (ft5xx6_t *ctx)
 FT5xx6 Touch Pressure Detect Function.
 
void ft5xx6_press_coordinates (ft5xx6_t *ctx, tp_touch_item_t *touch_item)
 FT5xx6 Pressure Coordinates Check Function.
 
void ft5xx6_gesture (ft5xx6_t *ctx, tp_event_t *event)
 FT5xx6 Gesture Check Function.
 
tp_err_t ft5xx6_process (ft5xx6_t *ctx)
 FT5xx6 Process Function.
 

Function Documentation

◆ ft5xx6_cfg_setup()

void ft5xx6_cfg_setup ( ft5xx6_cfg_t * cfg,
const ft5xx6_controller_t * controller )

This function initializes FT5xx6 configuration structure to default values.

Parameters
[out]cfg: FT5xx6 configuration object. See ft5xx6_cfg_t structure definition for detailed explanation.
[in]controller: Touch controller selector from FT5xx6 series touch controllers. See ft5xx6_controller_t structure definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

Example

// FT5xx6 configuration object.
ft5xx6_cfg_t ft5xx6_cfg;
// FT5x26 series touch controllers descriptor.
{
{
{ 0x00, TP_EVENT_GEST_NONE },
{ 0x1C, TP_EVENT_GEST_LEFT },
{ 0x10, TP_EVENT_GEST_UP },
{ 0x18, TP_EVENT_GEST_DOWN },
}
};
// FT5xx6 configuration setup.
const ft5xx6_controller_t FT5X26_CONTROLLER
FT5x26 Touch Controllers Descriptor.
void ft5xx6_cfg_setup(ft5xx6_cfg_t *cfg, const ft5xx6_controller_t *controller)
FT5xx6 Configuration Object Setup Function.
FT5xx6 Configuration Object.
Definition ft5xx6.h:571
FT5xx6 Gesture Items.
Definition ft5xx6.h:561
@ TP_EVENT_GEST_UP
Definition tp.h:90
@ TP_EVENT_GEST_ZOOM_OUT
Definition tp.h:93
@ TP_EVENT_GEST_RIGHT
Definition tp.h:89
@ TP_EVENT_GEST_LEFT
Definition tp.h:88
@ TP_EVENT_GEST_DOWN
Definition tp.h:91
@ TP_EVENT_GEST_ZOOM_IN
Definition tp.h:92
@ TP_EVENT_GEST_NONE
Definition tp.h:87

◆ ft5xx6_default_cfg()

void ft5xx6_default_cfg ( ft5xx6_t * ctx)

This function puts the FT5xx6 touch controller to normal operating mode.

Parameters
[in]ctx: FT5xx6 context object. See ft5xx6_t structure definition for detailed explanation.
Returns
Nothing.
Note
It's necessary for this functon to be executed after Initialization function for properly working of entire driver.

Example

// FT5xx6 driver object.
ft5xx6_t ft5xx6;
// FT5xx6 driver default configuration.
ft5xx6_default_cfg( &ft5xx6 );
void ft5xx6_default_cfg(ft5xx6_t *ctx)
FT5xx6 Default Configuration Function.
FT5xx6 Context Object.
Definition ft5xx6.h:585

◆ ft5xx6_dev_mode_setup()

void ft5xx6_dev_mode_setup ( ft5xx6_t * ctx,
ft5xx6_dev_mode_t mode )

This function puts the FT5xx6 series touch controllers to the selected device mode.

Parameters
[in]ctx: FT5xx6 context object. See ft5xx6_t structure definition for detailed explanation.
[in]mode: device mode of operation. See ft5xx6_dev_mode_t for valid values.
Returns
Nothing.

Example

// FT5xx6 driver object.
ft5xx6_t ft5xx6;
// Setting device normal operating mode of FT5xx6 series touch controllers.
@ FT5XX6_DEV_MODE_NORMAL
Definition ft5xx6.h:525
void ft5xx6_dev_mode_setup(ft5xx6_t *ctx, ft5xx6_dev_mode_t mode)
FT5xx6 Device Mode Setup Function.

◆ ft5xx6_generic_read_multiple()

tp_err_t ft5xx6_generic_read_multiple ( ft5xx6_t * ctx,
uint8_t reg_addr,
uint8_t * data_out,
uint16_t n_bytes )

This function allows user to read the desired number of data bytes, starting from the selected register address.

Parameters
[in]ctx: FT5xx6 context object. See ft5xx6_t structure definition for detailed explanation.
[in]reg_addr: Register address which from the data reading will be started.
[out]data_out: Memory where read data will be stored.
[in]n_bytes: Number of data bytes to be read.
Returns
  • 0 - OK,
  • 6 - Number of transfered bytes is out of range. See tp_err_t structure definition for detailed explanation.
Example
// FT5xx6 driver object.
ft5xx6_t ft5xx6;
// Read value.
uint8_t read_data[ 2 ];
// TP error code.
tp_err_t error;
// Reading two data bytes to get x coordinate value of touch1.
read_data, 2 );
#define FT5XX6_REG_TOUCH1_XH
FT5xx6 Touch1 X-coord MSB Register.
Definition ft5xx6.h:101
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.
tp_err_t
Touch Panel Error Code Definition.
Definition tp.h:65

◆ ft5xx6_generic_read_single()

uint8_t ft5xx6_generic_read_single ( ft5xx6_t * ctx,
uint8_t reg_addr )

This function allows user to read any desired register of the FT5xx6 series touch controllers.

Parameters
[in]ctx: FT5xx6 context object. See ft5xx6_t structure definition for detailed explanation.
[in]reg_addr: Register address which from data be read.
Returns
8-bit read data.

Example

// FT5xx6 driver object.
ft5xx6_t ft5xx6;
// Read value.
uint8_t read_data;
// Reading status of FT5xx6 controller to get number of pressed touches.
#define FT5XX6_REG_TD_STATUS
FT5xx6 Status Register.
Definition ft5xx6.h:94
uint8_t ft5xx6_generic_read_single(ft5xx6_t *ctx, uint8_t reg_addr)
FT5xx6 Generic Single Read Function.

◆ ft5xx6_generic_write()

void ft5xx6_generic_write ( ft5xx6_t * ctx,
uint8_t reg_addr,
uint8_t data_in )

This function allows user to write any 8-bit data to the selected register of the FT5xx6 series touch controllers.

Parameters
[in]ctx: FT5xx6 context object. See ft5xx6_t structure definition for detailed explanation.
[in]reg_addr: Register address where data be written.
[in]data_in: Data to be written.
Returns
Nothing.

Example

// FT5xx6 driver object.
ft5xx6_t ft5xx6;
// Setting FT5xx6 controller to configuration mode.
@ FT5XX6_RUN_MODE_CFG
Definition ft5xx6.h:537
#define FT5XX6_REG_RUNNING_STATE
FT5xx6 Running State Register.
Definition ft5xx6.h:353
void ft5xx6_generic_write(ft5xx6_t *ctx, uint8_t reg_addr, uint8_t data_in)
FT5xx6 Generic Write Function.

◆ ft5xx6_gesture()

void ft5xx6_gesture ( ft5xx6_t * ctx,
tp_event_t * event )

This function allows user to get the information about the gesture (slide direction).

Parameters
[in]ctx: FT5xx6 context object. See ft5xx6_t structure definition for detailed explanation.
[out]event: Touch panel gesture data. See tp_event_t structure definition for detailed explanation.
Returns
Nothing.
Note
ft5xx6_process function must be called to update all events.

Example

// FT5xx6 driver object.
ft5xx6_t ft5xx6;
// Gesture event.
tp_event_t event;
// Checking slide direction event of pressed touch.
ft5xx6_gesture( &ft5xx6, &event );
void ft5xx6_gesture(ft5xx6_t *ctx, tp_event_t *event)
FT5xx6 Gesture Check Function.
tp_event_t
Touch Panel Event Code Definition.
Definition tp.h:81

◆ ft5xx6_init()

tp_err_t ft5xx6_init ( ft5xx6_t * ctx,
ft5xx6_cfg_t * cfg,
tp_drv_t * drv )

This function initializes FT5xx6 context object to default values and allows driver interface object to be linked with FT5xx6 driver functions.

Parameters
[out]ctx: FT5xx6 context object. See ft5xx6_t structure definition for detailed explanation.
[in]cfg: FT5xx6 configuration object. See ft5xx6_cfg_t structure definition for detailed explanation.
[out]drv: TP driver interface object. See tp_drv_t structure definition for detailed explanation.
Returns
  • 0 - OK,
  • 1 - I2C driver init error,
  • 2 - Unsupported pin. See tp_err_t structure definition for detailed explanation.
Example
// FT5xx6 driver object.
ft5xx6_t ft5xx6;
// FT5xx6 configuration object.
ft5xx6_cfg_t ft5xx6_cfg;
// FT5x26 series touch controllers descriptor.
// TP driver interface object.
tp_drv_t tp_interface;
// FT5xx6 configuration setup.
// FT5xx6 controller pin mapping.
FT5XX6_MAP_PINS( ft5xx6_cfg );
// FT5xx6 driver initialization.
ft5xx6_init( &ft5xx6, &ft5xx6_cfg, &tp_interface );
#define FT5XX6_MAP_PINS(cfg)
FT5xx6 Pin Mapping.
Definition ft5xx6.h:510
tp_err_t ft5xx6_init(ft5xx6_t *ctx, ft5xx6_cfg_t *cfg, tp_drv_t *drv)
FT5xx6 Initialization Function.
Touch Panel Driver Interface Items.
Definition tp.h:199

◆ ft5xx6_press_coordinates()

void ft5xx6_press_coordinates ( ft5xx6_t * ctx,
tp_touch_item_t * touch_item )

This function allows user to get the information about the number of pressed touch points, coordinates and touch event for each pressed touch point.

Parameters
[in]ctx: FT5xx6 context object. See ft5xx6_t structure definition for detailed explanation.
[out]touch_item: Touch item data. See tp_touch_item_t structure definition for detailed explanation.
Returns
Nothing.
Note
ft5xx6_process function must be called to update all events.

Example

// FT5xx6 driver object.
ft5xx6_t ft5xx6;
// Touch pressure item.
// To get all necessary data information about pressed touch.
ft5xx6_press_coordinates( &ft5xx6, &tp_item );
void ft5xx6_press_coordinates(ft5xx6_t *ctx, tp_touch_item_t *touch_item)
FT5xx6 Pressure Coordinates Check Function.
Touch Item Definition.
Definition tp.h:151

◆ ft5xx6_press_detect()

tp_event_t ft5xx6_press_detect ( ft5xx6_t * ctx)

This function allows the touch pressure detection.

Parameters
[in]ctx: FT5xx6 context object. See ft5xx6_t structure definition for detailed explanation.
Returns
  • 3 - Touch pressure is not detected,
  • 4 - Touch pressure is detected. See tp_event_t structure definition for detailed explanation.
Note
ft5xx6_process function must be called to update all events.

Example

// FT5xx6 driver object.
ft5xx6_t ft5xx6;
// Touch pressure event.
tp_event_t event;
// Checking touch pressure event.
event = ft5xx6_press_detect( &ft5xx6 );
tp_event_t ft5xx6_press_detect(ft5xx6_t *ctx)
FT5xx6 Touch Pressure Detect Function.

◆ ft5xx6_process()

tp_err_t ft5xx6_process ( ft5xx6_t * ctx)

This function detects a touch pressure, and if any touch pressure was detected, then collects all information about the pressed touch and slide direction (gesture).

Parameters
[in]ctx: FT5xx6 context object. See ft5xx6_t structure definition for detailed explanation.
Returns
  • 0 - OK,
  • 5 - Number of pressed touches is out of range. See tp_err_t structure definition for detailed explanation.
Note
To update all possible events, just need to call this function before the any other function for checking events is called.

Example

// FT5xx6 driver object.
ft5xx6_t ft5xx6;
// TP error code.
tp_err_t error;
// Processing all data and events of the target touch controller.
error = ft5xx6_process( &ft5xx6 );
tp_err_t ft5xx6_process(ft5xx6_t *ctx)
FT5xx6 Process Function.

◆ ft5xx6_run_mode_setup()

void ft5xx6_run_mode_setup ( ft5xx6_t * ctx,
ft5xx6_run_mode_t mode )

This function puts the FT5xx6 series touch controllers to the selected run mode.

Parameters
[in]ctx: FT5xx6 context object. See ft5xx6_t structure definition for detailed explanation.
[in]mode: run mode of operation. See ft5xx6_run_mode_t for valid values.
Returns
Nothing.

Example

// FT5xx6 driver object.
ft5xx6_t ft5xx6;
// Setting run working mode of FT5xx6 series touch controllers.
@ FT5XX6_RUN_MODE_WORK
Definition ft5xx6.h:538
void ft5xx6_run_mode_setup(ft5xx6_t *ctx, ft5xx6_run_mode_t mode)
FT5xx6 Run Mode Setup Function.