# chshzh/inverter_stm32 architecture

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

- Interactive diagram: https://gitdiagram.com/chshzh/inverter_stm32
- Repository: https://github.com/chshzh/inverter_stm32

## Overview

This is STM32F103 inverter firmware. Its documented product workflow is user adjustment through keys, inverter frequency/voltage control and SPWM generation, with operating values shown on a 128×64 LCD. The tree also contains STM32 CMSIS and Standard Peripheral Library support. The README establishes the product capabilities, but sampled source does not show the application call graph or peripheral wiring, so those relationships are not inferred here.

Main entry points: [`USER/Timer.c`](https://github.com/chshzh/inverter_stm32/blob/master/USER/Timer.c) (Inverter control), [`USER/Display.c`](https://github.com/chshzh/inverter_stm32/blob/master/USER/Display.c) (Display driver), [`FWlib/src/stm32f10x_tim.c`](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/src/stm32f10x_tim.c) (Timer library), [`USER/main.c`](https://github.com/chshzh/inverter_stm32/blob/master/USER/main.c) (Application entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Inverter application"]
  node_main["Application entry<br/>[main.c]"]
  node_control["Inverter control<br/>[Timer.c]"]
  node_sine["Sine table<br/>[sin_tab.h]"]
  node_adcapp["Application ADC<br/>[adc.c]"]
end

subgraph group_ui["User interface"]
  node_keys["Key input<br/>[key.c]"]
  node_display["Display driver<br/>[Display.c]"]
  node_lcd["ST7920 LCD<br/>[st7920.c]"]
end

subgraph group_drivers["STM32 peripheral support"]
  node_timlib["Timer library<br/>[stm32f10x_tim.c]"]
  node_timheader["Timer API<br/>[stm32f10x_tim.h]"]
  node_adclib["ADC library<br/>[stm32f10x_adc.c]"]
  node_adcheader["ADC API<br/>[stm32f10x_adc.h]"]
  node_rcc["Clock control<br/>[stm32f10x_rcc.c]"]
  node_rcch["Clock API<br/>[stm32f10x_rcc.h]"]
  node_gpio["GPIO driver<br/>[stm32f10x_gpio.c]"]
  node_gpioh["GPIO API<br/>[stm32f10x_gpio.h]"]
  node_dma["DMA driver<br/>[stm32f10x_dma.c]"]
  node_dmah["DMA API<br/>[stm32f10x_dma.h]"]
  node_exti["EXTI API<br/>[stm32f10x_exti.h]"]
  node_misc["NVIC and SysTick<br/>[misc.h]"]
  node_can["CAN API<br/>[stm32f10x_can.h]"]
  node_fsmc["FSMC API<br/>[stm32f10x_fsmc.h]"]
  node_sdio["SDIO API<br/>[stm32f10x_sdio.h]"]
  node_spi["SPI API<br/>[stm32f10x_spi.h]"]
  node_usart["USART API<br/>[stm32f10x_usart.h]"]
end

subgraph group_device["CMSIS device support"]
  node_core["Cortex-M3 core<br/>[core_cm3.h]"]
  node_devicehdr["STM32F10x device<br/>[stm32f10x.h]"]
  node_system["System clocks<br/>[system_stm32f10x.c]"]
end

node_operator(("Operator"))

node_operator -->|"adjusts settings"| node_keys
node_main -.->|"runs inverter"| node_control
node_control -.->|"uses waveform data"| node_sine
node_control -->|"reports values"| node_display
node_display -.->|"uses LCD driver"| node_lcd
node_control -.->|"measures voltage"| node_adcapp
node_control -->|"generates SPWM"| node_timlib
node_timlib -->|"implements API"| node_timheader
node_adclib -->|"implements API"| node_adcheader
node_rcc -->|"implements API"| node_rcch
node_gpio -->|"implements API"| node_gpioh
node_dma -->|"implements API"| node_dmah
node_system -->|"configures clocks"| node_devicehdr

click node_main "https://github.com/chshzh/inverter_stm32/blob/master/USER/main.c"
click node_control "https://github.com/chshzh/inverter_stm32/blob/master/USER/Timer.c"
click node_sine "https://github.com/chshzh/inverter_stm32/blob/master/USER/sin_tab.h"
click node_keys "https://github.com/chshzh/inverter_stm32/blob/master/USER/key.c"
click node_display "https://github.com/chshzh/inverter_stm32/blob/master/USER/Display.c"
click node_lcd "https://github.com/chshzh/inverter_stm32/blob/master/USER/st7920.c"
click node_adcapp "https://github.com/chshzh/inverter_stm32/blob/master/USER/adc.c"
click node_timlib "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/src/stm32f10x_tim.c"
click node_timheader "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_tim.h"
click node_adclib "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/src/stm32f10x_adc.c"
click node_adcheader "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_adc.h"
click node_rcc "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/src/stm32f10x_rcc.c"
click node_rcch "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_rcc.h"
click node_gpio "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/src/stm32f10x_gpio.c"
click node_gpioh "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_gpio.h"
click node_dma "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/src/stm32f10x_dma.c"
click node_dmah "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_dma.h"
click node_exti "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_exti.h"
click node_misc "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/misc.h"
click node_can "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_can.h"
click node_fsmc "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_fsmc.h"
click node_sdio "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_sdio.h"
click node_spi "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_spi.h"
click node_usart "https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_usart.h"
click node_core "https://github.com/chshzh/inverter_stm32/blob/master/CMSIS/core_cm3.h"
click node_devicehdr "https://github.com/chshzh/inverter_stm32/blob/master/CMSIS/stm32f10x.h"
click node_system "https://github.com/chshzh/inverter_stm32/blob/master/CMSIS/system_stm32f10x.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_control,node_sine,node_adcapp toneBlue
class node_keys,node_display,node_lcd toneAmber
class node_timlib,node_timheader,node_adclib,node_adcheader,node_rcc,node_rcch,node_gpio,node_gpioh,node_dma,node_dmah,node_exti,node_misc,node_can,node_fsmc,node_sdio,node_spi,node_usart toneMint
class node_core,node_devicehdr,node_system toneRose
class node_operator toneIndigo
```

## Components

### Inverter application

- [Application entry](https://github.com/chshzh/inverter_stm32/blob/master/USER/main.c): `USER/main.c`
- [Inverter control](https://github.com/chshzh/inverter_stm32/blob/master/USER/Timer.c): `USER/Timer.c`
- [Sine table](https://github.com/chshzh/inverter_stm32/blob/master/USER/sin_tab.h): `USER/sin_tab.h`
- [Application ADC](https://github.com/chshzh/inverter_stm32/blob/master/USER/adc.c): `USER/adc.c`

### User interface

- [Key input](https://github.com/chshzh/inverter_stm32/blob/master/USER/key.c): `USER/key.c`
- [Display driver](https://github.com/chshzh/inverter_stm32/blob/master/USER/Display.c): `USER/Display.c`
- [ST7920 LCD](https://github.com/chshzh/inverter_stm32/blob/master/USER/st7920.c): `USER/st7920.c`

### STM32 peripheral support

- [Timer library](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/src/stm32f10x_tim.c): `FWlib/src/stm32f10x_tim.c`
- [Timer API](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_tim.h): `FWlib/inc/stm32f10x_tim.h`
- [ADC library](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/src/stm32f10x_adc.c): `FWlib/src/stm32f10x_adc.c`
- [ADC API](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_adc.h): `FWlib/inc/stm32f10x_adc.h`
- [Clock control](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/src/stm32f10x_rcc.c): `FWlib/src/stm32f10x_rcc.c`
- [Clock API](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_rcc.h): `FWlib/inc/stm32f10x_rcc.h`
- [GPIO driver](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/src/stm32f10x_gpio.c): `FWlib/src/stm32f10x_gpio.c`
- [GPIO API](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_gpio.h): `FWlib/inc/stm32f10x_gpio.h`
- [DMA driver](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/src/stm32f10x_dma.c): `FWlib/src/stm32f10x_dma.c`
- [DMA API](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_dma.h): `FWlib/inc/stm32f10x_dma.h`
- [EXTI API](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_exti.h): `FWlib/inc/stm32f10x_exti.h`
- [NVIC and SysTick](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/misc.h): `FWlib/inc/misc.h`
- [CAN API](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_can.h): `FWlib/inc/stm32f10x_can.h`
- [FSMC API](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_fsmc.h): `FWlib/inc/stm32f10x_fsmc.h`
- [SDIO API](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_sdio.h): `FWlib/inc/stm32f10x_sdio.h`
- [SPI API](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_spi.h): `FWlib/inc/stm32f10x_spi.h`
- [USART API](https://github.com/chshzh/inverter_stm32/blob/master/FWlib/inc/stm32f10x_usart.h): `FWlib/inc/stm32f10x_usart.h`

### CMSIS device support

- [Cortex-M3 core](https://github.com/chshzh/inverter_stm32/blob/master/CMSIS/core_cm3.h): `CMSIS/core_cm3.h`
- [STM32F10x device](https://github.com/chshzh/inverter_stm32/blob/master/CMSIS/stm32f10x.h): `CMSIS/stm32f10x.h`
- [System clocks](https://github.com/chshzh/inverter_stm32/blob/master/CMSIS/system_stm32f10x.c): `CMSIS/system_stm32f10x.c`

### Other components

- **Operator**

## Connections

- Operator → Key input: adjusts settings
- Application entry → Inverter control: runs inverter
- Inverter control → Sine table: uses waveform data
- Inverter control → Display driver: reports values
- Display driver → ST7920 LCD: uses LCD driver
- Inverter control → Application ADC: measures voltage
- Inverter control → Timer library: generates SPWM
- Timer library → Timer API: implements API (evidence: `FWlib/src/stm32f10x_tim.c`)
- ADC library → ADC API: implements API (evidence: `FWlib/src/stm32f10x_adc.c`)
- Clock control → Clock API: implements API (evidence: `FWlib/src/stm32f10x_rcc.c`)
- GPIO driver → GPIO API: implements API (evidence: `FWlib/src/stm32f10x_gpio.c`)
- DMA driver → DMA API: implements API (evidence: `FWlib/src/stm32f10x_dma.c`)
- System clocks → STM32F10x device: configures clocks (evidence: `CMSIS/system_stm32f10x.c`)
