Skip to content

Commit 39109a4

Browse files
authored
Remove gpio dispatch macro-defining proc macro (#2069)
* Keep a single PinType trait * Merge impl blocks * Deduplicate usb pad workaround * Deduplicate some bit manipulation * Remove gpio dispatch proc macro * Inline PinType into GpioProperties
1 parent 99bf346 commit 39109a4

File tree

3 files changed

+189
-320
lines changed

3 files changed

+189
-320
lines changed

esp-hal-procmacros/src/enum_dispatch.rs

Lines changed: 0 additions & 77 deletions
This file was deleted.

esp-hal-procmacros/src/lib.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ use proc_macro::TokenStream;
5252

5353
#[cfg(feature = "embassy")]
5454
mod embassy;
55-
#[cfg(feature = "enum-dispatch")]
56-
mod enum_dispatch;
5755
#[cfg(feature = "interrupt")]
5856
mod interrupt;
5957
#[cfg(any(
@@ -339,37 +337,6 @@ pub fn handler(args: TokenStream, input: TokenStream) -> TokenStream {
339337
.into()
340338
}
341339

342-
/// Create an enum for erased GPIO pins, using the enum-dispatch pattern
343-
///
344-
/// Only used internally
345-
#[cfg(feature = "enum-dispatch")]
346-
#[proc_macro]
347-
pub fn make_gpio_enum_dispatch_macro(input: TokenStream) -> TokenStream {
348-
use quote::{format_ident, quote};
349-
350-
use self::enum_dispatch::{build_match_arms, MakeGpioEnumDispatchMacro};
351-
352-
let input = syn::parse_macro_input!(input as MakeGpioEnumDispatchMacro);
353-
354-
let macro_name = format_ident!("{}", input.name);
355-
let arms = build_match_arms(input);
356-
357-
quote! {
358-
#[doc(hidden)]
359-
#[macro_export]
360-
macro_rules! #macro_name {
361-
($m:ident, $target:ident, $body:block) => {
362-
match $m {
363-
#(#arms)*
364-
}
365-
}
366-
}
367-
368-
pub(crate) use #macro_name;
369-
}
370-
.into()
371-
}
372-
373340
/// Load code to be run on the LP/ULP core.
374341
///
375342
/// ## Example

0 commit comments

Comments
 (0)