Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove gpio dispatch macro-defining proc macro #2069

Merged
merged 6 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 0 additions & 77 deletions esp-hal-procmacros/src/enum_dispatch.rs

This file was deleted.

33 changes: 0 additions & 33 deletions esp-hal-procmacros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ use proc_macro::TokenStream;

#[cfg(feature = "embassy")]
mod embassy;
#[cfg(feature = "enum-dispatch")]
mod enum_dispatch;
#[cfg(feature = "interrupt")]
mod interrupt;
#[cfg(any(
Expand Down Expand Up @@ -339,37 +337,6 @@ pub fn handler(args: TokenStream, input: TokenStream) -> TokenStream {
.into()
}

/// Create an enum for erased GPIO pins, using the enum-dispatch pattern
///
/// Only used internally
#[cfg(feature = "enum-dispatch")]
#[proc_macro]
pub fn make_gpio_enum_dispatch_macro(input: TokenStream) -> TokenStream {
use quote::{format_ident, quote};

use self::enum_dispatch::{build_match_arms, MakeGpioEnumDispatchMacro};

let input = syn::parse_macro_input!(input as MakeGpioEnumDispatchMacro);

let macro_name = format_ident!("{}", input.name);
let arms = build_match_arms(input);

quote! {
#[doc(hidden)]
#[macro_export]
macro_rules! #macro_name {
($m:ident, $target:ident, $body:block) => {
match $m {
#(#arms)*
}
}
}

pub(crate) use #macro_name;
}
.into()
}

/// Load code to be run on the LP/ULP core.
///
/// ## Example
Expand Down
Loading