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#
SHT4X_ADDR#
#define SHT4X_ADDRValue:
0x44
I2C device address for SHT4X.
78
of file hardware/driver/sht4x/inc/sl_sht4x.h
Function Documentation#
sl_sht4x_init#
sl_status_t sl_sht4x_init (sl_i2cspm_t * i2cspm, uint8_t addr)
Initialize the SHT4x sensor.
[in] | i2cspm | The I2C peripheral to use. |
[in] | addr | The I2C address to probe. |
92
of file hardware/driver/sht4x/inc/sl_sht4x.h
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.
[in] | i2cspm | The I2C peripheral to use. |
[in] | addr | The I2C address to probe. |
[out] | device_id | Write device ID if device responds. Pass in NULL to discard. Each SHT4x sensor has unique 48-bit serial number. |
107
of file hardware/driver/sht4x/inc/sl_sht4x.h
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.
[in] | i2cspm | The I2C peripheral to use. |
[in] | addr | The I2C address of the sensor. |
[out] | rhData | The relative humidity in percent (multiplied by 1000). |
[out] | tData | The temperature in degree Celsius (multiplied by 1000). |
123
of file hardware/driver/sht4x/inc/sl_sht4x.h
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.
[in] | i2cspm | The I2C peripheral to use. |
[in] | addr | The I2C address of the sensor. |
[out] | rhData | The relative humidity in percent. |
[out] | tData | The temperature in degree Celsius. |
140
of file hardware/driver/sht4x/inc/sl_sht4x.h
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.
[in] | enable_low_power_mode | If true, enables the SHT4x sensor in low power mode. |
N/A | sht4x_cmd_measure |
149
of file hardware/driver/sht4x/inc/sl_sht4x.h