aboutsummaryrefslogtreecommitdiff
path: root/examples/one-task.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/one-task.rs')
-rw-r--r--examples/one-task.rs19
1 files changed, 5 insertions, 14 deletions
diff --git a/examples/one-task.rs b/examples/one-task.rs
index 556177d0..e58d9fcd 100644
--- a/examples/one-task.rs
+++ b/examples/one-task.rs
@@ -1,6 +1,5 @@
//! An application with one task
#![deny(unsafe_code)]
-#![feature(const_fn)]
#![feature(proc_macro)]
#![no_std]
@@ -34,17 +33,6 @@ app! {
// Path to the task handler
path: sys_tick,
- // This is the priority of the task.
- //
- // 1 is the lowest priority a task can have, and the maximum
- // priority is determined by the number of priority bits the device
- // has. `stm32f103xx` has 4 priority bits so 16 is the maximum valid
- // value.
- //
- // You can omit this field. If you do the priority is assumed to be
- // 1.
- priority: 1,
-
// These are the resources this task has access to.
//
// A resource can be a peripheral like `GPIOC` or a static variable
@@ -54,7 +42,10 @@ app! {
}
}
-fn init(p: init::Peripherals, _r: init::Resources) {
+fn init(p: init::Peripherals, r: init::Resources) {
+ // `init` can modify all the `resources` declared in `app!`
+ r.ON;
+
// power on GPIOC
p.RCC.apb2enr.modify(|_, w| w.iopcen().enabled());
@@ -81,7 +72,7 @@ fn idle() -> ! {
//
// `_t` is the preemption threshold token. We won't use it in this program.
//
-// `r` is the set of resources this task has access to. `TIMER0_A1::Resources`
+// `r` is the set of resources this task has access to. `SYS_TICK::Resources`
// has one field per resource declared in `app!`.
fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) {
// toggle state