add edge detecting inputs for volume and brightness settings

This commit is contained in:
sigil-03 2025-10-26 17:26:34 -06:00
parent 144d24cf59
commit 9f12502a3d
2 changed files with 62 additions and 32 deletions

View file

@ -105,7 +105,7 @@ pub fn clear_interrupt(coin_pin: u8, button_pin: u8) -> crate::InputFlags {
/// * (probably WFI?)
/// exit:
/// 1. any interrupt/event (set in external interrupt register)
pub unsafe fn enter_standby(pin: usize) {
pub unsafe fn enter_standby() {
critical_section::with(|_| {
use hal::pac::Interrupt;
use qingke_rt::CoreInterrupt;
@ -124,10 +124,7 @@ pub unsafe fn enter_standby(pin: usize) {
// 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();
}
let mut val: u32 = unsafe { (reg as *mut u32).read_volatile() };
// modify PDDS
val |= 1 << 1; // PWR_CTLR[1] -> PDDS
unsafe {