Various fixes for keyboards not implementing callbacks correctly (#24092)
This commit is contained in:
		
							parent
							
								
									23c4704123
								
							
						
					
					
						commit
						e0809eade5
					
				
					 14 changed files with 58 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -19,10 +19,12 @@
 | 
			
		|||
// Tested and verified working on EXT65 Rev3
 | 
			
		||||
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.
 | 
			
		||||
  // Set our LED pins as output
 | 
			
		||||
  gpio_set_pin_output(LED_LAYERS_PIN);
 | 
			
		||||
 | 
			
		||||
  keyboard_pre_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
layer_state_t layer_state_set_kb(layer_state_t state) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,8 @@ void matrix_scan_kb(void) {
 | 
			
		|||
        max7219_message_sign_task(true);
 | 
			
		||||
        led_frame_timer = timer_read();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    matrix_scan_user();
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,23 +1,27 @@
 | 
			
		|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
 | 
			
		||||
// SPDX-License-Identifier: GPL-2.0-or-later
 | 
			
		||||
 | 
			
		||||
#include "quantum.h"
 | 
			
		||||
 | 
			
		||||
void matrix_init_user(void) {
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
  gpio_set_pin_output(GP9); //init gpio
 | 
			
		||||
  gpio_write_pin_low(GP9);
 | 
			
		||||
  gpio_set_pin_output(GP11); //init and turn off inverted power led
 | 
			
		||||
  gpio_write_pin_high(GP11);
 | 
			
		||||
 | 
			
		||||
  matrix_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//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));
 | 
			
		||||
    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_update_ports(led_state);
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
  return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -168,6 +168,10 @@ led_config_t g_led_config = { {
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    if (!process_record_user(keycode, record)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (record->event.pressed) {
 | 
			
		||||
        switch(keycode) {
 | 
			
		||||
#if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,6 +17,8 @@
 | 
			
		|||
 | 
			
		||||
#include "quantum.h"
 | 
			
		||||
 | 
			
		||||
void keyboard_post_init_user(void) {
 | 
			
		||||
void keyboard_post_init_kb(void) {
 | 
			
		||||
    rgblight_setrgb(0xff, 0xff, 0xff);
 | 
			
		||||
 | 
			
		||||
    keyboard_post_init_user();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -165,6 +165,10 @@ bool rgb_matrix_indicators_kb(void) {
 | 
			
		|||
#endif  //RGB_MATRIX_ENABLE
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    if (!process_record_user(keycode, record)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (record->event.pressed) {
 | 
			
		||||
        switch(keycode) {
 | 
			
		||||
#if defined(RGB_MATRIX_DISABLE_KEYCODES)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -169,6 +169,10 @@ bool rgb_matrix_indicators_kb(void) {
 | 
			
		|||
#endif  //RGB_MATRIX_ENABLE
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    if (!process_record_user(keycode, record)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (record->event.pressed) {
 | 
			
		||||
        switch(keycode) {
 | 
			
		||||
#if defined(RGB_MATRIX_DISABLE_KEYCODES)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -131,6 +131,10 @@ bool rgb_matrix_indicators_kb(void) {
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    if (!process_record_user(keycode, record)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (record->event.pressed) {
 | 
			
		||||
    switch(keycode) {
 | 
			
		||||
    #ifdef RGBLIGHT_ENABLE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -223,6 +223,10 @@ layer_state_t layer_state_set_user(layer_state_t state) {
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    if (!process_record_user(keycode, record)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (record->event.pressed) {
 | 
			
		||||
    switch(keycode) {
 | 
			
		||||
    #ifdef RGB_MATRIX_DISABLE_KEYCODES
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,9 +17,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
 | 
			
		||||
#include "quantum.h"
 | 
			
		||||
 | 
			
		||||
void keyboard_pre_init_user(void) {
 | 
			
		||||
  // Call the keyboard pre init code.
 | 
			
		||||
 | 
			
		||||
void keyboard_pre_init_kb(void) {
 | 
			
		||||
  // Set our LED pins as output
 | 
			
		||||
  gpio_set_pin_output(D7);
 | 
			
		||||
 | 
			
		||||
  keyboard_pre_init_user();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,8 +17,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
 | 
			
		||||
#include "quantum.h"
 | 
			
		||||
 | 
			
		||||
void keyboard_pre_init_user(void) {
 | 
			
		||||
  // Call the keyboard pre init code.
 | 
			
		||||
void keyboard_pre_init_kb(void) {
 | 
			
		||||
  // Set our LED pins as output
 | 
			
		||||
  gpio_set_pin_output(B7);
 | 
			
		||||
 | 
			
		||||
  keyboard_pre_init_user();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,10 +1,12 @@
 | 
			
		|||
#include "omnikeyish.h"
 | 
			
		||||
 | 
			
		||||
void keyboard_pre_init_user(void) {
 | 
			
		||||
void keyboard_pre_init_kb(void) {
 | 
			
		||||
  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 */
 | 
			
		||||
  //debug_enable = true;
 | 
			
		||||
  //debug_matrix=true;
 | 
			
		||||
| 
						 | 
				
			
			@ -19,6 +21,8 @@ void keyboard_post_init_user(void) {
 | 
			
		|||
  /* Send numlock keycode to attempt to force numlock back on. */
 | 
			
		||||
  register_code(KC_NUM_LOCK);
 | 
			
		||||
  unregister_code(KC_NUM_LOCK);
 | 
			
		||||
 | 
			
		||||
  keyboard_post_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
    if (!process_record_user(keycode, record)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    switch (keycode) {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -97,6 +97,10 @@ void keyboard_post_init_kb(void) {
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    if (!process_record_user(keycode, record)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    switch(keycode) {
 | 
			
		||||
#ifdef RGB_MATRIX_ENABLE
 | 
			
		||||
        case URGB_K:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue