From 3f30fbbc1c6c45db55ab5a7bc30fd6b937d439c9 Mon Sep 17 00:00:00 2001 From: yangdigi Date: Tue, 7 Nov 2023 13:57:46 +0800 Subject: [PATCH] to avoid all the keys being down in some cases like KEY is connected to GND --- keyboards/ydkb/unicore_f1/config.h | 2 +- keyboards/ydkb/unicore_f1/matrix.c | 9 ++++++--- keyboards/ydkb/unicore_f1/switch_board.h | 2 +- tmk_core/protocol/chibios.mk | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/keyboards/ydkb/unicore_f1/config.h b/keyboards/ydkb/unicore_f1/config.h index bbb32961fc6..68a0ee1bb29 100644 --- a/keyboards/ydkb/unicore_f1/config.h +++ b/keyboards/ydkb/unicore_f1/config.h @@ -4,7 +4,7 @@ #include "config_common.h" /* USB Device descriptor parameter */ -#define FW_VER DNB4 +#define FW_VER DNB7 #define VENDOR_ID 0x9D5B #define PRODUCT_ID 0x23FA #define DEVICE_VER 0x0001 diff --git a/keyboards/ydkb/unicore_f1/matrix.c b/keyboards/ydkb/unicore_f1/matrix.c index 3cea0615a07..b9fbb15d326 100644 --- a/keyboards/ydkb/unicore_f1/matrix.c +++ b/keyboards/ydkb/unicore_f1/matrix.c @@ -68,6 +68,11 @@ void matrix_init(void) init_cols(); } +//for qmk +static bool prevent_key_press = 0; +bool should_process_keypress(void) { + return is_keyboard_master(); +} uint8_t matrix_scan(void) { @@ -126,9 +131,7 @@ uint8_t matrix_scan(void) } // to avoid all the keys being down in some cases like KEY is connected to GND. - if (matrix_keys_down == MATRIX_ROWS * MATRIX_COLS) { - memset(matrix, 0, sizeof(matrix)); - } + prevent_key_press = (matrix_keys_down == MATRIX_ROWS * MATRIX_COLS); // no key down, set matrix_idle. if (matrix_keys_down == 0) { diff --git a/keyboards/ydkb/unicore_f1/switch_board.h b/keyboards/ydkb/unicore_f1/switch_board.h index 92567e8a53e..09f9c1a5767 100644 --- a/keyboards/ydkb/unicore_f1/switch_board.h +++ b/keyboards/ydkb/unicore_f1/switch_board.h @@ -20,7 +20,7 @@ static inline void select_key_ready(void) { #define CLOCK_PULSE() \ do { \ palSetPad(GPIOB, 12); \ - asm("nop"); \ + asm("nop"); asm("nop"); \ palClearPad(GPIOB, 12); \ } while(0) #endif diff --git a/tmk_core/protocol/chibios.mk b/tmk_core/protocol/chibios.mk index a7f2d8e93d1..c5bbd4b32af 100644 --- a/tmk_core/protocol/chibios.mk +++ b/tmk_core/protocol/chibios.mk @@ -19,3 +19,5 @@ OPT_DEFS += -DFIXED_NUM_CONFIGURATIONS=1 ifeq ($(strip $(MIDI_ENABLE)), yes) include $(TMK_PATH)/protocol/midi.mk endif + +ALLOW_WARNINGS = yes \ No newline at end of file