![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
test
WatchDog.cpp@1:a7bdc6b05f96, 2019-01-24 (annotated)
- Committer:
- hodgins
- Date:
- Thu Jan 24 06:52:36 2019 +0000
- Revision:
- 1:a7bdc6b05f96
- Parent:
- 0:e541909ea6b0
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hodgins | 0:e541909ea6b0 | 1 | #include "WatchDog.h" |
hodgins | 0:e541909ea6b0 | 2 | #include "Communication.h" |
hodgins | 0:e541909ea6b0 | 3 | |
hodgins | 0:e541909ea6b0 | 4 | |
hodgins | 0:e541909ea6b0 | 5 | Ticker watchDog; |
hodgins | 0:e541909ea6b0 | 6 | |
hodgins | 0:e541909ea6b0 | 7 | //Odosielanie správy s dátami pre reštart WatchDog |
hodgins | 0:e541909ea6b0 | 8 | void resetWatchDog() |
hodgins | 0:e541909ea6b0 | 9 | { |
hodgins | 0:e541909ea6b0 | 10 | char command [] = {0xff}; |
hodgins | 0:e541909ea6b0 | 11 | paket reset = {.adresa = 0xfe, .dlzkaDat = 0x01, .data = command}; |
hodgins | 0:e541909ea6b0 | 12 | sendData(reset); |
hodgins | 0:e541909ea6b0 | 13 | } |
hodgins | 0:e541909ea6b0 | 14 | |
hodgins | 0:e541909ea6b0 | 15 | //Inicializácia časovača, ktorý vyvolá po uplynutí času prerušenie a |
hodgins | 0:e541909ea6b0 | 16 | //zavolá obsluhu prerušenia, parameter je časový interval medzi prerušeniami |
hodgins | 0:e541909ea6b0 | 17 | void init_watchDog(float time) |
hodgins | 0:e541909ea6b0 | 18 | { |
hodgins | 0:e541909ea6b0 | 19 | watchDog.attach(&resetWatchDog, time); |
hodgins | 0:e541909ea6b0 | 20 | } |