captouch2 2.0.0.0
|
Functions | |
void | captouch2_cfg_setup (captouch2_cfg_t *cfg) |
Config Object Initialization function. | |
CAPTOUCH2_RETVAL | captouch2_init (captouch2_t *ctx, captouch2_cfg_t *cfg) |
Initialization function. | |
void | captouch2_default_cfg (captouch2_t *ctx) |
Click Default Configuration function. | |
void | captouch2_generic_transfer (captouch2_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len) |
Generic transfer function. | |
void | captouch2_write_reg (captouch2_t *ctx, uint8_t reg_addr, uint8_t tx_data) |
Generic Write function. | |
void | captouch2_read_reg (captouch2_t *ctx, uint8_t reg_addr, uint8_t *rx_data, uint8_t n_bytes) |
Generic Read function. | |
void | captouch2_detect_touch (captouch2_t *ctx, uint8_t *in_sens) |
Touch Detect function. | |
void | captouch2_set_active_mode (captouch2_t *ctx, uint8_t analog_gain, uint8_t en_input) |
Active Mode Set function. | |
void | captouch2_set_standby_mode (captouch2_t *ctx, uint8_t analog_gain, uint8_t en_input) |
Standby Mode Set function. | |
void | captouch2_set_deep_sleep_mode (captouch2_t *ctx) |
DeepSleep Mode Set function. | |
uint8_t | captouch2_check_interrupt (captouch2_t *ctx) |
Interrupt Check function. | |
void | captouch2_reset (captouch2_t *ctx) |
Reset function. | |
void captouch2_cfg_setup | ( | captouch2_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
@description This function initializes click configuration structure to init state.
uint8_t captouch2_check_interrupt | ( | captouch2_t * | ctx | ) |
Interrupt Check function.
ctx | Click object. |
@description Function checks interrupt state (ALERT pin).
void captouch2_default_cfg | ( | captouch2_t * | ctx | ) |
Click Default Configuration function.
ctx | Click object. |
@description This function executes default configuration for CapTouch2 click.
Cap Touch 2 is configured to works in Active mode (Normal mode). All inputs are enabled in this mode. In this example the interrupt will be generated when touch is detected and when touch is released. Also inputs 4, 5 and 6 will generate interrupt as long as the touch is detected (press and hold event), while inputs 1, 2 and 3 will generate interrupt only once on one touch detection, after which the touch will be released. Note: Standby mode should be used when fewer sensor inputs are enabled, and when they are programmed to have more sensitivity.
void captouch2_detect_touch | ( | captouch2_t * | ctx, |
uint8_t * | in_sens ) |
Touch Detect function.
ctx | Click object. |
in_sens | Results of detecting touch on sensor inputs |
Function detects touch on sensor inputs and checks is touch detected or is touch released. If noise occured on determined input, the touch will not be detected.
void captouch2_generic_transfer | ( | captouch2_t * | ctx, |
uint8_t * | wr_buf, | ||
uint16_t | wr_len, | ||
uint8_t * | rd_buf, | ||
uint16_t | rd_len ) |
Generic transfer function.
ctx | Click object. |
wr_buf | Write data buffer |
wr_len | Number of byte in write data buffer |
rd_buf | Read data buffer |
rd_len | Number of byte in read data buffer |
@description Generic SPI transfer, for sending and receiving packages
CAPTOUCH2_RETVAL captouch2_init | ( | captouch2_t * | ctx, |
captouch2_cfg_t * | cfg ) |
Initialization function.
ctx | Click object. |
cfg | Click configuration structure. |
@description This function initializes all necessary pins and peripherals used for this click.
void captouch2_read_reg | ( | captouch2_t * | ctx, |
uint8_t | reg_addr, | ||
uint8_t * | rx_data, | ||
uint8_t | n_bytes ) |
Generic Read function.
ctx | Click object. |
reg_addr | Address which from data be read |
rx_data | Buffer where data be stored |
n_bytes | Number of bytes which be read |
@description Function reads data from register.
void captouch2_reset | ( | captouch2_t * | ctx | ) |
Reset function.
ctx | Click object. |
@description Function performs device reset and waits until device exits from reset state.
void captouch2_set_active_mode | ( | captouch2_t * | ctx, |
uint8_t | analog_gain, | ||
uint8_t | en_input ) |
Active Mode Set function.
ctx | Click object. |
analog_gain | Possible gain value is 1, 2, 4 or 8 |
en_input | Enable or disable sensor inputs |
@description Function puts device in Active mode and enables desired inputs in Active mode.
void captouch2_set_deep_sleep_mode | ( | captouch2_t * | ctx | ) |
DeepSleep Mode Set function.
ctx | Click object. |
@description Function puts device in DeepSleep mode.
void captouch2_set_standby_mode | ( | captouch2_t * | ctx, |
uint8_t | analog_gain, | ||
uint8_t | en_input ) |
Standby Mode Set function.
ctx | Click object. |
analog_gain | Possible gain value is 1, 2, 4 or 8 |
en_input | Enable or disable sensor inputs |
@decscription Function puts device in Standby mode and enables desired inputs in Standby mode.
void captouch2_write_reg | ( | captouch2_t * | ctx, |
uint8_t | reg_addr, | ||
uint8_t | tx_data ) |
Generic Write function.
ctx | Click object. |
reg_addr | Address where data be written |
tx_data | Data which be written |
@description Function writes one byte to register.