SHT4x - RHT Sensor#
SHT4x Relative Humidity and Temperature Sensor I2C driver.
SHT4X example code#
Basic example for relative humidity and temperature measurement using an SHT4x sensor:
#include "sl_i2cspm_instances.h"
#include "sl_sht4x.h"
int main( void )
{
...
int32_t temp_data;
uint32_t rh_data;
sl_sht4x_init(sl_i2cspm_sensor, SHT4X_ADDR);
sl_sht4x_measure_rh_and_temp(sl_i2cspm_sensor, SHT4X_ADDR, &rh_data, &temp_data);
...
}
Sensor Defines#
I2C device address for SHT4X.
Functions#
Initialize the SHT4x sensor.
Check whether an SHT4x sensor is present on the I2C bus or not.
Measure relative humidity and temperature from an SHT4x sensor.
Read relative humidity and temperature from an SHT4x sensor.
Enables the low power mode.
Sensor Defines Documentation#
Function Documentation#
sl_sht4x_init#
sl_status_t sl_sht4x_init (sl_i2cspm_t * i2cspm, uint8_t addr)
Initialize the SHT4x sensor.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2cspm_t * | [in] | i2cspm | The I2C peripheral to use. |
uint8_t | [in] | addr | The I2C address to probe. |
sl_sht4x_present#
sl_status_t sl_sht4x_present (sl_i2cspm_t * i2cspm, uint8_t addr, uint64_t * device_id)
Check whether an SHT4x sensor is present on the I2C bus or not.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2cspm_t * | [in] | i2cspm | The I2C peripheral to use. |
uint8_t | [in] | addr | The I2C address to probe. |
uint64_t * | [out] | device_id | Write device ID if device responds. Pass in NULL to discard. Each SHT4x sensor has unique 48-bit serial number. |
sl_sht4x_measure_rh_and_temp#
sl_status_t sl_sht4x_measure_rh_and_temp (sl_i2cspm_t * i2cspm, uint8_t addr, uint32_t * rhData, int32_t * tData)
Measure relative humidity and temperature from an SHT4x sensor.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2cspm_t * | [in] | i2cspm | The I2C peripheral to use. |
uint8_t | [in] | addr | The I2C address of the sensor. |
uint32_t * | [out] | rhData | The relative humidity in percent (multiplied by 1000). |
int32_t * | [out] | tData | The temperature in degree Celsius (multiplied by 1000). |
sl_sht4x_read_rh_and_temp#
sl_status_t sl_sht4x_read_rh_and_temp (sl_i2cspm_t * i2cspm, uint8_t addr, uint32_t * rhData, int32_t * tData)
Read relative humidity and temperature from an SHT4x sensor.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2cspm_t * | [in] | i2cspm | The I2C peripheral to use. |
uint8_t | [in] | addr | The I2C address of the sensor. |
uint32_t * | [out] | rhData | The relative humidity in percent. |
int32_t * | [out] | tData | The temperature in degree Celsius. |
sl_sht4x_enable_low_power_mode#
void sl_sht4x_enable_low_power_mode (bool enable_low_power_mode, uint8_t * sht4x_cmd_measure)
Enables the low power mode.
Type | Direction | Argument Name | Description |
---|---|---|---|
bool | [in] | enable_low_power_mode | If true, enables the SHT4x sensor in low power mode. |
uint8_t * | N/A | sht4x_cmd_measure |