mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-12-28 12:59:34 +01:00
Compose the use-statements, reduce debug-printouts
This commit is contained in:
parent
9fd052b876
commit
0c7a619432
1 changed files with 12 additions and 18 deletions
|
@ -30,17 +30,18 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 {
|
|||
let mut mains = vec![];
|
||||
let mut root = vec![];
|
||||
let mut user = vec![];
|
||||
let mut imports = vec![];
|
||||
|
||||
// Generate the `main` function
|
||||
let assertion_stmts = assertions::codegen(analysis);
|
||||
|
||||
let pre_init_stmts = pre_init::codegen(&app, analysis, extra);
|
||||
|
||||
let (const_app_init, root_init, user_init, call_init) = init::codegen(app, analysis, extra);
|
||||
let (const_app_init, root_init, user_init, user_init_imports, call_init) = init::codegen(app, analysis, extra);
|
||||
|
||||
let post_init_stmts = post_init::codegen(&app, analysis);
|
||||
|
||||
let (const_app_idle, root_idle, user_idle, call_idle) = idle::codegen(app, analysis, extra);
|
||||
let (const_app_idle, root_idle, user_idle, user_idle_imports, call_idle) = idle::codegen(app, analysis, extra);
|
||||
|
||||
if user_init.is_some() {
|
||||
const_app_imports.push(quote!(
|
||||
|
@ -59,6 +60,11 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 {
|
|||
#user_idle
|
||||
));
|
||||
|
||||
imports.push(quote!(
|
||||
#(#user_init_imports)*
|
||||
#(#user_idle_imports)*
|
||||
));
|
||||
|
||||
root.push(quote!(
|
||||
#(#root_init)*
|
||||
|
||||
|
@ -105,27 +111,23 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 {
|
|||
|
||||
let const_app_schedule = schedule::codegen(app, extra);
|
||||
|
||||
|
||||
let user_imports = app.user_imports.clone();
|
||||
let name = &app.name;
|
||||
let device = extra.device;
|
||||
quote!(
|
||||
#(#user)*
|
||||
|
||||
/// USER_HW_TASKS
|
||||
#(#user_hardware_tasks)*
|
||||
|
||||
/// USER_SW_TASKS
|
||||
#(#user_software_tasks)*
|
||||
|
||||
/// ROOT
|
||||
#(#root)*
|
||||
|
||||
/// MOD_RESOURCES
|
||||
#mod_resources
|
||||
|
||||
/// root_hardware_tasks
|
||||
#(#root_hardware_tasks)*
|
||||
|
||||
/// root_software_tasks
|
||||
#(#root_software_tasks)*
|
||||
|
||||
/// Implementation details
|
||||
|
@ -133,35 +135,27 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 {
|
|||
mod #name {
|
||||
/// Always include the device crate which contains the vector table
|
||||
use #device as _;
|
||||
#(#const_app_imports)*
|
||||
#(#imports)*
|
||||
#(#user_imports)*
|
||||
|
||||
/// User hardware_tasks
|
||||
#(#user_hardware_tasks_imports)*
|
||||
|
||||
/// User software_tasks
|
||||
#(#user_software_tasks_imports)*
|
||||
|
||||
/// Mod resources imports
|
||||
#(#mod_resources_imports)*
|
||||
|
||||
/// Const app
|
||||
#(#const_app)*
|
||||
|
||||
/// Const app resources
|
||||
#(#const_app_resources)*
|
||||
|
||||
/// Const app hw tasks
|
||||
#(#const_app_hardware_tasks)*
|
||||
|
||||
/// Const app sw tasks
|
||||
#(#const_app_software_tasks)*
|
||||
|
||||
/// Const app dispatchers
|
||||
#(#const_app_dispatchers)*
|
||||
|
||||
/// Const app spawn
|
||||
#(#const_app_spawn)*
|
||||
/// Const app spawn end
|
||||
|
||||
#(#const_app_timer_queue)*
|
||||
|
||||
|
|
Loading…
Reference in a new issue