capsense2 2.0.0.0
CapSense 2 Click Driver

API for configuring and manipulating CapSense 2 Click driver. More...

Topics

 CapSense 2 Registers List
 List of registers of CapSense 2 Click driver.
 
 CapSense 2 Registers Settings
 Settings for registers of CapSense 2 Click driver.
 
 CapSense 2 MikroBUS Map
 MikroBUS pin mapping of CapSense 2 Click driver.
 

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

API for configuring and manipulating CapSense 2 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ capsense2_cfg_setup()

void capsense2_cfg_setup ( capsense2_cfg_t * cfg)

CapSense 2 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See capsense2_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ capsense2_check_communication()

err_t capsense2_check_communication ( capsense2_t * ctx)

CapSense 2 check communication function.

This function checks the communication by reading and verifying the chip identification numbers.

Parameters
[in]ctx: Click context object. See capsense2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ capsense2_clear_interrupt()

err_t capsense2_clear_interrupt ( capsense2_t * ctx)

CapSense 2 clear interrupt function.

This function clears the INT bit of the main status register if the interrupt pin is asserted.

Parameters
[in]ctx: Click context object. See capsense2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ capsense2_default_cfg()

err_t capsense2_default_cfg ( capsense2_t * ctx)

CapSense 2 default configuration function.

This function executes a default configuration of CapSense 2 click board.

Parameters
[in]ctx: Click context object. See capsense2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ capsense2_generic_read()

err_t capsense2_generic_read ( capsense2_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

CapSense 2 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See capsense2_t object definition for detailed explanation.
[in]reg: Start register address.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ capsense2_generic_write()

err_t capsense2_generic_write ( capsense2_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

CapSense 2 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See capsense2_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_buf: Data to be written.
[in]tx_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ capsense2_get_alert_pin()

uint8_t capsense2_get_alert_pin ( capsense2_t * ctx)

CapSense 2 get alert pin function.

This function returns the alert pin logic state.

Parameters
[in]ctx: Click context object. See capsense2_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ capsense2_init()

err_t capsense2_init ( capsense2_t * ctx,
capsense2_cfg_t * cfg )

CapSense 2 initialization function.

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

Parameters
[out]ctx: Click context object. See capsense2_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See capsense2_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ capsense2_read_register()

err_t capsense2_read_register ( capsense2_t * ctx,
uint8_t reg,
uint8_t * data_out )

CapSense 2 read register function.

This function reads a data byte from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See capsense2_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ capsense2_reset_device()

void capsense2_reset_device ( capsense2_t * ctx)

CapSense 2 reset device function.

This function performs the device reset by toggling the RST pin.

Parameters
[in]ctx: Click context object. See capsense2_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ capsense2_set_reset_pin()

void capsense2_set_reset_pin ( capsense2_t * ctx,
uint8_t state )

CapSense 2 set reset pin function.

This function sets the RST pin to a desired logic state.

Parameters
[in]ctx: Click context object. See capsense2_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ capsense2_write_register()

err_t capsense2_write_register ( capsense2_t * ctx,
uint8_t reg,
uint8_t data_in )

CapSense 2 write register function.

This function writes a data byte to the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See capsense2_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.