diff options
author | 2019-09-25 19:26:37 +0200 | |
---|---|---|
committer | 2019-09-25 19:26:37 +0200 | |
commit | eb90e7bb64fc8ed61523818261ed87a0a2f159b3 (patch) | |
tree | 9cd4c48202a71bfa65741a437657f9c28aa5d9cb | |
parent | c029601b7c55a64af6af8c544ddcffabc55a7f1d (diff) | |
download | rtic-generators.tar.gz rtic-generators.tar.zst rtic-generators.zip |
wip, gen_ok, handwritten POCgenerators
-rw-r--r-- | examples/gen_ok.rs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/examples/gen_ok.rs b/examples/gen_ok.rs index 076bb815..8693e19c 100644 --- a/examples/gen_ok.rs +++ b/examples/gen_ok.rs @@ -72,6 +72,7 @@ fn init(_: init::Context) { // hprintln!("{}", ctx.resources.shared2.lock(|v| *v)).unwrap(); ::cortex_m_semihosting::export::hstdout_str("init\n").unwrap(); + // rtfm::pend(Interrupt::GPIOA); } #[allow(non_snake_case)] @@ -90,27 +91,33 @@ static mut GENERATOR_FOO1: core::mem::MaybeUninit<Generatorfoo1> = core::mem::MaybeUninit::uninit(); #[allow(non_snake_case)] fn foo1(mut ctx: foo1::Context) -> Generatorfoo1 { - use rtfm::Mutex as _; - // ctx.resources.shared2.lock(|v| *v); move || loop { ctx.resources.shared2.lock(|v| { *v += 1; - hprintln!("{}", v) + hprintln!("foo1_1 lock {}", v); + rtfm::pend(Interrupt::GPIOB); + hprintln!("foo1_1 unloclock {}", v); + }); + ctx.resources.shared2.lock(|v| { + *v += 1; + hprintln!("foo1_1 {}", v); }); - ::cortex_m_semihosting::export::hstdout_str("foo1_1\n").unwrap(); + yield; ctx.resources.shared2.lock(|v| { *v += 1; - hprintln!("{}", v) + hprintln!("foo1_2 {}", v); }); - ::cortex_m_semihosting::export::hstdout_str("foo1_2\n").unwrap(); yield; } } #[allow(non_snake_case)] fn foo2(mut ctx: foo2::Context) { use rtfm::Mutex as _; - ctx.resources.shared2.lock(|v| *v += 1); + ctx.resources.shared2.lock(|v| { + *v += 1; + hprintln!("foo2 {}", v); + }); } #[allow(non_snake_case)] fn foo3(mut ctx: foo3::Context) { |