Remove ok() from hprintln!()

sd 'hprintln(.*).ok\(\)' 'hprintln' (fd -e rs .)
This commit is contained in:
Henrik Tjäder 2023-01-11 21:40:33 +01:00
parent 1fe587c516
commit c370c0b21f
8 changed files with 37 additions and 37 deletions

View file

@ -28,7 +28,7 @@ mod app {
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz) // Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000); let mono = Systick::new(systick, 12_000_000);
hprintln!("init").ok(); hprintln!("init");
// Schedule `foo` to run 1 second in the future // Schedule `foo` to run 1 second in the future
foo::spawn_after(1.secs()).unwrap(); foo::spawn_after(1.secs()).unwrap();
@ -42,7 +42,7 @@ mod app {
#[task] #[task]
fn foo(_: foo::Context) { fn foo(_: foo::Context) {
hprintln!("foo").ok(); hprintln!("foo");
// Schedule `bar` to run 2 seconds in the future (1 second after foo runs) // Schedule `bar` to run 2 seconds in the future (1 second after foo runs)
let spawn_handle = baz::spawn_after(2.secs()).unwrap(); let spawn_handle = baz::spawn_after(2.secs()).unwrap();
@ -51,7 +51,7 @@ mod app {
#[task] #[task]
fn bar(_: bar::Context, baz_handle: baz::SpawnHandle, do_reschedule: bool) { fn bar(_: bar::Context, baz_handle: baz::SpawnHandle, do_reschedule: bool) {
hprintln!("bar").ok(); hprintln!("bar");
if do_reschedule { if do_reschedule {
// Reschedule baz 2 seconds from now, instead of the original 1 second // Reschedule baz 2 seconds from now, instead of the original 1 second
@ -67,7 +67,7 @@ mod app {
#[task] #[task]
fn baz(_: baz::Context) { fn baz(_: baz::Context) {
hprintln!("baz").ok(); hprintln!("baz");
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
} }
} }

View file

@ -73,7 +73,7 @@ mod app {
// This task is only spawned once in `init`, hence this task will run // This task is only spawned once in `init`, hence this task will run
// only once // only once
hprintln!("foo").ok(); hprintln!("foo");
} }
// Software task, also not bound to a hardware interrupt // Software task, also not bound to a hardware interrupt
@ -81,7 +81,7 @@ mod app {
// The resources `s1` and `s2` are shared between all other tasks. // The resources `s1` and `s2` are shared between all other tasks.
#[task(shared = [s1, s2], local = [l2])] #[task(shared = [s1, s2], local = [l2])]
fn bar(_: bar::Context) { fn bar(_: bar::Context) {
hprintln!("bar").ok(); hprintln!("bar");
// Run `bar` once per second // Run `bar` once per second
bar::spawn_after(1.secs()).unwrap(); bar::spawn_after(1.secs()).unwrap();
@ -97,6 +97,6 @@ mod app {
// Note that RTIC does NOT clear the interrupt flag, this is up to the // Note that RTIC does NOT clear the interrupt flag, this is up to the
// user // user
hprintln!("UART0 interrupt!").ok(); hprintln!("UART0 interrupt!");
} }
} }

View file

@ -40,31 +40,31 @@ mod app {
#[idle(shared = [s2, s3])] #[idle(shared = [s2, s3])]
fn idle(mut cx: idle::Context) -> ! { fn idle(mut cx: idle::Context) -> ! {
hprintln!("idle p0 started").ok(); hprintln!("idle p0 started");
rtic::pend(Interrupt::GPIOC); rtic::pend(Interrupt::GPIOC);
cx.shared.s3.lock(|s| { cx.shared.s3.lock(|s| {
hprintln!("idle enter lock s3 {}", s).ok(); hprintln!("idle enter lock s3 {}", s);
hprintln!("idle pend t0").ok(); hprintln!("idle pend t0");
rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 3 rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 3
hprintln!("idle pend t1").ok(); hprintln!("idle pend t1");
rtic::pend(Interrupt::GPIOB); // t1 p3, with shared ceiling 3 rtic::pend(Interrupt::GPIOB); // t1 p3, with shared ceiling 3
hprintln!("idle pend t2").ok(); hprintln!("idle pend t2");
rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing
hprintln!("idle still in lock s3 {}", s).ok(); hprintln!("idle still in lock s3 {}", s);
}); });
hprintln!("\nback in idle").ok(); hprintln!("\nback in idle");
cx.shared.s2.lock(|s| { cx.shared.s2.lock(|s| {
hprintln!("enter lock s2 {}", s).ok(); hprintln!("enter lock s2 {}", s);
hprintln!("idle pend t0").ok(); hprintln!("idle pend t0");
rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 2 rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 2
hprintln!("idle pend t1").ok(); hprintln!("idle pend t1");
rtic::pend(Interrupt::GPIOB); // t1 p3, no sharing rtic::pend(Interrupt::GPIOB); // t1 p3, no sharing
hprintln!("idle pend t2").ok(); hprintln!("idle pend t2");
rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing
hprintln!("idle still in lock s2 {}", s).ok(); hprintln!("idle still in lock s2 {}", s);
}); });
hprintln!("\nidle exit").ok(); hprintln!("\nidle exit");
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
@ -84,7 +84,7 @@ mod app {
if *cx.local.times > 1 { "s" } else { "" } if *cx.local.times > 1 { "s" } else { "" }
) )
.ok(); .ok();
hprintln!("t0 p2 exit").ok(); hprintln!("t0 p2 exit");
} }
#[task(binds = GPIOB, priority = 3, local = [times: u32 = 0], shared = [s3, s4])] #[task(binds = GPIOB, priority = 3, local = [times: u32 = 0], shared = [s3, s4])]
@ -100,15 +100,15 @@ mod app {
.ok(); .ok();
cx.shared.s4.lock(|s| { cx.shared.s4.lock(|s| {
hprintln!("t1 enter lock s4 {}", s).ok(); hprintln!("t1 enter lock s4 {}", s);
hprintln!("t1 pend t0").ok(); hprintln!("t1 pend t0");
rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 2 rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 2
hprintln!("t1 pend t2").ok(); hprintln!("t1 pend t2");
rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing
hprintln!("t1 still in lock s4 {}", s).ok(); hprintln!("t1 still in lock s4 {}", s);
}); });
hprintln!("t1 p3 exit").ok(); hprintln!("t1 p3 exit");
} }
#[task(binds = GPIOC, priority = 4, local = [times: u32 = 0], shared = [s4])] #[task(binds = GPIOC, priority = 4, local = [times: u32 = 0], shared = [s4])]
@ -124,9 +124,9 @@ mod app {
.unwrap(); .unwrap();
cx.shared.s4.lock(|s| { cx.shared.s4.lock(|s| {
hprintln!("enter lock s4 {}", s).ok(); hprintln!("enter lock s4 {}", s);
*s += 1; *s += 1;
}); });
hprintln!("t3 p4 exit").ok(); hprintln!("t3 p4 exit");
} }
} }

View file

@ -10,7 +10,7 @@ use panic_semihosting as _;
// Free function implementing the interrupt bound task `foo`. // Free function implementing the interrupt bound task `foo`.
fn foo(_: app::foo::Context) { fn foo(_: app::foo::Context) {
hprintln!("foo called").ok(); hprintln!("foo called");
} }
#[rtic::app(device = lm3s6965)] #[rtic::app(device = lm3s6965)]

View file

@ -35,7 +35,7 @@ mod app {
#[task(local = [cnt: u32 = 0])] #[task(local = [cnt: u32 = 0])]
fn foo(cx: foo::Context, instant: fugit::TimerInstantU64<100>) { fn foo(cx: foo::Context, instant: fugit::TimerInstantU64<100>) {
hprintln!("foo {:?}", instant).ok(); hprintln!("foo {:?}", instant);
*cx.local.cnt += 1; *cx.local.cnt += 1;
if *cx.local.cnt == 4 { if *cx.local.cnt == 4 {

View file

@ -36,7 +36,7 @@ mod app {
// Using the explicit type of the timer implementation // Using the explicit type of the timer implementation
#[task(local = [cnt: u32 = 0])] #[task(local = [cnt: u32 = 0])]
fn foo(cx: foo::Context, instant: fugit::TimerInstantU64<100>) { fn foo(cx: foo::Context, instant: fugit::TimerInstantU64<100>) {
hprintln!("foo {:?}", instant).ok(); hprintln!("foo {:?}", instant);
*cx.local.cnt += 1; *cx.local.cnt += 1;
if *cx.local.cnt == 4 { if *cx.local.cnt == 4 {
@ -52,7 +52,7 @@ mod app {
// This remains agnostic to the timer implementation // This remains agnostic to the timer implementation
#[task(local = [cnt: u32 = 0])] #[task(local = [cnt: u32 = 0])]
fn bar(_cx: bar::Context, instant: <MyMono as rtic_monotonic::Monotonic>::Instant) { fn bar(_cx: bar::Context, instant: <MyMono as rtic_monotonic::Monotonic>::Instant) {
hprintln!("bar {:?}", instant).ok(); hprintln!("bar {:?}", instant);
// Spawn a new message with 1s offset to spawned time // Spawn a new message with 1s offset to spawned time
let next_instant = instant + 1.secs(); let next_instant = instant + 1.secs();

View file

@ -35,7 +35,7 @@ mod app {
#[task(local = [cnt: u32 = 0])] #[task(local = [cnt: u32 = 0])]
fn foo(cx: foo::Context) { fn foo(cx: foo::Context) {
hprintln!("foo").ok(); hprintln!("foo");
*cx.local.cnt += 1; *cx.local.cnt += 1;
if *cx.local.cnt == 4 { if *cx.local.cnt == 4 {

View file

@ -28,7 +28,7 @@ mod app {
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz) // Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000); let mono = Systick::new(systick, 12_000_000);
hprintln!("init").ok(); hprintln!("init");
// Schedule `foo` to run 1 second in the future // Schedule `foo` to run 1 second in the future
foo::spawn_after(1.secs()).unwrap(); foo::spawn_after(1.secs()).unwrap();
@ -42,7 +42,7 @@ mod app {
#[task] #[task]
fn foo(_: foo::Context) { fn foo(_: foo::Context) {
hprintln!("foo").ok(); hprintln!("foo");
// Schedule `bar` to run 2 seconds in the future (1 second after foo runs) // Schedule `bar` to run 2 seconds in the future (1 second after foo runs)
bar::spawn_after(1.secs()).unwrap(); bar::spawn_after(1.secs()).unwrap();
@ -50,7 +50,7 @@ mod app {
#[task] #[task]
fn bar(_: bar::Context) { fn bar(_: bar::Context) {
hprintln!("bar").ok(); hprintln!("bar");
// Schedule `baz` to run 1 seconds from now, but with a specific time instant. // Schedule `baz` to run 1 seconds from now, but with a specific time instant.
baz::spawn_at(monotonics::now() + 1.secs()).unwrap(); baz::spawn_at(monotonics::now() + 1.secs()).unwrap();
@ -58,7 +58,7 @@ mod app {
#[task] #[task]
fn baz(_: baz::Context) { fn baz(_: baz::Context) {
hprintln!("baz").ok(); hprintln!("baz");
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
} }
} }