uhbduhbv

Dependencies:   BNO055_fusion mbed

Fork of DEMO3 by Edwin Cho

Committer:
alaurens
Date:
Tue Mar 29 21:58:26 2016 +0000
Revision:
19:5832e34b7533
Parent:
6:0602a9e8118b
everything is beautiful

Who changed what in which revision?

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