An implementation of the GpioExpanderAdapter RobTillaart's PCF8575 library.
Note: You may need to call Wire.begin() in your sketch (if not already called) as the underlying library does not do so.
Repository: https://github.com/RobTillaart/PCF8575
#include <RobTillaartPCF8575ExpanderAdapter.h>
◆ RobTillaartPCF8575ExpanderAdapter() [1/2]
| RobTillaartPCF8575ExpanderAdapter::RobTillaartPCF8575ExpanderAdapter |
( |
const uint8_t |
deviceAddress, |
|
|
TwoWire * |
wire = &Wire |
|
) |
| |
|
inline |
◆ RobTillaartPCF8575ExpanderAdapter() [2/2]
| RobTillaartPCF8575ExpanderAdapter::RobTillaartPCF8575ExpanderAdapter |
( |
PCF8575 & |
_pcf | ) |
|
|
inline |
◆ attachPin()
| void RobTillaartPCF8575ExpanderAdapter::attachPin |
( |
byte |
pin, |
|
|
int |
mode = INPUT_PULLUP |
|
) |
| |
|
inlineoverridevirtual |
Attach a pin and set its pin mode.
- Parameters
-
| pin | The pin number on the expander |
| mode | Default INPUT_PULLUP |
Implements GpioExpanderAdapter.
◆ begin()
| void RobTillaartPCF8575ExpanderAdapter::begin |
( |
| ) |
|
|
inlineoverridevirtual |
◆ canWrite()
| bool RobTillaartPCF8575ExpanderAdapter::canWrite |
( |
| ) |
|
|
inline |
The MCP23017 can write a pins state.
- Returns
- true
◆ read()
| bool RobTillaartPCF8575ExpanderAdapter::read |
( |
byte |
pin | ) |
|
|
inlineoverridevirtual |
Returns the state of a pin on the expander.
- Parameters
-
| pin | The pin number on the expander |
- Returns
- true/HIGH
-
false/LOW
Implements GpioExpanderAdapter.
◆ update()
| void RobTillaartPCF8575ExpanderAdapter::update |
( |
| ) |
|
|
inlineoverridevirtual |
Update the state of all input pins (called from loop() before updating EventButtons)
Implements GpioExpanderAdapter.
◆ updateAndRead()
| bool RobTillaartPCF8575ExpanderAdapter::updateAndRead |
( |
byte |
pin | ) |
|
|
inline |
Update the expander over I2C and return a pin state. Not recommended, use a single uptate() and then multiple pin read()s in loop().
- Parameters
-
| pin | The pin number on the expander board |
- Returns
- true/HIGH
-
false/LOW
◆ write()
| void RobTillaartPCF8575ExpanderAdapter::write |
( |
byte |
pin, |
|
|
bool |
state |
|
) |
| |
|
inline |
Write bool state to a pin.
- Parameters
-
| pin | The pin number on the expander |
| state | true/false or HIGH/LOW |
The documentation for this class was generated from the following file: