Radio Structures in OOP

Dependencies:   mbed mbed-rtos

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Watchdog.h Source File

Watchdog.h

00001 #include "mbed.h"
00002 
00003 class Watchdog {
00004 public:
00005 // Load timeout value in watchdog timer and enable
00006     void set(float s) {
00007         LPC_WDT->WDCLKSEL = 0x1;                // Set CLK src to PCLK
00008         uint32_t clk = SystemCoreClock>>4;      // WD has a fixed /4 prescaler, PCLK default is /4
00009         LPC_WDT->WDTC = s * (float)clk;
00010         LPC_WDT->WDMOD = 0x3;                   // Enabled and Reset
00011         renew();
00012     }
00013 // "kick" or "feed" the dog - reset the watchdog timer
00014 // by writing this required bit pattern
00015     void renew() {
00016         LPC_WDT->WDFEED = 0xAA;
00017         LPC_WDT->WDFEED = 0x55;
00018     }
00019 };