Minor fixes

This commit is contained in:
Emil Fresk 2021-02-04 20:22:02 +01:00
parent 0658d53843
commit 6fb43fa97b
3 changed files with 12 additions and 4 deletions

View file

@ -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)*)

View file

@ -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);));

View file

@ -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,