capsense2 2.0.0.0
capsense2.h File Reference

This file contains API for CapSense 2 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  capsense2_t
 CapSense 2 Click context object. More...
 
struct  capsense2_cfg_t
 CapSense 2 Click configuration object. More...
 

Macros

#define CAPSENSE2_REG_MAIN_STATUS_CONTROL   0x00
 CapSense 2 Register List.
 
#define CAPSENSE2_REG_BUTTON_STATUS_1   0x03
 
#define CAPSENSE2_REG_BUTTON_STATUS_2   0x04
 
#define CAPSENSE2_REG_BUILD_REVISION   0x05
 
#define CAPSENSE2_REG_SLIDER_POSITION_DATA   0x06
 
#define CAPSENSE2_REG_VENDOR_ID   0x08
 
#define CAPSENSE2_REG_VOLUMETRIC_STEP   0x09
 
#define CAPSENSE2_REG_NOISE_STATUS_1   0x0A
 
#define CAPSENSE2_REG_NOISE_STATUS_2   0x0B
 
#define CAPSENSE2_REG_LID_CLOSURE_STATUS_1   0x0C
 
#define CAPSENSE2_REG_LID_CLOSURE_STATUS_2   0x0D
 
#define CAPSENSE2_REG_GPIO_STATUS   0x0E
 
#define CAPSENSE2_REG_GROUP_STATUS   0x0F
 
#define CAPSENSE2_REG_SENSOR_1_DELTA_COUNT   0x10
 
#define CAPSENSE2_REG_SENSOR_2_DELTA_COUNT   0x11
 
#define CAPSENSE2_REG_SENSOR_3_DELTA_COUNT   0x12
 
#define CAPSENSE2_REG_SENSOR_4_DELTA_COUNT   0x13
 
#define CAPSENSE2_REG_SENSOR_5_DELTA_COUNT   0x14
 
#define CAPSENSE2_REG_SENSOR_6_DELTA_COUNT   0x15
 
#define CAPSENSE2_REG_SENSOR_7_DELTA_COUNT   0x16
 
#define CAPSENSE2_REG_SENSOR_8_DELTA_COUNT   0x17
 
#define CAPSENSE2_REG_SENSOR_9_DELTA_COUNT   0x18
 
#define CAPSENSE2_REG_SENSOR_10_DELTA_COUNT   0x19
 
#define CAPSENSE2_REG_SENSOR_11_DELTA_COUNT   0x1A
 
#define CAPSENSE2_REG_SENSOR_12_DELTA_COUNT   0x1B
 
#define CAPSENSE2_REG_SENSOR_13_DELTA_COUNT   0x1C
 
#define CAPSENSE2_REG_SENSOR_14_DELTA_COUNT   0x1D
 
#define CAPSENSE2_REG_QUEUE_CONTROL   0x1E
 
#define CAPSENSE2_REG_DATA_SENSITIVITY   0x1F
 
#define CAPSENSE2_REG_CONFIGURATION   0x20
 
#define CAPSENSE2_REG_SENSOR_ENABLE   0x21
 
#define CAPSENSE2_REG_BUTTON_CONFIGURATION   0x22
 
#define CAPSENSE2_REG_GROUP_CONFIGURATION_1   0x23
 
#define CAPSENSE2_REG_GROUP_CONFIGURATION_2   0x24
 
#define CAPSENSE2_REG_CALIBRATION_ENABLE   0x25
 
#define CAPSENSE2_REG_CALIBRATION_ACTIVATE   0x26
 
#define CAPSENSE2_REG_INTERRUPT_ENABLE_1   0x27
 
#define CAPSENSE2_REG_INTERRUPT_ENABLE_2   0x28
 
#define CAPSENSE2_REG_SLEEP_CHANNEL_CONTROL   0x29
 
#define CAPSENSE2_REG_MULTIPLE_PRESS_CONFIGURATION   0x2A
 
#define CAPSENSE2_REG_LID_CLOSURE_CONFIGURATION   0x2B
 
#define CAPSENSE2_REG_LID_CLOSURE_QUEUE_CONTROL   0x2C
 
#define CAPSENSE2_REG_LID_CLOSURE_PATTERN_1   0x2D
 
#define CAPSENSE2_REG_LID_CLOSURE_PATTERN_2   0x2E
 
#define CAPSENSE2_REG_RECALIBRATION_CONFIGURATION   0x2F
 
#define CAPSENSE2_REG_SENSOR_1_THRESHOLD   0x30
 
#define CAPSENSE2_REG_SENSOR_2_THRESHOLD   0x31
 
#define CAPSENSE2_REG_SENSOR_3_THRESHOLD   0x32
 
#define CAPSENSE2_REG_SENSOR_4_THRESHOLD   0x33
 
