Radio Structures in OOP

Dependencies:   mbed mbed-rtos

Committer:
jjones646
Date:
Thu Jan 15 07:15:33 2015 +0000
Revision:
6:4a3dbfbc30f1
Parent:
2:7d523bdd2f50
socket interface confirmed working.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jjones646 2:7d523bdd2f50 1 #include "mbed.h"
jjones646 2:7d523bdd2f50 2
jjones646 2:7d523bdd2f50 3 class Watchdog {
jjones646 2:7d523bdd2f50 4 public:
jjones646 2:7d523bdd2f50 5 // Load timeout value in watchdog timer and enable
jjones646 2:7d523bdd2f50 6 void set(float s) {
jjones646 2:7d523bdd2f50 7 LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK
jjones646 2:7d523bdd2f50 8 uint32_t clk = SystemCoreClock>>4; // WD has a fixed /4 prescaler, PCLK default is /4
jjones646 2:7d523bdd2f50 9 LPC_WDT->WDTC = s * (float)clk;
jjones646 2:7d523bdd2f50 10 LPC_WDT->WDMOD = 0x3; // Enabled and Reset
jjones646 2:7d523bdd2f50 11 renew();
jjones646 2:7d523bdd2f50 12 }
jjones646 2:7d523bdd2f50 13 // "kick" or "feed" the dog - reset the watchdog timer
jjones646 2:7d523bdd2f50 14 // by writing this required bit pattern
jjones646 2:7d523bdd2f50 15 void renew() {
jjones646 2:7d523bdd2f50 16 LPC_WDT->WDFEED = 0xAA;
jjones646 2:7d523bdd2f50 17 LPC_WDT->WDFEED = 0x55;
jjones646 2:7d523bdd2f50 18 }
jjones646 2:7d523bdd2f50 19 };