mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-12-04 08:55:10 +00:00
35 lines
796 B
C
35 lines
796 B
C
|
/**
|
||
|
* Custom Keycodes
|
||
|
* https://beta.docs.qmk.fm/detailed-guides/custom_quantum_functions#custom-keycodes
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
// Called on every keyup and keydown
|
||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record)
|
||
|
{
|
||
|
switch (keycode) {
|
||
|
case HLD_ESC:
|
||
|
if(record->event.pressed) {
|
||
|
is_esc_held = true;
|
||
|
held_esc_timer = timer_read();
|
||
|
} else {
|
||
|
is_esc_held = false;
|
||
|
unregister_code(KC_ESC);
|
||
|
}
|
||
|
return true;
|
||
|
break;
|
||
|
|
||
|
default:
|
||
|
return true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// checking the held escape timer
|
||
|
void matrix_scan_user(void)
|
||
|
{
|
||
|
if(is_esc_held && timer_elapsed(held_esc_timer) > held_esc_threshold) {
|
||
|
register_code(KC_ESC);
|
||
|
}
|
||
|
}
|