aboutsummaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorEmil Fresk <emil.fresk@gmail.com>2020-10-15 18:27:48 +0200
committerEmil Fresk <emil.fresk@gmail.com>2020-10-15 18:27:48 +0200
commit6808cc7cdf1512a7b10dd43f268f430a676c606e (patch)
tree67c0eadf6d8a98a2691b816d46a5103d159d6bbc /macros
parentc5b5ea60e826a7b95bd04055a722ecdc332df1d0 (diff)
parentf9303cef1cf5b2d57d26e7667289fbdccf959ea8 (diff)
Merge branch 'master' into spawn_experiment
Diffstat (limited to 'macros')
-rw-r--r--macros/Cargo.toml1
-rw-r--r--macros/src/codegen.rs16
2 files changed, 17 insertions, 0 deletions
diff --git a/macros/Cargo.toml b/macros/Cargo.toml
index 91f057b..a9f268f 100644
--- a/macros/Cargo.toml
+++ b/macros/Cargo.toml
@@ -19,6 +19,7 @@ proc-macro = true
[dependencies]
proc-macro2 = "1"
+proc-macro-error = "1"
quote = "1"
syn = "1"
rtic-syntax = { git = "https://github.com/rtic-rs/rtic-syntax", branch = "master", version = "0.5.0-alpha.0" }
diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs
index 4ce876b..0cff5bb 100644
--- a/macros/src/codegen.rs
+++ b/macros/src/codegen.rs
@@ -117,6 +117,19 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 {
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)*
@@ -132,6 +145,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