From 1c8de78f6f6e9e265d9d894d2ebde622bf16d44e Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Sat, 12 Dec 2020 23:31:05 +0100 Subject: [PATCH] Cleanup --- examples/test_new_monotonic.rs | 4 +--- macros/src/codegen.rs | 14 +++++++++----- macros/src/codegen/hardware_tasks.rs | 14 +------------- macros/src/codegen/util.rs | 5 ++++- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/examples/test_new_monotonic.rs b/examples/test_new_monotonic.rs index d2530c660b..3323c09b3b 100644 --- a/examples/test_new_monotonic.rs +++ b/examples/test_new_monotonic.rs @@ -15,8 +15,7 @@ mod app { type MyMono2 = hal::Mono2; #[init] - fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) { - } + fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) {} #[task] fn task1(_: task1::Context) {} @@ -24,4 +23,3 @@ mod app { #[task] fn task2(_: task2::Context) {} } - diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index 03bac849e2..1219e14f97 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -104,11 +104,15 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { )); } - let monotonic_imports: Vec<_> = app.monotonics.iter().map(|(_, monotonic)| { - let name = &monotonic.ident; - let ty = &monotonic.ty; - quote!(pub type #name = #ty;) - }).collect(); + let monotonic_imports: Vec<_> = app + .monotonics + .iter() + .map(|(_, monotonic)| { + let name = &monotonic.ident; + let ty = &monotonic.ty; + quote!(pub type #name = #ty;) + }) + .collect(); quote!( /// Implementation details diff --git a/macros/src/codegen/hardware_tasks.rs b/macros/src/codegen/hardware_tasks.rs index db3ab3a6e8..4a1d7492f4 100644 --- a/macros/src/codegen/hardware_tasks.rs +++ b/macros/src/codegen/hardware_tasks.rs @@ -29,16 +29,6 @@ pub fn codegen( let mut user_tasks = vec![]; for (name, task) in &app.hardware_tasks { - // let (let_instant, instant) = if let Some(ref m) = extra.monotonic { - // ( - // Some(quote!(let instant = <#m as rtic::Monotonic>::now();)), - // Some(quote!(, instant)), - // ) - // } else { - // (None, None) - // }; - let (let_instant, instant) = (quote!(), quote!()); - let locals_new = if task.locals.is_empty() { quote!() } else { @@ -56,12 +46,10 @@ pub fn codegen( unsafe fn #symbol() { const PRIORITY: u8 = #priority; - #let_instant - rtic::export::run(PRIORITY, || { #app_path::#name( #locals_new - #name::Context::new(&rtic::export::Priority::new(PRIORITY) #instant) + #name::Context::new(&rtic::export::Priority::new(PRIORITY)) ) }); } diff --git a/macros/src/codegen/util.rs b/macros/src/codegen/util.rs index 329a7ddf6d..a201dfe5c4 100644 --- a/macros/src/codegen/util.rs +++ b/macros/src/codegen/util.rs @@ -78,7 +78,10 @@ pub fn inputs_ident(task: &Ident) -> Ident { /// Generates an identifier for the `INSTANTS` buffer (`schedule` API) pub fn monotonic_instants_ident(task: &Ident, monotonic: &Ident) -> Ident { - Ident::new(&format!("{}_{}_INSTANTS", task, monotonic), Span::call_site()) + Ident::new( + &format!("{}_{}_INSTANTS", task, monotonic), + Span::call_site(), + ) } pub fn interrupt_ident() -> Ident {