mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
wip, gen_ok, handwritten POC
This commit is contained in:
parent
c029601b7c
commit
eb90e7bb64
1 changed files with 14 additions and 7 deletions
|
@ -72,6 +72,7 @@ fn init(_: init::Context) {
|
||||||
// hprintln!("{}", ctx.resources.shared2.lock(|v| *v)).unwrap();
|
// hprintln!("{}", ctx.resources.shared2.lock(|v| *v)).unwrap();
|
||||||
|
|
||||||
::cortex_m_semihosting::export::hstdout_str("init\n").unwrap();
|
::cortex_m_semihosting::export::hstdout_str("init\n").unwrap();
|
||||||
|
//
|
||||||
rtfm::pend(Interrupt::GPIOA);
|
rtfm::pend(Interrupt::GPIOA);
|
||||||
}
|
}
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
@ -90,27 +91,33 @@ static mut GENERATOR_FOO1: core::mem::MaybeUninit<Generatorfoo1> =
|
||||||
core::mem::MaybeUninit::uninit();
|
core::mem::MaybeUninit::uninit();
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn foo1(mut ctx: foo1::Context) -> Generatorfoo1 {
|
fn foo1(mut ctx: foo1::Context) -> Generatorfoo1 {
|
||||||
use rtfm::Mutex as _;
|
|
||||||
// ctx.resources.shared2.lock(|v| *v);
|
|
||||||
move || loop {
|
move || loop {
|
||||||
ctx.resources.shared2.lock(|v| {
|
ctx.resources.shared2.lock(|v| {
|
||||||
*v += 1;
|
*v += 1;
|
||||||
hprintln!("{}", v)
|
hprintln!("foo1_1 lock {}", v);
|
||||||
|
rtfm::pend(Interrupt::GPIOB);
|
||||||
|
hprintln!("foo1_1 unloclock {}", v);
|
||||||
});
|
});
|
||||||
::cortex_m_semihosting::export::hstdout_str("foo1_1\n").unwrap();
|
ctx.resources.shared2.lock(|v| {
|
||||||
|
*v += 1;
|
||||||
|
hprintln!("foo1_1 {}", v);
|
||||||
|
});
|
||||||
|
|
||||||
yield;
|
yield;
|
||||||
ctx.resources.shared2.lock(|v| {
|
ctx.resources.shared2.lock(|v| {
|
||||||
*v += 1;
|
*v += 1;
|
||||||
hprintln!("{}", v)
|
hprintln!("foo1_2 {}", v);
|
||||||
});
|
});
|
||||||
::cortex_m_semihosting::export::hstdout_str("foo1_2\n").unwrap();
|
|
||||||
yield;
|
yield;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn foo2(mut ctx: foo2::Context) {
|
fn foo2(mut ctx: foo2::Context) {
|
||||||
use rtfm::Mutex as _;
|
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)]
|
#[allow(non_snake_case)]
|
||||||
fn foo3(mut ctx: foo3::Context) {
|
fn foo3(mut ctx: foo3::Context) {
|
||||||
|
|
Loading…
Reference in a new issue