Firmware SDK
twr_sht30

Driver for SHT30 humidity sensor. More...

Macros

#define TWR_SHT30_ADDRESS_DEFAULT   0x44
 
#define TWR_SHT30_ADDRESS_ALTERNATE   0x45
 

Typedefs

typedef struct twr_sht30_t twr_sht30_t
 SHT30 instance.
 

Enumerations

enum  twr_sht30_event_t {
  TWR_SHT30_EVENT_ERROR = 0 ,
  TWR_SHT30_EVENT_UPDATE = 1
}
 Callback events. More...
 

Functions

void twr_sht30_init (twr_sht30_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
 Initialize SHT30. More...
 
void twr_sht30_deinit (twr_sht30_t *self)
 Deinitialize SHT30. More...
 
void twr_sht30_set_event_handler (twr_sht30_t *self, void(*event_handler)(twr_sht30_t *, twr_sht30_event_t, void *), void *event_param)
 Set callback function. More...
 
void twr_sht30_set_update_interval (twr_sht30_t *self, twr_tick_t interval)
 Set measurement interval. More...
 
bool twr_sht30_measure (twr_sht30_t *self)
 Start measurement manually. More...
 
bool twr_sht30_get_humidity_raw (twr_sht30_t *self, uint16_t *raw)
 Get measured humidity as raw value. More...
 
bool twr_sht30_get_humidity_percentage (twr_sht30_t *self, float *percentage)
 Get measured humidity as percentage. More...
 
bool twr_sht30_get_temperature_raw (twr_sht30_t *self, uint16_t *raw)
 Get measured temperature as raw value. More...
 
bool twr_sht30_get_temperature_celsius (twr_sht30_t *self, float *celsius)
 Get measured temperature in degrees of Celsius. More...
 
bool twr_sht30_get_temperature_fahrenheit (twr_sht30_t *self, float *fahrenheit)
 Get measured temperature in degrees of Fahrenheit. More...
 
bool twr_sht30_get_temperature_kelvin (twr_sht30_t *self, float *kelvin)
 Get measured temperature in kelvin. More...
 

Detailed Description

Driver for SHT30 humidity sensor.

Enumeration Type Documentation

◆ twr_sht30_event_t

Callback events.

Enumerator
TWR_SHT30_EVENT_ERROR 

Error event.

TWR_SHT30_EVENT_UPDATE 

Update event.

Definition at line 16 of file twr_sht30.h.

Function Documentation

◆ twr_sht30_deinit()

void twr_sht30_deinit ( twr_sht30_t self)

Deinitialize SHT30.

Parameters
[in]selfInstance

Definition at line 30 of file twr_sht30.c.

Here is the call graph for this function:

◆ twr_sht30_get_humidity_percentage()

bool twr_sht30_get_humidity_percentage ( twr_sht30_t self,
float *  percentage 
)

Get measured humidity as percentage.

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

Definition at line 85 of file twr_sht30.c.

Referenced by twr_module_climate_get_humidity_percentage(), and twr_tag_humidity_get_humidity_percentage().

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

◆ twr_sht30_get_humidity_raw()

bool twr_sht30_get_humidity_raw ( twr_sht30_t self,
uint16_t *  raw 
)

Get measured humidity as raw value.

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

Definition at line 73 of file twr_sht30.c.

Referenced by twr_sht30_get_humidity_percentage(), and twr_tag_humidity_get_humidity_raw().

Here is the caller graph for this function:

◆ twr_sht30_get_temperature_celsius()

bool twr_sht30_get_temperature_celsius ( twr_sht30_t self,
float *  celsius 
)

Get measured temperature in degrees of Celsius.

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

Definition at line 120 of file twr_sht30.c.

Referenced by twr_module_climate_get_temperature_celsius(), twr_sht30_get_temperature_fahrenheit(), twr_sht30_get_temperature_kelvin(), and twr_tag_humidity_get_temperature_celsius().

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

◆ twr_sht30_get_temperature_fahrenheit()

bool twr_sht30_get_temperature_fahrenheit ( twr_sht30_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 134 of file twr_sht30.c.

Referenced by twr_module_climate_get_temperature_fahrenheit().

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

◆ twr_sht30_get_temperature_kelvin()

bool twr_sht30_get_temperature_kelvin ( twr_sht30_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 148 of file twr_sht30.c.

Referenced by twr_module_climate_get_temperature_kelvin().

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

◆ twr_sht30_get_temperature_raw()

bool twr_sht30_get_temperature_raw ( twr_sht30_t self,
uint16_t *  raw 
)

Get measured temperature as raw value.

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

Definition at line 108 of file twr_sht30.c.

Referenced by twr_sht30_get_temperature_celsius(), and twr_tag_humidity_get_temperature_raw().

Here is the caller graph for this function:

◆ twr_sht30_init()

void twr_sht30_init ( twr_sht30_t self,
twr_i2c_channel_t  i2c_channel,
uint8_t  i2c_address 
)

Initialize SHT30.

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

Definition at line 15 of file twr_sht30.c.

Referenced by twr_tag_humidity_init().

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

◆ twr_sht30_measure()

bool twr_sht30_measure ( twr_sht30_t self)

Start measurement manually.

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

Definition at line 59 of file twr_sht30.c.

Referenced by twr_module_climate_measure_all_sensors(), twr_module_climate_measure_hygrometer(), twr_sht30_set_update_interval(), and twr_tag_humidity_measure().

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

◆ twr_sht30_set_event_handler()

void twr_sht30_set_event_handler ( twr_sht30_t self,
void(*)(twr_sht30_t *, twr_sht30_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 37 of file twr_sht30.c.

Referenced by twr_tag_humidity_init().

Here is the caller graph for this function:

◆ twr_sht30_set_update_interval()

void twr_sht30_set_update_interval ( twr_sht30_t self,
twr_tick_t  interval 
)

Set measurement interval.

Parameters
[in]selfInstance
[in]intervalMeasurement interval

Definition at line 43 of file twr_sht30.c.

Referenced by twr_module_climate_set_update_interval_all_sensors(), twr_module_climate_set_update_interval_hygrometer(), and twr_tag_humidity_set_update_interval().

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