diff options
author | Joey Castillo <jose.castillo@gmail.com> | 2021-09-18 12:57:21 -0400 |
---|---|---|
committer | Joey Castillo <jose.castillo@gmail.com> | 2021-09-18 14:50:20 -0400 |
commit | 5ff4a88374986f3e74dd17f2c17b8532c88debb1 (patch) | |
tree | 9fe6ce15403b5c53b1c7b3605067628799681b0a /watch-library/watch/watch_private.c | |
parent | d97e74058f8b6a1c69d1da1c08176cb52ab2db24 (diff) | |
download | Sensor-Watch-5ff4a88374986f3e74dd17f2c17b8532c88debb1.tar.gz Sensor-Watch-5ff4a88374986f3e74dd17f2c17b8532c88debb1.tar.bz2 Sensor-Watch-5ff4a88374986f3e74dd17f2c17b8532c88debb1.zip |
add a new deep sleep mode alongside backup mode
Diffstat (limited to 'watch-library/watch/watch_private.c')
-rw-r--r-- | watch-library/watch/watch_private.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/watch-library/watch/watch_private.c b/watch-library/watch/watch_private.c index 9eb39324..d3da5426 100644 --- a/watch-library/watch/watch_private.c +++ b/watch-library/watch/watch_private.c @@ -28,6 +28,9 @@ void _watch_init() { // disable the LED pin (it may have been enabled by the bootloader) watch_disable_digital_output(RED); + // RAM should be back-biased in STANDBY + PM->STDBYCFG.bit.BBIASHS = 1; + // Use switching regulator for lower power consumption. SUPC->VREG.bit.SEL = 1; while(!SUPC->STATUS.bit.VREGRDY); @@ -41,10 +44,9 @@ void _watch_init() { SUPC->BOD33.bit.ACTCFG = 1; // Enable sampling mode when active SUPC->BOD33.bit.RUNSTDBY = 1; // Enable sampling mode in standby SUPC->BOD33.bit.STDBYCFG = 1; // Run in standby - SUPC->BOD33.bit.RUNBKUP = 1; // Also run in backup mode + SUPC->BOD33.bit.RUNBKUP = 0; // Don't run in backup mode SUPC->BOD33.bit.PSEL = 0xB; // Check battery level every 4 seconds SUPC->BOD33.bit.LEVEL = 31; // Detect brownout at 2.5V (1.445V + level * 34mV) - SUPC->BOD33.bit.BKUPLEVEL = 31; // Detect same level in backup mode SUPC->BOD33.bit.ACTION = 0x2; // Generate an interrupt when BOD33 is triggered SUPC->BOD33.bit.HYST = 0; // Disable hysteresis while(!SUPC->STATUS.bit.B33SRDY); @@ -57,9 +59,6 @@ void _watch_init() { CALENDAR_0_init(); calendar_enable(&CALENDAR_0); - // Not sure if this belongs in every app -- is there a power impact? - delay_driver_init(); - // set up state btn_alarm_callback = NULL; a2_callback = NULL; |