# portapack-mayhem/mayhem-firmware architecture

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

- Interactive diagram: https://gitdiagram.com/portapack-mayhem/mayhem-firmware
- Repository: https://github.com/portapack-mayhem/mayhem-firmware

## Overview

PortaPack Mayhem is firmware for the HackRF/PortaPack device. Its user-facing product is a collection of built-in and external applications, including radio receive/transmit tools, analysis utilities, and general-purpose apps. The tree also shows shared UI/navigation, radio-clock, I²C-device, and baseband-processing layers. The excerpts do not show the top-level boot path or most app-to-radio execution, so the graph keeps those connections conservative; listed app families reflect the repository tree rather than inspected implementations.

Main entry points: [`firmware/application/external/app_manager/ui_app_manager.cpp`](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/external/app_manager/ui_app_manager.cpp) (App manager), [`firmware/application/apps`](https://github.com/portapack-mayhem/mayhem-firmware/tree/next/firmware/application/apps) (Built-in apps), [`firmware/application/external`](https://github.com/portapack-mayhem/mayhem-firmware/tree/next/firmware/application/external) (External apps), [`firmware/application/ui_navigation.hpp`](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/ui_navigation.hpp) (App navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_user_apps["User applications"]
  node_builtins["Built-in apps"]
  node_external_apps["External apps"]
  node_app_manager["App manager<br/>[ui_app_manager.cpp]"]
end

subgraph group_shared_runtime["Shared runtime"]
  node_navigation["App navigation<br/>[ui_navigation.hpp]"]
  node_ui_framework["UI framework<br/>[ui.hpp]"]
  node_external_app_api["External app API<br/>[external_app.hpp]"]
  node_file_api["File access<br/>[file.hpp]"]
  node_settings["App settings<br/>[app_settings.cpp]"]
  node_formatting["String formatting<br/>[string_format.hpp]"]
end

subgraph group_radio_processing["Radio and processing"]
  node_modem_protocols["Modem protocols<br/>[modems.hpp]"]
  node_baseband_flex["Flex baseband<br/>[proc_flex.cpp]"]
  node_capture["Signal capture<br/>[capture_thread.cpp]"]
end

subgraph group_device["Device"]
  node_clock_manager["Clock manager<br/>[clock_manager.cpp]"]
  node_i2c_devices["I²C device manager<br/>[i2cdevmanager.cpp]"]
end

node_operator(("Device operator"))
node_hackrf{{"HackRF hardware"}}
node_device_user{{"PortaPack device"}}

node_operator -->|"operates"| node_device_user
node_device_user -->|"extends"| node_hackrf
node_app_manager -->|"uses navigation"| node_navigation
node_app_manager -->|"uses file access"| node_file_api
node_builtins -.->|"alongside"| node_external_apps

click node_builtins "https://github.com/portapack-mayhem/mayhem-firmware/tree/next/firmware/application/apps"
click node_external_apps "https://github.com/portapack-mayhem/mayhem-firmware/tree/next/firmware/application/external"
click node_app_manager "https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/external/app_manager/ui_app_manager.cpp"
click node_navigation "https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/ui_navigation.hpp"
click node_ui_framework "https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/common/ui.hpp"
click node_external_app_api "https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/common/external_app.hpp"
click node_file_api "https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/file.hpp"
click node_settings "https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/app_settings.cpp"
click node_formatting "https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/string_format.hpp"
click node_modem_protocols "https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/protocols/modems.hpp"
click node_baseband_flex "https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/baseband/proc_flex.cpp"
click node_capture "https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/capture_thread.cpp"
click node_clock_manager "https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/clock_manager.cpp"
click node_i2c_devices "https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/common/i2cdevmanager.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_builtins,node_external_apps,node_app_manager toneBlue
class node_navigation,node_ui_framework,node_external_app_api,node_file_api,node_settings,node_formatting toneAmber
class node_modem_protocols,node_baseband_flex,node_capture toneMint
class node_clock_manager,node_i2c_devices toneRose
class node_operator,node_hackrf,node_device_user toneIndigo
```

## Components

### User applications

- [Built-in apps](https://github.com/portapack-mayhem/mayhem-firmware/tree/next/firmware/application/apps): `firmware/application/apps`
- [External apps](https://github.com/portapack-mayhem/mayhem-firmware/tree/next/firmware/application/external): `firmware/application/external`
- [App manager](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/external/app_manager/ui_app_manager.cpp): `firmware/application/external/app_manager/ui_app_manager.cpp`

### Shared runtime

- [App navigation](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/ui_navigation.hpp): `firmware/application/ui_navigation.hpp`
- [UI framework](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/common/ui.hpp): `firmware/common/ui.hpp`
- [External app API](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/common/external_app.hpp): `firmware/common/external_app.hpp`
- [File access](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/file.hpp): `firmware/application/file.hpp`
- [App settings](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/app_settings.cpp): `firmware/application/app_settings.cpp`
- [String formatting](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/string_format.hpp): `firmware/application/string_format.hpp`

### Radio and processing

- [Modem protocols](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/protocols/modems.hpp): `firmware/application/protocols/modems.hpp`
- [Flex baseband](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/baseband/proc_flex.cpp): `firmware/baseband/proc_flex.cpp`
- [Signal capture](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/capture_thread.cpp): `firmware/application/capture_thread.cpp`

### Device

- [Clock manager](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/application/clock_manager.cpp): `firmware/application/clock_manager.cpp`
- [I²C device manager](https://github.com/portapack-mayhem/mayhem-firmware/blob/next/firmware/common/i2cdevmanager.cpp): `firmware/common/i2cdevmanager.cpp`

### Other components

- **Device operator**
- **HackRF hardware**
- **PortaPack device**

## Connections

- Device operator → PortaPack device: operates (evidence: `README.md`)
- PortaPack device → HackRF hardware: extends (evidence: `README.md`)
- App manager → App navigation: uses navigation (evidence: `firmware/application/external/app_manager/ui_app_manager.cpp`)
- App manager → File access: uses file access (evidence: `firmware/application/external/app_manager/ui_app_manager.cpp`)
- Built-in apps → External apps: alongside (evidence: `firmware/application/external/adult_toys_controller/ui_adult_toys_controller.cpp`)
