# jpbruijstens/embedded_production architecture

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

- Interactive diagram: https://gitdiagram.com/jpbruijstens/embedded_production
- Repository: https://github.com/jpbruijstens/embedded_production

## Overview

This is a Raspberry Pi Pico LED controller. Its principal workflow turns potentiometer, rotary-encoder, and IR-remote input into LED channel/volume state and updates a WS2812 strip and two PMOD OLED displays. The sampled code supports ADC/DMA volume processing, encoder-driven LED/display updates, and both predefined and learnable IR control. IR capture dispatch details and some unsampled module behavior are uncertain, so those connections are omitted; paths for documented but unsampled hardware subsystems use their exact source files.

Main entry points: [`main.c`](https://github.com/jpbruijstens/embedded_production/blob/main/main.c) (Startup and loop), [`adc_volume.c`](https://github.com/jpbruijstens/embedded_production/blob/main/adc_volume.c) (ADC volume), [`ir_remote.c`](https://github.com/jpbruijstens/embedded_production/blob/main/ir_remote.c) (Remote decoding), [`ws2812_led.c`](https://github.com/jpbruijstens/embedded_production/blob/main/ws2812_led.c) (LED control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Startup and loop<br/>[main.c]"]
  node_state["Shared state<br/>[global.c]"]
end

subgraph group_input["Input and control"]
  node_gpio_irq["GPIO interrupts<br/>[gpio_interrupt.c]"]
  node_adc["ADC volume<br/>[adc_volume.c]"]
  node_dma["ADC DMA<br/>[dma.c]"]
  node_rotary["Encoder processing<br/>[rotary_encoder.c]"]
  node_ir_capture["IR capture<br/>[ir_reader.c]"]
  node_ir_remote["Remote decoding<br/>[ir_remote.c]"]
end

subgraph group_output["LED output"]
  node_led_control["LED control<br/>[ws2812_led.c]"]
  node_pio["WS2812 PIO<br/>[ws2812.pio]"]
end

subgraph group_display["Display"]
  node_pmod["Display rendering<br/>[pmod.c]"]
end

node_operator(("Operator"))
node_pot(("Potentiometer"))
node_encoder(("Rotary encoder"))
node_remote(("IR remote"))
node_strip["WS2812 strip"]
node_oleds["Dual OLEDs"]

node_operator -->|"adjusts"| node_pot
node_operator -->|"rotates"| node_encoder
node_operator -->|"presses"| node_remote
node_main -->|"initializes"| node_adc
node_main -->|"starts"| node_dma
node_main -->|"initializes"| node_rotary
node_main -->|"initializes"| node_ir_remote
node_main -->|"initializes"| node_gpio_irq
node_main -->|"initializes"| node_led_control
node_main -->|"initializes"| node_pmod
node_pot -->|"sets level"| node_adc
node_adc -->|"configures sampling"| node_dma
node_dma -->|"updates volume"| node_adc
node_adc -->|"selects color"| node_led_control
node_adc -->|"refreshes bars"| node_pmod
node_encoder -->|"signals rotation"| node_rotary
node_rotary -->|"updates channel"| node_led_control
node_rotary -->|"refreshes displays"| node_pmod
node_remote -->|"sends commands"| node_ir_remote
node_ir_remote -->|"changes channel"| node_led_control
node_ir_remote -->|"adjusts volume"| node_adc
node_ir_capture -->|"records edges"| node_state
node_ir_remote -->|"reads capture state"| node_state
node_ir_capture -->|"shows learning prompts"| node_pmod
node_led_control -->|"writes pixel data"| node_pio
node_pio -->|"drives"| node_strip
node_pmod -->|"sends display data"| node_oleds

click node_main "https://github.com/jpbruijstens/embedded_production/blob/main/main.c"
click node_state "https://github.com/jpbruijstens/embedded_production/blob/main/global.c"
click node_gpio_irq "https://github.com/jpbruijstens/embedded_production/blob/main/gpio_interrupt.c"
click node_adc "https://github.com/jpbruijstens/embedded_production/blob/main/adc_volume.c"
click node_dma "https://github.com/jpbruijstens/embedded_production/blob/main/dma.c"
click node_rotary "https://github.com/jpbruijstens/embedded_production/blob/main/rotary_encoder.c"
click node_ir_capture "https://github.com/jpbruijstens/embedded_production/blob/main/ir_reader.c"
click node_ir_remote "https://github.com/jpbruijstens/embedded_production/blob/main/ir_remote.c"
click node_led_control "https://github.com/jpbruijstens/embedded_production/blob/main/ws2812_led.c"
click node_pio "https://github.com/jpbruijstens/embedded_production/blob/main/ws2812.pio"
click node_pmod "https://github.com/jpbruijstens/embedded_production/blob/main/pmod.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_state toneBlue
class node_gpio_irq,node_adc,node_dma,node_rotary,node_ir_capture,node_ir_remote toneAmber
class node_led_control,node_pio toneMint
class node_pmod toneRose
class node_operator,node_pot,node_encoder,node_remote,node_strip,node_oleds toneIndigo
```

## Components

### Application

- [Startup and loop](https://github.com/jpbruijstens/embedded_production/blob/main/main.c): `main.c`
- [Shared state](https://github.com/jpbruijstens/embedded_production/blob/main/global.c): `global.c`

### Input and control

- [GPIO interrupts](https://github.com/jpbruijstens/embedded_production/blob/main/gpio_interrupt.c): `gpio_interrupt.c`
- [ADC volume](https://github.com/jpbruijstens/embedded_production/blob/main/adc_volume.c): `adc_volume.c`
- [ADC DMA](https://github.com/jpbruijstens/embedded_production/blob/main/dma.c): `dma.c`
- [Encoder processing](https://github.com/jpbruijstens/embedded_production/blob/main/rotary_encoder.c): `rotary_encoder.c`
- [IR capture](https://github.com/jpbruijstens/embedded_production/blob/main/ir_reader.c): `ir_reader.c`
- [Remote decoding](https://github.com/jpbruijstens/embedded_production/blob/main/ir_remote.c): `ir_remote.c`

### LED output

- [LED control](https://github.com/jpbruijstens/embedded_production/blob/main/ws2812_led.c): `ws2812_led.c`
- [WS2812 PIO](https://github.com/jpbruijstens/embedded_production/blob/main/ws2812.pio): `ws2812.pio`

### Display

- [Display rendering](https://github.com/jpbruijstens/embedded_production/blob/main/pmod.c): `pmod.c`

### Other components

- **Operator**
- **Potentiometer**
- **Rotary encoder**
- **IR remote**
- **WS2812 strip**
- **Dual OLEDs**

## Connections

- Operator → Potentiometer: adjusts
- Operator → Rotary encoder: rotates
- Operator → IR remote: presses
- Startup and loop → ADC volume: initializes
- Startup and loop → ADC DMA: starts
- Startup and loop → Encoder processing: initializes
- Startup and loop → Remote decoding: initializes
- Startup and loop → GPIO interrupts: initializes
- Startup and loop → LED control: initializes
- Startup and loop → Display rendering: initializes
- Potentiometer → ADC volume: sets level
- ADC volume → ADC DMA: configures sampling
- ADC DMA → ADC volume: updates volume
- ADC volume → LED control: selects color
- ADC volume → Display rendering: refreshes bars
- Rotary encoder → Encoder processing: signals rotation
- Encoder processing → LED control: updates channel
- Encoder processing → Display rendering: refreshes displays
- IR remote → Remote decoding: sends commands
- Remote decoding → LED control: changes channel
- Remote decoding → ADC volume: adjusts volume
- IR capture → Shared state: records edges
- Remote decoding → Shared state: reads capture state
- IR capture → Display rendering: shows learning prompts
- LED control → WS2812 PIO: writes pixel data
- WS2812 PIO → WS2812 strip: drives
- Display rendering → Dual OLEDs: sends display data
