Versão limpa em 04/09/2014. Telnet funcionando.
Dependencies: EthernetInterface mbed-rtos mbed NTPClient
Functions/whatchdog.h@38:132e83a591d0, 2016-01-07 (annotated)
- Committer:
- rebonatto
- Date:
- Thu Jan 07 18:44:44 2016 +0000
- Revision:
- 38:132e83a591d0
Vers?o est?vel com DMA e FFT.
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 | }; |