From e85d6e53c89cd1ea1da8826778c5a74154fb651d Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 27 Jul 2017 22:40:47 -0500 Subject: update examples --- src/examples/_2_two_tasks.rs | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'src/examples/_2_two_tasks.rs') diff --git a/src/examples/_2_two_tasks.rs b/src/examples/_2_two_tasks.rs index 9eb61b1..451293c 100644 --- a/src/examples/_2_two_tasks.rs +++ b/src/examples/_2_two_tasks.rs @@ -1,4 +1,4 @@ -//! Two tasks running at the same priority with access to the same resource +//! Two tasks running at the *same* priority with access to the same resource //! //! ``` //! @@ -7,7 +7,6 @@ //! #![feature(proc_macro)] //! #![no_std] //! -//! #[macro_use(task)] //! extern crate cortex_m_rtfm as rtfm; //! extern crate stm32f103xx; //! @@ -16,33 +15,25 @@ //! app! { //! device: stm32f103xx, //! -//! // Resources that are plain data, not peripherals //! resources: { -//! // Declaration of resources looks like the declaration of `static` -//! // variables //! static COUNTER: u64 = 0; //! }, //! +//! // Both SYS_TICK and TIM2 have access to the `COUNTER` data //! tasks: { //! SYS_TICK: { -//! priority: 1, -//! // Both this task and TIM2 have access to the `COUNTER` resource +//! path: sys_tick, //! resources: [COUNTER], //! }, //! -//! // An interrupt as a task //! TIM2: { -//! // For interrupts the `enabled` field must be specified. It -//! // indicates if the interrupt will be enabled or disabled once -//! // `idle` starts -//! enabled: true, -//! priority: 1, +//! path: tim2, //! resources: [COUNTER], //! }, //! }, //! } //! -//! // when data resources are declared in the top `resources` field, `init` will +//! // When data resources are declared in the top `resources` field, `init` will //! // have full access to them //! fn init(_p: init::Peripherals, _r: init::Resources) { //! // .. @@ -54,8 +45,6 @@ //! } //! } //! -//! task!(SYS_TICK, sys_tick); -//! //! // As both tasks are running at the same priority one can't preempt the other. //! // Thus both tasks have direct access to the resource //! fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) { @@ -66,8 +55,6 @@ //! // .. //! } //! -//! task!(TIM2, tim2); -//! //! fn tim2(_t: &mut Threshold, r: TIM2::Resources) { //! // .. //! -- cgit v1.2.3