Library to control Dodge LX (83.3k) CAN devices

Dependencies:   DodgeRadioLib EthernetWrapperLib OBDIILib mbed

WatchDogTimer.cpp

Committer:
rtgree01
Date:
2011-12-30
Revision:
1:90487a39d54e
Parent:
0:4d16a55d0eec
Child:
2:e8b13ea2881b

File content as of revision 1:90487a39d54e:

#include "WatchDogTimer.h"

void WatchDogTimer::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();
}

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