0.3.4 PCF8574

This commit is contained in:
rob tillaart 2022-04-11 10:50:17 +02:00
parent 31d90e0927
commit 31b38b33f8
6 changed files with 113 additions and 47 deletions

View File

@ -0,0 +1,102 @@
# Change Log PCF8574
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.3.4] - 2022-04-11
### Added
- add CHANGELOG.md
### Changed
### Fixed
- **begin(int sda, int scl)** int parameters for ESP alike.
## [0.3.3] - 2021-12-23
### Changed
- update library.json, license, readme, minor edits
## [0.3.2] - 2021-07-04
### Added
- fix #25 add setAddress()
## [0.3.1] - 2021-04-23
### Fixed
- Fix for platformIO compatibility
## [0.3.0] - 2021-01-03
### Added
- multiWire support - inspired by mattbue - issue #14
## [0.2.4] - 2020-12-17
- fix #6 tag problem 0.2.3
## [0.2.3] - 2020-12-14
- fix #6 readButton8 ambiguity
## [0.2.2] - 2020-12-07
- add Arduino-ci + start unit test + _wire->h in PCF8574.h
## [0.2.1] - 2020-06-19
- fix library.json
## [0.2.0] - 2020-05-22
- #pragma once; refactor;
- removed pre 1.0 support
- added begin(dsa, scl) for ESP32
- added reverse()
## [0.1.9] - 2017-02-27
- fix warning about return in readButton8()
## [0.1.08] - 2016-05-20'
- Merged work of Septillion
- Fix/refactor ButtonRead8() - see https://github.com/RobTillaart/Arduino/issues/38
- missing begin() => mask parameter
## [0.1.07] - 2016-05-02
- (manually merged) Septillion
- added dataOut so a write() doesn't read first,
possibly corrupting a input pin;
- fixed shift comment, should read 1..7;
- added begin() to be sure it's in a known state,
states could be different if uC is reset and the PCF8574 isn't;
- added buttonRead() and buttonRead8()
which only effect the output while reading
## [0.1.06] - ??
- (intermediate) added defined errors + refactor rotate
## [0.1.05] - 2016-04-30
- refactor, +toggleMask, +rotLeft, +rotRight
## [0.1.04] - 2015-05-09
- removed ambiguity in read8()
## [0.1.03] - 2015-03-02
- address int -> uint8_t
## [0.1.02] - ?
- replaced integers with uint8_t to reduce footprint;
- added default value for shiftLeft() and shiftRight()
- renamed status() to lastError();
## [0.1.01] - ?
- added value(); returns last read 8 bit value (cached);
value() does not always reflect the latest state of the pins!
## [0.1.00] - 2013-02-02
- initial version

View File

