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#

#define

I2C device address for SHT4X.

Functions#

sl_status_t
sl_sht4x_init(sl_i2cspm_t *i2cspm, uint8_t addr)

Initialize the SHT4x sensor.

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.

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.

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.

void
sl_sht4x_enable_low_power_mode(bool enable_low_power_mode, uint8_t *sht4x_cmd_measure)

Enables the low power mode.

Sensor Defines Documentation#

SHT4X_ADDR#

#define SHT4X_ADDR
Value:
0x44

I2C device address for SHT4X.


Definition at line 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.

Parameters
[in]i2cspm

The I2C peripheral to use.

[in]addr

The I2C address to probe.


Definition at line 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.

Parameters
[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.


Definition at line 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.

Parameters
[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).


Definition at line 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.

Parameters
[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.


Definition at line 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.

Parameters
[in]enable_low_power_mode

If true, enables the SHT4x sensor in low power mode.

N/Asht4x_cmd_measure

Definition at line 149 of file hardware/driver/sht4x/inc/sl_sht4x.h