# robtillaart/pcf8574 architecture

> Architecture diagram of the GitHub repository robtillaart/pcf8574, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/robtillaart/pcf8574
- Repository: https://github.com/robtillaart/pcf8574

## Overview

PCF8574 is a small Arduino library for controlling an eight-pin I2C expander. A sketch configures the library and uses its API for pin-level or whole-port reads and writes; optional helpers support button reads, array transfers, and output-bit transformations. The implementation buffers input and output values and communicates through Arduino’s Wire interface with the expander. The README says interrupt handling is user-owned, not implemented by the library. The graph reflects the sampled core source; examples and unsampled code are not mapped.

Main entry points: [`PCF8574.cpp`](https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp) (Pin and port I/O), [`PCF8574.h`](https://github.com/robtillaart/pcf8574/blob/master/PCF8574.h) (PCF8574 API)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_sketch(("Arduino sketch"))
node_api["PCF8574 API<br/>[PCF8574.h]"]
node_lifecycle["Device setup<br/>[PCF8574.cpp]"]
node_scalar["Pin and port I/O<br/>[PCF8574.cpp]"]
node_arrays["Array transfers<br/>[PCF8574.cpp]"]
node_buttons["Button reads<br/>[PCF8574.cpp]"]
node_transforms["Output transforms<br/>[PCF8574.cpp]"]
node_buffer[("I/O buffers<br/>[PCF8574.cpp]")]
node_wire["Arduino Wire"]
node_expander["PCF8574 device"]

node_sketch -->|"uses"| node_api
node_api -->|"implements"| node_lifecycle
node_lifecycle -->|"initializes via"| node_scalar
node_scalar -->|"transfers I2C"| node_wire
node_arrays -->|"transfers I2C"| node_wire
node_buttons -->|"calls"| node_scalar
node_transforms -->|"writes via"| node_scalar
node_scalar -->|"updates"| node_buffer
node_arrays -->|"updates"| node_buffer
node_wire -.->|"communicates with"| node_expander

click node_api "https://github.com/robtillaart/pcf8574/blob/master/PCF8574.h"
click node_lifecycle "https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp"
click node_scalar "https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp"
click node_arrays "https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp"
click node_buttons "https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp"
click node_transforms "https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp"
click node_buffer "https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sketch,node_wire,node_expander toneIndigo
class node_api toneMint
class node_lifecycle,node_scalar,node_arrays,node_buttons,node_transforms toneTeal
class node_buffer toneAmber
```

## Components

### Other components

- **Arduino sketch**
- [PCF8574 API](https://github.com/robtillaart/pcf8574/blob/master/PCF8574.h): `PCF8574.h`
- [Device setup](https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp): `PCF8574.cpp`
- [Pin and port I/O](https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp): `PCF8574.cpp`
- [Array transfers](https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp): `PCF8574.cpp`
- [Button reads](https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp): `PCF8574.cpp`
- [Output transforms](https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp): `PCF8574.cpp`
- [I/O buffers](https://github.com/robtillaart/pcf8574/blob/master/PCF8574.cpp): `PCF8574.cpp`
- **Arduino Wire**
- **PCF8574 device**

## Connections

- Arduino sketch → PCF8574 API: uses (evidence: `README.md`)
- PCF8574 API → Device setup: implements (evidence: `PCF8574.cpp`)
- Device setup → Pin and port I/O: initializes via (evidence: `PCF8574.cpp`)
- Pin and port I/O → Arduino Wire: transfers I2C (evidence: `PCF8574.cpp`)
- Array transfers → Arduino Wire: transfers I2C (evidence: `PCF8574.cpp`)
- Button reads → Pin and port I/O: calls (evidence: `PCF8574.cpp`)
- Output transforms → Pin and port I/O: writes via (evidence: `PCF8574.cpp`)
- Pin and port I/O → I/O buffers: updates (evidence: `PCF8574.cpp`)
- Array transfers → I/O buffers: updates (evidence: `PCF8574.cpp`)
- Arduino Wire → PCF8574 device: communicates with
