Implement key debouncer.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "layer.h"
|
||||
#include "usb_report_updater.h"
|
||||
#include "timer.h"
|
||||
#include "key_debouncer.h"
|
||||
|
||||
uint32_t UsbReportUpdateTime = 0;
|
||||
|
||||
@@ -168,6 +169,13 @@ void UpdateActiveUsbReports(void)
|
||||
key_state_t *keyState = &KeyStates[slotId][keyId];
|
||||
key_action_t *action = &CurrentKeymap[activeLayer][slotId][keyId];
|
||||
|
||||
|
||||
if (keyState->debounceCounter < KEY_DEBOUNCER_TIMEOUT_MSEC) {
|
||||
keyState->current = keyState->previous;
|
||||
} else if (!keyState->previous && keyState->current) {
|
||||
keyState->debounceCounter = 0;
|
||||
}
|
||||
|
||||
if (keyState->current) {
|
||||
if (suppressKeys) {
|
||||
keyState->suppressed = true;
|
||||
|
||||
Reference in New Issue
Block a user