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: CANBuffer mbed SystemManagement mbed-rtos
Watchdog.cpp
00001 // Simon's Watchdog code from 00002 // http://mbed.org/forum/mbed/topic/508/ 00003 00004 #include "mbed.h" 00005 00006 class Watchdog { 00007 public: 00008 // Load timeout value in watchdog timer and enable 00009 void kick(float s) { 00010 LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK 00011 uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4 00012 LPC_WDT->WDTC = s * (float)clk; 00013 LPC_WDT->WDMOD = 0x3; // Enabled and Reset 00014 kick(); 00015 } 00016 // "kick" or "feed" the dog - reset the watchdog timer 00017 // by writing this required bit pattern 00018 void kick() { 00019 LPC_WDT->WDFEED = 0xAA; 00020 LPC_WDT->WDFEED = 0x55; 00021 } 00022 };
Generated on Sat Aug 13 2022 03:42:38 by
1.7.2