Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_module_infra_grid.h
1 #ifndef _BC_MODULE_INFRA_GRID_H
2 #define _BC_MODULE_INFRA_GRID_H
3 
4 #include <bc_i2c.h>
5 #include <bc_tca9534a.h>
6 #include <bc_scheduler.h>
7 
11 
13 
14 typedef enum
15 {
18 
21 
23 
25 
27 
29 
30 typedef enum
31 {
34 
37 
39 
41 
42 typedef enum
43 {
44  BC_MODULE_INFRA_GRID_STATE_ERROR = -1,
45  BC_MODULE_INFRA_GRID_STATE_INITIALIZE = 0,
46  BC_MODULE_INFRA_GRID_STATE_MODE_CHANGE = 1,
47  BC_MODULE_INFRA_GRID_STATE_POWER_UP = 2,
48  BC_MODULE_INFRA_GRID_STATE_INITIAL_RESET = 3,
49  BC_MODULE_INFRA_GRID_STATE_FLAG_RESET = 4,
50  BC_MODULE_INFRA_GRID_STATE_MEASURE = 5,
51  BC_MODULE_INFRA_GRID_STATE_READ = 6,
52  BC_MODULE_INFRA_GRID_STATE_UPDATE = 7
53 
54 } bc_module_infra_grid_state_t;
55 
57 {
58  int16_t _sensor_data[64];
59 
60  bc_tca9534a_t _tca9534;
62  bc_i2c_channel_t _i2c_channel;
63  uint8_t _i2c_address;
64  bc_scheduler_task_id_t _task_id_interval;
65  bc_scheduler_task_id_t _task_id_measure;
66  void (*_event_handler)(bc_module_infra_grid_t *, bc_module_infra_grid_event_t, void *);
67  void *_event_param;
68  bool _measurement_active;
69  bc_tick_t _update_interval;
70  bc_module_infra_grid_state_t _state;
71  bc_tick_t _tick_ready;
72  bool _temperature_valid;
73 
74  bool _enable_sleep;
75  bool _cmd_sleep;
76 
77 };
78 
80 
83 
85 
90 
91 void bc_module_infra_grid_set_event_handler(bc_module_infra_grid_t *self, void (*event_handler)(bc_module_infra_grid_t *, bc_module_infra_grid_event_t, void *), void *event_param);
92 
96 
98 
103 
105 
110 
112 
116 
118 
122 
124 
128 
130 
132 
133 #endif // _BC_MODULE_INFRA_GRID_H
uint64_t bc_tick_t
Timestamp data type.
Definition: bc_tick.h:16
void bc_module_infra_grid_init(bc_module_infra_grid_t *self)
Initialize Infra Grid Module.
bc_module_infra_grid_revision_t
Infragrid Module Revision.
bc_module_infra_grid_event_t
Callback events.
void bc_module_infra_grid_set_event_handler(bc_module_infra_grid_t *self, void(*event_handler)(bc_module_infra_grid_t *, bc_module_infra_grid_event_t, void *), void *event_param)
Set callback function.
Pin state.
Definition: bc_tca9534a.h:42
bool bc_module_infra_grid_read_values(bc_module_infra_grid_t *self)
Read measured data from sensor to the buffer.
size_t bc_scheduler_task_id_t
Task ID assigned by scheduler.
Definition: bc_scheduler.h:18
void bc_module_infra_grid_set_update_interval(bc_module_infra_grid_t *self, bc_tick_t interval)
Set measurement interval.
bc_i2c_channel_t
I2C channels.
Definition: bc_i2c.h:15
float bc_module_infra_grid_read_thermistor(bc_module_infra_grid_t *self)
Read and return thermistor temperature sensor value.
bc_module_infra_grid_revision_t bc_module_infra_grid_get_revision(bc_module_infra_grid_t *self)
Get module revision.
struct bc_module_infra_grid_t bc_module_infra_grid_t
Infra Grid Module instance.
bool bc_module_infra_grid_measure(bc_module_infra_grid_t *self)
Start measurement manually.
bool bc_module_infra_grid_get_temperatures_celsius(bc_module_infra_grid_t *self, float *values)
Get measured temperature in degrees of Celsius as a array of float numbers.