diff options
Diffstat (limited to 'macros/src/codegen/post_init.rs')
-rw-r--r-- | macros/src/codegen/post_init.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/macros/src/codegen/post_init.rs b/macros/src/codegen/post_init.rs index e3e3b20e..bee481db 100644 --- a/macros/src/codegen/post_init.rs +++ b/macros/src/codegen/post_init.rs @@ -161,10 +161,27 @@ pub fn codegen( let gen_static = util::gen_static_ident(&name); let priority = task.args.priority; + // #[doc(inline)] + // pub use super::foo1Resources as Resources; + // #[doc = r" Execution context"] + // pub struct Context<'a> { + // #[doc = r" Resources this task has access to"] + // pub resources: Resources<'a>, + // } + // impl<'a> Context<'a> { + // #[inline(always)] + // pub unsafe fn new( + // priority: &'a rtfm::export::Priority, + // ) -> Self { + // Context { + // resources: Resources::new(priority), + // } + // } + // } stmts.push(quote!( const PRIORITY: u8 = #priority; - unsafe { + static CTX: #name::Context = #name::Context::new(&rtfm::export::Priority::new(PRIORITY)); #gen_static.as_mut_ptr().write( #name(#name::Context::new(&rtfm::export::Priority::new(PRIORITY))) ); |