Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
Watchdog/Watchdog.cpp
- Committer:
- martydd3
- Date:
- 2014-10-10
- Revision:
- 8:ecf68db484af
- Parent:
- 6:6a04210a3f4f
File content as of revision 8:ecf68db484af:
// Simon's Watchdog code from
// http://mbed.org/forum/mbed/topic/508/
#include "mbed.h"
class Watchdog {
public:
// Load timeout value in watchdog timer and enable
void kick(float s) {
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();
}
// "kick" or "feed" the dog - reset the watchdog timer
// by writing this required bit pattern
void kick() {
LPC_WDT->WDFEED = 0xAA;
LPC_WDT->WDFEED = 0x55;
}
};
