Merge pull request #227 from bjoernQ/fix/multicore-example
Fix multicore example
This commit is contained in:
commit
6d769ab274
@ -69,6 +69,9 @@ fn cpu1_task(
|
||||
loop {
|
||||
block!(timer.wait()).unwrap();
|
||||
|
||||
critical_section::with(|cs| counter.borrow_ref_mut(cs).wrapping_add(1));
|
||||
critical_section::with(|cs| {
|
||||
let new_val = counter.borrow_ref_mut(cs).wrapping_add(1);
|
||||
*counter.borrow_ref_mut(cs) = new_val;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,8 @@ fn main() -> ! {
|
||||
|
||||
let mut adc1_config = AdcConfig::new();
|
||||
|
||||
let mut pin3 = adc1_config.enable_pin(io.pins.gpio3.into_analog(), Attenuation::Attenuation11dB);
|
||||
let mut pin3 =
|
||||
adc1_config.enable_pin(io.pins.gpio3.into_analog(), Attenuation::Attenuation11dB);
|
||||
|
||||
let mut adc1 = ADC::<ADC1>::adc(analog.adc1, adc1_config).unwrap();
|
||||
|
||||
|
||||
@ -69,6 +69,9 @@ fn cpu1_task(
|
||||
loop {
|
||||
block!(timer.wait()).unwrap();
|
||||
|
||||
critical_section::with(|cs| counter.borrow_ref_mut(cs).wrapping_add(1));
|
||||
critical_section::with(|cs| {
|
||||
let new_val = counter.borrow_ref_mut(cs).wrapping_add(1);
|
||||
*counter.borrow_ref_mut(cs) = new_val;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user