diff options
author | 2020-09-04 07:50:13 +0000 | |
---|---|---|
committer | 2020-09-04 07:50:13 +0000 | |
commit | 7506bd8ae0ba335fc058c2138438fab5f20f6dab (patch) | |
tree | fe65b335b19171370bd6be0bd5cd6b776a1d6110 /macros/src/codegen/module.rs | |
parent | c5e6d1fa49e3596227a8ee8fe89e2e4f66db3169 (diff) | |
parent | ad2b80907899cc335edcebfc77ae4b4b51272b87 (diff) | |
download | rtic-7506bd8ae0ba335fc058c2138438fab5f20f6dab.tar.gz rtic-7506bd8ae0ba335fc058c2138438fab5f20f6dab.tar.zst rtic-7506bd8ae0ba335fc058c2138438fab5f20f6dab.zip |
Merge #355
355: Multi-core removal r=korken89 a=AfoHT
Dependent on https://github.com/rtic-rs/rtic-syntax/pull/27
With the same reasoning as ^^
For now the testing is done against my rtic-syntax/multiremove-branch, but before we merge it should corrected.
Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
Diffstat (limited to 'macros/src/codegen/module.rs')
-rw-r--r-- | macros/src/codegen/module.rs | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index 1b21209f..863f6c5b 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -11,12 +11,11 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> let name = ctxt.ident(app); - let core = ctxt.core(app); let mut needs_instant = false; let mut lt = None; match ctxt { - Context::Init(core) => { - if app.uses_schedule(core) { + Context::Init => { + if app.uses_schedule() { let m = extra.monotonic(); fields.push(quote!( @@ -37,7 +36,7 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> )); } - if extra.peripherals == Some(core) { + if extra.peripherals { let device = extra.device; fields.push(quote!( @@ -51,10 +50,10 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> values.push(quote!(core)); } - Context::Idle(..) => {} + Context::Idle => {} Context::HardwareTask(..) => { - if app.uses_schedule(core) { + if app.uses_schedule() { let m = extra.monotonic(); fields.push(quote!( @@ -69,7 +68,7 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> } Context::SoftwareTask(..) => { - if app.uses_schedule(core) { + if app.uses_schedule() { let m = extra.monotonic(); fields.push(quote!( @@ -205,7 +204,7 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> values.push(quote!(spawn: Spawn { priority })); } else { - let instant_field = if app.uses_schedule(core) { + let instant_field = if app.uses_schedule() { let m = extra.monotonic(); needs_instant = true; @@ -252,8 +251,8 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> } } - if let Context::Init(core) = ctxt { - let init = &app.inits[&core]; + if let Context::Init = ctxt { + let init = &app.inits.first().unwrap(); if init.returns_late_resources { let late_resources = util::late_resources_ident(&init.name); @@ -265,14 +264,14 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> } let doc = match ctxt { - Context::Idle(_) => "Idle loop", - Context::Init(_) => "Initialization function", + Context::Idle => "Idle loop", + Context::Init => "Initialization function", Context::HardwareTask(_) => "Hardware task", Context::SoftwareTask(_) => "Software task", }; let core = if ctxt.is_init() { - if app.uses_schedule(core) { + if app.uses_schedule() { Some(quote!(core: rtic::Peripherals,)) } else { Some(quote!(core: rtic::export::Peripherals,)) @@ -312,12 +311,9 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> )); if !items.is_empty() { - let cfg_core = util::cfg_core(ctxt.core(app), app.args.cores); - quote!( #[allow(non_snake_case)] #[doc = #doc] - #cfg_core pub mod #name { #(#items)* } |