mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 19:39:27 +00:00
ESC/GRAVE/TILDE better handling (#1307)
* revise HHKB bootloader_size to 4096 such that sw reset works * cleanup esr/grave/tilde handling function
This commit is contained in:
parent
8da442f411
commit
aaa01d0a4e
@ -50,35 +50,28 @@ const uint16_t PROGMEM fn_actions[] = {
|
|||||||
|
|
||||||
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
|
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
|
||||||
static uint8_t mods_pressed;
|
static uint8_t mods_pressed;
|
||||||
static bool mod_flag;
|
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case 0:
|
case 0:
|
||||||
/* Handle the combined Grave/Esc key
|
/* Handle the combined Grave/Esc key
|
||||||
*/
|
*/
|
||||||
mods_pressed = get_mods()&GRAVE_MODS; // Check to see what mods are pressed
|
|
||||||
|
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
/* The key is being pressed.
|
/* The key is being pressed.
|
||||||
*/
|
*/
|
||||||
|
mods_pressed = get_mods()&GRAVE_MODS; // Check to see what mods are pressed
|
||||||
if (mods_pressed) {
|
if (mods_pressed) {
|
||||||
mod_flag = true;
|
register_code(KC_GRV);
|
||||||
add_key(KC_GRV);
|
|
||||||
send_keyboard_report();
|
|
||||||
} else {
|
} else {
|
||||||
add_key(KC_ESC);
|
register_code(KC_ESC);
|
||||||
send_keyboard_report();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* The key is being released.
|
/* The key is being released.
|
||||||
*/
|
*/
|
||||||
if (mod_flag) {
|
if (mods_pressed) {
|
||||||
mod_flag = false;
|
mods_pressed = false;
|
||||||
del_key(KC_GRV);
|
unregister_code(KC_GRV);
|
||||||
send_keyboard_report();
|
|
||||||
} else {
|
} else {
|
||||||
del_key(KC_ESC);
|
unregister_code(KC_ESC);
|
||||||
send_keyboard_report();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user