mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
examples/async-task fixup
This commit is contained in:
parent
fe2b5cc52e
commit
9247252cc7
1 changed files with 5 additions and 5 deletions
|
@ -6,7 +6,7 @@ use panic_semihosting as _;
|
||||||
|
|
||||||
// NOTES:
|
// NOTES:
|
||||||
//
|
//
|
||||||
// - Async tasks cannot have `#[lock_free]` resources, as they can interleve and each async
|
// - Async tasks cannot have `#[lock_free]` resources, as they can interleave and each async
|
||||||
// task can have a mutable reference stored.
|
// task can have a mutable reference stored.
|
||||||
// - Spawning an async task equates to it being polled once.
|
// - Spawning an async task equates to it being polled once.
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ mod app {
|
||||||
struct Local {}
|
struct Local {}
|
||||||
|
|
||||||
#[init]
|
#[init]
|
||||||
fn init(cx: init::Context) -> (Shared, Local) {
|
fn init(_cx: init::Context) -> (Shared, Local) {
|
||||||
hprintln!("init").unwrap();
|
hprintln!("init").unwrap();
|
||||||
|
|
||||||
async_task::spawn().unwrap();
|
async_task::spawn().unwrap();
|
||||||
|
@ -43,13 +43,13 @@ mod app {
|
||||||
|
|
||||||
#[task(binds = UART1, shared = [a])]
|
#[task(binds = UART1, shared = [a])]
|
||||||
fn hw_task(cx: hw_task::Context) {
|
fn hw_task(cx: hw_task::Context) {
|
||||||
let hw_task::SharedResources { a, .. } = cx.shared;
|
let hw_task::SharedResources { a: _, .. } = cx.shared;
|
||||||
hprintln!("hello from hw").ok();
|
hprintln!("hello from hw").ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[task(shared = [a])]
|
#[task(shared = [a])]
|
||||||
async fn async_task(cx: async_task::Context) {
|
async fn async_task(cx: async_task::Context) {
|
||||||
let async_task::SharedResources { a, .. } = cx.shared;
|
let async_task::SharedResources { a: _, .. } = cx.shared;
|
||||||
hprintln!("hello from async").ok();
|
hprintln!("hello from async").ok();
|
||||||
|
|
||||||
debug::exit(debug::EXIT_SUCCESS);
|
debug::exit(debug::EXIT_SUCCESS);
|
||||||
|
@ -57,7 +57,7 @@ mod app {
|
||||||
|
|
||||||
#[task(priority = 2, shared = [a])]
|
#[task(priority = 2, shared = [a])]
|
||||||
async fn async_task2(cx: async_task2::Context) {
|
async fn async_task2(cx: async_task2::Context) {
|
||||||
let async_task2::SharedResources { a, .. } = cx.shared;
|
let async_task2::SharedResources { a: _, .. } = cx.shared;
|
||||||
hprintln!("hello from async2").ok();
|
hprintln!("hello from async2").ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue