diff options
author | 2021-02-04 20:22:02 +0100 | |
---|---|---|
committer | 2021-02-04 20:22:02 +0100 | |
commit | 6fb43fa97be75f00553e0026ac06f107ee832dc2 (patch) | |
tree | 5219f673178999295e8738d0f8f7e1623a5a0bb9 /macros/src | |
parent | 0658d53843d5452085e7458269e0abebbf431971 (diff) | |
download | rtic-6fb43fa97be75f00553e0026ac06f107ee832dc2.tar.gz rtic-6fb43fa97be75f00553e0026ac06f107ee832dc2.tar.zst rtic-6fb43fa97be75f00553e0026ac06f107ee832dc2.zip |
Minor fixes
Diffstat (limited to 'macros/src')
-rw-r--r-- | macros/src/codegen/module.rs | 11 | ||||
-rw-r--r-- | macros/src/codegen/post_init.rs | 4 | ||||
-rw-r--r-- | macros/src/codegen/timer_queue.rs | 1 |
3 files changed, 12 insertions, 4 deletions
diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index d15b5eca..93fbeaef 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -135,7 +135,7 @@ pub fn codegen( /// Monotonics used by the system #[allow(non_snake_case)] pub struct Monotonics( - #(#monotonic_types),* + #(pub #monotonic_types),* ); )); } @@ -258,10 +258,13 @@ pub fn codegen( items.push(quote!( pub mod #m { #(#cfgs)* - pub fn spawn_after( - duration: rtic::time::duration::Duration, + pub fn spawn_after<D>( + duration: D, #(,#args)* - ) -> Result<(), #ty> { + ) -> Result<(), #ty> + where D: rtic::time::duration::Duration + rtic::time::fixed_point::FixedPoint, + D::T: Into<<#app_path::#m as rtic::time::Clock>::T>, + { let instant = <#app_path::#m as rtic::Monotonic>::now(); spawn_at(instant + duration, #(,#untupled)*) diff --git a/macros/src/codegen/post_init.rs b/macros/src/codegen/post_init.rs index 9174daeb..9268e040 100644 --- a/macros/src/codegen/post_init.rs +++ b/macros/src/codegen/post_init.rs @@ -25,6 +25,10 @@ pub fn codegen(app: &App, analysis: &Analysis) -> Vec<TokenStream2> { } } + for (monotonic, _) in app.monotonics.iter() { + stmts.push(quote!(#monotonic::reset();)); + } + // Forget the monotonics so they won't be dropped. stmts.push(quote!(core::mem::forget(monotonics);)); diff --git a/macros/src/codegen/timer_queue.rs b/macros/src/codegen/timer_queue.rs index 99dfa5bf..9a430a07 100644 --- a/macros/src/codegen/timer_queue.rs +++ b/macros/src/codegen/timer_queue.rs @@ -108,6 +108,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea items.push(quote!( #[no_mangle] + #[allow(non_snake_case)] unsafe fn #bound_interrupt() { while let Some((task, index)) = rtic::export::interrupt::free(|_| #tq.dequeue( || #enable_isr, |