mirror of
git://soft.sys114.com/klipper
synced 2026-02-13 05:30:33 +09:00
atsamd: Move watchdog code to its own files
Move the watchdog code from main.c to watchdog.c and samd51_watchdog.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
23
src/atsamd/samd51_watchdog.c
Normal file
23
src/atsamd/samd51_watchdog.c
Normal file
@@ -0,0 +1,23 @@
|
||||
// Watchdog handler on SAMD21 boards
|
||||
//
|
||||
// Copyright (C) 2018-2019 Kevin O'Connor <kevin@koconnor.net>
|
||||
//
|
||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
|
||||
#include "internal.h" // WDT
|
||||
#include "sched.h" // DECL_TASK
|
||||
|
||||
void
|
||||
watchdog_reset(void)
|
||||
{
|
||||
WDT->CLEAR.reg = 0xa5;
|
||||
}
|
||||
DECL_TASK(watchdog_reset);
|
||||
|
||||
void
|
||||
watchdog_init(void)
|
||||
{
|
||||
WDT->CONFIG.reg = WDT_CONFIG_PER(6); // 500ms timeout
|
||||
WDT->CTRLA.reg = WDT_CTRLA_ENABLE;
|
||||
}
|
||||
DECL_INIT(watchdog_init);
|
||||
Reference in New Issue
Block a user