Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_zssc3123.h
1 #ifndef _BC_ZSSC3123_H
2 #define _BC_ZSSC3123_H
3 
4 #include <bc_i2c.h>
5 #include <bc_scheduler.h>
6 
10 
12 
13 typedef enum
14 {
17 
20 
22 
24 
26 
28 
29 typedef enum
30 {
31  BC_ZSSC3123_STATE_ERROR = -1,
32  BC_ZSSC3123_STATE_INITIALIZE = 0,
33  BC_ZSSC3123_STATE_MEASURE = 1,
34  BC_ZSSC3123_STATE_READ = 2
35 
36 } bc_zssc3123_state_t;
37 
38 struct bc_zssc3123_t
39 {
40  bc_i2c_channel_t _i2c_channel;
41  uint8_t _i2c_address;
42  bc_scheduler_task_id_t _task_id;
43  void (*_event_handler)(bc_zssc3123_t *, bc_zssc3123_event_t, void *);
44  void *_event_param;
45  bc_zssc3123_state_t _state;
46  bc_tick_t _update_interval;
47  bool _valid;
48  bool _measurement_active;
49  bc_tick_t _next_update_start;
50  uint16_t _raw;
51  bc_tick_t _data_fetch_delay;
52 };
53 
55 
60 
61 bool bc_zssc3123_init(bc_zssc3123_t *self, bc_i2c_channel_t i2c_channel, uint8_t i2c_address);
62 
65 
67 
71 
73 
78 
79 void bc_zssc3123_set_event_handler(bc_zssc3123_t *self, void (*event_handler)(bc_zssc3123_t *, bc_zssc3123_event_t, void *), void *event_param);
80 
84 
86 
91 
93 
99 
100 bool bc_zssc3123_get_raw_cap_data(bc_zssc3123_t *self, uint16_t *raw);
101 
104 
106 
109 
111 
118 
119 bool bc_zssc3123_eeprom_read(bc_zssc3123_t *self, uint8_t address, uint16_t *word);
120 
127 
128 bool bc_zssc3123_eeprom_write(bc_zssc3123_t *self, uint8_t address, uint16_t word);
129 
134 
136 
138 
139 #endif // _BC_ZSSC3123_H
void bc_zssc3123_set_update_interval(bc_zssc3123_t *self, bc_tick_t interval)
Set scan interval.
Definition: bc_zssc3123.c:48
uint64_t bc_tick_t
Timestamp data type.
Definition: bc_tick.h:16
bool bc_zssc3123_unlock_eeprom(bc_zssc3123_t *self)
Unlock eerpom, work only with command mode.
Definition: bc_zssc3123.c:166
bool bc_zssc3123_start_cm(bc_zssc3123_t *self)
Start Command Mode.
Definition: bc_zssc3123.c:91
bool bc_zssc3123_measure(bc_zssc3123_t *self)
Start measurement manually.
Definition: bc_zssc3123.c:65
bool bc_zssc3123_deinit(bc_zssc3123_t *self)
Deitialize ZSSC3123.
Definition: bc_zssc3123.c:28
bool bc_zssc3123_get_raw_cap_data(bc_zssc3123_t *self, uint16_t *raw)
Get capacitance data as raw value.
Definition: bc_zssc3123.c:79
bool bc_zssc3123_init(bc_zssc3123_t *self, bc_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize ZSSC3123.
Definition: bc_zssc3123.c:8
struct bc_zssc3123_t bc_zssc3123_t
ZSSC3123 instance.
Definition: bc_zssc3123.h:25
void bc_zssc3123_set_data_fetch_delay(bc_zssc3123_t *self, bc_tick_t interval)
Set data fetch delay.
Definition: bc_zssc3123.c:37
void bc_zssc3123_set_event_handler(bc_zssc3123_t *self, void(*event_handler)(bc_zssc3123_t *, bc_zssc3123_event_t, void *), void *event_param)
Set callback function.
Definition: bc_zssc3123.c:42
size_t bc_scheduler_task_id_t
Task ID assigned by scheduler.
Definition: bc_scheduler.h:18
bool bc_zssc3123_end_cm(bc_zssc3123_t *self)
Ends Command Mode.
Definition: bc_zssc3123.c:101
bc_i2c_channel_t
I2C channels.
Definition: bc_i2c.h:15
bool bc_zssc3123_eeprom_read(bc_zssc3123_t *self, uint8_t address, uint16_t *word)
Write to eeprom, work only with command mode.
Definition: bc_zssc3123.c:111
bool bc_zssc3123_eeprom_write(bc_zssc3123_t *self, uint8_t address, uint16_t word)
Read from eeprm, work only with command mode.
Definition: bc_zssc3123.c:150
bc_zssc3123_event_t
Callback events.
Definition: bc_zssc3123.h:13