diff --git a/include/driver/ccs811.h b/include/driver/ccs811.h index 8be0e6e45bd837a9f59264b01d5c3bb1fb9fd6b5..98ef42b2acb1c63dfde51331665b7de63f30cd7c 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 66c238aa1c3b11218950cc16d171abde03f71502..531dadb2f1c1eb253bfaa5027b6b27b2e0dfc70b 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;