This commit is contained in:
Renzo Mischianti 2022-07-28 20:40:16 +02:00
parent 418fca71c2
commit 77d04961ed
6 changed files with 15 additions and 14 deletions

View File

@ -60,7 +60,7 @@ PCF8574::PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunctio
* @param sda: sda pin * @param sda: sda pin
* @param scl: scl pin * @param scl: scl pin
*/ */
PCF8574::PCF8574(uint8_t address, uint8_t sda, uint8_t scl){ PCF8574::PCF8574(uint8_t address, int sda, int scl){
_wire = &Wire; _wire = &Wire;
_address = address; _address = address;
@ -76,7 +76,7 @@ PCF8574::PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunctio
* @param interruptPin: pin to set interrupt * @param interruptPin: pin to set interrupt
* @param interruptFunction: function to call when interrupt raised * @param interruptFunction: function to call when interrupt raised
*/ */
PCF8574::PCF8574(uint8_t address, uint8_t sda, uint8_t scl, uint8_t interruptPin, void (*interruptFunction)() ){ PCF8574::PCF8574(uint8_t address, int sda, int scl, uint8_t interruptPin, void (*interruptFunction)() ){
_wire = &Wire; _wire = &Wire;
_address = address; _address = address;
@ -122,7 +122,7 @@ PCF8574::PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunctio
* @param sda: sda pin * @param sda: sda pin
* @param scl: scl pin * @param scl: scl pin
*/ */
PCF8574::PCF8574(TwoWire *pWire, uint8_t address, uint8_t sda, uint8_t scl){ PCF8574::PCF8574(TwoWire *pWire, uint8_t address, int sda, int scl){
_wire = pWire; _wire = pWire;
_address = address; _address = address;
@ -138,7 +138,7 @@ PCF8574::PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunctio
* @param interruptPin: pin to set interrupt * @param interruptPin: pin to set interrupt
* @param interruptFunction: function to call when interrupt raised * @param interruptFunction: function to call when interrupt raised
*/ */
PCF8574::PCF8574(TwoWire *pWire, uint8_t address, uint8_t sda, uint8_t scl, uint8_t interruptPin, void (*interruptFunction)() ){ PCF8574::PCF8574(TwoWire *pWire, uint8_t address, int sda, int scl, uint8_t interruptPin, void (*interruptFunction)() ){
_wire = pWire; _wire = pWire;
_address = address; _address = address;

View File

@ -2,7 +2,7 @@
* PCF8574 GPIO Port Expand * PCF8574 GPIO Port Expand
* *
* AUTHOR: Renzo Mischianti * AUTHOR: Renzo Mischianti
* VERSION: 2.3.2 * VERSION: 2.3.3
* *
* https://www.mischianti.org/2019/01/02/pcf8574-i2c-digital-i-o-expander-fast-easy-usage/ * https://www.mischianti.org/2019/01/02/pcf8574-i2c-digital-i-o-expander-fast-easy-usage/
* *
@ -110,17 +110,17 @@ public:
PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunction)() ); PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunction)() );
#if !defined(__AVR) && !defined(ARDUINO_ARCH_SAMD) && !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, int sda, int scl);
PCF8574(uint8_t address, uint8_t sda, uint8_t scl, uint8_t interruptPin, void (*interruptFunction)()); PCF8574(uint8_t address, int sda, int scl, uint8_t interruptPin, void (*interruptFunction)());
#endif #endif
#ifdef ESP32 #ifdef ESP32
///// changes for second i2c bus ///// changes for second i2c bus
PCF8574(TwoWire *pWire, uint8_t address); PCF8574(TwoWire *pWire, uint8_t address);
PCF8574(TwoWire *pWire, uint8_t address, uint8_t sda, uint8_t scl); PCF8574(TwoWire *pWire, uint8_t address, int sda, int scl);
PCF8574(TwoWire *pWire, uint8_t address, uint8_t interruptPin, void (*interruptFunction)() ); PCF8574(TwoWire *pWire, uint8_t address, uint8_t interruptPin, void (*interruptFunction)() );
PCF8574(TwoWire *pWire, uint8_t address, uint8_t sda, uint8_t scl, uint8_t interruptPin, void (*interruptFunction)()); PCF8574(TwoWire *pWire, uint8_t address, int sda, int scl, uint8_t interruptPin, void (*interruptFunction)());
#endif #endif
bool begin(); bool begin();
@ -223,8 +223,8 @@ private:
# endif # endif
#endif #endif
uint8_t _sda = DEFAULT_SDA; int _sda = DEFAULT_SDA;
uint8_t _scl = DEFAULT_SCL; int _scl = DEFAULT_SCL;
TwoWire *_wire; TwoWire *_wire;

View File

@ -2,7 +2,7 @@
* PCF8574 GPIO Port Expand * PCF8574 GPIO Port Expand
* *
* AUTHOR: Renzo Mischianti * AUTHOR: Renzo Mischianti
* VERSION: 2.3.2 * VERSION: 2.3.3
* *
* https://www.mischianti.org/2019/01/02/pcf8574-i2c-digital-i-o-expander-fast-easy-usage/ * https://www.mischianti.org/2019/01/02/pcf8574-i2c-digital-i-o-expander-fast-easy-usage/
* *

View File

@ -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 `<arduinosketchfolder>/libraries/` folder. You may need to create the libraries subfolder if its your first library. Restart the IDE. 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 `<arduinosketchfolder>/libraries/` folder. You may need to create the libraries subfolder if its your first library. Restart the IDE.
## Changelog ## Changelog
28/07/2022: v2.3.3 Force SDA SCL to use GPIO numeration (https://www.mischianti.org/forums/topic/cannot-set-sda-clk-on-esp8266/).
28/07/2022: v2.3.2 Fix the SDA SCL type #58 and add basic support for SAMD device. 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. 26/04/2022: v2.3.1 Fix example for esp32 and double begin issue #56.
06/04/2022: v2.3.0 Fix package size 06/04/2022: v2.3.0 Fix package size

View File

@ -1,6 +1,6 @@
{ {
"name": "PCF8574 library", "name": "PCF8574 library",
"version": "2.3.2", "version": "2.3.3",
"keywords": "digital, i2c, encoder, expander, pcf8574, pcf8574a, esp32, esp8266, stm32, SAMD, Arduino, wire", "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.", "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/", "homepage": "https://www.mischianti.org/category/my-libraries/pcf8574/",

View File

@ -1,5 +1,5 @@
name=PCF8574 library name=PCF8574 library
version=2.3.2 version=2.3.3
author=Renzo Mischianti <renzo.mischianti@gmail.com> author=Renzo Mischianti <renzo.mischianti@gmail.com>
maintainer=Renzo Mischianti <renzo.mischianti@gmail.com> maintainer=Renzo Mischianti <renzo.mischianti@gmail.com>
sentence=PCF8574, library for Arduino, ESP8266, smt32 and esp32 sentence=PCF8574, library for Arduino, ESP8266, smt32 and esp32