# ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware architecture

> Architecture diagram of the GitHub repository ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware
- Repository: https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware

## Overview

This is custom UV-K5 handheld-radio firmware. The principal workflow is user input through the firmware’s application loop and menus into radio operation, with received and transmitted signalling governed by the selected mode. The README documents MDC1200, FleetSync, DTMF PTT-ID, talk-permit tones, power calibration, ultra-low power, and CHIRP configuration. The tree and excerpts support the main loop and several application components, but not all subsystem call wiring; those links are therefore kept conservative.

Main entry points: [`app/app.c`](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/app.c) (Application logic), [`main.c`](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/main.c) (Firmware loop), [`app/menu.c`](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/menu.c) (Settings menu), [`driver/bk4819.c`](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/driver/bk4819.c) (BK4819 transceiver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Control and interface"]
  node_main["Firmware loop<br/>[main.c]"]
  node_app["Application logic<br/>[app.c]"]
  node_menu["Settings menu<br/>[menu.c]"]
  node_display["Radio display<br/>[main.c]"]
  node_keyscan["Keypad input<br/>[keyboard.c]"]
end

subgraph group_radio["Radio operation"]
  node_radioctrl["Radio control<br/>[app.c]"]
  node_scanner["Channel scanning<br/>[scanner.c]"]
  node_frequency["Frequency scanning<br/>[chFrScanner.c]"]
  node_fm["FM radio<br/>[fm.c]"]
  node_rf["BK4819 transceiver<br/>[bk4819.c]"]
end

subgraph group_signalling["Signalling"]
  node_mdc["MDC1200<br/>[mdc1200.c]"]
  node_fleet["FleetSync<br/>[fleetsync.c]"]
  node_dtmf["DTMF signalling<br/>[dtmf.c]"]
  node_audio["Audio and tones<br/>[audio.c]"]
end

subgraph group_config["Configuration"]
  node_chirp["CHIRP configuration<br/>[uvk5_TrueMDC.py]"]
  node_settings[("Radio settings<br/>[eeprom.c]")]
end

node_operator(("Radio operator"))
node_rfuser(("RF environment"))

node_operator -->|"presses keys"| node_keyscan
node_main -->|"runs updates"| node_app
node_main -->|"polls keys"| node_keyscan
node_app -->|"handles settings"| node_menu
node_app -->|"updates screen"| node_display
node_app -->|"controls radio"| node_radioctrl
node_radioctrl -->|"configures transceiver"| node_rf
node_app -->|"controls scanning"| node_scanner
node_app -->|"controls scan"| node_frequency
node_app -->|"controls FM"| node_fm
node_app -->|"uses signalling"| node_mdc
node_app -->|"uses signalling"| node_fleet
node_app -->|"uses signalling"| node_dtmf
node_app -->|"controls audio"| node_audio
node_menu -->|"persists settings"| node_settings
node_chirp -.->|"configures radio"| node_settings
node_rf -->|"transmits and receives"| node_rfuser

click node_main "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/main.c"
click node_app "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/app.c"
click node_menu "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/menu.c"
click node_display "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/ui/main.c"
click node_keyscan "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/driver/keyboard.c"
click node_radioctrl "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/app.c"
click node_scanner "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/scanner.c"
click node_frequency "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/chFrScanner.c"
click node_fm "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/fm.c"
click node_rf "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/driver/bk4819.c"
click node_mdc "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/mdc1200.c"
click node_fleet "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/fleetsync.c"
click node_dtmf "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/dtmf.c"
click node_audio "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/audio.c"
click node_chirp "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/CHIRP%20Module/uvk5_TrueMDC.py"
click node_settings "https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/driver/eeprom.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_app,node_menu,node_display,node_keyscan toneBlue
class node_radioctrl,node_scanner,node_frequency,node_fm,node_rf toneAmber
class node_mdc,node_fleet,node_dtmf,node_audio toneMint
class node_chirp,node_settings toneRose
class node_operator,node_rfuser toneIndigo
```

## Components

### Control and interface

- [Firmware loop](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/main.c): `main.c`
- [Application logic](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/app.c): `app/app.c`
- [Settings menu](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/menu.c): `app/menu.c`
- [Radio display](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/ui/main.c): `ui/main.c`
- [Keypad input](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/driver/keyboard.c): `driver/keyboard.c`

### Radio operation

- [Radio control](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/app.c): `app/app.c`
- [Channel scanning](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/scanner.c): `app/scanner.c`
- [Frequency scanning](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/chFrScanner.c): `app/chFrScanner.c`
- [FM radio](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/fm.c): `app/fm.c`
- [BK4819 transceiver](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/driver/bk4819.c): `driver/bk4819.c`

### Signalling

- [MDC1200](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/mdc1200.c): `app/mdc1200.c`
- [FleetSync](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/fleetsync.c): `app/fleetsync.c`
- [DTMF signalling](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/app/dtmf.c): `app/dtmf.c`
- [Audio and tones](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/audio.c): `audio.c`

### Configuration

- [CHIRP configuration](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/CHIRP%20Module/uvk5_TrueMDC.py): `CHIRP Module/uvk5_TrueMDC.py`
- [Radio settings](https://github.com/ivanmaestrogtr/truemdc-9m2rtx-losehu-uvk5-firmware/blob/main/driver/eeprom.c): `driver/eeprom.c`

### Other components

- **Radio operator**
- **RF environment**

## Connections

- Radio operator → Keypad input: presses keys
- Firmware loop → Application logic: runs updates
- Firmware loop → Keypad input: polls keys
- Application logic → Settings menu: handles settings
- Application logic → Radio display: updates screen
- Application logic → Radio control: controls radio
- Radio control → BK4819 transceiver: configures transceiver
- Application logic → Channel scanning: controls scanning
- Application logic → Frequency scanning: controls scan
- Application logic → FM radio: controls FM
- Application logic → MDC1200: uses signalling
- Application logic → FleetSync: uses signalling
- Application logic → DTMF signalling: uses signalling
- Application logic → Audio and tones: controls audio
- Settings menu → Radio settings: persists settings
- CHIRP configuration → Radio settings: configures radio
- BK4819 transceiver → RF environment: transmits and receives
