# robtillaart/ad56x8 architecture

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

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

## Overview

AD56X8 is a small Arduino runtime library for controlling eight-channel 12/14/16-bit DACs. An Arduino sketch instantiates a resolution-specific class, initializes it, then sets or prepares channel values and control modes. The library validates and caches values, frames device commands, and sends them through hardware or software SPI; optional LDAC GPIO pulses coordinate updates. The sampled implementation supports power, reset, clear-code, percentage, SPI-speed, and LDAC-mask operations. Hardware behavior itself was not inspected.

Main entry points: [`AD56X8.cpp`](https://github.com/robtillaart/ad56x8/blob/master/AD56X8.cpp) (Command Framing), [`AD56X8.h`](https://github.com/robtillaart/ad56x8/blob/master/AD56X8.h) (Control API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Application Layer"]
end

subgraph group_control["DAC Control"]
  node_dac_variants["DAC Variants<br/>[AD56X8.h]"]
  node_control_api["Control API<br/>[AD56X8.h]"]
  node_value_cache["Value Cache<br/>[AD56X8.cpp]"]
  node_ldac_controls["LDAC Controls<br/>[AD56X8.cpp]"]
  node_power_reset["Power Reset Controls<br/>[AD56X8.cpp]"]
end

subgraph group_transport["SPI Transport"]
  node_command_framing["Command Framing<br/>[AD56X8.cpp]"]
  node_spi_transfer["SPI Transfer<br/>[AD56X8.cpp]"]
  node_gpio_transport["GPIO Transport<br/>[AD56X8.cpp]"]
end

subgraph group_hardware["DAC Hardware"]
  node_dac_device["Eight-Channel DAC"]
end

node_arduino_sketch(("Arduino Sketch"))
node_spi_service["SPI Peripheral"]

node_arduino_sketch -->|"instantiates"| node_dac_variants
node_arduino_sketch -->|"calls API"| node_control_api
node_control_api -->|"reads writes"| node_value_cache
node_control_api -->|"dispatches commands"| node_command_framing
node_ldac_controls -->|"reads mask"| node_value_cache
node_ldac_controls -->|"dispatches latch"| node_command_framing
node_power_reset -->|"dispatches controls"| node_command_framing
node_command_framing -->|"frames transfer"| node_spi_transfer
node_spi_transfer -.->|"uses hardware SPI"| node_spi_service
node_spi_transfer -.->|"uses software SPI"| node_gpio_transport
node_spi_service -->|"sends frames"| node_dac_device
node_gpio_transport -->|"sends frames"| node_dac_device
node_ldac_controls -.->|"pulses LDAC"| node_gpio_transport

click node_dac_variants "https://github.com/robtillaart/ad56x8/blob/master/AD56X8.h"
click node_control_api "https://github.com/robtillaart/ad56x8/blob/master/AD56X8.h"
click node_value_cache "https://github.com/robtillaart/ad56x8/blob/master/AD56X8.cpp"
click node_ldac_controls "https://github.com/robtillaart/ad56x8/blob/master/AD56X8.cpp"
click node_power_reset "https://github.com/robtillaart/ad56x8/blob/master/AD56X8.cpp"
click node_command_framing "https://github.com/robtillaart/ad56x8/blob/master/AD56X8.cpp"
click node_spi_transfer "https://github.com/robtillaart/ad56x8/blob/master/AD56X8.cpp"
click node_gpio_transport "https://github.com/robtillaart/ad56x8/blob/master/AD56X8.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_dac_variants,node_control_api,node_value_cache,node_ldac_controls,node_power_reset toneAmber
class node_command_framing,node_spi_transfer,node_gpio_transport toneMint
class node_dac_device toneRose
class node_arduino_sketch,node_spi_service toneIndigo
```

## Components

### DAC Control

- [DAC Variants](https://github.com/robtillaart/ad56x8/blob/master/AD56X8.h): `AD56X8.h`
- [Control API](https://github.com/robtillaart/ad56x8/blob/master/AD56X8.h): `AD56X8.h`
- [Value Cache](https://github.com/robtillaart/ad56x8/blob/master/AD56X8.cpp): `AD56X8.cpp`
- [LDAC Controls](https://github.com/robtillaart/ad56x8/blob/master/AD56X8.cpp): `AD56X8.cpp`
- [Power Reset Controls](https://github.com/robtillaart/ad56x8/blob/master/AD56X8.cpp): `AD56X8.cpp`

### SPI Transport

- [Command Framing](https://github.com/robtillaart/ad56x8/blob/master/AD56X8.cpp): `AD56X8.cpp`
- [SPI Transfer](https://github.com/robtillaart/ad56x8/blob/master/AD56X8.cpp): `AD56X8.cpp`
- [GPIO Transport](https://github.com/robtillaart/ad56x8/blob/master/AD56X8.cpp): `AD56X8.cpp`

### DAC Hardware

- **Eight-Channel DAC**

### Other components

- **Arduino Sketch**
- **SPI Peripheral**

## Connections

- Arduino Sketch → DAC Variants: instantiates
- Arduino Sketch → Control API: calls API
- Control API → Value Cache: reads writes
- Control API → Command Framing: dispatches commands
- LDAC Controls → Value Cache: reads mask
- LDAC Controls → Command Framing: dispatches latch
- Power Reset Controls → Command Framing: dispatches controls
- Command Framing → SPI Transfer: frames transfer
- SPI Transfer → SPI Peripheral: uses hardware SPI
- SPI Transfer → GPIO Transport: uses software SPI
- SPI Peripheral → Eight-Channel DAC: sends frames
- GPIO Transport → Eight-Channel DAC: sends frames
- LDAC Controls → GPIO Transport: pulses LDAC
