touchpad3 2.0.0.0
touchpad3.h File Reference

This file contains API for Touchpad 3 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  touchpad3_t
 Touchpad 3 Click context object. More...
 
struct  touchpad3_cfg_t
 Touchpad 3 Click configuration object. More...
 
struct  touch_data_t
 
struct  cmd_protocol_t
 

Macros

#define TOUCHPAD3_GENERAL_INDEX_LOCATION   0x00
 Touchpad 3 description general registers index location.
 
#define TOUCHPAD3_GENERAL_RX_CH_ADD   0x01
 Touchpad 3 description general registers adresses.
 
#define TOUCHPAD3_GENERAL_TX_CH_ADD   0x02
 
#define TOUCHPAD3_GENERAL_RX_SC_L_ADD   0x04
 
#define TOUCHPAD3_GENERAL_RX_SC_H_ADD   0x05
 
#define TOUCHPAD3_GENERAL_TX_SC_L_ADD   0x06
 
#define TOUCHPAD3_GENERAL_TX_SC_H_ADD   0x07
 
#define TOUCHPAD3_GENERAL_RX_CH   0x05
 Touchpad 3 description general registers values.
 
#define TOUCHPAD3_GENERAL_TX_CH   0x04
 
#define TOUCHPAD3_GENERAL_RX_SC_L   0x33
 
#define TOUCHPAD3_GENERAL_RX_SC_H   0x33
 
#define TOUCHPAD3_GENERAL_TX_SC_L   0x00
 
#define TOUCHPAD3_GENERAL_TX_SC_H   0x40
 
#define TOUCHPAD3_DECODING_INDEX_LOCATION   0x30
 Touchpad 3 description decoding registers index location.
 
#define TOUCHPAD3_DEC_FLIP_STATE_ADD   0x00
 Touchpad 3 description decoding registers adresses.
 
#define TOUCHPAD3_DEC_NUM_AVG_ADD   0x01
 
#define TOUCHPAD3_DEC_MIN_TOUCH_DISTANCE_ADD   0x04
 
#define TOUCHPAD3_DEC_FLIP_STATE   0x04
 Touchpad 3 description decoding registers values.
 
#define TOUCHPAD3_DEC_NUM_AVG   0x08
 
#define TOUCHPAD3_DEC_MIN_TOUCH_DISTANCE   0x01
 
#define TOUCHPAD3_REG_WRITE   0x55, 0x04, 0x15
 Touchpad 3 sensor map rx registers addresses.
 
#define TOUCHPAD3_RX_MAP_INDEX_ADD   0x01
 
#define TOUCHPAD3_RX_CH1_ADD   0x00
 
#define TOUCHPAD3_RX_CH2_ADD   0x01
 
#define TOUCHPAD3_RX_CH3_ADD   0x02
 
#define TOUCHPAD3_RX_CH4_ADD   0x03
 
#define TOUCHPAD3_RX_CH5_ADD   0x04
 
#define TOUCHPAD3_RX_CH1   0x08
 Touchpad 3 sensor map rx values.
 
#define TOUCHPAD3_RX_CH2   0x07
 
#define TOUCHPAD3_RX_CH3   0x06
 
#define TOUCHPAD3_RX_CH4   0x05
 
#define TOUCHPAD3_RX_CH5   0x04
 
#define TOUCHPAD3_TX_MAP_INDEX_ADD   0x02
 Touchpad 3 sensor map tx registers addresses.
 
#define TOUCHPAD3_TX_CH1_ADD   0x00
 
#define TOUCHPAD3_TX_CH2_ADD   0x01
 
#define TOUCHPAD3_TX_CH3_ADD   0x02
 
#define TOUCHPAD3_TX_CH4_ADD   0x03
 
#define TOUCHPAD3_TX_CH1   0x0D
 Touchpad 3 sensor map tx values.
 
#define TOUCHPAD3_TX_CH2   0x06
 
#define TOUCHPAD3_TX_CH3   0x03
 
#define TOUCHPAD3_TX_CH4   0x02
 
#define TOUCHPAD3_SET_COMMAND   0x55
 Touchpad 3 command set.
 
#define TOUCHPAD3_CMD_ENABLE_TOUCH   0x00
 
#define TOUCHPAD3_CMD_DISABLE_TOUCH   0x01
 
#define TOUCHPAD3_CMD_SCAN_BASELINE   0x14
 
#define TOUCHPAD3_CMD_WRITE_REGISTER   0x15
 
