Add watchdog implementation + use it in main()
parent
82a9eaae43
commit
324ced6807
|
|
@ -8,4 +8,5 @@ target_sources(
|
|||
tmc2130.cpp
|
||||
adc.cpp
|
||||
avr/spi.cpp
|
||||
avr/watchdog.cpp
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
#include "../watchdog.h"
|
||||
|
||||
namespace hal {
|
||||
namespace watchdog {
|
||||
|
||||
void ConfigureWatchDog(uint16_t period) {
|
||||
// @@TODO
|
||||
}
|
||||
|
||||
void ResetWatchDog() {
|
||||
asm("wdr");
|
||||
}
|
||||
|
||||
} // namespace watchdog
|
||||
} // namespace hal
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
namespace hal {
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "hal/shr16.h"
|
||||
#include "hal/spi.h"
|
||||
#include "hal/usart.h"
|
||||
#include "hal/watchdog.h"
|
||||
|
||||
#include "pins.h"
|
||||
#include <avr/interrupt.h>
|
||||
|
|
@ -96,6 +97,8 @@ void setup() {
|
|||
|
||||
mt::timebase.Init();
|
||||
|
||||
hal::watchdog::ConfigureWatchDog(8);
|
||||
|
||||
mg::globals.Init();
|
||||
|
||||
// watchdog init
|
||||
|
|
@ -363,7 +366,8 @@ void loop() {
|
|||
ms::selector.Step();
|
||||
mui::userInput.Step();
|
||||
currentCommand->Step();
|
||||
// add a watchdog reset
|
||||
|
||||
hal::watchdog::ResetWatchDog();
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue