# hiteshbhoyar03/flight-controller-v2 architecture

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

- Interactive diagram: https://gitdiagram.com/hiteshbhoyar03/flight-controller-v2
- Repository: https://github.com/hiteshbhoyar03/flight-controller-v2

## Overview

Flight Controller Rev2 is a simulation-only dual-processor flight-control firmware project. The co-processor acquires sensor data and handles receiver protocols; the main processor receives co-processor data and drives motor outputs. The README also describes persistent configuration, GPS, telemetry, and control-loop capabilities, though telemetry and PID control are in progress. The sampled excerpts show only parts of the runtime, so unsampled capability links are omitted or marked unverified rather than treated as confirmed calls.

Main entry points: [`firmware/CP flight controller rev2/Core/Src/main.c`](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/CP%20flight%20controller%20rev2/Core/Src/main.c) (Co-processor Loop), [`firmware/MP flight controller rev2/Core/Src/main.c`](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/MP%20flight%20controller%20rev2/Core/Src/main.c) (Main Processor Loop), [`firmware/sensors protocol and config/dshot protocol/DSHOT.c`](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/sensors%20protocol%20and%20config/dshot%20protocol/DSHOT.c) (DShot Output), [`firmware/sensors protocol and config/receiver protocols`](https://github.com/hiteshbhoyar03/flight-controller-v2/tree/main/firmware/sensors%20protocol%20and%20config/receiver%20protocols) (RC Protocol Parsers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_processors["Processor Runtime"]
  node_cp_main["Co-processor Loop<br/>[main.c]"]
  node_mp_main["Main Processor Loop<br/>[main.c]"]
  node_cp_hal["CP Peripheral Setup<br/>[main.h]"]
  node_mp_hal["MP Peripheral Setup<br/>[main.h]"]
end

subgraph group_sensing["Sensors And Navigation"]
  node_imu["IMU Drivers"]
  node_barometers["Barometer Drivers"]
  node_gps["GNSS Parser<br/>[M9N.c]"]
  node_ekf["IMU Filter<br/>[ekf_imu.c]"]
end

subgraph group_control["Control And Protocols"]
  node_receiver["RC Protocol Parsers"]
  node_pid["PID Control<br/>[PID.c]"]
  node_dshot["DShot Output<br/>[DSHOT.c]"]
  node_drone_config["Motor Configuration<br/>[DRONE_CONFIG.c]"]
end

subgraph group_storage["Configuration"]
  node_eeprom["EEPROM Access<br/>[EEPROM.c]"]
end

node_pilot(("Pilot / RC"))
node_esc{{"ESCs / Servos"}}
node_gcs(("Ground Station"))

node_cp_main -->|"initializes peripherals"| node_cp_hal
node_mp_main -->|"initializes peripherals"| node_mp_hal
node_cp_main -->|"reads sensor data"| node_imu
node_cp_main -->|"reads and calculates"| node_barometers
node_pilot -.->|"sends RC input"| node_receiver
node_cp_main -->|"parses receiver frames"| node_receiver
node_cp_main -.->|"parses GNSS"| node_gps
node_cp_main -.->|"filters sensor data"| node_ekf
node_cp_main -->|"sends data over UART"| node_mp_main
node_mp_main -->|"receives data over UART"| node_cp_main
node_mp_main -.->|"uses control loops"| node_pid
node_mp_main -->|"sets motor output"| node_dshot
node_mp_main -->|"uses motor config"| node_drone_config
node_dshot -.->|"sends motor commands"| node_esc
node_cp_main -.->|"persists configuration"| node_eeprom
node_mp_main -.->|"telemetry link"| node_gcs

click node_cp_main "https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/CP%20flight%20controller%20rev2/Core/Src/main.c"
click node_mp_main "https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/MP%20flight%20controller%20rev2/Core/Src/main.c"
click node_cp_hal "https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/CP%20flight%20controller%20rev2/Core/Inc/main.h"
click node_mp_hal "https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/MP%20flight%20controller%20rev2/Core/Inc/main.h"
click node_imu "https://github.com/hiteshbhoyar03/flight-controller-v2/tree/main/firmware/sensors%20protocol%20and%20config/imu"
click node_barometers "https://github.com/hiteshbhoyar03/flight-controller-v2/tree/main/firmware/sensors%20protocol%20and%20config/baro"
click node_gps "https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/sensors%20protocol%20and%20config/gps/M9N.c"
click node_ekf "https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/sensors%20protocol%20and%20config/ekf%20kalman%20filter/ekf_imu.c"
click node_receiver "https://github.com/hiteshbhoyar03/flight-controller-v2/tree/main/firmware/sensors%20protocol%20and%20config/receiver%20protocols"
click node_pid "https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/sensors%20protocol%20and%20config/pid/PID.c"
click node_dshot "https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/sensors%20protocol%20and%20config/dshot%20protocol/DSHOT.c"
click node_drone_config "https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/MP%20flight%20controller%20rev2/Core/Src/DRONE_CONFIG.c"
click node_eeprom "https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/sensors%20protocol%20and%20config/eeprom/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_cp_main,node_mp_main,node_cp_hal,node_mp_hal toneBlue
class node_imu,node_barometers,node_gps,node_ekf toneAmber
class node_receiver,node_pid,node_dshot,node_drone_config toneMint
class node_eeprom toneRose
class node_pilot,node_esc,node_gcs toneIndigo
```

## Components

### Processor Runtime

- [Co-processor Loop](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/CP%20flight%20controller%20rev2/Core/Src/main.c): `firmware/CP flight controller rev2/Core/Src/main.c`
- [Main Processor Loop](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/MP%20flight%20controller%20rev2/Core/Src/main.c): `firmware/MP flight controller rev2/Core/Src/main.c`
- [CP Peripheral Setup](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/CP%20flight%20controller%20rev2/Core/Inc/main.h): `firmware/CP flight controller rev2/Core/Inc/main.h`
- [MP Peripheral Setup](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/MP%20flight%20controller%20rev2/Core/Inc/main.h): `firmware/MP flight controller rev2/Core/Inc/main.h`

### Sensors And Navigation

- [IMU Drivers](https://github.com/hiteshbhoyar03/flight-controller-v2/tree/main/firmware/sensors%20protocol%20and%20config/imu): `firmware/sensors protocol and config/imu`
- [Barometer Drivers](https://github.com/hiteshbhoyar03/flight-controller-v2/tree/main/firmware/sensors%20protocol%20and%20config/baro): `firmware/sensors protocol and config/baro`
- [GNSS Parser](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/sensors%20protocol%20and%20config/gps/M9N.c): `firmware/sensors protocol and config/gps/M9N.c`
- [IMU Filter](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/sensors%20protocol%20and%20config/ekf%20kalman%20filter/ekf_imu.c): `firmware/sensors protocol and config/ekf kalman filter/ekf_imu.c`

### Control And Protocols

- [RC Protocol Parsers](https://github.com/hiteshbhoyar03/flight-controller-v2/tree/main/firmware/sensors%20protocol%20and%20config/receiver%20protocols): `firmware/sensors protocol and config/receiver protocols`
- [PID Control](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/sensors%20protocol%20and%20config/pid/PID.c): `firmware/sensors protocol and config/pid/PID.c`
- [DShot Output](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/sensors%20protocol%20and%20config/dshot%20protocol/DSHOT.c): `firmware/sensors protocol and config/dshot protocol/DSHOT.c`
- [Motor Configuration](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/MP%20flight%20controller%20rev2/Core/Src/DRONE_CONFIG.c): `firmware/MP flight controller rev2/Core/Src/DRONE_CONFIG.c`

### Configuration

- [EEPROM Access](https://github.com/hiteshbhoyar03/flight-controller-v2/blob/main/firmware/sensors%20protocol%20and%20config/eeprom/EEPROM.c): `firmware/sensors protocol and config/eeprom/EEPROM.c`

### Other components

- **Pilot / RC**
- **ESCs / Servos**
- **Ground Station**

## Connections

- Co-processor Loop → CP Peripheral Setup: initializes peripherals (evidence: `firmware/CP flight controller rev2/Core/Src/main.c`)
- Main Processor Loop → MP Peripheral Setup: initializes peripherals (evidence: `firmware/MP flight controller rev2/Core/Src/main.c`)
- Co-processor Loop → IMU Drivers: reads sensor data (evidence: `firmware/CP flight controller rev2/Core/Src/main.c`)
- Co-processor Loop → Barometer Drivers: reads and calculates (evidence: `firmware/CP flight controller rev2/Core/Src/main.c`)
- Pilot / RC → RC Protocol Parsers: sends RC input (evidence: `README.md`)
- Co-processor Loop → RC Protocol Parsers: parses receiver frames
- Co-processor Loop → GNSS Parser: parses GNSS
- Co-processor Loop → IMU Filter: filters sensor data
- Co-processor Loop → Main Processor Loop: sends data over UART (evidence: `README.md`)
- Main Processor Loop → Co-processor Loop: receives data over UART (evidence: `README.md`)
- Main Processor Loop → PID Control: uses control loops
- Main Processor Loop → DShot Output: sets motor output (evidence: `firmware/MP flight controller rev2/Core/Src/main.c`)
- Main Processor Loop → Motor Configuration: uses motor config (evidence: `firmware/MP flight controller rev2/Core/Src/main.c`)
- DShot Output → ESCs / Servos: sends motor commands (evidence: `README.md`)
- Co-processor Loop → EEPROM Access: persists configuration (evidence: `README.md`)
- Main Processor Loop → Ground Station: telemetry link (evidence: `README.md`)
