Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_cy8cmbr3102.h
1 #ifndef _BC_CY8CMBR3102_H
2 #define _BC_CY8CMBR3102_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_CY8CMBR3102_STATE_ERROR = -1,
32  BC_CY8CMBR3102_STATE_INITIALIZE = 0,
33  BC_CY8CMBR3102_STATE_CALC_CONFIG_CRC = 1,
34  BC_CY8CMBR3102_STATE_SELF_RESET = 2,
35  BC_CY8CMBR3102_STATE_READ = 3
36 
37 } bc_cy8cmbr3102_state_t;
38 
39 struct bc_cy8cmbr3102_t
40 {
41  bc_i2c_channel_t _i2c_channel;
42  uint8_t _i2c_address;
43  bc_scheduler_task_id_t _task_id_task;
44  void (*_event_handler)(bc_cy8cmbr3102_t *, bc_cy8cmbr3102_event_t, void *);
45  void *_event_param;
46  bc_cy8cmbr3102_state_t _state;
47  bc_tick_t _scan_interval;
48  int _error_cnt;
49 };
50 
52 
57 
58 bool bc_cy8cmbr3102_init(bc_cy8cmbr3102_t *self, bc_i2c_channel_t i2c_channel, uint8_t i2c_address);
59 
64 
65 void bc_cy8cmbr3102_set_event_handler(bc_cy8cmbr3102_t *self, void (*event_handler)(bc_cy8cmbr3102_t *, bc_cy8cmbr3102_event_t, void *), void *event_param);
66 
70 
72 
78 
79 bool bc_cy8cmbr3102_get_proximity(bc_cy8cmbr3102_t *self, uint16_t value);
80 
86 
87 bool bc_cy8cmbr3102_is_touch(bc_cy8cmbr3102_t *self, bool *is_touch);
88 
90 
91 #endif // _BC_CY8CMBR3102_H
uint64_t bc_tick_t
Timestamp data type.
Definition: bc_tick.h:16
bool bc_cy8cmbr3102_init(bc_cy8cmbr3102_t *self, bc_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize CY8CMBR3102.
void bc_cy8cmbr3102_set_event_handler(bc_cy8cmbr3102_t *self, void(*event_handler)(bc_cy8cmbr3102_t *, bc_cy8cmbr3102_event_t, void *), void *event_param)
Set callback function.
void bc_cy8cmbr3102_set_scan_interval(bc_cy8cmbr3102_t *self, bc_tick_t scan_interval)
Set scan interval.
size_t bc_scheduler_task_id_t
Task ID assigned by scheduler.
Definition: bc_scheduler.h:18
bool bc_cy8cmbr3102_is_touch(bc_cy8cmbr3102_t *self, bool *is_touch)
Is touch.
struct bc_cy8cmbr3102_t bc_cy8cmbr3102_t
TCA9534A instance.
bc_i2c_channel_t
I2C channels.
Definition: bc_i2c.h:15
bc_cy8cmbr3102_event_t
Callback events.
bool bc_cy8cmbr3102_get_proximity(bc_cy8cmbr3102_t *self, uint16_t value)
Get proximity (Capacitive sensor difference count signal.)