Files
.github
.vscode
cyw43
cyw43-firmware
cyw43-pio
docs
modules
ROOT
examples
images
pages
basic_application.adoc
bootloader.adoc
developer.adoc
developer_stm32.adoc
examples.adoc
getting_started.adoc
hal.adoc
index.adoc
layer_by_layer.adoc
nrf.adoc
runtime.adoc
stm32.adoc
nav.adoc
antora.yml
embassy-boot
embassy-embedded-hal
embassy-executor
embassy-futures
embassy-hal-internal
embassy-lora
embassy-macros
embassy-net
embassy-net-adin1110
embassy-net-driver
embassy-net-driver-channel
embassy-net-enc28j60
embassy-net-esp-hosted
embassy-net-ppp
embassy-net-tuntap
embassy-net-wiznet
embassy-nrf
embassy-rp
embassy-stm32
embassy-stm32-wpan
embassy-sync
embassy-time
embassy-usb
embassy-usb-driver
embassy-usb-logger
examples
tests
.gitattributes
.gitignore
LICENSE-APACHE
LICENSE-MIT
NOTICE.md
README.md
ci.sh
ci_stable.sh
rust-toolchain.toml
rustfmt.toml
embassy/docs/modules/ROOT/pages/stm32.adoc
2022-11-15 10:10:36 +01:00

25 lines
1.3 KiB
Plaintext

= Embassy STM32 HAL
The link:https://github.com/embassy-rs/embassy/tree/master/embassy-stm32[Embassy STM32 HAL] is based on the `stm32-metapac` project.
== The infinite variant problem
STM32 microcontrollers come in many families, and flavors and supporting all of them is a big undertaking. Embassy has taken advantage of the fact
that the STM32 peripheral versions are shared across chip families. Instead of re-implementing the SPI
peripheral for every STM32 chip family, embassy has a single SPI implementation that depends on
code-generated register types that are identical for STM32 families with the same version of a given peripheral.
=== The 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.
The chip and register definitions are located in a separate module, `stm32-data`, which is modified whenever a bug is found in the definitions, or when adding support for new chip families.
=== The 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 operates at 32768 Hz by default.