diff options
| author | xoviat <[email protected]> | 2023-04-16 17:47:25 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-04-16 17:47:25 -0500 |
| commit | 776e001b5befc50ff409b5cd8252bbb61fbb5acc (patch) | |
| tree | 4b6f918251a844719a9b33e79c2b4119d4afc0b3 /embassy-hal-common/src | |
| parent | 1fdce6e52a51de89f48f002d5c92139f58029575 (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.rs | 25 |
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] |
| 2 | macro_rules! peripherals { | 2 | macro_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] | ||
| 33 | macro_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] |
| 85 | macro_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] | ||
| 80 | macro_rules! into_ref { | 103 | macro_rules! into_ref { |
| 81 | ($($name:ident),*) => { | 104 | ($($name:ident),*) => { |
| 82 | $( | 105 | $( |
