enable high-efficiency low power regulator

This commit is contained in:
Joey Castillo
2022-02-13 14:15:00 -05:00
parent 203850104d
commit b91f025542
3 changed files with 26 additions and 6 deletions

View File

@@ -27,7 +27,13 @@
// receives interrupts from MCLK, OSC32KCTRL, OSCCTRL, PAC, PM, SUPC and TAL, whatever that is.
void SYSTEM_Handler(void) {
if (SUPC->INTFLAG.bit.BOD33DET) {
// Our system voltage has dipped below 2.6V!
// Set the voltage regulator to work at low system voltage before we hit 2.5 V
// This voltage regulator can carry us down to 1.62 volts as the battery drains.
SUPC->VREG.bit.LPEFF = 0;
// clear the interrupt condition
SUPC->INTENCLR.bit.BOD33DET = 1;
// and disable the brownout detector (TODO: add a second, "power critical" brownout condition?)
SUPC->INTFLAG.reg &= ~SUPC_INTFLAG_BOD33DET;
}
}