Add watchdog implementation + use it in main()
parent
82a9eaae43
commit
a23ed5e1bf
|
|
@ -8,4 +8,5 @@ target_sources(
|
||||||
tmc2130.cpp
|
tmc2130.cpp
|
||||||
adc.cpp
|
adc.cpp
|
||||||
avr/spi.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
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
namespace hal {
|
namespace hal {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include "hal/shr16.h"
|
#include "hal/shr16.h"
|
||||||
#include "hal/spi.h"
|
#include "hal/spi.h"
|
||||||
#include "hal/usart.h"
|
#include "hal/usart.h"
|
||||||
|
#include "hal/watchdog.h"
|
||||||
|
|
||||||
#include "pins.h"
|
#include "pins.h"
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
|
|
@ -95,6 +96,7 @@ void setup() {
|
||||||
cpu::Init();
|
cpu::Init();
|
||||||
|
|
||||||
mt::timebase.Init();
|
mt::timebase.Init();
|
||||||
|
hal::watchdog::ConfigureWatchDog(8);
|
||||||
|
|
||||||
mg::globals.Init();
|
mg::globals.Init();
|
||||||
|
|
||||||
|
|
@ -363,7 +365,8 @@ void loop() {
|
||||||
ms::selector.Step();
|
ms::selector.Step();
|
||||||
mui::userInput.Step();
|
mui::userInput.Step();
|
||||||
currentCommand->Step();
|
currentCommand->Step();
|
||||||
// add a watchdog reset
|
|
||||||
|
hal::watchdog::ResetWatchDog();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue