diff options
author | 2020-10-07 09:22:38 +1100 | |
---|---|---|
committer | 2020-10-07 09:22:38 +1100 | |
commit | f386cb63cb6d3cd6642debfb4dc1bde97b325550 (patch) | |
tree | 30b21968997f809dbbba59117db93254607fa22d /macros/src/codegen/module.rs | |
parent | 3d6a0ea64fb2661ee1150a84425f50c18c2de9ad (diff) | |
parent | b1e1abae29591e50ebf345a2bd249a73e564cea9 (diff) | |
download | rtic-f386cb63cb6d3cd6642debfb4dc1bde97b325550.tar.gz rtic-f386cb63cb6d3cd6642debfb4dc1bde97b325550.tar.zst rtic-f386cb63cb6d3cd6642debfb4dc1bde97b325550.zip |
Merge branch 'master'
of https://github.com/rtic-rs/cortex-m-rtic
Diffstat (limited to 'macros/src/codegen/module.rs')
-rw-r--r-- | macros/src/codegen/module.rs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index 863f6c5b..2e51e7db 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -47,6 +47,14 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> values.push(quote!(device: #device::Peripherals::steal())); } + lt = Some(quote!('a)); + fields.push(quote!( + /// Critical section token for init + pub cs: rtic::export::CriticalSection<#lt> + )); + + values.push(quote!(cs: rtic::export::CriticalSection::new())); + values.push(quote!(core)); } @@ -253,14 +261,12 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> 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); + let late_resources = util::late_resources_ident(&init.name); - items.push(quote!( - #[doc(inline)] - pub use super::#late_resources as LateResources; - )); - } + items.push(quote!( + #[doc(inline)] + pub use super::#late_resources as LateResources; + )); } let doc = match ctxt { |