Si70XX Sensor#
Introduction#
The Si70xx sensor driver offers a set of functions for interacting with the Si70xx sensor series over the I2C bus. It facilitates the integration of the sensor by providing access to features such as temperature and humidity measurements, firmware revision retrieval, and device presence detection. All Si70xx functions are managed through the generic driver.
Usage#
Once the I2C peripheral is initialized and configured, the Si70xx sensor will be ready for use. The common functions include the following:
Initialize the Si70xx sensor:sl_si91x_si70xx_init
Check whether an Si7006/13/20/21 is present on the I2C bus:sl_si91x_si70xx_is_present
Measure relative humidity and temperature from the Si7006/13/20/21 sensor:sl_si91x_si70xx_measure_rh_and_temp
Read firmware revision from the Si7006/13/20/21 sensor:sl_si91x_si70xx_get_firmware_revision
Initiate a Si70xx software reset using the appropriate command:sl_si91x_si70xx_reset
The following sequence should be followed when using the Si70xx sensor:
Initialize the Si70xx sensor: Use sl_si91x_si70xx_init before using the other functions.
Check Sensor Presence: Optionally verify if a Si70xx sensor is present on the I2C bus using sl_si91x_si70xx_is_present.
Measure Relative Humidity and Temperature: Use sl_si91x_si70xx_measure_rh_and_temp to obtain measurements from the sensor.
Read the firmware revision: Retrieve the firmware version with sl_si91x_si70xx_get_firmware_revision.
Initiate a software reset: Perform a software reset on the sensor if needed using sl_si91x_si70xx_reset.
See the Function Documentation for the usage information of all the APIs in detail.
Enumerations#
Enum for Si70xx commands.
Enum for Temperature and Humidity measurement types.
To specify the type of electronic ID byte to be sent.
To specify the RH/T (Relative Humidity & Temperature) User Register and Heater Control Registers.
Typedefs#
Enum for Si70xx commands.
Enum for Temperature and Humidity measurement types.
To specify the type of electronic ID byte to be sent.
To specify the RH/T (Relative Humidity & Temperature) User Register and Heater Control Registers.
Functions#
To initialize the Si70xx sensor.
To check whether an Si7006/13/20/21 is present on the I2C bus.
To measure relative humidity and temperature from Si7006/13/20/21 sensor.
To read the firmware revision from the Si7006/13/20/21 sensor.
To read the temperature value from the previous relative humidity measurement from the Si7006/13/20/21 sensor.
To start a no-hold measurement of relative humidity or temperature from the Si7006/13/20/21 sensor.
To measure relative humidity from the Si7006/13/20/21 sensor.
To measure temperature from the Si7006/13/20/21 sensor.
To initiate a software reset for the Si70xx sensor.
To read the RH/T user register and heater control register data from the Si70xx sensor.
To write data to RH/T user register and heater control register.
Macros#
I2C device address for Si7006.
I2C device address for Si7013.
I2C device address for Si7020.
I2C device address for Si7021.
I2C2 base.
Enumeration Documentation#
sl_si70xx_commands#
sl_si70xx_commands
Enum for Si70xx commands.
This enumeration defines the command codes used to interact with the Si70xx sensor family. These commands are used to measure humidity and temperature, read and write user registers, control the heater, and read the electronic ID and firmware revision.
Enumerator | |
---|---|
SL_HUMIDITY_HM | Measure Relative Humidity, Hold Master Mode. |
SL_HUMIDITY_NHM | Measure Relative Humidity, No Hold Master Mode. |
SL_TEMPERATURE_HM | Measure Temperature, Hold Master Mode. |
SL_TEMPERATURE_NHM | Measure Temperature, No Hold Master Mode. |
SL_TEMPERATURE_AH | Read Temperature Value from Previous RH Measurement. |
SL_SI70XX_RESET | Si70XX Reset. |
SL_W_RHT_U_REG | Write RH/T User Register 1. |
SL_R_RHT_U_REG | Read RH/T User Register 1. |
SL_W_HEATER_C_REG | Write Heater Control Register. |
SL_R_HEATER_C_REG | Read Heater Control Register. |
SL_EID_BYTEL1 | Read Electronic ID 1st Byte, first part. |
SL_EID_BYTEL2 | Read Electronic ID 1st Byte, second part. |
SL_EID_BYTE21 | Read Electronic ID 2nd Byte, first part. |
SL_EID_BYTE22 | Read Electronic ID 2nd Byte, second part. |
SL_FIRMWARE_REV1 | Read Firmware Revision, first part. |
SL_FIRMWARE_REV2 | Read Firmware Revision, second part. |
69
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si70xx_measurement_type#
sl_si70xx_measurement_type
Enum for Temperature and Humidity measurement types.
This enumeration defines the types of measurements that can be performed by the Si70xx sensor. It includes options for measuring humidity and temperature, as well as a validation enum.
Enumerator | |
---|---|
SL_HUMIDITY | Enumerator for humidity selection. |
SL_TEMPERATURE | Enumerator for temperature selection. |
SL_LAST_MEASUREMENT | Last enum for validation. |
95
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si70xx_eid_type#
sl_si70xx_eid_type
To specify the type of electronic ID byte to be sent.
This enumeration defines the types of electronic ID bytes that can be sent to the Si70xx sensor. It includes options for sending the first and second bytes of the electronic ID, as well as a validation enum.
Enumerator | |
---|---|
SL_EID_FIRST_BYTE | Enumerator for sending the first byte of the electronic ID. |
SL_EID_SECOND_BYTE | Enumerator for sending the second byte of the electronic ID. |
SL_LAST_EID | Last enum for validation. |
108
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si70xx_registers#
sl_si70xx_registers
To specify the RH/T (Relative Humidity & Temperature) User Register and Heater Control Registers.
This enumeration defines the register types used for configuring the Si70xx sensor. It includes options for the RH/T user register and the heater control register, as well as a validation enum.
Enumerator | |
---|---|
SL_RH_T_USER_REG | Enumerator for RH/T user register selection. |
SL_HEATER_CONTROL_REG | Enumerator for heater control register selection. |
SL_LAST_CONTROL_REG | Last enum for validation. |
121
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
Typedef Documentation#
sl_si70xx_commands_t#
typedef enum sl_si70xx_commands sl_si70xx_commands_t
Enum for Si70xx commands.
This enumeration defines the command codes used to interact with the Si70xx sensor family. These commands are used to measure humidity and temperature, read and write user registers, control the heater, and read the electronic ID and firmware revision.
86
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si70xx_measurement_type_t#
typedef enum sl_si70xx_measurement_type sl_si70xx_measurement_type_t
Enum for Temperature and Humidity measurement types.
This enumeration defines the types of measurements that can be performed by the Si70xx sensor. It includes options for measuring humidity and temperature, as well as a validation enum.
99
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si70xx_eid_type_t#
typedef enum sl_si70xx_eid_type sl_si70xx_eid_type_t
To specify the type of electronic ID byte to be sent.
This enumeration defines the types of electronic ID bytes that can be sent to the Si70xx sensor. It includes options for sending the first and second bytes of the electronic ID, as well as a validation enum.
112
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si70xx_registers_t#
typedef enum sl_si70xx_registers sl_si70xx_registers_t
To specify the RH/T (Relative Humidity & Temperature) User Register and Heater Control Registers.
This enumeration defines the register types used for configuring the Si70xx sensor. It includes options for the RH/T user register and the heater control register, as well as a validation enum.
125
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
Function Documentation#
sl_si91x_si70xx_init#
sl_status_t sl_si91x_si70xx_init (sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_eid_type_t eid)
To initialize the Si70xx sensor.
[in] | i2c_instance | Select the I2C instance from sl_i2c_instance_t. |
[in] | addr | I2C address for Si70xx. |
[in] | eid | Electronic ID of type sl_si70xx_eid_type_t. |
This API initializes the Si70xx sensor and must be called before using other functions.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK (0x0000) - Success.
SL_STATUS_INITIALIZATION (0x0010) - No Si70xx device present.
SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.
For more information on status codes, see SL STATUS DOCUMENTATION.
150
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si91x_si70xx_is_present#
sl_status_t sl_si91x_si70xx_is_present (sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_eid_type_t eid)
To check whether an Si7006/13/20/21 is present on the I2C bus.
[in] | i2c_instance | Select the I2C instance from sl_i2c_instance_t. |
[in] | addr | I2C device address for Si70xx. |
[in] | eid | Electronic ID of type sl_si70xx_eid_type_t. |
This API checks whether an Si7006/13/20/21 sensor is present on the I2C bus based on the provided Electronic ID (EID). If SL_EID_FIRST_BYTE
is selected, the first byte of the EID is considered. If SL_EID_SECOND_BYTE
is selected, the second byte of the EID is considered. For details on EID commands, see the sensor's datasheet. The device ID from SNB_3 is written if the device responds. Pass NULL to discard. Expected values: 0x0D for Si7013, 0x14 for Si7020, or 0x15 for Si7021.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK (0x0000) - Success.
SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.
For more information on status codes, see SL STATUS DOCUMENTATION.
173
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si91x_si70xx_measure_rh_and_temp#
sl_status_t sl_si91x_si70xx_measure_rh_and_temp (sl_i2c_instance_t i2c_instance, uint8_t addr, uint32_t * humid_data, int32_t * temp_data)
To measure relative humidity and temperature from Si7006/13/20/21 sensor.
[in] | i2c_instance | Select the I2C instance from sl_i2c_instance_t. |
[in] | addr | I2C device address for Si70xx. |
[out] | humid_data | The relative humidity in percentage. |
[out] | temp_data | The temperature in degrees Celsius. |
This API is used to measure relative humidity in percentage and temperature in degrees Celsius from the Si70xx sensor. The relative humidity and temperature values are obtained after conversion as per the formula mentioned in the datasheet.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK (0x0000) - Success.
SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
194
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si91x_si70xx_get_firmware_revision#
sl_status_t sl_si91x_si70xx_get_firmware_revision (sl_i2c_instance_t i2c_instance, uint8_t addr, uint8_t * firmware_revision)
To read the firmware revision from the Si7006/13/20/21 sensor.
[in] | i2c_instance | Select the I2C instance from sl_i2c_instance_t. |
[in] | addr | I2C device address for Si70xx. |
[out] | firmware_revision | Pointer to store the internal firmware revision. |
This API reads the firmware revision from the Si70xx sensor. The firmware revision provides information about the internal firmware version of the sensor.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK (0x0000) - Success.
SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
216
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si91x_si70xx_read_temp_from_rh#
sl_status_t sl_si91x_si70xx_read_temp_from_rh (sl_i2c_instance_t i2c_instance, uint8_t addr, uint32_t * humid_data, int32_t * temp_data)
To read the temperature value from the previous relative humidity measurement from the Si7006/13/20/21 sensor.
[in] | i2c_instance | Select the I2C instance from sl_i2c_instance_t. |
[in] | addr | I2C device address for Si70xx. |
[out] | humid_data | The relative humidity in percent. |
[out] | temp_data | The temperature in degrees Celsius. |
This API reads the temperature (in degrees Celsius) from the previous relative humidity measurement (in percent) from the Si70xx sensor.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK (0x0000) - Success.
SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
238
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si91x_si70xx_start_no_hold_measure_rh_or_temp#
sl_status_t sl_si91x_si70xx_start_no_hold_measure_rh_or_temp (sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_measurement_type_t type, uint32_t * data)
To start a no-hold measurement of relative humidity or temperature from the Si7006/13/20/21 sensor.
[in] | i2c_instance | Select the I2C instance from sl_i2c_instance_t. |
[in] | addr | I2C device address for Si70xx. |
[in] | type | Measurement type of sl_si70xx_measurement_type_t. |
[out] | data | The data read from the sensor. |
This API starts a no-hold measurement (not acknowledging read requests) of relative humidity or temperature from the Si70xx sensor. The measurement type is specified by the type
parameter, which can be either relative humidity or temperature.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK (0x0000) - Success.
SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.
For more information on status codes, see SL STATUS DOCUMENTATION.
261
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si91x_si70xx_measure_humidity#
sl_status_t sl_si91x_si70xx_measure_humidity (sl_i2c_instance_t i2c_instance, uint8_t addr, uint32_t * humid_data)
To measure relative humidity from the Si7006/13/20/21 sensor.
[in] | i2c_instance | Select the I2C instance from sl_i2c_instance_t. |
[in] | addr | I2C device address for Si70xx. |
[out] | humid_data | The relative humidity measurement. |
This API is used to measure the relative humidity from the Si70xx sensor. The relative humidity value is returned in the humid_data
parameter.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK (0x0000) - Success.
SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
283
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si91x_si70xx_measure_temperature#
sl_status_t sl_si91x_si70xx_measure_temperature (sl_i2c_instance_t i2c_instance, uint8_t addr, int32_t * temp_data)
To measure temperature from the Si7006/13/20/21 sensor.
[in] | i2c_instance | Select the I2C instance from sl_i2c_instance_t. |
[in] | addr | I2C device address for Si70xx. |
[out] | temp_data | The temperature measurement. |
This API is used to measure the temperature from the Si70xx sensor. The temperature value is returned in the temp_data
parameter.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK (0x0000) - Success.
SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
302
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si91x_si70xx_reset#
sl_status_t sl_si91x_si70xx_reset (sl_i2c_instance_t i2c_instance, uint8_t addr)
To initiate a software reset for the Si70xx sensor.
[in] | i2c_instance | Select the I2C instance from sl_i2c_instance_t. |
[in] | addr | I2C device address for Si70xx. |
This API initiates a software reset for the Si70xx sensor using the appropriate command. It is used to reset the sensor to its default state.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK (0x0000) - Success.
SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.
For more information on status codes, see SL STATUS DOCUMENTATION.
320
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si91x_si70xx_read_control_register#
sl_status_t sl_si91x_si70xx_read_control_register (sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_registers_t reg, uint8_t * data)
To read the RH/T user register and heater control register data from the Si70xx sensor.
[in] | i2c_instance | Select the I2C instance from sl_i2c_instance_t. |
[in] | addr | I2C device address for Si70xx. |
[in] | reg | Register of type sl_si70xx_registers_t. |
[out] | data | The data read from the sensor. |
This API reads the RH/T user register and heater control register data from the Si70xx sensor. The register to be read is specified by the reg
parameter, which can be either the RH/T user register or the heater control register.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK (0x0000) - Success.
SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
341
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
sl_si91x_si70xx_write_control_register#
sl_status_t sl_si91x_si70xx_write_control_register (sl_i2c_instance_t i2c_instance, uint8_t addr, sl_si70xx_registers_t reg, uint8_t value)
To write data to RH/T user register and heater control register.
[in] | i2c_instance | Select the I2C instance from sl_i2c_instance_t. |
[in] | addr | I2C device address for Si70xx. |
[in] | reg | Register of type sl_si70xx_registers_t. |
[in] | value | The value to be written into the register. |
This API is used to write data to the RH/T user register and heater control register of the Si70xx sensor. The register to be written is specified by the reg
parameter, which can be either the RH/T user register or the heater control register.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK (0x0000) - Success.
SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.
For more information on status codes, see SL STATUS DOCUMENTATION.
364
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
Macro Definition Documentation#
SI7006_ADDR#
#define SI7006_ADDRValue:
0X40
I2C device address for Si7006.
52
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
SI7013_ADDR#
#define SI7013_ADDRValue:
0x41
I2C device address for Si7013.
53
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
SI7020_ADDR#
#define SI7020_ADDRValue:
0X40
I2C device address for Si7020.
54
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
SI7021_ADDR#
#define SI7021_ADDRValue:
0x40
I2C device address for Si7021.
55
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h
I2C_BASE#
#define I2C_BASEValue:
I2C2
I2C2 base.
56
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/si70xx_sensor/inc/sl_si91x_si70xx.h