Firmware SDK
twr_zssc3123

Driver for ZSSC3123 Capacitive Sensor. More...

Typedefs

typedef struct twr_zssc3123_t twr_zssc3123_t
 ZSSC3123 instance.
 

Enumerations

enum  twr_zssc3123_event_t {
  TWR_ZSSC3123_EVENT_ERROR = 0,
  TWR_ZSSC3123_EVENT_UPDATE = 1
}
 Callback events. More...
 

Functions

bool twr_zssc3123_init (twr_zssc3123_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
 Initialize ZSSC3123. More...
 
bool twr_zssc3123_deinit (twr_zssc3123_t *self)
 Deitialize ZSSC3123. More...
 
void twr_zssc3123_set_data_fetch_delay (twr_zssc3123_t *self, twr_tick_t interval)
 Set data fetch delay. More...
 
void twr_zssc3123_set_event_handler (twr_zssc3123_t *self, void(*event_handler)(twr_zssc3123_t *, twr_zssc3123_event_t, void *), void *event_param)
 Set callback function. More...
 
void twr_zssc3123_set_update_interval (twr_zssc3123_t *self, twr_tick_t interval)
 Set scan interval. More...
 
bool twr_zssc3123_measure (twr_zssc3123_t *self)
 Start measurement manually. More...
 
bool twr_zssc3123_get_raw_cap_data (twr_zssc3123_t *self, uint16_t *raw)
 Get capacitance data as raw value. More...
 
bool twr_zssc3123_start_cm (twr_zssc3123_t *self)
 Start Command Mode. More...
 
bool twr_zssc3123_end_cm (twr_zssc3123_t *self)
 Ends Command Mode. More...
 
bool twr_zssc3123_eeprom_read (twr_zssc3123_t *self, uint8_t address, uint16_t *word)
 Write to eeprom, work only with command mode. More...
 
bool twr_zssc3123_eeprom_write (twr_zssc3123_t *self, uint8_t address, uint16_t word)
 Read from eeprm, work only with command mode. More...
 
bool twr_zssc3123_unlock_eeprom (twr_zssc3123_t *self)
 Unlock eerpom, work only with command mode. More...
 

Detailed Description

Driver for ZSSC3123 Capacitive Sensor.

Enumeration Type Documentation

◆ twr_zssc3123_event_t

Callback events.

Enumerator
TWR_ZSSC3123_EVENT_ERROR 

Error event.

TWR_ZSSC3123_EVENT_UPDATE 

Update event.

Definition at line 13 of file twr_zssc3123.h.

Function Documentation

◆ twr_zssc3123_deinit()

bool twr_zssc3123_deinit ( twr_zssc3123_t self)

Deitialize ZSSC3123.

Parameters
[in]selfInstance

Definition at line 28 of file twr_zssc3123.c.

Here is the call graph for this function:

◆ twr_zssc3123_eeprom_read()

bool twr_zssc3123_eeprom_read ( twr_zssc3123_t self,
uint8_t  address,
uint16_t *  word 
)

Write to eeprom, work only with command mode.

Parameters
[in]selfInstance
[in]addressAddress
[out]wordOutput data which have been read
Returns
true On success
false On failure

Definition at line 111 of file twr_zssc3123.c.

Here is the call graph for this function:

◆ twr_zssc3123_eeprom_write()

bool twr_zssc3123_eeprom_write ( twr_zssc3123_t self,
uint8_t  address,
uint16_t  word 
)

Read from eeprm, work only with command mode.

Parameters
[in]selfInstance
[in]addressAddress
[in]wordData to write
Returns
true On success
false On failure

Definition at line 150 of file twr_zssc3123.c.

Here is the call graph for this function:

◆ twr_zssc3123_end_cm()

bool twr_zssc3123_end_cm ( twr_zssc3123_t self)

Ends Command Mode.

Parameters
[in]selfInstance

Definition at line 101 of file twr_zssc3123.c.

Here is the call graph for this function:

◆ twr_zssc3123_get_raw_cap_data()

bool twr_zssc3123_get_raw_cap_data ( twr_zssc3123_t self,
uint16_t *  raw 
)

Get capacitance data as raw value.

Parameters
[in]selfInstance
[out]rawPointer to variable where result will be stored
Returns
true When value is valid
false When value is invalid

Definition at line 79 of file twr_zssc3123.c.

◆ twr_zssc3123_init()

bool twr_zssc3123_init ( twr_zssc3123_t self,
twr_i2c_channel_t  i2c_channel,
uint8_t  i2c_address 
)

Initialize ZSSC3123.

Parameters
[in]selfInstance
[in]i2c_channelI2C channel
[in]i2c_addressI2C device address

Definition at line 8 of file twr_zssc3123.c.

Here is the call graph for this function:

◆ twr_zssc3123_measure()

bool twr_zssc3123_measure ( twr_zssc3123_t self)

Start measurement manually.

Parameters
[in]selfInstance
Returns
true On success
false When other measurement is in progress

Definition at line 65 of file twr_zssc3123.c.

Referenced by twr_zssc3123_set_update_interval().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_zssc3123_set_data_fetch_delay()

void twr_zssc3123_set_data_fetch_delay ( twr_zssc3123_t self,
twr_tick_t  interval 
)

Set data fetch delay.

Parameters
[in]selfInstance
[in]intervalDesired scan interval in ticks

Definition at line 37 of file twr_zssc3123.c.

◆ twr_zssc3123_set_event_handler()

void twr_zssc3123_set_event_handler ( twr_zssc3123_t self,
void(*)(twr_zssc3123_t *, twr_zssc3123_event_t, void *)  event_handler,
void *  event_param 
)

Set callback function.

Parameters
[in]selfInstance
[in]event_handlerFunction address
[in]event_paramOptional event parameter (can be NULL)

Definition at line 42 of file twr_zssc3123.c.

◆ twr_zssc3123_set_update_interval()

void twr_zssc3123_set_update_interval ( twr_zssc3123_t self,
twr_tick_t  interval 
)

Set scan interval.

Parameters
[in]selfInstance
[in]intervalDesired scan interval in ticks

Definition at line 48 of file twr_zssc3123.c.

Here is the call graph for this function:

◆ twr_zssc3123_start_cm()

bool twr_zssc3123_start_cm ( twr_zssc3123_t self)

Start Command Mode.

Parameters
[in]selfInstance

Definition at line 91 of file twr_zssc3123.c.

Here is the call graph for this function:

◆ twr_zssc3123_unlock_eeprom()

bool twr_zssc3123_unlock_eeprom ( twr_zssc3123_t self)

Unlock eerpom, work only with command mode.

Parameters
[in]selfInstance
Returns
true On success
false On failure

Definition at line 166 of file twr_zssc3123.c.

Here is the call graph for this function: