|
|
| PCF8574 (TwoWire &wire, const uint8_t deviceAddress=0x20) |
| | Bind the bus and 7-bit device address (default 0x20).
|
| bool | begin (uint8_t value=PCF8574_INITIAL_VALUE) |
| | Probe the address and set the output latch to value. Initialize the I2C bus first.
|
|
bool | isConnected () |
| | Probe the device address and return whether it acknowledges.
|
|
bool | setAddress (const uint8_t deviceAddress) |
| | Change the host-side 7-bit address and probe it; does not reprogram hardware. Refresh cached inputs/outputs with read8()/write8() after changing address.
|
| uint8_t | getAddress () const |
| | Return the configured host-side 7-bit address.
|
|
uint8_t | read8 () |
| | Read all eight input levels and cache them; inspect lastError() for I2C failure.
|
|
uint8_t | read (const uint8_t pin) |
| | Read pin 0 through 7 as 0/1; invalid pins set PCF8574_PIN_ERROR.
|
| uint8_t | value () const |
| | Return the last cached input byte without bus access.
|
|
void | write8 (const uint8_t value) |
| | Write and cache all eight output latch bits.
|
|
void | write (const uint8_t pin, const uint8_t value) |
| | Update one output latch bit for pin 0 through 7.
|
| uint8_t | valueOut () const |
| | Return the cached output latch byte without bus access.
|
| uint8_t | readButton8 () |
| | Read button inputs using the configured button mask.
|
|
uint8_t | readButton8 (const uint8_t mask) |
| | Temporarily release the pins in mask, read inputs, and restore the output latch.
|
|
uint8_t | readButton (const uint8_t pin) |
| | Release and read one button pin, then restore its output latch state.
|
| void | setButtonMask (const uint8_t mask) |
| | Cache the mask of pins released by the no-argument readButton8().
|
| uint8_t | getButtonMask () const |
| | Return the configured button mask.
|
|
void | toggle (const uint8_t pin) |
| | Invert one cached output bit and write the latch; pin must be 0 through 7.
|
|
void | toggleMask (const uint8_t mask=0xFF) |
| | Invert output latch bits selected by mask; default inverts all eight.
|
|
void | shiftRight (const uint8_t n=1) |
| | Shift the output latch right by n bits, filling with zeros.
|
|
void | shiftLeft (const uint8_t n=1) |
| | Shift the output latch left by n bits, filling with zeros.
|
|
void | rotateRight (const uint8_t n=1) |
| | Rotate the eight output bits right by n positions.
|
|
void | rotateLeft (const uint8_t n=1) |
| | Rotate the eight output bits left by n positions.
|
|
void | reverse () |
| | Reverse the order of the eight output bits and write the latch.
|
|
void | select (const uint8_t pin) |
| | Set only the selected output pin high; pin must be 0 through 7.
|
|
void | selectN (const uint8_t pin) |
| | Write the mask (2 << pin) - 1 for pin 0 through 7; other values write 0xFF.
|
| void | selectNone () |
| | Drive all eight output latch bits low.
|
| void | selectAll () |
| | Release all eight pins by writing all output latch bits high.
|
|
int | lastError () |
| | Return and clear the stored error (PCF8574_OK means no error).
|
PCF8574 eight-pin quasi-bidirectional I2C expander. Call begin() first. Release input pins by writing 1; check lastError() after I/O.