Go to the documentation of this file.
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 CAPTOUCH4_REG_PRODUCT_NUM 0x00
74 #define CAPTOUCH4_REG_VERSION_NUM 0x01
75 #define CAPTOUCH4_REG_SYSFLAGS0 0x10
76 #define CAPTOUCH4_REG_MOVEMENT_VALUE 0x41
77 #define CAPTOUCH4_REG_CS_H 0x42
78 #define CAPTOUCH4_REG_CS_L 0x43
79 #define CAPTOUCH4_REG_LTA_H 0x83
80 #define CAPTOUCH4_REG_LTA_L 0x84
81 #define CAPTOUCH4_REG_TOUCH_THRESHOLD_H 0x90
82 #define CAPTOUCH4_REG_TOUCH_THRESHOLD_L 0x91
83 #define CAPTOUCH4_REG_MULTIPLIERS 0xC4
84 #define CAPTOUCH4_REG_COMPENSATION 0xC5
85 #define CAPTOUCH4_REG_PROX_SETTINGS0 0xC6
86 #define CAPTOUCH4_REG_PROX_SETTINGS1 0xC7
87 #define CAPTOUCH4_REG_PROX_SETTINGS2 0xC8
88 #define CAPTOUCH4_REG_ATI_TARGET 0xC9
89 #define CAPTOUCH4_REG_LP_PERIOD 0xCA
90 #define CAPTOUCH4_REG_PROX_THRESHOLD 0xCB
91 #define CAPTOUCH4_REG_TOUCH_THRESHOLD 0xCC
92 #define CAPTOUCH4_REG_MOVEMENT_THRESHOLD 0xCD
93 #define CAPTOUCH4_REG_AUTO_RESEED_LIMIT 0xCE
94 #define CAPTOUCH4_REG_TEST_MODE 0x0F
95 #define CAPTOUCH4_REG_OTP_BANK_0 0x10
96 #define CAPTOUCH4_REG_OTP_BANK_1 0x11
97 #define CAPTOUCH4_REG_OTP_BANK_2 0x12
98 #define CAPTOUCH4_REG_OTP_BANK_3 0x13
99 #define CAPTOUCH4_REG_OTP_BANK_4 0x14
117 #define CAPTOUCH4_TEST_MODE_OK 0xA5
118 #define CAPTOUCH4_OTP_BANK_2_OUT_I2C_NO_WKP 0x05
124 #define CAPTOUCH4_SYSFLAGS0_MOVEMENT 0x80
125 #define CAPTOUCH4_SYSFLAGS0_MOVEMENT_LATCH 0x40
126 #define CAPTOUCH4_SYSFLAGS0_PROX 0x20
127 #define CAPTOUCH4_SYSFLAGS0_TOUCH 0x10
128 #define CAPTOUCH4_SYSFLAGS0_SHOW_RESET 0x08
129 #define CAPTOUCH4_SYSFLAGS0_ATI_BUSY 0x04
130 #define CAPTOUCH4_SYSFLAGS0_FILTER_HALT 0x02
131 #define CAPTOUCH4_SYSFLAGS0_LP_ACTIVE 0x01
132 #define CAPTOUCH4_SYSFLAGS0_CLEAR 0x01
138 #define CAPTOUCH4_PRODUCT_NUMBER 0x3D
139 #define CAPTOUCH4_VERSION_NUMBER 0x02
145 #define CAPTOUCH4_I2C_TIMEOUT 100000ul
152 #define CAPTOUCH4_DEVICE_ADDRESS 0x47
170 #define CAPTOUCH4_MAP_MIKROBUS( cfg, mikrobus ) \
171 cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
172 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
173 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA );
393 #endif // CAPTOUCH4_H
err_t captouch4_read_cap_counts(captouch4_t *ctx, uint16_t *cap_counts)
Cap Touch 4 read cap counts function.
void captouch4_enable_device(captouch4_t *ctx)
Cap Touch 4 enable device function.
pin_name_t en
Definition: captouch4.h:205
err_t captouch4_read_lta(captouch4_t *ctx, uint16_t *lta)
Cap Touch 4 read lta function.
err_t captouch4_init(captouch4_t *ctx, captouch4_cfg_t *cfg)
Cap Touch 4 initialization function.
void captouch4_cfg_setup(captouch4_cfg_t *cfg)
Cap Touch 4 configuration object setup function.
err_t captouch4_read_reg(captouch4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Cap Touch 4 read reg function.
pin_name_t scl
Definition: captouch4.h:203
err_t captouch4_read_system_flags(captouch4_t *ctx, uint8_t *sysflags)
Cap Touch 4 read system flags function.
uint8_t i2c_started
Definition: captouch4.h:190
Cap Touch 4 Click context object.
Definition: captouch4.h:183
err_t captouch4_read_movement(captouch4_t *ctx, uint8_t *movement)
Cap Touch 4 read movement function.
pin_name_t scl
Definition: captouch4.h:187
@ CAPTOUCH4_ERROR
Definition: captouch4.h:218
@ CAPTOUCH4_OK
Definition: captouch4.h:217
err_t captouch4_write_reg(captouch4_t *ctx, uint8_t reg, uint8_t data_in)
Cap Touch 4 write reg function.
err_t captouch4_check_communication(captouch4_t *ctx)
Cap Touch 4 check communication function.
err_t captouch4_default_cfg(captouch4_t *ctx)
Cap Touch 4 default configuration function.
captouch4_return_value_t
Cap Touch 4 Click return value data.
Definition: captouch4.h:216
uint8_t i2c_address
Definition: captouch4.h:207
uint8_t slave_address
Definition: captouch4.h:193
pin_name_t sda
Definition: captouch4.h:204
Cap Touch 4 Click configuration object.
Definition: captouch4.h:202
void captouch4_disable_device(captouch4_t *ctx)
Cap Touch 4 disable device function.
digital_out_t en
Definition: captouch4.h:184
pin_name_t sda
Definition: captouch4.h:188