diff options
author | 2017-07-27 11:40:15 -0500 | |
---|---|---|
committer | 2017-07-27 11:40:15 -0500 | |
commit | aa2249454975a203e459597005944f5370c1d200 (patch) | |
tree | b6cf75b34302cf7681712c82bffa2841631ef998 /examples/full-syntax.rs | |
parent | 0b5afce771cb9e5cc42c4fd4c5e18f020bf1ecad (diff) | |
download | rtic-aa2249454975a203e459597005944f5370c1d200.tar.gz rtic-aa2249454975a203e459597005944f5370c1d200.tar.zst rtic-aa2249454975a203e459597005944f5370c1d200.zip |
update tests and examples
with task! gone 3 types of errors / gotchas have been eliminated :tada:
Diffstat (limited to 'examples/full-syntax.rs')
-rw-r--r-- | examples/full-syntax.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/examples/full-syntax.rs b/examples/full-syntax.rs index 6965a63b..918a2e67 100644 --- a/examples/full-syntax.rs +++ b/examples/full-syntax.rs @@ -5,7 +5,6 @@ #![feature(proc_macro)] #![no_std] -#[macro_use(task)] extern crate cortex_m_rtfm as rtfm; extern crate stm32f103xx; @@ -16,6 +15,7 @@ app! { resources: { static CO_OWNED: u32 = 0; + static ON: bool = false; static OWNED: bool = false; static SHARED: bool = false; }, @@ -31,12 +31,14 @@ app! { tasks: { SYS_TICK: { + path: sys_tick, priority: 1, - resources: [CO_OWNED, SHARED], + resources: [CO_OWNED, ON, SHARED], }, TIM2: { enabled: true, + path: tim2, priority: 1, resources: [CO_OWNED], }, @@ -59,18 +61,12 @@ fn idle_(t: &mut Threshold, mut r: idle::Resources) -> ! { } } -task!(SYS_TICK, sys_tick, Local { - static STATE: bool = true; -}); - -fn sys_tick(_t: &mut Threshold, l: &mut Local, r: SYS_TICK::Resources) { - *l.STATE = !*l.STATE; +fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) { + **r.ON = !**r.ON; **r.CO_OWNED += 1; } -task!(TIM2, tim2); - fn tim2(_t: &mut Threshold, r: TIM2::Resources) { **r.CO_OWNED += 1; } |