diff options
| author | Dan Halbert <halbert@halwitz.org> | 2018-06-01 18:02:13 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-01 18:02:13 -0400 |
| commit | ea95eb730a3e462da4bab32ee71fd2977a5a89c5 (patch) | |
| tree | 85cf7e3194ac5f81973e0523d261c49c9f9a8b0c /ports | |
| parent | 317bb6d2ce75daa0737fb3ca8a2fb152160f1a7a (diff) | |
| parent | f38ce1060ca231e4542619d5401e46d22a92c009 (diff) | |
Merge pull request #890 from tannewt/brownout3
Support brownout to safe mode. Fixes #870
Diffstat (limited to 'ports')
| -rw-r--r-- | ports/atmel-samd/supervisor/port.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 55304e8ba..7c682d120 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -201,9 +201,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; |
