deep sleep with PDDS is working
This commit is contained in:
parent
1a420018d1
commit
885c7746b3
1 changed files with 11 additions and 2 deletions
|
|
@ -109,6 +109,15 @@ unsafe fn enter_standby(pin: usize) {
|
||||||
w.set_sleeponexit(false);
|
w.set_sleeponexit(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// set PDDS=1:
|
||||||
|
// get current value of PWR_CTLR
|
||||||
|
let mut reg: u32 = 0x4000_7000;
|
||||||
|
let mut val: u32 = 0;
|
||||||
|
unsafe { val = (reg as *mut u32).read_volatile(); }
|
||||||
|
// modify PDDS
|
||||||
|
val |= 1 << 1; // PWR_CTLR[1] -> PDDS
|
||||||
|
unsafe { (reg as *mut u32).write_volatile(val); }
|
||||||
|
|
||||||
// // disable all exti interrupts
|
// // disable all exti interrupts
|
||||||
let exti = &hal::pac::EXTI;
|
let exti = &hal::pac::EXTI;
|
||||||
// exti.intenr().write(| w| {
|
// exti.intenr().write(| w| {
|
||||||
|
|
@ -144,8 +153,8 @@ unsafe fn enter_standby(pin: usize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn init_gpio_irq(pin: u8, port: u8, rising: bool, falling: bool) {
|
unsafe fn init_gpio_irq(pin: u8, port: u8, rising: bool, falling: bool) {
|
||||||
critical_section::with(|_| {
|
critical_section::with(|_| {
|
||||||
#[cfg(features="enable_print")]
|
#[cfg(feature="enable_print")]
|
||||||
println!("init_gpio_irq");
|
println!("init_gpio_irq");
|
||||||
let exti = &hal::pac::EXTI;
|
let exti = &hal::pac::EXTI;
|
||||||
let afio = &hal::pac::AFIO;
|
let afio = &hal::pac::AFIO;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue