Si7006/13/20/21 temperature and humidity sensors

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

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

enum @157
SI70XX_OK
All OK.
SI70XX_ERR_NODEV
No valid device found on I2C bus.
SI70XX_ERR_I2C
An error occured when reading/writing on I2C bus.
int si70xx_init(si70xx_t * dev, const si70xx_params_t * params)

Initialize and reset the sensor.

Parameters

dev:device descriptor
params:initialization parameters

Return values

  • 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
uint16_t si70xx_get_relative_humidity(const si70xx_t * dev)

Read the relative humidity from the sensor.

Uses clock streching.

Parameters

dev:device descriptor

Return values

  • relative humidity in centi-percent (times 100)
int16_t si70xx_get_temperature(const si70xx_t * dev)

Read the current temperature from the sensor.

Uses clock streching.

Parameters

dev:device descriptor

Return values

  • current temperature in centi-degrees Celsius (times 100)
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.

Parameters

dev:device descriptor
humidity:pointer to relative humidity (in centi-percent)
temperature:pointer to temperature (in centi-degrees Celsius)

uint64_t si70xx_get_serial(const si70xx_t * dev)

Read the sensor serial number.

Parameters

dev:device descriptor

Return values

  • sensor serial number
uint8_t si70xx_get_id(const si70xx_t * dev)

Read the sensor id, to identifier the sensor variant.

Parameters

dev:device descriptor

Return values

  • device id
uint8_t si70xx_get_revision(const si70xx_t * dev)

Read the firmware revision of the sensor.

Parameters

dev:device descriptor

Return values

  • sensor firmware revision number
struct si70xx_params_t

Device initialization parameters.

i2c.h::i2c_t i2c_dev

I2C bus the sensor is connected to.

uint8_t address

sensor address

struct si70xx_t

Si70xx device descriptor.

si70xx_params_t params

Device parameters.