Go to the documentation of this file.
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 #include "drv_i2c_master.h"
53 #define CAPSENSE_MAP_MIKROBUS( cfg, mikrobus ) \
54 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
55 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
56 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
57 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST )
65 #define CAPSENSE_RETVAL uint8_t
67 #define CAPSENSE_OK 0x00
68 #define CAPSENSE_INIT_ERROR 0xFF
75 #define CAPSENSE_COMMAND_REG 0xA0
76 #define CAPSENSE_CS_ENABL0 0x06
77 #define CAPSENSE_CS_ENABL1 0x07
78 #define CAPSENSE_GPIO_ENABLE0 0x08
79 #define CAPSENSE_DM_STRONG0 0x11
80 #define CAPSENSE_CS_SLID_CONFIG 0x75
81 #define CAPSENSE_CS_SLID_MULM 0x77
82 #define CAPSENSE_CS_SLID_MULL 0x78
83 #define CAPSENSE_OUTPUT_PORT0 0x04
84 #define CAPSENSE_CS_READ_RAW 0x87
85 #define CAPSENSE_CS_READ_STATUS0 0x88
86 #define CAPSENSE_CS_READ_STATUS1 0x89
87 #define CAPSENSE_CS_READ_CEN_POSM 0x8A
88 #define CAPSENSE_CS_READ_CEN_POSL 0x8B
89 #define CAPSENSE_CS_READ_CEN_PEAKM 0x8C
90 #define CAPSENSE_CS_READ_CEN_PEAKL 0x8D
91 #define CAPSENSE_DEVICE_ID 0x7A
92 #define CAPSENSE_DEVICE_STATUS 0x7B
99 #define CAPSENSE_I2C_ADDRESS_0 0x00
100 #define CAPSENSE_I2C_ADDRESS_1 0x4B
287 #endif // _CAPSENSE_H_
CAPSENSE_RETVAL capsense_init(capsense_t *ctx, capsense_cfg_t *cfg)
Initialization function.
uint8_t slave_address
Definition: capsense.h:129
Click configuration structure definition.
Definition: capsense.h:137
void capsense_generic_read(capsense_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint8_t capsense_get_slider_lvl(capsense_t *ctx)
Function get slider level.
pin_name_t scl
Definition: capsense.h:140
void capsense_write_data(capsense_t *ctx, uint8_t reg_address, uint8_t write_command)
Generic write data function.
uint16_t capsense_read_data_bytes(capsense_t *ctx, uint8_t reg_address)
Read two bytes from register address.
uint8_t capsense_read_data(capsense_t *ctx, uint8_t reg_address)
Read one byte from register address.
void capsense_default_cfg(capsense_t *ctx)
Click Default Configuration function.
uint8_t i2c_address
Definition: capsense.h:151
pin_name_t an
Definition: capsense.h:145
void capsense_generic_write(capsense_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
pin_name_t rst
Definition: capsense.h:146
pin_name_t sda
Definition: capsense.h:141
digital_in_t rst
Definition: capsense.h:121
uint32_t i2c_speed
Definition: capsense.h:150
void capsense_cfg_setup(capsense_cfg_t *cfg)
Config Object Initialization function.
i2c_master_t i2c
Definition: capsense.h:125
digital_out_t an
Definition: capsense.h:117
Click ctx object definition.
Definition: capsense.h:114
#define CAPSENSE_RETVAL
Definition: capsense.h:65