5 #include <twr_scheduler.h>
31 TWR_TMP112_STATE_ERROR = -1,
32 TWR_TMP112_STATE_INITIALIZE = 0,
33 TWR_TMP112_STATE_MEASURE = 1,
34 TWR_TMP112_STATE_READ = 2,
35 TWR_TMP112_STATE_UPDATE = 3
47 bool _measurement_active;
49 twr_tmp112_state_t _state;
51 bool _temperature_valid;
52 uint16_t _reg_temperature;
twr_i2c_channel_t
I2C channels.
size_t twr_scheduler_task_id_t
Task ID assigned by scheduler.
uint64_t twr_tick_t
Timestamp data type.
bool twr_tmp112_get_temperature_kelvin(twr_tmp112_t *self, float *kelvin)
Get measured temperature in kelvin.
twr_tmp112_event_t
Callback events.
void twr_tmp112_set_update_interval(twr_tmp112_t *self, twr_tick_t interval)
Set measurement interval.
bool twr_tmp112_get_temperature_raw(twr_tmp112_t *self, int16_t *raw)
Get measured temperature as raw value.
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.
bool twr_tmp112_measure(twr_tmp112_t *self)
Start measurement manually.
struct twr_tmp112_t twr_tmp112_t
TMP112 instance.
void twr_tmp112_deinit(twr_tmp112_t *self)
Deinitialize TMP112.
bool twr_tmp112_get_temperature_celsius(twr_tmp112_t *self, float *celsius)
Get measured temperature in degrees of Celsius.
bool twr_tmp112_get_temperature_fahrenheit(twr_tmp112_t *self, float *fahrenheit)
Get measured temperature in degrees of Fahrenheit.
void twr_tmp112_init(twr_tmp112_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize TMP112.
@ TWR_TMP112_EVENT_ERROR
Error event.
@ TWR_TMP112_EVENT_UPDATE
Update event.