Firmware SDK
twr_tag_barometer.c
1 #include <twr_tag_barometer.h>
2 
4 {
5  twr_mpl3115a2_init(self, i2c_channel, 0x60);
6 }
7 
8 void twr_tag_barometer_set_event_handler(twr_tag_barometer_t *self, void (*event_handler)(twr_tag_barometer_t *, twr_tag_barometer_event_t, void *), void *event_param)
9 {
10  twr_mpl3115a2_set_event_handler(self, (void (*)(twr_mpl3115a2_t *, twr_mpl3115a2_event_t, void *)) event_handler, event_param);
11 }
12 
14 {
15  twr_mpl3115a2_set_update_interval(self, interval);
16 }
17 
19 {
20  return twr_mpl3115a2_measure(self);
21 }
22 
24 {
25  return twr_mpl3115a2_get_altitude_meter(self, meter);
26 }
27 
29 {
30  return twr_mpl3115a2_get_pressure_pascal(self, pascal);
31 }
twr_mpl3115a2_t twr_tag_barometer_t
HARDWARIO Barometer Module instance.
bool twr_tag_barometer_get_pressure_pascal(twr_tag_barometer_t *self, float *pascal)
Get measured pressure in Pascal.
struct twr_mpl3115a2_t twr_mpl3115a2_t
MPL3115A2 instance.
Definition: twr_mpl3115a2.h:25
twr_tag_barometer_event_t
Callback events.
void twr_mpl3115a2_init(twr_mpl3115a2_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize MPL3115A2.
Definition: twr_mpl3115a2.c:11
void twr_mpl3115a2_set_update_interval(twr_mpl3115a2_t *self, twr_tick_t interval)
Set measurement interval.
Definition: twr_mpl3115a2.c:41
void twr_tag_barometer_set_update_interval(twr_tag_barometer_t *self, twr_tick_t interval)
Set measurement interval.
twr_mpl3115a2_event_t
Callback events.
Definition: twr_mpl3115a2.h:13
void twr_tag_barometer_init(twr_tag_barometer_t *self, twr_i2c_channel_t i2c_channel)
Initialize HARDWARIO Barometer Module.
bool twr_mpl3115a2_get_pressure_pascal(twr_mpl3115a2_t *self, float *pascal)
Get measured pressured in Pascal.
Definition: twr_mpl3115a2.c:85
void twr_tag_barometer_set_event_handler(twr_tag_barometer_t *self, void(*event_handler)(twr_tag_barometer_t *, twr_tag_barometer_event_t, void *), void *event_param)
Set callback function.
bool twr_tag_barometer_measure(twr_tag_barometer_t *self)
Start measurement manually.
bool twr_mpl3115a2_measure(twr_mpl3115a2_t *self)
Start measurement manually.
Definition: twr_mpl3115a2.c:57
uint64_t twr_tick_t
Timestamp data type.
Definition: twr_tick.h:16
twr_i2c_channel_t
I2C channels.
Definition: twr_i2c.h:15
bool twr_mpl3115a2_get_altitude_meter(twr_mpl3115a2_t *self, float *meter)
Get measured altitude in meters.
Definition: twr_mpl3115a2.c:71
bool twr_tag_barometer_get_altitude_meter(twr_tag_barometer_t *self, float *meter)
Get measured altitude in meters.
void twr_mpl3115a2_set_event_handler(twr_mpl3115a2_t *self, void(*event_handler)(twr_mpl3115a2_t *, twr_mpl3115a2_event_t, void *), void *event_param)
Set callback function.
Definition: twr_mpl3115a2.c:35