Skip to content

Commit

Permalink
to avoid all the keys being down in some cases like KEY is connected …
Browse files Browse the repository at this point in the history
…to GND
  • Loading branch information
yangdigi committed Nov 7, 2023
1 parent d7c1eaa commit 3f30fbb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion keyboards/ydkb/unicore_f1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions keyboards/ydkb/unicore_f1/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion keyboards/ydkb/unicore_f1/switch_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions tmk_core/protocol/chibios.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3f30fbb

Please sign in to comment.