Versão estável sem DMA e FFT. 128 amostras.
Dependencies: EthernetInterface NTPClient mbed-rtos mbed
Functions/whatchdog.h@0:fac116e94d44, 2016-01-05 (annotated)
- Committer:
- rebonatto
- Date:
- Tue Jan 05 11:47:35 2016 +0000
- Revision:
- 0:fac116e94d44
Vers?o est?vel sem DMA e FFT. 128 amostras.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rebonatto | 0:fac116e94d44 | 1 | // Simon's Watchdog code from |
rebonatto | 0:fac116e94d44 | 2 | // http://mbed.org/forum/mbed/topic/508/ |
rebonatto | 0:fac116e94d44 | 3 | class Watchdog { |
rebonatto | 0:fac116e94d44 | 4 | public: |
rebonatto | 0:fac116e94d44 | 5 | // Load timeout value in watchdog timer and enable |
rebonatto | 0:fac116e94d44 | 6 | void kick(float s) { |
rebonatto | 0:fac116e94d44 | 7 | LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK |
rebonatto | 0:fac116e94d44 | 8 | uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4 |
rebonatto | 0:fac116e94d44 | 9 | LPC_WDT->WDTC = s * (float)clk; |
rebonatto | 0:fac116e94d44 | 10 | LPC_WDT->WDMOD = 0x3; // Enabled and Reset |
rebonatto | 0:fac116e94d44 | 11 | kick(); |
rebonatto | 0:fac116e94d44 | 12 | } |
rebonatto | 0:fac116e94d44 | 13 | // "kick" or "feed" the dog - reset the watchdog timer |
rebonatto | 0:fac116e94d44 | 14 | // by writing this required bit pattern |
rebonatto | 0:fac116e94d44 | 15 | void kick() { |
rebonatto | 0:fac116e94d44 | 16 | LPC_WDT->WDFEED = 0xAA; |
rebonatto | 0:fac116e94d44 | 17 | LPC_WDT->WDFEED = 0x55; |
rebonatto | 0:fac116e94d44 | 18 | } |
rebonatto | 0:fac116e94d44 | 19 | }; |