#define TOUCHPAD3_CMD_READ_REGISTER   0x16
 
#define TOUCHPAD3_CMD_WRITE_NVRAM   0x17
 
#define TOUCHPAD3_CMD_SOFTWARE_SLEEP   0x18
 
#define TOUCHPAD3_CMD_ERASE_NVRAM   0x19
 
#define TOUCHPAD3_CMD_MANUFACTURING_TEST   0x1A
 
#define TOUCHPAD3_CMD_DEVICE_ID   0x83
 
#define TOUCHPAD3_GENERAL_INDEX_BYTE   0x00
 Touchpad 3 index byte.
 
#define TOUCHPAD3_SENSOR_MAP_RX_INDEX_BYTE   0x01
 
#define TOUCHPAD3_SENSOR_MAP_TX_INDEX_BYTE   0x02
 
#define TOUCHPAD3_SELF_INDEX_BYTE   0x10
 
#define TOUCHPAD3_MUTUAL_INDEX_BYTE   0x20
 
#define TOUCHPAD3_DECODING_INDEX_BYTE   0x30
 
#define TOUCHPAD3_GESTURES_INDEX_BYTE   0x50
 
#define TOUCHPAD3_CONFIGURATION_INDEX_BYTE   0xF0
 
#define TOUCHPAD3_I_O_STATUS_INDEX_BYTE   0xF1
 
#define TOUCHPAD3_GENERAL_OFFSET_BYTE_RX_CHANNELS   0x01
 Touchpad 3 offset byte - General.
 
#define TOUCHPAD3_GENERAL_OFFSET_BYTE_TX_CHANNELS   0x02
 
#define TOUCHPAD3_GENERAL_OFFSET_BYTE_RX_SCALING_LSB   0x04
 
#define TOUCHPAD3_GENERAL_OFFSET_BYTE_RX_SCALING_MSB   0x05
 
#define TOUCHPAD3_GENERAL_OFFSET_BYTE_TX_SCALING_LSB   0x06
 
#define TOUCHPAD3_GENERAL_OFFSET_BYTE_TX_SCALING_MSB   0x07
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_0   0x00
 Touchpad 3 Offset Byte - Sensor Map RX.
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_1   0x01
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_2   0x02
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_3   0x03
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_4   0x04
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_5   0x05
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_6   0x06
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_7   0x07
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_8   0x08
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_9   0x09
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_10   0x0A
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_11   0x0B
 
#define TOUCHPAD3_SENSOR_MAP_RX_OFFSET_BYTE_RX_PIN_MAP_12   0x0C
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_0   0x00
 Touchpad 3 Offset Byte - Sensor Map TX.
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_1   0x01
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_2   0x02
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_3   0x03
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_4   0x04
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_5   0x05
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_6   0x06
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_7   0x07
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_8   0x08
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_9   0x09
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_10   0x0A
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_11   0x0B
 
#define TOUCHPAD3_SENSOR_MAP_TX_OFFSET_BYTE_RX_PIN_MAP_12   0x0C
 
#define TOUCHPAD3_SELF_OFFSET_BYTE_SELF_SCAN_TIME   0x00
 Touchpad 3 offset byte - Self.
 
#define TOUCHPAD3_SELF_OFFSET_BYTE_SELF_THRESHOLD   0x01
 
#define TOUCHPAD3_MUTUAL_OFFSET_BYTE_MUTUAL_SCAN_TIME   0x00
 Touchpad 3 offset byte - Mutual.
 
#define TOUCHPAD3_MUTUAL_OFFSET_BYTE_MUTUAL_THRESHOLD   0x01
 
#define TOUCHPAD3_DECODING_OFFSET_BYTE_FLIP_STATE   0x00
 Touchpad 3 Offset Byte - Decoding.
 
#define TOUCHPAD3_DECODING_OFFSET_BYTE_NUMBER_OF_AVG   0x01
 
#define TOUCHPAD3_DECODING_OFFSET_BYTE_MIN_TOUCH_DIST   0x04
 
#define TOUCHPAD3_DECODING_OFFSET_BYTE_PEN_DOWN_TIMER   0x05
 
#define TOUCHPAD3_DECODING_OFFSET_BYTE_PEN_UP_TIMER   0x06
 
#define TOUCHPAD3_DECODING_OFFSET_BYTE_TOUCH_SUPPR_VALUE   0x07
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_RX_SWIPE_LEN   0x00
 Touchpad 3 Offset Byte - Gestures.
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_TX_SWIPE_LEN   0x01
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_SWIPE_BOUNDARY   0x02
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_SWIPE_HOLD_THD   0x03
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_SWIPE_TIME_LSB   0x04
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_SWIPE_TIME_MSB   0x05
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_TAP_TIME_LSB   0x06
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_TAP_TIME_MSB   0x07
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_TAP_THD   0x08
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_MIN_SWIPE_VELOCITY   0x09
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_DOUBLE_TAP_TIME_LSB   0x0A
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_DOUBLE_TAP_TIME_MSB   0x0B
 
#define TOUCHPAD3_GESTURES_OFFSET_BYTE_GESTURE_EDGE_KEEP_OUT   0x0C
 
#define TOUCHPAD3_CONFIG_OFFSET_BYTE_SLP_LSW_LSB   0x00
 Touchpad 3 Offset Byte - Configuration.
 
#define TOUCHPAD3_CONFIG_OFFSET_BYTE_SLP_LSW_MSB   0x01
 
#define TOUCHPAD3_CONFIG_OFFSET_BYTE_SLP_MSW_LSB   0x02
 
#define TOUCHPAD3_CONFIG_OFFSET_BYTE_SLP_MSW_MSB   0x03
 
#define TOUCHPAD3_CONFIG_OFFSET_BYTE_TOUCH_PCK_CFG   0x07
 
#define TOUCHPAD3_CONFIG_OFFSET_BYTE_GESTURE_PCK_CFG   0x09
 
#define TOUCHPAD3_CONFIG_OFFSET_BYTE_STATUS_PCK_CFG   0x0A
 
#define TOUCHPAD3_IOSTATUS_OFFSET_BYTE_TX_SHORT_STATUS_LSB   0x02
 Touchpad 3 Offset Byte - I/O Status.
 
#define TOUCHPAD3_IOSTATUS_OFFSET_BYTE_TX_SHORT_STATUS_MSB   0x03
 
#define TOUCHPAD3_IOSTATUS_OFFSET_BYTE_RX_SHORT_STATUS_LSB   0x06
 
#define TOUCHPAD3_IOSTATUS_OFFSET_BYTE_RX_SHORT_STATUS_MSB   0x07
 
#define TOUCHPAD3_CONFIG_TOUCH_GESTURE_PCK_DISABLE   0x01
 Touchpad 3 Configuration Enable/Disable.
 
#define TOUCHPAD3_CONFIG_TOUCH_GESTURE_PCK_ENABLE   0x81
 
#define TOUCHPAD3_TOUCH_GESTURE_DISABLE   0x00
 Touchpad 3 touch.
 
#define TOUCHPAD3_TOUCH_GESTURE_ENABLE   0x01
 
#define TOUCHPAD3_GESTURE_SINGLE_TAP   0x10
 Touchpad 3 Gesture ID.
 
#define TOUCHPAD3_GESTURE_SINGLE_TAP_HOLD   0x11
 
#define TOUCHPAD3_GESTURE_DOUBLE_TAP   0x20
 
#define TOUCHPAD3_GESTURE_UP_SWIPE   0x31
 
#define TOUCHPAD3_GESTURE_UP_SWIPE_HOLD   0x32
 
#define TOUCHPAD3_GESTURE_RIGHT_SWIPE   0x41
 
#define TOUCHPAD3_GESTURE_RIGHT_SWIPE_HOLD   0x42
 
#define TOUCHPAD3_GESTURE_DOWN_SWIPE   0x51
 
#define TOUCHPAD3_GESTURE_DOWN_SWIPE_HOLD   0x52
 
#define TOUCHPAD3_GESTURE_LEFT_SWIPE   0x61
 
#define TOUCHPAD3_GESTURE_LEFT_SWIPE_HOLD   0x62
 
#define TOUCHPAD3_CMD_STATUS_SUCCESS   0x00
 Touchpad 3 command protocol status result.
 
#define TOUCHPAD3_CMD_STATUS_PARAM_OUT_OF_RANGE   0x80
 
#define TOUCHPAD3_CMD_STATUS_TIMEOUT   0xFE
 
#define TOUCHPAD3_CMD_STATUS_UNRECOGNIZED   0xFF
 
#define TOUCHPAD3_CMD_STATUS_INVALID_PARAM   0xFD
 
#define TOUCHPAD3_CMD_STATUS_MISSING_OR_EXTRA_PARAM   0xFC
 
