watchdog library. this is a derived work.
Dependents: RTOS_project RTOS_project_fork_01 RTOS_project_fork_02 ELEC351-Coursework
Revision 1:60654f9e0936, committed 2013-09-17
- Comitter:
- gatedClock
- Date:
- Tue Sep 17 20:43:35 2013 +0000
- Parent:
- 0:f27d373a8e28
- Commit message:
- update.
Changed in this revision
watchdog.h | Show diff for this revision Revisions of this file |
watchdog_RTOS.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r f27d373a8e28 -r 60654f9e0936 watchdog.h --- a/watchdog.h Tue Sep 17 15:03:56 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/*----------------------------------------------//----------------------------*/ - // Simon's Watchdog code from - // http://mbed.org/forum/mbed/topic/508/ - class Watchdog - { - public: - - void kick(float s) // Load timeout value in watchdog timer and enable - { - LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK - uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4 - LPC_WDT->WDTC = s * (float)clk; - LPC_WDT->WDMOD = 0x3; // Enabled and Reset - kick(); - } - - - void kick() // reset timer. - { - LPC_WDT->WDFEED = 0xAA; - LPC_WDT->WDFEED = 0x55; - } - }; -/*----------------------------------------------//----------------------------*/ \ No newline at end of file
diff -r f27d373a8e28 -r 60654f9e0936 watchdog_RTOS.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/watchdog_RTOS.h Tue Sep 17 20:43:35 2013 +0000 @@ -0,0 +1,24 @@ +/*----------------------------------------------//----------------------------*/ + // Simon's Watchdog code from + // http://mbed.org/forum/mbed/topic/508/ + class Watchdog_RTOS + { + public: + + void kick(float s) // Load timeout value in watchdog timer and enable + { + LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK + uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4 + LPC_WDT->WDTC = s * (float)clk; + LPC_WDT->WDMOD = 0x3; // Enabled and Reset + kick(); + } + + + void kick() // reset timer. + { + LPC_WDT->WDFEED = 0xAA; + LPC_WDT->WDFEED = 0x55; + } + }; +/*----------------------------------------------//----------------------------*/ \ No newline at end of file