aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp/src/reset.rs
blob: 4b9e42483ddb6aa6c2bfae2db7e75cdbf8f7aeca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pub use pac::resets::regs::Peripherals;

use crate::pac;

pub const ALL_PERIPHERALS: Peripherals = Peripherals(0x01ff_ffff);

pub(crate) fn reset(peris: Peripherals) {
    pac::RESETS.reset().write_value(peris);
}

pub(crate) 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 {}
}