# scottcandy34/ads1256-linux-driver architecture

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

- Interactive diagram: https://gitdiagram.com/scottcandy34/ads1256-linux-driver
- Repository: https://github.com/scottcandy34/ads1256-linux-driver

## Overview

This repository is a Raspberry Pi Linux kernel driver and example client for the ADS1256 ADC. The principal workflow configures channel MUX selections and acquisition settings, captures timestamped conversions over SPI, optionally buffers samples, and exposes them through character devices and sysfs. The README documents broader controls—including sensor detection, calibration, dropped-sample reporting, and multi-device synchronization—than the sampled driver excerpts establish in detail; those capabilities are represented without asserting unverified internal call paths.

Main entry points: [`ads1256.c`](https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c) (ADS1256 driver), [`read_ads1256.c`](https://github.com/scottcandy34/ads1256-linux-driver/blob/main/read_ads1256.c) (Sample client), [`ads1256-overlay.dts`](https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256-overlay.dts) (Hardware pin configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_example["Sample client<br/>[read_ads1256.c]"]
  node_char["Character devices<br/>[ads1256.c]"]
  node_sysfs["Sysfs controls<br/>[ads1256.c]"]
end

subgraph group_acquisition["ADC acquisition"]
  node_driver["ADS1256 driver<br/>[ads1256.c]"]
  node_config["MUX and settings<br/>[ads1256.c]"]
  node_sampling["Conversion sampling<br/>[ads1256.c]"]
  node_spi["SPI subsystem"]
  node_adc["ADS1256 hardware"]
  node_buffer[("Circular sample buffer<br/>[ads1256.c]")]
end

subgraph group_coordination["Device coordination"]
  node_device_tree["Hardware pin configuration"]
  node_gpio["GPIO subsystem"]
  node_sync["Shared device synchronization<br/>[ads1256.c]"]
end

node_user(("Applications and operators"))

node_user -->|"runs"| node_example
node_example -->|"configures and reads"| node_char
node_example -->|"reads gain"| node_sysfs
node_user -->|"writes and reads"| node_char
node_user -->|"configures and triggers"| node_sysfs
node_char -->|"dispatches operations"| node_driver
node_sysfs -->|"dispatches controls"| node_driver
node_driver -->|"applies settings"| node_config
node_driver -->|"requests conversions"| node_sampling
node_sampling -->|"transfers commands and data"| node_spi
node_spi -->|"communicates"| node_adc
node_sampling -->|"stores samples"| node_buffer
node_char -->|"reads buffered samples"| node_buffer
node_device_tree -->|"defines pin configuration"| node_gpio
node_driver -->|"uses configured pins"| node_gpio
node_sysfs -->|"triggers synchronization"| node_sync
node_sync -->|"pulses shared GPIO"| node_gpio
node_sync -->|"synchronizes instances"| node_driver

click node_example "https://github.com/scottcandy34/ads1256-linux-driver/blob/main/read_ads1256.c"
click node_char "https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c"
click node_sysfs "https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c"
click node_driver "https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c"
click node_config "https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c"
click node_sampling "https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c"
click node_buffer "https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c"
click node_device_tree "https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256-overlay.dts"
click node_sync "https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c"

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_example,node_char,node_sysfs toneBlue
class node_driver,node_config,node_sampling,node_spi,node_adc,node_buffer toneAmber
class node_device_tree,node_gpio,node_sync toneMint
class node_user toneIndigo
```

## Components

### User interfaces

- [Sample client](https://github.com/scottcandy34/ads1256-linux-driver/blob/main/read_ads1256.c): `read_ads1256.c`
- [Character devices](https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c): `ads1256.c`
- [Sysfs controls](https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c): `ads1256.c`

### ADC acquisition

- [ADS1256 driver](https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c): `ads1256.c`
- [MUX and settings](https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c): `ads1256.c`
- [Conversion sampling](https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c): `ads1256.c`
- **SPI subsystem**
- **ADS1256 hardware**
- [Circular sample buffer](https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c): `ads1256.c`

### Device coordination

- [Hardware pin configuration](https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256-overlay.dts): `ads1256-overlay.dts`
- **GPIO subsystem**
- [Shared device synchronization](https://github.com/scottcandy34/ads1256-linux-driver/blob/main/ads1256.c): `ads1256.c`

### Other components

- **Applications and operators**

## Connections

- Applications and operators → Sample client: runs
- Sample client → Character devices: configures and reads
- Sample client → Sysfs controls: reads gain
- Applications and operators → Character devices: writes and reads
- Applications and operators → Sysfs controls: configures and triggers
- Character devices → ADS1256 driver: dispatches operations
- Sysfs controls → ADS1256 driver: dispatches controls
- ADS1256 driver → MUX and settings: applies settings
- ADS1256 driver → Conversion sampling: requests conversions
- Conversion sampling → SPI subsystem: transfers commands and data
- SPI subsystem → ADS1256 hardware: communicates
- Conversion sampling → Circular sample buffer: stores samples
- Character devices → Circular sample buffer: reads buffered samples
- Hardware pin configuration → GPIO subsystem: defines pin configuration
- ADS1256 driver → GPIO subsystem: uses configured pins
- Sysfs controls → Shared device synchronization: triggers synchronization
- Shared device synchronization → GPIO subsystem: pulses shared GPIO
- Shared device synchronization → ADS1256 driver: synchronizes instances
