Firmware SDK
twr_tag_temperature.c
1 #include <twr_tag_temperature.h>
2 
4 {
5  twr_tmp112_init(self, i2c_channel, (uint8_t) i2c_address);
6 }
7 
9 {
10  twr_tmp112_set_event_handler(self, (void (*)(twr_tmp112_t *, twr_tmp112_event_t, void *)) event_handler, event_param);
11 }
12 
14 {
15  twr_tmp112_set_update_interval(self, interval);
16 }
17 
19 {
20  return twr_tmp112_measure(self);
21 }
22 
24 {
25  return twr_tmp112_get_temperature_raw(self, raw);
26 }
27 
29 {
30  return twr_tmp112_get_temperature_celsius(self, celsius);
31 }
32 
34 {
35  return twr_tmp112_get_temperature_fahrenheit(self, fahrenheit);
36 }
37 
39 {
40  return twr_tmp112_get_temperature_kelvin(self, kelvin);
41 }
twr_i2c_channel_t
I2C channels.
Definition: twr_i2c.h:16
void twr_tag_temperature_init(twr_tag_temperature_t *self, twr_i2c_channel_t i2c_channel, twr_tag_temperature_i2c_address_t i2c_address)
Initialize HARDWARIO Temperature Module.
void twr_tag_temperature_set_event_handler(twr_tag_temperature_t *self, void(*event_handler)(twr_tag_temperature_t *, twr_tag_temperature_event_t, void *), void *event_param)
Set callback function.
void twr_tag_temperature_set_update_interval(twr_tag_temperature_t *self, twr_tick_t interval)
Set measurement interval.
bool twr_tag_temperature_get_temperature_celsius(twr_tag_temperature_t *self, float *celsius)
Get measured temperature in degrees of Celsius.
twr_tag_temperature_event_t
Callback events.
bool twr_tag_temperature_get_temperature_raw(twr_tag_temperature_t *self, int16_t *raw)
Get measured temperature as raw value.
bool twr_tag_temperature_get_temperature_fahrenheit(twr_tag_temperature_t *self, float *fahrenheit)
Get measured temperature in degrees of Fahrenheit.
bool twr_tag_temperature_get_temperature_kelvin(twr_tag_temperature_t *self, float *kelvin)
Get measured temperature in kelvin.
twr_tag_temperature_i2c_address_t
I2C address.
twr_tmp112_t twr_tag_temperature_t
HARDWARIO Temperature Module instance.
bool twr_tag_temperature_measure(twr_tag_temperature_t *self)
Start measurement manually.
uint64_t twr_tick_t
Timestamp data type.
Definition: twr_tick.h:16
bool twr_tmp112_get_temperature_kelvin(twr_tmp112_t *self, float *kelvin)
Get measured temperature in kelvin.
Definition: twr_tmp112.c:111
twr_tmp112_event_t
Callback events.
Definition: twr_tmp112.h:14
void twr_tmp112_set_update_interval(twr_tmp112_t *self, twr_tick_t interval)
Set measurement interval.
Definition: twr_tmp112.c:41
bool twr_tmp112_get_temperature_raw(twr_tmp112_t *self, int16_t *raw)
Get measured temperature as raw value.
Definition: twr_tmp112.c:71
void twr_tmp112_set_event_handler(twr_tmp112_t *self, void(*event_handler)(twr_tmp112_t *, twr_tmp112_event_t, void *), void *event_param)
Set callback function.
Definition: twr_tmp112.c:35
bool twr_tmp112_measure(twr_tmp112_t *self)
Start measurement manually.
Definition: twr_tmp112.c:57
struct twr_tmp112_t twr_tmp112_t
TMP112 instance.
Definition: twr_tmp112.h:25
bool twr_tmp112_get_temperature_celsius(twr_tmp112_t *self, float *celsius)
Get measured temperature in degrees of Celsius.
Definition: twr_tmp112.c:83
bool twr_tmp112_get_temperature_fahrenheit(twr_tmp112_t *self, float *fahrenheit)
Get measured temperature in degrees of Fahrenheit.
Definition: twr_tmp112.c:97
void twr_tmp112_init(twr_tmp112_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize TMP112.
Definition: twr_tmp112.c:11