How cn-vik/pwm-protocol-data-driven works
This is an STM32F103 firmware example for a data-driven PWM protocol, with an RGB color-cycling loop as its visible application workflow. The main loop initializes GPIO, DMA, and TIM1, then selects RGB colors through the PWM protocol interface. Protocol internals and interrupt/DMA behavior were not excerpted, so those implementation relationships are left unverified rather than treated as confirmed calls.
Main entry points: main.c Firmware loop · protocol_pwm.c PWM encoding · protocol_pwm.h PWM interface · dma.c DMA setup
Components 8
Application
- Firmware loop
project/stm32f103_LL_keil/Core/Src/main.c - Application definitions
project/stm32f103_LL_keil/Core/Inc/main.h
PWM Protocol
- PWM encoding
project/stm32f103_LL_keil/Core/Src/protocol_pwm.c - PWM interface
project/stm32f103_LL_keil/Core/Src/protocol_pwm.h
MCU Peripherals
- GPIO setup
project/stm32f103_LL_keil/Core/Src/gpio.c - DMA setup
project/stm32f103_LL_keil/Core/Src/dma.c - TIM1 setup
project/stm32f103_LL_keil/Core/Src/tim.c
Other components
- RGB LED
Connections 9
- Firmware loop → Application definitions: uses definitions
project/stm32f103_LL_keil/Core/Src/main.c - Firmware loop → GPIO setup: initializes
project/stm32f103_LL_keil/Core/Src/main.c - Firmware loop → DMA setup: initializes
project/stm32f103_LL_keil/Core/Src/main.c - Firmware loop → TIM1 setup: initializes
project/stm32f103_LL_keil/Core/Src/main.c - Firmware loop → PWM interface: calls color setter
project/stm32f103_LL_keil/Core/Src/main.c - PWM interface → PWM encoding: implemented by
- PWM encoding → TIM1 setup: configures PWM
- PWM encoding → DMA setup: transfers data
- PWM encoding → RGB LED: drives colors