# devbender/esp-gcs architecture

> Architecture diagram of the GitHub repository devbender/esp-gcs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devbender/esp-gcs
- Repository: https://github.com/devbender/esp-gcs

## Overview

##### Project type and purpose
- This is an embedded‐firmware project (no web frontend or server) targeting an ESP32-S3 microcontroller.
- Purpose: implement a Ground Control Station (GCS) on a small embedded board, parsing MAVLink messages, filtering data, and driving a graphical display + touch input.

##### File structure
- platformio.ini, boards/esp32-s3-wroom-1-n16r2.json, partitions.csv: PlatformIO build and target hardware configuration.
- /mavlink: MAVLink protocol headers.
- lib/README: probably custom or 3rd-party libraries (none else visible).
- src/: all firmware modules. Main.cpp and modules:
- esp_gcs_system: initialization, main loop
- esp_gcs_datalink: Rx/Tx of MAVLink over serial or radio
- esp_gcs_filter: data conditioning
- esp_gcs_pfd: primary flight display logic
- esp_gcs_display_parallel16_9488 and esp_gcs_display_spi_9342: two display driver variants
- esp_gcs_input_ft6236: touch-screen input
- esp_gcs_types, esp_gcs_config: shared types and configuration constants
- test/: unit or integration tests

## Diagram (Mermaid)

```mermaid
graph TB
    %% Build & Deployment Artifacts
    subgraph "Build & Deployment"
        PlatformIO["PlatformIO Build Config"]:::artifact
        BoardDef["Board Definition"]:::artifact
        Partition["Partition Tables"]:::artifact
        Test["Unit/Integration Tests"]:::artifact
    end

    %% External Libraries
    subgraph "External Libraries"
        Mavlib["MAVLink Library"]:::lib
    end

    %% SoC and Firmware
    subgraph "ESP32-S3 SoC"
        SoCHw["ESP32-S3 SoC"]:::hardware
        subgraph "Firmware Modules"
            System["esp_gcs_system"]:::software
            Datalink["esp_gcs_datalink"]:::software
            Filter["esp_gcs_filter"]:::software
            PFD["esp_gcs_pfd"]:::software
            DispPar["esp_gcs_display_parallel16_9488"]:::software
            DispSPI["esp_gcs_display_spi_9342"]:::software
            Input["esp_gcs_input_ft6236"]:::software
            Types["esp_gcs_types"]:::software
            Config["esp_gcs_config"]:::software
        end
    end

    %% Hardware Peripherals
    UART["UART/Radio Link"]:::hardware
    ParDisp["Parallel 16-bit Display"]:::hardware
    SPIDisp["SPI Display"]:::hardware
    Touch["I2C Touch Controller"]:::hardware
    Flash["Flash Partitions"]:::hardware

    %% Build & Deployment Relationships
    PlatformIO --> SoCHw
    BoardDef --> SoCHw
    Partition --> Flash
    PlatformIO --> Flash
    PlatformIO --> Test

    %% Software Data Flow
    System --> Datalink
    Datalink --> Filter
    Filter --> PFD
    PFD --> DispPar
    PFD --> DispSPI
    Input --> System

    %% Hardware Connections
    SoCHw -->|UART| UART
    SoCHw -->|Parallel GPIO| ParDisp
    SoCHw -->|SPI| SPIDisp
    SoCHw -->|I2C| Touch
    SoCHw --> Flash

    %% Module Dependencies
    Types --> System
    Config --> System
    Mavlib --> Datalink

    %% Click Events
    click PlatformIO "https://github.com/devbender/esp-gcs/blob/main/platformio.ini"
    click BoardDef "https://github.com/devbender/esp-gcs/blob/main/boards/esp32-s3-wroom-1-n16r2.json"
    click Partition "https://github.com/devbender/esp-gcs/blob/main/partitions.csv"
    click Test "https://github.com/devbender/esp-gcs/tree/main/test/"
    click Mavlib "https://github.com/devbender/esp-gcs/tree/main/include/mavlink/"
    click System "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_system.cpp"
    click System "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_system.h"
    click System "https://github.com/devbender/esp-gcs/blob/main/src/main.cpp"
    click Datalink "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_datalink.cpp"
    click Datalink "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_datalink.h"
    click Filter "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_filter.cpp"
    click Filter "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_filter.h"
    click PFD "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_pfd.cpp"
    click PFD "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_pfd.h"
    click DispPar "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_display_parallel16_9488.h"
    click DispSPI "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_display_spi_9342.h"
    click Input "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_input_ft6236.h"
    click Types "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_types.h"
    click Config "https://github.com/devbender/esp-gcs/blob/main/src/esp_gcs_config.h"

    %% Styles
    classDef software fill:#ADD8E6,stroke:#0000FF
    classDef hardware fill:#98FB98,stroke:#008000
    classDef lib fill:#FFD580,stroke:#FFA500
    classDef artifact fill:#D3D3D3,stroke:#A9A9A9
```
