qmk_firmware/keyboards/dz60/keymaps/_bonfire/keymap-parts/functions.c
Ethan Beyer 45e71aedf0 [Keymap] My DZ60 Layout and files (#7537)
* I don't know if this is how my keyboard is laid out or not

* testing, still broken

* name change

* I think this is the layout I will try to use to start

* it compiles!

* added norman layout!

* media keys

* Moved backlight functions to KEYB
Moved Delete off of Backspace and to the < key

* more changes to layout, move Norman to 1 so it was moddable by FCTN

* swapped volume and media, I use volume a lot more than media

* Eh, it's still all in flux.

* I don't want the entire function layer full of dead keys, after all...

* moves escape to the caps lock key and caps lock to the functions layer

* update my readme for posterity

* Updates bonfire dz60 for better escape control

* WIP commit -- this is not working yet

* updates keymap for GAME layer
adds info to README
adds visual keyboard layout map in json and jpg for reference

* updates readme for visual keymap insertion

* removes my layout from the parent folder and keeps it localized

* updates the C code to be more readable

* finished the HELD_ESCAPE code

* finishes v6.1.0

* updates layout names to match repo code style per @mechmerlin

Apply suggestions from code review

* updates to code style per suggestions by @mechmerlin

* Update global-functions.c

updates some personal documentation

* updates hold time for escape on gaming layer

* updates several aspects of the code based on PR requests

* moves a variable
2019-12-12 02:53:39 -08:00

34 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);
}
}