diff options
author | Ante Laurijssen <antelaurijssen@gmail.com> | 2017-06-08 04:01:28 +0200 |
---|---|---|
committer | Ante Laurijssen <antelaurijssen@gmail.com> | 2017-06-08 04:01:28 +0200 |
commit | 8f80f35186353801b960d536339b70f43f484c46 (patch) | |
tree | 25a2269970bdabe4a40d2e246a168abdd8de11e1 /keyboards | |
parent | 1b8ed53f21702d279dc5b5bffc2d0213943a22ad (diff) | |
download | qmk_firmware-8f80f35186353801b960d536339b70f43f484c46.tar.gz qmk_firmware-8f80f35186353801b960d536339b70f43f484c46.tar.xz |
Working on Morse Code Macros
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/s60_x/keymaps/bluebear/keymap.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/keyboards/s60_x/keymaps/bluebear/keymap.c b/keyboards/s60_x/keymaps/bluebear/keymap.c index 22356db2b..1ecddb8d5 100644 --- a/keyboards/s60_x/keymaps/bluebear/keymap.c +++ b/keyboards/s60_x/keymaps/bluebear/keymap.c @@ -407,21 +407,36 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -// Macros +// Custom Function - Check if shift is pressed + +bool check_shift(void); + +bool check_shift() { + if (keyboard_report->mods & (MOD_BIT(KC_LSHIFT))) { + return KC_LSHIFT; + } + if (keyboard_report->mods & (MOD_BIT(KC_RSHIFT))) { + return KC_RSHIFT; + } + else { + return false; + } +} + +// Morse Code Macros const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + uint16_t is_shift = check_shift(); switch(id) { - - // Morse Code Macros - case 0: //Number 0-) if (record->event.pressed) { - if (keyboard_report->mods & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) { - clear_mods(); - return MACRO(T(MINS), T(DOT), T(MINS), T(MINS), T(DOT), T(MINS), T(SPACE), END); //-.--.- - } + if (is_shift == false) { + return MACRO(T(MINS), T(MINS), T(MINS), T(MINS), T(MINS), T(SPACE), END); //----- + } else { - return MACRO(T(MINS), T(MINS), T(MINS), T(MINS), T(MINS), T(SPACE), END); //----- + unregister_mods(MOD_BIT(is_shift)); + return MACRO(T(MINS), T(DOT), T(MINS), T(MINS), T(DOT), T(MINS), T(SPACE), END); //-.--.- + register_code(is_shift); } } break; |