Various fixes for keyboards not implementing callbacks correctly (#24092)

This commit is contained in:
Joel Challis 2024-07-11 13:47:53 +01:00 committed by GitHub
parent 23c4704123
commit e0809eade5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 58 additions and 16 deletions

View file

@ -19,10 +19,12 @@
// Tested and verified working on EXT65 Rev3 // Tested and verified working on EXT65 Rev3
void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); } void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); }
void keyboard_pre_init_user(void) { void keyboard_pre_init_kb(void) {
// Call the keyboard pre init code. // Call the keyboard pre init code.
// Set our LED pins as output // Set our LED pins as output
gpio_set_pin_output(LED_LAYERS_PIN); gpio_set_pin_output(LED_LAYERS_PIN);
keyboard_pre_init_user();
} }
layer_state_t layer_state_set_kb(layer_state_t state) { layer_state_t layer_state_set_kb(layer_state_t state) {

View file

@ -26,6 +26,8 @@ void matrix_scan_kb(void) {
max7219_message_sign_task(true); max7219_message_sign_task(true);
led_frame_timer = timer_read(); led_frame_timer = timer_read();
} }
matrix_scan_user();
} }
#endif #endif

View file

@ -1,23 +1,27 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */ // SPDX-License-Identifier: GPL-2.0-or-later
#include "quantum.h" #include "quantum.h"
void matrix_init_user(void) { void matrix_init_kb(void) {
gpio_set_pin_output(GP9); //init gpio gpio_set_pin_output(GP9); //init gpio
gpio_write_pin_low(GP9); gpio_write_pin_low(GP9);
gpio_set_pin_output(GP11); //init and turn off inverted power led gpio_set_pin_output(GP11); //init and turn off inverted power led
gpio_write_pin_high(GP11); gpio_write_pin_high(GP11);
matrix_init_user();
} }
//layer, capslock and numlock //layer, capslock and numlock
layer_state_t layer_state_set_user(layer_state_t state) { __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
gpio_write_pin(GP9, layer_state_cmp(state, 1)); gpio_write_pin(GP9, layer_state_cmp(state, 1));
return state; return state;
} }
bool led_update_user(led_t led_state) { bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
led_state.num_lock = !led_state.num_lock; led_state.num_lock = !led_state.num_lock;
led_update_ports(led_state); led_update_ports(led_state);
return false; }
return res;
} }

View file

@ -168,6 +168,10 @@ led_config_t g_led_config = { {
#endif #endif
bool process_record_kb(uint16_t keycode, keyrecord_t *record) { bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
if (record->event.pressed) { if (record->event.pressed) {
switch(keycode) { switch(keycode) {
#if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) #if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE)

View file

@ -17,6 +17,8 @@
#include "quantum.h" #include "quantum.h"
void keyboard_post_init_user(void) { void keyboard_post_init_kb(void) {
rgblight_setrgb(0xff, 0xff, 0xff); rgblight_setrgb(0xff, 0xff, 0xff);
keyboard_post_init_user();
} }

View file

@ -165,6 +165,10 @@ bool rgb_matrix_indicators_kb(void) {
#endif //RGB_MATRIX_ENABLE #endif //RGB_MATRIX_ENABLE
bool process_record_kb(uint16_t keycode, keyrecord_t *record) { bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
if (record->event.pressed) { if (record->event.pressed) {
switch(keycode) { switch(keycode) {
#if defined(RGB_MATRIX_DISABLE_KEYCODES) #if defined(RGB_MATRIX_DISABLE_KEYCODES)

View file

@ -169,6 +169,10 @@ bool rgb_matrix_indicators_kb(void) {
#endif //RGB_MATRIX_ENABLE #endif //RGB_MATRIX_ENABLE
bool process_record_kb(uint16_t keycode, keyrecord_t *record) { bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
if (record->event.pressed) { if (record->event.pressed) {
switch(keycode) { switch(keycode) {
#if defined(RGB_MATRIX_DISABLE_KEYCODES) #if defined(RGB_MATRIX_DISABLE_KEYCODES)

View file

@ -131,6 +131,10 @@ bool rgb_matrix_indicators_kb(void) {
#endif #endif
bool process_record_kb(uint16_t keycode, keyrecord_t *record) { bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
if (record->event.pressed) { if (record->event.pressed) {
switch(keycode) { switch(keycode) {
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE

View file

@ -223,6 +223,10 @@ layer_state_t layer_state_set_user(layer_state_t state) {
#endif #endif
bool process_record_kb(uint16_t keycode, keyrecord_t *record) { bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
if (record->event.pressed) { if (record->event.pressed) {
switch(keycode) { switch(keycode) {
#ifdef RGB_MATRIX_DISABLE_KEYCODES #ifdef RGB_MATRIX_DISABLE_KEYCODES

View file

@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h" #include "quantum.h"
void keyboard_pre_init_user(void) { void keyboard_pre_init_kb(void) {
// Call the keyboard pre init code.
// Set our LED pins as output // Set our LED pins as output
gpio_set_pin_output(D7); gpio_set_pin_output(D7);
keyboard_pre_init_user();
} }

View file

@ -17,8 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h" #include "quantum.h"
void keyboard_pre_init_user(void) { void keyboard_pre_init_kb(void) {
// Call the keyboard pre init code.
// Set our LED pins as output // Set our LED pins as output
gpio_set_pin_output(B7); gpio_set_pin_output(B7);
keyboard_pre_init_user();
} }

View file

@ -1,10 +1,12 @@
#include "omnikeyish.h" #include "omnikeyish.h"
void keyboard_pre_init_user(void) { void keyboard_pre_init_kb(void) {
dynamic_macro_init(); dynamic_macro_init();
keyboard_pre_init_user();
} }
void keyboard_post_init_user(void) { void keyboard_post_init_kb(void) {
/* Customise these values to desired behaviour */ /* Customise these values to desired behaviour */
//debug_enable = true; //debug_enable = true;
//debug_matrix=true; //debug_matrix=true;
@ -19,6 +21,8 @@ void keyboard_post_init_user(void) {
/* Send numlock keycode to attempt to force numlock back on. */ /* Send numlock keycode to attempt to force numlock back on. */
register_code(KC_NUM_LOCK); register_code(KC_NUM_LOCK);
unregister_code(KC_NUM_LOCK); unregister_code(KC_NUM_LOCK);
keyboard_post_init_user();
} }
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {

View file

@ -162,6 +162,9 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
} }
bool process_record_kb(uint16_t keycode, keyrecord_t *record) { bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) { switch (keycode) {

View file

@ -97,6 +97,10 @@ void keyboard_post_init_kb(void) {
#endif #endif
bool process_record_kb(uint16_t keycode, keyrecord_t *record) { bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch(keycode) { switch(keycode) {
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
case URGB_K: case URGB_K: