Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_sht20

Driver for SHT20 humidity sensor. More...

Typedefs

typedef struct bc_sht20_t bc_sht20_t
 SHT20 instance.
 

Enumerations

enum  bc_sht20_event_t {
  BC_SHT20_EVENT_ERROR = 0,
  BC_SHT20_EVENT_UPDATE = 1
}
 Callback events. More...
 

Functions

void bc_sht20_init (bc_sht20_t *self, bc_i2c_channel_t i2c_channel, uint8_t i2c_address)
 Initialize SHT20. More...
 
void bc_sht20_set_event_handler (bc_sht20_t *self, void(*event_handler)(bc_sht20_t *, bc_sht20_event_t, void *), void *event_param)
 Set callback function. More...
 
void bc_sht20_set_update_interval (bc_sht20_t *self, bc_tick_t interval)
 Set measurement interval. More...
 
bool bc_sht20_measure (bc_sht20_t *self)
 Start measurement manually. More...
 
bool bc_sht20_get_humidity_raw (bc_sht20_t *self, uint16_t *raw)
 Get measured humidity as raw value. More...
 
bool bc_sht20_get_humidity_percentage (bc_sht20_t *self, float *percentage)
 Get measured humidity as percentage. More...
 
bool bc_sht20_get_temperature_raw (bc_sht20_t *self, uint16_t *raw)
 Get measured temperature as raw value. More...
 
bool bc_sht20_get_temperature_celsius (bc_sht20_t *self, float *celsius)
 Get measured temperature in degrees of Celsius. More...
 

Detailed Description

Driver for SHT20 humidity sensor.

Enumeration Type Documentation

Callback events.

Enumerator
BC_SHT20_EVENT_ERROR 

Error event.

BC_SHT20_EVENT_UPDATE 

Update event.

Definition at line 13 of file bc_sht20.h.

Function Documentation

bool bc_sht20_get_humidity_percentage ( bc_sht20_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 77 of file bc_sht20.c.

Referenced by bc_module_climate_get_humidity_percentage(), and bc_tag_humidity_get_humidity_percentage().

Here is the call graph for this function:

Here is the caller graph for this function:

bool bc_sht20_get_humidity_raw ( bc_sht20_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 65 of file bc_sht20.c.

Referenced by bc_sht20_get_humidity_percentage(), and bc_tag_humidity_get_humidity_raw().

Here is the caller graph for this function:

bool bc_sht20_get_temperature_celsius ( bc_sht20_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 112 of file bc_sht20.c.

Referenced by bc_tag_humidity_get_temperature_celsius().

Here is the call graph for this function:

Here is the caller graph for this function:

bool bc_sht20_get_temperature_raw ( bc_sht20_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 100 of file bc_sht20.c.

Referenced by bc_sht20_get_temperature_celsius(), and bc_tag_humidity_get_temperature_raw().

Here is the caller graph for this function:

void bc_sht20_init ( bc_sht20_t self,
bc_i2c_channel_t  i2c_channel,
uint8_t  i2c_address 
)

Initialize SHT20.

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

Definition at line 14 of file bc_sht20.c.

Referenced by bc_module_climate_init(), and bc_tag_humidity_init().

Here is the call graph for this function:

Here is the caller graph for this function:

bool bc_sht20_measure ( bc_sht20_t self)

Start measurement manually.

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

Definition at line 51 of file bc_sht20.c.

Referenced by bc_module_climate_measure_all_sensors(), bc_module_climate_measure_hygrometer(), bc_sht20_set_update_interval(), and bc_tag_humidity_measure().

Here is the call graph for this function:

Here is the caller graph for this function:

void bc_sht20_set_event_handler ( bc_sht20_t self,
void(*)(bc_sht20_t *, bc_sht20_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 29 of file bc_sht20.c.

Referenced by bc_module_climate_init(), and bc_tag_humidity_init().

Here is the caller graph for this function:

void bc_sht20_set_update_interval ( bc_sht20_t self,
bc_tick_t  interval 
)

Set measurement interval.

Parameters
[in]selfInstance
[in]intervalMeasurement interval

Definition at line 35 of file bc_sht20.c.

Referenced by bc_module_climate_set_update_interval_all_sensors(), bc_module_climate_set_update_interval_hygrometer(), and bc_tag_humidity_set_update_interval().

Here is the call graph for this function:

Here is the caller graph for this function: