Localization

Dependencies:   BNO055_fusion mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WATCHDOG.cpp Source File

WATCHDOG.cpp

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