summaryrefslogtreecommitdiff
path: root/ports
diff options
context:
space:
mode:
authorScott Shawcroft <scott.shawcroft@gmail.com>2018-06-01 13:45:28 -0700
committerScott Shawcroft <scott.shawcroft@gmail.com>2018-06-01 13:45:28 -0700
commitf38ce1060ca231e4542619d5401e46d22a92c009 (patch)
tree4f1f495fea70dc95dfbd1647606b4e62bbf16f91 /ports
parent6479cb08060d7fb29b9189430a1ee8d105d37b26 (diff)
Support brownout to safe mode. Fixes #870
Diffstat (limited to 'ports')
-rw-r--r--ports/atmel-samd/supervisor/port.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c
index a92ab2913..63c143c2a 100644
--- a/ports/atmel-samd/supervisor/port.c
+++ b/ports/atmel-samd/supervisor/port.c
@@ -203,9 +203,16 @@ safe_mode_t port_init(void) {
}
#endif
- // if (PM->RCAUSE.bit.BOD33 == 1 || PM->RCAUSE.bit.BOD12 == 1) {
- // return BROWNOUT;
- // }
+ #ifdef SAMD21
+ if (PM->RCAUSE.bit.BOD33 == 1 || PM->RCAUSE.bit.BOD12 == 1) {
+ return BROWNOUT;
+ }
+ #endif
+ #ifdef SAMD51
+ if (RSTC->RCAUSE.bit.BODVDD == 1 || RSTC->RCAUSE.bit.BODCORE == 1) {
+ return BROWNOUT;
+ }
+ #endif
if (board_requests_safe_mode()) {
return USER_SAFE_MODE;