Repo. for the ELEC351 Coursework - Oliver Thompson

Dependencies:   BMP280 ELEC350-Practicals-FZ429- TextLCD watchdog_RTOS BME280 ntp-client

Revision:
9:654e14de9d74
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Watchdog.hpp	Fri Nov 30 15:01:03 2018 +0000
@@ -0,0 +1,17 @@
+#include "mbed.h"
+
+class Watchdog {
+public:
+    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 the dog
+    void kick() {
+        LPC_WDT->WDFEED = 0xAA;
+        LPC_WDT->WDFEED = 0x55;
+    }
+};
\ No newline at end of file