touchclamp 2.0.0.0

Functions

void touchclamp_cfg_setup (touchclamp_cfg_t *cfg)
 Config Object Initialization function.
 
TOUCHCLAMP_RETVAL touchclamp_init (touchclamp_t *ctx, touchclamp_cfg_t *cfg)
 Initialization function.
 
void touchclamp_default_cfg (touchclamp_t *ctx)
 Click Default Configuration function.
 
void touchclamp_generic_write (touchclamp_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void touchclamp_generic_read (touchclamp_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void touchclamp_soft_reset (touchclamp_t *ctx)
 Soft reset function.
 
void touchclamp_set_touch_threshold (touchclamp_t *ctx, uint8_t th_data)
 Setting touch threshold for a specified electrode function.
 
uint8_t touchclamp_get_touch_threshold (touchclamp_t *ctx, uint8_t electrode)
 Get the current touch threshold for a specified electrode function.
 
void touchclamp_set_release_threshold (touchclamp_t *ctx, uint8_t rth_data)
 Setting release threshold for a specified electrode function.
 
uint8_t touchclamp_get_release_threshold (touchclamp_t *ctx, uint8_t electrode)
 Get the current release threshold for a specified electrode function.
 
uint16_t touchclamp_get_touch_data (touchclamp_t *ctx)
 Get touch data function.
 
void touchclamp_set_sample_period (touchclamp_t *ctx, uint8_t sample_per)
 Sets the sample period function.
 
void touchclamp_digital_toggle (touchclamp_t *ctx, uint8_t electrode)
 Toggles electrode set as GPIO output function.
 
void touchclamp_stop (touchclamp_t *ctx)
 Stop touch clamp function.
 
uint8_t touchclamp_get_interrupt (touchclamp_t *ctx)
 Get state of interrupt pin function.
 

Detailed Description

Function Documentation

◆ touchclamp_cfg_setup()

void touchclamp_cfg_setup ( touchclamp_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.

◆ touchclamp_default_cfg()

void touchclamp_default_cfg ( touchclamp_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for TouchClamp click.

Note

Click default configuration:

   TOUCHCLAMP_REG_ECR
-------------------------------------------------
   TOUCHCLAMP_ECR_INIT_VAL

TOUCHCLAMP_REG_MHDR

   TOUCHCLAMP_MHDR_MAX_VAL
   TOUCHCLAMP_REG_NHDR
-------------------------------------------------
   TOUCHCLAMP_NHDR_MIN_VAL
   TOUCHCLAMP_REG_NCLR
-------------------------------------------------
   TOUCHCLAMP_NCLR_DEF_VAL
   TOUCHCLAMP_REG_FDLR
-------------------------------------------------
   TOUCHCLAMP_FDLR_DEF_VAL

TOUCHCLAMP_REG_MHDF

   TOUCHCLAMP_MHDF_DEF_VAL
   TOUCHCLAMP_REG_NHDF
-------------------------------------------------
   TOUCHCLAMP_NHDF_DEF_VAL

TOUCHCLAMP_REG_NCLF

   TOUCHCLAMP_NCLF_DEF_VAL
   TOUCHCLAMP_REG_FDLF
-------------------------------------------------
   TOUCHCLAMP_FDLF_DEF_VAL

TOUCHCLAMP_REG_NHDT

   TOUCHCLAMP_NHDT_DEF_VAL
   TOUCHCLAMP_REG_NCLT
-------------------------------------------------
   TOUCHCLAMP_NCLT_DEF_VAL

TOUCHCLAMP_REG_FDLT

   TOUCHCLAMP_FDLT_DEF_VAL
   TOUCHCLAMP_REG_MHDPROXR
-------------------------------------------------
   TOUCHCLAMP_MHDPROXR_DEF_VAL

TOUCHCLAMP_REG_NHDPROXR

   TOUCHCLAMP_NHDPROXR_DEF_VAL
   TOUCHCLAMP_REG_NCLPROXR
-------------------------------------------------
   TOUCHCLAMP_NCLPROXR_DEF_VAL

TOUCHCLAMP_REG_FDLPROXR

   TOUCHCLAMP_FDLPROXR_DEF_VAL
   TOUCHCLAMP_REG_MHDPROXF
-------------------------------------------------
   TOUCHCLAMP_MHDPROXF_DEF_VAL

TOUCHCLAMP_REG_NHDPROXF

   TOUCHCLAMP_NHDPROXF_DEF_VAL
   TOUCHCLAMP_REG_NCLPROXF
-------------------------------------------------
   TOUCHCLAMP_NCLPROXF_DEF_VAL

TOUCHCLAMP_REG_FDLPROXF

   TOUCHCLAMP_NCLPROXF_DEF_VAL
   TOUCHCLAMP_REG_NHDPROXT
-------------------------------------------------
   TOUCHCLAMP_NHDPROXT_DEF_VAL

TOUCHCLAMP_REG_NCLPROXT

   TOUCHCLAMP_NHDPROXT_DEF_VAL
   TOUCHCLAMP_REG_FDLPROXT
-------------------------------------------------
   TOUCHCLAMP_NHDPROXT_DEF_VAL

TOUCHCLAMP_REG_DTR

   TOUCHCLAMP_DTR_DEF_VAL
   TOUCHCLAMP_REG_AFE1
-------------------------------------------------
   TOUCHCLAMP_AFE1_DEF_VAL

TOUCHCLAMP_REG_AFE2

   TOUCHCLAMP_AFE2_DEF_VAL
   Set touch threshold
-------------------------------------------------
   0x28 ( 40 )

Set release threshold

   0x14 ( 20 )
   LDC1101_REG_CFG_ADDITIONAL_DEVICE
-------------------------------------------------
   TOUCHCLAMP_ECR_DEF_VAL

◆ touchclamp_digital_toggle()

void touchclamp_digital_toggle ( touchclamp_t * ctx,
uint8_t electrode )

Toggles electrode set as GPIO output function.

Parameters
ctxClick object.
electrodeDigital toggle electrode position value.

@description This function set the sample period of the MPR121, the time between capacitive readings. Higher values consume less power, but are less responsive.

◆ touchclamp_generic_read()

void touchclamp_generic_read ( touchclamp_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

@description This function reads data from the desired register.

◆ touchclamp_generic_write()

void touchclamp_generic_write ( touchclamp_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.

@description This function writes data to the desired register.

◆ touchclamp_get_interrupt()

uint8_t touchclamp_get_interrupt ( touchclamp_t * ctx)

Get state of interrupt pin function.

Parameters
ctxClick object.
Returns
Interrupt state:
   0 : Not active.
   1 : Active.

@description This function gets states of the interrupt ( INT ) pin of the MPR121 chip.

◆ touchclamp_get_release_threshold()

uint8_t touchclamp_get_release_threshold ( touchclamp_t * ctx,
uint8_t electrode )

Get the current release threshold for a specified electrode function.

Parameters
ctxClick object.
electrodeRelease threshold electrode position value.
Returns
8-bit release threshold data.

@description This function current release threshold for a specified electrode of MPR121 chip.

◆ touchclamp_get_touch_data()

uint16_t touchclamp_get_touch_data ( touchclamp_t * ctx)

Get touch data function.

Parameters
ctxClick object.
Returns
16-bit touch data.

@description This function 16-bit touch data from the two register address of MPR121 chip.

◆ touchclamp_get_touch_threshold()

uint8_t touchclamp_get_touch_threshold ( touchclamp_t * ctx,
uint8_t electrode )

Get the current touch threshold for a specified electrode function.

Parameters
ctxClick object.
electrodeTouch threshold electrode position value.
Returns
8-bit touch threshold data.

@description This function get the current touch threshold for a specified electrode of MPR121 chip.

◆ touchclamp_init()

TOUCHCLAMP_RETVAL touchclamp_init ( touchclamp_t * ctx,
touchclamp_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ touchclamp_set_release_threshold()

void touchclamp_set_release_threshold ( touchclamp_t * ctx,
uint8_t rth_data )

Setting release threshold for a specified electrode function.

Parameters
ctxClick object.
th_dataRelease threshold value.

@description This function set release threshold value for a specified electrode of MPR121 chip.

◆ touchclamp_set_sample_period()

void touchclamp_set_sample_period ( touchclamp_t * ctx,
uint8_t sample_per )

Sets the sample period function.

Parameters
ctxClick object.
sample_per8-bit sample period value.

@description This function set the sample period of the MPR121, the time between capacitive readings. Higher values consume less power, but are less responsive.

◆ touchclamp_set_touch_threshold()

void touchclamp_set_touch_threshold ( touchclamp_t * ctx,
uint8_t th_data )

Setting touch threshold for a specified electrode function.

Parameters
ctxClick object.
th_dataTouch threshold value.

@description This function set touch threshold value for a specified electrode of MPR121 chip.

◆ touchclamp_soft_reset()

void touchclamp_soft_reset ( touchclamp_t * ctx)

Soft reset function.

Parameters
ctxClick object.

@description This function performs a software reset.

◆ touchclamp_stop()

void touchclamp_stop ( touchclamp_t * ctx)

Stop touch clamp function.

Parameters
ctxClick object.

@description The stop function switch the MPR121 chip to stop mode which reduces power consumption to 3uA.