Use built-in function to do bootloader reset
parent
0a035bab1a
commit
7a3d43acf1
|
|
@ -64,14 +64,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
|||
uartStartSend(&UARTD3, 6, "\x09\x04\x05\x01\x00\x00");
|
||||
}
|
||||
return false;
|
||||
case AP_RST:
|
||||
/* Reset the keyboard, enter DFU when ESC is pressed */
|
||||
__disable_irq();
|
||||
SCB->VTOR = 0x08000000;
|
||||
NVIC_SystemReset();
|
||||
/* This should not be reached */
|
||||
while(1);
|
||||
return false;
|
||||
default:
|
||||
/* Handle other keycodes normally */
|
||||
return true;
|
||||
|
|
@ -97,3 +89,13 @@ void keyboard_post_init_kb(void) {
|
|||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
/* Instead of doing some magic to get to the bootloader, just press ESC and reset */
|
||||
void bootloader_jump(void) {
|
||||
/* Disable interrupts as changing the vector table can mess them up */
|
||||
__disable_irq();
|
||||
/* Move the vector table back to the bootloader */
|
||||
SCB->VTOR = 0x08000000;
|
||||
/* Reset the system into the bootloader */
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@ enum anne_pro_keycodes {
|
|||
APL_RGB = SAFE_RANGE,
|
||||
APL_RAT,
|
||||
APL_BRT,
|
||||
APL_MOD,
|
||||
AP_RST
|
||||
APL_MOD
|
||||
};
|
||||
|
||||
/* The fully-featured LAYOUT() that has every single key available in the matrix. */
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
_______, _______, _______, XXXXXXX, _______, _______, _______, _______
|
||||
),
|
||||
[2] = LAYOUT(
|
||||
AP_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______,
|
||||
|
|
|
|||
Loading…
Reference in New Issue