Soft Reset via Serial or post-kill button click (#21652)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
fedetony
2021-04-24 09:53:52 +02:00
committed by GitHub
parent 7a8e3cc258
commit d3a2c6a0b4
29 changed files with 97 additions and 27 deletions

View File

@ -58,6 +58,15 @@ void HAL_init() {
#endif
}
void HAL_reboot() {
#if ENABLED(USE_WATCHDOG)
while (1) { /* run out the watchdog */ }
#else
void (*resetFunc)() = 0; // Declare resetFunc() at address 0
resetFunc(); // Jump to address 0
#endif
}
#if ENABLED(SDSUPPORT)
#include "../../sd/SdFatUtil.h"

View File

@ -135,7 +135,7 @@ void HAL_init();
inline void HAL_clear_reset_source() { MCUSR = 0; }
inline uint8_t HAL_get_reset_source() { return MCUSR; }
inline void HAL_reboot() {} // reboot the board or restart the bootloader
void HAL_reboot();
#if GCC_VERSION <= 50000
#pragma GCC diagnostic push