# ofpr/fuoz architecture

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

- Interactive diagram: https://gitdiagram.com/ofpr/fuoz
- Repository: https://github.com/ofpr/fuoz

## Overview

FUOZ is AVR firmware for timed engine ignition, configured for transistor-controlled (TCI) or capacitor-discharge (CDI) operation. The main workflow initializes timer and external-interrupt handling; an engine trigger lets the interrupt handler calculate ignition timing, then timer compare events switch the ignition output. The sampled code also contains optional thermistor conversion and an LCD driver, but the main loop has their use commented out. The graph reflects the inspected excerpts; it does not establish wiring for those optional modules or hardware beyond the pin-level behavior shown.

Main entry points: [`fuoz/formirovatelj.c`](https://github.com/ofpr/fuoz/blob/master/fuoz/formirovatelj.c) (Ignition Timing), [`fuoz/fuoz.c`](https://github.com/ofpr/fuoz/blob/master/fuoz/fuoz.c) (Firmware Main), [`fuoz/term.c`](https://github.com/ofpr/fuoz/blob/master/fuoz/term.c) (Temperature Readout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Ignition Control"]
  node_main["Firmware Main<br/>[fuoz.c]"]
  node_ignition["Ignition Timing<br/>[formirovatelj.c]"]
  node_timer["AVR Timer"]
end

subgraph group_sensors["Optional Sensing"]
  node_temperature["Temperature Readout<br/>[term.c]"]
end

subgraph group_display["Display Support"]
  node_lcd["LCD Interface<br/>[lcd_lib.c]"]
end

node_engine(("Engine Trigger"))
node_driver["Ignition Switch"]
node_thermistor(("Thermistor"))

node_main -->|"initializes"| node_ignition
node_engine -->|"triggers interrupt"| node_ignition
node_ignition -->|"sets compare timing"| node_timer
node_timer -->|"dispatches compare ISRs"| node_ignition
node_ignition -->|"switches output pin"| node_driver
node_thermistor -.->|"provides ADC input"| node_temperature

click node_main "https://github.com/ofpr/fuoz/blob/master/fuoz/fuoz.c"
click node_ignition "https://github.com/ofpr/fuoz/blob/master/fuoz/formirovatelj.c"
click node_temperature "https://github.com/ofpr/fuoz/blob/master/fuoz/term.c"
click node_lcd "https://github.com/ofpr/fuoz/blob/master/fuoz/lcd_lib.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_main,node_ignition,node_timer toneBlue
class node_temperature toneAmber
class node_lcd toneMint
class node_engine,node_driver,node_thermistor toneIndigo
```

## Components

### Ignition Control

- [Firmware Main](https://github.com/ofpr/fuoz/blob/master/fuoz/fuoz.c): `fuoz/fuoz.c`
- [Ignition Timing](https://github.com/ofpr/fuoz/blob/master/fuoz/formirovatelj.c): `fuoz/formirovatelj.c`
- **AVR Timer**

### Optional Sensing

- [Temperature Readout](https://github.com/ofpr/fuoz/blob/master/fuoz/term.c): `fuoz/term.c`

### Display Support

- [LCD Interface](https://github.com/ofpr/fuoz/blob/master/fuoz/lcd_lib.c): `fuoz/lcd_lib.c`

### Other components

- **Engine Trigger**
- **Ignition Switch**
- **Thermistor**

## Connections

- Firmware Main → Ignition Timing: initializes (evidence: `fuoz/fuoz.c`)
- Engine Trigger → Ignition Timing: triggers interrupt (evidence: `fuoz/formirovatelj.c`)
- Ignition Timing → AVR Timer: sets compare timing (evidence: `fuoz/formirovatelj.c`)
- AVR Timer → Ignition Timing: dispatches compare ISRs (evidence: `fuoz/formirovatelj.c`)
- Ignition Timing → Ignition Switch: switches output pin (evidence: `fuoz/formirovatelj.c`)
- Thermistor → Temperature Readout: provides ADC input
