From 37ee3a47afbbbf57751243d6d32aaac78073780c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Wed, 14 Oct 2020 10:15:35 +0000 Subject: [PATCH] Create Enum containing all tasks --- macros/src/codegen.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index f230d3956d..a44266ad3c 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -126,6 +126,20 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { let user_code = app.user_code.clone(); let name = &app.name; let device = extra.device; + + // Get the list of all tasks + // Currently unused, might be useful + let task_list = analysis.tasks.clone(); + + let mut tasks = vec![]; + if !task_list.is_empty() { + tasks.push(quote!( + enum Tasks { + #(#task_list),* + } + )); + } + quote!( #(#user)* @@ -141,6 +155,9 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { #(#root_software_tasks)* + /// Unused + #(#tasks)* + /// Implementation details mod #name { /// Always include the device crate which contains the vector table