From 02b43b4b603a426627c63e7bd0e48de8e88028e6 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sat, 27 Jul 2024 06:02:51 +0100 Subject: [PATCH] Refactor use of `matrix_scan_kb` (#24200) --- keyboards/capsunlocked/cu75/cu75.c | 4 +--- keyboards/clueboard/2x1800/2019/2019.c | 4 +--- keyboards/clueboard/2x1800/2021/2021.c | 4 +--- keyboards/custommk/evo70/evo70.c | 3 +-- keyboards/fallacy/fallacy.c | 3 +-- keyboards/gboards/butterstick/butterstick.c | 26 --------------------- keyboards/handwired/promethium/promethium.c | 4 +--- keyboards/hotdox76v2/hotdox76v2.c | 11 +++------ keyboards/jones/v03/matrix.c | 3 --- keyboards/jones/v03_1/matrix.c | 3 --- keyboards/lfkeyboards/lfk78/lfk78.c | 4 +--- keyboards/lfkeyboards/lfk87/lfk87.c | 4 +--- keyboards/lfkeyboards/lfkpad/lfkpad.c | 4 +--- keyboards/lfkeyboards/mini1800/mini1800.c | 4 +--- keyboards/lfkeyboards/smk65/revb/revb.c | 4 +--- keyboards/makeymakey/makeymakey.c | 3 +-- keyboards/matrix/m20add/m20add.c | 3 +-- keyboards/mlego/m65/m65.c | 3 +-- keyboards/owlab/spring/spring.c | 4 +--- keyboards/system76/launch_1/launch_1.c | 4 +--- keyboards/woodkeys/bigseries/1key/1key.c | 26 --------------------- keyboards/woodkeys/bigseries/2key/2key.c | 26 --------------------- keyboards/woodkeys/bigseries/3key/3key.c | 26 --------------------- keyboards/woodkeys/meira/meira.c | 4 +--- 24 files changed, 20 insertions(+), 164 deletions(-) delete mode 100644 keyboards/gboards/butterstick/butterstick.c delete mode 100755 keyboards/woodkeys/bigseries/1key/1key.c delete mode 100755 keyboards/woodkeys/bigseries/2key/2key.c delete mode 100755 keyboards/woodkeys/bigseries/3key/3key.c diff --git a/keyboards/capsunlocked/cu75/cu75.c b/keyboards/capsunlocked/cu75/cu75.c index e04dd74bc8..42d5f4e290 100644 --- a/keyboards/capsunlocked/cu75/cu75.c +++ b/keyboards/capsunlocked/cu75/cu75.c @@ -29,12 +29,10 @@ void matrix_init_kb(void) #endif } -void matrix_scan_kb(void) -{ +void housekeeping_task_kb(void) { #ifdef WATCHDOG_ENABLE wdt_reset(); #endif - matrix_scan_user(); } void click(uint16_t freq, uint16_t duration){ diff --git a/keyboards/clueboard/2x1800/2019/2019.c b/keyboards/clueboard/2x1800/2019/2019.c index 5910ca61e9..b7fb799ecb 100644 --- a/keyboards/clueboard/2x1800/2019/2019.c +++ b/keyboards/clueboard/2x1800/2019/2019.c @@ -58,7 +58,7 @@ uint8_t detected_shakes = 0; static uint16_t shake_timer; #endif -void matrix_scan_kb(void) { +void housekeeping_task_kb(void) { #ifdef SHAKE_ENABLE // Read the current state of the tilt sensor. It is physically // impossible for both pins to register a low state at the same time. @@ -81,8 +81,6 @@ void matrix_scan_kb(void) { detected_shakes = 0; } #endif - - matrix_scan_user(); } bool process_record_kb(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/clueboard/2x1800/2021/2021.c b/keyboards/clueboard/2x1800/2021/2021.c index d140c1cf15..511c40a699 100644 --- a/keyboards/clueboard/2x1800/2021/2021.c +++ b/keyboards/clueboard/2x1800/2021/2021.c @@ -21,13 +21,11 @@ #ifndef DRAWING_TOY_MODE static uint16_t led_frame_timer = 0; -void matrix_scan_kb(void) { +void housekeeping_task_kb(void) { if (timer_elapsed(led_frame_timer) > 100) { max7219_message_sign_task(true); led_frame_timer = timer_read(); } - - matrix_scan_user(); } #endif diff --git a/keyboards/custommk/evo70/evo70.c b/keyboards/custommk/evo70/evo70.c index f2874c4e8a..a8df4a7d1d 100644 --- a/keyboards/custommk/evo70/evo70.c +++ b/keyboards/custommk/evo70/evo70.c @@ -740,8 +740,7 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { } -void matrix_scan_kb(void) { - matrix_scan_user(); +void housekeeping_task_kb(void) { led_t current_led_state = host_keyboard_led_state(); uint8_t current_layer = get_highest_layer(layer_state); if (startup_delay) { diff --git a/keyboards/fallacy/fallacy.c b/keyboards/fallacy/fallacy.c index 05f68a0f99..9ed484d69a 100755 --- a/keyboards/fallacy/fallacy.c +++ b/keyboards/fallacy/fallacy.c @@ -22,9 +22,8 @@ void matrix_init_kb(void) { matrix_init_user(); } -void matrix_scan_kb(void) { +void housekeeping_task_kb(void) { update_fallacy_leds(); - matrix_scan_user(); } /* update LED driver with usb led_state diff --git a/keyboards/gboards/butterstick/butterstick.c b/keyboards/gboards/butterstick/butterstick.c deleted file mode 100644 index e19edc69ac..0000000000 --- a/keyboards/gboards/butterstick/butterstick.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright 2019 Jane Bernhardt - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include "quantum.h" - -void matrix_scan_kb(void) { -#ifdef DEBUG_MATRIX - for (uint8_t c = 0; c < MATRIX_COLS; c++) - for (uint8_t r = 0; r < MATRIX_ROWS; r++) - if (matrix_is_on(r, c)) xprintf("r:%d c:%d \n", r, c); -#endif - - matrix_scan_user(); -} diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c index e9df7dfe87..63139ac09d 100644 --- a/keyboards/handwired/promethium/promethium.c +++ b/keyboards/handwired/promethium/promethium.c @@ -17,7 +17,7 @@ __attribute__ ((weak)) void battery_poll(uint8_t level) { } -void matrix_scan_kb(void) { +void housekeeping_task_kb(void) { static uint16_t counter = BATTERY_POLL; counter++; @@ -25,6 +25,4 @@ void matrix_scan_kb(void) { counter = 0; battery_poll(battery_level()); } - - matrix_scan_user(); } diff --git a/keyboards/hotdox76v2/hotdox76v2.c b/keyboards/hotdox76v2/hotdox76v2.c index 57ed81b128..3ee5894107 100644 --- a/keyboards/hotdox76v2/hotdox76v2.c +++ b/keyboards/hotdox76v2/hotdox76v2.c @@ -248,13 +248,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { return true; } -void matrix_scan_kb(void) { - if (!is_oled_on()) { - m2s.cur_alp_index = 1; - } - matrix_scan_user(); -} - void user_sync_alpa_slave_handler(uint8_t in_buflen, const void *in_data, uint8_t out_buflen, void *out_data) { const master_to_slave_t *m2s_p = (const master_to_slave_t *)in_data; s2m.cur_alp_index = m2s_p->cur_alp_index; @@ -270,6 +263,9 @@ void keyboard_post_init_kb(void) { void housekeeping_task_kb(void) { if (is_keyboard_master()) { + if (!is_oled_on()) { + m2s.cur_alp_index = 1; + } // Interact with slave every 200ms static uint32_t last_sync = 0; if (timer_elapsed32(last_sync) > 200) { @@ -281,7 +277,6 @@ void housekeeping_task_kb(void) { } } } - housekeeping_task_user(); } #endif diff --git a/keyboards/jones/v03/matrix.c b/keyboards/jones/v03/matrix.c index 5663f1a8fc..d8bc134cf7 100644 --- a/keyboards/jones/v03/matrix.c +++ b/keyboards/jones/v03/matrix.c @@ -79,8 +79,6 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) void matrix_init_custom(void) { // initialize key pins init_pins(); - - matrix_init_kb(); } bool matrix_scan_custom(matrix_row_t current_matrix[]) { @@ -91,6 +89,5 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { changed |= read_cols_on_row(current_matrix, current_row); } - matrix_scan_kb(); return changed; } diff --git a/keyboards/jones/v03_1/matrix.c b/keyboards/jones/v03_1/matrix.c index 5663f1a8fc..d8bc134cf7 100644 --- a/keyboards/jones/v03_1/matrix.c +++ b/keyboards/jones/v03_1/matrix.c @@ -79,8 +79,6 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) void matrix_init_custom(void) { // initialize key pins init_pins(); - - matrix_init_kb(); } bool matrix_scan_custom(matrix_row_t current_matrix[]) { @@ -91,6 +89,5 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { changed |= read_cols_on_row(current_matrix, current_row); } - matrix_scan_kb(); return changed; } diff --git a/keyboards/lfkeyboards/lfk78/lfk78.c b/keyboards/lfkeyboards/lfk78/lfk78.c index 3bf7c40d15..3f6cb61263 100644 --- a/keyboards/lfkeyboards/lfk78/lfk78.c +++ b/keyboards/lfkeyboards/lfk78/lfk78.c @@ -21,12 +21,10 @@ void matrix_init_kb(void) { #endif } -void matrix_scan_kb(void) { +void housekeeping_task_kb(void) { #ifdef WATCHDOG_ENABLE wdt_reset(); #endif - - matrix_scan_user(); } void clicking_notes(uint16_t freq, uint16_t duration) { diff --git a/keyboards/lfkeyboards/lfk87/lfk87.c b/keyboards/lfkeyboards/lfk87/lfk87.c index 480a44ea84..e6288eb6c1 100644 --- a/keyboards/lfkeyboards/lfk87/lfk87.c +++ b/keyboards/lfkeyboards/lfk87/lfk87.c @@ -22,12 +22,10 @@ void matrix_init_kb(void) #endif } -void matrix_scan_kb(void) -{ +void housekeeping_task_kb(void) { #ifdef WATCHDOG_ENABLE wdt_reset(); #endif - matrix_scan_user(); } void clicking_notes(uint16_t freq, uint16_t duration){ diff --git a/keyboards/lfkeyboards/lfkpad/lfkpad.c b/keyboards/lfkeyboards/lfkpad/lfkpad.c index 8769c2c531..a169f7aa96 100644 --- a/keyboards/lfkeyboards/lfkpad/lfkpad.c +++ b/keyboards/lfkeyboards/lfkpad/lfkpad.c @@ -11,10 +11,8 @@ void matrix_init_kb(void) { #endif } -void matrix_scan_kb(void) { +void housekeeping_task_kb(void) { #ifdef WATCHDOG_ENABLE wdt_reset(); #endif - - matrix_scan_user(); } diff --git a/keyboards/lfkeyboards/mini1800/mini1800.c b/keyboards/lfkeyboards/mini1800/mini1800.c index 6ac615f871..96dc56c03c 100644 --- a/keyboards/lfkeyboards/mini1800/mini1800.c +++ b/keyboards/lfkeyboards/mini1800/mini1800.c @@ -24,12 +24,10 @@ void matrix_init_kb(void) #endif } -void matrix_scan_kb(void) -{ +void housekeeping_task_kb(void) { #ifdef WATCHDOG_ENABLE wdt_reset(); #endif - matrix_scan_user(); } void click(uint16_t freq, uint16_t duration){ diff --git a/keyboards/lfkeyboards/smk65/revb/revb.c b/keyboards/lfkeyboards/smk65/revb/revb.c index f519b413b5..c183ae1b02 100644 --- a/keyboards/lfkeyboards/smk65/revb/revb.c +++ b/keyboards/lfkeyboards/smk65/revb/revb.c @@ -36,12 +36,10 @@ void matrix_init_kb(void) #endif } -void matrix_scan_kb(void) -{ +void housekeeping_task_kb(void) { #ifdef WATCHDOG_ENABLE wdt_reset(); #endif - matrix_scan_user(); } void click(uint16_t freq, uint16_t duration){ diff --git a/keyboards/makeymakey/makeymakey.c b/keyboards/makeymakey/makeymakey.c index bfc8788375..6f8839f76e 100644 --- a/keyboards/makeymakey/makeymakey.c +++ b/keyboards/makeymakey/makeymakey.c @@ -108,9 +108,8 @@ void cycle_leds(void) { } } -void matrix_scan_kb(void) { +void housekeeping_task_kb(void) { cycle_leds(); - matrix_scan_user(); } bool process_record_kb(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/matrix/m20add/m20add.c b/keyboards/matrix/m20add/m20add.c index ac483e8aab..267c8e5134 100644 --- a/keyboards/matrix/m20add/m20add.c +++ b/keyboards/matrix/m20add/m20add.c @@ -34,11 +34,10 @@ void matrix_init_kb(void) { matrix_init_user(); } -void matrix_scan_kb(void) { +void housekeeping_task_kb(void) { #ifdef RGBLIGHT_ENABLE rgb_ring_task(); #endif - matrix_scan_user(); } static uint16_t caps_lock_pin = DEF_PIN(TCA6424_PORT2, 3); diff --git a/keyboards/mlego/m65/m65.c b/keyboards/mlego/m65/m65.c index 506ac2e30d..fd9ee5b947 100644 --- a/keyboards/mlego/m65/m65.c +++ b/keyboards/mlego/m65/m65.c @@ -167,8 +167,7 @@ bool oled_task_kb(void) { #endif -void matrix_scan_kb(void) { - matrix_scan_user(); +void housekeeping_task_kb(void) { toggle_leds(toggle_lwr, toggle_rse); } diff --git a/keyboards/owlab/spring/spring.c b/keyboards/owlab/spring/spring.c index 13280ff9b3..5e814d5a60 100644 --- a/keyboards/owlab/spring/spring.c +++ b/keyboards/owlab/spring/spring.c @@ -76,7 +76,7 @@ void set_caps_mode(uint8_t mode){ } -void matrix_scan_kb(void) { +void housekeeping_task_kb(void) { if(caps_in){ if(timer_elapsed32(caps_timer) > 3000){ rgblight_sethsv(pre_rgb.hue, pre_rgb.sat, pre_rgb.val); @@ -84,8 +84,6 @@ void matrix_scan_kb(void) { caps_in = false; } } - - matrix_scan_user(); } diff --git a/keyboards/system76/launch_1/launch_1.c b/keyboards/system76/launch_1/launch_1.c index 630305194e..dbe697c19d 100644 --- a/keyboards/system76/launch_1/launch_1.c +++ b/keyboards/system76/launch_1/launch_1.c @@ -143,10 +143,8 @@ void matrix_init_kb(void) { matrix_init_user(); } -void matrix_scan_kb(void) { +void housekeeping_task_kb(void) { usb_mux_event(); - - matrix_scan_user(); } #define LEVEL(value) (uint8_t)(((uint16_t)value) * ((uint16_t)RGB_MATRIX_MAXIMUM_BRIGHTNESS) / ((uint16_t)255)) diff --git a/keyboards/woodkeys/bigseries/1key/1key.c b/keyboards/woodkeys/bigseries/1key/1key.c deleted file mode 100755 index a2ebca4fe0..0000000000 --- a/keyboards/woodkeys/bigseries/1key/1key.c +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2018 Cole Markham - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#include "quantum.h" - -void matrix_scan_kb(void) { - // Looping keyboard code goes here - // This runs every cycle (a lot) - matrix_scan_user(); -#ifdef BACKLIGHT_ENABLE - backlight_task(); -#endif -}; diff --git a/keyboards/woodkeys/bigseries/2key/2key.c b/keyboards/woodkeys/bigseries/2key/2key.c deleted file mode 100755 index a2ebca4fe0..0000000000 --- a/keyboards/woodkeys/bigseries/2key/2key.c +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2018 Cole Markham - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#include "quantum.h" - -void matrix_scan_kb(void) { - // Looping keyboard code goes here - // This runs every cycle (a lot) - matrix_scan_user(); -#ifdef BACKLIGHT_ENABLE - backlight_task(); -#endif -}; diff --git a/keyboards/woodkeys/bigseries/3key/3key.c b/keyboards/woodkeys/bigseries/3key/3key.c deleted file mode 100755 index a2ebca4fe0..0000000000 --- a/keyboards/woodkeys/bigseries/3key/3key.c +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2018 Cole Markham - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#include "quantum.h" - -void matrix_scan_kb(void) { - // Looping keyboard code goes here - // This runs every cycle (a lot) - matrix_scan_user(); -#ifdef BACKLIGHT_ENABLE - backlight_task(); -#endif -}; diff --git a/keyboards/woodkeys/meira/meira.c b/keyboards/woodkeys/meira/meira.c index cca87a1b51..2141c171c8 100644 --- a/keyboards/woodkeys/meira/meira.c +++ b/keyboards/woodkeys/meira/meira.c @@ -31,12 +31,10 @@ void matrix_init_kb(void) matrix_init_user(); } -void matrix_scan_kb(void) -{ +void housekeeping_task_kb(void) { #ifdef WATCHDOG_ENABLE wdt_reset(); #endif - matrix_scan_user(); } bool process_record_kb(uint16_t keycode, keyrecord_t *record) {