mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-17 21:35:20 +01:00
Added interface for cancel/reschedule
Use wrapping add for marker No need to store handle to queue Remove unnecessary `SpawnHandle::new` Fix test Updated interface to follow proposal
This commit is contained in:
parent
4bdc187912
commit
1087f2ee64
6 changed files with 108 additions and 249 deletions
|
|
@ -26,18 +26,29 @@ mod app {
|
|||
|
||||
let mono = DwtSystick::new(&mut dcb, dwt, systick, 8_000_000);
|
||||
|
||||
let _: Result<(), ()> = foo::spawn_after(Seconds(1_u32));
|
||||
let _: Result<(), u32> = bar::spawn_after(Seconds(2_u32), 0);
|
||||
let _: Result<(), (u32, u32)> = baz::spawn_after(Seconds(3_u32), 0, 1);
|
||||
let a: Result<foo::MyMono::SpawnHandle, ()> = foo::spawn_after(Seconds(1_u32));
|
||||
if let Ok(handle) = a {
|
||||
let _: Result<foo::MyMono::SpawnHandle, ()> = handle.reschedule_after(Seconds(1_u32));
|
||||
}
|
||||
|
||||
let b: Result<bar::MyMono::SpawnHandle, u32> = bar::spawn_after(Seconds(2_u32), 0);
|
||||
if let Ok(handle) = b {
|
||||
let _: Result<u32, ()> = handle.cancel();
|
||||
}
|
||||
|
||||
let _: Result<baz::MyMono::SpawnHandle, (u32, u32)> =
|
||||
baz::spawn_after(Seconds(3_u32), 0, 1);
|
||||
|
||||
(init::LateResources {}, init::Monotonics(mono))
|
||||
}
|
||||
|
||||
#[idle]
|
||||
fn idle(_: idle::Context) -> ! {
|
||||
let _: Result<(), ()> = foo::spawn_at(MyMono::now() + Seconds(3_u32));
|
||||
let _: Result<(), u32> = bar::spawn_at(MyMono::now() + Seconds(4_u32), 0);
|
||||
let _: Result<(), (u32, u32)> = baz::spawn_at(MyMono::now() + Seconds(5_u32), 0, 1);
|
||||
let _: Result<foo::MyMono::SpawnHandle, ()> = foo::spawn_at(MyMono::now() + Seconds(3_u32));
|
||||
let _: Result<bar::MyMono::SpawnHandle, u32> =
|
||||
bar::spawn_at(MyMono::now() + Seconds(4_u32), 0);
|
||||
let _: Result<baz::MyMono::SpawnHandle, (u32, u32)> =
|
||||
baz::spawn_at(MyMono::now() + Seconds(5_u32), 0, 1);
|
||||
|
||||
loop {
|
||||
cortex_m::asm::nop();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue