COSA
An Object-Oriented Platform for Arduino Programming
Si70XX Class Reference

#include <Si70XX.hh>

Inheritance diagram for Si70XX:
Inheritance graph
Collaboration diagram for Si70XX:
Collaboration graph

Public Member Functions

 Si70XX ()
 
bool read_user_register (uint8_t &reg)
 
bool read_electronic_serial_number (uint8_t snr[8])
 
bool read_firmware_revision (uint8_t &rev)
 
bool measure_humidity ()
 
float read_humidity ()
 
float read_humidity_temperature ()
 
bool measure_temperature ()
 
float read_temperature ()
 

Protected Types

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 = 0xFA0F, READ_ID_2 = 0xFCC8, READ_REV = 0x84B8
}
 

Protected Member Functions

bool issue (uint8_t cmd)
 
bool read (uint16_t &value, bool check=true)
 
bool read (uint8_t cmd, uint8_t &value)
 

Private Member Functions

bool is_async () const
 
void sync_request ()
 
void async_request ()
 
virtual void on_completion (uint8_t type, int count)
 

Private Attributes

uint8_t m_addr
 
bool m_async
 

Detailed Description

Cosa TWI 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

  1. http://www.silabs.com/products/sensors/humidity-sensors/Pages/si7013-20-21.aspx
  2. https://www.silabs.com/Support%20Documents/TechnicalDocs/Si7020-A20.pdf, Rev. 1.1 6/15.

Definition at line 49 of file Si70XX.hh.

Member Enumeration Documentation

enum Si70XX::Command
protected

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 145 of file Si70XX.hh.

Constructor & Destructor Documentation

Si70XX::Si70XX ( )
inline

Create device driver instance.

Definition at line 54 of file Si70XX.hh.

Member Function Documentation

bool Si70XX::issue ( uint8_t  cmd)
protected

Issue given command. Return true(1) if successful otherwise false(0).

Parameters
[in]cmdcommand.
Returns
bool.

Definition at line 35 of file Si70XX.cpp.

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 88 of file Si70XX.hh.

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 124 of file Si70XX.hh.

bool Si70XX::read ( uint16_t &  value,
bool  check = true 
)
protected

Read 16-bit value after issued command. Return true(1) if successful otherwise false(0).

Parameters
[out]valueregister value.
[in]checkcrc value (default true).
Returns
bool.

Definition at line 46 of file Si70XX.cpp.

bool Si70XX::read ( uint8_t  cmd,
uint8_t &  value 
)
protected

Read 8-bit register value given command. Return true(1) if successful otherwise false(0).

Parameters
[in]cmdcommand.
[out]valueregister value.
Returns
bool.

Definition at line 72 of file Si70XX.cpp.

bool Si70XX::read_electronic_serial_number ( uint8_t  snr[8])

Read electronic serial number, Return true(1) if successful otherwise false(0).

Parameters
[out]snrserial number register (64-bits).
Returns
bool.

Definition at line 87 of file Si70XX.cpp.

bool Si70XX::read_firmware_revision ( uint8_t &  rev)

Read firmware revision, Return true(1) if successful otherwise false(0).

Parameters
[out]revrevision code.
Returns
bool.

Definition at line 135 of file Si70XX.cpp.

float Si70XX::read_humidity ( )
inline

Read humidity value after issued measurement, Return relativ humidity.

Returns
relative humidity.

Definition at line 98 of file Si70XX.hh.

float Si70XX::read_humidity_temperature ( )
inline

Read temperature from humidity measurement, Return temperature in Celcius.

Returns
temperature.

Definition at line 110 of file Si70XX.hh.

float Si70XX::read_temperature ( )
inline

Read temperature from issued measurement, Return temperature in Celcius.

Returns
temperature.

Definition at line 134 of file Si70XX.hh.

bool Si70XX::read_user_register ( uint8_t &  reg)
inline

Read configuration register, Return true(1) if successful otherwise false(0).

Parameters
[out]regvalue.
Returns
bool.

Definition at line 62 of file Si70XX.hh.


The documentation for this class was generated from the following files: