Localization
Dependencies: BNO055_fusion mbed
WATCHDOG.cpp@18:f9012e93edb8, 2016-03-29 (annotated)
- Committer:
- 12104404
- Date:
- Tue Mar 29 02:12:08 2016 +0000
- Revision:
- 18:f9012e93edb8
- Parent:
- 6:0602a9e8118b
ROBOT CLEANS THE PATH;
Who changed what in which revision?
User | Revision | Line number | New 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 | } |