aboutsummaryrefslogtreecommitdiffstats
path: root/src/atsamd/main.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-01-14 18:21:50 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-01-28 20:02:16 -0500
commit8cd83b4c2dcaeac1fe68f18eadd7f25ff42476c2 (patch)
tree780a7aa17ffd41969e5e6d63751b0efe7a9d108c /src/atsamd/main.c
parentf6ce875818a1341ff7a0279699505453d8ca0db4 (diff)
downloadkutter-8cd83b4c2dcaeac1fe68f18eadd7f25ff42476c2.tar.gz
kutter-8cd83b4c2dcaeac1fe68f18eadd7f25ff42476c2.tar.xz
kutter-8cd83b4c2dcaeac1fe68f18eadd7f25ff42476c2.zip
atsamd: Initial support for SAMD51
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/atsamd/main.c')
-rw-r--r--src/atsamd/main.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/atsamd/main.c b/src/atsamd/main.c
index 4687fc34..5cd85d44 100644
--- a/src/atsamd/main.c
+++ b/src/atsamd/main.c
@@ -1,14 +1,14 @@
-// Main starting point for SAMD21 boards
+// Main starting point for SAMD boards
//
-// Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2018-2019 Kevin O'Connor <kevin@koconnor.net>
//
// This file may be distributed under the terms of the GNU GPLv3 license.
#include "command.h" // DECL_CONSTANT
-#include "samd21.h" // SystemInit
+#include "internal.h" // WDT
#include "sched.h" // sched_main
-DECL_CONSTANT(MCU, "samd21g");
+DECL_CONSTANT(MCU, CONFIG_MCU);
/****************************************************************
@@ -25,8 +25,13 @@ DECL_TASK(watchdog_reset);
void
watchdog_init(void)
{
+#if CONFIG_MACH_SAMD21
WDT->CONFIG.reg = WDT_CONFIG_PER_16K; // 500ms timeout
WDT->CTRL.reg = WDT_CTRL_ENABLE;
+#elif CONFIG_MACH_SAMD51
+ WDT->CONFIG.reg = WDT_CONFIG_PER(6); // 500ms timeout
+ WDT->CTRLA.reg = WDT_CTRLA_ENABLE;
+#endif
}
DECL_INIT(watchdog_init);