aboutsummaryrefslogtreecommitdiff
path: root/embassy-hal-common/src
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-04-16 17:47:25 -0500
committerxoviat <[email protected]>2023-04-16 17:47:25 -0500
commit776e001b5befc50ff409b5cd8252bbb61fbb5acc (patch)
tree4b6f918251a844719a9b33e79c2b4119d4afc0b3 /embassy-hal-common/src
parent1fdce6e52a51de89f48f002d5c92139f58029575 (diff)
stm32: remove TIMX singleton when used on timer driver
fixes #1316.
Diffstat (limited to 'embassy-hal-common/src')
-rw-r--r--embassy-hal-common/src/macros.rs25
1 files changed, 24 insertions, 1 deletions
diff --git a/embassy-hal-common/src/macros.rs b/embassy-hal-common/src/macros.rs
index 5e62e048a..f06b46002 100644
--- a/embassy-hal-common/src/macros.rs
+++ b/embassy-hal-common/src/macros.rs
@@ -1,5 +1,5 @@
1#[macro_export] 1#[macro_export]
2macro_rules! peripherals { 2macro_rules! peripherals_definition {
3 ($($(#[$cfg:meta])? $name:ident),*$(,)?) => { 3 ($($(#[$cfg:meta])? $name:ident),*$(,)?) => {
4 /// Types for the peripheral singletons. 4 /// Types for the peripheral singletons.
5 pub mod peripherals { 5 pub mod peripherals {
@@ -26,7 +26,12 @@ macro_rules! peripherals {
26 $crate::impl_peripheral!($name); 26 $crate::impl_peripheral!($name);
27 )* 27 )*
28 } 28 }
29 };
30}
29 31
32#[macro_export]
33macro_rules! peripherals_struct {
34 ($($(#[$cfg:meta])? $name:ident),*$(,)?) => {
30 /// Struct containing all the peripheral singletons. 35 /// Struct containing all the peripheral singletons.
31 /// 36 ///
32 /// To obtain the peripherals, you must initialize the HAL, by calling [`crate::init`]. 37 /// To obtain the peripherals, you must initialize the HAL, by calling [`crate::init`].
@@ -77,6 +82,24 @@ macro_rules! peripherals {
77} 82}
78 83
79#[macro_export] 84#[macro_export]
85macro_rules! peripherals {
86 ($($(#[$cfg:meta])? $name:ident),*$(,)?) => {
87 $crate::peripherals_definition!(
88 $(
89 $(#[$cfg])?
90 $name,
91 )*
92 );
93 $crate::peripherals_struct!(
94 $(
95 $(#[$cfg])?
96 $name,
97 )*
98 );
99 };
100}
101
102#[macro_export]
80macro_rules! into_ref { 103macro_rules! into_ref {
81 ($($name:ident),*) => { 104 ($($name:ident),*) => {
82 $( 105 $(