capslider2 2.0.0.0

Functions

void capslider2_cfg_setup (capslider2_cfg_t *cfg)
 Config Object Initialization function.
 
CAPSLIDER2_RETVAL capslider2_init (capslider2_t *ctx, capslider2_cfg_t *cfg)
 Initialization function.
 
void capslider2_generic_write (capslider2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void capslider2_generic_read (capslider2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint8_t capsldr2_write_reg (capslider2_t *ctx, uint8_t register_address, uint8_t *data_in, uint8_t n_bytes)
 Generic Write function.
 
uint8_t capsldr2_read_reg (capslider2_t *ctx, uint8_t register_address, uint8_t *data_out, uint8_t n_bytes)
 Generic Read function.
 
uint8_t capsldr2_check_data_ready (capslider2_t *ctx)
 Data Ready Check function.
 
uint8_t capsldr2_enable_chann (capslider2_t *ctx, uint16_t sel_chann)
 Channel Enable function.
 
void capsldr2_get_data (capslider2_t *ctx, uint16_t *wheel_data1, uint16_t *wheel_data2)
 Data Get function.
 
void capsldr2_set_output (capslider2_t *ctx, uint8_t input_data, uint8_t output_mode)
 Output Set function.
 
void capsldr2_set_threshold (capslider2_t *ctx, uint8_t thresh_value)
 Threshold Set function.
 
void capsldr2_reset (capslider2_t *ctx)
 Reset function.
 
void capsldr2_config (capslider2_t *ctx)
 Config function.
 

Detailed Description

Function Documentation

◆ capsldr2_check_data_ready()

uint8_t capsldr2_check_data_ready ( capslider2_t * ctx)

Data Ready Check function.

Parameters
ctxClick object.
Returns
0 - Data is ready, 1 - Data is not ready

Function checks is conversion cycle done and is data ready for reading.

◆ capsldr2_config()

void capsldr2_config ( capslider2_t * ctx)

Config function.

Parameters
ctxClick object.

Function performs the CAP Slider 2 configuration.

◆ capsldr2_enable_chann()

uint8_t capsldr2_enable_chann ( capslider2_t * ctx,
uint16_t sel_chann )

Channel Enable function.

Parameters
ctxClick object.
sel_channSelects which channel be activated.
Returns
0x00 - OK, 0xFD - Wrong channel selection

Function puts the desired channel/channels to active state.

Note
sel_chann parameter has format 0b0000 00c9c8 c7c6c5c4 c3c2c1c0. 1 on the desired bit will put determined channel to active state. CH1 to CH3 belong to wheel 1, CH4 to CH6 belong to wheel 2, CH7 to CH9 are touch buttons, and CH0 is proximity channel.

◆ capsldr2_get_data()

void capsldr2_get_data ( capslider2_t * ctx,
uint16_t * wheel_data1,
uint16_t * wheel_data2 )

Data Get function.

Parameters
ctxClick object.
wheel_data1Memory where data from wheel 0 register be stored.
wheel_data2Memory where data from wheel 1 register be stored.

Function reads data from both wheel registers and stores these values to memory via output parameters.

◆ capsldr2_read_reg()

uint8_t capsldr2_read_reg ( capslider2_t * ctx,
uint8_t register_address,
uint8_t * data_out,
uint8_t n_bytes )

Generic Read function.

Parameters
ctxClick object.
register_addressAddress which from data be read
data_outMemory where data be stored
n_bytesNumber of bytes to be read
Returns
0x00 - OK, 0xFF - Wrong address, 0xFE - Number of bytes is out of range

Function reads the determined number of bytes from the register.

◆ capsldr2_reset()

void capsldr2_reset ( capslider2_t * ctx)

Reset function.

Parameters
ctxClick object.

Function performs the device reset and puts the device back to normal operating mode.

◆ capsldr2_set_output()

void capsldr2_set_output ( capslider2_t * ctx,
uint8_t input_data,
uint8_t output_mode )

Output Set function.

Parameters
ctxClick object.
input_dataInput data which be showed on LEDs.
output_modeDetermines how input data be showed on LEDs.

Function sets output LEDs depending on the input wheel data value on the way which is determined with the ouputMode parameter.

Note
Input data represents wheel 1 and wheel 2 results in resolution from 0 to 8. Output Mode parameter determines in which way finger (object) is pulled over the sensor: 0 - will change the LEDs intensity, 1 - will change the number of activated LEDs.

◆ capsldr2_set_threshold()

void capsldr2_set_threshold ( capslider2_t * ctx,
uint8_t thresh_value )

Threshold Set function.

Parameters
ctxClick object.
thresh_valueDetermines touch and proximity sensitivity for all channels.

Function determines touch and proximity sensitivity (threshold) for all channels.

Note
Threshold value can be in the range from 0x00 (Most sensitive) to 0xFF (Least sensitive).

◆ capsldr2_write_reg()

uint8_t capsldr2_write_reg ( capslider2_t * ctx,
uint8_t register_address,
uint8_t * data_in,
uint8_t n_bytes )

Generic Write function.

Parameters
ctxClick object.
register_addressAddress where data be written.
data_inData to be written.
n_bytesNumber of bytes to be written.
Returns
0x00 - OK, 0xFF - Wrong address, 0xFE - Number of bytes is out of range

Function writes the determined number of bytes to the register.

◆ capslider2_cfg_setup()

void capslider2_cfg_setup ( capslider2_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.

◆ capslider2_generic_read()

void capslider2_generic_read ( capslider2_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.

◆ capslider2_generic_write()

void capslider2_generic_write ( capslider2_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.

◆ capslider2_init()

CAPSLIDER2_RETVAL capslider2_init ( capslider2_t * ctx,
capslider2_cfg_t * cfg )

Initialization function.

Parameters
capslider2Click object.
cfgClick configuration structure.

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