@ -2,48 +2,12 @@
// FILE: PCF8574.cpp
// AUTHOR: Rob Tillaart
// DATE: 02-febr-2013
// VERSION: 0.3.3
// VERSION: 0.3.4
// PURPOSE: Arduino library for PCF8574 - 8 channel I2C IO expander
// URL: https://github.com/RobTillaart/PCF8574
// http://forum.arduino.cc/index.php?topic=184800
//
// HISTORY:
//
// 0.3.3 2021-12-23 update library.json, license, readme, minor edits
// 0.3.2 2021-07-04 fix #25 add setAddress()
// 0.3.1 2021-04-23 Fix for platformIO compatibility
// 0.3.0 2021-01-03 multiWire support - inspired by mattbue - issue #14
// 0.2.4 2020-12-17 fix #6 tag problem 0.2.3
// 0.2.3 2020-12-14 fix #6 readButton8 ambiguity
// 0.2.2 2020-12-07 add Arduino-ci + start unit test + _wire->h in PCF8574.h
// 0.2.1 2020-06-19 fix library.json
// 0.2.0 2020-05-22 #pragma once; refactor;
// removed pre 1.0 support
// added begin(dsa, scl) for ESP32
// added reverse()
//
// 0.1.9 2017-02-27 fix warning about return in readButton8()
// 0.1.08 2016-05-20 Merged work of Septillion
// Fix/refactor ButtonRead8() - see https://github.com/RobTillaart/Arduino/issues/38
// missing begin() => mask parameter
// 0.1.07 2016-05-02 (manually merged) Septillion
// added dataOut so a write() doesn't read first,
// possibly corrupting a input pin;
// fixed shift comment, should read 1..7;
// added begin() to be sure it's in a known state,
// states could be different if uC is reset and the PCF8574 isn't;
// added buttonRead() and buttonRead8()
// which only effect the output while reading
// 0.1.06 (intermediate) added defined errors + refactor rotate
// 0.1.05 2016-04-30 refactor, +toggleMask, +rotLeft, +rotRight
// 0.1.04 2015-05-09 removed ambiguity in read8()
// 0.1.03 2015-03-02 address int -> uint8_t
// 0.1.02 replaced integers with uint8_t to reduce footprint;
// added default value for shiftLeft() and shiftRight()
// renamed status() to lastError();
// 0.1.01 added value(); returns last read 8 bit value (cached);
// value() does not always reflect the latest state of the pins!
// 0.1.00 initial version
// HISTORY: See CHANGELOG.md
//
#include "PCF8574.h"
@ -61,7 +25,7 @@ PCF8574::PCF8574(const uint8_t deviceAddress, TwoWire *wire)
#if defined (ESP8266) || defined(ESP32)
bool PCF8574::begin(uint8_t dataPin, uint8_t clockPin, uint8_t value)
bool PCF8574::begin(int dataPin, int clockPin, uint8_t value)
{
_wire = &Wire;
if ((dataPin < 255) && (clockPin < 255))

View File

@ -3,7 +3,7 @@
// FILE: PCF8574.h
// AUTHOR: Rob Tillaart
// DATE: 02-febr-2013
// VERSION: 0.3.3
// VERSION: 0.3.4
// PURPOSE: Arduino library for PCF8574 - 8 channel I2C IO expander
// URL: https://github.com/RobTillaart/PCF8574
// http://forum.arduino.cc/index.php?topic=184800
@ -17,7 +17,7 @@
#include "Wire.h"
#define PCF8574_LIB_VERSION (F("0.3.3"))
#define PCF8574_LIB_VERSION (F("0.3.4"))
#ifndef PCF8574_INITIAL_VALUE
#define PCF8574_INITIAL_VALUE 0xFF
@ -34,7 +34,7 @@ public:
explicit PCF8574(const uint8_t deviceAddress = 0x20, TwoWire *wire = &Wire);
#if defined (ESP8266) || defined(ESP32)
bool begin(uint8_t sda, uint8_t scl, uint8_t value = PCF8574_INITIAL_VALUE);
bool begin(int sda, int scl, uint8_t value = PCF8574_INITIAL_VALUE);
#endif
bool begin(uint8_t value = PCF8574_INITIAL_VALUE);
bool isConnected();

View File

@ -42,7 +42,7 @@ the include of "pcf8574.h" to overrule the default value used with the **begin()
- **PCF8574(uint8_t deviceAddress = 0x20, TwoWire \*wire = &Wire)** Constructor with optional device address, default 0x20,
and the optional Wire interface as parameter.
- **bool begin(uint8_t value = PCF8574_INITIAL_VALUE)** set the initial value for the pins and masks.
- **bool begin(uint8_t sda, uint8_t scl, uint8_t value = PCF8574_INITIAL_VALUE)** idem, for the ESP32 where one can choose the I2C pins.
- **bool begin(int sda, int scl, uint8_t value = PCF8574_INITIAL_VALUE)** idem, for the ESP32 where one can choose the I2C pins.
- **bool isConnected()** checks if the address set in the constructor or by **setAddress()** is visible on the I2C bus.
- **bool setAddress(const uint8_t deviceAddress)** sets the device address after construction.
Can be used to switch between PCF8574 modules runtime. Note this corrupts internal buffered values,
@ -116,6 +116,6 @@ It is advised to use pull-up or pull-down resistors so the lines have a defined
## Future
- update documentation
- link to related libraries.
-

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/PCF8574.git"
},
"version": "0.3.3",
"version": "0.3.4",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=PCF8574
version=0.3.3
version=0.3.4
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for PCF8574 - 8 channel I2C IO expander