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"
67#define CAPSENSE_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
69 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
70 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
71 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST )
80#define CAPSENSE_ERROR -1
87#define CAPSENSE_COMMAND_REG 0xA0
88#define CAPSENSE_CS_ENABL0 0x06
89#define CAPSENSE_CS_ENABL1 0x07
90#define CAPSENSE_GPIO_ENABLE0 0x08
91#define CAPSENSE_DM_STRONG0 0x11
92#define CAPSENSE_CS_SLID_CONFIG 0x75
93#define CAPSENSE_CS_SLID_MULM 0x77
94#define CAPSENSE_CS_SLID_MULL 0x78
95#define CAPSENSE_OUTPUT_PORT0 0x04
96#define CAPSENSE_CS_READ_RAW 0x87
97#define CAPSENSE_CS_READ_STATUS0 0x88
98#define CAPSENSE_CS_READ_STATUS1 0x89
99#define CAPSENSE_CS_READ_CEN_POSM 0x8A
100#define CAPSENSE_CS_READ_CEN_POSL 0x8B
101#define CAPSENSE_CS_READ_CEN_PEAKM 0x8C
102#define CAPSENSE_CS_READ_CEN_PEAKL 0x8D
103#define CAPSENSE_DEVICE_ID 0x7A
104#define CAPSENSE_DEVICE_STATUS 0x7B
111#define CAPSENSE_I2C_ADDRESS_0 0x00
112#define CAPSENSE_I2C_ADDRESS_1 0x4B
err_t capsense_generic_read(capsense_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
err_t capsense_write_data(capsense_t *ctx, uint8_t reg_address, uint8_t write_command)
Generic write data function.
void capsense_cfg_setup(capsense_cfg_t *cfg)
Config Object Initialization function.
err_t capsense_read_data_bytes(capsense_t *ctx, uint8_t reg_address, uint16_t *read_data)
Read two bytes from register address.
err_t capsense_init(capsense_t *ctx, capsense_cfg_t *cfg)
Initialization function.
err_t capsense_read_data(capsense_t *ctx, uint8_t reg_address, uint8_t *read_data)
Read one byte from register address.
err_t capsense_generic_write(capsense_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
err_t capsense_default_cfg(capsense_t *ctx)
Click Default Configuration function.
err_t capsense_get_slider_lvl(capsense_t *ctx, uint8_t *slider_lvl)
Function get slider level.
Click configuration structure definition.
Definition capsense.h:145
uint32_t i2c_speed
Definition capsense.h:155
pin_name_t scl
Definition capsense.h:147
pin_name_t sda
Definition capsense.h:148
pin_name_t rst
Definition capsense.h:152
pin_name_t an
Definition capsense.h:151
uint8_t i2c_address
Definition capsense.h:156
Click ctx object definition.
Definition capsense.h:126
i2c_master_t i2c
Definition capsense.h:134
digital_in_t rst
Definition capsense.h:131
uint8_t slave_address
Definition capsense.h:137
digital_out_t an
Definition capsense.h:128