diff options
-rw-r--r-- | include/driver/ccs811.h | 1 | ||||
-rw-r--r-- | src/driver/ccs811.cc | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/driver/ccs811.h b/include/driver/ccs811.h index 8be0e6e..98ef42b 100644 --- a/include/driver/ccs811.h +++ b/include/driver/ccs811.h @@ -31,6 +31,7 @@ class CCS811 { void setMode(unsigned char mode); void read(); void setEnv(unsigned char humi, unsigned char humi_fraction, unsigned char temp, unsigned char temp_fraction); + void setEnv(float humi, float temp); void reset(); }; diff --git a/src/driver/ccs811.cc b/src/driver/ccs811.cc index 66c238a..531dadb 100644 --- a/src/driver/ccs811.cc +++ b/src/driver/ccs811.cc @@ -65,6 +65,11 @@ void CCS811::setEnv(unsigned char humi, unsigned char humi_fraction, unsigned ch i2c.xmit(address, 5, txbuf, 0, rxbuf); } +void CCS811::setEnv(float humi, float temp) +{ + setEnv(humi * 2, 0, (temp - 25) * 2, 0); +} + unsigned char CCS811::getStatus() { txbuf[0] = 0x00; |