39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
73#define TOUCHPAD2_CMD_VERSION_INFO 0x00
74#define TOUCHPAD2_CMD_XY_DATA 0x01
75#define TOUCHPAD2_CMD_PROXIMITY_STATUS 0x02
76#define TOUCHPAD2_CMD_TOUCH_STATUS 0x03
77#define TOUCHPAD2_CMD_COUNT_VALUES 0x04
78#define TOUCHPAD2_CMD_LONG_TERM_AVERAGES 0x05
79#define TOUCHPAD2_CMD_ATI_COMPENSATION 0x06
80#define TOUCHPAD2_CMD_PORT_CONTROL 0x07
81#define TOUCHPAD2_CMD_SNAP_STATUS 0x08
82#define TOUCHPAD2_CMD_CONTROL_SETTINGS 0x10
83#define TOUCHPAD2_CMD_THRESHOLD_SETTINGS 0x11
84#define TOUCHPAD2_CMD_ATI_SETTINGS 0x12
85#define TOUCHPAD2_CMD_FILTER_SETTINGS 0x13
86#define TOUCHPAD2_CMD_TIMING_SETTINGS 0x14
87#define TOUCHPAD2_CMD_CHANNEL_SETUP 0x15
88#define TOUCHPAD2_CMD_HARDWARE_CONFIG_SETTINGS 0x16
89#define TOUCHPAD2_CMD_ACTIVE_CHANNELS 0x17
90#define TOUCHPAD2_CMD_DEBOUNCE_SETTINGS 0x18
91#define TOUCHPAD2_CMD_PM_PROXIMITY_STATUS 0x20
92#define TOUCHPAD2_CMD_PM_COUNT_VALUES 0x21
93#define TOUCHPAD2_CMD_PM_LONG_TERM_AVERAGES 0x22
94#define TOUCHPAD2_CMD_PM_ATI_COMPENSATION 0x23
95#define TOUCHPAD2_CMD_PM_ATI_SETTINGS 0x24
96#define TOUCHPAD2_CMD_BOOTLOADER 0xFF
120#define TOUCHPAD2_SET_DEV_ADDR 0x74
127#define TOUCHPAD2_SHOW_RESET 0x80
128#define TOUCHPAD2_MODE_INDICATOR 0x40
129#define TOUCHPAD2_NOISE_STATUS 0x20
130#define TOUCHPAD2_LP_STATUS 0x10
131#define TOUCHPAD2_SNAP_OUTPUT 0x08
132#define TOUCHPAD2_NO_OF_FINGERS 0x07
139#define TOUCHPAD2_ACK_RESET 0x80
140#define TOUCHPAD2_AUTO_MODES 0x40
141#define TOUCHPAD2_SINGLE_XY 0x20
142#define TOUCHPAD2_PM_RESEED 0x10
143#define TOUCHPAD2_MODE_SELECT 0x08
144#define TOUCHPAD2_AUTO_ATI 0x04
145#define TOUCHPAD2_TRACKPAD_RESEED 0x02
146#define TOUCHPAD2_EVENT_MODE 0x01
147#define TOUCHPAD2_DIS_PROX_EVENT 0x80
148#define TOUCHPAD2_DIS_TOUCH_EVENT 0x40
149#define TOUCHPAD2_DIS_SNAP_EVENT 0x20
150#define TOUCHPAD2_DIS_PMPROX_EVENT 0x10
151#define TOUCHPAD2_REVERSE_EN 0x08
152#define TOUCHPAD2_SLEEP_EN 0x04
153#define TOUCHPAD2_LOW_POWER 0x02
154#define TOUCHPAD2_SNAP_EN 0x01
161#define TOUCHPAD2_DIS_NM_FILTER 0x10
162#define TOUCHPAD2_DIS_PM_FILTER 0x08
163#define TOUCHPAD2_SELECT_TOUCH_FILTER 0x04
164#define TOUCHPAD2_DIS_HOVER_FILTER 0x02
165#define TOUCHPAD2_DIS_TOUCH_FILTER 0x01
172#define TOUCHPAD2_CHARGE_TYPE_SELF_CHARG 0x80
173#define TOUCHPAD2_CHARGE_MUTUAL_SELF_CHARG 0x00
174#define TOUCHPAD2_RX_GROUP_RXB 0x40
175#define TOUCHPAD2_RX_GROUP_RXA 0x00
176#define TOUCHPAD2_SUM_OF_TP_RX 0x10
177#define TOUCHPAD2_SUM_OF_TP_TX 0x00
178#define TOUCHPAD2_RX_SELECT 0x0F
179#define TOUCHPAD2_TX_CFG_DEFAULT 0x001F
186#define TOUCHPAD2_ND_ENABLE 0x20
187#define TOUCHPAD2_RX_FLOAT 0x04
188#define TOUCHPAD2_CK_FREQ_2 0x40
189#define TOUCHPAD2_CK_FREQ_1 0x20
190#define TOUCHPAD2_CK_FREQ_0 0x10
191#define TOUCHPAD2_ANA_DEAD_TIME 0x02
192#define TOUCHPAD2_INCR_PHASE 0x01
193#define TOUCHPAD2_STAB_TIME_1 0x80
194#define TOUCHPAD2_STAB_TIME_0 0x40
195#define TOUCHPAD2_OPAMP_BIAS_1 0x20
196#define TOUCHPAD2_OPAMP_BIAS_0 0x10
197#define TOUCHPAD2_VTRIP_3 0x08
198#define TOUCHPAD2_VTRIP_2 0x04
199#define TOUCHPAD2_VTRIP_1 0x02
200#define TOUCHPAD2_VTRIP_0 0x01
201#define TOUCHPAD2_UPLEN_2 0x40
202#define TOUCHPAD2_UPLEN_1 0x20
203#define TOUCHPAD2_UPLEN_0 0x10
204#define TOUCHPAD2_PASSLEN_2 0x04
205#define TOUCHPAD2_PASSLEN_1 0x02
206#define TOUCHPAD2_PASSLEN_0 0x01
213#define TOUCHPAD2_PALM_REJECT 0x08
214#define TOUCHPAD2_SWITCH_XY_AXIS 0x04
215#define TOUCHPAD2_FLIP_Y 0x02
216#define TOUCHPAD2_FLIP_X 0x01
223#define TOUCHPAD2_PROX_EVENT 0x80
224#define TOUCHPAD2_TOUCH_EVENT 0x40
225#define TOUCHPAD2_SNAP_EVENT 0x20
226#define TOUCHPAD2_ALP_PROX_EVENT 0x10
227#define TOUCHPAD2_REATI_EVENT 0x08
228#define TOUCHPAD2_TP_EVENT 0x04
229#define TOUCHPAD2_GESTURE_EVENT 0x02
230#define TOUCHPAD2_EVENT_MODE 0x01
231#define TOUCHPAD2_ALP_COUNT_FILTER 0x08
232#define TOUCHPAD2_IIR_SELECT 0x04
233#define TOUCHPAD2_MAV_FILTER 0x02
234#define TOUCHPAD2_IIR_FILTER 0x01
241#define TOUCHPAD2_CHARGE_TYPE 0x80
242#define TOUCHPAD2_RX_GROUP 0x40
243#define TOUCHPAD2_PROX_REV 0x20
244#define TOUCHPAD2_ALP_ENABLE 0x10
251#define TOUCHPAD2_RX7_TX2 0x80
252#define TOUCHPAD2_RX6_TX3 0x40
253#define TOUCHPAD2_RX5_TX4 0x20
254#define TOUCHPAD2_RX4_TX5 0x10
255#define TOUCHPAD2_RX3_TX6 0x08
256#define TOUCHPAD2_RX2_TX7 0x04
257#define TOUCHPAD2_RX1_TX8 0x02
258#define TOUCHPAD2_RX0_TX9 0x01
282#define TOUCHPAD2_PROXIMITY_STATUS 0x00
283#define TOUCHPAD2_TOUCH_STATUS 0x01
284#define TOUCHPAD2_SNAP_STATUS 0x02
298#define TOUCHPAD2_ID_TAG_TOUCH_1 0x01
299#define TOUCHPAD2_ID_TAG_TOUCH_2 0x02
300#define TOUCHPAD2_ID_TAG_TOUCH_3 0x03
301#define TOUCHPAD2_ID_TAG_TOUCH_4 0x04
302#define TOUCHPAD2_ID_TAG_TOUCH_5 0x05
303#define TOUCHPAD2_ID_TAG_HOVER_1 0x81
304#define TOUCHPAD2_ID_TAG_HOVER_2 0x82
305#define TOUCHPAD2_ID_TAG_HOVER_3 0x83
306#define TOUCHPAD2_ID_TAG_HOVER_4 0x84
307#define TOUCHPAD2_ID_TAG_HOVER_5 0x85
321#define TOUCHPAD2_IQS525_PRODUCT_NUMBER 0x34
340#define TOUCHPAD2_MAP_MIKROBUS( cfg, mikrobus ) \
341 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
342 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
343 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t touchpad2_get_status(touchpad2_t *ctx, uint8_t sel_status, uint16_t *rx_data)
TouchPad 2 get status function.
err_t touchpad2_default_cfg(touchpad2_t *ctx)
TouchPad 2 default configuration function.
err_t touchpad2_generic_read(touchpad2_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
TouchPad 2 I2C reading function.
err_t touchpad2_channel_setup(touchpad2_t *ctx, touchpad2_channel_setup_t ch_setup)
TouchPad 2 channel setup function.
err_t touchpad2_get_all_data(touchpad2_t *ctx, uint8_t *rx_data)
TouchPad 2 get all data function.
err_t touchpad2_check_version(touchpad2_t *ctx, touchpad2_ver_info_t *ver_info)
TouchPad 2 check version function.
void touchpad2_cfg_setup(touchpad2_cfg_t *cfg)
TouchPad 2 configuration object setup function.
void touchpad2_wait_ready(touchpad2_t *ctx)
TouchPad 2 wait ready function.
uint8_t touchpad2_check_interrupt(touchpad2_t *ctx)
TouchPad 2 check interrupt function.
err_t touchpad2_init(touchpad2_t *ctx, touchpad2_cfg_t *cfg)
TouchPad 2 initialization function.
err_t touchpad2_generic_write(touchpad2_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
TouchPad 2 I2C writing function.
err_t touchpad2_get_touch(touchpad2_t *ctx, touchpad2_touch_t *touch_data)
TouchPad 2 get touch function.
touchpad2_touch_t touch_data
Definition main.c:32
touchpad2_ver_info_t ver_info
Definition main.c:31
TouchPad 2 Click configuration object.
Definition touchpad2.h:373
uint32_t i2c_speed
Definition touchpad2.h:379
pin_name_t scl
Definition touchpad2.h:374
pin_name_t int_pin
Definition touchpad2.h:377
pin_name_t sda
Definition touchpad2.h:375
uint8_t i2c_address
Definition touchpad2.h:380
TouchPad Channel Setup object.
Definition touchpad2.h:418
uint8_t pm_setup
Definition touchpad2.h:423
uint8_t track_pad_rx
Definition touchpad2.h:421
uint8_t total_rx
Definition touchpad2.h:419
uint16_t tx_config
Definition touchpad2.h:424
uint8_t track_pad_tx
Definition touchpad2.h:422
uint8_t total_tx
Definition touchpad2.h:420
TouchPad 2 Click context object.
Definition touchpad2.h:353
digital_in_t int_pin
Definition touchpad2.h:356
i2c_master_t i2c
Definition touchpad2.h:360
uint8_t slave_address
Definition touchpad2.h:364
TouchPad 2 XY data object.
Definition touchpad2.h:403
uint8_t xy_info
Definition touchpad2.h:404
uint16_t y_pos
Definition touchpad2.h:408
uint16_t touch_str
Definition touchpad2.h:409
uint16_t x_pos
Definition touchpad2.h:407
uint8_t no_of_fingers
Definition touchpad2.h:405
uint8_t id_tag
Definition touchpad2.h:406
TouchPad 2 device version information object.
Definition touchpad2.h:389
uint16_t product_num
Definition touchpad2.h:390
uint16_t hw_revision
Definition touchpad2.h:394
float version
Definition touchpad2.h:392
uint16_t projec_num
Definition touchpad2.h:391
uint16_t hw_id
Definition touchpad2.h:393
touchpad2_return_value_t
TouchPad 2 Click return value data.
Definition touchpad2.h:433
@ TOUCHPAD2_OK
Definition touchpad2.h:434
@ TOUCHPAD2_ERROR
Definition touchpad2.h:435