Skip to main content

embassy_dt_stm32/
lib.rs

1#![no_std]
2#![forbid(unsafe_code)]
3#![warn(missing_docs)]
4
5//! The STM32 backend for [`embassy-dt`](https://docs.rs/embassy-dt).
6//!
7//! Supported chips (one feature per build):
8//!
9//! - `stm32h723zg` (default) / `stm32h723vg` (H7)
10//! - `stm32f411ce` (F4)
11//! - `stm32l476rg` (L4)
12//! - `stm32g474re` / `stm32g474ve` (G4)
13//! - `stm32f103c8` / `stm32f103re` (F1)
14//! - `stm32f072rb` (F0)
15//!
16//! ## Usage
17//!
18//! Describe the hardware with `.dts` / `.dtsi` files: chip-level `.dtsi` is shared, and
19//! board-level `.dts` overlays the differences. Declaring `backend stm32;` in
20//! `device_tree!` generates a typed `Board` structure:
21//!
22//! ```rust,ignore
23//! use embassy_dt::device_tree;
24//!
25//! device_tree! {
26//!     name "my-board";
27//!     backend stm32;
28//!     chip "stm32h723zg";
29//!     from "boards/my-board.dts";
30//! }
31//!
32//! // Application code:
33//! // #[embassy_executor::main]
34//! // async fn main(_s: Spawner) {
35//! //     let board = Board::init(embassy_stm32::init(clock_config()));
36//! //     app::heartbeat(&mut board.led0).await;
37//! // }
38//! ```
39//!
40//! Pin/peripheral AF compatibility is guaranteed at compile time by the
41//! `embassy-stm32` type system: for example, if `PB8` is not a legal I2C1 SCL pin, the
42//! code simply does not compile.
43//!
44//! Supported nodes: `I2c` / `Spi` / `Uart` (async + DMA, including shared buses),
45//! `gpio Out/In/Pin` (EXTI async inputs), and peripherals `Rng` / `Adc` / `Crc` /
46//! `Dac` / `Pwm` / `Can` / `Usb` / `Qei` / `InputCapture` / `Sdmmc` / `I2s` /
47//! `PwmInput` / `ComplementaryPwm`, plus intent-based clock configuration. Complete
48//! examples live in the repository `examples/` directory.
49
50pub mod f411;
51pub mod h723;