2021-03-19 20:26:20 +00:00
|
|
|
#![no_std]
|
|
|
|
#![feature(generic_associated_types)]
|
|
|
|
#![feature(asm)]
|
|
|
|
#![feature(min_type_alias_impl_trait)]
|
|
|
|
#![feature(impl_trait_in_bindings)]
|
|
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
#![allow(incomplete_features)]
|
|
|
|
|
|
|
|
#[cfg(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",
|
|
|
|
))]
|
2021-03-30 15:05:52 +00:00
|
|
|
mod f4;
|
|
|
|
|
|
|
|
#[cfg(any(
|
|
|
|
feature = "stm32f401",
|
|
|
|
feature = "stm32f405",
|
|
|
|
feature = "stm32f407",
|
|
|
|
feature = "stm32f412",
|
|
|
|
feature = "stm32f413",
|
|
|
|
feature = "stm32f415",
|
|
|
|
feature = "stm32f417",
|
|
|
|
feature = "stm32f423",
|
|
|
|
feature = "stm32f427",
|
|
|
|
feature = "stm32f429",
|
|
|
|
feature = "stm32f437",
|
|
|
|
feature = "stm32f439",
|
|
|
|
feature = "stm32f446",
|
|
|
|
feature = "stm32f469",
|
|
|
|
feature = "stm32f479",
|
|
|
|
))]
|
2021-03-19 20:26:20 +00:00
|
|
|
pub use {stm32f4xx_hal as hal, stm32f4xx_hal::stm32 as pac};
|
|
|
|
|
|
|
|
#[cfg(any(feature = "stm32l0x1", feature = "stm32l0x2", feature = "stm32l0x3",))]
|
|
|
|
pub use {stm32l0xx_hal as hal, stm32l0xx_hal::pac};
|
|
|
|
|
|
|
|
pub mod fmt;
|
|
|
|
|
2021-03-20 16:07:16 +00:00
|
|
|
pub mod exti;
|
2021-03-19 20:26:20 +00:00
|
|
|
pub mod interrupt;
|
2021-03-19 00:30:35 +00:00
|
|
|
|
|
|
|
#[cfg(any(
|
|
|
|
feature = "stm32f401",
|
|
|
|
feature = "stm32f405",
|
|
|
|
feature = "stm32f407",
|
2021-03-27 00:34:52 +00:00
|
|
|
feature = "stm32f412",
|
|
|
|
feature = "stm32f413",
|
|
|
|
feature = "stm32f415",
|
|
|
|
feature = "stm32f417",
|
|
|
|
feature = "stm32f423",
|
|
|
|
feature = "stm32f427",
|
|
|
|
feature = "stm32f429",
|
|
|
|
feature = "stm32f437",
|
|
|
|
feature = "stm32f439",
|
|
|
|
feature = "stm32f446",
|
|
|
|
feature = "stm32f469",
|
|
|
|
feature = "stm32f479",
|
|
|
|
))]
|
|
|
|
pub mod can;
|
|
|
|
|
|
|
|
#[cfg(any(
|
|
|
|
feature = "stm32f401",
|
|
|
|
feature = "stm32f405",
|
|
|
|
feature = "stm32f407",
|
2021-03-19 00:30:35 +00:00
|
|
|
feature = "stm32f412",
|
|
|
|
feature = "stm32f413",
|
|
|
|
feature = "stm32f415",
|
|
|
|
feature = "stm32f417",
|
|
|
|
feature = "stm32f423",
|
|
|
|
feature = "stm32f427",
|
|
|
|
feature = "stm32f429",
|
|
|
|
feature = "stm32f437",
|
|
|
|
feature = "stm32f439",
|
|
|
|
feature = "stm32f446",
|
|
|
|
feature = "stm32f469",
|
|
|
|
feature = "stm32f479",
|
|
|
|
))]
|
2021-03-27 00:34:52 +00:00
|
|
|
pub mod rtc;
|
2021-03-28 02:24:21 +00:00
|
|
|
|
2021-03-30 15:05:52 +00:00
|
|
|
#[cfg(any(
|
|
|
|
feature = "stm32f401",
|
|
|
|
feature = "stm32f405",
|
|
|
|
feature = "stm32f407",
|
|
|
|
feature = "stm32f412",
|
|
|
|
feature = "stm32f413",
|
|
|
|
feature = "stm32f415",
|
|
|
|
feature = "stm32f417",
|
|
|
|
feature = "stm32f423",
|
|
|
|
feature = "stm32f427",
|
|
|
|
feature = "stm32f429",
|
|
|
|
feature = "stm32f437",
|
|
|
|
feature = "stm32f439",
|
|
|
|
feature = "stm32f446",
|
|
|
|
feature = "stm32f469",
|
|
|
|
feature = "stm32f479",
|
|
|
|
))]
|
2021-04-13 21:11:06 +00:00
|
|
|
pub use f4::{serial, spi};
|
2021-03-30 15:05:52 +00:00
|
|
|
|
2021-03-28 02:42:26 +00:00
|
|
|
#[cfg(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",
|
|
|
|
))]
|
2021-03-19 00:30:35 +00:00
|
|
|
unsafe impl embassy_extras::usb::USBInterrupt for interrupt::OTG_FS {}
|
2021-03-28 02:31:49 +00:00
|
|
|
|
2021-03-27 22:27:39 +00:00
|
|
|
use core::option::Option;
|
|
|
|
use hal::prelude::*;
|
|
|
|
use hal::rcc::Clocks;
|
|
|
|
|
|
|
|
#[cfg(feature = "stm32f446")]
|
2021-03-29 13:57:40 +00:00
|
|
|
embassy_extras::std_peripherals! {
|
2021-03-27 22:27:39 +00:00
|
|
|
DCMI,
|
|
|
|
FMC,
|
|
|
|
DBGMCU,
|
|
|
|
DMA2,
|
|
|
|
DMA1,
|
|
|
|
// RCC,
|
|
|
|
GPIOH,
|
|
|
|
GPIOG,
|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