Go to the documentation of this file.
38 #include "mikrosdk_version.h"
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
48 #include "drv_digital_out.h"
49 #include "drv_digital_in.h"
50 #include "drv_i2c_master.h"
63 #define CAPSENSE_MAP_MIKROBUS( cfg, mikrobus ) \
64 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
65 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
66 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
67 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST )
76 #define CAPSENSE_ERROR -1
83 #define CAPSENSE_COMMAND_REG 0xA0
84 #define CAPSENSE_CS_ENABL0 0x06
85 #define CAPSENSE_CS_ENABL1 0x07
86 #define CAPSENSE_GPIO_ENABLE0 0x08
87 #define CAPSENSE_DM_STRONG0 0x11
88 #define CAPSENSE_CS_SLID_CONFIG 0x75
89 #define CAPSENSE_CS_SLID_MULM 0x77
90 #define CAPSENSE_CS_SLID_MULL 0x78
91 #define CAPSENSE_OUTPUT_PORT0 0x04
92 #define CAPSENSE_CS_READ_RAW 0x87
93 #define CAPSENSE_CS_READ_STATUS0 0x88
94 #define CAPSENSE_CS_READ_STATUS1 0x89
95 #define CAPSENSE_CS_READ_CEN_POSM 0x8A
96 #define CAPSENSE_CS_READ_CEN_POSL 0x8B
97 #define CAPSENSE_CS_READ_CEN_PEAKM 0x8C
98 #define CAPSENSE_CS_READ_CEN_PEAKL 0x8D
99 #define CAPSENSE_DEVICE_ID 0x7A
100 #define CAPSENSE_DEVICE_STATUS 0x7B
107 #define CAPSENSE_I2C_ADDRESS_0 0x00
108 #define CAPSENSE_I2C_ADDRESS_1 0x4B
306 #endif // _CAPSENSE_H_
uint8_t slave_address
Definition: capsense.h:133
Click configuration structure definition.
Definition: capsense.h:141
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.
pin_name_t scl
Definition: capsense.h:143
uint8_t i2c_address
Definition: capsense.h:152
pin_name_t an
Definition: capsense.h:147
pin_name_t rst
Definition: capsense.h:148
pin_name_t sda
Definition: capsense.h:144
digital_in_t rst
Definition: capsense.h:127
err_t capsense_read_data_bytes(capsense_t *ctx, uint8_t reg_address, uint16_t *read_data)
Read two bytes from register address.
uint32_t i2c_speed
Definition: capsense.h:151
void capsense_cfg_setup(capsense_cfg_t *cfg)
Config Object Initialization function.
i2c_master_t i2c
Definition: capsense.h:130
err_t capsense_init(capsense_t *ctx, capsense_cfg_t *cfg)
Initialization function.
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.
digital_out_t an
Definition: capsense.h:124
err_t capsense_get_slider_lvl(capsense_t *ctx, uint8_t *slider_lvl)
Function get slider level.
err_t capsense_read_data(capsense_t *ctx, uint8_t reg_address, uint8_t *read_data)
Read one byte from register address.
Click ctx object definition.
Definition: capsense.h:122