1 #ifndef _TWR_ZSSC3123_H
2 #define _TWR_ZSSC3123_H
5 #include <twr_scheduler.h>
31 TWR_ZSSC3123_STATE_ERROR = -1,
32 TWR_ZSSC3123_STATE_INITIALIZE = 0,
33 TWR_ZSSC3123_STATE_MEASURE = 1,
34 TWR_ZSSC3123_STATE_READ = 2
36 } twr_zssc3123_state_t;
45 twr_zssc3123_state_t _state;
48 bool _measurement_active;
twr_i2c_channel_t
I2C channels.
size_t twr_scheduler_task_id_t
Task ID assigned by scheduler.
uint64_t twr_tick_t
Timestamp data type.
bool twr_zssc3123_deinit(twr_zssc3123_t *self)
Deitialize ZSSC3123.
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.
bool twr_zssc3123_get_raw_cap_data(twr_zssc3123_t *self, uint16_t *raw)
Get capacitance data as raw value.
bool twr_zssc3123_eeprom_read(twr_zssc3123_t *self, uint8_t address, uint16_t *word)
Write to eeprom, work only with command mode.
bool twr_zssc3123_end_cm(twr_zssc3123_t *self)
Ends Command Mode.
void twr_zssc3123_set_update_interval(twr_zssc3123_t *self, twr_tick_t interval)
Set scan interval.
bool twr_zssc3123_measure(twr_zssc3123_t *self)
Start measurement manually.
struct twr_zssc3123_t twr_zssc3123_t
ZSSC3123 instance.
bool twr_zssc3123_unlock_eeprom(twr_zssc3123_t *self)
Unlock eerpom, work only with command mode.
twr_zssc3123_event_t
Callback events.
void twr_zssc3123_set_data_fetch_delay(twr_zssc3123_t *self, twr_tick_t interval)
Set data fetch delay.
bool twr_zssc3123_init(twr_zssc3123_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize ZSSC3123.
bool twr_zssc3123_start_cm(twr_zssc3123_t *self)
Start Command Mode.
bool twr_zssc3123_eeprom_write(twr_zssc3123_t *self, uint8_t address, uint16_t word)
Read from eeprm, work only with command mode.
@ TWR_ZSSC3123_EVENT_ERROR
Error event.
@ TWR_ZSSC3123_EVENT_UPDATE
Update event.