diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-02-14 21:42:26 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-02-14 21:43:32 +0100 |
commit | cf97c18554b9aa88202b9d2463ee08cafd1252b0 (patch) | |
tree | d29c3004f678df32f4e0bc8ba97521cceac76445 /include/driver | |
parent | 1f1d47d6c867ae3fdab9b84f3f9a691d645fd413 (diff) |
add initialization and readout to CCS811 driver
Diffstat (limited to 'include/driver')
-rw-r--r-- | include/driver/ccs811.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/include/driver/ccs811.h b/include/driver/ccs811.h index aab1e35..8be0e6e 100644 --- a/include/driver/ccs811.h +++ b/include/driver/ccs811.h @@ -9,15 +9,29 @@ class CCS811 { private: CCS811(const CCS811 ©); - unsigned char const address; - unsigned char txbuf[3]; - unsigned char rxbuf[2]; + unsigned char const address = 0x5a; + unsigned char txbuf[5]; + unsigned char rxbuf[8]; public: - CCS811(unsigned char const addr) : address(addr) {} + CCS811() {} + + unsigned short eco2; + unsigned short tvoc; + unsigned char status; + unsigned char error_id; + unsigned char raw_current; + unsigned short raw_voltage; void init(); - short check(); + unsigned char getStatus(); + unsigned char getError(); + unsigned char getManufacturerID(); + void startFirmware(); + void setMode(unsigned char mode); + void read(); + void setEnv(unsigned char humi, unsigned char humi_fraction, unsigned char temp, unsigned char temp_fraction); + void reset(); }; extern CCS811 ccs811; |