From f96b25fdf2d7421cc16830a4ccac4ebb3e69cc5d Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Thu, 15 Oct 2020 18:50:17 +0200 Subject: Updated examples More work --- macros/src/codegen/software_tasks.rs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'macros/src/codegen/software_tasks.rs') diff --git a/macros/src/codegen/software_tasks.rs b/macros/src/codegen/software_tasks.rs index 9918dea..f5757a1 100644 --- a/macros/src/codegen/software_tasks.rs +++ b/macros/src/codegen/software_tasks.rs @@ -1,5 +1,5 @@ use proc_macro2::TokenStream as TokenStream2; -use quote::{format_ident, quote}; +use quote::quote; use rtic_syntax::{ast::App, Context}; use crate::{ @@ -22,13 +22,10 @@ pub fn codegen( Vec, // user_software_tasks -- the `#[task]` functions written by the user Vec, - // user_software_tasks_imports -- the imports for `#[task]` functions written by the user - Vec, ) { let mut mod_app = vec![]; let mut root = vec![]; let mut user_tasks = vec![]; - let mut software_tasks_imports = vec![]; for (name, task) in &app.software_tasks { let inputs = &task.inputs; @@ -93,13 +90,6 @@ pub fn codegen( analysis, ); - // Add resources to imports - let name_res = format_ident!("{}Resources", name); - software_tasks_imports.push(quote!( - #[allow(non_snake_case)] - use super::#name_res; - )); - root.push(item); mod_app.push(constructor); @@ -129,11 +119,6 @@ pub fn codegen( #(#stmts)* } )); - software_tasks_imports.push(quote!( - #(#cfgs)* - #[allow(non_snake_case)] - use super::#name; - )); root.push(module::codegen( Context::SoftwareTask(name), @@ -144,5 +129,5 @@ pub fn codegen( )); } - (mod_app, root, user_tasks, software_tasks_imports) + (mod_app, root, user_tasks) } -- cgit v1.2.3 From f076b33bb91e9cd2cb1f71ba22ebfebab085d3a8 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Wed, 21 Oct 2020 20:20:26 +0200 Subject: Namespace cleanup --- macros/src/codegen/software_tasks.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'macros/src/codegen/software_tasks.rs') diff --git a/macros/src/codegen/software_tasks.rs b/macros/src/codegen/software_tasks.rs index f5757a1..323060c 100644 --- a/macros/src/codegen/software_tasks.rs +++ b/macros/src/codegen/software_tasks.rs @@ -50,7 +50,7 @@ pub fn codegen( mod_app.push(quote!( /// Queue version of a free-list that keeps track of empty slots in /// the following buffers - pub static mut #fq: #fq_ty = #fq_expr; + static mut #fq: #fq_ty = #fq_expr; )); let ref elems = (0..cap) @@ -64,7 +64,7 @@ pub fn codegen( mod_app.push(quote!( #uninit /// Buffer that holds the instants associated to the inputs of a task - pub static mut #instants: + static mut #instants: [core::mem::MaybeUninit<<#m as rtic::Monotonic>::Instant>; #cap_lit] = [#(#elems,)*]; )); @@ -75,7 +75,7 @@ pub fn codegen( mod_app.push(quote!( #uninit /// Buffer that holds the inputs of a task - pub static mut #inputs_ident: [core::mem::MaybeUninit<#input_ty>; #cap_lit] = + static mut #inputs_ident: [core::mem::MaybeUninit<#input_ty>; #cap_lit] = [#(#elems,)*]; )); @@ -113,7 +113,7 @@ pub fn codegen( #(#attrs)* #(#cfgs)* #[allow(non_snake_case)] - pub fn #name(#(#locals_pat,)* #context: #name::Context #(,#inputs)*) { + fn #name(#(#locals_pat,)* #context: #name::Context #(,#inputs)*) { use rtic::Mutex as _; #(#stmts)* -- cgit v1.2.3