#include <Si70XX.h>
|
enum | Command {
MEASURE_RH_HOLD = 0xE5,
MEASURE_RH_NO_HOLD = 0xF5,
MEASURE_TEMP_HOLD = 0xE3,
MEASURE_TEMP_NO_HOLD = 0xF3,
READ_RH_TEMP = 0xE0,
RESET = 0xFE,
WRITE_RHT_USER_REG_1 = 0xE6,
READ_RHT_USER_REG_1 = 0xE7,
READ_ID_1 = 0x0FFA,
READ_ID_2 = 0xC8FC,
READ_REV = 0xB884
} |
|
|
bool | issue (uint8_t cmd) |
|
bool | read (uint16_t &value, bool check=true) |
|
bool | read (uint8_t cmd, uint8_t &value) |
|
bool | acquire () |
|
bool | release () |
|
int | read (void *buf, size_t count) |
|
int | write (const void *buf, size_t count) |
|
int | write (iovec_t *vp) |
|
|
static uint8_t | crc_update (uint8_t crc, uint8_t data) |
|
Device Driver for Silicon Labs, Si70XX I2C Humidity and Temperature Sensor. The device driver does not block on measurements.
Circuit
The GY-21 module with pull-up resistors for TWI signals and 3V3 internal voltage converter.
GY-21
+------------+
(VCC)---------------1-|VIN ( ) |
(VCC)---------------2-|GND |
(A5/SCL)------------3-|SCL |
(A4/SDA)------------4-|SDA |
+------------+
References
- http://www.silabs.com/products/sensors/humidity-sensors/Pages/si7013-20-21.aspx
- https://www.silabs.com/Support%20Documents/TechnicalDocs/Si7020-A20.pdf, Rev. 1.1 6/15.
Definition at line 51 of file Si70XX.h.
I2C Command Table (See tab. 11, pp. 19).
Enumerator |
---|
MEASURE_RH_HOLD |
Measure Relative Humidity, Hold Master Mode.
|
MEASURE_RH_NO_HOLD |
Dito, No Hold Master Mode.
|
MEASURE_TEMP_HOLD |
Measure Temperature, Hold Master Mode.
|
MEASURE_TEMP_NO_HOLD |
Dito, No Hold Master Mode.
|
READ_RH_TEMP |
Read Temperature from RH Measurement.
|
RESET |
Reset.
|
WRITE_RHT_USER_REG_1 |
Write RH/T User Register 1.
|
READ_RHT_USER_REG_1 |
Read RH/T User Register 1.
|
READ_ID_1 |
Read Electronic ID 1.
|
READ_ID_2 |
Read Electronic ID 2.
|
READ_REV |
Read Firmware Revision.
|
Definition at line 201 of file Si70XX.h.
Si70XX::Si70XX |
( |
TWI & |
twi | ) |
|
|
inline |
Create device driver instance.
Definition at line 56 of file Si70XX.h.
bool TWI::Device::acquire |
( |
| ) |
|
|
inlineinherited |
Start transaction. Return true(1) if successful otherwise false(0).
- Returns
- bool.
Definition at line 52 of file TWI.h.
static uint8_t Si70XX::crc_update |
( |
uint8_t |
crc, |
|
|
uint8_t |
data |
|
) |
| |
|
inlinestaticprotected |
bool Si70XX::issue |
( |
uint8_t |
cmd | ) |
|
|
inlineprotected |
Issue given command. Return true(1) if successful otherwise false(0).
- Parameters
-
- Returns
- bool.
Definition at line 220 of file Si70XX.h.
bool Si70XX::measure_humidity |
( |
| ) |
|
|
inline |
Issue a humidity measurement. Call read_humidity() for result of measurement. Return true(1) if successful otherwise false(0).
- Returns
- bool.
Definition at line 144 of file Si70XX.h.
bool Si70XX::measure_temperature |
( |
| ) |
|
|
inline |
Issue a temperature measurement. Call read_temperature() for result of measurement. Return true(1) if successful otherwise false(0).
- Returns
- bool.
Definition at line 180 of file Si70XX.h.
int TWI::Device::read |
( |
void * |
buf, |
|
|
size_t |
count |
|
) |
| |
|
inlineinherited |
Read data from device to given buffer.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | count | buffer size in bytes. |
- Returns
- number of bytes read or negative error code.
Definition at line 73 of file TWI.h.
bool Si70XX::read |
( |
uint16_t & |
value, |
|
|
bool |
check = true |
|
) |
| |
|
inlineprotected |
Read 16-bit value after issued command. Return true(1) if successful otherwise false(0).
- Parameters
-
[out] | value | register value. |
[in] | check | crc value (default true). |
- Returns
- bool.
Definition at line 235 of file Si70XX.h.
bool Si70XX::read |
( |
uint8_t |
cmd, |
|
|
uint8_t & |
value |
|
) |
| |
|
inlineprotected |
Read 8-bit register value given command. Return true(1) if successful otherwise false(0).
- Parameters
-
[in] | cmd | command. |
[out] | value | register value. |
- Returns
- bool.
Definition at line 266 of file Si70XX.h.
bool Si70XX::read_electronic_serial_number |
( |
uint8_t |
snr[8] | ) |
|
|
inline |
Read electronic serial number, Return true(1) if successful otherwise false(0).
- Parameters
-
[out] | snr | serial number register (64-bits). |
- Returns
- bool.
Definition at line 77 of file Si70XX.h.
bool Si70XX::read_firmware_revision |
( |
uint8_t & |
rev | ) |
|
|
inline |
Read firmware revision, Return true(1) if successful otherwise false(0).
- Parameters
-
- Returns
- bool.
Definition at line 128 of file Si70XX.h.
float Si70XX::read_humidity |
( |
| ) |
|
|
inline |
Read humidity value after issued measurement, Return relativ humidity.
- Returns
- relative humidity.
Definition at line 154 of file Si70XX.h.
float Si70XX::read_humidity_temperature |
( |
| ) |
|
|
inline |
Read temperature from humidity measurement, Return temperature in Celcius.
- Returns
- temperature.
Definition at line 166 of file Si70XX.h.
float Si70XX::read_temperature |
( |
| ) |
|
|
inline |
Read temperature from issued measurement, Return temperature in Celcius.
- Returns
- temperature.
Definition at line 190 of file Si70XX.h.
bool Si70XX::read_user_register |
( |
uint8_t & |
reg | ) |
|
|
inline |
Read configuration register, Return true(1) if successful otherwise false(0).
- Parameters
-
- Returns
- bool.
Definition at line 66 of file Si70XX.h.
bool TWI::Device::release |
( |
| ) |
|
|
inlineinherited |
Stop transaction. Return true(1) if successful otherwise false(0).
- Returns
- bool.
Definition at line 62 of file TWI.h.
int TWI::Device::write |
( |
const void * |
buf, |
|
|
size_t |
count |
|
) |
| |
|
inlineinherited |
Write data from the given buffer to device.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | count | buffer size in bytes. |
- Returns
- number of bytes written or negative error code.
Definition at line 84 of file TWI.h.
int TWI::Device::write |
( |
iovec_t * |
vp | ) |
|
|
inlineinherited |
Write data to device with from given io vector.
- Parameters
-
- Returns
- number of bytes written or negative error code.
Definition at line 94 of file TWI.h.
uint8_t TWI::Device::m_addr |
|
protectedinherited |
Two-Wire Interface Manager.
Definition at line 101 of file TWI.h.
The documentation for this class was generated from the following file: