aboutsummaryrefslogtreecommitdiffstats
path: root/src/samd21/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/samd21/main.c')
-rw-r--r--src/samd21/main.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/samd21/main.c b/src/samd21/main.c
index a9da6324..4687fc34 100644
--- a/src/samd21/main.c
+++ b/src/samd21/main.c
@@ -12,6 +12,26 @@ DECL_CONSTANT(MCU, "samd21g");
/****************************************************************
+ * watchdog handler
+ ****************************************************************/
+
+void
+watchdog_reset(void)
+{
+ WDT->CLEAR.reg = 0xa5;
+}
+DECL_TASK(watchdog_reset);
+
+void
+watchdog_init(void)
+{
+ WDT->CONFIG.reg = WDT_CONFIG_PER_16K; // 500ms timeout
+ WDT->CTRL.reg = WDT_CTRL_ENABLE;
+}
+DECL_INIT(watchdog_init);
+
+
+/****************************************************************
* misc functions
****************************************************************/