touchpad5 2.0.0.0
|
TouchPad5 Click example. More...
Macros | |
#define | SNAP_BUFFER_SIZE ( 8 ) |
#define | SNAP_NUMBER_OF_CHANNELS ( 8 ) |
#define | SNAP_MAX_NO_CONSECUTIVE_SAMPLES ( 3 ) |
#define | TOUCH_STRENGTH_THRESHOLD ( 30 ) |
Functions | |
bool | touchpad5_get_snap_sample (touchpad5_t *ctx, uint16_t *snap_data) |
TouchPad 5 snap sample getter. | |
bool | touchpad5_detect_snap (touchpad5_t *ctx, uint16_t *snap_buffer, uint8_t snap_buffer_size, uint16_t *snap_reference) |
TouchPad 5 snap detection function. | |
void | application_init (void) |
void | application_task (void) |
int | main (void) |
TouchPad5 Click example.
This example demonstrates the use of Touchpad 5 click board by utilizing the touchpad XY and snap functionalities.
The demo application is composed of two sections :
Initializes the driver and USB UART logging and displays the device version information such as product number, project number, major/minor release number, hardware ID, hardware revision and bootloader status.
Task busy waits for the touchpad controller ready bit using polling operation. When the communication window is available, the snap functionality is being checked, as well as XY touchpad data. Based on the user's touch sensibility and duration, one of the two features is being determined and logged over UART terminal. Snap (click) corresponds to the shorter and lighter 'click' gesture, while the touch is detected as longer and stronger 'swipe' gesture.
#define SNAP_BUFFER_SIZE ( 8 ) |
#define SNAP_MAX_NO_CONSECUTIVE_SAMPLES ( 3 ) |
#define SNAP_NUMBER_OF_CHANNELS ( 8 ) |
#define TOUCH_STRENGTH_THRESHOLD ( 30 ) |
void application_init | ( | void | ) |
< Logger config object.
< Click config object.
Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG
void application_task | ( | void | ) |
int main | ( | void | ) |
bool touchpad5_detect_snap | ( | touchpad5_t * | ctx, |
uint16_t * | snap_buffer, | ||
uint8_t | snap_buffer_size, | ||
uint16_t * | snap_reference ) |
TouchPad 5 snap detection function.
This function checks for snap criteria defined by snap reference and predefined number of consecutive samples deviating from said reference.
[in] | ctx | : Click context object. See touchpad5_t object definition for detailed explanation. |
[out] | snap_buffer | : Snap buffer with snap status data . |
[in] | snap_buffer_size | : Buffer size of the 16-bit snap data. |
[out] | snap_reference | : Pointer to the reference data calculated inside within each iteration. |
bool touchpad5_get_snap_sample | ( | touchpad5_t * | ctx, |
uint16_t * | snap_data ) |
TouchPad 5 snap sample getter.
This function gets the snap sample value as the averaged value of the predefined number of channels.
[in] | ctx | : Click context object. See touchpad5_t object definition for detailed explanation. |
[out] | snap_data | : Pointer to the memory location of the buffer where data is stored. |