Skip to content

Commit

Permalink
lpc176x: Enable watchdog
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
  • Loading branch information
KevinOConnor committed May 25, 2018
1 parent 83d3c17 commit 65613ae
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/lpc176x/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,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
****************************************************************/
Expand Down

0 comments on commit 65613ae

Please sign in to comment.