mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-16 21:05:35 +01:00
drop the Static wrapper
This commit is contained in:
parent
0f5784c240
commit
219e172680
8 changed files with 28 additions and 26 deletions
|
|
@ -63,22 +63,22 @@ mod main {
|
|||
*r.OWNED != *r.OWNED;
|
||||
|
||||
if *r.OWNED {
|
||||
if r.SHARED.claim(t, |shared, _| **shared) {
|
||||
if r.SHARED.claim(t, |shared, _| *shared) {
|
||||
rtfm::wfi();
|
||||
}
|
||||
} else {
|
||||
r.SHARED.claim_mut(t, |shared, _| **shared = !**shared);
|
||||
r.SHARED.claim_mut(t, |shared, _| *shared = !*shared);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) {
|
||||
**r.ON = !**r.ON;
|
||||
*r.ON = !*r.ON;
|
||||
|
||||
**r.CO_OWNED += 1;
|
||||
*r.CO_OWNED += 1;
|
||||
}
|
||||
|
||||
fn tim2(_t: &mut Threshold, r: TIM2::Resources) {
|
||||
**r.CO_OWNED += 1;
|
||||
*r.CO_OWNED += 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,9 +79,9 @@ fn idle() -> ! {
|
|||
#[allow(unsafe_code)]
|
||||
fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) {
|
||||
// toggle state
|
||||
**r.ON = !**r.ON;
|
||||
*r.ON = !*r.ON;
|
||||
|
||||
if **r.ON {
|
||||
if *r.ON {
|
||||
// set the pin PC13 high
|
||||
// NOTE(unsafe) atomic write to a stateless register
|
||||
unsafe {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) {
|
|||
|
||||
// This task can't be preempted by `tim2` so it has direct access to the
|
||||
// resource data
|
||||
**r.COUNTER += 1;
|
||||
*r.COUNTER += 1;
|
||||
|
||||
// ..
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ fn tim2(t: &mut Threshold, mut r: TIM2::Resources) {
|
|||
// lead to undefined behavior.
|
||||
r.COUNTER.claim_mut(t, |counter, _t| {
|
||||
// `claim_mut` creates a critical section
|
||||
**counter += 1;
|
||||
*counter += 1;
|
||||
});
|
||||
|
||||
// ..
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ fn idle() -> ! {
|
|||
fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) {
|
||||
// ..
|
||||
|
||||
**r.COUNTER += 1;
|
||||
*r.COUNTER += 1;
|
||||
|
||||
// ..
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) {
|
|||
fn tim2(_t: &mut Threshold, r: TIM2::Resources) {
|
||||
// ..
|
||||
|
||||
**r.COUNTER += 1;
|
||||
*r.COUNTER += 1;
|
||||
|
||||
// ..
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue