diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-05-08 15:25:22 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-05-25 11:52:13 -0400 |
commit | 65613aeddfb9ef86905cb1dade9e773a02ef3c27 (patch) | |
tree | e29f578daa1e5ded114c74b9b041cc6a9cd0c394 /src/lpc176x/main.c | |
parent | 83d3c1728052fae7402569e6ec012c657d9d0e4c (diff) | |
download | kutter-65613aeddfb9ef86905cb1dade9e773a02ef3c27.tar.gz kutter-65613aeddfb9ef86905cb1dade9e773a02ef3c27.tar.xz kutter-65613aeddfb9ef86905cb1dade9e773a02ef3c27.zip |
lpc176x: Enable watchdog
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/lpc176x/main.c')
-rw-r--r-- | src/lpc176x/main.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lpc176x/main.c b/src/lpc176x/main.c index 24cf6816..fc06bc24 100644 --- a/src/lpc176x/main.c +++ b/src/lpc176x/main.c @@ -12,6 +12,29 @@ DECL_CONSTANT(MCU, "lpc176x"); /**************************************************************** + * watchdog handler + ****************************************************************/ + +void +watchdog_reset(void) +{ + LPC_WDT->WDFEED = 0xaa; + LPC_WDT->WDFEED = 0x55; +} +DECL_TASK(watchdog_reset); + +void +watchdog_init(void) +{ + LPC_WDT->WDTC = 4000000 / 2; // 500ms timeout + LPC_WDT->WDCLKSEL = 1<<31; // Lock to internal RC + LPC_WDT->WDMOD = 0x03; // select reset and enable + watchdog_reset(); +} +DECL_INIT(watchdog_init); + + +/**************************************************************** * misc functions ****************************************************************/ |