mikroSDK Reference Manual
FT5xx6 Touch Controllers Driver

FT5xx6 Touch Controller Driver API Reference. More...

Modules

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

Detailed Description

API for configuring and manipulating FT5xx6 Touch Controller driver.

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.

◆ 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 );

◆ 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 );

◆ 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_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.

◆ 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 );

◆ 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_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_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 );

◆ 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 );

◆ 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 );

◆ 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 );
ft5xx6_press_coordinates
void ft5xx6_press_coordinates(ft5xx6_t *ctx, tp_touch_item_t *touch_item)
FT5xx6 Pressure Coordinates Check Function.
FT5XX6_MAP_PINS
#define FT5XX6_MAP_PINS(cfg)
FT5xx6 Pin Mapping.
Definition: ft5xx6.h:514
FT5XX6_REG_RUNNING_STATE
#define FT5XX6_REG_RUNNING_STATE
FT5xx6 Running State Register.
Definition: ft5xx6.h:352
FT5XX6_DEV_MODE_NORMAL
Definition: ft5xx6.h:529
ft5xx6_default_cfg
void ft5xx6_default_cfg(ft5xx6_t *ctx)
FT5xx6 Default Configuration Function.
TP_EVENT_GEST_UP
Definition: tp.h:89
ft5xx6_generic_read_single
uint8_t ft5xx6_generic_read_single(ft5xx6_t *ctx, uint8_t reg_addr)
FT5xx6 Generic Single Read Function.
TP_EVENT_GEST_LEFT
Definition: tp.h:87
tp_event_t
tp_event_t
Touch Panel Event Code Definition.
Definition: tp.h:79
TP_EVENT_GEST_ZOOM_IN
Definition: tp.h:91
ft5xx6_gesture
void ft5xx6_gesture(ft5xx6_t *ctx, tp_event_t *event)
FT5xx6 Gesture Check Function.
FT5XX6_REG_TD_STATUS
#define FT5XX6_REG_TD_STATUS
FT5xx6 Status Register.
Definition: ft5xx6.h:93
ft5xx6_init
tp_err_t ft5xx6_init(ft5xx6_t *ctx, ft5xx6_cfg_t *cfg, tp_drv_t *drv)
FT5xx6 Initialization Function.
tp_touch_item_t
Touch Item Definition.
Definition: tp.h:149
FT5XX6_RUN_MODE_CFG
Definition: ft5xx6.h:541
ft5xx6_generic_write
void ft5xx6_generic_write(ft5xx6_t *ctx, uint8_t reg_addr, uint8_t data_in)
FT5xx6 Generic Write Function.
ft5xx6_t
FT5xx6 Context Object.
Definition: ft5xx6.h:588
ft5xx6_press_detect
tp_event_t ft5xx6_press_detect(ft5xx6_t *ctx)
FT5xx6 Touch Pressure Detect Function.
tp_err_t
tp_err_t
Touch Panel Error Code Definition.
Definition: tp.h:63
TP_EVENT_GEST_DOWN
Definition: tp.h:90
TP_EVENT_GEST_ZOOM_OUT
Definition: tp.h:92
FT5X26_CONTROLLER
const ft5xx6_controller_t FT5X26_CONTROLLER
FT5x26 Touch Controllers Descriptor.
ft5xx6_dev_mode_setup
void ft5xx6_dev_mode_setup(ft5xx6_t *ctx, ft5xx6_dev_mode_t mode)
FT5xx6 Device Mode Setup Function.
ft5xx6_process
tp_err_t ft5xx6_process(ft5xx6_t *ctx)
FT5xx6 Process Function.
FT5XX6_REG_TOUCH1_XH
#define FT5XX6_REG_TOUCH1_XH
FT5xx6 Touch1 X-coord MSB Register.
Definition: ft5xx6.h:100
ft5xx6_cfg_setup
void ft5xx6_cfg_setup(ft5xx6_cfg_t *cfg, const ft5xx6_controller_t *controller)
FT5xx6 Configuration Object Setup Function.
FT5XX6_RUN_MODE_WORK
Definition: ft5xx6.h:542
TP_EVENT_GEST_NONE
Definition: tp.h:86
ft5xx6_controller_t
FT5xx6 Gesture Items.
Definition: ft5xx6.h:564
ft5xx6_run_mode_setup
void ft5xx6_run_mode_setup(ft5xx6_t *ctx, ft5xx6_run_mode_t mode)
FT5xx6 Run Mode Setup Function.
TP_EVENT_GEST_RIGHT
Definition: tp.h:88
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)
FT5xx6 Generic Multiple Read Function.
tp_drv_t
Touch Panel Driver Interface Items.
Definition: tp.h:197
ft5xx6_cfg_t
FT5xx6 Configuration Object.
Definition: ft5xx6.h:574