capsense 2.0.0.0
Public function

Functions

void capsense_cfg_setup (capsense_cfg_t *cfg)
 Config Object Initialization function.
 
err_t capsense_init (capsense_t *ctx, capsense_cfg_t *cfg)
 Initialization function.
 
err_t capsense_default_cfg (capsense_t *ctx)
 Click Default Configuration function.
 
err_t capsense_generic_write (capsense_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
err_t capsense_generic_read (capsense_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
err_t capsense_write_data (capsense_t *ctx, uint8_t reg_address, uint8_t write_command)
 Generic write data function.
 
err_t capsense_read_data (capsense_t *ctx, uint8_t reg_address, uint8_t *read_data)
 Read one byte from register address.
 
err_t capsense_read_data_bytes (capsense_t *ctx, uint8_t reg_address, uint16_t *read_data)
 Read two bytes from register address.
 
err_t capsense_get_slider_lvl (capsense_t *ctx, uint8_t *slider_lvl)
 Function get slider level.
 

Detailed Description

Function Documentation

◆ capsense_cfg_setup()

void capsense_cfg_setup ( capsense_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.

◆ capsense_default_cfg()

err_t capsense_default_cfg ( capsense_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation. @description This function executes default configuration for CapSense click.
Note
The following configuration is set in main:

-Enable pins on B0,B1 and slider as CapSense
-Five pins will be used for Slider pads
-Two pins will be used for Button pads
-Three pins will be used as GPIO 2 for LED and 1 as GPIO2
-Enable strong drive mode for GPIOs
-Enable slider
-Configure slider resolution
-Configure slider resolution
-Store Current Configuration to NVM
-Reconfigure Device (POR)

◆ capsense_generic_read()

err_t capsense_generic_read ( capsense_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation. @description This function reads data from the desired register.

◆ capsense_generic_write()

err_t capsense_generic_write ( capsense_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation. @description This function writes data to the desired register.

◆ capsense_get_slider_lvl()

err_t capsense_get_slider_lvl ( capsense_t * ctx,
uint8_t * slider_lvl )

Function get slider level.

Parameters
ctxClick object.
slider_lvlSlider pressed position
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation. @description This function gets slider level of click object ctx.

◆ capsense_init()

err_t capsense_init ( capsense_t * ctx,
capsense_cfg_t * cfg )

Initialization function.

Parameters
capsenseClick object.
cfgClick configuration structure.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation. @description This function initializes all necessary pins and peripherals used for this click.

◆ capsense_read_data()

err_t capsense_read_data ( capsense_t * ctx,
uint8_t reg_address,
uint8_t * read_data )

Read one byte from register address.

Parameters
ctxClick object.
reg_addressRegister address.
read_data8-bit data from addressed register
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation. @description This function reads one byte from reg_address.

◆ capsense_read_data_bytes()

err_t capsense_read_data_bytes ( capsense_t * ctx,
uint8_t reg_address,
uint16_t * read_data )

Read two bytes from register address.

Parameters
ctxClick object.
reg_addressRegister address
read_data16-bit data from addressed register
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation. @description This function reads two bytes from address reg_address.

◆ capsense_write_data()

err_t capsense_write_data ( capsense_t * ctx,
uint8_t reg_address,
uint8_t write_command )

Generic write data function.

Parameters
ctxClick object.
reg_addressRegister address.
write_commandCommand to write.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation. @description This function writes one byte to reg_address.