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 TOUCHPAD5_CMD_VERSION_INFO 0x00
74#define TOUCHPAD5_CMD_XY_DATA 0x01
75#define TOUCHPAD5_CMD_PROXIMITY_STATUS 0x02
76#define TOUCHPAD5_CMD_TOUCH_STATUS 0x03
77#define TOUCHPAD5_CMD_COUNT_VALUES 0x04
78#define TOUCHPAD5_CMD_LONG_TERM_AVERAGES 0x05
79#define TOUCHPAD5_CMD_ATI_COMPENSATION 0x06
80#define TOUCHPAD5_CMD_PORT_CONTROL 0x07
81#define TOUCHPAD5_CMD_SNAP_STATUS 0x08
82#define TOUCHPAD5_CMD_CONTROL_SETTINGS 0x10
83#define TOUCHPAD5_CMD_THRESHOLD_SETTINGS 0x11
84#define TOUCHPAD5_CMD_ATI_SETTINGS 0x12
85#define TOUCHPAD5_CMD_FILTER_SETTINGS 0x13
86#define TOUCHPAD5_CMD_TIMING_SETTINGS 0x14
87#define TOUCHPAD5_CMD_CHANNEL_SETUP 0x15
88#define TOUCHPAD5_CMD_HARDWARE_CONFIG_SETTINGS 0x16
89#define TOUCHPAD5_CMD_ACTIVE_CHANNELS 0x17
90#define TOUCHPAD5_CMD_DEBOUNCE_SETTINGS 0x18
91#define TOUCHPAD5_CMD_PM_PROXIMITY_STATUS 0x20
92#define TOUCHPAD5_CMD_PM_COUNT_VALUES 0x21
93#define TOUCHPAD5_CMD_PM_LONG_TERM_AVERAGES 0x22
94#define TOUCHPAD5_CMD_PM_ATI_COMPENSATION 0x23
95#define TOUCHPAD5_CMD_PM_ATI_SETTINGS 0x24
96#define TOUCHPAD5_CMD_BOOTLOADER 0xFF
115#define TOUCHPAD5_SET_DEV_ADDR 0x74
128#define TOUCHPAD5_SHOW_RESET 0x80
129#define TOUCHPAD5_MODE_INDICATOR 0x40
130#define TOUCHPAD5_NOISE_STATUS 0x20
131#define TOUCHPAD5_LP_STATUS 0x10
132#define TOUCHPAD5_SNAP_OUTPUT 0x08
133#define TOUCHPAD5_NO_OF_FINGERS 0x07
140#define TOUCHPAD5_ACK_RESET 0x80
141#define TOUCHPAD5_AUTO_MODES 0x40
142#define TOUCHPAD5_SINGLE_XY 0x20
143#define TOUCHPAD5_PM_RESEED 0x10
144#define TOUCHPAD5_MODE_SELECT 0x08
145#define TOUCHPAD5_AUTO_ATI 0x04
146#define TOUCHPAD5_TRACKPAD_RESEED 0x02
147#define TOUCHPAD5_EVENT_MODE 0x01
148#define TOUCHPAD5_DIS_PROX_EVENT 0x80
149#define TOUCHPAD5_DIS_TOUCH_EVENT 0x40
150#define TOUCHPAD5_DIS_SNAP_EVENT 0x20
151#define TOUCHPAD5_DIS_PMPROX_EVENT 0x10
152#define TOUCHPAD5_REVERSE_EN 0x08
153#define TOUCHPAD5_SLEEP_EN 0x04
154#define TOUCHPAD5_LOW_POWER 0x02
155#define TOUCHPAD5_SNAP_EN 0x01
162#define TOUCHPAD5_DIS_NM_FILTER 0x10
163#define TOUCHPAD5_DIS_PM_FILTER 0x08
164#define TOUCHPAD5_SELECT_TOUCH_FILTER 0x04
165#define TOUCHPAD5_DIS_HOVER_FILTER 0x02
166#define TOUCHPAD5_DIS_TOUCH_FILTER 0x01
173#define TOUCHPAD5_CHARGE_TYPE_SELF_CHARG 0x80
174#define TOUCHPAD5_CHARGE_MUTUAL_SELF_CHARG 0x00
175#define TOUCHPAD5_RX_GROUP_RXB 0x40
176#define TOUCHPAD5_RX_GROUP_RXA 0x00
177#define TOUCHPAD5_SUM_OF_TP_RX 0x10
178#define TOUCHPAD5_SUM_OF_TP_TX 0x00
179#define TOUCHPAD5_RX_SELECT 0x0F
180#define TOUCHPAD5_TX_HIGH_DFLT 0x1F
181#define TOUCHPAD5_TX_LOW_DFLT 0xFF
188#define TOUCHPAD5_ND_ENABLE 0x20
189#define TOUCHPAD5_RX_FLOAT 0x04
190#define TOUCHPAD5_CK_FREQ_2 0x40
191#define TOUCHPAD5_CK_FREQ_1 0x20
192#define TOUCHPAD5_CK_FREQ_0 0x10
193#define TOUCHPAD5_ANA_DEAD_TIME 0x02
194#define TOUCHPAD5_INCR_PHASE 0x01
195#define TOUCHPAD5_STAB_TIME_1 0x80
196#define TOUCHPAD5_STAB_TIME_0 0x40
197#define TOUCHPAD5_OPAMP_BIAS_1 0x20
198#define TOUCHPAD5_OPAMP_BIAS_0 0x10
199#define TOUCHPAD5_VTRIP_3 0x08
200#define TOUCHPAD5_VTRIP_2 0x04
201#define TOUCHPAD5_VTRIP_1 0x02
202#define TOUCHPAD5_VTRIP_0 0x01
203#define TOUCHPAD5_UPLEN_2 0x40
204#define TOUCHPAD5_UPLEN_1 0x20
205#define TOUCHPAD5_UPLEN_0 0x10
206#define TOUCHPAD5_PASSLEN_2 0x04
207#define TOUCHPAD5_PASSLEN_1 0x02
208#define TOUCHPAD5_PASSLEN_0 0x01
215#define TOUCHPAD5_PALM_REJECT 0x08
216#define TOUCHPAD5_SWITCH_XY_AXIS 0x04
217#define TOUCHPAD5_FLIP_Y 0x02
218#define TOUCHPAD5_FLIP_X 0x01
225#define TOUCHPAD5_PROX_EVENT 0x80
226#define TOUCHPAD5_TOUCH_EVENT 0x40
227#define TOUCHPAD5_SNAP_EVENT 0x20
228#define TOUCHPAD5_ALP_PROX_EVENT 0x10
229#define TOUCHPAD5_REATI_EVENT 0x08
230#define TOUCHPAD5_TP_EVENT 0x04
231#define TOUCHPAD5_GESTURE_EVENT 0x02
232#define TOUCHPAD5_EVENT_MODE 0x01
233#define TOUCHPAD5_ALP_COUNT_FILTER 0x08
234#define TOUCHPAD5_IIR_SELECT 0x04
235#define TOUCHPAD5_MAV_FILTER 0x02
236#define TOUCHPAD5_IIR_FILTER 0x01
243#define TOUCHPAD5_CHARGE_TYPE 0x80
244#define TOUCHPAD5_RX_GROUP 0x40
245#define TOUCHPAD5_PROX_REV 0x20
246#define TOUCHPAD5_ALP_ENABLE 0x10
253#define TOUCHPAD5_RX7_TX2 0x80
254#define TOUCHPAD5_RX6_TX3 0x40
255#define TOUCHPAD5_RX5_TX4 0x20
256#define TOUCHPAD5_RX4_TX5 0x10
257#define TOUCHPAD5_RX3_TX6 0x08
258#define TOUCHPAD5_RX2_TX7 0x04
259#define TOUCHPAD5_RX1_TX8 0x02
260#define TOUCHPAD5_RX0_TX9 0x01
279#define TOUCHPAD5_PROXIMITY_STATUS 0x02
280#define TOUCHPAD5_TOUCH_STATUS 0x01
281#define TOUCHPAD5_SNAP_STATUS 0x05
295#define TOUCHPAD5_ID_TAG_TOUCH_1 0x01
296#define TOUCHPAD5_ID_TAG_TOUCH_2 0x02
297#define TOUCHPAD5_ID_TAG_TOUCH_3 0x03
298#define TOUCHPAD5_ID_TAG_TOUCH_4 0x04
299#define TOUCHPAD5_ID_TAG_TOUCH_5 0x05
300#define TOUCHPAD5_ID_TAG_HOVER_1 0x81
301#define TOUCHPAD5_ID_TAG_HOVER_2 0x82
302#define TOUCHPAD5_ID_TAG_HOVER_3 0x83
303#define TOUCHPAD5_ID_TAG_HOVER_4 0x84
304#define TOUCHPAD5_ID_TAG_HOVER_5 0x85
323#define TOUCHPAD5_MAP_MIKROBUS( cfg, mikrobus ) \
324 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
325 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
326 cfg.nrst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
327 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
340#define TOUCHPAD5_IQS550_PRODUCT_NUMBER 40
err_t touchpad5_check_bl_status(touchpad5_t *ctx, uint8_t *rx_buf)
TouchPad 5 Check Bootloader Status.
err_t touchpad5_get_all_data(touchpad5_t *ctx, uint8_t *rx_data)
TouchPad 5 get all data function.
err_t touchpad5_get_status(touchpad5_t *ctx, uint8_t sel_status, uint16_t *rx_data, uint8_t num_of_samples)
TouchPad 5 get status function.
uint8_t touchpad5_check_interrupt(touchpad5_t *ctx)
TouchPad 5 check interrupt function.
void touchpad5_cfg_setup(touchpad5_cfg_t *cfg)
Touchpad 5 configuration object setup function.
err_t touchpad5_init(touchpad5_t *ctx, touchpad5_cfg_t *cfg)
Touchpad 5 initialization function.
err_t touchpad5_generic_read(touchpad5_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Touchpad 5 I2C reading function.
void touchpad5_wait_ready(touchpad5_t *ctx)
TouchPad 5 wait ready function.
err_t touchpad5_default_cfg(touchpad5_t *ctx)
Touchpad 5 default configuration function.
err_t touchpad5_threshold_setup(touchpad5_t *ctx, touchpad5_threshold_settings_t thresh_setup)
TouchPad 5 threshold setup function.
err_t touchpad5_channel_setup(touchpad5_t *ctx, touchpad5_channel_setup_t ch_setup)
TouchPad 5 channel setup function.
err_t touchpad5_control_setup(touchpad5_t *ctx, touchpad5_control_settings_t ctrl_setup)
TouchPad 5 control setup function.
err_t touchpad5_generic_write(touchpad5_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Touchpad 5 I2C writing function.
err_t touchpad5_get_touch(touchpad5_t *ctx, touchpad5_touch_t *touch_data)
TouchPad 5 get touch function.
err_t touchpad5_check_version(touchpad5_t *ctx, touchpad5_ver_info_t *ver_info)
TouchPad 5 Check Version function.
void touchpad5_reset(touchpad5_t *ctx)
Touchpad 5 reset function.
Touchpad 5 Click configuration object.
Definition touchpad5.h:371
uint32_t i2c_speed
Definition touchpad5.h:378
pin_name_t nrst
Definition touchpad5.h:375
pin_name_t scl
Definition touchpad5.h:372
pin_name_t int_pin
Definition touchpad5.h:376
pin_name_t sda
Definition touchpad5.h:373
uint8_t i2c_address
Definition touchpad5.h:379
TouchPad 5 Channel Setup object.
Definition touchpad5.h:416
uint8_t pm_setup
Definition touchpad5.h:421
uint8_t track_pad_rx
Definition touchpad5.h:419
uint8_t total_rx
Definition touchpad5.h:417
uint16_t tx_config
Definition touchpad5.h:422
uint8_t track_pad_tx
Definition touchpad5.h:420
uint8_t total_tx
Definition touchpad5.h:418
TouchPad 5 Control Settings object.
Definition touchpad5.h:449
uint8_t ctrl_settings1
Definition touchpad5.h:451
uint8_t ctrl_settings0
Definition touchpad5.h:450
Touchpad 5 Click context object.
Definition touchpad5.h:351
digital_in_t int_pin
Definition touchpad5.h:356
i2c_master_t i2c
Definition touchpad5.h:359
uint8_t slave_address
Definition touchpad5.h:362
digital_out_t nrst
Definition touchpad5.h:353
TouchPad 5 Threshold Settings object.
Definition touchpad5.h:431
uint8_t snap_thresh_high
Definition touchpad5.h:436
uint8_t prox_thresh2
Definition touchpad5.h:438
uint8_t pm_prox_thresh
Definition touchpad5.h:435
uint8_t snap_thresh_low
Definition touchpad5.h:437
uint8_t touch_thresh_mult2
Definition touchpad5.h:439
uint8_t touch_thresh_shift2
Definition touchpad5.h:440
uint8_t prox_thresh
Definition touchpad5.h:432
uint8_t touch_thresh_mult
Definition touchpad5.h:433
uint8_t touch_thresh_shift
Definition touchpad5.h:434
TouchPad 5 XY data object.
Definition touchpad5.h:401
uint8_t xy_info
Definition touchpad5.h:402
uint16_t touch_strength
Definition touchpad5.h:407
uint16_t y_pos
Definition touchpad5.h:406
uint16_t x_pos
Definition touchpad5.h:405
uint8_t no_of_fingers
Definition touchpad5.h:403
uint8_t id_tag
Definition touchpad5.h:404
TouchPad 5 device version information object.
Definition touchpad5.h:388
uint16_t product_num
Definition touchpad5.h:389
uint16_t project_num
Definition touchpad5.h:390
uint16_t hw_revision
Definition touchpad5.h:393
float version
Definition touchpad5.h:391
uint16_t hw_id
Definition touchpad5.h:392
touchpad5_return_value_t
Touchpad 5 Click return value data.
Definition touchpad5.h:460
@ TOUCHPAD5_ERROR
Definition touchpad5.h:462
@ TOUCHPAD5_OK
Definition touchpad5.h:461