mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-19 06:15:45 +01:00
wip, problem with static Context
This commit is contained in:
parent
99a45ff28e
commit
06e6e9dc9d
5 changed files with 66 additions and 41 deletions
|
|
@ -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)))
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue