Skip to content

Commit

Permalink
Remove keyboard level QK_BOOT implementations (#24231)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored Aug 10, 2024
1 parent 339b820 commit 019b6f6
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 82 deletions.
12 changes: 7 additions & 5 deletions keyboards/capsunlocked/cu75/cu75.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
19 changes: 0 additions & 19 deletions keyboards/lfkeyboards/lfk65_hs/lfk65_hs.c

This file was deleted.

13 changes: 6 additions & 7 deletions keyboards/lfkeyboards/lfk78/lfk78.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
12 changes: 7 additions & 5 deletions keyboards/lfkeyboards/lfk87/lfk87.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
12 changes: 7 additions & 5 deletions keyboards/lfkeyboards/mini1800/mini1800.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
12 changes: 7 additions & 5 deletions keyboards/lfkeyboards/smk65/revb/revb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
29 changes: 13 additions & 16 deletions keyboards/nullbitsco/tidbit/tidbit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}
11 changes: 8 additions & 3 deletions keyboards/snes_macropad/snes_macropad.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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;
}
25 changes: 8 additions & 17 deletions keyboards/woodkeys/meira/meira.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

0 comments on commit 019b6f6

Please sign in to comment.