#define CAPSENSE2_REG_SENSOR_5_THRESHOLD   0x34
 
#define CAPSENSE2_REG_SENSOR_6_THRESHOLD   0x35
 
#define CAPSENSE2_REG_SENSOR_7_THRESHOLD   0x36
 
#define CAPSENSE2_REG_GROUP_THRESHOLD   0x37
 
#define CAPSENSE2_REG_BUTTON_NOISE_THRESHOLD_1   0x38
 
#define CAPSENSE2_REG_BUTTON_NOISE_THRESHOLD_2   0x39
 
#define CAPSENSE2_REG_LID_CLOSURE_THRESHOLD_1   0x3A
 
#define CAPSENSE2_REG_LID_CLOSURE_THRESHOLD_2   0x3B
 
#define CAPSENSE2_REG_LID_CLOSURE_THRESHOLD_3   0x3C
 
#define CAPSENSE2_REG_LID_CLOSURE_THRESHOLD_4   0x3D
 
#define CAPSENSE2_REG_SLIDER_VELOCITY_CONFIGURATION   0x3E
 
#define CAPSENSE2_REG_DIGITAL_RECALIBRATION   0x3F
 
#define CAPSENSE2_REG_CONFIGURATION_2   0x40
 
#define CAPSENSE2_REG_GROUPED_CHANNEL_SENSOR_ENABLE   0x41
 
#define CAPSENSE2_REG_PROXIMITY_CONTROL   0x42
 
#define CAPSENSE2_REG_GROUPED_SENSOR_CALIB_ACTIVATE   0x46
 
#define CAPSENSE2_REG_SAMPLING_CHANNEL_SELECT   0x4E
 
#define CAPSENSE2_REG_SAMPLING_CONFIGURATION   0x4F
 
#define CAPSENSE2_REG_SENSOR_1_BASE_COUNT   0x50
 
#define CAPSENSE2_REG_SENSOR_2_BASE_COUNT   0x51
 
#define CAPSENSE2_REG_SENSOR_3_BASE_COUNT   0x52
 
#define CAPSENSE2_REG_SENSOR_4_BASE_COUNT   0x53
 
#define CAPSENSE2_REG_SENSOR_5_BASE_COUNT   0x54
 
#define CAPSENSE2_REG_SENSOR_6_BASE_COUNT   0x55
 
#define CAPSENSE2_REG_SENSOR_7_BASE_COUNT   0x56
 
#define CAPSENSE2_REG_SENSOR_8_BASE_COUNT   0x57
 
#define CAPSENSE2_REG_SENSOR_9_BASE_COUNT   0x58
 
#define CAPSENSE2_REG_SENSOR_10_BASE_COUNT   0x59
 
#define CAPSENSE2_REG_SENSOR_11_BASE_COUNT   0x5A
 
#define CAPSENSE2_REG_SENSOR_12_BASE_COUNT   0x5B
 
#define CAPSENSE2_REG_SENSOR_13_BASE_COUNT   0x5C
 
#define CAPSENSE2_REG_SENSOR_14_BASE_COUNT   0x5D
 
#define CAPSENSE2_REG_LED_STATUS_1   0x60
 
#define CAPSENSE2_REG_LED_STATUS_2   0x61
 
#define CAPSENSE2_REG_LED_DIRECTION   0x70
 
#define CAPSENSE2_REG_LED_OUTPUT_TYPE   0x71
 
#define CAPSENSE2_REG_GPIO_INPUT   0x72
 
#define CAPSENSE2_REG_LED_OUTPUT_CONTROL_1   0x73
 
#define CAPSENSE2_REG_LED_OUTPUT_CONTROL_2   0x74
 
#define CAPSENSE2_REG_LED_POLARITY_1   0x75
 
#define CAPSENSE2_REG_LED_POLARITY_2   0x76
 
#define CAPSENSE2_REG_LINKED_LED_TRANSITION_CONTROL_1   0x77
 
#define CAPSENSE2_REG_LINKED_LED_TRANSITION_CONTROL_2   0x78
 
#define CAPSENSE2_REG_LED_MIRROR_CONTROL_1   0x79
 
#define CAPSENSE2_REG_LED_MIRROR_CONTROL_2   0x7A
 
#define CAPSENSE2_REG_SENSOR_LED_LINKING   0x80
 
#define CAPSENSE2_REG_LED_BEHAVIOR_1   0x81
 
#define CAPSENSE2_REG_LED_BEHAVIOR_2   0x82
 
#define CAPSENSE2_REG_LED_BEHAVIOR_3   0x83
 
#define CAPSENSE2_REG_LED_PULSE_1_PERIOD   0x84
 
#define CAPSENSE2_REG_LED_PULSE_2_PERIOD   0x85
 
