aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGravatar Emil Fresk <emil.fresk@gmail.com> 2023-01-02 14:34:05 +0100
committerGravatar Henrik Tjäder <henrik@tjaders.com> 2023-03-01 00:31:01 +0100
commit582c602912592ec7ebea3096aefa02aea99c2143 (patch)
tree96b14a130788960ee06d7e80adec43a167b4844b /examples
parent7614b96fe45240dafe91ae549e712b560e2d4c10 (diff)
downloadrtic-582c602912592ec7ebea3096aefa02aea99c2143.tar.gz
rtic-582c602912592ec7ebea3096aefa02aea99c2143.tar.zst
rtic-582c602912592ec7ebea3096aefa02aea99c2143.zip
Old xtask test pass
Diffstat (limited to 'examples')
-rw-r--r--examples/async-delay.rs67
-rw-r--r--examples/async-infinite-loop.rs57
-rw-r--r--examples/async-task-multiple-prios.rs76
-rw-r--r--examples/async-task.rs61
-rw-r--r--examples/async-timeout.rs87
-rw-r--r--examples/binds.rs13
-rw-r--r--examples/cancel-reschedule.rs9
-rw-r--r--examples/capacity.rs5
-rw-r--r--examples/cfg-whole-task.rs17
-rw-r--r--examples/common.rs7
-rw-r--r--examples/complex.rs54
-rw-r--r--examples/declared_locals.rs1
-rw-r--r--examples/destructure.rs5
-rw-r--r--examples/extern_binds.rs12
-rw-r--r--examples/extern_spawn.rs3
-rw-r--r--examples/generics.rs10
-rw-r--r--examples/hardware.rs13
-rw-r--r--examples/idle-wfi.rs5
-rw-r--r--examples/idle.rs5
-rw-r--r--examples/init.rs3
-rw-r--r--examples/locals.rs11
-rw-r--r--examples/lock-free.rs5
-rw-r--r--examples/lock.rs11
-rw-r--r--examples/message.rs7
-rw-r--r--examples/message_passing.rs3
-rw-r--r--examples/multilock.rs3
-rw-r--r--examples/not-sync.rs4
-rw-r--r--examples/only-shared-access.rs5
-rw-r--r--examples/periodic-at.rs7
-rw-r--r--examples/periodic-at2.rs11
-rw-r--r--examples/periodic.rs9
-rw-r--r--examples/peripherals-taken.rs4
-rw-r--r--examples/pool.rs2
-rw-r--r--examples/preempt.rs10
-rw-r--r--examples/ramfunc.rs3
-rw-r--r--examples/resource-user-struct.rs5
-rw-r--r--examples/schedule.rs9
-rw-r--r--examples/shared.rs5
-rw-r--r--examples/spawn.rs5
-rw-r--r--examples/static.rs3
-rw-r--r--examples/t-binds.rs1
-rw-r--r--examples/t-htask-main.rs2
-rw-r--r--examples/t-idle-main.rs2
-rw-r--r--examples/t-schedule.rs1
-rw-r--r--examples/t-spawn.rs1
-rw-r--r--examples/task.rs11
46 files changed, 466 insertions, 184 deletions
diff --git a/examples/async-delay.rs b/examples/async-delay.rs
new file mode 100644
index 00000000..7802bda4
--- /dev/null
+++ b/examples/async-delay.rs
@@ -0,0 +1,67 @@
+#![no_main]
+#![no_std]
+#![feature(type_alias_impl_trait)]
+
+use panic_semihosting as _;
+
+#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0], peripherals = true)]
+mod app {
+ use cortex_m_semihosting::{debug, hprintln};
+ use systick_monotonic::*;
+
+ #[shared]
+ struct Shared {}
+
+ #[local]
+ struct Local {}
+
+ #[monotonic(binds = SysTick, default = true)]
+ type MyMono = Systick<100>;
+
+ #[init]
+ fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
+ hprintln!("init").unwrap();
+
+ foo::spawn().ok();
+ bar::spawn().ok();
+ baz::spawn().ok();
+
+ (
+ Shared {},
+ Local {},
+ init::Monotonics(Systick::new(cx.core.SYST, 12_000_000)),
+ )
+ }
+
+ #[idle]
+ fn idle(_: idle::Context) -> ! {
+ // debug::exit(debug::EXIT_SUCCESS);
+ loop {
+ // hprintln!("idle");
+ cortex_m::asm::wfi(); // put the MCU in sleep mode until interrupt occurs
+ }
+ }
+
+ #[task]
+ async fn foo(_cx: foo::Context) {
+ hprintln!("hello from foo").ok();
+ monotonics::delay(100.millis()).await;
+ hprintln!("bye from foo").ok();
+ }
+
+ #[task]
+ async fn bar(_cx: bar::Context) {
+ hprintln!("hello from bar").ok();
+ monotonics::delay(200.millis()).await;
+ hprintln!("bye from bar").ok();
+ }
+
+ #[task]
+ async fn baz(_cx: baz::Context) {
+ hprintln!("hello from baz").ok();
+ monotonics::delay(300.millis()).await;
+ hprintln!("bye from baz").ok();
+
+ debug::exit(debug::EXIT_SUCCESS);
+ }
+}
diff --git a/examples/async-infinite-loop.rs b/examples/async-infinite-loop.rs
new file mode 100644
index 00000000..7615818d
--- /dev/null
+++ b/examples/async-infinite-loop.rs
@@ -0,0 +1,57 @@
+#![no_main]
+#![no_std]
+#![feature(type_alias_impl_trait)]
+
+use panic_semihosting as _;
+
+#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0], peripherals = true)]
+mod app {
+ use cortex_m_semihosting::{debug, hprintln};
+ use systick_monotonic::*;
+
+ #[shared]
+ struct Shared {}
+
+ #[local]
+ struct Local {}
+
+ #[monotonic(binds = SysTick, default = true)]
+ type MyMono = Systick<100>;
+
+ #[init]
+ fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
+ hprintln!("init").unwrap();
+
+ foo::spawn().ok();
+
+ (
+ Shared {},
+ Local {},
+ init::Monotonics(Systick::new(cx.core.SYST, 12_000_000)),
+ )
+ }
+
+ #[idle]
+ fn idle(_: idle::Context) -> ! {
+ loop {
+ cortex_m::asm::wfi(); // put the MCU in sleep mode until interrupt occurs
+ }
+ }
+
+ // Infinite loops are not allowed in RTIC, however in async tasks they are - if there is an
+ // await inside the loop.
+ #[task]
+ async fn foo(_cx: foo::Context) {
+ let mut i = 0;
+ loop {
+ if i == 5 {
+ debug::exit(debug::EXIT_SUCCESS);
+ }
+
+ hprintln!("hello from async {}", i).ok();
+ monotonics::delay(100.millis()).await; // This makes it okey!
+
+ i += 1;
+ }
+ }
+}
diff --git a/examples/async-task-multiple-prios.rs b/examples/async-task-multiple-prios.rs
new file mode 100644
index 00000000..3e197987
--- /dev/null
+++ b/examples/async-task-multiple-prios.rs
@@ -0,0 +1,76 @@
+#![no_main]
+#![no_std]
+#![feature(type_alias_impl_trait)]
+
+use panic_semihosting as _;
+
+// NOTES:
+//
+// - Async tasks cannot have `#[lock_free]` resources, as they can interleve and each async
+// task can have a mutable reference stored.
+// - Spawning an async task equates to it being polled once.
+
+#[rtic::app(device = lm3s6965, dispatchers = [SSI0, QEI0, UART0, UART1], peripherals = true)]
+mod app {
+ use cortex_m_semihosting::{debug, hprintln};
+ use systick_monotonic::*;
+
+ #[shared]
+ struct Shared {
+ a: u32,
+ b: u32,
+ }
+
+ #[local]
+ struct Local {}
+
+ #[monotonic(binds = SysTick, default = true)]
+ type MyMono = Systick<100>;
+
+ #[init]
+ fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
+ hprintln!("init").unwrap();
+
+ normal_task::spawn().ok();
+ async_task::spawn().ok();
+ normal_task2::spawn().ok();
+ async_task2::spawn().ok();
+
+ (
+ Shared { a: 0, b: 0 },
+ Local {},
+ init::Monotonics(Systick::new(cx.core.SYST, 12_000_000)),
+ )
+ }
+
+ #[idle]
+ fn idle(_: idle::Context) -> ! {
+ // debug::exit(debug::EXIT_SUCCESS);
+ loop {
+ // hprintln!("idle");
+ cortex_m::asm::wfi(); // put the MCU in sleep mode until interrupt occurs
+ }
+ }
+
+ #[task(priority = 1, shared = [a, b])]
+ fn normal_task(_cx: normal_task::Context) {
+ hprintln!("hello from normal 1").ok();
+ }
+
+ #[task(priority = 1, shared = [a, b])]
+ async fn async_task(_cx: async_task::Context) {
+ hprintln!("hello from async 1").ok();
+
+ debug::exit(debug::EXIT_SUCCESS);
+ }
+
+ #[task(priority = 2, shared = [a, b])]
+ fn normal_task2(_cx: normal_task2::Context) {
+ hprintln!("hello from normal 2").ok();
+ }
+
+ #[task(priority = 2, shared = [a, b])]
+ async fn async_task2(_cx: async_task2::Context) {
+ hprintln!("hello from async 2").ok();
+ }
+}
diff --git a/examples/async-task.rs b/examples/async-task.rs
new file mode 100644
index 00000000..4d25ec44
--- /dev/null
+++ b/examples/async-task.rs
@@ -0,0 +1,61 @@
+#![no_main]
+#![no_std]
+#![feature(type_alias_impl_trait)]
+
+use panic_semihosting as _;
+
+// NOTES:
+//
+// - Async tasks cannot have `#[lock_free]` resources, as they can interleve and each async
+// task can have a mutable reference stored.
+// - Spawning an async task equates to it being polled once.
+
+#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0], peripherals = true)]
+mod app {
+ use cortex_m_semihosting::{debug, hprintln};
+ use systick_monotonic::*;
+
+ #[shared]
+ struct Shared {}
+
+ #[local]
+ struct Local {}
+
+ #[monotonic(binds = SysTick, default = true)]
+ type MyMono = Systick<100>;
+
+ #[init]
+ fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
+ hprintln!("init").unwrap();
+
+ normal_task::spawn().ok();
+ async_task::spawn().ok();
+
+ (
+ Shared {},
+ Local {},
+ init::Monotonics(Systick::new(cx.core.SYST, 12_000_000)),
+ )
+ }
+
+ #[idle]
+ fn idle(_: idle::Context) -> ! {
+ // debug::exit(debug::EXIT_SUCCESS);
+ loop {
+ // hprintln!("idle");
+ cortex_m::asm::wfi(); // put the MCU in sleep mode until interrupt occurs
+ }
+ }
+
+ #[task]
+ fn normal_task(_cx: normal_task::Context) {
+ hprintln!("hello from normal").ok();
+ }
+
+ #[task]
+ async fn async_task(_cx: async_task::Context) {
+ hprintln!("hello from async").ok();
+
+ debug::exit(debug::EXIT_SUCCESS);
+ }
+}
diff --git a/examples/async-timeout.rs b/examples/async-timeout.rs
new file mode 100644
index 00000000..3f68df74
--- /dev/null
+++ b/examples/async-timeout.rs
@@ -0,0 +1,87 @@
+#![no_main]
+#![no_std]
+#![feature(type_alias_impl_trait)]
+
+use panic_semihosting as _;
+
+// NOTES:
+//
+// - Async tasks cannot have `#[lock_free]` resources, as they can interleve and each async
+// task can have a mutable reference stored.
+// - Spawning an async task equates to it being polled once.
+
+#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0], peripherals = true)]
+mod app {
+ use core::{
+ future::Future,
+ pin::Pin,
+ task::{Context, Poll},
+ };
+ use cortex_m_semihosting::{debug, hprintln};
+ use systick_monotonic::*;
+
+ #[shared]
+ struct Shared {}
+
+ #[local]
+ struct Local {}
+
+ #[monotonic(binds = SysTick, default = true)]
+ type MyMono = Systick<100>;
+
+ #[init]
+ fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
+ hprintln!("init").unwrap();
+
+ foo::spawn().ok();
+ bar::spawn().ok();
+
+ (
+ Shared {},
+ Local {},
+ init::Monotonics(Systick::new(cx.core.SYST, 12_000_000)),
+ )
+ }
+
+ #[idle]
+ fn idle(_: idle::Context) -> ! {
+ loop {
+ cortex_m::asm::wfi(); // put the MCU in sleep mode until interrupt occurs
+ }
+ }
+
+ #[task]
+ async fn foo(_cx: foo::Context) {
+ hprintln!("hello from foo").ok();
+
+ // This will not timeout
+ match monotonics::timeout_after(monotonics::delay(100.millis()), 200.millis()).await {
+ Ok(_) => hprintln!("foo no timeout").ok(),
+ Err(_) => hprintln!("foo timeout").ok(),
+ };
+ }
+
+ #[task]
+ async fn bar(_cx: bar::Context) {
+ hprintln!("hello from bar").ok();
+
+ // This will timeout
+ match monotonics::timeout_after(NeverEndingFuture {}, 300.millis()).await {
+ Ok(_) => hprintln!("bar no timeout").ok(),
+ Err(_) => hprintln!("bar timeout").ok(),
+ };
+
+ debug::exit(debug::EXIT_SUCCESS);
+ }
+
+ pub struct NeverEndingFuture {}
+
+ impl Future for NeverEndingFuture {
+ type Output = ();
+
+ fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Self::Output> {
+ // Never finish
+ Poll::Pending
+ }
+ }
+}
diff --git a/examples/binds.rs b/examples/binds.rs
index 1b0c8c5b..56565cbe 100644
--- a/examples/binds.rs
+++ b/examples/binds.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -24,22 +23,21 @@ mod app {
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
rtic::pend(Interrupt::UART0);
- hprintln!("init");
+ hprintln!("init").unwrap();
(Shared {}, Local {}, init::Monotonics())
}
#[idle]
fn idle(_: idle::Context) -> ! {
- hprintln!("idle");
+ hprintln!("idle").unwrap();
rtic::pend(Interrupt::UART0);
+ debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
+
loop {
- // Exit moved after nop to ensure that rtic::pend gets
- // to run before exiting
cortex_m::asm::nop();
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
}
@@ -51,6 +49,7 @@ mod app {
"foo called {} time{}",
*cx.local.times,
if *cx.local.times > 1 { "s" } else { "" }
- );
+ )
+ .unwrap();
}
}
diff --git a/examples/cancel-reschedule.rs b/examples/cancel-reschedule.rs
index 36c496b7..a38a9c4e 100644
--- a/examples/cancel-reschedule.rs
+++ b/examples/cancel-reschedule.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -29,7 +28,7 @@ mod app {
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000);
- hprintln!("init");
+ hprintln!("init").ok();
// Schedule `foo` to run 1 second in the future
foo::spawn_after(1.secs()).unwrap();
@@ -43,7 +42,7 @@ mod app {
#[task]
fn foo(_: foo::Context) {
- hprintln!("foo");
+ hprintln!("foo").ok();
// Schedule `bar` to run 2 seconds in the future (1 second after foo runs)
let spawn_handle = baz::spawn_after(2.secs()).unwrap();
@@ -52,7 +51,7 @@ mod app {
#[task]
fn bar(_: bar::Context, baz_handle: baz::SpawnHandle, do_reschedule: bool) {
- hprintln!("bar");
+ hprintln!("bar").ok();
if do_reschedule {
// Reschedule baz 2 seconds from now, instead of the original 1 second
@@ -68,7 +67,7 @@ mod app {
#[task]
fn baz(_: baz::Context) {
- hprintln!("baz");
+ hprintln!("baz").ok();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
}
diff --git a/examples/capacity.rs b/examples/capacity.rs
index 550829be..a6172698 100644
--- a/examples/capacity.rs
+++ b/examples/capacity.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -38,12 +37,12 @@ mod app {
#[task(capacity = 4)]
fn foo(_: foo::Context, x: u32) {
- hprintln!("foo({})", x);
+ hprintln!("foo({})", x).unwrap();
}
#[task]
fn bar(_: bar::Context) {
- hprintln!("bar");
+ hprintln!("bar").unwrap();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
diff --git a/examples/cfg-whole-task.rs b/examples/cfg-whole-task.rs
index 17f31f4e..f41866db 100644
--- a/examples/cfg-whole-task.rs
+++ b/examples/cfg-whole-task.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -82,19 +81,6 @@ mod app {
// ..
}
- // The whole task should disappear,
- // currently still present in the Tasks enum
- #[cfg(never)]
- #[task(binds = UART1, shared = [count])]
- fn foo3(mut _cx: foo3::Context) {
- #[cfg(debug_assertions)]
- {
- _cx.shared.count.lock(|count| *count += 10);
-
- log::spawn(_cx.shared.count.lock(|count| *count)).unwrap();
- }
- }
-
#[cfg(debug_assertions)]
#[task(capacity = 2)]
fn log(_: log::Context, n: u32) {
@@ -102,6 +88,7 @@ mod app {
"foo has been called {} time{}",
n,
if n == 1 { "" } else { "s" }
- );
+ )
+ .ok();
}
}
diff --git a/examples/common.rs b/examples/common.rs
index 74ee8db2..1fe671e6 100644
--- a/examples/common.rs
+++ b/examples/common.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -74,7 +73,7 @@ mod app {
// This task is only spawned once in `init`, hence this task will run
// only once
- hprintln!("foo");
+ hprintln!("foo").ok();
}
// Software task, also not bound to a hardware interrupt
@@ -82,7 +81,7 @@ mod app {
// The resources `s1` and `s2` are shared between all other tasks.
#[task(shared = [s1, s2], local = [l2])]
fn bar(_: bar::Context) {
- hprintln!("bar");
+ hprintln!("bar").ok();
// Run `bar` once per second
bar::spawn_after(1.secs()).unwrap();
@@ -98,6 +97,6 @@ mod app {
// Note that RTIC does NOT clear the interrupt flag, this is up to the
// user
- hprintln!("UART0 interrupt!");
+ hprintln!("UART0 interrupt!").ok();
}
}
diff --git a/examples/complex.rs b/examples/complex.rs
index 73df025d..e5cf6dbe 100644
--- a/examples/complex.rs
+++ b/examples/complex.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -26,7 +25,7 @@ mod app {
#[init]
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- hprintln!("init");
+ hprintln!("init").unwrap();
(
Shared {
@@ -41,31 +40,31 @@ mod app {
#[idle(shared = [s2, s3])]
fn idle(mut cx: idle::Context) -> ! {
- hprintln!("idle p0 started");
+ hprintln!("idle p0 started").ok();
rtic::pend(Interrupt::GPIOC);
cx.shared.s3.lock(|s| {
- hprintln!("idle enter lock s3 {}", s);
- hprintln!("idle pend t0");
+ hprintln!("idle enter lock s3 {}", s).ok();
+ hprintln!("idle pend t0").ok();
rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 3
- hprintln!("idle pend t1");
+ hprintln!("idle pend t1").ok();
rtic::pend(Interrupt::GPIOB); // t1 p3, with shared ceiling 3
- hprintln!("idle pend t2");
+ hprintln!("idle pend t2").ok();
rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing
- hprintln!("idle still in lock s3 {}", s);
+ hprintln!("idle still in lock s3 {}", s).ok();
});
- hprintln!("\nback in idle");
+ hprintln!("\nback in idle").ok();
cx.shared.s2.lock(|s| {
- hprintln!("enter lock s2 {}", s);
- hprintln!("idle pend t0");
+ hprintln!("enter lock s2 {}", s).ok();
+ hprintln!("idle pend t0").ok();
rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 2
- hprintln!("idle pend t1");
+ hprintln!("idle pend t1").ok();
rtic::pend(Interrupt::GPIOB); // t1 p3, no sharing
- hprintln!("idle pend t2");
+ hprintln!("idle pend t2").ok();
rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing
- hprintln!("idle still in lock s2 {}", s);
+ hprintln!("idle still in lock s2 {}", s).ok();
});
- hprintln!("\nidle exit");
+ hprintln!("\nidle exit").ok();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
@@ -83,8 +82,9 @@ mod app {
"t0 p2 called {} time{}",
*cx.local.times,
if *cx.local.times > 1 { "s" } else { "" }
- );
- hprintln!("t0 p2 exit");
+ )
+ .ok();
+ hprintln!("t0 p2 exit").ok();
}
#[task(binds = GPIOB, priority = 3, local = [times: u32 = 0], shared = [s3, s4])]
@@ -96,18 +96,19 @@ mod app {
"t1 p3 called {} time{}",
*cx.local.times,
if *cx.local.times > 1 { "s" } else { "" }
- );
+ )
+ .ok();
cx.shared.s4.lock(|s| {
- hprintln!("t1 enter lock s4 {}", s);
- hprintln!("t1 pend t0");
+ hprintln!("t1 enter lock s4 {}", s).ok();
+ hprintln!("t1 pend t0").ok();
rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 2
- hprintln!("t1 pend t2");
+ hprintln!("t1 pend t2").ok();
rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing
- hprintln!("t1 still in lock s4 {}", s);
+ hprintln!("t1 still in lock s4 {}", s).ok();
});
- hprintln!("t1 p3 exit");
+ hprintln!("t1 p3 exit").ok();
}
#[task(binds = GPIOC, priority = 4, local = [times: u32 = 0], shared = [s4])]
@@ -119,12 +120,13 @@ mod app {
"t2 p4 called {} time{}",
*cx.local.times,
if *cx.local.times > 1 { "s" } else { "" }
- );
+ )
+ .unwrap();
cx.shared.s4.lock(|s| {
- hprintln!("enter lock s4 {}", s);
+ hprintln!("enter lock s4 {}", s).ok();
*s += 1;
});
- hprintln!("t3 p4 exit");
+ hprintln!("t3 p4 exit").ok();
}
}
diff --git a/examples/declared_locals.rs b/examples/declared_locals.rs
index cb621496..52d354bc 100644
--- a/examples/declared_locals.rs
+++ b/examples/declared_locals.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
diff --git a/examples/destructure.rs b/examples/destructure.rs
index 70b0dd7e..6019c225 100644
--- a/examples/destructure.rs
+++ b/examples/destructure.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -43,7 +42,7 @@ mod app {
let b = cx.shared.b;
let c = cx.shared.c;
- hprintln!("foo: a = {}, b = {}, c = {}", a, b, c);
+ hprintln!("foo: a = {}, b = {}, c = {}", a, b, c).unwrap();
}
// De-structure-ing syntax
@@ -51,6 +50,6 @@ mod app {
fn bar(cx: bar::Context) {
let bar::SharedResources { a, b, c } = cx.shared;
- hprintln!("bar: a = {}, b = {}, c = {}", a, b, c);
+ hprintln!("bar: a = {}, b = {}, c = {}", a, b, c).unwrap();
}
}
diff --git a/examples/extern_binds.rs b/examples/extern_binds.rs
index bfc85cfc..4dc6633c 100644
--- a/examples/extern_binds.rs
+++ b/examples/extern_binds.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -11,7 +10,7 @@ use panic_semihosting as _;
// Free function implementing the interrupt bound task `foo`.
fn foo(_: app::foo::Context) {
- hprintln!("foo called");
+ hprintln!("foo called").ok();
}
#[rtic::app(device = lm3s6965)]
@@ -30,22 +29,21 @@ mod app {
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
rtic::pend(Interrupt::UART0);
- hprintln!("init");
+ hprintln!("init").unwrap();
(Shared {}, Local {}, init::Monotonics())
}
#[idle]
fn idle(_: idle::Context) -> ! {
- hprintln!("idle");
+ hprintln!("idle").unwrap();
rtic::pend(Interrupt::UART0);
+ debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
+
loop {
cortex_m::asm::nop();
- // Exit moved after nop to ensure that rtic::pend gets
- // to run before exiting
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
}
diff --git a/examples/extern_spawn.rs b/examples/extern_spawn.rs
index 446d31a7..7f9b5a5f 100644
--- a/examples/extern_spawn.rs
+++ b/examples/extern_spawn.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -11,7 +10,7 @@ use panic_semihosting as _;
// Free function implementing the spawnable task `foo`.
fn foo(_c: app::foo::Context, x: i32, y: u32) {
- hprintln!("foo {}, {}", x, y);
+ hprintln!("foo {}, {}", x, y).unwrap();
if x == 2 {
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
diff --git a/examples/generics.rs b/examples/generics.rs
index bc4959fb..72b861ba 100644
--- a/examples/generics.rs
+++ b/examples/generics.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -33,22 +32,19 @@ mod app {
#[task(binds = UART0, shared = [shared], local = [state: u32 = 0])]
fn uart0(c: uart0::Context) {
- hprintln!("UART0(STATE = {})", *c.local.state);
+ hprintln!("UART0(STATE = {})", *c.local.state).unwrap();
// second argument has type `shared::shared`
super::advance(c.local.state, c.shared.shared);
rtic::pend(Interrupt::UART1);
- // Exit moved after nop to ensure that rtic::pend gets
- // to run before exiting
- cortex_m::asm::nop();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
#[task(binds = UART1, priority = 2, shared = [shared], local = [state: u32 = 0])]
fn uart1(c: uart1::Context) {
- hprintln!("UART1(STATE = {})", *c.local.state);
+ hprintln!("UART1(STATE = {})", *c.local.state).unwrap();
// second argument has type `shared::shared`
super::advance(c.local.state, c.shared.shared);
@@ -65,5 +61,5 @@ fn advance(state: &mut u32, mut shared: impl Mutex<T = u32>) {
(old, *shared)
});
- hprintln!("shared: {} -> {}", old, new);
+ hprintln!("shared: {} -> {}", old, new).unwrap();
}
diff --git a/examples/hardware.rs b/examples/hardware.rs
index a7fdb47a..60632247 100644
--- a/examples/hardware.rs
+++ b/examples/hardware.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -25,7 +24,7 @@ mod app {
// `init` returns because interrupts are disabled
rtic::pend(Interrupt::UART0); // equivalent to NVIC::pend
- hprintln!("init");
+ hprintln!("init").unwrap();
(Shared {}, Local {}, init::Monotonics())
}
@@ -34,15 +33,14 @@ mod app {
fn idle(_: idle::Context) -> ! {
// interrupts are enabled again; the `UART0` handler runs at this point
- hprintln!("idle");
+ hprintln!("idle").unwrap();
rtic::pend(Interrupt::UART0);
+ debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
+
loop {
- // Exit moved after nop to ensure that rtic::pend gets
- // to run before exiting
cortex_m::asm::nop();
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
}
@@ -55,6 +53,7 @@ mod app {
"UART0 called {} time{}",
*cx.local.times,
if *cx.local.times > 1 { "s" } else { "" }
- );
+ )
+ .unwrap();
}
}
diff --git a/examples/idle-wfi.rs b/examples/idle-wfi.rs
index 5e52620d..4a8a8dee 100644
--- a/examples/idle-wfi.rs
+++ b/examples/idle-wfi.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -20,7 +19,7 @@ mod app {
#[init]
fn init(mut cx: init::Context) -> (Shared, Local, init::Monotonics) {
- hprintln!("init");
+ hprintln!("init").unwrap();
// Set the ARM SLEEPONEXIT bit to go to sleep after handling interrupts
// See https://developer.arm.com/docs/100737/0100/power-management/sleep-mode/sleep-on-exit-bit
@@ -34,7 +33,7 @@ mod app {
// Locals in idle have lifetime 'static
let _x: &'static mut u32 = cx.local.x;
- hprintln!("idle");
+ hprintln!("idle").unwrap();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
diff --git a/examples/idle.rs b/examples/idle.rs
index ccec9bf2..55d6b153 100644
--- a/examples/idle.rs
+++ b/examples/idle.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -20,7 +19,7 @@ mod app {
#[init]
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- hprintln!("init");
+ hprintln!("init").unwrap();
(Shared {}, Local {}, init::Monotonics())
}
@@ -30,7 +29,7 @@ mod app {
// Locals in idle have lifetime 'static
let _x: &'static mut u32 = cx.local.x;
- hprintln!("idle");
+ hprintln!("idle").unwrap();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
diff --git a/examples/init.rs b/examples/init.rs
index afd3b98c..b8a5bc5b 100644
--- a/examples/init.rs
+++ b/examples/init.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -33,7 +32,7 @@ mod app {
// to indicate that this is a critical seciton
let _cs_token: bare_metal::CriticalSection = cx.cs;
- hprintln!("init");
+ hprintln!("init").unwrap();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
diff --git a/examples/locals.rs b/examples/locals.rs
index 9e112be4..aa5d0fee 100644
--- a/examples/locals.rs
+++ b/examples/locals.rs
@@ -2,8 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -18,11 +16,8 @@ mod app {
#[local]
struct Local {
- /// Local foo
local_to_foo: i64,
- /// Local bar
local_to_bar: i64,
- /// Local idle
local_to_idle: i64,
}
@@ -50,7 +45,7 @@ mod app {
let local_to_idle = cx.local.local_to_idle;
*local_to_idle += 1;
- hprintln!("idle: local_to_idle = {}", local_to_idle);
+ hprintln!("idle: local_to_idle = {}", local_to_idle).unwrap();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
@@ -74,7 +69,7 @@ mod app {
// error: no `local_to_bar` field in `foo::LocalResources`
// cx.local.local_to_bar += 1;
- hprintln!("foo: local_to_foo = {}", local_to_foo);
+ hprintln!("foo: local_to_foo = {}", local_to_foo).unwrap();
}
// `local_to_bar` can only be accessed from this context
@@ -86,6 +81,6 @@ mod app {
// error: no `local_to_foo` field in `bar::LocalResources`
// cx.local.local_to_foo += 1;
- hprintln!("bar: local_to_bar = {}", local_to_bar);
+ hprintln!("bar: local_to_bar = {}", local_to_bar).unwrap();
}
}
diff --git a/examples/lock-free.rs b/examples/lock-free.rs
index 6e5faadb..ea6ff1bf 100644
--- a/examples/lock-free.rs
+++ b/examples/lock-free.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -34,7 +33,7 @@ mod app {
*c.shared.counter += 1; // <- no lock API required
let counter = *c.shared.counter;
- hprintln!(" foo = {}", counter);
+ hprintln!(" foo = {}", counter).unwrap();
}
#[task(shared = [counter])] // <- same priority
@@ -43,7 +42,7 @@ mod app {
*c.shared.counter += 1; // <- no lock API required
let counter = *c.shared.counter;
- hprintln!(" bar = {}", counter);
+ hprintln!(" bar = {}", counter).unwrap();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
diff --git a/examples/lock.rs b/examples/lock.rs
index 5b3e0bcc..f1a16968 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();
}
}
diff --git a/examples/message.rs b/examples/message.rs
index 8a6a12d5..76c5675a 100644
--- a/examples/message.rs
+++ b/examples/message.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -27,7 +26,7 @@ mod app {
#[task(local = [count: u32 = 0])]
fn foo(cx: foo::Context) {
- hprintln!("foo");
+ hprintln!("foo").unwrap();
bar::spawn(*cx.local.count).unwrap();
*cx.local.count += 1;
@@ -35,14 +34,14 @@ mod app {
#[task]
fn bar(_: bar::Context, x: u32) {
- hprintln!("bar({})", x);
+ hprintln!("bar({})", x).unwrap();
baz::spawn(x + 1, x + 2).unwrap();
}
#[task]
fn baz(_: baz::Context, x: u32, y: u32) {
- hprintln!("baz({}, {})", x, y);
+ hprintln!("baz({}, {})", x, y).unwrap();
if x + y > 4 {
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
diff --git a/examples/message_passing.rs b/examples/message_passing.rs
index 9550a501..ffa95371 100644
--- a/examples/message_passing.rs
+++ b/examples/message_passing.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -30,7 +29,7 @@ mod app {
#[task(capacity = 3)]
fn foo(_c: foo::Context, x: i32, y: u32) {
- hprintln!("foo {}, {}", x, y);
+ hprintln!("foo {}, {}", x, y).unwrap();
if x == 2 {
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
diff --git a/examples/multilock.rs b/examples/multilock.rs
index c7085cd5..d99bae69 100644
--- a/examples/multilock.rs
+++ b/examples/multilock.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -49,7 +48,7 @@ mod app {
*s2 += 1;
*s3 += 1;
- hprintln!("Multiple locks, s1: {}, s2: {}, s3: {}", *s1, *s2, *s3);
+ hprintln!("Multiple locks, s1: {}, s2: {}, s3: {}", *s1, *s2, *s3).unwrap();
});
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
diff --git a/examples/not-sync.rs b/examples/not-sync.rs
index 68af04a6..aa79ad56 100644
--- a/examples/not-sync.rs
+++ b/examples/not-sync.rs
@@ -2,16 +2,13 @@
// #![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
use core::marker::PhantomData;
use panic_semihosting as _;
-/// Not sync
pub struct NotSync {
- /// Phantom action
_0: PhantomData<*const ()>,
}
@@ -25,7 +22,6 @@ mod app {
#[shared]
struct Shared {
- /// This resource is not Sync
shared: NotSync,
}
diff --git a/examples/only-shared-access.rs b/examples/only-shared-access.rs
index b32827ab..8b0a77ef 100644
--- a/examples/only-shared-access.rs
+++ b/examples/only-shared-access.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -31,13 +30,13 @@ mod app {
#[task(shared = [&key])]
fn foo(cx: foo::Context) {
let key: &u32 = cx.shared.key;
- hprintln!("foo(key = {:#x})", key);
+ hprintln!("foo(key = {:#x})", key).unwrap();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
#[task(priority = 2, shared = [&key])]
fn bar(cx: bar::Context) {
- hprintln!("bar(key = {:#x})", cx.shared.key);
+ hprintln!("bar(key = {:#x})", cx.shared.key).unwrap();
}
}
diff --git a/examples/periodic-at.rs b/examples/periodic-at.rs
index ad8a5496..ca68ed5e 100644
--- a/examples/periodic-at.rs
+++ b/examples/periodic-at.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -36,15 +35,15 @@ mod app {
#[task(local = [cnt: u32 = 0])]
fn foo(cx: foo::Context, instant: fugit::TimerInstantU64<100>) {
- hprintln!("foo {:?}", instant);
+ hprintln!("foo {:?}", instant).ok();
*cx.local.cnt += 1;
if *cx.local.cnt == 4 {
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
- // Periodic ever 1 seconds
- let next_instant = instant + 1.secs();
+ // Periodic every 100 milliseconds
+ let next_instant = instant + 100.millis();
foo::spawn_at(next_instant, next_instant).unwrap();
}
}
diff --git a/examples/periodic-at2.rs b/examples/periodic-at2.rs
index 4719bdb7..ec9adcc5 100644
--- a/examples/periodic-at2.rs
+++ b/examples/periodic-at2.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -29,7 +28,7 @@ mod app {
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mut mono = Systick::new(systick, 12_000_000);
- foo::spawn_after(1.secs(), mono.now()).unwrap();
+ foo::spawn_after(200.millis(), mono.now()).unwrap();
(Shared {}, Local {}, init::Monotonics(mono))
}
@@ -37,7 +36,7 @@ mod app {
// Using the explicit type of the timer implementation
#[task(local = [cnt: u32 = 0])]
fn foo(cx: foo::Context, instant: fugit::TimerInstantU64<100>) {
- hprintln!("foo {:?}", instant);
+ hprintln!("foo {:?}", instant).ok();
*cx.local.cnt += 1;
if *cx.local.cnt == 4 {
@@ -53,10 +52,10 @@ mod app {
// This remains agnostic to the timer implementation
#[task(local = [cnt: u32 = 0])]
fn bar(_cx: bar::Context, instant: <MyMono as rtic_monotonic::Monotonic>::Instant) {
- hprintln!("bar {:?}", instant);
+ hprintln!("bar {:?}", instant).ok();
- // Spawn a new message with 1s offset to spawned time
- let next_instant = instant + 1.secs();
+ // Spawn a new message with 200ms offset to spawned time
+ let next_instant = instant + 200.millis();
foo::spawn_at(next_instant, next_instant).unwrap();
}
}
diff --git a/examples/periodic.rs b/examples/periodic.rs
index 13ca7c85..2f9e8e6a 100644
--- a/examples/periodic.rs
+++ b/examples/periodic.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -29,21 +28,21 @@ mod app {
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000);
- foo::spawn_after(1.secs()).unwrap();
+ foo::spawn_after(100.millis()).unwrap();
(Shared {}, Local {}, init::Monotonics(mono))
}
#[task(local = [cnt: u32 = 0])]
fn foo(cx: foo::Context) {
- hprintln!("foo");
+ hprintln!("foo").ok();
*cx.local.cnt += 1;
if *cx.local.cnt == 4 {
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
- // Periodic ever 1 seconds
- foo::spawn_after(1.secs()).unwrap();
+ // Periodic every 100ms
+ foo::spawn_after(100.millis()).unwrap();
}
}
diff --git a/examples/peripherals-taken.rs b/examples/peripherals-taken.rs
index cc9b9a11..d542c0e6 100644
--- a/examples/peripherals-taken.rs
+++ b/examples/peripherals-taken.rs
@@ -1,7 +1,5 @@
-//! examples/peripherals-taken.rs
-#![deny(warnings)]
#![deny(unsafe_code)]
-#![deny(missing_docs)]
+#![deny(warnings)]
#![no_main]
#![no_std]
diff --git a/examples/pool.rs b/examples/pool.rs
index 4c551bef..5aadd24c 100644
--- a/examples/pool.rs
+++ b/examples/pool.rs
@@ -2,8 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-// pool!() generates a struct without docs
-//#![deny(missing_docs)]
#![no_main]
#![no_std]
diff --git a/examples/preempt.rs b/examples/preempt.rs
index 3c7f2429..d0c8cc7d 100644
--- a/examples/preempt.rs
+++ b/examples/preempt.rs
@@ -25,21 +25,21 @@ mod app {
#[task(priority = 1)]
fn foo(_: foo::Context) {
- hprintln!("foo - start");
+ hprintln!("foo - start").unwrap();
baz::spawn().unwrap();
- hprintln!("foo - end");
+ hprintln!("foo - end").unwrap();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
#[task(priority = 2)]
fn bar(_: bar::Context) {
- hprintln!(" bar");
+ hprintln!(" bar").unwrap();
}
#[task(priority = 2)]
fn baz(_: baz::Context) {
- hprintln!(" baz - start");
+ hprintln!(" baz - start").unwrap();
bar::spawn().unwrap();
- hprintln!(" baz - end");
+ hprintln!(" baz - end").unwrap();
}
}
diff --git a/examples/ramfunc.rs b/examples/ramfunc.rs
index 956a2554..b3b8012c 100644
--- a/examples/ramfunc.rs
+++ b/examples/ramfunc.rs
@@ -1,7 +1,6 @@
//! examples/ramfunc.rs
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -34,7 +33,7 @@ mod app {
#[inline(never)]
#[task]
fn foo(_: foo::Context) {
- hprintln!("foo");
+ hprintln!("foo").unwrap();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
diff --git a/examples/resource-user-struct.rs b/examples/resource-user-struct.rs
index 37a88560..ae1918d0 100644
--- a/examples/resource-user-struct.rs
+++ b/examples/resource-user-struct.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -56,7 +55,7 @@ mod app {
*shared
});
- hprintln!("UART0: shared = {}", shared);
+ hprintln!("UART0: shared = {}", shared).unwrap();
}
// `shared` can be accessed from this context
@@ -67,6 +66,6 @@ mod app {
*shared
});
- hprintln!("UART1: shared = {}", shared);
+ hprintln!("UART1: shared = {}", shared).unwrap();
}
}
diff --git a/examples/schedule.rs b/examples/schedule.rs
index 9b86929d..5bad5a30 100644
--- a/examples/schedule.rs
+++ b/examples/schedule.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -29,7 +28,7 @@ mod app {
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000);
- hprintln!("init");
+ hprintln!("init").ok();
// Schedule `foo` to run 1 second in the future
foo::spawn_after(1.secs()).unwrap();
@@ -43,7 +42,7 @@ mod app {
#[task]
fn foo(_: foo::Context) {
- hprintln!("foo");
+ hprintln!("foo").ok();
// Schedule `bar` to run 2 seconds in the future (1 second after foo runs)
bar::spawn_after(1.secs()).unwrap();
@@ -51,7 +50,7 @@ mod app {
#[task]
fn bar(_: bar::Context) {
- hprintln!("bar");
+ hprintln!("bar").ok();
// Schedule `baz` to run 1 seconds from now, but with a specific time instant.
baz::spawn_at(monotonics::now() + 1.secs()).unwrap();
@@ -59,7 +58,7 @@ mod app {
#[task]
fn baz(_: baz::Context) {
- hprintln!("baz");
+ hprintln!("baz").ok();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
}
diff --git a/examples/shared.rs b/examples/shared.rs
index b43a19a3..d87dca52 100644
--- a/examples/shared.rs
+++ b/examples/shared.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -16,9 +15,7 @@ mod app {
#[shared]
struct Shared {
- /// Producer
p: Producer<'static, u32, 5>,
- /// Consumer
c: Consumer<'static, u32, 5>,
}
@@ -37,7 +34,7 @@ mod app {
fn idle(mut c: idle::Context) -> ! {
loop {
if let Some(byte) = c.shared.c.lock(|c| c.dequeue()) {
- hprintln!("received message: {}", byte);
+ hprintln!("received message: {}", byte).unwrap();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
} else {
diff --git a/examples/spawn.rs b/examples/spawn.rs
index 50ae7e7a..2db1ab8a 100644
--- a/examples/spawn.rs
+++ b/examples/spawn.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -20,7 +19,7 @@ mod app {
#[init]
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- hprintln!("init");
+ hprintln!("init").unwrap();
foo::spawn().unwrap();
(Shared {}, Local {}, init::Monotonics())
@@ -28,7 +27,7 @@ mod app {
#[task]
fn foo(_: foo::Context) {
- hprintln!("foo");
+ hprintln!("foo").unwrap();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
diff --git a/examples/static.rs b/examples/static.rs
index efafcc7a..c9aa6046 100644
--- a/examples/static.rs
+++ b/examples/static.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -38,7 +37,7 @@ mod app {
loop {
// Lock-free access to the same underlying queue!
if let Some(data) = c.local.c.dequeue() {
- hprintln!("received message: {}", data);
+ hprintln!("received message: {}", data).unwrap();
// Run foo until data
if data == 3 {
diff --git a/examples/t-binds.rs b/examples/t-binds.rs
index 822a2eea..12479c0a 100644
--- a/examples/t-binds.rs
+++ b/examples/t-binds.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
diff --git a/examples/t-htask-main.rs b/examples/t-htask-main.rs
index 2b17b2ee..37189faf 100644
--- a/examples/t-htask-main.rs
+++ b/examples/t-htask-main.rs
@@ -1,7 +1,5 @@
-//! examples/t-htask-main.rs
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
diff --git a/examples/t-idle-main.rs b/examples/t-idle-main.rs
index 48635b2a..1adc9bf0 100644
--- a/examples/t-idle-main.rs
+++ b/examples/t-idle-main.rs
@@ -1,7 +1,5 @@
-//! examples/t-idle-main.rs
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
diff --git a/examples/t-schedule.rs b/examples/t-schedule.rs
index f3979dd6..5ec42087 100644
--- a/examples/t-schedule.rs
+++ b/examples/t-schedule.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
diff --git a/examples/t-spawn.rs b/examples/t-spawn.rs
index 7483a849..2bd771d7 100644
--- a/examples/t-spawn.rs
+++ b/examples/t-spawn.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
diff --git a/examples/task.rs b/examples/task.rs
index 9757f2f5..2c53aa23 100644
--- a/examples/task.rs
+++ b/examples/task.rs
@@ -2,7 +2,6 @@
#![deny(unsafe_code)]
#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
@@ -27,31 +26,31 @@ mod app {
#[task]
fn foo(_: foo::Context) {
- hprintln!("foo - start");
+ hprintln!("foo - start").unwrap();
// spawns `bar` onto the task scheduler
// `foo` and `bar` have the same priority so `bar` will not run until
// after `foo` terminates
bar::spawn().unwrap();
- hprintln!("foo - middle");
+ hprintln!("foo - middle").unwrap();
// spawns `baz` onto the task scheduler
// `baz` has higher priority than `foo` so it immediately preempts `foo`
baz::spawn().unwrap();
- hprintln!("foo - end");
+ hprintln!("foo - end").unwrap();
}
#[task]
fn bar(_: bar::Context) {
- hprintln!("bar");
+ hprintln!("bar").unwrap();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}
#[task(priority = 2)]
fn baz(_: baz::Context) {
- hprintln!("baz");
+ hprintln!("baz").unwrap();
}
}