diff --git a/PCF8574.cpp b/PCF8574.cpp index eb06e9b..36da965 100644 --- a/PCF8574.cpp +++ b/PCF8574.cpp @@ -53,7 +53,7 @@ PCF8574::PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunctio _usingInterrupt = true; }; -#if !defined(__AVR) && !defined(__STM32F1__) && !defined(TEENSYDUINO) +#if !defined(__AVR) && !defined(ARDUINO_ARCH_SAMD) && !defined(__STM32F1__) && !defined(TEENSYDUINO) /** * Constructor * @param address: i2c address @@ -185,8 +185,10 @@ PCF8574::PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunctio */ bool PCF8574::begin(){ this->transmissionStatus = 4; - #if !defined(__AVR) && !defined(__STM32F1__) && !defined(TEENSYDUINO) - _wire->begin(_sda, _scl); + #if !defined(__AVR) && !defined(ARDUINO_ARCH_SAMD) && !defined(__STM32F1__) && !defined(TEENSYDUINO) + DEBUG_PRINT(F("begin(sda, scl) -> "));DEBUG_PRINT(_sda);DEBUG_PRINT(F(" "));DEBUG_PRINTLN(_scl); +// _wire->begin(_sda, _scl); + _wire->begin((int)_sda, (int)_scl); #else // Default pin for AVR some problem on software emulation // #define SCL_PIN _scl diff --git a/PCF8574.h b/PCF8574.h index efbda2f..bab2c78 100644 --- a/PCF8574.h +++ b/PCF8574.h @@ -2,7 +2,7 @@ * PCF8574 GPIO Port Expand * * AUTHOR: Renzo Mischianti - * VERSION: 2.3.1 + * VERSION: 2.3.2 * * https://www.mischianti.org/2019/01/02/pcf8574-i2c-digital-i-o-expander-fast-easy-usage/ * @@ -47,7 +47,7 @@ #define DEFAULT_SCL SCL; // Uncomment to enable printing out nice debug messages. - // #define PCF8574_DEBUG +// #define PCF8574_DEBUG // Uncomment for low memory usage this prevent use of complex DigitalInput structure and free 7byte of memory // #define PCF8574_LOW_MEMORY @@ -109,7 +109,7 @@ class PCF8574 { PCF8574(uint8_t address); PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunction)() ); -#if !defined(__AVR) && !defined(__STM32F1__) && !defined(TEENSYDUINO) +#if !defined(__AVR) && !defined(ARDUINO_ARCH_SAMD) && !defined(__STM32F1__) && !defined(TEENSYDUINO) 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 @@ -193,6 +193,8 @@ class PCF8574 { } bool isLastTransmissionSuccess(){ + DEBUG_PRINT(F("STATUS --> ")); + DEBUG_PRINTLN(transmissionStatus); return transmissionStatus==0; } private: diff --git a/PCF8574_library.h b/PCF8574_library.h index 4576cce..e82c10d 100644 --- a/PCF8574_library.h +++ b/PCF8574_library.h @@ -2,7 +2,7 @@ * PCF8574 GPIO Port Expand * * AUTHOR: Renzo Mischianti - * VERSION: 2.3.1 + * VERSION: 2.3.2 * * https://www.mischianti.org/2019/01/02/pcf8574-i2c-digital-i-o-expander-fast-easy-usage/ * diff --git a/README.md b/README.md index 050d99d..9ffd5e3 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Tutorial: To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder PCF8574. Check that the PCF8574 folder contains `PCF8574\\.cpp` and `PCF8574.h`. Place the DHT library folder your `/libraries/` folder. You may need to create the libraries subfolder if its your first library. Restart the IDE. ## Changelog +28/07/2022: v2.3.2 Fix the SDA SCL type #58 and add basic support for SAMD device. 26/04/2022: v2.3.1 Fix example for esp32 and double begin issue #56. 06/04/2022: v2.3.0 Fix package size 30/12/2021: v2.2.4 Minor fix and remove deprecated declaration diff --git a/library.json b/library.json new file mode 100644 index 0000000..3fa699d --- /dev/null +++ b/library.json @@ -0,0 +1,24 @@ +{ + "name": "PCF8574 library", + "version": "2.3.2", + "keywords": "digital, i2c, encoder, expander, pcf8574, pcf8574a, esp32, esp8266, stm32, SAMD, Arduino, wire", + "description": "i2c digital expander for Arduino, esp32, SMT32 and ESP8266. Can read write digital values with only 2 wire. Very simple to use and encoder support.", + "homepage": "https://www.mischianti.org/category/my-libraries/pcf8574/", + "authors": + [ + { + "name": "Renzo Mischianti", + "email": "renzo.mischianti@gmail.com", + "maintainer": true, + "url": "https://www.mischianti.org" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/xreef/PCF8574_library" + }, + "license": "MIT", + "frameworks": "arduino", + "platforms": "*", + "headers": ["PCF8574.h, PCF8574_library.h"] +} \ No newline at end of file diff --git a/library.properties b/library.properties index 61351ab..2cee7fa 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=PCF8574 library -version=2.3.1 +version=2.3.2 author=Renzo Mischianti maintainer=Renzo Mischianti sentence=PCF8574, library for Arduino, ESP8266, smt32 and esp32