117 *rhData = ( (uint32_t) readData[0] << 8 ) + ( readData[1] & 0xfc );
118 *rhData = ( ( ( *rhData ) * 15625L ) >> 13 ) - 6000;
140 *tData = ( (uint32_t) readData[0] << 8 ) + ( readData[1] & 0xfc );
141 *tData = ( ( ( *tData ) * 21965L ) >> 13 ) - 46850;
188 uint32_t
SI7021_cmdRead( uint8_t *cmd,
size_t cmdLen, uint8_t *result,
size_t resultLen )
203 seq.
buf[1].
len = resultLen;
210 seq.
buf[0].
len = resultLen;
247 uint32_t
SI7021_cmdWrite( uint8_t *cmd,
size_t cmdLen, uint8_t *data,
size_t dataLen )
Driver for the Si7021 I2C Humidity and Temperature Sensor.
#define SI7021_CMD_MEASURE_RH_NO_HOLD
I2C_TransferReturn_TypeDef I2CSPM_Transfer(I2C_TypeDef *i2c, I2C_TransferSeq_TypeDef *seq)
Perform I2C transfer.
#define I2C_FLAG_READ
Indicate plain read sequence: S+ADDR(R)+DATA0+P.
void UTIL_delay(uint32_t ms)
Delays number of msTick Systicks (1 ms)
#define SI7021_ERROR_TIMEOUT
#define SI7021_ERROR_INVALID_DEVICE_ID
#define I2C_FLAG_WRITE
Indicate plain write sequence: S+ADDR(W)+DATA0+P.
I2C_TransferReturn_TypeDef
uint32_t BOARD_envSensEnable(bool enable)
Enables or disables the environmental sensor group (Pressure, RH/Temp, UV/Ambient light and Hall sens...
uint32_t SI7021_getFwRev(uint8_t *fwRev)
Reads the firmware revision of the Si7021 chip.
I2C simple poll-based master mode driver for the DK/STK.
#define SI7021_CMD_READ_ID_BYTE2
#define SI7021_ERROR_I2C_TRANSFER_NACK
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.
Utility Functions for the Thunderboard Sense.
struct I2C_TransferSeq_TypeDef::@0 buf[2]
Master mode transfer message structure used to define a complete I2C transfer sequence (from start to...
#define SI7021_I2C_DEVICE
#define SI7021_I2C_BUS_ADDRESS
uint32_t SI7021_measure(uint32_t *rhData, int32_t *tData)
Performs relative humidity and temperature measurements.
uint32_t SI7021_init(void)
Initializes the Si7021 chip.
#define I2C_FLAG_WRITE_WRITE
Indicate write sequence using two buffers: S+ADDR(W)+DATA0+DATA1+P.
#define SI7021_CMD_READ_FW_REV
#define I2C_FLAG_WRITE_READ
Indicate combined write/read sequence: S+ADDR(W)+DATA0+Sr+ADDR(R)+DATA1+P.
uint16_t addr
Address to use after (repeated) start.
BOARD module header file.
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.
#define SI7021_CMD_READ_TEMP
void SI7021_deInit(void)
De-initializes the Si7021 chip. Disables the sensor power domain, this also disables other sensors...
#define SI7021_ERROR_I2C_TRANSFER_FAILED