Embassy STM32 HAL
Embassy STM32 HAL is based on the stm32-metapac
project.
The Infinite Variant Problem
STM32 microcontrollers have many series and variants, and supporting all of them is a huge engineering undertaking. Embassy leverages the fact that STM32 peripheral versions are shared across chip families. Instead of reimplementing the SPI peripheral for each STM32 chip family, Embassy has a single SPI implementation that relies on code-generated register types, which are the same for STM32 families with the same peripheral version.
Metapac
The stm32-metapac
module uses pre-generated chip and register definitions for STM32 chip families to generate register types. This is done at compile time based on Cargo feature flags.
Chip and register definitions are located in a separate module stm32-data
, which is modified whenever errors are found in the definitions or support for new chip families is added.
HAL
The embassy-stm32
module contains the HAL implementation for all STM32 families. The implementation uses automatically derived feature flags to support the correct version of a given peripheral for a given chip family.
Timer Driver
The STM32 timer driver runs at 32768 Hz by default.