#define CAPSENSE2_REG_LED_BREATHE_PERIOD   0x86
 
#define CAPSENSE2_REG_LED_CONFIGURATION   0x88
 
#define CAPSENSE2_REG_LED_PULSE_1_DUTY_CYCLE   0x90
 
#define CAPSENSE2_REG_LED_PULSE_2_DUTY_CYCLE   0x91
 
#define CAPSENSE2_REG_LED_BREATHE_DUTY_CYCLE   0x92
 
#define CAPSENSE2_REG_LED_DIRECT_DUTY_CYCLE   0x93
 
#define CAPSENSE2_REG_LED_DIRECT_RAMP_RATES   0x94
 
#define CAPSENSE2_REG_LED_OFF_DELAY   0x95
 
#define CAPSENSE2_REG_SENSOR_1_CALIBRATION   0xB1
 
#define CAPSENSE2_REG_SENSOR_2_CALIBRATION   0xB2
 
#define CAPSENSE2_REG_SENSOR_3_CALIBRATION   0xB3
 
#define CAPSENSE2_REG_SENSOR_4_CALIBRATION   0xB4
 
#define CAPSENSE2_REG_SENSOR_5_CALIBRATION   0xB5
 
#define CAPSENSE2_REG_SENSOR_6_CALIBRATION   0xB6
 
#define CAPSENSE2_REG_SENSOR_7_CALIBRATION   0xB7
 
#define CAPSENSE2_REG_SENSOR_8_CALIBRATION   0xB8
 
#define CAPSENSE2_REG_SENSOR_9_CALIBRATION   0xB9
 
#define CAPSENSE2_REG_SENSOR_10_CALIBRATION   0xBA
 
#define CAPSENSE2_REG_SENSOR_11_CALIBRATION   0xBB
 
#define CAPSENSE2_REG_SENSOR_12_CALIBRATION   0xBC
 
#define CAPSENSE2_REG_SENSOR_13_CALIBRATION   0xBD
 
#define CAPSENSE2_REG_SENSOR_14_CALIBRATION   0xBE
 
#define CAPSENSE2_REG_PRODUCT_ID   0xFD
 
#define CAPSENSE2_REG_MANUFACTURER_ID   0xFE
 
#define CAPSENSE2_REG_REVISION   0xFF
 
#define CAPSENSE2_MAIN_STATUS_CONTROL_DEACT   0x40
 CapSense 2 main status control register values.
 
#define CAPSENSE2_MAIN_STATUS_CONTROL_SLEEP   0x20
 
#define CAPSENSE2_MAIN_STATUS_CONTROL_DSLEEP   0x10
 
#define CAPSENSE2_MAIN_STATUS_CONTROL_PWR_LED   0x02
 
#define CAPSENSE2_MAIN_STATUS_CONTROL_INT   0x01
 
#define CAPSENSE2_BUTTON_STATUS_1_UP_SLIDER   0x80
 CapSense 2 button status 1 register values.
 
#define CAPSENSE2_BUTTON_STATUS_1_DOWN_SLIDER   0x40
 
#define CAPSENSE2_BUTTON_STATUS_1_BUTTON_2   0x02
 
#define CAPSENSE2_BUTTON_STATUS_1_BUTTON_1   0x01
 
#define CAPSENSE2_MULTIPLE_PRESS_CONFIG_ENABLE   0x80
 CapSense 2 multiple press configuration register values.
 
#define CAPSENSE2_MULTIPLE_PRESS_CONFIG_BUTTONS_1   0x00
 
#define CAPSENSE2_MULTIPLE_PRESS_CONFIG_BUTTONS_2   0x04
 
#define CAPSENSE2_MULTIPLE_PRESS_CONFIG_BUTTONS_3   0x08
 
#define CAPSENSE2_MULTIPLE_PRESS_CONFIG_BUTTONS_4   0x0C
 
#define CAPSENSE2_MULTIPLE_PRESS_CONFIG_GROUP_2   0x00
 
#define CAPSENSE2_MULTIPLE_PRESS_CONFIG_GROUP_3   0x01
 
#define CAPSENSE2_MULTIPLE_PRESS_CONFIG_GROUP_4   0x02
 
#define CAPSENSE2_MULTIPLE_PRESS_CONFIG_GROUP_1   0x03
 
#define CAPSENSE2_CONFIGURATION_TIMEOUT   0x80
 CapSense 2 configuration register values.
 
#define CAPSENSE2_CONFIGURATION_POS_VOL   0x40
 
#define CAPSENSE2_CONFIGURATION_BLK_DIG_NOISE   0x20
 
#define CAPSENSE2_CONFIGURATION_BLK_ANA_NOISE   0x10
 
#define CAPSENSE2_CONFIGURATION_MAX_DUR_EN_B   0x08
 
