Firmware SDK
twr_hts221

Driver for HTS221 humidity sensor. More...

Typedefs

typedef struct twr_hts221_t twr_hts221_t
 HTS221 instance.
 

Enumerations

enum  twr_hts221_event_t {
  TWR_HTS221_EVENT_ERROR = 0,
  TWR_HTS221_EVENT_UPDATE = 1
}
 Callback events. More...
 

Functions

void twr_hts221_init (twr_hts221_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
 Initialize HTS221. More...
 
void twr_hts221_deinit (twr_hts221_t *self)
 Deinitialize HTS221. More...
 
void twr_hts221_set_event_handler (twr_hts221_t *self, void(*event_handler)(twr_hts221_t *, twr_hts221_event_t, void *), void *event_param)
 Set callback function. More...
 
void twr_hts221_set_update_interval (twr_hts221_t *self, twr_tick_t interval)
 Set measurement interval. More...
 
bool twr_hts221_measure (twr_hts221_t *self)
 Start measurement manually. More...
 
bool twr_hts221_get_humidity_percentage (twr_hts221_t *self, float *percentage)
 Get measured humidity as percentage. More...
 

Detailed Description

Driver for HTS221 humidity sensor.

Enumeration Type Documentation

◆ twr_hts221_event_t

Callback events.

Enumerator
TWR_HTS221_EVENT_ERROR 

Error event.

TWR_HTS221_EVENT_UPDATE 

Update event.

Definition at line 13 of file twr_hts221.h.

Function Documentation

◆ twr_hts221_deinit()

void twr_hts221_deinit ( twr_hts221_t self)

Deinitialize HTS221.

Parameters
[in]selfInstance

Definition at line 71 of file twr_hts221.c.

Here is the call graph for this function:

◆ twr_hts221_get_humidity_percentage()

bool twr_hts221_get_humidity_percentage ( twr_hts221_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 120 of file twr_hts221.c.

Referenced by twr_tag_humidity_get_humidity_percentage().

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

◆ twr_hts221_init()

void twr_hts221_init ( twr_hts221_t self,
twr_i2c_channel_t  i2c_channel,
uint8_t  i2c_address 
)

Initialize HTS221.

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

Definition at line 53 of file twr_hts221.c.

Referenced by twr_tag_humidity_init().

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

◆ twr_hts221_measure()

bool twr_hts221_measure ( twr_hts221_t self)

Start measurement manually.

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

Definition at line 106 of file twr_hts221.c.

Referenced by twr_hts221_get_humidity_percentage(), twr_hts221_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_hts221_set_event_handler()

void twr_hts221_set_event_handler ( twr_hts221_t self,
void(*)(twr_hts221_t *, twr_hts221_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 84 of file twr_hts221.c.

Referenced by twr_tag_humidity_init().

Here is the caller graph for this function:

◆ twr_hts221_set_update_interval()

void twr_hts221_set_update_interval ( twr_hts221_t self,
twr_tick_t  interval 
)

Set measurement interval.

Parameters
[in]selfInstance
[in]intervalMeasurement interval

Definition at line 90 of file twr_hts221.c.

Referenced by twr_tag_humidity_set_update_interval().

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