Remove keyboard level QK_BOOT implementations (#24231)

This commit is contained in:
Joel Challis 2024-08-10 13:50:36 +01:00 committed by GitHub
parent 339b820520
commit 019b6f67b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 63 additions and 82 deletions

View File

@ -54,17 +54,19 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record)
if (click_toggle && record->event.pressed){
click(click_hz, click_time);
}
if (keycode == QK_BOOT) {
reset_keyboard_kb();
}
return process_record_user(keycode, record);
}
void reset_keyboard_kb(void){
bool shutdown_kb(bool jump_to_bootloader) {
#ifdef WATCHDOG_ENABLE
// Unconditionally run so shutdown_user can't mess up watchdog
MCUSR = 0;
wdt_disable();
wdt_reset();
#endif
reset_keyboard();
if (!shutdown_user(jump_to_bootloader)) {
return false;
}
return true;
}

View File

@ -1,19 +0,0 @@
#include "lfk65_hs.h"
#include <avr/wdt.h>
bool process_record_kb(uint16_t keycode, keyrecord_t* record)
{
if (keycode == QK_BOOT) {
reset_keyboard_kb();
}
return process_record_user(keycode, record);
}
void reset_keyboard_kb(void){
#ifdef WATCHDOG_ENABLE
MCUSR = 0;
wdt_disable();
wdt_reset();
#endif
reset_keyboard();
}

View File

@ -43,20 +43,19 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
if (click_toggle && record->event.pressed) {
clicking_notes(click_hz, click_time);
}
if (keycode == QK_BOOT) {
reset_keyboard_kb();
}
return process_record_user(keycode, record);
}
void reset_keyboard_kb(void) {
bool shutdown_kb(bool jump_to_bootloader) {
#ifdef WATCHDOG_ENABLE
// Unconditionally run so shutdown_user can't mess up watchdog
MCUSR = 0;
wdt_disable();
wdt_reset();
#endif
reset_keyboard();
if (!shutdown_user(jump_to_bootloader)) {
return false;
}
return true;
}

View File

@ -45,17 +45,19 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record)
if (click_toggle && record->event.pressed){
clicking_notes(click_hz, click_time);
}
if (keycode == QK_BOOT) {
reset_keyboard_kb();
}
return process_record_user(keycode, record);
}
void reset_keyboard_kb(void){
bool shutdown_kb(bool jump_to_bootloader) {
#ifdef WATCHDOG_ENABLE
// Unconditionally run so shutdown_user can't mess up watchdog
MCUSR = 0;
wdt_disable();
wdt_reset();
#endif
reset_keyboard();
if (!shutdown_user(jump_to_bootloader)) {
return false;
}
return true;
}

View File

@ -47,17 +47,19 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record)
if (click_toggle && record->event.pressed){
click(click_hz, click_time);
}
if (keycode == QK_BOOT) {
reset_keyboard_kb();
}
return process_record_user(keycode, record);
}
void reset_keyboard_kb(void){
bool shutdown_kb(bool jump_to_bootloader) {
#ifdef WATCHDOG_ENABLE
// Unconditionally run so shutdown_user can't mess up watchdog
MCUSR = 0;
wdt_disable();
wdt_reset();
#endif
reset_keyboard();
if (!shutdown_user(jump_to_bootloader)) {
return false;
}
return true;
}

View File

@ -61,17 +61,19 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record)
if (click_toggle && record->event.pressed){
click(click_hz, click_time);
}
if (keycode == QK_BOOT) {
reset_keyboard_kb();
}
return process_record_user(keycode, record);
}
void reset_keyboard_kb(void){
bool shutdown_kb(bool jump_to_bootloader) {
#ifdef WATCHDOG_ENABLE
// Unconditionally run so shutdown_user can't mess up watchdog
MCUSR = 0;
wdt_disable();
wdt_reset();
#endif
reset_keyboard();
if (!shutdown_user(jump_to_bootloader)) {
return false;
}
return true;
}

View File

@ -92,22 +92,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
numlock_set = true;
}
switch (keycode) {
case QK_BOOT:
if (record->event.pressed) {
set_bitc_LED(LED_DIM);
rgblight_disable_noeeprom();
#ifdef OLED_ENABLE
oled_off();
#endif
bootloader_jump(); // jump to bootloader
}
return false;
default:
break;
}
return true;
}
@ -121,3 +105,16 @@ void matrix_scan_kb(void) {
matrix_scan_remote_kb();
matrix_scan_user();
}
bool shutdown_kb(bool jump_to_bootloader) {
if (!shutdown_user(jump_to_bootloader)) {
return false;
}
set_bitc_LED(LED_DIM);
rgblight_disable_noeeprom();
#ifdef OLED_ENABLE
oled_off();
#endif
return true;
}

View File

@ -92,9 +92,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
set_keylog(keycode, record);
}
if (keycode == QK_BOOT) {
setupForFlashing();
}
return process_record_user(keycode, record);
}
@ -104,3 +101,11 @@ void keyboard_post_init_kb(void) {
rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_SWIRL);
keyboard_post_init_user();
}
bool shutdown_kb(bool jump_to_bootloader) {
if (!shutdown_user(jump_to_bootloader)) {
return false;
}
setupForFlashing();
return true;
}

View File

@ -15,11 +15,7 @@
*/
#include "meira.h"
void matrix_init_kb(void)
{
debug_enable=true;
print("meira matrix_init_kb\n");
void matrix_init_kb(void) {
#ifdef WATCHDOG_ENABLE
// This is done after turning the layer LED red, if we're caught in a loop
// we should get a flashing red light
@ -37,21 +33,16 @@ void housekeeping_task_kb(void) {
#endif
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
// Test code that turns on the switch led for the key that is pressed
// set_backlight_by_keymap(record->event.key.col, record->event.key.row);
if (keycode == QK_BOOT) {
reset_keyboard_kb();
}
return process_record_user(keycode, record);
}
void reset_keyboard_kb(void){
bool shutdown_kb(bool jump_to_bootloader) {
#ifdef WATCHDOG_ENABLE
// Unconditionally run so shutdown_user can't mess up watchdog
MCUSR = 0;
wdt_disable();
wdt_reset();
#endif
xprintf("programming!\n");
reset_keyboard();
if (!shutdown_user(jump_to_bootloader)) {
return false;
}
return true;
}