mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-24 04:32:52 +01:00
Minor fixes
This commit is contained in:
parent
0658d53843
commit
6fb43fa97b
3 changed files with 12 additions and 4 deletions
|
@ -135,7 +135,7 @@ pub fn codegen(
|
||||||
/// Monotonics used by the system
|
/// Monotonics used by the system
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub struct Monotonics(
|
pub struct Monotonics(
|
||||||
#(#monotonic_types),*
|
#(pub #monotonic_types),*
|
||||||
);
|
);
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -258,10 +258,13 @@ pub fn codegen(
|
||||||
items.push(quote!(
|
items.push(quote!(
|
||||||
pub mod #m {
|
pub mod #m {
|
||||||
#(#cfgs)*
|
#(#cfgs)*
|
||||||
pub fn spawn_after(
|
pub fn spawn_after<D>(
|
||||||
duration: rtic::time::duration::Duration,
|
duration: D,
|
||||||
#(,#args)*
|
#(,#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();
|
let instant = <#app_path::#m as rtic::Monotonic>::now();
|
||||||
|
|
||||||
spawn_at(instant + duration, #(,#untupled)*)
|
spawn_at(instant + duration, #(,#untupled)*)
|
||||||
|
|
|
@ -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.
|
// Forget the monotonics so they won't be dropped.
|
||||||
stmts.push(quote!(core::mem::forget(monotonics);));
|
stmts.push(quote!(core::mem::forget(monotonics);));
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea
|
||||||
|
|
||||||
items.push(quote!(
|
items.push(quote!(
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
#[allow(non_snake_case)]
|
||||||
unsafe fn #bound_interrupt() {
|
unsafe fn #bound_interrupt() {
|
||||||
while let Some((task, index)) = rtic::export::interrupt::free(|_| #tq.dequeue(
|
while let Some((task, index)) = rtic::export::interrupt::free(|_| #tq.dequeue(
|
||||||
|| #enable_isr,
|
|| #enable_isr,
|
||||||
|
|
Loading…
Reference in a new issue