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:
- 2:c836ed5bafce
- Parent:
- 1:f0e19383efb9
- Child:
- 6:52d9088d70cd
--- a/Multichannel_Gas_GMXXX.h Wed Feb 03 17:03:19 2021 +0100 +++ b/Multichannel_Gas_GMXXX.h Wed Feb 03 18:57:23 2021 +0100 @@ -26,14 +26,7 @@ #define __GAS_GMXXX__ #include <inttypes.h> - -//#define SOFTWAREWIRE -/*#ifdef SOFTWAREWIRE - #include <SoftwareWire.h> -#else - #include <Wire.h> -#endif -*/ +#include "mbed.h" #define GM_RESOLUTION 1023 @@ -48,11 +41,11 @@ #define WARMING_UP 0xFE #define WARMING_DOWN 0xFF -template <class T> class GAS_GMXXX { public: - GAS_GMXXX(); - void begin(T& wire = Wire, uint8_t address = 0x08); + GAS_GMXXX(PinName sda, PinName scl, uint8_t addr = 0x08); + //void begin(); + void init(); void setAddress(uint8_t address = 0x08); void preheated(); void unPreheated(); @@ -83,7 +76,8 @@ return (adc * 3.3) / GM_RESOLUTION; }; private: - T* _Wire; + I2C* _i2c_p; + I2C& _i2c; bool isPreheated; uint8_t GMXXX_ADDRESS; void GMXXXWriteByte(uint8_t cmd);