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

Detailed Description

Files

file  si70xx.h
 Interface definition of the Si70xx driver.
 

Data Structures

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

Functions

int si70xx_test (si70xx_t *dev)
 Test if the device id and revision number are as expected. More...
 
int si70xx_init (si70xx_t *dev, i2c_t i2c_dev, uint8_t address)
 Initialize and reset the sensor. More...
 
uint16_t si70xx_get_relative_humidity (si70xx_t *dev)
 Read the relative humidity from the sensor. More...
 
int16_t si70xx_get_temperature (si70xx_t *dev)
 Read the current temperature from the sensor. More...
 
void si70xx_get_both (si70xx_t *dev, uint16_t *humidity, int16_t *temperature)
 Read the relative humidity and temperature from the sensor. More...
 
uint64_t si70xx_get_serial (si70xx_t *dev)
 Read the sensor serial number. More...
 
uint8_t si70xx_get_id (si70xx_t *dev)
 Read the sensor id, to identifier the sensor variant. More...
 
uint8_t si70xx_get_revision (si70xx_t *dev)
 Read the firmware revision of the sensor. More...
 

Si70xx chip addresses.

#define SI70XX_ADDRESS_SI7006   (0x80)
 
#define SI70XX_ADDRESS_SI7013   (0x80)
 
#define SI70XX_ADDRESS_SI7013_ALT   (0x81)
 
#define SI70XX_ADDRESS_SI7020   (0x80)
 
#define SI70XX_ADDRESS_SI7021   (0x80)
 

Si70xx device commands.

#define SI70XX_MEASURE_RH_HOLD   (0xE5)
 
#define SI70XX_MEASURE_RH   (0xF5)
 
#define SI70XX_MEASURE_TEMP_HOLD   (0xE3)
 
#define SI70XX_MEASURE_TEMP   (0xF3)
 
#define SI70XX_MEASURE_TEMP_PREV   (0xE0)
 
#define SI70XX_RESET   (0xFE)
 
#define SI70XX_WRITE_USER_REG   (0xE6)
 
#define SI70XX_READ_USER_REG   (0xE7)
 
#define SI70XX_WRITE_HEATER_REG   (0x51)
 
#define SI70XX_READ_HEATER_REG   (0x11)
 
#define SI70XX_READ_ID_FIRST_A   (0xFA)
 
#define SI70XX_READ_ID_FIRST_B   (0x0F)
 
#define SI70XX_READ_ID_SECOND_A   (0xFC)
 
#define SI70XX_READ_ID_SECOND_B   (0xC9)
 
#define SI70XX_READ_REVISION_A   (0x84)
 
#define SI70XX_READ_REVISION_B   (0xB8)
 

Si70xx register values.

#define SI70XX_ID_SI7006   (0x06)
 
#define SI70XX_ID_SI7013   (0x0D)
 
#define SI70XX_ID_SI7020   (0x14)
 
#define SI70XX_ID_SI7021   (0x15)
 
#define SI70XX_REVISION_1   (0xFF)
 
#define SI70XX_REVISION_2   (0x20)
 

Function Documentation

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

Uses clock stretching.

Parameters
[in]devdevice descriptor
[out]humiditypointer to relative humidity (in centi-percent)
[out]temperaturepointer to temperature (in centi-degrees Celsius)
uint8_t si70xx_get_id ( si70xx_t dev)
Parameters
[in]devdevice descriptor
Returns
device id
uint16_t si70xx_get_relative_humidity ( si70xx_t dev)

Uses clock streching.

Parameters
[in]devdevice descriptor
Returns
relative humidity in centi-percent (times 100)
uint8_t si70xx_get_revision ( si70xx_t dev)
Parameters
[in]devdevice descriptor
Returns
sensor firmware revision number
uint64_t si70xx_get_serial ( si70xx_t dev)
Parameters
[in]devdevice descriptor
Returns
sensor serial number
int16_t si70xx_get_temperature ( si70xx_t dev)

Uses clock streching.

Parameters
[in]devdevice descriptor
Returns
current temperature in centi-degrees Celsius (times 100)
int si70xx_init ( si70xx_t dev,
i2c_t  i2c_dev,
uint8_t  address 
)
Parameters
[in]devdevice descriptor
[in]i2c_devi2c device to use
[in]addressdevice address (depends on the chip)
Returns
zero on succesful initialization.
non-zero on error
int si70xx_test ( si70xx_t dev)
Parameters
[in]devdevice descriptor
Returns
zero on succesful test
non-zero on unsuccesfull test.