Browse Source

Implement a tricky esc function for GH60

ledmap
Kai Ryu 9 years ago
parent
commit
f59510aea8
2 changed files with 29 additions and 0 deletions
  1. 1
    0
      keyboard/gh60/keymap_common.h
  2. 28
    0
      keyboard/gh60/keymap_poker2.c

+ 1
- 0
keyboard/gh60/keymap_common.h View File

#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include "keycode.h" #include "keycode.h"
#include "action.h" #include "action.h"
#include "action_util.h"
#include "action_macro.h" #include "action_macro.h"
#include "report.h" #include "report.h"
#include "host.h" #include "host.h"

+ 28
- 0
keyboard/gh60/keymap_poker2.c View File

return sizeof(fn_actions) / sizeof(fn_actions[0]); return sizeof(fn_actions) / sizeof(fn_actions[0]);
} }
#endif #endif

enum {
TRICKY_ESC = 0,
};

#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
static uint8_t tricky_esc_registered;
switch (id) {
case TRICKY_ESC:
if (record->event.pressed) {
if (get_mods() & MODS_SHIFT_MASK) {
tricky_esc_registered = KC_GRV;
}
else {
tricky_esc_registered = KC_ESC;
}
register_code(tricky_esc_registered);
send_keyboard_report();
}
else {
unregister_code(tricky_esc_registered);
send_keyboard_report();
}
break;
}
}