Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Multichannel_Gas_GMXXX.h
- Revision:
- 9:07c1751a6d00
- Parent:
- 8:705631dd7248
diff -r 705631dd7248 -r 07c1751a6d00 Multichannel_Gas_GMXXX.h
--- a/Multichannel_Gas_GMXXX.h Tue Mar 02 18:29:08 2021 +0100
+++ b/Multichannel_Gas_GMXXX.h Wed Mar 03 15:22:39 2021 +0100
@@ -43,60 +43,59 @@
class GAS_GMXXX
{
- public:
- GAS_GMXXX(PinName sda, PinName scl, uint8_t addr = 0x08);
- GAS_GMXXX(I2C* i2c, uint8_t addr = 0x08);
- void init();
- void setAddress(uint8_t address = 0x08);
- void preheated();
- void unPreheated();
- void changeGMXXXAddr(uint8_t address = 0x08);
- uint32_t measure_NO2()
- {
- return getGM102B();
- };
- uint32_t getGM102B();
- uint32_t measure_C2H5OH()
- {
- return getGM302B();
- };
- uint32_t getGM302B();
- #ifdef GM_402B
- uint32_t getGM402B();
- #endif
- uint32_t measure_VOC()
- {
- return getGM502B();
- };
- uint32_t getGM502B();
- uint32_t measure_CO()
- {
- return getGM702B();
- };
- uint32_t getGM702B();
- #ifdef GM_802B
- uint32_t getGM802B();
- #endif
- inline float calcVol(uint32_t adc)
- {
- return (adc * 3.3) / GM_RESOLUTION;
- };
- void read();
- bool gas_detected();
- uint32_t get_no2();
- uint32_t get_c2h5oh();
- uint32_t get_voc();
- uint32_t get_co();
- private:
- I2C* _i2c_p;
- I2C& _i2c;
+ public:
+ GAS_GMXXX(PinName sda, PinName scl, uint8_t addr = 0x08);
+ void init();
+ void setAddress(uint8_t address = 0x08);
+ void preheated();
+ void unPreheated();
+ void changeGMXXXAddr(uint8_t address = 0x08);
+ uint32_t measure_NO2()
+ {
+ return getGM102B();
+ };
+ uint32_t getGM102B();
+ uint32_t measure_C2H5OH()
+ {
+ return getGM302B();
+ };
+ uint32_t getGM302B();
+ #ifdef GM_402B
+ uint32_t getGM402B();
+ #endif
+ uint32_t measure_VOC()
+ {
+ return getGM502B();
+ };
+ uint32_t getGM502B();
+ uint32_t measure_CO()
+ {
+ return getGM702B();
+ };
+ uint32_t getGM702B();
+ #ifdef GM_802B
+ uint32_t getGM802B();
+ #endif
+ inline float calcVol(uint32_t adc)
+ {
+ return (adc * 3.3) / GM_RESOLUTION;
+ };
+ void read();
+ bool gas_detected();
+ float get_no2();
+ float get_c2h5oh();
+ float get_voc();
+ float get_co();
+ private:
+ I2C* _i2c_p;
+ I2C& _i2c;
- uint32_t _no2, _c2h5oh, _voc, _co;
+ float _no2, _c2h5oh, _voc, _co;
- bool isPreheated;
- bool gasDetected;
- uint8_t GMXXX_ADDRESS;
- void GMXXXWriteByte(uint8_t cmd);
- uint32_t GMXXXRead32();
+ bool isPreheated;
+ bool gasDetected;
+ uint8_t GMXXX_ADDRESS;
+ void GMXXXWriteByte(uint8_t cmd);
+ uint32_t GMXXXRead32();
};
#endif