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.
 

Detailed Description

Function Documentation

◆ captouch2_cfg_setup()

void captouch2_cfg_setup ( captouch2_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ captouch2_check_interrupt()

uint8_t captouch2_check_interrupt ( captouch2_t * ctx)

Interrupt Check function.

Parameters
ctxClick object.
Returns
State of ALERT pin, 0 or 1

@description Function checks interrupt state (ALERT pin).

◆ captouch2_default_cfg()

void captouch2_default_cfg ( captouch2_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for CapTouch2 click.

Note
    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.

◆ captouch2_detect_touch()

void captouch2_detect_touch ( captouch2_t * ctx,
uint8_t * in_sens )

Touch Detect function.

Parameters
ctxClick object.
in_sensResults of detecting touch on sensor inputs
Note
    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.

◆ captouch2_generic_transfer()

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.

Parameters
ctxClick object.
wr_bufWrite data buffer
wr_lenNumber of byte in write data buffer
rd_bufRead data buffer
rd_lenNumber of byte in read data buffer

@description Generic SPI transfer, for sending and receiving packages

◆ captouch2_init()

CAPTOUCH2_RETVAL captouch2_init ( captouch2_t * ctx,
captouch2_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ captouch2_read_reg()

void captouch2_read_reg ( captouch2_t * ctx,
uint8_t reg_addr,
uint8_t * rx_data,
uint8_t n_bytes )

Generic Read function.

Parameters
ctxClick object.
reg_addrAddress which from data be read
rx_dataBuffer where data be stored
n_bytesNumber of bytes which be read

@description Function reads data from register.

◆ captouch2_reset()

void captouch2_reset ( captouch2_t * ctx)

Reset function.

Parameters
ctxClick object.

@description Function performs device reset and waits until device exits from reset state.

◆ captouch2_set_active_mode()

void captouch2_set_active_mode ( captouch2_t * ctx,
uint8_t analog_gain,
uint8_t en_input )

Active Mode Set function.

Parameters
ctxClick object.
analog_gainPossible gain value is 1, 2, 4 or 8
en_inputEnable or disable sensor inputs

@description Function puts device in Active mode and enables desired inputs in Active mode.

◆ captouch2_set_deep_sleep_mode()

void captouch2_set_deep_sleep_mode ( captouch2_t * ctx)

DeepSleep Mode Set function.

Parameters
ctxClick object.
Note
In this mode the communication will not work and the sensor inputs will not detect touch.

@description Function puts device in DeepSleep mode.

◆ captouch2_set_standby_mode()

void captouch2_set_standby_mode ( captouch2_t * ctx,
uint8_t analog_gain,
uint8_t en_input )

Standby Mode Set function.

Parameters
ctxClick object.
analog_gainPossible gain value is 1, 2, 4 or 8
en_inputEnable or disable sensor inputs

@decscription Function puts device in Standby mode and enables desired inputs in Standby mode.

◆ captouch2_write_reg()

void captouch2_write_reg ( captouch2_t * ctx,
uint8_t reg_addr,
uint8_t tx_data )

Generic Write function.

Parameters
ctxClick object.
reg_addrAddress where data be written
tx_dataData which be written

@description Function writes one byte to register.