diff options
author | tomaszduda23 <[email protected]> | 2022-09-12 16:00:30 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2022-09-12 17:00:30 +0300 |
commit | fa01d92dde2d4c199c8f6b394a72a4f41c28cfe9 (patch) | |
tree | c280173d27be97941d1862c5c160fbc1fe1c3dda /hid | |
parent | 38f2da2e2e931c22d5ce1361d5e39bb5739022d5 (diff) |
Watchdog (#108)
* add SW reset
* adds watchdog
Diffstat (limited to 'hid')
-rw-r--r-- | hid/lib/drivers-stm32/board-stm32.h | 7 | ||||
-rw-r--r-- | hid/lib/drivers/board.h | 1 | ||||
-rw-r--r-- | hid/src/main.cpp | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/hid/lib/drivers-stm32/board-stm32.h b/hid/lib/drivers-stm32/board-stm32.h index 212106b3..118138ad 100644 --- a/hid/lib/drivers-stm32/board-stm32.h +++ b/hid/lib/drivers-stm32/board-stm32.h @@ -23,16 +23,23 @@ #pragma once #include "board.h" +#include <libmaple/iwdg.h> namespace DRIVERS { class BoardStm32 : public Board { public: BoardStm32() : Board(BOARD){ + //2 sec timeout + iwdg_init(IWDG_PRE_16, 0xFFF); } void reset() override { nvic_sys_reset(); } + + void periodic() { + iwdg_feed(); + } }; } diff --git a/hid/lib/drivers/board.h b/hid/lib/drivers/board.h index b0981e71..50730ee1 100644 --- a/hid/lib/drivers/board.h +++ b/hid/lib/drivers/board.h @@ -29,5 +29,6 @@ namespace DRIVERS { struct Board : public Driver { using Driver::Driver; virtual void reset() {} + virtual void periodic() {} }; } diff --git a/hid/src/main.cpp b/hid/src/main.cpp index 991d8c26..802abc15 100644 --- a/hid/src/main.cpp +++ b/hid/src/main.cpp @@ -242,6 +242,7 @@ void loop() { _out.kbd->periodic(); _out.mouse->periodic(); + _board->periodic(); # ifdef CMD_SERIAL static unsigned long last = micros(); |