Library to control Dodge LX (83.3k) CAN devices

Dependencies:   DodgeRadioLib EthernetWrapperLib OBDIILib mbed

Committer:
rtgree01
Date:
Fri Dec 30 20:23:00 2011 +0000
Revision:
1:90487a39d54e
Parent:
0:4d16a55d0eec
Child:
2:e8b13ea2881b
HU emulator; CAN Monitor; OBD2 reader (started)

Who changed what in which revision?

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