Repo. for the ELEC351 Coursework - Oliver Thompson

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

Committer:
O_Thom
Date:
Wed Jan 02 12:12:30 2019 +0000
Revision:
20:2ce28a5032d5
Parent:
9:654e14de9d74
Serial Messaging Complete - SD Class need to handle commands. LCD and Networking Time and Date Update Needs Testing.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
O_Thom 9:654e14de9d74 1 #include "mbed.h"
O_Thom 9:654e14de9d74 2
O_Thom 9:654e14de9d74 3 class Watchdog {
O_Thom 9:654e14de9d74 4 public:
O_Thom 9:654e14de9d74 5 void kick(float s) {
O_Thom 9:654e14de9d74 6 LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK
O_Thom 9:654e14de9d74 7 uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4
O_Thom 9:654e14de9d74 8 LPC_WDT->WDTC = s * (float)clk;
O_Thom 9:654e14de9d74 9 LPC_WDT->WDMOD = 0x3; // Enabled and Reset
O_Thom 9:654e14de9d74 10 kick();
O_Thom 9:654e14de9d74 11 }
O_Thom 9:654e14de9d74 12 // Kick the dog
O_Thom 9:654e14de9d74 13 void kick() {
O_Thom 9:654e14de9d74 14 LPC_WDT->WDFEED = 0xAA;
O_Thom 9:654e14de9d74 15 LPC_WDT->WDFEED = 0x55;
O_Thom 9:654e14de9d74 16 }
O_Thom 9:654e14de9d74 17 };