Versão limpa em 04/09/2014. Telnet funcionando.
Dependencies: EthernetInterface mbed-rtos mbed NTPClient
Functions/whatchdog.h@43:69afea5f5a4d, 2016-01-18 (annotated)
- Committer:
- rebonatto
- Date:
- Mon Jan 18 18:26:03 2016 +0000
- Revision:
- 43:69afea5f5a4d
- Parent:
- 38:132e83a591d0
Aquisi??o sem DMA, 256 amostras.; Buffer simples com copia de buffer para calculo da FFT.; Com telnetr e TFTP ativos. Telnet funcionando sem travar.; Vers?o com WhatDog.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rebonatto | 38:132e83a591d0 | 1 | // Simon's Watchdog code from |
rebonatto | 38:132e83a591d0 | 2 | // http://mbed.org/forum/mbed/topic/508/ |
rebonatto | 38:132e83a591d0 | 3 | class Watchdog { |
rebonatto | 38:132e83a591d0 | 4 | public: |
rebonatto | 38:132e83a591d0 | 5 | // Load timeout value in watchdog timer and enable |
rebonatto | 38:132e83a591d0 | 6 | void kick(float s) { |
rebonatto | 38:132e83a591d0 | 7 | LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK |
rebonatto | 38:132e83a591d0 | 8 | uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4 |
rebonatto | 38:132e83a591d0 | 9 | LPC_WDT->WDTC = s * (float)clk; |
rebonatto | 38:132e83a591d0 | 10 | LPC_WDT->WDMOD = 0x3; // Enabled and Reset |
rebonatto | 38:132e83a591d0 | 11 | kick(); |
rebonatto | 38:132e83a591d0 | 12 | } |
rebonatto | 38:132e83a591d0 | 13 | // "kick" or "feed" the dog - reset the watchdog timer |
rebonatto | 38:132e83a591d0 | 14 | // by writing this required bit pattern |
rebonatto | 38:132e83a591d0 | 15 | void kick() { |
rebonatto | 38:132e83a591d0 | 16 | LPC_WDT->WDFEED = 0xAA; |
rebonatto | 38:132e83a591d0 | 17 | LPC_WDT->WDFEED = 0x55; |
rebonatto | 38:132e83a591d0 | 18 | } |
rebonatto | 38:132e83a591d0 | 19 | }; |