Refactor use of matrix_scan_kb (#24200)

This commit is contained in:
Joel Challis 2024-07-27 06:02:51 +01:00 committed by GitHub
parent 20ae67ba01
commit 02b43b4b60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 20 additions and 164 deletions

View File

@ -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){

View File

@ -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) {

View File

@ -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

View File

@ -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) {

View File

@ -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

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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();
}

View File

@ -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();
}

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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) {

View File

@ -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){

View File

@ -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();
}

View File

@ -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){

View File

@ -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){

View File

@ -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) {

View File

@ -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);

View File

@ -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);
}

View File

@ -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();
}

View File

@ -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))

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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
};

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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
};

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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
};

View File

@ -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) {