12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #ifndef ADAFRUIT_SGP30_H
- #define ADAFRUIT_SGP30_H
- #include "Arduino.h"
- #include <Wire.h>
- #define SGP30_I2CADDR_DEFAULT 0x58
- #define SGP30_FEATURESET 0x0020
- #define SGP30_CRC8_POLYNOMIAL 0x31
- #define SGP30_CRC8_INIT 0xFF
- #define SGP30_WORD_LEN 2
- class Adafruit_SGP30 {
- public:
- Adafruit_SGP30();
- boolean begin(TwoWire *theWire = &Wire, boolean initSensor = true);
- boolean softReset();
- boolean IAQinit();
- boolean IAQmeasure();
- boolean IAQmeasureRaw();
- boolean getIAQBaseline(uint16_t *eco2_base, uint16_t *tvoc_base);
- boolean setIAQBaseline(uint16_t eco2_base, uint16_t tvoc_base);
- boolean setHumidity(uint32_t absolute_humidity);
-
- uint16_t TVOC;
-
- uint16_t eCO2;
-
- uint16_t rawH2;
-
- uint16_t rawEthanol;
-
- uint16_t serialnumber[3];
- private:
- TwoWire *_i2c;
- uint8_t _i2caddr;
- void write(uint8_t address, uint8_t *data, uint8_t n);
- void read(uint8_t address, uint8_t *data, uint8_t n);
- boolean readWordFromCommand(uint8_t command[], uint8_t commandLength,
- uint16_t delay, uint16_t *readdata = NULL,
- uint8_t readlen = 0);
- uint8_t generateCRC(uint8_t data[], uint8_t datalen);
- };
- #endif
|