# davidclawson/openscope-2c53t architecture

> Architecture diagram of the GitHub repository davidclawson/openscope-2c53t, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/davidclawson/openscope-2c53t
- Repository: https://github.com/davidclawson/openscope-2c53t

## Overview

OpenScope 2C53T is replacement firmware for the FNIRSI handheld oscilloscope, multimeter, and signal generator. The user operates it through physical buttons: input handling changes instrument state, the firmware acquires data from the FPGA, and the display renders the resulting scope or meter view. The product also documents live FFT, waveform mask testing, math channels, protocol decoders, settings, and firmware recovery. Edges follow the excerpts and README; some feature implementation details and unsampled call sites are not shown, so those links are documented at subsystem level rather than inferred as precise calls.

Main entry points: [`firmware/src/main.c`](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/main.c) (Firmware runtime), [`firmware/src/ui/scope_ui.c`](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/ui/scope_ui.c) (Scope display), [`firmware/src/tasks/input_handler.c`](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/tasks/input_handler.c) (Input handling), [`firmware/src/drivers/fpga.c`](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/drivers/fpga.c) (FPGA acquisition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Interaction and display"]
  node_button_scan["Button scanning<br/>[button_scan.h]"]
  node_input_handler["Input handling<br/>[input_handler.c]"]
  node_app["Firmware runtime<br/>[main.c]"]
  node_display["LCD rendering<br/>[lcd.h]"]
  node_scope_ui["Scope display<br/>[scope_ui.c]"]
  node_meter_ui["Meter display<br/>[meter_ui.c]"]
end

subgraph group_acquisition["Acquisition and analysis"]
  node_fpga["FPGA acquisition<br/>[fpga.c]"]
  node_mask["Waveform mask<br/>[scope_mask.h]"]
  node_fft["FFT analysis<br/>[fft.c]"]
  node_cmsis["DSP primitives<br/>[arm_cfft_f32.c]"]
  node_math_channel["Math channels<br/>[math_channel.c]"]
  node_decoders["Protocol decoders<br/>[decoder.h]"]
end

subgraph group_instrument["Instrument modes"]
  node_meter["Multimeter mode<br/>[meter_ui.c]"]
  node_signal_generator["Signal generator<br/>[signal_gen.c]"]
  node_settings[("Settings persistence<br/>[persistence.h]")]
end

subgraph group_recovery["Firmware recovery"]
  node_bootloader["USB HID bootloader<br/>[main.c]"]
end

node_operator(("Instrument operator"))
node_usb_host(("USB host"))

node_operator -->|"presses"| node_button_scan
node_button_scan -->|"dispatches buttons"| node_input_handler
node_input_handler -->|"requests mask tests"| node_mask
node_input_handler -->|"queues display commands"| node_app
node_app -->|"configures acquisition"| node_fpga
node_app -->|"draws instrument screens"| node_display
node_app -->|"loads settings"| node_settings
node_fpga -->|"supplies captures"| node_scope_ui
node_scope_ui -->|"renders waveforms"| node_display
node_mask -->|"provides overlay"| node_scope_ui
node_fpga -->|"tests committed records"| node_mask
node_scope_ui -->|"shows live FFT"| node_fft
node_fft -.->|"uses transforms"| node_cmsis
node_app -->|"selects meter mode"| node_meter
node_meter -->|"renders readings"| node_display
node_app -->|"initializes generator"| node_signal_generator
node_operator -.->|"uses decoded protocols"| node_decoders
node_scope_ui -.->|"offers math views"| node_math_channel
node_usb_host -->|"sends firmware updates"| node_bootloader

click node_button_scan "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/drivers/button_scan.h"
click node_input_handler "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/tasks/input_handler.c"
click node_app "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/main.c"
click node_display "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/drivers/lcd.h"
click node_scope_ui "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/ui/scope_ui.c"
click node_meter_ui "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/ui/meter_ui.c"
click node_fpga "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/drivers/fpga.c"
click node_mask "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/ui/scope_mask.h"
click node_fft "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/dsp/fft.c"
click node_cmsis "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/CMSIS-DSP/Source/TransformFunctions/arm_cfft_f32.c"
click node_math_channel "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/dsp/math_channel.c"
click node_decoders "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/decode/decoder.h"
click node_meter "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/ui/meter_ui.c"
click node_signal_generator "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/dsp/signal_gen.c"
click node_settings "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/ui/persistence.h"
click node_bootloader "https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/bootloader/src/main.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_button_scan,node_input_handler,node_app,node_display,node_scope_ui,node_meter_ui toneBlue
class node_fpga,node_mask,node_fft,node_cmsis,node_math_channel,node_decoders toneAmber
class node_meter,node_signal_generator,node_settings toneMint
class node_bootloader toneRose
class node_operator,node_usb_host toneIndigo
```

## Components

### Interaction and display

- [Button scanning](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/drivers/button_scan.h): `firmware/src/drivers/button_scan.h`
- [Input handling](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/tasks/input_handler.c): `firmware/src/tasks/input_handler.c`
- [Firmware runtime](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/main.c): `firmware/src/main.c`
- [LCD rendering](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/drivers/lcd.h): `firmware/src/drivers/lcd.h`
- [Scope display](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/ui/scope_ui.c): `firmware/src/ui/scope_ui.c`
- [Meter display](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/ui/meter_ui.c): `firmware/src/ui/meter_ui.c`

### Acquisition and analysis

- [FPGA acquisition](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/drivers/fpga.c): `firmware/src/drivers/fpga.c`
- [Waveform mask](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/ui/scope_mask.h): `firmware/src/ui/scope_mask.h`
- [FFT analysis](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/dsp/fft.c): `firmware/src/dsp/fft.c`
- [DSP primitives](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/CMSIS-DSP/Source/TransformFunctions/arm_cfft_f32.c): `firmware/CMSIS-DSP/Source/TransformFunctions/arm_cfft_f32.c`
- [Math channels](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/dsp/math_channel.c): `firmware/src/dsp/math_channel.c`
- [Protocol decoders](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/decode/decoder.h): `firmware/src/decode/decoder.h`

### Instrument modes

- [Multimeter mode](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/ui/meter_ui.c): `firmware/src/ui/meter_ui.c`
- [Signal generator](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/dsp/signal_gen.c): `firmware/src/dsp/signal_gen.c`
- [Settings persistence](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/src/ui/persistence.h): `firmware/src/ui/persistence.h`

### Firmware recovery

- [USB HID bootloader](https://github.com/davidclawson/openscope-2c53t/blob/main/firmware/bootloader/src/main.c): `firmware/bootloader/src/main.c`

### Other components

- **Instrument operator**
- **USB host**

## Connections

- Instrument operator → Button scanning: presses (evidence: `README.md`)
- Button scanning → Input handling: dispatches buttons (evidence: `firmware/src/drivers/button_scan.h`)
- Input handling → Waveform mask: requests mask tests (evidence: `firmware/src/tasks/input_handler.c`)
- Input handling → Firmware runtime: queues display commands
- Firmware runtime → FPGA acquisition: configures acquisition (evidence: `firmware/src/main.c`)
- Firmware runtime → LCD rendering: draws instrument screens (evidence: `firmware/src/main.c`)
- Firmware runtime → Settings persistence: loads settings (evidence: `firmware/src/main.c`)
- FPGA acquisition → Scope display: supplies captures (evidence: `README.md`)
- Scope display → LCD rendering: renders waveforms (evidence: `README.md`)
- Waveform mask → Scope display: provides overlay (evidence: `firmware/src/ui/scope_mask.h`)
- FPGA acquisition → Waveform mask: tests committed records (evidence: `firmware/src/ui/scope_mask.h`)
- Scope display → FFT analysis: shows live FFT (evidence: `README.md`)
- FFT analysis → DSP primitives: uses transforms
- Firmware runtime → Multimeter mode: selects meter mode (evidence: `firmware/src/main.c`)
- Multimeter mode → LCD rendering: renders readings (evidence: `README.md`)
- Firmware runtime → Signal generator: initializes generator (evidence: `firmware/src/main.c`)
- Instrument operator → Protocol decoders: uses decoded protocols
- Scope display → Math channels: offers math views
- USB host → USB HID bootloader: sends firmware updates (evidence: `firmware/bootloader/src/main.c`)
