Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_pyq1648.h
1 #ifndef _BC_PYQ1648_H
2 #define _BC_PYQ1648_H
3 
4 #include <bc_tick.h>
5 #include <bc_gpio.h>
6 #include <bc_scheduler.h>
7 
11 
13 
14 typedef enum
15 {
18 
21 
23 
25 
26 typedef enum
27 {
30 
33 
36 
39 
41 
43 
44 typedef struct bc_pyq1648_t bc_pyq1648_t;
45 
47 
48 typedef enum
49 {
50  BC_PYQ1648_STATE_ERROR = -1,
51  BC_PYQ1648_STATE_INITIALIZE = 0,
52  BC_PYQ1648_STATE_IGNORE = 1,
53  BC_PYQ1648_STATE_CHECK = 2
54 
55 } bc_pyq1648_state_t;
56 
57 struct bc_pyq1648_t
58 {
59  bc_gpio_channel_t _gpio_channel_serin;
60  bc_gpio_channel_t _gpio_channel_dl;
61  void (*_event_handler)(bc_pyq1648_t *, bc_pyq1648_event_t, void *);
62  void *_event_param;
63  bc_pyq1648_state_t _state;
64  uint32_t _config;
65  uint8_t _sensitivity;
66  bc_tick_t _blank_period;
67  bc_tick_t _aware_time;
68  bc_tick_t _ignore_untill;
69  bc_scheduler_task_id_t _task_id;
70 };
71 
73 
78 
79 void bc_pyq1648_init(bc_pyq1648_t *self, bc_gpio_channel_t gpio_channel_serin, bc_gpio_channel_t gpio_channel_dl);
80 
85 
86 void bc_pyq1648_set_event_handler(bc_pyq1648_t *self, void (*event_handler)(bc_pyq1648_t *, bc_pyq1648_event_t, void *), void *event_param);
87 
91 
93 
97 
98 void bc_pyq1648_set_blank_period(bc_pyq1648_t *self, bc_tick_t blank_period);
99 
101 
102 #endif // _BC_PYQ1648_H
uint64_t bc_tick_t
Timestamp data type.
Definition: bc_tick.h:16
Update event.
Definition: bc_pyq1648.h:20
void bc_pyq1648_set_blank_period(bc_pyq1648_t *self, bc_tick_t blank_period)
Set blank period (for how long alarm events will be ignored)
Definition: bc_pyq1648.c:78
void bc_pyq1648_set_event_handler(bc_pyq1648_t *self, void(*event_handler)(bc_pyq1648_t *, bc_pyq1648_event_t, void *), void *event_param)
Set callback function.
Definition: bc_pyq1648.c:59
Error event.
Definition: bc_pyq1648.h:17
void bc_pyq1648_init(bc_pyq1648_t *self, bc_gpio_channel_t gpio_channel_serin, bc_gpio_channel_t gpio_channel_dl)
Initialize PYQ1648 driver.
Definition: bc_pyq1648.c:37
size_t bc_scheduler_task_id_t
Task ID assigned by scheduler.
Definition: bc_scheduler.h:18
Medium sensitivity.
Definition: bc_pyq1648.h:32
bc_pyq1648_sensitivity_t
Possible sensitivities.
Definition: bc_pyq1648.h:26
High sensitivity.
Definition: bc_pyq1648.h:35
struct bc_pyq1648_t bc_pyq1648_t
PYQ1648 instance.
Definition: bc_pyq1648.h:44
Low sensitivity.
Definition: bc_pyq1648.h:29
void bc_pyq1648_set_sensitivity(bc_pyq1648_t *self, bc_pyq1648_sensitivity_t sensitivity)
Set PYQ1648 sensitivity.
Definition: bc_pyq1648.c:68
bc_gpio_channel_t
GPIO channels.
Definition: bc_gpio.h:12
Very high sensitivity.
Definition: bc_pyq1648.h:38
bc_pyq1648_event_t
Callback events.
Definition: bc_pyq1648.h:14