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