touchpad2  2.0.0.0
Main Page

TouchPad 2 click

Touchpad 2 Click is a compact add-on board that easily integrates projected capacitive touch into their applications. This board features the IQS525, a projected capacitive touch and proximity trackpad/touchscreen controller from Azoteq. It features best in class sensitivity, signal-to-noise ratio, and automatic tuning of electrodes, in addition to the multi-touch and multi-hover feature. This Click boardâ„¢ is characterized by embedded gesture engine recognition for simple gestures (tap, swipes, hold), as well as built-in noise detection and filtering.

click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Feb 2021.
  • Type : I2C type

Software Support

We provide a library for the TouchPad2 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.

Library Description

This library contains API for TouchPad2 Click driver.

Standard key functions :

Example key functions :

Example Description

This library contains API for the TouchPad 2 Click driver. The library contains drivers to get touch details, the number of touches, X and Y coordinates and touch strength.

The demo application is composed of two sections :

Application Init

Initializes I2C driver, check communication and reads device version information.

void application_init ( void ) {
log_cfg_t log_cfg;
touchpad2_cfg_t touchpad2_cfg;
// Logger initialization.
LOG_MAP_USB_UART( log_cfg );
log_cfg.level = LOG_LEVEL_DEBUG;
log_cfg.baud = 115200;
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
touchpad2_cfg_setup( &touchpad2_cfg );
TOUCHPAD2_MAP_MIKROBUS( touchpad2_cfg, MIKROBUS_1 );
err_t init_flag = touchpad2_init( &touchpad2, &touchpad2_cfg );
if ( init_flag == I2C_MASTER_ERROR ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
touchpad2_default_cfg ( &touchpad2 );
log_info( &logger, " Application Task " );
Delay_ms( 1000 );
Delay_ms( 100 );
log_error( &logger, " Communication Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_printf( &logger, "------------------------\r\n" );
log_printf( &logger, " Product number : %u \r\n", ver_info.product_num );
log_printf( &logger, " Project number : %u \r\n", ver_info.projec_num );
log_printf( &logger, " Version : %.1f \r\n", ver_info.version );
log_printf( &logger, " HW ID : %u \r\n", ver_info.hw_id );
log_printf( &logger, " HW Revision : %u \r\n", ver_info.hw_revision );
log_printf( &logger, "------------------------\r\n" );
Delay_ms( 1000 );
log_printf( &logger, " Waiting for a new touch\r\n" );
log_printf( &logger, "------------------------\r\n" );
Delay_ms( 100 );
}

Application Task

This is an example that demonstrates the use of the TouchPad 2 Click board. Read XY data consisting of a status byte, the number of touches, X and Y coordinates and touch strength data. Results are being sent to the Usart Terminal where you can track their changes.

void application_task ( void ) {
touchpad2_wait_ready( &touchpad2 );
touchpad2_get_touch ( &touchpad2, &touch_data );
Delay_ms( 100 );
log_printf( &logger, " Number of touches : %d \r\n", ( uint16_t ) touch_data.no_of_fingers );
log_printf( &logger, "- - - - - - - - - - - - -\r\n" );
log_printf( &logger, " Coordinate X = %d \r\n", touch_data.x_pos );
log_printf( &logger, " Coordinate Y = %d \r\n", touch_data.y_pos );
log_printf( &logger, "- - - - - - - - - - - - -\r\n" );
log_printf( &logger, " Touch Strength : %u \r\n", ( uint16_t ) touch_data.touch_str );
log_printf( &logger, "------------------------ \r\n" );
Delay_ms( 500 );
}
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.TouchPad2

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all Mikroelektronika compilers.


touchpad2_cfg_setup
void touchpad2_cfg_setup(touchpad2_cfg_t *cfg)
TouchPad 2 configuration object setup function.
ver_info
touchpad2_ver_info_t ver_info
Definition: main.c:31
TOUCHPAD2_MAP_MIKROBUS
#define TOUCHPAD2_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: touchpad2.h:326
touchpad2_touch_t::id_tag
uint8_t id_tag
Definition: touchpad2.h:392
touchpad2_touch_t::touch_str
uint16_t touch_str
Definition: touchpad2.h:395
touchpad2_ver_info_t::hw_revision
uint16_t hw_revision
Definition: touchpad2.h:380
touchpad2_ver_info_t
TouchPad 2 device version information object.
Definition: touchpad2.h:375
application_task
void application_task(void)
Definition: main.c:86
TOUCHPAD2_ID_TAG_TOUCH_1
#define TOUCHPAD2_ID_TAG_TOUCH_1
TouchPad 2 ID tag selection.
Definition: touchpad2.h:284
touchpad2_touch_t
TouchPad 2 XY data object.
Definition: touchpad2.h:389
TOUCHPAD2_ID_TAG_TOUCH_4
#define TOUCHPAD2_ID_TAG_TOUCH_4
Definition: touchpad2.h:287
touchpad2_ver_info_t::hw_id
uint16_t hw_id
Definition: touchpad2.h:379
touchpad2_ver_info_t::version
float version
Definition: touchpad2.h:378
touchpad2_cfg_t
TouchPad 2 Click configuration object.
Definition: touchpad2.h:359
touchpad2_init
err_t touchpad2_init(touchpad2_t *ctx, touchpad2_cfg_t *cfg)
TouchPad 2 initialization function.
touchpad2_touch_t::x_pos
uint16_t x_pos
Definition: touchpad2.h:393
touch_data
touchpad2_touch_t touch_data
Definition: main.c:32
touchpad2_get_touch
err_t touchpad2_get_touch(touchpad2_t *ctx, touchpad2_touch_t *touch_data)
TouchPad 2 get touch function.
touchpad2_touch_t::y_pos
uint16_t y_pos
Definition: touchpad2.h:394
touchpad2_check_version
err_t touchpad2_check_version(touchpad2_t *ctx, touchpad2_ver_info_t *ver_info)
TouchPad 2 check version function.
touchpad2_default_cfg
err_t touchpad2_default_cfg(touchpad2_t *ctx)
TouchPad 2 default configuration function.
touchpad2_touch_t::no_of_fingers
uint8_t no_of_fingers
Definition: touchpad2.h:391
application_init
void application_init(void)
Definition: main.c:34
TOUCHPAD2_ID_TAG_TOUCH_5
#define TOUCHPAD2_ID_TAG_TOUCH_5
Definition: touchpad2.h:288
TOUCHPAD2_IQS525_PRODUCT_NUMBER
#define TOUCHPAD2_IQS525_PRODUCT_NUMBER
TouchPad 2 Product Number selection.
Definition: touchpad2.h:307
touchpad2_ver_info_t::projec_num
uint16_t projec_num
Definition: touchpad2.h:377
TOUCHPAD2_ID_TAG_TOUCH_3
#define TOUCHPAD2_ID_TAG_TOUCH_3
Definition: touchpad2.h:286
touchpad2_ver_info_t::product_num
uint16_t product_num
Definition: touchpad2.h:376
touchpad2_t
TouchPad 2 Click context object.
Definition: touchpad2.h:339
touchpad2_wait_ready
void touchpad2_wait_ready(touchpad2_t *ctx)
TouchPad 2 wait ready function.
TOUCHPAD2_ID_TAG_TOUCH_2
#define TOUCHPAD2_ID_TAG_TOUCH_2
Definition: touchpad2.h:285