diff --git a/PCF8574.cpp b/PCF8574.cpp index 9a235b0..1813f7e 100644 --- a/PCF8574.cpp +++ b/PCF8574.cpp @@ -22,7 +22,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 @@ -59,16 +59,16 @@ 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 + // Default pin for AVR and Arduino STM32 some problem on software emulation // #define SCL_PIN _scl // #define SDA_PIN _sda 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 87036e4..449c7c4 100644 --- a/PCF8574.h +++ b/PCF8574.h @@ -91,8 +91,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 bool _usingInterrupt = false; uint8_t _interruptPin = 2;