42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
66#define CAPEXTEND_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
70 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
77#define CAPEXTEND_RETVAL uint8_t
79#define CAPEXTEND_OK 0x00
80#define CAPEXTEND_INIT_ERROR 0xFF
87#define CAPEXTEND_SPM_CFG 0x0D
88#define CAPEXTEND_SPM_BASE_ADDR 0x0E
89#define CAPEXTEND_SPM_KEY_MSB 0xAC
90#define CAPEXTEND_SPM_KEY_LSB 0xAD
97#define CAPEXTEND_BLOCK_1 0x00
98#define CAPEXTEND_BLOCK_2 0x08
99#define CAPEXTEND_BLOCK_3 0x10
100#define CAPEXTEND_BLOCK_4 0x20
101#define CAPEXTEND_BLOCK_5 0x28
102#define CAPEXTEND_BLOCK_6 0x30
103#define CAPEXTEND_BLOCK_7 0x38
104#define CAPEXTEND_BLOCK_8 0x40
105#define CAPEXTEND_BLOCK_9 0x48
106#define CAPEXTEND_BLOCK_10 0x50
107#define CAPEXTEND_BLOCK_11 0x58
108#define CAPEXTEND_BLOCK_12 0x60
109#define CAPEXTEND_BLOCK_13 0x68
110#define CAPEXTEND_BLOCK_14 0x70
111#define CAPEXTEND_BLOCK_15 0x78
118#define CAPEXTEND_IRQ_SRC 0x00
119#define CAPEXTEND_CAP_STAT_MSB 0x01
120#define CAPEXTEND_CAP_STAT_LSB 0x02
121#define CAPEXTEND_GPI_STAT 0x07
122#define CAPEXTEND_SPM_STAT 0x08
123#define CAPEXTEND_COMP_OP_MODE 0x09
124#define CAPEXTEND_GPO_CTRL 0x0A
125#define CAPEXTEND_GPP_PIN_ID 0x0B
126#define CAPEXTEND_GPP_INTENSITY 0x0C
127#define CAPEXTEND_SOFT_RESET 0xB1
128#define CAPEXTEND_MON_SCAN_PER 0xF9
129#define CAPEXTEND_SLAVE_ADDRESS 0x2B
136#define CAPEXTEND_CAP_DIFF_BA 0xB4
137#define CAPEXTEND_CAP_RAW_BA 0x80
138#define CAPEXTEND_CAP_AVG_BA 0x9A
145#define CAPEXTEND_CAP_DIFF_BLK_1 0xB4
146#define CAPEXTEND_CAP_DIFF_BLK_2 0xBC
147#define CAPEXTEND_CAP_DIFF_BLK_3 0xC4
148#define CAPEXTEND_CAP_AVG_BLK_1 0x80
149#define CAPEXTEND_CAP_AVG_BLK_2 0x88
150#define CAPEXTEND_CAP_AVG_BLK_3 0x90
151#define CAPEXTEND_CAP_RAW_BLK_1 0x9A
152#define CAPEXTEND_CAP_RAW_BLK_2 0xA2
153#define CAPEXTEND_CAP_RAW_BLK_3 0xAA
154#define CAPEXTEND_GPIO_0 0x00
155#define CAPEXTEND_GPIO_1 0x01
156#define CAPEXTEND_GPIO_2 0x02
157#define CAPEXTEND_GPIO_3 0x03
158#define CAPEXTEND_GPIO_4 0x04
159#define CAPEXTEND_GPIO_5 0x05
160#define CAPEXTEND_GPIO_6 0x06
161#define CAPEXTEND_GPIO_7 0x07
162#define CAPEXTEND_GPIO_ALL 0x08
163#define CAPEXTEND_COMMON_SETTINGS 0x01
164#define CAPEXTEND_INDIVIDUAL_SETTINGS 0x04
165#define CAPEXTEND_DISABLED 0x00
166#define CAPEXTEND_BUTTON 0x01
167#define CAPEXTEND_MULTI_TOUCH 0x00
168#define CAPEXTEND_SINGLE_TOUCH 0x01
169#define CAPEXTEND_INT_MASKED 0x00
170#define CAPEXTEND_INT_TOUCH 0x01
171#define CAPEXTEND_INT_RELEASE 0x02
172#define CAPEXTEND_INT_BOTH_TR 0x03
173#define CAPEXTEND_SMPL_0 0x00
174#define CAPEXTEND_SMPL_2 0x01
175#define CAPEXTEND_SMPL_3 0x02
176#define CAPEXTEND_SMPL_4 0x03
177#define CAPEXTEND_BTN_0 0x00
178#define CAPEXTEND_BTN_1 0x01
179#define CAPEXTEND_BTN_2 0x02
180#define CAPEXTEND_BTN_3 0x03
181#define CAPEXTEND_BTN_4 0x04
182#define CAPEXTEND_BTN_5 0x05
183#define CAPEXTEND_BTN_6 0x06
184#define CAPEXTEND_BTN_7 0x07
185#define CAPEXTEND_BTN_8 0x08
186#define CAPEXTEND_BTN_9 0x09
187#define CAPEXTEND_BTN_10 0x0A
188#define CAPEXTEND_BTN_11 0x0B
189#define CAPEXTEND_GROUP_0 0x0C
190#define CAPEXTEND_GROUP_1 0x0D
191#define CAPEXTEND_GPO 0x00
192#define CAPEXTEND_GPP 0x01
193#define CAPEXTEND_GPI 0x02
194#define CAPEXTEND_LOG 0x00
195#define CAPEXTEND_LIN 0x01
196#define CAPEXTEND_EVERY_TIME 0x00
197#define CAPEXTEND_EVERY_16 0x01
198#define CAPEXTEND_NONE 0x00
199#define CAPEXTEND_PULLUP 0x01
200#define CAPEXTEND_PULLDOWN 0x02
201#define CAPEXTEND_NO_INT 0x00
202#define CAPEXTEND_RISING 0x01
203#define CAPEXTEND_FALLING 0x02
204#define CAPEXTEND_BOTH 0x03
205#define CAPEXTEND_OP_MODE_INT 0x01
206#define CAPEXTEND_COMP_INT 0x02
207#define CAPEXTEND_BUTTON_INT 0x04
208#define CAPEXTEND_GPI_INT 0x10
209#define CAPEXTEND_SPM_INT 0x20
210#define CAPEXTEND_NVM_INT 0x40
211#define CAPEXTEND_ACTIVE_MODE 0x00
212#define CAPEXTEND_DOZE_MODE 0x01
213#define CAPEXTEND_SLEEP_MODE 0x02
214#define CAPEXTEND_RAW 0x00
215#define CAPEXTEND_AVG 0x01
216#define CAPEXTEND_DIFF 0x02
217#define CAPEXTEND_MSB_BUTTONS_ADDR 0x01
218#define CAPEXTEND_LSB_BUTTONS_ADDR 0x02
#define CAPEXTEND_RETVAL
Definition capextend.h:77
void capextend_generic_read(capextend_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
int8_t capextend_read_lsb_buttons(capextend_t *ctx)
Read LSB buttons function.
CAPEXTEND_RETVAL capextend_init(capextend_t *ctx, capextend_cfg_t *cfg)
Initialization function.
uint16_t capextend_read_buttons(capextend_t *ctx)
Read buttons function.
void capextend_reset(capextend_t *ctx)
Reset function.
void capextend_set_rst_high(capextend_t *ctx)
Set reset high function.
void capextend_cfg_setup(capextend_cfg_t *cfg)
Config Object Initialization function.
int8_t capextend_read_msb_buttons(capextend_t *ctx)
Read MSB buttons function.
void capextend_set_rst_low(capextend_t *ctx)
Set reset low function.
uint8_t capextend_get_int_input(capextend_t *ctx)
Get interrupt input function.
void capextend_generic_write(capextend_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
Click configuration structure definition.
Definition capextend.h:255
uint32_t i2c_speed
Definition capextend.h:268
pin_name_t scl
Definition capextend.h:258
pin_name_t int_pin
Definition capextend.h:264
pin_name_t sda
Definition capextend.h:259
pin_name_t rst
Definition capextend.h:263
uint8_t i2c_address
Definition capextend.h:269
Click ctx object definition.
Definition capextend.h:232
digital_in_t int_pin
Definition capextend.h:239
i2c_master_t i2c
Definition capextend.h:243
digital_out_t rst
Definition capextend.h:235
uint8_t slave_address
Definition capextend.h:247