captouch4  2.1.0.0
Modules | Functions
Cap Touch 4 Click Driver

API for configuring and manipulating Cap Touch 4 Click driver. More...

Modules

 Cap Touch 4 Registers List
 List of registers of Cap Touch 4 Click driver.
 
 Cap Touch 4 Registers Settings
 Settings for registers of Cap Touch 4 Click driver.
 
 Cap Touch 4 MikroBUS Map
 MikroBUS pin mapping of Cap Touch 4 Click driver.
 

Functions

void captouch4_cfg_setup (captouch4_cfg_t *cfg)
 Cap Touch 4 configuration object setup function. More...
 
err_t captouch4_init (captouch4_t *ctx, captouch4_cfg_t *cfg)
 Cap Touch 4 initialization function. More...
 
err_t captouch4_default_cfg (captouch4_t *ctx)
 Cap Touch 4 default configuration function. More...
 
err_t captouch4_write_reg (captouch4_t *ctx, uint8_t reg, uint8_t data_in)
 Cap Touch 4 write reg function. More...
 
err_t captouch4_read_reg (captouch4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Cap Touch 4 read reg function. More...
 
err_t captouch4_check_communication (captouch4_t *ctx)
 Cap Touch 4 check communication function. More...
 
void captouch4_enable_device (captouch4_t *ctx)
 Cap Touch 4 enable device function. More...
 
void captouch4_disable_device (captouch4_t *ctx)
 Cap Touch 4 disable device function. More...
 
err_t captouch4_read_system_flags (captouch4_t *ctx, uint8_t *sysflags)
 Cap Touch 4 read system flags function. More...
 
err_t captouch4_read_movement (captouch4_t *ctx, uint8_t *movement)
 Cap Touch 4 read movement function. More...
 
err_t captouch4_read_cap_counts (captouch4_t *ctx, uint16_t *cap_counts)
 Cap Touch 4 read cap counts function. More...
 
err_t captouch4_read_lta (captouch4_t *ctx, uint16_t *lta)
 Cap Touch 4 read lta function. More...
 

Detailed Description

API for configuring and manipulating Cap Touch 4 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

◆ captouch4_cfg_setup()

void captouch4_cfg_setup ( captouch4_cfg_t cfg)

Cap Touch 4 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ captouch4_check_communication()

err_t captouch4_check_communication ( captouch4_t ctx)

Cap Touch 4 check communication function.

This function checks the communication by reading and verifying the device product and version numbers.

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

◆ captouch4_default_cfg()

err_t captouch4_default_cfg ( captouch4_t ctx)

Cap Touch 4 default configuration function.

This function executes a default configuration of Cap Touch 4 click board.

Parameters
[in]ctx: Click context object. See captouch4_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.

◆ captouch4_disable_device()

void captouch4_disable_device ( captouch4_t ctx)

Cap Touch 4 disable device function.

This function disables the device by setting the EN pin to low logic state.

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

◆ captouch4_enable_device()

void captouch4_enable_device ( captouch4_t ctx)

Cap Touch 4 enable device function.

This function enables the device by setting the EN pin to high logic state.

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

◆ captouch4_init()

err_t captouch4_init ( captouch4_t ctx,
captouch4_cfg_t cfg 
)

Cap Touch 4 initialization function.

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

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

◆ captouch4_read_cap_counts()

err_t captouch4_read_cap_counts ( captouch4_t ctx,
uint16_t *  cap_counts 
)

Cap Touch 4 read cap counts function.

This function reads the counts number directly proportional to capacitance. The system is calibrated to make the counts as sensitive as possible to changes in capacitance for relative measurements.

Parameters
[in]ctx: Click context object. See captouch4_t object definition for detailed explanation.
[out]cap_counts: 16-bit capacitance counts.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ captouch4_read_lta()

err_t captouch4_read_lta ( captouch4_t ctx,
uint16_t *  lta 
)

Cap Touch 4 read lta function.

This function reads the long-term averate (LTA) value. The LTA is used as reference to compare with capacitance counts.

Parameters
[in]ctx: Click context object. See captouch4_t object definition for detailed explanation.
[out]lta: 16-bit long term average value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ captouch4_read_movement()

err_t captouch4_read_movement ( captouch4_t ctx,
uint8_t *  movement 
)

Cap Touch 4 read movement function.

This function reads an average of movement pulses over a time period.

Parameters
[in]ctx: Click context object. See captouch4_t object definition for detailed explanation.
[out]movement: 8-bit movement value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ captouch4_read_reg()

err_t captouch4_read_reg ( captouch4_t ctx,
uint8_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

Cap Touch 4 read reg 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 captouch4_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ captouch4_read_system_flags()

err_t captouch4_read_system_flags ( captouch4_t ctx,
uint8_t *  sysflags 
)

Cap Touch 4 read system flags function.

This function reads the system flags register.

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

◆ captouch4_write_reg()

err_t captouch4_write_reg ( captouch4_t ctx,
uint8_t  reg,
uint8_t  data_in 
)

Cap Touch 4 write reg function.

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

Parameters
[in]ctx: Click context object. See captouch4_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.