keymap: Allow ghost keys to be pressed once the ghost is removed
- Don't record a ghost key as pressed - Debouce on ghost release to allow ghosts to settle. - Reduce debounce time from 20ms to 15ms. Signed-off-by: Evan Lojewski <github@meklort.com>
This commit is contained in:
parent
de7d507277
commit
a6093d8708
@ -30,7 +30,7 @@ void kbscan_init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Debounce time in milliseconds
|
// Debounce time in milliseconds
|
||||||
#define DEBOUNCE_DELAY 20
|
#define DEBOUNCE_DELAY 15
|
||||||
|
|
||||||
static uint8_t kbscan_get_row(int i) {
|
static uint8_t kbscan_get_row(int i) {
|
||||||
// Set current line as output
|
// Set current line as output
|
||||||
@ -192,7 +192,7 @@ bool kbscan_press(uint16_t key, bool pressed, uint8_t * layer) {
|
|||||||
if (pressed) {
|
if (pressed) {
|
||||||
uint8_t sci = SCI_EXTRA;
|
uint8_t sci = SCI_EXTRA;
|
||||||
sci_extra = (uint8_t)(key & 0xFF);
|
sci_extra = (uint8_t)(key & 0xFF);
|
||||||
|
|
||||||
// HACK FOR HARDWARE HOTKEYS
|
// HACK FOR HARDWARE HOTKEYS
|
||||||
switch (sci_extra) {
|
switch (sci_extra) {
|
||||||
case SCI_EXTRA_KBD_BKL:
|
case SCI_EXTRA_KBD_BKL:
|
||||||
@ -215,6 +215,7 @@ void kbscan_event(void) {
|
|||||||
uint8_t layer = kbscan_layer;
|
uint8_t layer = kbscan_layer;
|
||||||
static uint8_t kbscan_last[KM_OUT] = { 0 };
|
static uint8_t kbscan_last[KM_OUT] = { 0 };
|
||||||
static uint8_t kbscan_last_layer[KM_OUT][KM_IN] = { { 0 } };
|
static uint8_t kbscan_last_layer[KM_OUT][KM_IN] = { { 0 } };
|
||||||
|
static bool kbscan_ghost[KM_OUT] = { false };
|
||||||
|
|
||||||
static bool debounce = false;
|
static bool debounce = false;
|
||||||
static uint32_t debounce_time = 0;
|
static uint32_t debounce_time = 0;
|
||||||
@ -242,8 +243,12 @@ void kbscan_event(void) {
|
|||||||
uint8_t last = kbscan_last[i];
|
uint8_t last = kbscan_last[i];
|
||||||
if (new != last) {
|
if (new != last) {
|
||||||
if (kbscan_has_ghost_in_row(i, new)) {
|
if (kbscan_has_ghost_in_row(i, new)) {
|
||||||
kbscan_last[i] = new;
|
kbscan_ghost[i] = true;
|
||||||
continue;
|
continue;
|
||||||
|
} else if (kbscan_ghost[i]) {
|
||||||
|
kbscan_ghost[i] = false;
|
||||||
|
// Debounce to allow remaining ghosts to settle.
|
||||||
|
debounce = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A key was pressed or released
|
// A key was pressed or released
|
||||||
|
Loading…
x
Reference in New Issue
Block a user