* add SW reset

* adds watchdog
This commit is contained in:
tomaszduda23 2022-09-12 16:00:30 +02:00 committed by GitHub
parent 38f2da2e2e
commit fa01d92dde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -23,16 +23,23 @@
#pragma once #pragma once
#include "board.h" #include "board.h"
#include <libmaple/iwdg.h>
namespace DRIVERS { namespace DRIVERS {
class BoardStm32 : public Board { class BoardStm32 : public Board {
public: public:
BoardStm32() : Board(BOARD){ BoardStm32() : Board(BOARD){
//2 sec timeout
iwdg_init(IWDG_PRE_16, 0xFFF);
} }
void reset() override { void reset() override {
nvic_sys_reset(); nvic_sys_reset();
} }
void periodic() {
iwdg_feed();
}
}; };
} }

View File

@ -29,5 +29,6 @@ namespace DRIVERS {
struct Board : public Driver { struct Board : public Driver {
using Driver::Driver; using Driver::Driver;
virtual void reset() {} virtual void reset() {}
virtual void periodic() {}
}; };
} }

View File

@ -242,6 +242,7 @@ void loop() {
_out.kbd->periodic(); _out.kbd->periodic();
_out.mouse->periodic(); _out.mouse->periodic();
_board->periodic();
# ifdef CMD_SERIAL # ifdef CMD_SERIAL
static unsigned long last = micros(); static unsigned long last = micros();