An ESP-IDF component for the Silicon Labs Si7021-A20 Relative Humidity and Temperature Sensor with I2C Interface.
The following features have been implemented:
- Measure Relative Humidity
- Measure Temperature
- Read and Write Registers
- Read the Electronic Serial Number
- Read the Firmware Revision
- Perform a software reset of the sensor
This component requires the ESP-IDF IoT Development Environment as well as the C99 Standard Library, and has no other external dependencies.
TODO: provide an example
struct si7021_reading
{
float humidity;
float temperature;
};
esp_err_t readHumidity(const i2c_port_t i2c_num, float *humidity);
esp_err_t readTemperature(const i2c_port_t i2c_num, float *temperature);
esp_err_t readTemperatureAfterHumidity(const i2c_port_t i2c_num,
float *temperature);
esp_err_t readSensors(const i2c_port_t i2c_num,
struct si7021_reading *sensor_data);
esp_err_t readSerialNumber(const i2c_port_t i2c_num, uint8_t *serial);
esp_err_t readFirmwareRevision(const i2c_port_t i2c_num, uint8_t *revision);
esp_err_t readRegister(const i2c_port_t i2c_num, const uint8_t command,
uint8_t *settings);
esp_err_t writeRegister(const i2c_port_t i2c_num, const uint8_t command,
const uint8_t settings);
esp_err_t softwareReset(const i2c_port_t i2c_num);
- implement all features documented in the datasheet
- acknowledge the fact that checksums are, in fact, a thing
- implement an easier method of manipulating the user and heater control registers
- user register - measurement resolution
- user register - vdd status
- user register - heater status
- heater control register - heater current
- properly comment header and source files
- provide example application
- write documentation