mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-17 21:35:20 +01:00
resources
This commit is contained in:
parent
91ea1e428b
commit
0cb7cb0ba8
3 changed files with 22 additions and 54 deletions
|
|
@ -41,6 +41,7 @@ mod app {
|
|||
}
|
||||
|
||||
// `shared` can be accessed from this context
|
||||
// defaults to priority 1
|
||||
#[task(binds = UART0, resources = [shared])]
|
||||
fn uart0(mut cx: uart0::Context) {
|
||||
let shared = cx.resources.shared.lock(|shared| {
|
||||
|
|
@ -52,7 +53,8 @@ mod app {
|
|||
}
|
||||
|
||||
// `shared` can be accessed from this context
|
||||
#[task(binds = UART1, resources = [shared])]
|
||||
// explicitly set to priority 2
|
||||
#[task(binds = UART1, resources = [shared], priority = 2)]
|
||||
fn uart1(mut cx: uart1::Context) {
|
||||
let shared = cx.resources.shared.lock(|shared| {
|
||||
*shared += 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue