EFM32 Happy Gecko Software Documentation
efm32hg-doc-5.1.2
|
Si7021 driver and support functions.
Functions | |
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. More... | |
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. More... | |
void | SI7021_deInit (void) |
De-initializes the Si7021 chip. Disables the sensor power domain, this also disables other sensors. More... | |
uint32_t | SI7021_getFwRev (uint8_t *fwRev) |
Reads the firmware revision of the Si7021 chip. More... | |
uint32_t | SI7021_init (void) |
Initializes the Si7021 chip. More... | |
uint32_t | SI7021_measure (uint32_t *rhData, int32_t *tData) |
Performs relative humidity and temperature measurements. More... | |
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.
[in] | cmd | The command to be sent |
[in] | cmdLen | The length of the command in bytes |
[out] | result | The received bytes sent by the chip |
[in] | resultLen | The number of the bytes to read from the chip |
Definition at line 188 of file si7021.c.
References I2C_TransferSeq_TypeDef::addr, I2C_TransferSeq_TypeDef::buf, I2C_TransferSeq_TypeDef::data, I2C_TransferSeq_TypeDef::flags, I2C_FLAG_READ, I2C_FLAG_WRITE_READ, I2CSPM_Transfer(), i2cTransferDone, i2cTransferNack, I2C_TransferSeq_TypeDef::len, SI7021_ERROR_I2C_TRANSFER_FAILED, SI7021_ERROR_I2C_TRANSFER_NACK, SI7021_I2C_BUS_ADDRESS, SI7021_I2C_DEVICE, and SI7021_OK.
Referenced by SI7021_getFwRev(), SI7021_init(), and SI7021_measure().
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.
[in] | cmd | The command to be sent |
[in] | cmdLen | The length of the command in bytes |
[out] | data | The data byte(s) to be sent to the chip |
[in] | dataLen | The number of the bytes to be sent to the chip |
Definition at line 247 of file si7021.c.
References I2C_TransferSeq_TypeDef::addr, I2C_TransferSeq_TypeDef::buf, I2C_TransferSeq_TypeDef::data, I2C_TransferSeq_TypeDef::flags, I2C_FLAG_WRITE, I2C_FLAG_WRITE_WRITE, I2CSPM_Transfer(), i2cTransferDone, i2cTransferNack, I2C_TransferSeq_TypeDef::len, SI7021_ERROR_I2C_TRANSFER_FAILED, SI7021_ERROR_I2C_TRANSFER_NACK, SI7021_I2C_BUS_ADDRESS, SI7021_I2C_DEVICE, and SI7021_OK.
Referenced by measureSupplyIR(), and SI7021_measure().
void SI7021_deInit | ( | void | ) |
De-initializes the Si7021 chip. Disables the sensor power domain, this also disables other sensors.
Definition at line 74 of file si7021.c.
Referenced by UTIL_supplyProbe().
uint32_t SI7021_getFwRev | ( | uint8_t * | fwRev | ) |
Reads the firmware revision of the Si7021 chip.
[out] | fwRev | The firmware revision of the chip |
Definition at line 157 of file si7021.c.
References SI7021_CMD_READ_FW_REV, and SI7021_cmdRead().
uint32_t SI7021_init | ( | void | ) |
Initializes the Si7021 chip.
Definition at line 41 of file si7021.c.
References BOARD_envSensEnable(), SI7021_CMD_READ_ID_BYTE2, SI7021_cmdRead(), SI7021_DEVICE_ID, SI7021_ERROR_INVALID_DEVICE_ID, SI7021_OK, and UTIL_delay().
Referenced by UTIL_supplyProbe().
uint32_t SI7021_measure | ( | uint32_t * | rhData, |
int32_t * | tData | ||
) |
Performs relative humidity and temperature measurements.
[out] | rhData | The measured relative humidity value in milli-percent units |
[out] | tData | The measured temperature value in milli-degree Celsius |
Definition at line 94 of file si7021.c.
References SI7021_CMD_MEASURE_RH_NO_HOLD, SI7021_CMD_READ_TEMP, SI7021_cmdRead(), SI7021_cmdWrite(), SI7021_ERROR_I2C_TRANSFER_NACK, SI7021_ERROR_TIMEOUT, SI7021_OK, and UTIL_delay().