summaryrefslogtreecommitdiffstats
path: root/watch-library
diff options
context:
space:
mode:
authorJoey Castillo <joeycastillo@utexas.edu>2022-02-13 16:04:21 -0500
committerJoey Castillo <joeycastillo@utexas.edu>2022-02-13 16:04:21 -0500
commitc7f6387aee75cc76d3eae2ab23b419e9edf88902 (patch)
tree1c604645c1f99887b8d38a8eabb4eda8836430e6 /watch-library
parentb91f025542b4be42182de218630ea442eb119ddc (diff)
downloadSensor-Watch-c7f6387aee75cc76d3eae2ab23b419e9edf88902.tar.gz
Sensor-Watch-c7f6387aee75cc76d3eae2ab23b419e9edf88902.tar.bz2
Sensor-Watch-c7f6387aee75cc76d3eae2ab23b419e9edf88902.zip
on second thought: keep BOD33 disabled in sleep mode
Diffstat (limited to 'watch-library')
-rw-r--r--watch-library/hardware/watch/watch_deepsleep.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/watch-library/hardware/watch/watch_deepsleep.c b/watch-library/hardware/watch/watch_deepsleep.c
index 3238a953..e3f654f2 100644
--- a/watch-library/hardware/watch/watch_deepsleep.c
+++ b/watch-library/hardware/watch/watch_deepsleep.c
@@ -155,10 +155,8 @@ void watch_enter_sleep_mode(void) {
// disable tick interrupt
watch_rtc_disable_all_periodic_callbacks();
- // set brownout detector to check voltage once an hour (64 minutes).
- // in sleep, we're not worried about the LED causing a voltage drop and a brownout.
- // changes to voltage will take place slowly over months, not quickly over seconds.
- SUPC->BOD33.bit.PSEL = 0xF;
+ // disable brownout detector interrupt, which could inadvertently wake us up.
+ SUPC->INTENCLR.bit.BOD33DET = 1;
// disable all pins
_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.
sleep(4);
- // and we awake! speed the brownout detector back up to 1 check per second.
- SUPC->BOD33.bit.PSEL = 0x9;
+ // and we awake! re-enable the brownout detector
+ SUPC->INTENSET.bit.BOD33DET = 1;
// call app_setup so the app can re-enable everything we disabled.
app_setup();