Skip to content

Commit a945332

Browse files
authored
update readme.md (#58)
- sync last commits - update readme.md
1 parent 5afe366 commit a945332

File tree

7 files changed

+55
-31
lines changed

7 files changed

+55
-31
lines changed

CHANGELOG.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## [0.4.2] - 2025-04-18
10+
- sync last commits
11+
- update readme.md
12+
13+
914
## [0.4.1] - 2023-09-23
1015
- Update readme with advanced interrupts insights
1116
- kudos to ddowling for testing.
1217
- add example
1318
- fix URL examples
1419
- add Wire1 example (ESP32 + RP2040)
1520

16-
1721
## [0.4.0] - 2023-09-23
1822
- refactor API, begin()
1923
- update readme.md
@@ -39,7 +43,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3943
## [0.3.6] - 2022-10-19
4044
- fix example PCF8574_rotaryEncoder.ino
4145
- add RP2040 to build-CI
42-
- simplified changelog.md
46+
- simplified changelog.md
4347

4448
## [0.3.5] - 2022-06-17
4549
- add select(), selectN(), selectNone() and selectAll()
@@ -49,7 +53,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4953
- add CHANGELOG.md
5054
- fix **begin(int sda, int scl)** int parameters for ESP alike.
5155

52-
## [0.3.3] - 2021-12-23
56+
## [0.3.3] - 2021-12-23
5357
- update library.json, license, readme, minor edits
5458

5559
## [0.3.2] - 2021-07-04
@@ -91,7 +95,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
9195
- Fix/refactor ButtonRead8() - see https://github.com/RobTillaart/Arduino/issues/38
9296
- missing begin() => mask parameter
9397

94-
## [0.1.07] - 2016-05-02
98+
## [0.1.07] - 2016-05-02
9599
- (manually merged) Septillion
96100
- added dataOut so a write() doesn't read first,
97101
possibly corrupting a input pin;

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2013-2024 Rob Tillaart
3+
Copyright (c) 2013-2025 Rob Tillaart
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

PCF8574.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// FILE: PCF8574.cpp
33
// AUTHOR: Rob Tillaart
44
// DATE: 02-febr-2013
5-
// VERSION: 0.4.1
5+
// VERSION: 0.4.2
66
// PURPOSE: Arduino library for PCF8574 - 8 channel I2C IO expander
77
// URL: https://github.com/RobTillaart/PCF8574
88
// http://forum.arduino.cc/index.php?topic=184800

PCF8574.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// FILE: PCF8574.h
44
// AUTHOR: Rob Tillaart
55
// DATE: 02-febr-2013
6-
// VERSION: 0.4.1
6+
// VERSION: 0.4.2
77
// PURPOSE: Arduino library for PCF8574 - 8 channel I2C IO expander
88
// URL: https://github.com/RobTillaart/PCF8574
99
// http://forum.arduino.cc/index.php?topic=184800
@@ -13,7 +13,7 @@
1313
#include "Wire.h"
1414

1515

16-
#define PCF8574_LIB_VERSION (F("0.4.1"))
16+
#define PCF8574_LIB_VERSION (F("0.4.2"))
1717

1818
#ifndef PCF8574_INITIAL_VALUE
1919
#define PCF8574_INITIAL_VALUE 0xFF
@@ -27,7 +27,7 @@
2727
class PCF8574
2828
{
2929
public:
30-
explicit PCF8574(const uint8_t deviceAddress = 0x20, TwoWire *wire = &Wire);
30+
PCF8574(const uint8_t deviceAddress = 0x20, TwoWire *wire = &Wire);
3131

3232
bool begin(uint8_t value = PCF8574_INITIAL_VALUE);
3333
bool isConnected();
@@ -82,7 +82,7 @@ class PCF8574
8282
uint8_t _dataIn {0};
8383
uint8_t _dataOut {0xFF};
8484
uint8_t _buttonMask {0xFF};
85-
85+
8686

8787
TwoWire* _wire;
8888
};

README.md

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ Arduino library for PCF8574 - 8 channel I2C IO expander.
1616

1717
## Description
1818

19-
Related to the PCF8575 16 channel IO expander library https://github.com/RobTillaart/PCF8575
20-
2119
This library gives easy control over the 8 pins of a PCF8574 and PCF8574A chip.
2220
These chips are identical in behaviour although there are two distinct address ranges.
2321

@@ -36,7 +34,7 @@ The library allows to read and write both single pins or 8 pins at once.
3634
Furthermore some additional functions are implemented that are playful and useful.
3735

3836

39-
#### Interrupts intro
37+
### Interrupts intro
4038

4139
The PCF8574 has an interrupt output line (INT) to notify an MCU that one of the input lines has changed.
4240
This can be used to prevent active polling of the PCF8574, which can be more efficient.
@@ -61,7 +59,7 @@ In practice if you have faster polling than your signals changes this would not
6159
be a problem. E.g. tactile switches and a polling frequency > 100 Hz will work.
6260

6361

64-
#### Interrupts library
62+
### Interrupts library
6563

6664
The library cannot handle the PCF8574 interrupts as it has no code for it.
6765
The user should catch the interrupt in his own code to set a flag and can use
@@ -84,7 +82,7 @@ A minimal example that shows catching missed interrupts:
8482
- **PCF8574_interrupt_advanced.ino**
8583

8684

87-
#### 0.4.0 Breaking change
85+
### 0.4.0 Breaking change
8886

8987
Version 0.4.0 introduced a breaking change.
9088
You cannot set the pins in **begin()** any more.
@@ -93,23 +91,27 @@ The user has to call **Wire.begin()** and can optionally set the Wire pins
9391
before calling **begin()**.
9492

9593

96-
#### Related
94+
### Related
9795

9896
16 bit port expanders
9997

100-
- https://github.com/RobTillaart/MCP23017_RT
101-
- https://github.com/RobTillaart/MCP23S17
102-
- https://github.com/RobTillaart/PCF8575
98+
- https://github.com/RobTillaart/MCP23017_RT I2C 16 IO lines.
99+
- https://github.com/RobTillaart/MCP23S17 SPI 16 IO lines.
100+
- https://github.com/RobTillaart/PCF8575 I2C 16 IO lines.
101+
- https://github.com/RobTillaart/PCA9671 I2C 16 IO lines. - successor PCF8575
103102

104103

105104
8 bit port expanders
106105

107-
- https://github.com/RobTillaart/MCP23008
108-
- https://github.com/RobTillaart/MCP23S08
109-
- https://github.com/RobTillaart/PCF8574
106+
- https://github.com/RobTillaart/MCP23008 I2C 8 IO lines.
107+
- https://github.com/RobTillaart/MCP23S08 SPI 8 IO lines.
108+
- https://github.com/RobTillaart/PCF8574 I2C 8 IO lines.
109+
110110

111+
## I2C
111112

112-
## I2C Clock
113+
114+
### Performance
113115

114116
Tested on UNO with **PCF8574_performance** showed that the PCF8574 still works at 500 KHz and failed at 600 KHz.
115117
These values are outside the specs of the datasheet so they are not recommended.
@@ -125,6 +127,24 @@ However when performance is needed you can try to overclock the chip.
125127
| 600000 | crash | crash |
126128

127129

130+
### I2C multiplexing
131+
132+
Sometimes you need to control more devices than possible with the default
133+
address range the device provides.
134+
This is possible with an I2C multiplexer e.g. TCA9548 which creates up
135+
to eight channels (think of it as I2C subnets) which can use the complete
136+
address range of the device.
137+
138+
Drawback of using a multiplexer is that it takes more administration in
139+
your code e.g. which device is on which channel.
140+
This will slow down the access, which must be taken into account when
141+
deciding which devices are on which channel.
142+
Also note that switching between channels will slow down other devices
143+
too if they are behind the multiplexer.
144+
145+
- https://github.com/RobTillaart/TCA9548
146+
147+
128148
## Interface
129149

130150
```cpp
@@ -135,7 +155,7 @@ However when performance is needed you can try to overclock the chip.
135155
the include of "pcf8574.h" to overrule the default value used with the **begin()** call.
136156

137157

138-
#### Constructor
158+
### Constructor
139159

140160
- **PCF8574(uint8_t deviceAddress = 0x20, TwoWire \*wire = &Wire)** Constructor with optional address, default 0x20,
141161
and the optional Wire interface as parameter.
@@ -147,7 +167,7 @@ so one might need to call **read8()** and/or **write8()**. Returns true if addre
147167
- **uint8_t getAddress()** Returns the device address.
148168

149169

150-
#### Read and Write
170+
### Read and Write
151171

152172
- **uint8_t read8()** reads all 8 pins at once. This one does the actual reading.
153173
- **uint8_t read(uint8_t pin)** reads a single pin; pin = 0..7
@@ -159,7 +179,7 @@ value is HIGH(1) or LOW (0)
159179
- **uint8_t valueOut()** returns the last written data.
160180

161181

162-
#### Button
182+
### Button
163183

164184
The **"button"** functions are to be used when you mix input and output on one IC.
165185
It does not change / affect the pins used for output by masking these.
@@ -176,7 +196,7 @@ Note this can be a subset of the pins set with **setButtonMask()** if one wants
176196
Background - https://github.com/RobTillaart/Arduino/issues/38
177197

178198

179-
#### Special
199+
### Special
180200

181201
- **void toggle(const uint8_t pin)** toggles a single pin
182202
- **void toggleMask(const uint8_t mask = 0xFF)** toggles a selection of pins,
@@ -190,7 +210,7 @@ Fills the lower lines with zero's.
190210
- **void reverse()** reverse the "bit pattern" of the lines, swapping pin 7 with 0, 6 with 1, 5 with 2 etc.
191211

192212

193-
#### Select
213+
### Select
194214

195215
Some convenience wrappers.
196216

@@ -204,7 +224,7 @@ This can typical be used to implement a VU meter.
204224
- **void selectAll()** sets all pins to HIGH.
205225

206226

207-
#### Miscellaneous
227+
### Miscellaneous
208228

209229
- **int lastError()** returns the last error from the lib. (see .h file).
210230

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"url": "https://github.com/RobTillaart/PCF8574.git"
1717
},
18-
"version": "0.4.1",
18+
"version": "0.4.2",
1919
"license": "MIT",
2020
"frameworks": "*",
2121
"platforms": "*",

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=PCF8574
2-
version=0.4.1
2+
version=0.4.2
33
author=Rob Tillaart <rob.tillaart@gmail.com>
44
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
55
sentence=Arduino library for PCF8574 - 8 channel I2C IO expander

0 commit comments

Comments
 (0)