diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-06-08 16:08:40 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-06-08 18:00:48 +0200 |
| commit | 921780e6bfb9bcb2cd087b8aa8b094d792c99fa2 (patch) | |
| tree | bd21fba9800471b860ca44e05567588dcc1afef7 /embassy-macros/src/lib.rs | |
| parent | 87ad66f2b4a5bfd36dfc8d8aad5492e9e3f915e6 (diff) | |
Make interrupt module more standard.
- Move typelevel interrupts to a special-purpose mod: `embassy_xx::interrupt::typelevel`.
- Reexport the PAC interrupt enum in `embassy_xx::interrupt`.
This has a few advantages:
- The `embassy_xx::interrupt` module is now more "standard".
- It works with `cortex-m` functions for manipulating interrupts, for example.
- It works with RTIC.
- the interrupt enum allows holding value that can be "any interrupt at runtime", this can't be done with typelevel irqs.
- When "const-generics on enums" is stable, we can remove the typelevel interrupts without disruptive changes to `embassy_xx::interrupt`.
Diffstat (limited to 'embassy-macros/src/lib.rs')
| -rw-r--r-- | embassy-macros/src/lib.rs | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/embassy-macros/src/lib.rs b/embassy-macros/src/lib.rs index d7ca1f69c..ba4f13b77 100644 --- a/embassy-macros/src/lib.rs +++ b/embassy-macros/src/lib.rs | |||
| @@ -156,16 +156,3 @@ pub fn main_wasm(args: TokenStream, item: TokenStream) -> TokenStream { | |||
| 156 | let f = syn::parse_macro_input!(item as syn::ItemFn); | 156 | let f = syn::parse_macro_input!(item as syn::ItemFn); |
| 157 | main::run(args, f, main::wasm()).unwrap_or_else(|x| x).into() | 157 | main::run(args, f, main::wasm()).unwrap_or_else(|x| x).into() |
| 158 | } | 158 | } |
| 159 | |||
| 160 | #[proc_macro_attribute] | ||
| 161 | pub fn cortex_m_interrupt(args: TokenStream, item: TokenStream) -> TokenStream { | ||
| 162 | let args = syn::parse_macro_input!(args as syn::AttributeArgs); | ||
| 163 | let f = syn::parse_macro_input!(item as syn::ItemFn); | ||
| 164 | cortex_m_interrupt::run(args, f).unwrap_or_else(|x| x).into() | ||
| 165 | } | ||
| 166 | |||
| 167 | #[proc_macro] | ||
| 168 | pub fn cortex_m_interrupt_declare(item: TokenStream) -> TokenStream { | ||
| 169 | let name = syn::parse_macro_input!(item as syn::Ident); | ||
| 170 | cortex_m_interrupt_declare::run(name).unwrap_or_else(|x| x).into() | ||
| 171 | } | ||
