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

Committer:
Bobty
Date:
Fri Oct 16 09:07:04 2015 +0000
Revision:
23:fd5a5a9f30bc
Parent:
19:0367cb46d003
Added index.html file to project for completeness

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Bobty 12:a52996515063 1 #ifndef __WATCHDOG__H
Bobty 12:a52996515063 2 #define __WATCHDOG__H
Bobty 12:a52996515063 3 #include "mbed.h"
Bobty 12:a52996515063 4
Bobty 12:a52996515063 5 // Simon's Watchdog code from
Bobty 12:a52996515063 6 // http://mbed.org/forum/mbed/topic/508/
Bobty 12:a52996515063 7 class Watchdog
Bobty 12:a52996515063 8 {
Bobty 12:a52996515063 9 public:
Bobty 12:a52996515063 10 // Load timeout value in watchdog timer and enable
Bobty 12:a52996515063 11 void SetTimeoutSecs(float s)
Bobty 12:a52996515063 12 {
Bobty 12:a52996515063 13 LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK
Bobty 12:a52996515063 14 uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4
Bobty 12:a52996515063 15 LPC_WDT->WDTC = s * (float)clk;
Bobty 12:a52996515063 16 LPC_WDT->WDMOD = 0x3; // Enabled and Reset
Bobty 12:a52996515063 17 Feed();
Bobty 12:a52996515063 18 }
Bobty 12:a52996515063 19 // "kick" or "feed" the dog - reset the watchdog timer
Bobty 12:a52996515063 20 // by writing this required bit pattern
Bobty 12:a52996515063 21 void Feed()
Bobty 12:a52996515063 22 {
Bobty 19:0367cb46d003 23 __disable_irq();
Bobty 12:a52996515063 24 LPC_WDT->WDFEED = 0xAA;
Bobty 12:a52996515063 25 LPC_WDT->WDFEED = 0x55;
Bobty 19:0367cb46d003 26 __enable_irq();
Bobty 12:a52996515063 27 }
Bobty 12:a52996515063 28
Bobty 12:a52996515063 29 bool WatchdogCausedRestart()
Bobty 12:a52996515063 30 {
Bobty 12:a52996515063 31 if ((LPC_WDT->WDMOD >> 2) & 1)
Bobty 12:a52996515063 32 return true;
Bobty 12:a52996515063 33 return false;
Bobty 12:a52996515063 34 }
Bobty 12:a52996515063 35 };
Bobty 12:a52996515063 36
Bobty 12:a52996515063 37 #endif