# alkamotors/am32 architecture

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

- Interactive diagram: https://gitdiagram.com/alkamotors/am32
- Repository: https://github.com/alkamotors/am32

## Overview

AM32 is embedded ESC firmware for controlling brushless motors. Its principal workflow is receiving throttle/control signals, interpreting motor commands, and driving the ESC hardware; it also supports configuration, telemetry, and multiple MCU/ESC targets. The main loop excerpt shows initialization and periodic control work, while the README documents the supported protocols and startup modes. Several implementation files are listed but not excerpted, so uncertain internal call relationships are omitted or marked unverified.

Main entry points: [`Src/main.c`](https://github.com/alkamotors/am32/blob/main/Src/main.c) (Firmware main loop), [`Mcu/e230/Src/peripherals.c`](https://github.com/alkamotors/am32/blob/main/Mcu/e230/Src/peripherals.c) (MCU peripherals), [`Src/signal.c`](https://github.com/alkamotors/am32/blob/main/Src/signal.c) (Signal capture), [`Src/dshot.c`](https://github.com/alkamotors/am32/blob/main/Src/dshot.c) (DShot protocol)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Control and drive"]
  node_main["Firmware main loop<br/>[main.c]"]
  node_motor["Motor commutation<br/>[main.c]"]
end

subgraph group_interfaces["Command and telemetry"]
  node_signal["Signal capture<br/>[signal.c]"]
  node_dshot["DShot protocol<br/>[dshot.c]"]
  node_telemetry["Serial telemetry<br/>[serial_telemetry.c]"]
  node_dronecan["DroneCAN support<br/>[DroneCAN.c]"]
end

subgraph group_hardware["ESC hardware"]
  node_peripherals["MCU peripherals<br/>[peripherals.c]"]
  node_adc["ADC sensing<br/>[ADC.c]"]
  node_io["ESC I/O<br/>[IO.c]"]
end

subgraph group_configuration["Settings and targets"]
  node_storage[("Settings storage<br/>[eeprom.c]")]
  node_targets["ESC target profiles<br/>[targets.h]"]
end

node_pilot(("Flight controller / operator"))
node_esc["Brushless motor / ESC"]

node_pilot -->|"controls"| node_main
node_main -.->|"uses input"| node_signal
node_main -->|"supports DShot"| node_dshot
node_main -->|"runs control"| node_motor
node_motor -.->|"drives hardware"| node_peripherals
node_peripherals -.->|"samples sensors"| node_adc
node_peripherals -.->|"controls pins"| node_io
node_motor -->|"drives motor"| node_esc
node_main -->|"supports telemetry"| node_telemetry
node_main -.->|"optional CAN"| node_dronecan
node_main -->|"loads settings"| node_storage
node_main -.->|"selects target"| node_targets

click node_main "https://github.com/alkamotors/am32/blob/main/Src/main.c"
click node_signal "https://github.com/alkamotors/am32/blob/main/Src/signal.c"
click node_dshot "https://github.com/alkamotors/am32/blob/main/Src/dshot.c"
click node_telemetry "https://github.com/alkamotors/am32/blob/main/Mcu/e230/Src/serial_telemetry.c"
click node_dronecan "https://github.com/alkamotors/am32/blob/main/Src/DroneCAN/DroneCAN.c"
click node_motor "https://github.com/alkamotors/am32/blob/main/Src/main.c"
click node_peripherals "https://github.com/alkamotors/am32/blob/main/Mcu/e230/Src/peripherals.c"
click node_adc "https://github.com/alkamotors/am32/blob/main/Mcu/e230/Src/ADC.c"
click node_io "https://github.com/alkamotors/am32/blob/main/Mcu/e230/Src/IO.c"
click node_storage "https://github.com/alkamotors/am32/blob/main/Mcu/e230/Src/eeprom.c"
click node_targets "https://github.com/alkamotors/am32/blob/main/Inc/targets.h"

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_motor toneBlue
class node_signal,node_dshot,node_telemetry,node_dronecan toneAmber
class node_peripherals,node_adc,node_io toneMint
class node_storage,node_targets toneRose
class node_pilot,node_esc toneIndigo
```

## Components

### Control and drive

- [Firmware main loop](https://github.com/alkamotors/am32/blob/main/Src/main.c): `Src/main.c`
- [Motor commutation](https://github.com/alkamotors/am32/blob/main/Src/main.c): `Src/main.c`

### Command and telemetry

- [Signal capture](https://github.com/alkamotors/am32/blob/main/Src/signal.c): `Src/signal.c`
- [DShot protocol](https://github.com/alkamotors/am32/blob/main/Src/dshot.c): `Src/dshot.c`
- [Serial telemetry](https://github.com/alkamotors/am32/blob/main/Mcu/e230/Src/serial_telemetry.c): `Mcu/e230/Src/serial_telemetry.c`
- [DroneCAN support](https://github.com/alkamotors/am32/blob/main/Src/DroneCAN/DroneCAN.c): `Src/DroneCAN/DroneCAN.c`

### ESC hardware

- [MCU peripherals](https://github.com/alkamotors/am32/blob/main/Mcu/e230/Src/peripherals.c): `Mcu/e230/Src/peripherals.c`
- [ADC sensing](https://github.com/alkamotors/am32/blob/main/Mcu/e230/Src/ADC.c): `Mcu/e230/Src/ADC.c`
- [ESC I/O](https://github.com/alkamotors/am32/blob/main/Mcu/e230/Src/IO.c): `Mcu/e230/Src/IO.c`

### Settings and targets

- [Settings storage](https://github.com/alkamotors/am32/blob/main/Mcu/e230/Src/eeprom.c): `Mcu/e230/Src/eeprom.c`
- [ESC target profiles](https://github.com/alkamotors/am32/blob/main/Inc/targets.h): `Inc/targets.h`

### Other components

- **Flight controller / operator**
- **Brushless motor / ESC**

## Connections

- Flight controller / operator → Firmware main loop: controls (evidence: `README.md`)
- Firmware main loop → Signal capture: uses input
- Firmware main loop → DShot protocol: supports DShot (evidence: `README.md`)
- Firmware main loop → Motor commutation: runs control (evidence: `Src/main.c`)
- Motor commutation → MCU peripherals: drives hardware
- MCU peripherals → ADC sensing: samples sensors
- MCU peripherals → ESC I/O: controls pins
- Motor commutation → Brushless motor / ESC: drives motor (evidence: `README.md`)
- Firmware main loop → Serial telemetry: supports telemetry (evidence: `README.md`)
- Firmware main loop → DroneCAN support: optional CAN
- Firmware main loop → Settings storage: loads settings (evidence: `Src/main.c`)
- Firmware main loop → ESC target profiles: selects target (evidence: `Src/main.c`)
