Monitor for central heating system (e.g. 2zones+hw) Supports up to 15 temp probes (DS18B20/DS18S20) 3 valve monitors Gas pulse meter recording Use stand-alone or with nodeEnergyServer See http://robdobson.com/2015/09/central-heating-monitor

Dependencies:   EthernetInterfacePlusHostname NTPClient Onewire RdWebServer SDFileSystem-RTOS mbed-rtos mbed-src

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Watchdog.h Source File

Watchdog.h

00001 #ifndef __WATCHDOG__H
00002 #define __WATCHDOG__H
00003 #include "mbed.h"
00004 
00005 // Simon's Watchdog code from
00006 // http://mbed.org/forum/mbed/topic/508/
00007 class Watchdog
00008 {
00009     public:
00010         // Load timeout value in watchdog timer and enable
00011         void SetTimeoutSecs(float s)
00012         {
00013             LPC_WDT->WDCLKSEL = 0x1;                // Set CLK src to PCLK
00014             uint32_t clk = SystemCoreClock / 16;    // WD has a fixed /4 prescaler, PCLK default is /4
00015             LPC_WDT->WDTC = s * (float)clk;
00016             LPC_WDT->WDMOD = 0x3;                   // Enabled and Reset
00017             Feed();
00018         }
00019         // "kick" or "feed" the dog - reset the watchdog timer
00020         // by writing this required bit pattern
00021         void Feed() 
00022         {
00023             __disable_irq();
00024             LPC_WDT->WDFEED = 0xAA;
00025             LPC_WDT->WDFEED = 0x55;
00026             __enable_irq();
00027         }
00028         
00029         bool WatchdogCausedRestart()
00030         {
00031             if ((LPC_WDT->WDMOD >> 2) & 1)
00032                 return true;
00033             return false;
00034         }
00035 };
00036 
00037 #endif