mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-16 21:05:35 +01:00
Keep user code as-is within the module, add example
This commit is contained in:
parent
adff844b8c
commit
487fea45ce
3 changed files with 68 additions and 1 deletions
|
|
@ -123,6 +123,7 @@ 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 user_code = app.user_code.clone();
|
||||
let name = &app.name;
|
||||
let device = extra.device;
|
||||
quote!(
|
||||
|
|
@ -148,6 +149,11 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 {
|
|||
#(#imports)*
|
||||
#(#user_imports)*
|
||||
|
||||
/// User code from within the module
|
||||
#(#user_code)*
|
||||
/// User code end
|
||||
|
||||
|
||||
#(#user_hardware_tasks_imports)*
|
||||
|
||||
#(#user_software_tasks_imports)*
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ mod tests;
|
|||
///
|
||||
/// The items allowed in the module block are specified below:
|
||||
///
|
||||
/// # 1. `struct Resources`
|
||||
/// # 1. `#[resources]
|
||||
/// struct <resource-name>`
|
||||
///
|
||||
/// This structure contains the declaration of all the resources used by the application. Each field
|
||||
/// in this structure corresponds to a different resource. Each resource may optionally be given an
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue