# chenxu-cd/scxbj architecture

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

- Interactive diagram: https://gitdiagram.com/chenxu-cd/scxbj
- Repository: https://github.com/chenxu-cd/scxbj

## Overview

This is firmware for a SCX beacon handheld terminal. Its visible startup initializes AXI hardware control, starts GPS parsing, and launches the LCD interface; the LCD’s board-specific menus expose beacon settings and actions. GPS input is parsed into navigation data, while the application also has audio, 406-beacon, key-input, and OLED modules. The graph preserves those major runtime branches, but their internal wiring is limited where source was not excerpted; dashed edges indicate unverified integration.

Main entry points: [`lcd/lcd.c`](https://github.com/chenxu-cd/scxbj/blob/master/lcd/lcd.c) (LCD runtime), [`app/main.c`](https://github.com/chenxu-cd/scxbj/blob/master/app/main.c) (Application startup), [`nmea/nmeaparser.c`](https://github.com/chenxu-cd/scxbj/blob/master/nmea/nmeaparser.c) (NMEA parser), [`app/axi_ctrl.c`](https://github.com/chenxu-cd/scxbj/blob/master/app/axi_ctrl.c) (AXI control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and hardware"]
  node_main["Application startup<br/>[main.c]"]
  node_axi["AXI control<br/>[axi_ctrl.c]"]
  node_ad9361["AD9361 operations<br/>[ad9361_op.c]"]
  node_audio["Audio processing<br/>[audio_process.c]"]
end

subgraph group_navigation["GPS navigation"]
  node_gps_thread["GPS thread<br/>[gps_thread.c]"]
  node_parser["NMEA parser<br/>[nmeaparser.c]"]
  node_reader["NMEA reader<br/>[nmeardr.c]"]
  node_tokenizer["Sentence tokenizer<br/>[nmeatknzr.c]"]
  node_navdata["Navigation data<br/>[navdata.c]"]
end

subgraph group_beacon["Beacon functions"]
  node_beacon_thread["406 beacon thread<br/>[beacon406_thread.c]"]
  node_beacon_board["Beacon menus and state<br/>[lcd_bus_cen.c]"]
  node_key_input["Key input<br/>[gpio_key_tpt.c]"]
end

subgraph group_display["LCD interface"]
  node_lcd_entry["LCD runtime<br/>[lcd.c]"]
  node_board_lcd["LCD board driver<br/>[lcd_cfg_cen.c]"]
  node_controls["Control manager<br/>[ctrl_mgr.c]"]
  node_gui["GUI widgets<br/>[gui.c]"]
  node_lcd_library["LCD data library<br/>[lcd_lib.c]"]
  node_lcd_cover["Data access cover<br/>[lcd_cover.c]"]
  node_margins["Display margins<br/>[marg.c]"]
  node_oled["OLED interface<br/>[lcm_oled.c]"]
end

subgraph group_platform["Platform support"]
  node_platform_compat["Platform compatibility<br/>[vxcompat.c]"]
end

node_operator(("Operator"))

node_operator -->|"starts"| node_main
node_main -->|"initializes"| node_axi
node_main -->|"starts"| node_gps_thread
node_main -->|"initializes"| node_lcd_entry
node_gps_thread -->|"parses input"| node_parser
node_parser -->|"uses"| node_reader
node_parser -->|"tokenizes"| node_tokenizer
node_parser -->|"fills"| node_navdata
node_lcd_entry -->|"uses"| node_controls
node_lcd_entry -->|"uses"| node_gui
node_lcd_entry -->|"uses"| node_lcd_library
node_lcd_entry -->|"uses"| node_lcd_cover
node_controls -.->|"uses"| node_margins
node_lcd_library -->|"uses"| node_lcd_cover
node_beacon_board -->|"dispatches events"| node_controls
node_beacon_board -->|"plays audio"| node_audio
node_beacon_board -.->|"uses display"| node_board_lcd
node_beacon_thread -.->|"controls hardware"| node_axi
node_audio -.->|"controls hardware"| node_axi
node_axi -.->|"coordinates radio"| node_ad9361
node_key_input -.->|"forwards keys"| node_controls
node_oled -.->|"uses display"| node_board_lcd

click node_main "https://github.com/chenxu-cd/scxbj/blob/master/app/main.c"
click node_axi "https://github.com/chenxu-cd/scxbj/blob/master/app/axi_ctrl.c"
click node_ad9361 "https://github.com/chenxu-cd/scxbj/blob/master/app/ad9361_op.c"
click node_audio "https://github.com/chenxu-cd/scxbj/blob/master/app/audio_process.c"
click node_gps_thread "https://github.com/chenxu-cd/scxbj/blob/master/app/gps_thread.c"
click node_parser "https://github.com/chenxu-cd/scxbj/blob/master/nmea/nmeaparser.c"
click node_reader "https://github.com/chenxu-cd/scxbj/blob/master/nmea/nmeardr.c"
click node_tokenizer "https://github.com/chenxu-cd/scxbj/blob/master/nmea/nmeatknzr.c"
click node_navdata "https://github.com/chenxu-cd/scxbj/blob/master/nmea/navdata.c"
click node_beacon_thread "https://github.com/chenxu-cd/scxbj/blob/master/app/beacon406_thread.c"
click node_beacon_board "https://github.com/chenxu-cd/scxbj/blob/master/lcd/cen/lcd_bus_cen.c"
click node_key_input "https://github.com/chenxu-cd/scxbj/blob/master/app/gpio_key_tpt.c"
click node_lcd_entry "https://github.com/chenxu-cd/scxbj/blob/master/lcd/lcd.c"
click node_board_lcd "https://github.com/chenxu-cd/scxbj/blob/master/lcd/cen/lcd_cfg_cen.c"
click node_controls "https://github.com/chenxu-cd/scxbj/blob/master/lcd/ctrl_mgr.c"
click node_gui "https://github.com/chenxu-cd/scxbj/blob/master/lcd/gui.c"
click node_lcd_library "https://github.com/chenxu-cd/scxbj/blob/master/lcd/lcd_lib.c"
click node_lcd_cover "https://github.com/chenxu-cd/scxbj/blob/master/lcd/lcd_cover.c"
click node_margins "https://github.com/chenxu-cd/scxbj/blob/master/lcd/marg.c"
click node_platform_compat "https://github.com/chenxu-cd/scxbj/blob/master/port/src/vxcompat.c"
click node_oled "https://github.com/chenxu-cd/scxbj/blob/master/app/lcm_oled.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_axi,node_ad9361,node_audio toneBlue
class node_gps_thread,node_parser,node_reader,node_tokenizer,node_navdata toneAmber
class node_beacon_thread,node_beacon_board,node_key_input toneMint
class node_lcd_entry,node_board_lcd,node_controls,node_gui,node_lcd_library,node_lcd_cover,node_margins,node_oled toneRose
class node_platform_compat,node_operator toneIndigo
```

## Components

### Startup and hardware

- [Application startup](https://github.com/chenxu-cd/scxbj/blob/master/app/main.c): `app/main.c`
- [AXI control](https://github.com/chenxu-cd/scxbj/blob/master/app/axi_ctrl.c): `app/axi_ctrl.c`
- [AD9361 operations](https://github.com/chenxu-cd/scxbj/blob/master/app/ad9361_op.c): `app/ad9361_op.c`
- [Audio processing](https://github.com/chenxu-cd/scxbj/blob/master/app/audio_process.c): `app/audio_process.c`

### GPS navigation

- [GPS thread](https://github.com/chenxu-cd/scxbj/blob/master/app/gps_thread.c): `app/gps_thread.c`
- [NMEA parser](https://github.com/chenxu-cd/scxbj/blob/master/nmea/nmeaparser.c): `nmea/nmeaparser.c`
- [NMEA reader](https://github.com/chenxu-cd/scxbj/blob/master/nmea/nmeardr.c): `nmea/nmeardr.c`
- [Sentence tokenizer](https://github.com/chenxu-cd/scxbj/blob/master/nmea/nmeatknzr.c): `nmea/nmeatknzr.c`
- [Navigation data](https://github.com/chenxu-cd/scxbj/blob/master/nmea/navdata.c): `nmea/navdata.c`

### Beacon functions

- [406 beacon thread](https://github.com/chenxu-cd/scxbj/blob/master/app/beacon406_thread.c): `app/beacon406_thread.c`
- [Beacon menus and state](https://github.com/chenxu-cd/scxbj/blob/master/lcd/cen/lcd_bus_cen.c): `lcd/cen/lcd_bus_cen.c`
- [Key input](https://github.com/chenxu-cd/scxbj/blob/master/app/gpio_key_tpt.c): `app/gpio_key_tpt.c`

### LCD interface

- [LCD runtime](https://github.com/chenxu-cd/scxbj/blob/master/lcd/lcd.c): `lcd/lcd.c`
- [LCD board driver](https://github.com/chenxu-cd/scxbj/blob/master/lcd/cen/lcd_cfg_cen.c): `lcd/cen/lcd_cfg_cen.c`
- [Control manager](https://github.com/chenxu-cd/scxbj/blob/master/lcd/ctrl_mgr.c): `lcd/ctrl_mgr.c`
- [GUI widgets](https://github.com/chenxu-cd/scxbj/blob/master/lcd/gui.c): `lcd/gui.c`
- [LCD data library](https://github.com/chenxu-cd/scxbj/blob/master/lcd/lcd_lib.c): `lcd/lcd_lib.c`
- [Data access cover](https://github.com/chenxu-cd/scxbj/blob/master/lcd/lcd_cover.c): `lcd/lcd_cover.c`
- [Display margins](https://github.com/chenxu-cd/scxbj/blob/master/lcd/marg.c): `lcd/marg.c`
- [OLED interface](https://github.com/chenxu-cd/scxbj/blob/master/app/lcm_oled.c): `app/lcm_oled.c`

### Platform support

- [Platform compatibility](https://github.com/chenxu-cd/scxbj/blob/master/port/src/vxcompat.c): `port/src/vxcompat.c`

### Other components

- **Operator**

## Connections

- Operator → Application startup: starts (evidence: `app/main.c`)
- Application startup → AXI control: initializes (evidence: `app/main.c`)
- Application startup → GPS thread: starts (evidence: `app/main.c`)
- Application startup → LCD runtime: initializes (evidence: `app/main.c`)
- GPS thread → NMEA parser: parses input (evidence: `app/gps_thread.c`)
- NMEA parser → NMEA reader: uses
- NMEA parser → Sentence tokenizer: tokenizes
- NMEA parser → Navigation data: fills (evidence: `nmea/nmeaparser.c`)
- LCD runtime → Control manager: uses (evidence: `lcd/lcd.c`)
- LCD runtime → GUI widgets: uses (evidence: `lcd/lcd.c`)
- LCD runtime → LCD data library: uses (evidence: `lcd/lcd.c`)
- LCD runtime → Data access cover: uses (evidence: `lcd/lcd.c`)
- Control manager → Display margins: uses
- LCD data library → Data access cover: uses (evidence: `lcd/lcd_lib.c`)
- Beacon menus and state → Control manager: dispatches events (evidence: `lcd/cen/lcd_bus_cen.c`)
- Beacon menus and state → Audio processing: plays audio (evidence: `lcd/cen/lcd_bus_cen.c`)
- Beacon menus and state → LCD board driver: uses display
- 406 beacon thread → AXI control: controls hardware
- Audio processing → AXI control: controls hardware
- AXI control → AD9361 operations: coordinates radio
- Key input → Control manager: forwards keys
- OLED interface → LCD board driver: uses display
