Firmware SDK
twr_tmp112

Driver for TMP112 temperature sensor. More...

Typedefs

typedef struct twr_tmp112_t twr_tmp112_t
 TMP112 instance.
 

Enumerations

enum  twr_tmp112_event_t {
  TWR_TMP112_EVENT_ERROR = 0 ,
  TWR_TMP112_EVENT_UPDATE = 1
}
 Callback events. More...
 

Functions

void twr_tmp112_init (twr_tmp112_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
 Initialize TMP112. More...
 
void twr_tmp112_deinit (twr_tmp112_t *self)
 Deinitialize TMP112. More...
 
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. More...
 
void twr_tmp112_set_update_interval (twr_tmp112_t *self, twr_tick_t interval)
 Set measurement interval. More...
 
bool twr_tmp112_measure (twr_tmp112_t *self)
 Start measurement manually. More...
 
bool twr_tmp112_get_temperature_raw (twr_tmp112_t *self, int16_t *raw)
 Get measured temperature as raw value. More...
 
bool twr_tmp112_get_temperature_celsius (twr_tmp112_t *self, float *celsius)
 Get measured temperature in degrees of Celsius. More...
 
bool twr_tmp112_get_temperature_fahrenheit (twr_tmp112_t *self, float *fahrenheit)
 Get measured temperature in degrees of Fahrenheit. More...
 
bool twr_tmp112_get_temperature_kelvin (twr_tmp112_t *self, float *kelvin)
 Get measured temperature in kelvin. More...
 

Detailed Description

Driver for TMP112 temperature sensor.

Enumeration Type Documentation

◆ twr_tmp112_event_t

Callback events.

Enumerator
TWR_TMP112_EVENT_ERROR 

Error event.

TWR_TMP112_EVENT_UPDATE 

Update event.

Definition at line 13 of file twr_tmp112.h.

Function Documentation

◆ twr_tmp112_deinit()

void twr_tmp112_deinit ( twr_tmp112_t self)

Deinitialize TMP112.

Parameters
[in]selfInstance

Definition at line 26 of file twr_tmp112.c.

Here is the call graph for this function:

◆ twr_tmp112_get_temperature_celsius()

bool twr_tmp112_get_temperature_celsius ( twr_tmp112_t self,
float *  celsius 
)

Get measured temperature in degrees of Celsius.

Parameters
[in]selfInstance
[out]celsiusPointer to variable where result will be stored
Returns
true When value is valid
false When value is invalid

Definition at line 83 of file twr_tmp112.c.

Referenced by twr_module_climate_get_temperature_celsius(), twr_tag_temperature_get_temperature_celsius(), twr_tmp112_get_temperature_fahrenheit(), and twr_tmp112_get_temperature_kelvin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_tmp112_get_temperature_fahrenheit()

bool twr_tmp112_get_temperature_fahrenheit ( twr_tmp112_t self,
float *  fahrenheit 
)

Get measured temperature in degrees of Fahrenheit.

Parameters
[in]selfInstance
[out]fahrenheitPointer to variable where result will be stored
Returns
true When value is valid
false When value is invalid

Definition at line 97 of file twr_tmp112.c.

Referenced by twr_module_climate_get_temperature_fahrenheit(), and twr_tag_temperature_get_temperature_fahrenheit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_tmp112_get_temperature_kelvin()

bool twr_tmp112_get_temperature_kelvin ( twr_tmp112_t self,
float *  kelvin 
)

Get measured temperature in kelvin.

Parameters
[in]selfInstance
[out]kelvinPointer to variable where result will be stored
Returns
true When value is valid
false When value is invalid

Definition at line 111 of file twr_tmp112.c.

Referenced by twr_module_climate_get_temperature_kelvin(), and twr_tag_temperature_get_temperature_kelvin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_tmp112_get_temperature_raw()

bool twr_tmp112_get_temperature_raw ( twr_tmp112_t self,
int16_t *  raw 
)

Get measured temperature as raw value.

Parameters
[in]selfInstance
[out]rawPointer to variable where result will be stored
Returns
true When value is valid
false When value is invalid

Definition at line 71 of file twr_tmp112.c.

Referenced by twr_tag_temperature_get_temperature_raw(), and twr_tmp112_get_temperature_celsius().

Here is the caller graph for this function:

◆ twr_tmp112_init()

void twr_tmp112_init ( twr_tmp112_t self,
twr_i2c_channel_t  i2c_channel,
uint8_t  i2c_address 
)

Initialize TMP112.

Parameters
[in]selfInstance
[in]i2c_channelI2C channel
[in]i2c_addressI2C device address

Definition at line 11 of file twr_tmp112.c.

Referenced by twr_module_climate_init(), and twr_tag_temperature_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_tmp112_measure()

bool twr_tmp112_measure ( twr_tmp112_t self)

Start measurement manually.

Parameters
[in]selfInstance
Returns
true On success
false When other measurement is in progress

Definition at line 57 of file twr_tmp112.c.

Referenced by twr_module_climate_measure_all_sensors(), twr_module_climate_measure_thermometer(), twr_tag_temperature_measure(), and twr_tmp112_set_update_interval().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_tmp112_set_event_handler()

void twr_tmp112_set_event_handler ( twr_tmp112_t self,
void(*)(twr_tmp112_t *, twr_tmp112_event_t, void *)  event_handler,
void *  event_param 
)

Set callback function.

Parameters
[in]selfInstance
[in]event_handlerFunction address
[in]event_paramOptional event parameter (can be NULL)

Definition at line 35 of file twr_tmp112.c.

Referenced by twr_module_climate_init(), and twr_tag_temperature_set_event_handler().

Here is the caller graph for this function:

◆ twr_tmp112_set_update_interval()

void twr_tmp112_set_update_interval ( twr_tmp112_t self,
twr_tick_t  interval 
)

Set measurement interval.

Parameters
[in]selfInstance
[in]intervalMeasurement interval

Definition at line 41 of file twr_tmp112.c.

Referenced by twr_module_climate_set_update_interval_all_sensors(), twr_module_climate_set_update_interval_thermometer(), and twr_tag_temperature_set_update_interval().

Here is the call graph for this function:
Here is the caller graph for this function: