# inferi70/gp-2040-glyph architecture

> Architecture diagram of the GitHub repository inferi70/gp-2040-glyph, 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/inferi70/gp-2040-glyph
- Repository: https://github.com/inferi70/gp-2040-glyph

## Overview

GP2040-CE is configurable RP2040 gamepad firmware: board inputs become gamepad state, optional input-processing features modify behavior, and a selected input-mode driver exposes controller reports to a host. Its embedded web configurator manages mappings, profiles, peripherals, and feature settings; firmware storage persists configuration. The README also documents display, LED, audio, and customization features. The tree and README support these major branches, but only storage, one driver, and parts of layout/configurator code were sampled, so detailed wiring for other subsystems is omitted.

Main entry points: [`src/gp2040.cpp`](https://github.com/inferi70/gp-2040-glyph/blob/main/src/gp2040.cpp) (Firmware loop), [`www/src`](https://github.com/inferi70/gp-2040-glyph/tree/main/www/src) (Web configurator), [`src/storagemanager.cpp`](https://github.com/inferi70/gp-2040-glyph/blob/main/src/storagemanager.cpp) (Config and profiles), [`src/addons`](https://github.com/inferi70/gp-2040-glyph/tree/main/src/addons) (Feature addons)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Firmware Runtime"]
  node_firmware["Firmware loop<br/>[gp2040.cpp]"]
  node_gamepad["Gamepad state<br/>[gamepad.cpp]"]
  node_addons["Input addons<br/>[addonmanager.cpp]"]
end

subgraph group_protocols["Controller I/O"]
  node_drivers["Driver manager<br/>[drivermanager.cpp]"]
  node_usb["USB transport<br/>[usbdriver.cpp]"]
  node_platform_drivers["Platform drivers"]
end

subgraph group_settings["Configuration"]
  node_web_app["Web configurator"]
  node_web_api["Firmware web API<br/>[webconfig.cpp]"]
  node_storage[("Config and profiles<br/>[storagemanager.cpp]")]
  node_config_utils["Config serialization<br/>[config_utils.cpp]"]
  node_flash[("On-device flash<br/>[FlashPROM.cpp]")]
end

subgraph group_features["Features and UI"]
  node_layouts["Button layouts<br/>[layoutmanager.cpp]"]
  node_display["Display UI<br/>[GPGFX_UI.cpp]"]
  node_animations["LED animations"]
  node_addon_impl["Feature addons"]
end

subgraph group_boards["Board Support"]
  node_board_config["Board definitions"]
  node_peripherals["Peripheral manager"]
end

node_controls(("Physical controls"))
node_host(("Console or PC"))
node_web_user(("Configurator user"))

node_controls -->|"provides input"| node_firmware
node_firmware -->|"updates state"| node_gamepad
node_firmware -->|"dispatches processing"| node_addons
node_firmware -->|"selects mode"| node_drivers
node_drivers -->|"dispatches reports"| node_platform_drivers
node_platform_drivers -->|"sends reports"| node_usb
node_usb -->|"reports controls"| node_host
node_web_user -->|"configures"| node_web_app
node_web_app -->|"requests settings"| node_web_api
node_web_api -->|"reads and updates"| node_storage
node_storage -->|"serializes config"| node_config_utils
node_config_utils -->|"persists settings"| node_flash
node_storage -->|"resets storage"| node_flash
node_web_app -.->|"configures layouts"| node_layouts
node_display -.->|"uses layout definitions"| node_layouts
node_addons -->|"dispatches features"| node_addon_impl
node_board_config -.->|"defines hardware options"| node_peripherals
node_peripherals -.->|"supports peripherals"| node_addon_impl
node_animations -.->|"supports LED effects"| node_addon_impl

click node_firmware "https://github.com/inferi70/gp-2040-glyph/blob/main/src/gp2040.cpp"
click node_gamepad "https://github.com/inferi70/gp-2040-glyph/blob/main/src/gamepad.cpp"
click node_addons "https://github.com/inferi70/gp-2040-glyph/blob/main/src/addonmanager.cpp"
click node_drivers "https://github.com/inferi70/gp-2040-glyph/blob/main/src/drivermanager.cpp"
click node_usb "https://github.com/inferi70/gp-2040-glyph/blob/main/src/usbdriver.cpp"
click node_platform_drivers "https://github.com/inferi70/gp-2040-glyph/tree/main/src/drivers"
click node_web_app "https://github.com/inferi70/gp-2040-glyph/tree/main/www/src"
click node_web_api "https://github.com/inferi70/gp-2040-glyph/blob/main/src/webconfig.cpp"
click node_storage "https://github.com/inferi70/gp-2040-glyph/blob/main/src/storagemanager.cpp"
click node_config_utils "https://github.com/inferi70/gp-2040-glyph/blob/main/src/config_utils.cpp"
click node_flash "https://github.com/inferi70/gp-2040-glyph/blob/main/lib/FlashPROM/src/FlashPROM.cpp"
click node_layouts "https://github.com/inferi70/gp-2040-glyph/blob/main/src/layoutmanager.cpp"
click node_display "https://github.com/inferi70/gp-2040-glyph/blob/main/src/display/GPGFX_UI.cpp"
click node_animations "https://github.com/inferi70/gp-2040-glyph/blob/main/src/animationstation/animationstation.cpp"
click node_addon_impl "https://github.com/inferi70/gp-2040-glyph/tree/main/src/addons"
click node_board_config "https://github.com/inferi70/gp-2040-glyph/tree/main/configs"
click node_peripherals "https://github.com/inferi70/gp-2040-glyph/blob/main/src/peripheralmanager.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_firmware,node_gamepad,node_addons,node_web_user toneBlue
class node_drivers,node_usb,node_platform_drivers toneAmber
class node_web_app,node_web_api,node_storage,node_config_utils,node_flash toneMint
class node_layouts,node_display,node_animations,node_addon_impl toneRose
class node_board_config,node_peripherals,node_controls,node_host toneIndigo
```

## Components

### Firmware Runtime

- [Firmware loop](https://github.com/inferi70/gp-2040-glyph/blob/main/src/gp2040.cpp): `src/gp2040.cpp`
- [Gamepad state](https://github.com/inferi70/gp-2040-glyph/blob/main/src/gamepad.cpp): `src/gamepad.cpp`
- [Input addons](https://github.com/inferi70/gp-2040-glyph/blob/main/src/addonmanager.cpp): `src/addonmanager.cpp`

### Controller I/O

- [Driver manager](https://github.com/inferi70/gp-2040-glyph/blob/main/src/drivermanager.cpp): `src/drivermanager.cpp`
- [USB transport](https://github.com/inferi70/gp-2040-glyph/blob/main/src/usbdriver.cpp): `src/usbdriver.cpp`
- [Platform drivers](https://github.com/inferi70/gp-2040-glyph/tree/main/src/drivers): `src/drivers`

### Configuration

- [Web configurator](https://github.com/inferi70/gp-2040-glyph/tree/main/www/src): `www/src`
- [Firmware web API](https://github.com/inferi70/gp-2040-glyph/blob/main/src/webconfig.cpp): `src/webconfig.cpp`
- [Config and profiles](https://github.com/inferi70/gp-2040-glyph/blob/main/src/storagemanager.cpp): `src/storagemanager.cpp`
- [Config serialization](https://github.com/inferi70/gp-2040-glyph/blob/main/src/config_utils.cpp): `src/config_utils.cpp`
- [On-device flash](https://github.com/inferi70/gp-2040-glyph/blob/main/lib/FlashPROM/src/FlashPROM.cpp): `lib/FlashPROM/src/FlashPROM.cpp`

### Features and UI

- [Button layouts](https://github.com/inferi70/gp-2040-glyph/blob/main/src/layoutmanager.cpp): `src/layoutmanager.cpp`
- [Display UI](https://github.com/inferi70/gp-2040-glyph/blob/main/src/display/GPGFX_UI.cpp): `src/display/GPGFX_UI.cpp`
- [LED animations](https://github.com/inferi70/gp-2040-glyph/blob/main/src/animationstation/animationstation.cpp): `src/animationstation/animationstation.cpp`
- [Feature addons](https://github.com/inferi70/gp-2040-glyph/tree/main/src/addons): `src/addons`

### Board Support

- [Board definitions](https://github.com/inferi70/gp-2040-glyph/tree/main/configs): `configs`
- [Peripheral manager](https://github.com/inferi70/gp-2040-glyph/blob/main/src/peripheralmanager.cpp): `src/peripheralmanager.cpp`

### Other components

- **Physical controls**
- **Console or PC**
- **Configurator user**

## Connections

- Physical controls → Firmware loop: provides input
- Firmware loop → Gamepad state: updates state
- Firmware loop → Input addons: dispatches processing
- Firmware loop → Driver manager: selects mode
- Driver manager → Platform drivers: dispatches reports
- Platform drivers → USB transport: sends reports
- USB transport → Console or PC: reports controls
- Configurator user → Web configurator: configures
- Web configurator → Firmware web API: requests settings
- Firmware web API → Config and profiles: reads and updates
- Config and profiles → Config serialization: serializes config
- Config serialization → On-device flash: persists settings
- Config and profiles → On-device flash: resets storage
- Web configurator → Button layouts: configures layouts
- Display UI → Button layouts: uses layout definitions
- Input addons → Feature addons: dispatches features
- Board definitions → Peripheral manager: defines hardware options
- Peripheral manager → Feature addons: supports peripherals
- LED animations → Feature addons: supports LED effects
