aboutsummaryrefslogtreecommitdiff
path: root/examples/periodic.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/periodic.rs')
-rw-r--r--examples/periodic.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/examples/periodic.rs b/examples/periodic.rs
index f7841183..ec110e11 100644
--- a/examples/periodic.rs
+++ b/examples/periodic.rs
@@ -5,27 +5,26 @@
#![no_main]
#![no_std]
-extern crate panic_semihosting;
-
use cortex_m_semihosting::hprintln;
-use rtfm::Instant;
+use panic_semihosting as _;
+use rtfm::cyccnt::{Instant, U32Ext};
const PERIOD: u32 = 8_000_000;
// NOTE: does NOT work on QEMU!
-#[rtfm::app(device = lm3s6965)]
+#[rtfm::app(device = lm3s6965, monotonic = rtfm::cyccnt::CYCCNT)]
const APP: () = {
#[init(schedule = [foo])]
- fn init(c: init::Context) {
- c.schedule.foo(Instant::now() + PERIOD.cycles()).unwrap();
+ fn init(cx: init::Context) {
+ cx.schedule.foo(Instant::now() + PERIOD.cycles()).unwrap();
}
#[task(schedule = [foo])]
- fn foo(c: foo::Context) {
+ fn foo(cx: foo::Context) {
let now = Instant::now();
- hprintln!("foo(scheduled = {:?}, now = {:?})", c.scheduled, now).unwrap();
+ hprintln!("foo(scheduled = {:?}, now = {:?})", cx.scheduled, now).unwrap();
- c.schedule.foo(c.scheduled + PERIOD.cycles()).unwrap();
+ cx.schedule.foo(cx.scheduled + PERIOD.cycles()).unwrap();
}
extern "C" {