diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index 6701ff8f..3fae66e9 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml @@ -42,5 +42,7 @@ cortex-m-rt = "0.6.13" cortex-m = "0.7.1" embedded-hal = { version = "0.2.4" } embedded-dma = { version = "0.1.2" } +bxcan = "0.5.0" +nb = "*" stm32f4xx-hal = { version = "0.8.3", features = ["rt", "can"], git = "https://github.com/stm32-rs/stm32f4xx-hal.git", optional = true } -stm32l0xx-hal = { version = "0.7.0", features = ["rt"], git = "https://github.com/stm32-rs/stm32l0xx-hal.git", optional = true } \ No newline at end of file +stm32l0xx-hal = { version = "0.7.0", features = ["rt"], optional = true } \ No newline at end of file diff --git a/embassy-stm32f4/src/can.rs b/embassy-stm32/src/can.rs similarity index 85% rename from embassy-stm32f4/src/can.rs rename to embassy-stm32/src/can.rs index 526d002c..f97e900e 100644 --- a/embassy-stm32f4/src/can.rs +++ b/embassy-stm32/src/can.rs @@ -95,6 +95,25 @@ macro_rules! can { } } +#[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", +))] can! { CAN1 => (CAN1_TX, CAN1_RX0), CAN2 => (CAN2_TX, CAN2_RX0), diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 954067f3..8a1fe5a3 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs @@ -34,3 +34,42 @@ pub mod fmt; pub mod exti; pub mod interrupt; + +#[cfg(any( + 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", +))] +pub mod can; + +#[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", +))] +pub mod rtc; diff --git a/embassy-stm32f4/src/rtc.rs b/embassy-stm32/src/rtc.rs similarity index 100% rename from embassy-stm32f4/src/rtc.rs rename to embassy-stm32/src/rtc.rs diff --git a/embassy-stm32f4/src/lib.rs b/embassy-stm32f4/src/lib.rs index bdd4d0fd..eb6f04f8 100644 --- a/embassy-stm32f4/src/lib.rs +++ b/embassy-stm32f4/src/lib.rs @@ -307,11 +307,11 @@ compile_error!( "Multile chip features activated. You must activate exactly one of the following features: " ); -pub use embassy_stm32::{exti, fmt, hal, interrupt, pac}; +pub use embassy_stm32::{exti, fmt, hal, interrupt, pac, rtc}; #[cfg(not(any(feature = "stm32f401", feature = "stm32f410", feature = "stm32f411",)))] -pub mod can; +pub use embassy_stm32::can; + #[cfg(not(feature = "stm32f410"))] pub mod qei; -pub mod rtc; pub mod serial;