embassy/embassy-stm32f4/src/lib.rs
Dario Nieuwenhuis 11be9170ec Cleanup interrupt package naming. Fixes #40
The `interrupt` package previously tried to be drop-in compatible with the
`interrupt` package from PACs. THis meant that there was both a PAC-style enum
value `UARTE0` and an embassy-style owned `UARTE0Interrupt` type. This made
things VERY confusing.

This drops compatibility with the PAC, improving the names for embassy interrupts.
2021-02-26 01:55:27 +01:00

318 lines
16 KiB
Rust

#![no_std]
#![feature(generic_associated_types)]
#![feature(asm)]
#![feature(type_alias_impl_trait)]
#![allow(incomplete_features)]
#[cfg(not(any(
feature = "stm32f401",
feature = "stm32f405",
feature = "stm32f407",
feature = "stm32f410",
feature = "stm32f411",
feature = "stm32f412",
feature = "stm32f413",
feature = "stm32f415",
feature = "stm32f417",
feature = "stm32f423",
feature = "stm32f427",
feature = "stm32f429",
feature = "stm32f437",
feature = "stm32f439",
feature = "stm32f446",
feature = "stm32f469",
feature = "stm32f479",
)))]
compile_error!(
"No chip feature activated. You must activate exactly one of the following features: "
);
#[cfg(any(
all(feature = "stm32f401", feature = "stm32f405"),
all(feature = "stm32f401", feature = "stm32f407"),
all(feature = "stm32f401", feature = "stm32f410"),
all(feature = "stm32f401", feature = "stm32f411"),
all(feature = "stm32f401", feature = "stm32f412"),
all(feature = "stm32f401", feature = "stm32f413"),
all(feature = "stm32f401", feature = "stm32f415"),
all(feature = "stm32f401", feature = "stm32f417"),
all(feature = "stm32f401", feature = "stm32f423"),
all(feature = "stm32f401", feature = "stm32f427"),
all(feature = "stm32f401", feature = "stm32f429"),
all(feature = "stm32f401", feature = "stm32f437"),
all(feature = "stm32f401", feature = "stm32f439"),
all(feature = "stm32f401", feature = "stm32f446"),
all(feature = "stm32f401", feature = "stm32f469"),
all(feature = "stm32f401", feature = "stm32f479"),
all(feature = "stm32f405", feature = "stm32f401"),
all(feature = "stm32f405", feature = "stm32f407"),
all(feature = "stm32f405", feature = "stm32f410"),
all(feature = "stm32f405", feature = "stm32f411"),
all(feature = "stm32f405", feature = "stm32f412"),
all(feature = "stm32f405", feature = "stm32f413"),
all(feature = "stm32f405", feature = "stm32f415"),
all(feature = "stm32f405", feature = "stm32f417"),
all(feature = "stm32f405", feature = "stm32f423"),
all(feature = "stm32f405", feature = "stm32f427"),
all(feature = "stm32f405", feature = "stm32f429"),
all(feature = "stm32f405", feature = "stm32f437"),
all(feature = "stm32f405", feature = "stm32f439"),
all(feature = "stm32f405", feature = "stm32f446"),
all(feature = "stm32f405", feature = "stm32f469"),
all(feature = "stm32f405", feature = "stm32f479"),
all(feature = "stm32f407", feature = "stm32f401"),
all(feature = "stm32f407", feature = "stm32f405"),
all(feature = "stm32f407", feature = "stm32f410"),
all(feature = "stm32f407", feature = "stm32f411"),
all(feature = "stm32f407", feature = "stm32f412"),
all(feature = "stm32f407", feature = "stm32f413"),
all(feature = "stm32f407", feature = "stm32f415"),
all(feature = "stm32f407", feature = "stm32f417"),
all(feature = "stm32f407", feature = "stm32f423"),
all(feature = "stm32f407", feature = "stm32f427"),
all(feature = "stm32f407", feature = "stm32f429"),
all(feature = "stm32f407", feature = "stm32f437"),
all(feature = "stm32f407", feature = "stm32f439"),
all(feature = "stm32f407", feature = "stm32f446"),
all(feature = "stm32f407", feature = "stm32f469"),
all(feature = "stm32f407", feature = "stm32f479"),
all(feature = "stm32f410", feature = "stm32f401"),
all(feature = "stm32f410", feature = "stm32f405"),
all(feature = "stm32f410", feature = "stm32f407"),
all(feature = "stm32f410", feature = "stm32f411"),
all(feature = "stm32f410", feature = "stm32f412"),
all(feature = "stm32f410", feature = "stm32f413"),
all(feature = "stm32f410", feature = "stm32f415"),
all(feature = "stm32f410", feature = "stm32f417"),
all(feature = "stm32f410", feature = "stm32f423"),
all(feature = "stm32f410", feature = "stm32f427"),
all(feature = "stm32f410", feature = "stm32f429"),
all(feature = "stm32f410", feature = "stm32f437"),
all(feature = "stm32f410", feature = "stm32f439"),
all(feature = "stm32f410", feature = "stm32f446"),
all(feature = "stm32f410", feature = "stm32f469"),
all(feature = "stm32f410", feature = "stm32f479"),
all(feature = "stm32f411", feature = "stm32f401"),
all(feature = "stm32f411", feature = "stm32f405"),
all(feature = "stm32f411", feature = "stm32f407"),
all(feature = "stm32f411", feature = "stm32f410"),
all(feature = "stm32f411", feature = "stm32f412"),
all(feature = "stm32f411", feature = "stm32f413"),
all(feature = "stm32f411", feature = "stm32f415"),
all(feature = "stm32f411", feature = "stm32f417"),
all(feature = "stm32f411", feature = "stm32f423"),
all(feature = "stm32f411", feature = "stm32f427"),
all(feature = "stm32f411", feature = "stm32f429"),
all(feature = "stm32f411", feature = "stm32f437"),
all(feature = "stm32f411", feature = "stm32f439"),
all(feature = "stm32f411", feature = "stm32f446"),
all(feature = "stm32f411", feature = "stm32f469"),
all(feature = "stm32f411", feature = "stm32f479"),
all(feature = "stm32f412", feature = "stm32f401"),
all(feature = "stm32f412", feature = "stm32f405"),
all(feature = "stm32f412", feature = "stm32f407"),
all(feature = "stm32f412", feature = "stm32f410"),
all(feature = "stm32f412", feature = "stm32f411"),
all(feature = "stm32f412", feature = "stm32f413"),
all(feature = "stm32f412", feature = "stm32f415"),
all(feature = "stm32f412", feature = "stm32f417"),
all(feature = "stm32f412", feature = "stm32f423"),
all(feature = "stm32f412", feature = "stm32f427"),
all(feature = "stm32f412", feature = "stm32f429"),
all(feature = "stm32f412", feature = "stm32f437"),
all(feature = "stm32f412", feature = "stm32f439"),
all(feature = "stm32f412", feature = "stm32f446"),
all(feature = "stm32f412", feature = "stm32f469"),
all(feature = "stm32f412", feature = "stm32f479"),
all(feature = "stm32f413", feature = "stm32f401"),
all(feature = "stm32f413", feature = "stm32f405"),
all(feature = "stm32f413", feature = "stm32f407"),
all(feature = "stm32f413", feature = "stm32f410"),
all(feature = "stm32f413", feature = "stm32f411"),
all(feature = "stm32f413", feature = "stm32f412"),
all(feature = "stm32f413", feature = "stm32f415"),
all(feature = "stm32f413", feature = "stm32f417"),
all(feature = "stm32f413", feature = "stm32f423"),
all(feature = "stm32f413", feature = "stm32f427"),
all(feature = "stm32f413", feature = "stm32f429"),
all(feature = "stm32f413", feature = "stm32f437"),
all(feature = "stm32f413", feature = "stm32f439"),
all(feature = "stm32f413", feature = "stm32f446"),
all(feature = "stm32f413", feature = "stm32f469"),
all(feature = "stm32f413", feature = "stm32f479"),
all(feature = "stm32f415", feature = "stm32f401"),
all(feature = "stm32f415", feature = "stm32f405"),
all(feature = "stm32f415", feature = "stm32f407"),
all(feature = "stm32f415", feature = "stm32f410"),
all(feature = "stm32f415", feature = "stm32f411"),
all(feature = "stm32f415", feature = "stm32f412"),
all(feature = "stm32f415", feature = "stm32f413"),
all(feature = "stm32f415", feature = "stm32f417"),
all(feature = "stm32f415", feature = "stm32f423"),
all(feature = "stm32f415", feature = "stm32f427"),
all(feature = "stm32f415", feature = "stm32f429"),
all(feature = "stm32f415", feature = "stm32f437"),
all(feature = "stm32f415", feature = "stm32f439"),
all(feature = "stm32f415", feature = "stm32f446"),
all(feature = "stm32f415", feature = "stm32f469"),
all(feature = "stm32f415", feature = "stm32f479"),
all(feature = "stm32f417", feature = "stm32f401"),
all(feature = "stm32f417", feature = "stm32f405"),
all(feature = "stm32f417", feature = "stm32f407"),
all(feature = "stm32f417", feature = "stm32f410"),
all(feature = "stm32f417", feature = "stm32f411"),
all(feature = "stm32f417", feature = "stm32f412"),
all(feature = "stm32f417", feature = "stm32f413"),
all(feature = "stm32f417", feature = "stm32f415"),
all(feature = "stm32f417", feature = "stm32f423"),
all(feature = "stm32f417", feature = "stm32f427"),
all(feature = "stm32f417", feature = "stm32f429"),
all(feature = "stm32f417", feature = "stm32f437"),
all(feature = "stm32f417", feature = "stm32f439"),
all(feature = "stm32f417", feature = "stm32f446"),
all(feature = "stm32f417", feature = "stm32f469"),
all(feature = "stm32f417", feature = "stm32f479"),
all(feature = "stm32f423", feature = "stm32f401"),
all(feature = "stm32f423", feature = "stm32f405"),
all(feature = "stm32f423", feature = "stm32f407"),
all(feature = "stm32f423", feature = "stm32f410"),
all(feature = "stm32f423", feature = "stm32f411"),
all(feature = "stm32f423", feature = "stm32f412"),
all(feature = "stm32f423", feature = "stm32f413"),
all(feature = "stm32f423", feature = "stm32f415"),
all(feature = "stm32f423", feature = "stm32f417"),
all(feature = "stm32f423", feature = "stm32f427"),
all(feature = "stm32f423", feature = "stm32f429"),
all(feature = "stm32f423", feature = "stm32f437"),
all(feature = "stm32f423", feature = "stm32f439"),
all(feature = "stm32f423", feature = "stm32f446"),
all(feature = "stm32f423", feature = "stm32f469"),
all(feature = "stm32f423", feature = "stm32f479"),
all(feature = "stm32f427", feature = "stm32f401"),
all(feature = "stm32f427", feature = "stm32f405"),
all(feature = "stm32f427", feature = "stm32f407"),
all(feature = "stm32f427", feature = "stm32f410"),
all(feature = "stm32f427", feature = "stm32f411"),
all(feature = "stm32f427", feature = "stm32f412"),
all(feature = "stm32f427", feature = "stm32f413"),
all(feature = "stm32f427", feature = "stm32f415"),
all(feature = "stm32f427", feature = "stm32f417"),
all(feature = "stm32f427", feature = "stm32f423"),
all(feature = "stm32f427", feature = "stm32f429"),
all(feature = "stm32f427", feature = "stm32f437"),
all(feature = "stm32f427", feature = "stm32f439"),
all(feature = "stm32f427", feature = "stm32f446"),
all(feature = "stm32f427", feature = "stm32f469"),
all(feature = "stm32f427", feature = "stm32f479"),
all(feature = "stm32f429", feature = "stm32f401"),
all(feature = "stm32f429", feature = "stm32f405"),
all(feature = "stm32f429", feature = "stm32f407"),
all(feature = "stm32f429", feature = "stm32f410"),
all(feature = "stm32f429", feature = "stm32f411"),
all(feature = "stm32f429", feature = "stm32f412"),
all(feature = "stm32f429", feature = "stm32f413"),
all(feature = "stm32f429", feature = "stm32f415"),
all(feature = "stm32f429", feature = "stm32f417"),
all(feature = "stm32f429", feature = "stm32f423"),
all(feature = "stm32f429", feature = "stm32f427"),
all(feature = "stm32f429", feature = "stm32f437"),
all(feature = "stm32f429", feature = "stm32f439"),
all(feature = "stm32f429", feature = "stm32f446"),
all(feature = "stm32f429", feature = "stm32f469"),
all(feature = "stm32f429", feature = "stm32f479"),
all(feature = "stm32f437", feature = "stm32f401"),
all(feature = "stm32f437", feature = "stm32f405"),
all(feature = "stm32f437", feature = "stm32f407"),
all(feature = "stm32f437", feature = "stm32f410"),
all(feature = "stm32f437", feature = "stm32f411"),
all(feature = "stm32f437", feature = "stm32f412"),
all(feature = "stm32f437", feature = "stm32f413"),
all(feature = "stm32f437", feature = "stm32f415"),
all(feature = "stm32f437", feature = "stm32f417"),
all(feature = "stm32f437", feature = "stm32f423"),
all(feature = "stm32f437", feature = "stm32f427"),
all(feature = "stm32f437", feature = "stm32f429"),
all(feature = "stm32f437", feature = "stm32f439"),
all(feature = "stm32f437", feature = "stm32f446"),
all(feature = "stm32f437", feature = "stm32f469"),
all(feature = "stm32f437", feature = "stm32f479"),
all(feature = "stm32f439", feature = "stm32f401"),
all(feature = "stm32f439", feature = "stm32f405"),
all(feature = "stm32f439", feature = "stm32f407"),
all(feature = "stm32f439", feature = "stm32f410"),
all(feature = "stm32f439", feature = "stm32f411"),
all(feature = "stm32f439", feature = "stm32f412"),
all(feature = "stm32f439", feature = "stm32f413"),
all(feature = "stm32f439", feature = "stm32f415"),
all(feature = "stm32f439", feature = "stm32f417"),
all(feature = "stm32f439", feature = "stm32f423"),
all(feature = "stm32f439", feature = "stm32f427"),
all(feature = "stm32f439", feature = "stm32f429"),
all(feature = "stm32f439", feature = "stm32f437"),
all(feature = "stm32f439", feature = "stm32f446"),
all(feature = "stm32f439", feature = "stm32f469"),
all(feature = "stm32f439", feature = "stm32f479"),
all(feature = "stm32f446", feature = "stm32f401"),
all(feature = "stm32f446", feature = "stm32f405"),
all(feature = "stm32f446", feature = "stm32f407"),
all(feature = "stm32f446", feature = "stm32f410"),
all(feature = "stm32f446", feature = "stm32f411"),
all(feature = "stm32f446", feature = "stm32f412"),
all(feature = "stm32f446", feature = "stm32f413"),
all(feature = "stm32f446", feature = "stm32f415"),
all(feature = "stm32f446", feature = "stm32f417"),
all(feature = "stm32f446", feature = "stm32f423"),
all(feature = "stm32f446", feature = "stm32f427"),
all(feature = "stm32f446", feature = "stm32f429"),
all(feature = "stm32f446", feature = "stm32f437"),
all(feature = "stm32f446", feature = "stm32f439"),
all(feature = "stm32f446", feature = "stm32f469"),
all(feature = "stm32f446", feature = "stm32f479"),
all(feature = "stm32f469", feature = "stm32f401"),
all(feature = "stm32f469", feature = "stm32f405"),
all(feature = "stm32f469", feature = "stm32f407"),
all(feature = "stm32f469", feature = "stm32f410"),
all(feature = "stm32f469", feature = "stm32f411"),
all(feature = "stm32f469", feature = "stm32f412"),
all(feature = "stm32f469", feature = "stm32f413"),
all(feature = "stm32f469", feature = "stm32f415"),
all(feature = "stm32f469", feature = "stm32f417"),
all(feature = "stm32f469", feature = "stm32f423"),
all(feature = "stm32f469", feature = "stm32f427"),
all(feature = "stm32f469", feature = "stm32f429"),
all(feature = "stm32f469", feature = "stm32f437"),
all(feature = "stm32f469", feature = "stm32f439"),
all(feature = "stm32f469", feature = "stm32f446"),
all(feature = "stm32f469", feature = "stm32f479"),
all(feature = "stm32f479", feature = "stm32f401"),
all(feature = "stm32f479", feature = "stm32f405"),
all(feature = "stm32f479", feature = "stm32f407"),
all(feature = "stm32f479", feature = "stm32f410"),
all(feature = "stm32f479", feature = "stm32f411"),
all(feature = "stm32f479", feature = "stm32f412"),
all(feature = "stm32f479", feature = "stm32f413"),
all(feature = "stm32f479", feature = "stm32f415"),
all(feature = "stm32f479", feature = "stm32f417"),
all(feature = "stm32f479", feature = "stm32f423"),
all(feature = "stm32f479", feature = "stm32f427"),
all(feature = "stm32f479", feature = "stm32f429"),
all(feature = "stm32f479", feature = "stm32f437"),
all(feature = "stm32f479", feature = "stm32f439"),
all(feature = "stm32f479", feature = "stm32f446"),
all(feature = "stm32f479", feature = "stm32f469"),
))]
compile_error!(
"Multile chip features activated. You must activate exactly one of the following features: "
);
pub use stm32f4xx_hal as hal;
pub use stm32f4xx_hal::stm32 as pac;
// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;
pub mod exti;
pub mod interrupt;
pub mod rtc;
pub mod serial;