Fork of Smoothie to port to mbed non-LPC targets.
Fork of Smoothie by
libs/Watchdog.cpp
- Committer:
- Bigcheese
- Date:
- 2014-03-02
- Revision:
- 3:f151d08d335c
- Parent:
- 2:1df0b61d3b5a
File content as of revision 3:f151d08d335c:
#include "Watchdog.h" #include <lpc17xx_wdt.h> #include <mri.h> // TODO : comment this // Basically, when stuff stop answering, reset, or enter MRI mode, or something Watchdog::Watchdog(uint32_t timeout, WDT_ACTION action) { WDT_Init(WDT_CLKSRC_IRC, (action == WDT_MRI)?WDT_MODE_INT_ONLY:WDT_MODE_RESET); WDT_Start(timeout); WDT_Feed(); } void Watchdog::feed() { WDT_Feed(); } void Watchdog::on_module_loaded() { register_for_event(ON_IDLE); feed(); } void Watchdog::on_idle(void*) { feed(); } extern "C" void WDT_IRQHandler(void) { WDT_ClrTimeOutFlag(); WDT_Feed(); __debugbreak(); }