Radio Structures in OOP

Dependencies:   mbed mbed-rtos

utils/Watchdog/Watchdog.h

Committer:
jjones646
Date:
2015-01-15
Revision:
6:4a3dbfbc30f1
Parent:
2:7d523bdd2f50

File content as of revision 6:4a3dbfbc30f1:

#include "mbed.h"

class Watchdog {
public:
// Load timeout value in watchdog timer and enable
    void set(float s) {
        LPC_WDT->WDCLKSEL = 0x1;                // Set CLK src to PCLK
        uint32_t clk = SystemCoreClock>>4;      // WD has a fixed /4 prescaler, PCLK default is /4
        LPC_WDT->WDTC = s * (float)clk;
        LPC_WDT->WDMOD = 0x3;                   // Enabled and Reset
        renew();
    }
// "kick" or "feed" the dog - reset the watchdog timer
// by writing this required bit pattern
    void renew() {
        LPC_WDT->WDFEED = 0xAA;
        LPC_WDT->WDFEED = 0x55;
    }
};