diff options
author | 2020-10-24 19:38:49 +0200 | |
---|---|---|
committer | 2020-10-24 19:38:49 +0200 | |
commit | 0f8e17361408a704a63995ce9e52fbdeaf34de0b (patch) | |
tree | 6e6097e87ab01186e017f2fc8da0bc11f1a0a486 /macros/src/codegen/software_tasks.rs | |
parent | d11b2ddd3559b29480b9bbcf9d5b7836de190f77 (diff) | |
download | rtic-0f8e17361408a704a63995ce9e52fbdeaf34de0b.tar.gz rtic-0f8e17361408a704a63995ce9e52fbdeaf34de0b.tar.zst rtic-0f8e17361408a704a63995ce9e52fbdeaf34de0b.zip |
extern examples added
Diffstat (limited to 'macros/src/codegen/software_tasks.rs')
-rw-r--r-- | macros/src/codegen/software_tasks.rs | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/macros/src/codegen/software_tasks.rs b/macros/src/codegen/software_tasks.rs index dfba193b..833e338d 100644 --- a/macros/src/codegen/software_tasks.rs +++ b/macros/src/codegen/software_tasks.rs @@ -99,21 +99,23 @@ pub fn codegen( root.push(struct_); } - let context = &task.context; - let attrs = &task.attrs; - let cfgs = &task.cfgs; - let stmts = &task.stmts; - let locals_pat = locals_pat.iter(); - user_tasks.push(quote!( - #(#attrs)* - #(#cfgs)* - #[allow(non_snake_case)] - fn #name(#(#locals_pat,)* #context: #name::Context #(,#inputs)*) { - use rtic::Mutex as _; - - #(#stmts)* - } - )); + if !&task.is_extern { + let context = &task.context; + let attrs = &task.attrs; + let cfgs = &task.cfgs; + let stmts = &task.stmts; + let locals_pat = locals_pat.iter(); + user_tasks.push(quote!( + #(#attrs)* + #(#cfgs)* + #[allow(non_snake_case)] + fn #name(#(#locals_pat,)* #context: #name::Context #(,#inputs)*) { + use rtic::Mutex as _; + + #(#stmts)* + } + )); + } root.push(module::codegen( Context::SoftwareTask(name), |