WatchDog Timer library, support for LPC1768 and LPC11U24
Dependents: ECGAFE_copy WatchDog
Fork of WatchDog by
WatchDog.h@0:bbc789f8d849, 2012-07-01 (annotated)
- Committer:
- Lerche
- Date:
- Sun Jul 01 22:43:25 2012 +0000
- Revision:
- 0:bbc789f8d849
Added support for LPC11U24.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Lerche | 0:bbc789f8d849 | 1 | /* |
Lerche | 0:bbc789f8d849 | 2 | * Using code Simon Ford written in his example |
Lerche | 0:bbc789f8d849 | 3 | * to implement WDT. |
Lerche | 0:bbc789f8d849 | 4 | * It can run in seconds, milliseconds, and microseconds. |
Lerche | 0:bbc789f8d849 | 5 | * All there is to do, is keep feeding the watchdog. |
Lerche | 0:bbc789f8d849 | 6 | */ |
Lerche | 0:bbc789f8d849 | 7 | |
Lerche | 0:bbc789f8d849 | 8 | #ifndef WATCHDOG_H |
Lerche | 0:bbc789f8d849 | 9 | #define WATCHDOG_H |
Lerche | 0:bbc789f8d849 | 10 | |
Lerche | 0:bbc789f8d849 | 11 | #include "mbed.h" |
Lerche | 0:bbc789f8d849 | 12 | |
Lerche | 0:bbc789f8d849 | 13 | /** Watchdog timer implementation (in seconds) */ |
Lerche | 0:bbc789f8d849 | 14 | class WatchDog { |
Lerche | 0:bbc789f8d849 | 15 | public: |
Lerche | 0:bbc789f8d849 | 16 | /** Creates Watchdog timer |
Lerche | 0:bbc789f8d849 | 17 | * |
Lerche | 0:bbc789f8d849 | 18 | * @param Sets the WDT in seconds |
Lerche | 0:bbc789f8d849 | 19 | */ |
Lerche | 0:bbc789f8d849 | 20 | WatchDog(float s); |
Lerche | 0:bbc789f8d849 | 21 | |
Lerche | 0:bbc789f8d849 | 22 | /** Keep feeding the watchdog in routine |
Lerche | 0:bbc789f8d849 | 23 | * |
Lerche | 0:bbc789f8d849 | 24 | * xxx.feed(); does the trick |
Lerche | 0:bbc789f8d849 | 25 | */ |
Lerche | 0:bbc789f8d849 | 26 | void feed(); |
Lerche | 0:bbc789f8d849 | 27 | }; |
Lerche | 0:bbc789f8d849 | 28 | /** Watchdog timer implementation (in milliseconds) */ |
Lerche | 0:bbc789f8d849 | 29 | class WatchDog_ms { |
Lerche | 0:bbc789f8d849 | 30 | public: |
Lerche | 0:bbc789f8d849 | 31 | /** Creates Watchdog timer |
Lerche | 0:bbc789f8d849 | 32 | * |
Lerche | 0:bbc789f8d849 | 33 | * @param Sets the WDT in milliseconds |
Lerche | 0:bbc789f8d849 | 34 | */ |
Lerche | 0:bbc789f8d849 | 35 | WatchDog_ms(int ms); |
Lerche | 0:bbc789f8d849 | 36 | /** Keep feeding the watchdog in routine |
Lerche | 0:bbc789f8d849 | 37 | * |
Lerche | 0:bbc789f8d849 | 38 | * xxx.feed(); does the trick |
Lerche | 0:bbc789f8d849 | 39 | */ |
Lerche | 0:bbc789f8d849 | 40 | void feed(); |
Lerche | 0:bbc789f8d849 | 41 | }; |
Lerche | 0:bbc789f8d849 | 42 | /** Watchdog timer implementation (in microseconds) */ |
Lerche | 0:bbc789f8d849 | 43 | class WatchDog_us { |
Lerche | 0:bbc789f8d849 | 44 | public: |
Lerche | 0:bbc789f8d849 | 45 | /** Creates Watchdog timer |
Lerche | 0:bbc789f8d849 | 46 | * |
Lerche | 0:bbc789f8d849 | 47 | * @param Sets the WDT in microseconds |
Lerche | 0:bbc789f8d849 | 48 | */ |
Lerche | 0:bbc789f8d849 | 49 | WatchDog_us(int us); |
Lerche | 0:bbc789f8d849 | 50 | /** Keep feeding the watchdog in routine |
Lerche | 0:bbc789f8d849 | 51 | * |
Lerche | 0:bbc789f8d849 | 52 | * xxx.feed(); does the trick |
Lerche | 0:bbc789f8d849 | 53 | */ |
Lerche | 0:bbc789f8d849 | 54 | void feed(); |
Lerche | 0:bbc789f8d849 | 55 | }; |
Lerche | 0:bbc789f8d849 | 56 | |
Lerche | 0:bbc789f8d849 | 57 | #endif |