From cf97c18554b9aa88202b9d2463ee08cafd1252b0 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 14 Feb 2021 21:42:26 +0100 Subject: add initialization and readout to CCS811 driver --- include/driver/ccs811.h | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'include/driver') 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; -- cgit v1.2.3