Firmware SDK
twr_tag_humidity.h
1 #ifndef _TWR_TAG_HUMIDITY_H
2 #define _TWR_TAG_HUMIDITY_H
3 
4 #include <twr_hts221.h>
5 #include <twr_hdc2080.h>
6 #include <twr_sht20.h>
7 #include <twr_sht30.h>
8 
12 
14 
15 typedef enum
16 {
19 
22 
25 
28 
29 
31 
33 
34 typedef enum
35 {
38 
41 
43 
45 
46 typedef enum
47 {
50 
53 
55 
57 
59 
61 
62 struct twr_tag_humidity_t
63 {
65  void (*_event_handler)(twr_tag_humidity_t *, twr_tag_humidity_event_t, void *);
66  void *_event_param;
67  union
68  {
69  twr_hts221_t hts221;
70  twr_hdc2080_t hdc2080;
71  twr_sht20_t sht20;
72  twr_sht30_t sht30;
73  } _sensor;
74 };
75 
77 
83 
85 
90 
91 void twr_tag_humidity_set_event_handler(twr_tag_humidity_t *self, void (*event_handler)(twr_tag_humidity_t *, twr_tag_humidity_event_t, void *), void *event_param);
92 
96 
98 
103 
105 
111 
113 
119 
121 
127 
128 bool twr_tag_humidity_get_humidity_raw(twr_tag_humidity_t *self, uint16_t *raw);
129 
135 
136 bool twr_tag_humidity_get_humidity_percentage(twr_tag_humidity_t *self, float *percentage);
137 
139 
140 #endif // _TWR_TAG_HUMIDITY_H
bool twr_tag_humidity_measure(twr_tag_humidity_t *self)
Start measurement manually.
twr_tag_humidity_revision_t
Humidity Tag hardware revision.
Hardware revision R2.
bool twr_tag_humidity_get_humidity_raw(twr_tag_humidity_t *self, uint16_t *raw)
Get measured humidity as raw value.
bool twr_tag_humidity_get_temperature_celsius(twr_tag_humidity_t *self, float *celsius)
Get measured temperature in degrees of Celsius.
void twr_tag_humidity_set_event_handler(twr_tag_humidity_t *self, void(*event_handler)(twr_tag_humidity_t *, twr_tag_humidity_event_t, void *), void *event_param)
Set callback function.
void twr_tag_humidity_init(twr_tag_humidity_t *self, twr_tag_humidity_revision_t revision, twr_i2c_channel_t i2c_channel, twr_tag_humidity_i2c_address_t i2c_address)
Initialize HARDWARIO Humidity Module.
struct twr_tag_humidity_t twr_tag_humidity_t
HARDWARIO Humidity Module instance.
Hardware revision R1.
uint64_t twr_tick_t
Timestamp data type.
Definition: twr_tick.h:16
twr_i2c_channel_t
I2C channels.
Definition: twr_i2c.h:15
void twr_tag_humidity_set_update_interval(twr_tag_humidity_t *self, twr_tick_t interval)
Set measurement interval.
struct twr_sht20_t twr_sht20_t
SHT20 instance.
Definition: twr_sht20.h:25
struct twr_hdc2080_t twr_hdc2080_t
HDC2080 instance.
Definition: twr_hdc2080.h:25
bool twr_tag_humidity_get_humidity_percentage(twr_tag_humidity_t *self, float *percentage)
Get measured humidity as percentage.
struct twr_hts221_t twr_hts221_t
HTS221 instance.
Definition: twr_hts221.h:25
twr_tag_humidity_i2c_address_t
I2C address.
Hardware revision R3.
twr_tag_humidity_event_t
Callback events.
bool twr_tag_humidity_get_temperature_raw(twr_tag_humidity_t *self, uint16_t *raw)
Get measured temperature as raw value.
struct twr_sht30_t twr_sht30_t
SHT30 instance.
Definition: twr_sht30.h:28
Hardware revision R4.