#define CAPSENSE2_CONFIGURATION_RPT_EN_B   0x04
 
#define CAPSENSE2_CONFIGURATION_MAX_DUR_EN_G   0x02
 
#define CAPSENSE2_CONFIGURATION_RPT_EN_G   0x01
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_EXTRA_INT_EN   0x80
 CapSense 2 slider velocity configuration register values.
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_MAX_INT_0   0x00
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_MAX_INT_1   0x10
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_MAX_INT_2   0x20
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_MAX_INT_3   0x30
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_MAX_INT_4   0x40
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_MAX_INT_5   0x50
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_MAX_INT_6   0x60
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_MAX_INT_7   0x70
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_SLIDE_TIME_350   0x00
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_SLIDE_TIME_560   0x04
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_SLIDE_TIME_770   0x08
 
#define CAPSENSE2_SLIDER_VELOCITY_CONFIG_SLIDE_TIME_980   0x0C
 
#define CAPSENSE2_LED_DIRECTION_OUTPUT_LED1   0x01
 CapSense 2 led direction register values.
 
#define CAPSENSE2_LED_DIRECTION_OUTPUT_LED2   0x02
 
#define CAPSENSE2_LED_DIRECTION_OUTPUT_LED3   0x04
 
#define CAPSENSE2_LED_DIRECTION_OUTPUT_LED4   0x08
 
#define CAPSENSE2_LED_DIRECTION_OUTPUT_LED5   0x10
 
#define CAPSENSE2_LED_DIRECTION_OUTPUT_LED6   0x20
 
#define CAPSENSE2_LED_DIRECTION_OUTPUT_LED7   0x40
 
#define CAPSENSE2_LED_DIRECTION_OUTPUT_LED8   0x80
 
#define CAPSENSE2_SENSOR_LED_LINKING_CS1_LED1   0x01
 CapSense 2 sensor led linking register values.
 
#define CAPSENSE2_SENSOR_LED_LINKING_CS2_LED2   0x02
 
#define CAPSENSE2_SENSOR_LED_LINKING_CS3_LED3   0x04
 
#define CAPSENSE2_SENSOR_LED_LINKING_CS4_LED4   0x08
 
#define CAPSENSE2_SENSOR_LED_LINKING_CS5_LED5   0x10
 
#define CAPSENSE2_SENSOR_LED_LINKING_CS6_LED6   0x20
 
#define CAPSENSE2_SENSOR_LED_LINKING_CS7_LED7   0x40
 
#define CAPSENSE2_SENSOR_LED_LINKING_UP_DOWN_LINK   0x80
 
#define CAPSENSE2_VENDOR_ID   0x5D
 CapSense 2 ID values.
 
#define CAPSENSE2_MANUFACTURER_ID   0x5D
 
#define CAPSENSE2_PRODUCT_ID   0x3A
 
#define CAPSENSE2_SET_DEV_ADDR   0x28
 CapSense 2 device address setting.
 
#define CAPSENSE2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  capsense2_return_value_t { CAPSENSE2_OK = 0 , CAPSENSE2_ERROR = -1 }
 CapSense 2 Click return value data. More...
 

Functions

void capsense2_cfg_setup (capsense2_cfg_t *cfg)
 CapSense 2 configuration object setup function.
 
err_t capsense2_init (capsense2_t *ctx, capsense2_cfg_t *cfg)
 CapSense 2 initialization function.
 
err_t capsense2_default_cfg (capsense2_t *ctx)
 CapSense 2 default configuration function.
 
err_t capsense2_generic_write (capsense2_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 CapSense 2 I2C writing function.
 
err_t capsense2_generic_read (capsense2_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 CapSense 2 I2C reading function.
 
err_t capsense2_write_register (capsense2_t *ctx, uint8_t reg, uint8_t data_in)
 CapSense 2 write register function.
 
err_t capsense2_read_register (capsense2_t *ctx, uint8_t reg, uint8_t *data_out)
 CapSense 2 read register function.
 
void capsense2_set_reset_pin (capsense2_t *ctx, uint8_t state)
 CapSense 2 set reset pin function.
 
uint8_t capsense2_get_alert_pin (capsense2_t *ctx)
 CapSense 2 get alert pin function.
 
void capsense2_reset_device (capsense2_t *ctx)
 CapSense 2 reset device function.
 
err_t capsense2_check_communication (capsense2_t *ctx)
 CapSense 2 check communication function.
 
err_t capsense2_clear_interrupt (capsense2_t *ctx)
 CapSense 2 clear interrupt function.
 

Detailed Description

This file contains API for CapSense 2 Click Driver.

Enumeration Type Documentation

◆ capsense2_return_value_t

CapSense 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
CAPSENSE2_OK 
CAPSENSE2_ERROR