Actually works, and with mbed os 5 latest

Dependents:   CCS811-TEST Mbed-Connect-Cloud-Demo Mbed-Connect-Cloud-Demo HTTP-all-sensors ... more

Fork of CCS811 by MtM+

Revision:
1:4acc5b63a984
Parent:
0:b5dbfc21185d
Child:
2:64a96d555ef0
diff -r b5dbfc21185d -r 4acc5b63a984 CCS811.h
--- a/CCS811.h	Tue Jun 27 05:17:02 2017 +0000
+++ b/CCS811.h	Wed Sep 13 15:31:53 2017 +0000
@@ -2,7 +2,7 @@
 #define CCS811_H
 
 //CCS811 register define
-#define CCS811_I2C_ADDR                 0xB4
+#define CCS811_I2C_ADDR                 0xB6    //This is already left shifted 0x5B, if using other address, should be 0xB4 which is 0x5A left shifted.
 #define CCS811_REG_STATUS               0x00    //Status.
 #define CCS811_REG_MEAS_MODE            0x01    //Mesurement mode and conditions register.
 #define CCS811_REG_ALG_RESULT_DATA      0x02    //Algorithm result. 2 bytes co2 ppm next 2 bytes ppb VOC level.
@@ -34,14 +34,17 @@
 
 class CCS811 {
     public:
-        CCS811(I2C& i2c);
+        CCS811(I2C* i2c);
         void init();
         int setMeasureMode(char mode);
         int readData(uint16_t *ECO2, uint16_t *TVOC);
         bool checkHW();
         bool softRest();
+        bool readstatus();
+        bool readmeas();
+        bool readerror();
     protected:
-        I2C m_i2c;
+        I2C* m_i2c;
         Serial pc;
     private:
 };