aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxoviat <[email protected]>2021-03-19 15:26:20 -0500
committerxoviat <[email protected]>2021-03-19 15:26:20 -0500
commit03ecc91d552328f625c3ed13088291272123784f (patch)
treebb2b333b5cd66b5443fd3aedd8e1f181848c55cf
parentc8d90f3e75aca252cda49192d61a6b4a756c106b (diff)
stm32: consolidate functionality into new pkg
-rw-r--r--Cargo.toml1
-rw-r--r--embassy-stm32/Cargo.toml46
-rw-r--r--embassy-stm32/src/fmt.rs (renamed from embassy-stm32f4/src/fmt.rs)0
-rw-r--r--embassy-stm32/src/interrupt.rs (renamed from embassy-stm32f4/src/interrupt.rs)102
-rw-r--r--embassy-stm32/src/lib.rs35
-rw-r--r--embassy-stm32f4/Cargo.toml36
-rw-r--r--embassy-stm32f4/src/lib.rs7
-rw-r--r--embassy-stm32l0/Cargo.toml7
-rw-r--r--embassy-stm32l0/src/fmt.rs119
-rw-r--r--embassy-stm32l0/src/interrupt.rs162
-rw-r--r--embassy-stm32l0/src/lib.rs7
11 files changed, 208 insertions, 314 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 31fe26476..d9fbeaf45 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,6 +4,7 @@ members = [
4 "embassy", 4 "embassy",
5 "embassy-traits", 5 "embassy-traits",
6 "embassy-nrf", 6 "embassy-nrf",
7 "embassy-stm32",
7 "embassy-stm32f4", 8 "embassy-stm32f4",
8 "embassy-stm32l0", 9 "embassy-stm32l0",
9 "embassy-nrf-examples", 10 "embassy-nrf-examples",
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
new file mode 100644
index 000000000..6701ff8f3
--- /dev/null
+++ b/embassy-stm32/Cargo.toml
@@ -0,0 +1,46 @@
1[package]
2name = "embassy-stm32"
3version = "0.1.0"
4authors = ["Dario Nieuwenhuis <[email protected]>"]
5edition = "2018"
6
7[features]
8defmt-trace = [ ]
9defmt-debug = [ ]
10defmt-info = [ ]
11defmt-warn = [ ]
12defmt-error = [ ]
13
14stm32f401 = ["stm32f4xx-hal/stm32f401"]
15stm32f405 = ["stm32f4xx-hal/stm32f405"]
16stm32f407 = ["stm32f4xx-hal/stm32f407"]
17stm32f410 = ["stm32f4xx-hal/stm32f410"]
18stm32f411 = ["stm32f4xx-hal/stm32f411"]
19stm32f412 = ["stm32f4xx-hal/stm32f412"]
20stm32f413 = ["stm32f4xx-hal/stm32f413"]
21stm32f415 = ["stm32f4xx-hal/stm32f405"]
22stm32f417 = ["stm32f4xx-hal/stm32f407"]
23stm32f423 = ["stm32f4xx-hal/stm32f413"]
24stm32f427 = ["stm32f4xx-hal/stm32f427"]
25stm32f429 = ["stm32f4xx-hal/stm32f429"]
26stm32f437 = ["stm32f4xx-hal/stm32f427"]
27stm32f439 = ["stm32f4xx-hal/stm32f429"]
28stm32f446 = ["stm32f4xx-hal/stm32f446"]
29stm32f469 = ["stm32f4xx-hal/stm32f469"]
30stm32f479 = ["stm32f4xx-hal/stm32f469"]
31
32stm32l0x1 = ["stm32l0xx-hal/stm32l0x1"]
33stm32l0x2 = ["stm32l0xx-hal/stm32l0x2"]
34stm32l0x3 = ["stm32l0xx-hal/stm32l0x3"]
35
36[dependencies]
37embassy = { version = "0.1.0", path = "../embassy" }
38
39defmt = { version = "0.2.0", optional = true }
40log = { version = "0.4.11", optional = true }
41cortex-m-rt = "0.6.13"
42cortex-m = "0.7.1"
43embedded-hal = { version = "0.2.4" }
44embedded-dma = { version = "0.1.2" }
45stm32f4xx-hal = { version = "0.8.3", features = ["rt", "can"], git = "https://github.com/stm32-rs/stm32f4xx-hal.git", optional = true }
46stm32l0xx-hal = { version = "0.7.0", features = ["rt"], git = "https://github.com/stm32-rs/stm32l0xx-hal.git", optional = true } \ No newline at end of file
diff --git a/embassy-stm32f4/src/fmt.rs b/embassy-stm32/src/fmt.rs
index 160642ccd..160642ccd 100644
--- a/embassy-stm32f4/src/fmt.rs
+++ b/embassy-stm32/src/fmt.rs
diff --git a/embassy-stm32f4/src/interrupt.rs b/embassy-stm32/src/interrupt.rs
index 402aee582..5ad7ef8ef 100644
--- a/embassy-stm32f4/src/interrupt.rs
+++ b/embassy-stm32/src/interrupt.rs
@@ -1022,4 +1022,106 @@ mod irqs {
1022 declare!(DSIHOST); 1022 declare!(DSIHOST);
1023} 1023}
1024 1024
1025#[cfg(feature = "stm32l0x1")]
1026mod irqs {
1027 use super::*;
1028 declare!(WWDG);
1029 declare!(PVD);
1030 declare!(RTC);
1031 declare!(FLASH);
1032 declare!(RCC);
1033 declare!(EXTI0_1);
1034 declare!(EXTI2_3);
1035 declare!(EXTI4_15);
1036 declare!(DMA1_CHANNEL1);
1037 declare!(DMA1_CHANNEL2_3);
1038 declare!(DMA1_CHANNEL4_7);
1039 declare!(ADC_COMP);
1040 declare!(LPTIM1);
1041 declare!(USART4_USART5);
1042 declare!(TIM2);
1043 declare!(TIM3);
1044 declare!(TIM6);
1045 declare!(TIM7);
1046 declare!(TIM21);
1047 declare!(I2C3);
1048 declare!(TIM22);
1049 declare!(I2C1);
1050 declare!(I2C2);
1051 declare!(SPI1);
1052 declare!(SPI2);
1053 declare!(USART1);
1054 declare!(USART2);
1055 declare!(AES_RNG_LPUART1);
1056}
1057
1058#[cfg(feature = "stm32l0x2")]
1059mod irqs {
1060 use super::*;
1061 declare!(WWDG);
1062 declare!(PVD);
1063 declare!(RTC);
1064 declare!(RCC);
1065 declare!(EXTI0_1);
1066 declare!(EXTI2_3);
1067 declare!(EXTI4_15);
1068 declare!(TSC);
1069 declare!(DMA1_CHANNEL1);
1070 declare!(DMA1_CHANNEL2_3);
1071 declare!(DMA1_CHANNEL4_7);
1072 declare!(ADC_COMP);
1073 declare!(LPTIM1);
1074 declare!(USART4_USART5);
1075 declare!(TIM2);
1076 declare!(TIM3);
1077 declare!(TIM6_DAC);
1078 declare!(TIM7);
1079 declare!(TIM21);
1080 declare!(I2C3);
1081 declare!(TIM22);
1082 declare!(I2C1);
1083 declare!(I2C2);
1084 declare!(SPI1);
1085 declare!(SPI2);
1086 declare!(USART1);
1087 declare!(USART2);
1088 declare!(AES_RNG_LPUART1);
1089 declare!(USB);
1090}
1091
1092#[cfg(feature = "stm32l0x3")]
1093mod irqs {
1094 use super::*;
1095 declare!(WWDG);
1096 declare!(PVD);
1097 declare!(RTC);
1098 declare!(RCC);
1099 declare!(EXTI0_1);
1100 declare!(EXTI2_3);
1101 declare!(EXTI4_15);
1102 declare!(TSC);
1103 declare!(DMA1_CHANNEL1);
1104 declare!(DMA1_CHANNEL2_3);
1105 declare!(DMA1_CHANNEL4_7);
1106 declare!(ADC_COMP);
1107 declare!(LPTIM1);
1108 declare!(USART4_USART5);
1109 declare!(TIM2);
1110 declare!(TIM3);
1111 declare!(TIM6_DAC);
1112 declare!(TIM7);
1113 declare!(TIM21);
1114 declare!(I2C3);
1115 declare!(TIM22);
1116 declare!(I2C1);
1117 declare!(I2C2);
1118 declare!(SPI1);
1119 declare!(SPI2);
1120 declare!(USART1);
1121 declare!(USART2);
1122 declare!(AES_RNG_LPUART1);
1123 declare!(LCD);
1124 declare!(USB);
1125}
1126
1025pub use irqs::*; 1127pub use irqs::*;
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs
new file mode 100644
index 000000000..a1f40b2c7
--- /dev/null
+++ b/embassy-stm32/src/lib.rs
@@ -0,0 +1,35 @@
1#![no_std]
2#![feature(generic_associated_types)]
3#![feature(asm)]
4#![feature(min_type_alias_impl_trait)]
5#![feature(impl_trait_in_bindings)]
6#![feature(type_alias_impl_trait)]
7#![allow(incomplete_features)]
8
9#[cfg(any(
10 feature = "stm32f401",
11 feature = "stm32f405",
12 feature = "stm32f407",
13 feature = "stm32f410",
14 feature = "stm32f411",
15 feature = "stm32f412",
16 feature = "stm32f413",
17 feature = "stm32f415",
18 feature = "stm32f417",
19 feature = "stm32f423",
20 feature = "stm32f427",
21 feature = "stm32f429",
22 feature = "stm32f437",
23 feature = "stm32f439",
24 feature = "stm32f446",
25 feature = "stm32f469",
26 feature = "stm32f479",
27))]
28pub use {stm32f4xx_hal as hal, stm32f4xx_hal::stm32 as pac};
29
30#[cfg(any(feature = "stm32l0x1", feature = "stm32l0x2", feature = "stm32l0x3",))]
31pub use {stm32l0xx_hal as hal, stm32l0xx_hal::pac};
32
33pub mod fmt;
34
35pub mod interrupt;
diff --git a/embassy-stm32f4/Cargo.toml b/embassy-stm32f4/Cargo.toml
index 935b4a2b0..ae3273d67 100644
--- a/embassy-stm32f4/Cargo.toml
+++ b/embassy-stm32f4/Cargo.toml
@@ -11,27 +11,27 @@ defmt-info = [ ]
11defmt-warn = [ ] 11defmt-warn = [ ]
12defmt-error = [ ] 12defmt-error = [ ]
13 13
14stm32f401 = ["stm32f4xx-hal/stm32f401"] 14stm32f401 = ["stm32f4xx-hal/stm32f401", "embassy-stm32/stm32f401"]
15stm32f405 = ["stm32f4xx-hal/stm32f405"] 15stm32f405 = ["stm32f4xx-hal/stm32f405", "embassy-stm32/stm32f405"]
16stm32f407 = ["stm32f4xx-hal/stm32f407"] 16stm32f407 = ["stm32f4xx-hal/stm32f407", "embassy-stm32/stm32f407"]
17stm32f410 = ["stm32f4xx-hal/stm32f410"] 17stm32f410 = ["stm32f4xx-hal/stm32f410", "embassy-stm32/stm32f410"]
18stm32f411 = ["stm32f4xx-hal/stm32f411"] 18stm32f411 = ["stm32f4xx-hal/stm32f411", "embassy-stm32/stm32f411"]
19stm32f412 = ["stm32f4xx-hal/stm32f412"] 19stm32f412 = ["stm32f4xx-hal/stm32f412", "embassy-stm32/stm32f412"]
20stm32f413 = ["stm32f4xx-hal/stm32f413"] 20stm32f413 = ["stm32f4xx-hal/stm32f413", "embassy-stm32/stm32f413"]
21stm32f415 = ["stm32f4xx-hal/stm32f405"] 21stm32f415 = ["stm32f4xx-hal/stm32f405", "embassy-stm32/stm32f415"]
22stm32f417 = ["stm32f4xx-hal/stm32f407"] 22stm32f417 = ["stm32f4xx-hal/stm32f407", "embassy-stm32/stm32f417"]
23stm32f423 = ["stm32f4xx-hal/stm32f413"] 23stm32f423 = ["stm32f4xx-hal/stm32f413", "embassy-stm32/stm32f423"]
24stm32f427 = ["stm32f4xx-hal/stm32f427"] 24stm32f427 = ["stm32f4xx-hal/stm32f427", "embassy-stm32/stm32f427"]
25stm32f429 = ["stm32f4xx-hal/stm32f429"] 25stm32f429 = ["stm32f4xx-hal/stm32f429", "embassy-stm32/stm32f429"]
26stm32f437 = ["stm32f4xx-hal/stm32f427"] 26stm32f437 = ["stm32f4xx-hal/stm32f427", "embassy-stm32/stm32f437"]
27stm32f439 = ["stm32f4xx-hal/stm32f429"] 27stm32f439 = ["stm32f4xx-hal/stm32f429", "embassy-stm32/stm32f439"]
28stm32f446 = ["stm32f4xx-hal/stm32f446"] 28stm32f446 = ["stm32f4xx-hal/stm32f446", "embassy-stm32/stm32f446"]
29stm32f469 = ["stm32f4xx-hal/stm32f469"] 29stm32f469 = ["stm32f4xx-hal/stm32f469", "embassy-stm32/stm32f469"]
30stm32f479 = ["stm32f4xx-hal/stm32f469"] 30stm32f479 = ["stm32f4xx-hal/stm32f469", "embassy-stm32/stm32f479"]
31 31
32[dependencies] 32[dependencies]
33embassy = { version = "0.1.0", path = "../embassy" } 33embassy = { version = "0.1.0", path = "../embassy" }
34 34embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32" }
35defmt = { version = "0.2.0", optional = true } 35defmt = { version = "0.2.0", optional = true }
36log = { version = "0.4.11", optional = true } 36log = { version = "0.4.11", optional = true }
37cortex-m-rt = "0.6.13" 37cortex-m-rt = "0.6.13"
diff --git a/embassy-stm32f4/src/lib.rs b/embassy-stm32f4/src/lib.rs
index 82d26d952..0d490525c 100644
--- a/embassy-stm32f4/src/lib.rs
+++ b/embassy-stm32f4/src/lib.rs
@@ -307,16 +307,11 @@ compile_error!(
307 "Multile chip features activated. You must activate exactly one of the following features: " 307 "Multile chip features activated. You must activate exactly one of the following features: "
308); 308);
309 309
310pub use stm32f4xx_hal as hal; 310pub use embassy_stm32::{fmt, hal, interrupt, pac};
311pub use stm32f4xx_hal::stm32 as pac;
312
313// This mod MUST go first, so that the others see its macros.
314pub(crate) mod fmt;
315 311
316#[cfg(not(any(feature = "stm32f401", feature = "stm32f410", feature = "stm32f411",)))] 312#[cfg(not(any(feature = "stm32f401", feature = "stm32f410", feature = "stm32f411",)))]
317pub mod can; 313pub mod can;
318pub mod exti; 314pub mod exti;
319pub mod interrupt;
320#[cfg(not(feature = "stm32f410"))] 315#[cfg(not(feature = "stm32f410"))]
321pub mod qei; 316pub mod qei;
322pub mod rtc; 317pub mod rtc;
diff --git a/embassy-stm32l0/Cargo.toml b/embassy-stm32l0/Cargo.toml
index c74d14076..8926763d2 100644
--- a/embassy-stm32l0/Cargo.toml
+++ b/embassy-stm32l0/Cargo.toml
@@ -11,12 +11,13 @@ defmt-info = [ ]
11defmt-warn = [ ] 11defmt-warn = [ ]
12defmt-error = [ ] 12defmt-error = [ ]
13 13
14stm32l0x1 = ["stm32l0xx-hal/stm32l0x1"] 14stm32l0x1 = ["stm32l0xx-hal/stm32l0x1", "embassy-stm32/stm32l0x1"]
15stm32l0x2 = ["stm32l0xx-hal/stm32l0x2"] 15stm32l0x2 = ["stm32l0xx-hal/stm32l0x2", "embassy-stm32/stm32l0x2"]
16stm32l0x3 = ["stm32l0xx-hal/stm32l0x3"] 16stm32l0x3 = ["stm32l0xx-hal/stm32l0x3", "embassy-stm32/stm32l0x3"]
17 17
18[dependencies] 18[dependencies]
19embassy = { version = "0.1.0", path = "../embassy" } 19embassy = { version = "0.1.0", path = "../embassy" }
20embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32" }
20defmt = { version = "0.2.0", optional = true } 21defmt = { version = "0.2.0", optional = true }
21futures = { version = "0.3.5", default-features = false, features = [ "cfg-target-has-atomic", "unstable" ] } 22futures = { version = "0.3.5", default-features = false, features = [ "cfg-target-has-atomic", "unstable" ] }
22log = { version = "0.4.11", optional = true } 23log = { version = "0.4.11", optional = true }
diff --git a/embassy-stm32l0/src/fmt.rs b/embassy-stm32l0/src/fmt.rs
deleted file mode 100644
index 1be1057a7..000000000
--- a/embassy-stm32l0/src/fmt.rs
+++ /dev/null
@@ -1,119 +0,0 @@
1#![macro_use]
2#![allow(clippy::module_inception)]
3
4#[cfg(all(feature = "defmt", feature = "log"))]
5compile_error!("You may not enable both `defmt` and `log` features.");
6
7pub use fmt::*;
8
9#[cfg(feature = "defmt")]
10mod fmt {
11 pub use defmt::{
12 assert, assert_eq, assert_ne, debug, debug_assert, debug_assert_eq, debug_assert_ne, error,
13 info, panic, todo, trace, unreachable, unwrap, warn,
14 };
15}
16
17#[cfg(feature = "log")]
18mod fmt {
19 pub use core::{
20 assert, assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne, panic, todo,
21 unreachable,
22 };
23 pub use log::{debug, error, info, trace, warn};
24}
25
26#[cfg(not(any(feature = "defmt", feature = "log")))]
27mod fmt {
28 #![macro_use]
29
30 pub use core::{
31 assert, assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne, panic, todo,
32 unreachable,
33 };
34
35 #[macro_export]
36 macro_rules! trace {
37 ($($msg:expr),+ $(,)?) => {
38 ()
39 };
40 }
41
42 #[macro_export]
43 macro_rules! debug {
44 ($($msg:expr),+ $(,)?) => {
45 ()
46 };
47 }
48
49 #[macro_export]
50 macro_rules! info {
51 ($($msg:expr),+ $(,)?) => {
52 ()
53 };
54 }
55
56 #[macro_export]
57 macro_rules! warn {
58 ($($msg:expr),+ $(,)?) => {
59 ()
60 };
61 }
62
63 #[macro_export]
64 macro_rules! error {
65 ($($msg:expr),+ $(,)?) => {
66 ()
67 };
68 }
69}
70
71#[cfg(not(feature = "defmt"))]
72#[macro_export]
73macro_rules! unwrap {
74 ($arg:expr) => {
75 match $crate::fmt::Try::into_result($arg) {
76 ::core::result::Result::Ok(t) => t,
77 ::core::result::Result::Err(e) => {
78 ::core::panic!("unwrap of `{}` failed: {:?}", ::core::stringify!($arg), e);
79 }
80 }
81 };
82 ($arg:expr, $($msg:expr),+ $(,)? ) => {
83 match $crate::fmt::Try::into_result($arg) {
84 ::core::result::Result::Ok(t) => t,
85 ::core::result::Result::Err(e) => {
86 ::core::panic!("unwrap of `{}` failed: {}: {:?}", ::core::stringify!($arg), ::core::format_args!($($msg,)*), e);
87 }
88 }
89 }
90}
91
92#[derive(Debug, Copy, Clone, Eq, PartialEq)]
93pub struct NoneError;
94
95pub trait Try {
96 type Ok;
97 type Error;
98 fn into_result(self) -> Result<Self::Ok, Self::Error>;
99}
100
101impl<T> Try for Option<T> {
102 type Ok = T;
103 type Error = NoneError;
104
105 #[inline]
106 fn into_result(self) -> Result<T, NoneError> {
107 self.ok_or(NoneError)
108 }
109}
110
111impl<T, E> Try for Result<T, E> {
112 type Ok = T;
113 type Error = E;
114
115 #[inline]
116 fn into_result(self) -> Self {
117 self
118 }
119}
diff --git a/embassy-stm32l0/src/interrupt.rs b/embassy-stm32l0/src/interrupt.rs
deleted file mode 100644
index 499f3f275..000000000
--- a/embassy-stm32l0/src/interrupt.rs
+++ /dev/null
@@ -1,162 +0,0 @@
1//! Interrupt management
2use crate::pac::NVIC_PRIO_BITS;
3
4// Re-exports
5pub use cortex_m::interrupt::{CriticalSection, Mutex};
6pub use embassy::interrupt::{declare, take, Interrupt};
7
8#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
9#[cfg_attr(feature = "defmt", derive(defmt::Format))]
10#[repr(u8)]
11pub enum Priority {
12 Level0 = 0,
13 Level1 = 1,
14 Level2 = 2,
15 Level3 = 3,
16 Level4 = 4,
17 Level5 = 5,
18 Level6 = 6,
19 Level7 = 7,
20 Level8 = 8,
21 Level9 = 9,
22 Level10 = 10,
23 Level11 = 11,
24 Level12 = 12,
25 Level13 = 13,
26 Level14 = 14,
27 Level15 = 15,
28}
29
30impl From<u8> for Priority {
31 fn from(priority: u8) -> Self {
32 match priority >> (8 - NVIC_PRIO_BITS) {
33 0 => Self::Level0,
34 1 => Self::Level1,
35 2 => Self::Level2,
36 3 => Self::Level3,
37 4 => Self::Level4,
38 5 => Self::Level5,
39 6 => Self::Level6,
40 7 => Self::Level7,
41 8 => Self::Level8,
42 9 => Self::Level9,
43 10 => Self::Level10,
44 11 => Self::Level11,
45 12 => Self::Level12,
46 13 => Self::Level13,
47 14 => Self::Level14,
48 15 => Self::Level15,
49 _ => unreachable!(),
50 }
51 }
52}
53
54impl From<Priority> for u8 {
55 fn from(p: Priority) -> Self {
56 (p as u8) << (8 - NVIC_PRIO_BITS)
57 }
58}
59
60#[cfg(feature = "stm32l0x1")]
61mod irqs {
62 use super::*;
63 declare!(WWDG);
64 declare!(PVD);
65 declare!(RTC);
66 declare!(FLASH);
67 declare!(RCC);
68 declare!(EXTI0_1);
69 declare!(EXTI2_3);
70 declare!(EXTI4_15);
71 declare!(DMA1_CHANNEL1);
72 declare!(DMA1_CHANNEL2_3);
73 declare!(DMA1_CHANNEL4_7);
74 declare!(ADC_COMP);
75 declare!(LPTIM1);
76 declare!(USART4_USART5);
77 declare!(TIM2);
78 declare!(TIM3);
79 declare!(TIM6);
80 declare!(TIM7);
81 declare!(TIM21);
82 declare!(I2C3);
83 declare!(TIM22);
84 declare!(I2C1);
85 declare!(I2C2);
86 declare!(SPI1);
87 declare!(SPI2);
88 declare!(USART1);
89 declare!(USART2);
90 declare!(AES_RNG_LPUART1);
91}
92
93#[cfg(feature = "stm32l0x2")]
94mod irqs {
95 use super::*;
96 declare!(WWDG);
97 declare!(PVD);
98 declare!(RTC);
99 declare!(RCC);
100 declare!(EXTI0_1);
101 declare!(EXTI2_3);
102 declare!(EXTI4_15);
103 declare!(TSC);
104 declare!(DMA1_CHANNEL1);
105 declare!(DMA1_CHANNEL2_3);
106 declare!(DMA1_CHANNEL4_7);
107 declare!(ADC_COMP);
108 declare!(LPTIM1);
109 declare!(USART4_USART5);
110 declare!(TIM2);
111 declare!(TIM3);
112 declare!(TIM6_DAC);
113 declare!(TIM7);
114 declare!(TIM21);
115 declare!(I2C3);
116 declare!(TIM22);
117 declare!(I2C1);
118 declare!(I2C2);
119 declare!(SPI1);
120 declare!(SPI2);
121 declare!(USART1);
122 declare!(USART2);
123 declare!(AES_RNG_LPUART1);
124 declare!(USB);
125}
126
127#[cfg(feature = "stm32l0x3")]
128mod irqs {
129 use super::*;
130 declare!(WWDG);
131 declare!(PVD);
132 declare!(RTC);
133 declare!(RCC);
134 declare!(EXTI0_1);
135 declare!(EXTI2_3);
136 declare!(EXTI4_15);
137 declare!(TSC);
138 declare!(DMA1_CHANNEL1);
139 declare!(DMA1_CHANNEL2_3);
140 declare!(DMA1_CHANNEL4_7);
141 declare!(ADC_COMP);
142 declare!(LPTIM1);
143 declare!(USART4_USART5);
144 declare!(TIM2);
145 declare!(TIM3);
146 declare!(TIM6_DAC);
147 declare!(TIM7);
148 declare!(TIM21);
149 declare!(I2C3);
150 declare!(TIM22);
151 declare!(I2C1);
152 declare!(I2C2);
153 declare!(SPI1);
154 declare!(SPI2);
155 declare!(USART1);
156 declare!(USART2);
157 declare!(AES_RNG_LPUART1);
158 declare!(LCD);
159 declare!(USB);
160}
161
162pub use irqs::*;
diff --git a/embassy-stm32l0/src/lib.rs b/embassy-stm32l0/src/lib.rs
index d030713ca..e80fe6cb4 100644
--- a/embassy-stm32l0/src/lib.rs
+++ b/embassy-stm32l0/src/lib.rs
@@ -19,11 +19,6 @@ compile_error!(
19 "Multile chip features activated. You must activate exactly one of the following features: " 19 "Multile chip features activated. You must activate exactly one of the following features: "
20); 20);
21 21
22pub use stm32l0xx_hal as hal; 22pub use embassy_stm32::{fmt, hal, interrupt, pac};
23pub use stm32l0xx_hal::pac;
24
25// This mod MUST go first, so that the others see its macros.
26pub(crate) mod fmt;
27 23
28pub mod exti; 24pub mod exti;
29pub mod interrupt;