21 #include "si7021_config.h"
34 #ifndef SI7021_CONFIG_I2C_DEVICE
35 #define SI7021_CONFIG_I2C_DEVICE (I2C0)
38 #ifndef SI7021_CONFIG_I2C_BUS_ADDRESS
39 #define SI7021_CONFIG_I2C_BUS_ADDRESS 0x40
42 #ifndef SI7021_CONFIG_DEVICE_ID
43 #define SI7021_CONFIG_DEVICE_ID 0x21
46 #define SI7021_I2C_DEVICE SI7021_CONFIG_I2C_DEVICE
47 #define SI7021_I2C_BUS_ADDRESS SI7021_CONFIG_I2C_BUS_ADDRESS
48 #define SI7021_DEVICE_ID SI7021_CONFIG_DEVICE_ID
59 #define SI7021_ERROR_I2C_TRANSFER_NACK 0x0001
60 #define SI7021_ERROR_I2C_TRANSFER_FAILED 0x0002
61 #define SI7021_ERROR_INVALID_DEVICE_ID 0x0003
62 #define SI7021_ERROR_TIMEOUT 0x0004
72 #define SI7021_CMD_MEASURE_RH 0xE5
73 #define SI7021_CMD_MEASURE_RH_NO_HOLD 0xF5
74 #define SI7021_CMD_MEASURE_TEMP 0xE3
75 #define SI7021_CMD_MEASURE_TEMP_NO_HOLD 0xF3
76 #define SI7021_CMD_READ_TEMP 0xE0
77 #define SI7021_CMD_RESET 0xFE
78 #define SI7021_CMD_WRITE_USER_REG1 0xE6
79 #define SI7021_CMD_READ_USER_REG1 0xE7
80 #define SI7021_CMD_WRITE_HEATER_CTRL 0x51
81 #define SI7021_CMD_READ_HEATER_CTRL 0x11
82 #define SI7021_CMD_READ_ID_BYTE1 {0xFA, 0x0F}
83 #define SI7021_CMD_READ_ID_BYTE2 {0xFC, 0xC9}
84 #define SI7021_CMD_READ_FW_REV {0x84, 0xB8}
94 uint32_t SI7021_init ( void );
99 uint32_t
SI7021_cmdWrite ( uint8_t *cmd,
size_t cmdLen, uint8_t *data,
size_t dataLen );
100 uint32_t
SI7021_cmdRead ( uint8_t *cmd,
size_t cmdLen, uint8_t *result,
size_t resultLen );
uint32_t SI7021_getFwRev(uint8_t *fwRev)
Reads the firmware revision of the Si7021 chip.
uint32_t SI7021_cmdWrite(uint8_t *cmd, size_t cmdLen, uint8_t *data, size_t dataLen)
Sends a command and data to the chip over the I2C bus.
uint32_t SI7021_measure(uint32_t *rhData, int32_t *tData)
Performs relative humidity and temperature measurements.
uint32_t SI7021_cmdRead(uint8_t *cmd, size_t cmdLen, uint8_t *result, size_t resultLen)
Sends a command and reads the result byte(s) over the I2C bus.
void SI7021_deInit(void)
De-initializes the Si7021 chip. Disables the sensor power domain, this also disables other sensors...