mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-11-13 19:31:29 +01:00
Implement mcu_reset function for teensy_32/teensy_lc
This commit is contained in:
@@ -19,9 +19,27 @@
|
||||
#include <ch.h>
|
||||
#include "wait.h"
|
||||
|
||||
#define SCB_AIRCR_VECTKEY_WRITEMAGIC 0x05FA0000
|
||||
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
wait_ms(100);
|
||||
__BKPT(0);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void mcu_reset(void) {}
|
||||
__attribute__((weak)) void mcu_reset(void) {
|
||||
/* Ensure all outstanding memory operations complete */
|
||||
__DSB();
|
||||
__ISB();
|
||||
|
||||
/* Request system reset (preserve PRIGROUP) */
|
||||
uint32_t aircr = SCB->AIRCR;
|
||||
aircr &= ~SCB_AIRCR_VECTKEY_Msk;
|
||||
aircr |= SCB_AIRCR_VECTKEY_WRITEMAGIC;
|
||||
aircr |= SCB_AIRCR_SYSRESETREQ_Msk;
|
||||
SCB->AIRCR = aircr;
|
||||
|
||||
/* Wait for reset to occur */
|
||||
while (true) {
|
||||
__NOP();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user