aboutsummaryrefslogtreecommitdiff
path: root/examples/capacity.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/capacity.rs')
-rw-r--r--examples/capacity.rs40
1 files changed, 21 insertions, 19 deletions
diff --git a/examples/capacity.rs b/examples/capacity.rs
index a7132ba0..ba8b15b0 100644
--- a/examples/capacity.rs
+++ b/examples/capacity.rs
@@ -5,43 +5,45 @@
#![no_main]
#![no_std]
-extern crate panic_semihosting;
-
use cortex_m_semihosting::{debug, hprintln};
use lm3s6965::Interrupt;
-use rtfm::app;
+use panic_semihosting as _;
-#[app(device = lm3s6965)]
-const APP: () = {
+#[rtic::app(device = lm3s6965)]
+mod app {
#[init]
- fn init() {
- rtfm::pend(Interrupt::UART0);
+ fn init(_: init::Context) -> init::LateResources {
+ rtic::pend(Interrupt::UART0);
+
+ init::LateResources {}
}
- #[interrupt(spawn = [foo, bar])]
- fn UART0() {
- spawn.foo(0).unwrap();
- spawn.foo(1).unwrap();
- spawn.foo(2).unwrap();
- spawn.foo(3).unwrap();
+ #[task(binds = UART0, spawn = [foo, bar])]
+ fn uart0(c: uart0::Context) {
+ c.spawn.foo(0).unwrap();
+ c.spawn.foo(1).unwrap();
+ c.spawn.foo(2).unwrap();
+ c.spawn.foo(3).unwrap();
- spawn.bar().unwrap();
+ c.spawn.bar().unwrap();
}
#[task(capacity = 4)]
- fn foo(x: u32) {
+ fn foo(_: foo::Context, x: u32) {
hprintln!("foo({})", x).unwrap();
}
#[task]
- fn bar() {
+ fn bar(_: bar::Context) {
hprintln!("bar").unwrap();
debug::exit(debug::EXIT_SUCCESS);
}
- // Interrupt handlers used to dispatch software tasks
+ // RTIC requires that unused interrupts are declared in an extern block when
+ // using software tasks; these free interrupts will be used to dispatch the
+ // software tasks.
extern "C" {
- fn UART1();
+ fn SSI0();
}
-};
+}