Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
59 #define LDCTOUCH_REG_STATUS 0x00
60 #define LDCTOUCH_REG_OUT 0x01
61 #define LDCTOUCH_REG_DATA0_LSB 0x02
62 #define LDCTOUCH_REG_DATA0_MSB 0x03
63 #define LDCTOUCH_REG_DATA1_LSB 0x04
64 #define LDCTOUCH_REG_DATA1_MSB 0x05
65 #define LDCTOUCH_REG_DATA2_LSB 0x06
66 #define LDCTOUCH_REG_DATA2_MSB 0x07
67 #define LDCTOUCH_REG_DATA3_LSB 0x08
68 #define LDCTOUCH_REG_DATA3_MSB 0x09
69 #define LDCTOUCH_REG_RESET 0x0A
70 #define LDCTOUCH_REG_EN 0x0C
71 #define LDCTOUCH_REG_NP_SCAN_RATE 0x0D
72 #define LDCTOUCH_REG_GAIN0 0x0E
73 #define LDCTOUCH_REG_LP_SCAN_RATE 0x0F
74 #define LDCTOUCH_REG_GAIN1 0x10
75 #define LDCTOUCH_REG_INTPOL 0x11
76 #define LDCTOUCH_REG_GAIN2 0x12
77 #define LDCTOUCH_REG_LP_BASE_INC 0x13
78 #define LDCTOUCH_REG_GAIN3 0x14
79 #define LDCTOUCH_REG_NP_BASE_INC 0x15
80 #define LDCTOUCH_REG_BTPAUSE_MAXWIN 0x16
81 #define LDCTOUCH_REG_LC_DIVIDER 0x17
82 #define LDCTOUCH_REG_HYST 0x18
83 #define LDCTOUCH_REG_TWIST 0x19
84 #define LDCTOUCH_REG_COMMON_DEFORM 0x1A
85 #define LDCTOUCH_REG_OPOL_DPOL 0x1C
86 #define LDCTOUCH_REG_CNTSC 0x1E
87 #define LDCTOUCH_REG_SENSOR0_CONFIG 0x20
88 #define LDCTOUCH_REG_SENSOR1_CONFIG 0x22
89 #define LDCTOUCH_REG_SENSOR2_CONFIG 0x24
90 #define LDCTOUCH_REG_FTF0 0x25
91 #define LDCTOUCH_REG_SENSOR3_CONFIG 0x26
92 #define LDCTOUCH_REG_FTF1_2 0x28
93 #define LDCTOUCH_REG_FTF3 0x2B
94 #define LDCTOUCH_REG_RAW_DATA0_3 0x59
95 #define LDCTOUCH_REG_RAW_DATA0_2 0x5A
96 #define LDCTOUCH_REG_RAW_DATA0_1 0x5B
97 #define LDCTOUCH_REG_RAW_DATA1_3 0x5C
98 #define LDCTOUCH_REG_RAW_DATA1_2 0x5D
99 #define LDCTOUCH_REG_RAW_DATA1_1 0x5E
100 #define LDCTOUCH_REG_RAW_DATA2_3 0x5F
101 #define LDCTOUCH_REG_RAW_DATA2_2 0x60
102 #define LDCTOUCH_REG_RAW_DATA2_1 0x61
103 #define LDCTOUCH_REG_RAW_DATA3_3 0x62
104 #define LDCTOUCH_REG_RAW_DATA3_2 0x63
105 #define LDCTOUCH_REG_RAW_DATA3_1 0x64
106 #define LDCTOUCH_REG_MANUFACTURER_ID_LSB 0xFC
107 #define LDCTOUCH_REG_MANUFACTURER_ID_MSB 0xFD
108 #define LDCTOUCH_REG_DEVICE_ID_LSB 0xFE
109 #define LDCTOUCH_REG_DEVICE_ID_MSB 0xFF
127 #define LDCTOUCH_STATUS_OUT 0x80
128 #define LDCTOUCH_STATUS_CHIP_READY 0x40
129 #define LDCTOUCH_STATUS_READY_TO_WRITE 0x20
130 #define LDCTOUCH_STATUS_MAXOUT 0x10
131 #define LDCTOUCH_STATUS_FSM_WD 0x08
132 #define LDCTOUCH_STATUS_LC_WD 0x04
133 #define LDCTOUCH_STATUS_TIMEOUT 0x02
134 #define LDCTOUCH_STATUS_REGISTER_FLAG 0x01
140 #define LDCTOUCH_MODE_NORMAL 0x00
141 #define LDCTOUCH_MODE_CONFIG 0x01
142 #define LDCTOUCH_MODE_FULL_RESET 0x10
148 #define LDCTOUCH_EN_CH3_LP 0x80
149 #define LDCTOUCH_EN_CH2_LP 0x40
150 #define LDCTOUCH_EN_CH1_LP 0x20
151 #define LDCTOUCH_EN_CH0_LP 0x10
152 #define LDCTOUCH_EN_CH3_NP 0x08
153 #define LDCTOUCH_EN_CH2_NP 0x04
154 #define LDCTOUCH_EN_CH1_NP 0x02
155 #define LDCTOUCH_EN_CH0_NP 0x01
161 #define LDCTOUCH_OPOL3_ACTIVE_HIGH 0x80
162 #define LDCTOUCH_OPOL3_ACTIVE_LOW 0x00
163 #define LDCTOUCH_OPOL2_ACTIVE_HIGH 0x40
164 #define LDCTOUCH_OPOL2_ACTIVE_LOW 0x00
165 #define LDCTOUCH_OPOL1_ACTIVE_HIGH 0x20
166 #define LDCTOUCH_OPOL1_ACTIVE_LOW 0x00
167 #define LDCTOUCH_OPOL0_ACTIVE_HIGH 0x10
168 #define LDCTOUCH_OPOL0_ACTIVE_LOW 0x00
169 #define LDCTOUCH_DPOL3_DATA_INCREASES 0x08
170 #define LDCTOUCH_DPOL3_DATA_DECREASES 0x00
171 #define LDCTOUCH_DPOL2_DATA_INCREASES 0x04
172 #define LDCTOUCH_DPOL2_DATA_DECREASES 0x00
173 #define LDCTOUCH_DPOL1_DATA_INCREASES 0x02
174 #define LDCTOUCH_DPOL1_DATA_DECREASES 0x00
175 #define LDCTOUCH_DPOL0_DATA_INCREASES 0x01
176 #define LDCTOUCH_DPOL0_DATA_DECREASES 0x00
182 #define LDCTOUCH_BUTTON_MODE_FINGER 0x00
183 #define LDCTOUCH_BUTTON_MODE_METAL 0x01
184 #define LDCTOUCH_BUTTON_MODE LDCTOUCH_BUTTON_MODE_FINGER
190 #define LDCTOUCH_MANUFACTURER_ID_LSB 0x49
191 #define LDCTOUCH_MANUFACTURER_ID_MSB 0x54
192 #define LDCTOUCH_DEVICE_ID_LSB 0x00
193 #define LDCTOUCH_DEVICE_ID_MSB 0x40
200 #define LDCTOUCH_DEVICE_ADDRESS 0x2A
218 #define LDCTOUCH_MAP_MIKROBUS( cfg, mikrobus ) \
219 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
220 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
221 cfg.s2 = MIKROBUS( mikrobus, MIKROBUS_CS ); \
222 cfg.s0 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
223 cfg.s1 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
224 cfg.s3 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
225 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
uint8_t ldctouch_get_s1_pin(ldctouch_t *ctx)
LDC Touch get s1 pin function.
pin_name_t int_pin
Definition: ldctouch.h:264
uint8_t ldctouch_get_s0_pin(ldctouch_t *ctx)
LDC Touch get s0 pin function.
err_t ldctouch_get_data(ldctouch_t *ctx, ldctouch_data_t *button_data)
LDC Touch get data function.
uint8_t ldctouch_get_int_pin(ldctouch_t *ctx)
LDC Touch get int pin function.
i2c_master_t i2c
Definition: ldctouch.h:244
err_t ldctouch_generic_read(ldctouch_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
LDC Touch I2C reading function.
int16_t ch0_raw_button
Definition: ldctouch.h:279
ldctouch_return_value_t
LDC Touch Click return value data.
Definition: ldctouch.h:291
int16_t ch1_raw_button
Definition: ldctouch.h:280
pin_name_t s0
Definition: ldctouch.h:260
pin_name_t s1
Definition: ldctouch.h:261
LDC Touch Click configuration object.
Definition: ldctouch.h:256
@ LDCTOUCH_ERROR
Definition: ldctouch.h:293
int16_t ch2_raw_button
Definition: ldctouch.h:281
uint32_t i2c_speed
Definition: ldctouch.h:266
@ LDCTOUCH_OK
Definition: ldctouch.h:292
uint8_t ldctouch_get_s3_pin(ldctouch_t *ctx)
LDC Touch get s3 pin function.
LDC Touch Click context object.
Definition: ldctouch.h:235
digital_in_t s2
Definition: ldctouch.h:239
uint8_t slave_address
Definition: ldctouch.h:247
err_t ldctouch_read_register(ldctouch_t *ctx, uint8_t reg, uint8_t *data_out)
LDC Touch read register function.
uint8_t i2c_address
Definition: ldctouch.h:267
uint8_t out_state
Definition: ldctouch.h:278
pin_name_t scl
Definition: ldctouch.h:257
int16_t ch3_raw_button
Definition: ldctouch.h:282
digital_in_t s3
Definition: ldctouch.h:240
void ldctouch_cfg_setup(ldctouch_cfg_t *cfg)
LDC Touch configuration object setup function.
err_t ldctouch_generic_write(ldctouch_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
LDC Touch I2C writing function.
err_t ldctouch_init(ldctouch_t *ctx, ldctouch_cfg_t *cfg)
LDC Touch initialization function.
pin_name_t sda
Definition: ldctouch.h:258
uint8_t status
Definition: ldctouch.h:277
err_t ldctouch_set_operation_mode(ldctouch_t *ctx, uint8_t mode)
LDC Touch set operation mode function.
err_t ldctouch_write_register(ldctouch_t *ctx, uint8_t reg, uint8_t data_in)
LDC Touch write register function.
err_t ldctouch_default_cfg(ldctouch_t *ctx)
LDC Touch default configuration function.
digital_in_t int_pin
Definition: ldctouch.h:241
digital_in_t s0
Definition: ldctouch.h:237
uint8_t ldctouch_get_s2_pin(ldctouch_t *ctx)
LDC Touch get s2 pin function.
pin_name_t s2
Definition: ldctouch.h:262
pin_name_t s3
Definition: ldctouch.h:263
digital_in_t s1
Definition: ldctouch.h:238
err_t ldctouch_check_communication(ldctouch_t *ctx)
LDC Touch check communication function.
LDC Touch Click data object.
Definition: ldctouch.h:276