mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 23:02:30 +00:00
16 lines
454 B
Rust
16 lines
454 B
Rust
pub use pac::resets::regs::Peripherals;
|
|
|
|
use crate::pac;
|
|
|
|
pub const ALL_PERIPHERALS: Peripherals = Peripherals(0x01ffffff);
|
|
|
|
pub unsafe fn reset(peris: Peripherals) {
|
|
pac::RESETS.reset().write_value(peris);
|
|
}
|
|
|
|
pub unsafe fn unreset_wait(peris: Peripherals) {
|
|
// TODO use the "atomic clear" register version
|
|
pac::RESETS.reset().modify(|v| *v = Peripherals(v.0 & !peris.0));
|
|
while ((!pac::RESETS.reset_done().read().0) & peris.0) != 0 {}
|
|
}
|