From 582c602912592ec7ebea3096aefa02aea99c2143 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Mon, 2 Jan 2023 14:34:05 +0100 Subject: Old xtask test pass --- examples/lock.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'examples/lock.rs') diff --git a/examples/lock.rs b/examples/lock.rs index 5b3e0bc..f1a1696 100644 --- a/examples/lock.rs +++ b/examples/lock.rs @@ -2,7 +2,6 @@ #![deny(unsafe_code)] #![deny(warnings)] -#![deny(missing_docs)] #![no_main] #![no_std] @@ -30,7 +29,7 @@ mod app { // when omitted priority is assumed to be `1` #[task(shared = [shared])] fn foo(mut c: foo::Context) { - hprintln!("A"); + hprintln!("A").unwrap(); // the lower priority task requires a critical section to access the data c.shared.shared.lock(|shared| { @@ -40,7 +39,7 @@ mod app { // bar will *not* run right now due to the critical section bar::spawn().unwrap(); - hprintln!("B - shared = {}", *shared); + hprintln!("B - shared = {}", *shared).unwrap(); // baz does not contend for `shared` so it's allowed to run now baz::spawn().unwrap(); @@ -48,7 +47,7 @@ mod app { // critical section is over: bar can now start - hprintln!("E"); + hprintln!("E").unwrap(); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } @@ -62,11 +61,11 @@ mod app { *shared }); - hprintln!("D - shared = {}", shared); + hprintln!("D - shared = {}", shared).unwrap(); } #[task(priority = 3)] fn baz(_: baz::Context) { - hprintln!("C"); + hprintln!("C").unwrap(); } } -- cgit v1.2.3 From b054e871d486e8eb35e3c98a73652640238c5e7d Mon Sep 17 00:00:00 2001 From: Per Lindgren Date: Sat, 7 Jan 2023 14:23:32 +0100 Subject: examples/lock fixed --- examples/lock.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'examples/lock.rs') diff --git a/examples/lock.rs b/examples/lock.rs index f1a1696..50b6aaa 100644 --- a/examples/lock.rs +++ b/examples/lock.rs @@ -4,6 +4,7 @@ #![deny(warnings)] #![no_main] #![no_std] +#![feature(type_alias_impl_trait)] use panic_semihosting as _; @@ -20,15 +21,15 @@ mod app { struct Local {} #[init] - fn init(_: init::Context) -> (Shared, Local, init::Monotonics) { + fn init(_: init::Context) -> (Shared, Local) { foo::spawn().unwrap(); - (Shared { shared: 0 }, Local {}, init::Monotonics()) + (Shared { shared: 0 }, Local {}) } // when omitted priority is assumed to be `1` #[task(shared = [shared])] - fn foo(mut c: foo::Context) { + async fn foo(mut c: foo::Context) { hprintln!("A").unwrap(); // the lower priority task requires a critical section to access the data @@ -53,7 +54,7 @@ mod app { } #[task(priority = 2, shared = [shared])] - fn bar(mut c: bar::Context) { + async fn bar(mut c: bar::Context) { // the higher priority task does still need a critical section let shared = c.shared.shared.lock(|shared| { *shared += 1; @@ -65,7 +66,7 @@ mod app { } #[task(priority = 3)] - fn baz(_: baz::Context) { + async fn baz(_: baz::Context) { hprintln!("C").unwrap(); } } -- cgit v1.2.3 From ceaf3613d3256f60b139a4f93220e3c298603b83 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Sun, 8 Jan 2023 19:40:31 +0100 Subject: Update semihosting --- examples/lock.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/lock.rs') diff --git a/examples/lock.rs b/examples/lock.rs index 50b6aaa..3c1a514 100644 --- a/examples/lock.rs +++ b/examples/lock.rs @@ -30,7 +30,7 @@ mod app { // when omitted priority is assumed to be `1` #[task(shared = [shared])] async fn foo(mut c: foo::Context) { - hprintln!("A").unwrap(); + hprintln!("A"); // the lower priority task requires a critical section to access the data c.shared.shared.lock(|shared| { @@ -40,7 +40,7 @@ mod app { // bar will *not* run right now due to the critical section bar::spawn().unwrap(); - hprintln!("B - shared = {}", *shared).unwrap(); + hprintln!("B - shared = {}", *shared); // baz does not contend for `shared` so it's allowed to run now baz::spawn().unwrap(); @@ -48,7 +48,7 @@ mod app { // critical section is over: bar can now start - hprintln!("E").unwrap(); + hprintln!("E"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } @@ -62,11 +62,11 @@ mod app { *shared }); - hprintln!("D - shared = {}", shared).unwrap(); + hprintln!("D - shared = {}", shared); } #[task(priority = 3)] async fn baz(_: baz::Context) { - hprintln!("C").unwrap(); + hprintln!("C"); } } -- cgit v1.2.3 From b8b881f446a226d6f3c4a7db7c9174590b47dbf6 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Thu, 19 Jan 2023 13:56:59 +0100 Subject: Fix so deny(missing_docs) work --- examples/lock.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/lock.rs') diff --git a/examples/lock.rs b/examples/lock.rs index 3c1a514..203ae6f 100644 --- a/examples/lock.rs +++ b/examples/lock.rs @@ -2,6 +2,7 @@ #![deny(unsafe_code)] #![deny(warnings)] +#![deny(missing_docs)] #![no_main] #![no_std] #![feature(type_alias_impl_trait)] -- cgit v1.2.3 From 306aa47170fd59369b7a184924e287dc3706d64d Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Mon, 23 Jan 2023 20:05:47 +0100 Subject: Add rtic-timer (timerqueue + monotonic) and rtic-monotonics (systick-monotonic) --- examples/lock.rs | 73 -------------------------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 examples/lock.rs (limited to 'examples/lock.rs') diff --git a/examples/lock.rs b/examples/lock.rs deleted file mode 100644 index 203ae6f..0000000 --- a/examples/lock.rs +++ /dev/null @@ -1,73 +0,0 @@ -//! examples/lock.rs - -#![deny(unsafe_code)] -#![deny(warnings)] -#![deny(missing_docs)] -#![no_main] -#![no_std] -#![feature(type_alias_impl_trait)] - -use panic_semihosting as _; - -#[rtic::app(device = lm3s6965, dispatchers = [GPIOA, GPIOB, GPIOC])] -mod app { - use cortex_m_semihosting::{debug, hprintln}; - - #[shared] - struct Shared { - shared: u32, - } - - #[local] - struct Local {} - - #[init] - fn init(_: init::Context) -> (Shared, Local) { - foo::spawn().unwrap(); - - (Shared { shared: 0 }, Local {}) - } - - // when omitted priority is assumed to be `1` - #[task(shared = [shared])] - async fn foo(mut c: foo::Context) { - hprintln!("A"); - - // the lower priority task requires a critical section to access the data - c.shared.shared.lock(|shared| { - // data can only be modified within this critical section (closure) - *shared += 1; - - // bar will *not* run right now due to the critical section - bar::spawn().unwrap(); - - hprintln!("B - shared = {}", *shared); - - // baz does not contend for `shared` so it's allowed to run now - baz::spawn().unwrap(); - }); - - // critical section is over: bar can now start - - hprintln!("E"); - - debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator - } - - #[task(priority = 2, shared = [shared])] - async fn bar(mut c: bar::Context) { - // the higher priority task does still need a critical section - let shared = c.shared.shared.lock(|shared| { - *shared += 1; - - *shared - }); - - hprintln!("D - shared = {}", shared); - } - - #[task(priority = 3)] - async fn baz(_: baz::Context) { - hprintln!("C"); - } -} -- cgit v1.2.3