From 1c244a995d54332649c1643aa0a3178f169406e4 Mon Sep 17 00:00:00 2001 From: Per Lindgren Date: Fri, 23 Oct 2020 10:35:56 +0200 Subject: move dispatchers to app argument --- macros/src/codegen/module.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'macros/src/codegen/module.rs') diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index a5b61394..838a989f 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -23,7 +23,7 @@ pub fn codegen( let mut lt = None; match ctxt { Context::Init => { - if let Some(m) = extra.monotonic { + if let Some(m) = &extra.monotonic { fields.push(quote!( /// System start time = `Instant(0 /* cycles */)` pub start: <#m as rtic::Monotonic>::Instant @@ -43,7 +43,7 @@ pub fn codegen( } if extra.peripherals { - let device = extra.device; + let device = &extra.device; fields.push(quote!( /// Device peripherals @@ -67,7 +67,7 @@ pub fn codegen( Context::Idle => {} Context::HardwareTask(..) => { - if let Some(m) = extra.monotonic { + if let Some(m) = &extra.monotonic { fields.push(quote!( /// Time at which this handler started executing pub start: <#m as rtic::Monotonic>::Instant @@ -80,7 +80,7 @@ pub fn codegen( } Context::SoftwareTask(..) => { - if let Some(m) = extra.monotonic { + if let Some(m) = &extra.monotonic { fields.push(quote!( /// The time at which this task was scheduled to run pub scheduled: <#m as rtic::Monotonic>::Instant @@ -162,7 +162,7 @@ pub fn codegen( }; let instant = if needs_instant { - let m = extra.monotonic(); + let m = extra.monotonic.clone().expect("RTIC-ICE: UNREACHABLE"); Some(quote!(, instant: <#m as rtic::Monotonic>::Instant)) } else { @@ -205,9 +205,13 @@ pub fn codegen( let app_name = &app.name; let app_path = quote! {crate::#app_name}; - let device = extra.device; + let device = &extra.device; let enum_ = util::interrupt_ident(); - let interrupt = &analysis.interrupts.get(&priority); + let interrupt = &analysis + .interrupts + .get(&priority) + .expect("RTIC-ICE: interrupt identifer not found") + .0; // Spawn caller items.push(quote!( @@ -240,7 +244,7 @@ pub fn codegen( })); // Schedule caller - if let Some(m) = extra.monotonic { + if let Some(m) = &extra.monotonic { let instants = util::instants_ident(name); let tq = util::tq_ident(); -- cgit v1.2.3