on second thought: keep BOD33 disabled in sleep mode

This commit is contained in:
Joey Castillo 2022-02-13 16:04:21 -05:00
parent b91f025542
commit c7f6387aee

View File

@ -155,10 +155,8 @@ void watch_enter_sleep_mode(void) {
// disable tick interrupt // disable tick interrupt
watch_rtc_disable_all_periodic_callbacks(); watch_rtc_disable_all_periodic_callbacks();
// set brownout detector to check voltage once an hour (64 minutes). // disable brownout detector interrupt, which could inadvertently wake us up.
// in sleep, we're not worried about the LED causing a voltage drop and a brownout. SUPC->INTENCLR.bit.BOD33DET = 1;
// changes to voltage will take place slowly over months, not quickly over seconds.
SUPC->BOD33.bit.PSEL = 0xF;
// disable all pins // disable all pins
_watch_disable_all_pins_except_rtc(); _watch_disable_all_pins_except_rtc();
@ -166,8 +164,8 @@ void watch_enter_sleep_mode(void) {
// enter standby (4); we basically hang out here until an interrupt wakes us. // enter standby (4); we basically hang out here until an interrupt wakes us.
sleep(4); sleep(4);
// and we awake! speed the brownout detector back up to 1 check per second. // and we awake! re-enable the brownout detector
SUPC->BOD33.bit.PSEL = 0x9; SUPC->INTENSET.bit.BOD33DET = 1;
// call app_setup so the app can re-enable everything we disabled. // call app_setup so the app can re-enable everything we disabled.
app_setup(); app_setup();