diff --git a/PCF8574.cpp b/PCF8574.cpp index 2bb92c7..99ffc5a 100644 --- a/PCF8574.cpp +++ b/PCF8574.cpp @@ -53,7 +53,7 @@ PCF8574::PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunctio _usingInterrupt = true; }; -#ifndef __AVR +#if !defined(__AVR) && !defined(__STM32F1__) /** * Constructor * @param address: i2c address @@ -156,7 +156,7 @@ PCF8574::PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunctio * wake up i2c controller */ void PCF8574::begin(){ - #ifndef __AVR + #if !defined(__AVR) && !defined(__STM32F1__) _wire->begin(_sda, _scl); #else // Default pin for AVR some problem on software emulation @@ -165,7 +165,7 @@ void PCF8574::begin(){ _wire->begin(); #endif - // Che if there are pins to set low + // Check if there are pins to set low if (writeMode>0 || readMode>0){ DEBUG_PRINTLN("Set write mode"); _wire->beginTransmission(_address); diff --git a/PCF8574.h b/PCF8574.h index a11544b..65f355a 100644 --- a/PCF8574.h +++ b/PCF8574.h @@ -83,7 +83,7 @@ public: PCF8574(uint8_t address); PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunction)() ); -#ifndef __AVR +#if !defined(__AVR) && !defined(__STM32F1__) PCF8574(uint8_t address, uint8_t sda, uint8_t scl); PCF8574(uint8_t address, uint8_t sda, uint8_t scl, uint8_t interruptPin, void (*interruptFunction)()); #endif @@ -123,8 +123,14 @@ public: private: uint8_t _address; - uint8_t _sda = SDA; - uint8_t _scl = SCL; + + #if defined(__AVR) || defined(__STM32F1__) + uint8_t _sda; + uint8_t _scl; + #else + uint8_t _sda = SDA; + uint8_t _scl = SCL; + #endif TwoWire *_wire; diff --git a/README.md b/README.md index 2d6665b..9bb3c7e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ +<<<<<<< HEAD Additional information and document update here on my site: [pcf8574 Article](https://www.mischianti.org/2019/01/02/pcf8574-i2c-digital-i-o-expander-fast-easy-usage/). +======= +You can find document update at www.mischianti.org +>>>>>>> branch 'master' of https://github.com/xreef/PCF8574_library.git Library to use i2c analog IC with arduino and esp8266. Can read and write digital value with only 2 wire (perfect for ESP-01).