Localization

Dependencies:   BNO055_fusion mbed

WATCHDOG.cpp

Committer:
12104404
Date:
2016-03-29
Revision:
18:f9012e93edb8
Parent:
6:0602a9e8118b

File content as of revision 18:f9012e93edb8:

#include "WATCHDOG.h"

// "kick" or "feed" the dog - reset the watchdog timer
// by writing this required bit pattern
void Watchdog::kick(void)
{
    LPC_WDT->WDFEED = 0xAA;
    LPC_WDT->WDFEED = 0x55;
}

void Watchdog::kick(float s)
{
    LPC_WDT->WDCLKSEL = 0x1;                // Set CLK src to PCLK
    uint32_t clk = SystemCoreClock / 16;    // WD has a fixed /4 prescaler, PCLK default is /4
    LPC_WDT->WDTC = s * (float)clk;
    LPC_WDT->WDMOD = 0x3;                   // Enabled and Reset
    kick();
}