Loading...
Searching...
No Matches
Si7006/13/20/21/5x temperature and humidity sensors

Driver for the Si7006/13/20/21/5x temperature and humidity sensor. More...

Detailed Description

Driver for the Si7006/13/20/21/5x temperature and humidity sensor.

The Si70xx driver supports a range of similar temperature and humidity sensors from Silicon Labs.

The Si7006/13/20/21 sensors support both temperature and relative humidity reading, while the Si7050/1/3/4/5 sensors only provide a temperature reading varying in accuracy between +/- 0.1 C to +/- 1.0 C depending on the model.

For any of the Si705x models, use the pseudo module si705x.

This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.

Files

file  si70xx.h
 Interface definition of the Si70xx driver.
 
file  si70xx_internals.h
 Internal definitions for Si7006/13/20/21.
 
file  si70xx_params.h
 Default configuration for Si7006/13/20/21.
 

Data Structures

struct  si70xx_params_t
 Device initialization parameters. More...
 
struct  si70xx_t
 Si70xx device descriptor. More...
 

Macros

#define SI70XX_HAS_HUMIDITY_SENSOR   1
 Compile time macro telling whether the chip has a humidity sensor.
 

Enumerations

enum  { SI70XX_OK , SI70XX_ERR_NODEV , SI70XX_ERR_I2C }
 Driver return codes. More...
 

Functions

int si70xx_init (si70xx_t *dev, const si70xx_params_t *params)
 Initialize and reset the sensor.
 
uint16_t si70xx_get_relative_humidity (const si70xx_t *dev)
 Read the relative humidity from the sensor.
 
int16_t si70xx_get_temperature (const si70xx_t *dev)
 Read the current temperature from the sensor.
 
void si70xx_get_both (const si70xx_t *dev, uint16_t *humidity, int16_t *temperature)
 Read the relative humidity and temperature from the sensor.
 
uint64_t si70xx_get_serial (const si70xx_t *dev)
 Read the sensor serial number.
 
uint8_t si70xx_get_id (const si70xx_t *dev)
 Read the sensor id, to identifier the sensor variant.
 
uint8_t si70xx_get_revision (const si70xx_t *dev)
 Read the firmware revision of the sensor.
 

Macro Definition Documentation

◆ SI70XX_HAS_HUMIDITY_SENSOR

#define SI70XX_HAS_HUMIDITY_SENSOR   1

Compile time macro telling whether the chip has a humidity sensor.

Definition at line 50 of file si70xx.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Driver return codes.

Enumerator
SI70XX_OK 

All OK.

SI70XX_ERR_NODEV 

No valid device found on I2C bus.

SI70XX_ERR_I2C 

An error occurred when reading/writing on I2C bus.

Definition at line 56 of file si70xx.h.

Function Documentation

◆ si70xx_get_both()

void si70xx_get_both ( const si70xx_t dev,
uint16_t *  humidity,
int16_t *  temperature 
)

Read the relative humidity and temperature from the sensor.

Uses clock stretching.

This function is only available in models that have a humidity sensor.

Parameters
[in]devdevice descriptor
[out]humiditypointer to relative humidity (in centi-percent)
[out]temperaturepointer to temperature (in centi-degrees Celsius)

◆ si70xx_get_id()

uint8_t si70xx_get_id ( const si70xx_t dev)

Read the sensor id, to identifier the sensor variant.

Parameters
[in]devdevice descriptor
Returns
device id

◆ si70xx_get_relative_humidity()

uint16_t si70xx_get_relative_humidity ( const si70xx_t dev)

Read the relative humidity from the sensor.

Uses clock stretching.

This function is only available in models that have a humidity sensor.

Parameters
[in]devdevice descriptor
Returns
relative humidity in centi-percent (times 100)

◆ si70xx_get_revision()

uint8_t si70xx_get_revision ( const si70xx_t dev)

Read the firmware revision of the sensor.

Parameters
[in]devdevice descriptor
Returns
sensor firmware revision number

◆ si70xx_get_serial()

uint64_t si70xx_get_serial ( const si70xx_t dev)

Read the sensor serial number.

Parameters
[in]devdevice descriptor
Returns
sensor serial number

◆ si70xx_get_temperature()

int16_t si70xx_get_temperature ( const si70xx_t dev)

Read the current temperature from the sensor.

Uses clock stretching.

Parameters
[in]devdevice descriptor
Returns
current temperature in centi-degrees Celsius (times 100)

◆ si70xx_init()

int si70xx_init ( si70xx_t dev,
const si70xx_params_t params 
)

Initialize and reset the sensor.

Parameters
[in]devdevice descriptor
[in]paramsinitialization parameters
Returns
SI70XX_OK on successful initialization
-SI70XX_ERR_NOI2C on I2C initialization error
-SI70XX_ERR_NODEV on device test error
-SI70XX_ERR_I2C on I2C bus error