This PR replaces an interruption-free section inside Peripherals::take() with more generic critical section using critical_section crate.
Critical sections implemented with just disabling interrupts are unsound on multicore environments, because other core can still modify data.
critical_section crate can mitigate this problem because it can be implemented in multicore-safe way, as in rp2040-hal.
Also, it improves compatibility with newer, unreleased version of cortex-m which has different signature of interrupt::free.
This PR replaces an interruption-free section inside
Peripherals::take()
with more generic critical section usingcritical_section
crate.Critical sections implemented with just disabling interrupts are unsound on multicore environments, because other core can still modify data.
critical_section
crate can mitigate this problem because it can be implemented in multicore-safe way, as inrp2040-hal
.Also, it improves compatibility with newer, unreleased version of
cortex-m
which has different signature ofinterrupt::free
.