#define TOUCHPAD3_T_AND_G_ID_BIT_MASK   0x0F
 Touchpad 3 bit mask.
 
#define TOUCHPAD3_TCH_STATE_BIT_MASK   0x01
 
#define TOUCHPAD3_PEN_STATE_BIT_MASK   0x01
 
#define TOUCHPAD3_5_BIT_MASK   0x1F
 
#define TOUCHPAD3_INT_STATUS_LOW   0x00
 Touchpad 3 interrupt status.
 
#define TOUCHPAD3_INT_STATUS_HIGH   0x01
 
#define TOUCHPAD3_STATUS_ERROR   0x00
 Touchpad 3 status.
 
#define TOUCHPAD3_STATUS_SUCCESS   0x01
 
#define TOUCHPAD3_STATE_TCH   0x00
 Touchpad 3 Touch or Gesture state.
 
#define TOUCHPAD3_STATE_GST   0x01
 
#define TOUCHPAD3_LEN_TCH   0x05
 
#define TOUCHPAD3_LEN_GST   0x02
 
#define TOUCHPAD3_SET_DEV_ADDR   0x25
 Touchpad 3 device address setting.
 
#define TOUCHPAD3_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  touchpad3_return_value_t { TOUCHPAD3_OK = 0 , TOUCHPAD3_ERROR = -1 }
 Touchpad 3 Click return value data. More...
 

Functions

void touchpad3_cfg_setup (touchpad3_cfg_t *cfg)
 Touchpad 3 configuration object setup function.
 
err_t touchpad3_init (touchpad3_t *ctx, touchpad3_cfg_t *cfg)
 Touchpad 3 initialization function.
 
err_t touchpad3_default_cfg (touchpad3_t *ctx)
 Touchpad 3 default configuration function.
 
uint8_t touchpad3_get_int (touchpad3_t *ctx)
 Touchpad 3 get interrupt function..
 
void touchpad3_hw_reset (touchpad3_t *ctx)
 Touchpad 3 hardware reset function.
 
void touchpad3_generic_write (touchpad3_t *ctx, uint8_t *tx_buf, uint8_t tx_len)
 Touchpad 3 I2C writing function.
 
err_t touchpad3_generic_read (touchpad3_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Touchpad 3 I2C reading function.
 
void touchpad3_general_configuration (touchpad3_t *ctx)
 Touchpad 3 general configuration function.
 
void touchpad3_decoding_configuration (touchpad3_t *ctx)
 Touchpad 3 decoding configuration function.
 
void touchpad3_sensor_mapping_configuration (touchpad3_t *ctx)
 Touchpad 3 sensor mapping configuration function.
 
uint8_t touchpad3_get_touch (touchpad3_t *ctx, touch_data_t *tch_data, uint16_t *x_axis, uint16_t *y_axis)
 Touchpad 3 get touch data function.
 
uint8_t touchpad3_get_gesture (touchpad3_t *ctx, touch_data_t *gst_data, uint8_t *gesture)
 Touchpad 3 get gesture data function.
 
uint8_t touchpad3_cmd_protocol (touchpad3_t *ctx, cmd_protocol_t cmd_data, uint8_t *p_tx_data, uint8_t *p_rx_data)
 Touchpad 3 command protocol function.
 
uint8_t touchpad3_write_reg (touchpad3_t *ctx, uint8_t index_loc, uint8_t offset_loc, uint8_t tx_data, uint8_t *p_response)
 Touchpad 3 write register data function.
 
uint8_t touchpad3_read_reg (touchpad3_t *ctx, uint8_t index_loc, uint8_t offset_loc, uint8_t *read_data, uint8_t *p_response)
 Touchpad 3 read register data function.
 
uint8_t touchpad3_manufacturing_test (touchpad3_t *ctx)
 Touchpad 3 manufacturing test function.
 
uint32_t touchpad3_get_device_id (touchpad3_t *ctx)
 Touchpad 3 get device id function.
 
uint8_t touchpad3_config_touch (touchpad3_t *ctx, uint8_t en_touch)
 Touchpad 3 configure touch function.
 
uint8_t touchpad3_config_gesture (touchpad3_t *ctx, uint8_t en_gesture)
 Touchpad 3 configure gesture function.
 

Detailed Description

This file contains API for Touchpad 3 Click Driver.

Enumeration Type Documentation

◆ touchpad3_return_value_t

Touchpad 3 Click return value data.

Predefined enum values for driver return values.

Enumerator
TOUCHPAD3_OK 
TOUCHPAD3_ERROR