diff options
Diffstat (limited to 'keyboards/nack/keymaps/farfalleflickan/keymap.h')
| -rw-r--r-- | keyboards/nack/keymaps/farfalleflickan/keymap.h | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/keyboards/nack/keymaps/farfalleflickan/keymap.h b/keyboards/nack/keymaps/farfalleflickan/keymap.h new file mode 100644 index 000000000..212f45ffd --- /dev/null +++ b/keyboards/nack/keymaps/farfalleflickan/keymap.h | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | /* Copyright 2020 farfalleflickan <farfalleflickan@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | #include "quantum.h" | ||
| 19 | |||
| 20 | void add_to_prev(uint16_t kc); | ||
| 21 | void unreg_prev(void); | ||
| 22 | void timer_timeout_keymap(void); | ||
| 23 | bool process_record_user(uint16_t keycode, keyrecord_t *record); | ||
| 24 | |||
| 25 | // Normal shift status | ||
| 26 | #define SHIFT_NORM(kc1, kc2) \ | ||
| 27 | if (record->event.pressed) { \ | ||
| 28 | timer_timeout_keymap(); \ | ||
| 29 | if (lshift) { \ | ||
| 30 | register_code(KC_LSFT); \ | ||
| 31 | unregister_code(kc2); \ | ||
| 32 | register_code(kc2); \ | ||
| 33 | add_to_prev(kc2); \ | ||
| 34 | } else { \ | ||
| 35 | unregister_code(KC_LSFT); \ | ||
| 36 | unregister_code(kc1); \ | ||
| 37 | register_code(kc1); \ | ||
| 38 | } \ | ||
| 39 | } else { \ | ||
| 40 | unregister_code(kc1); \ | ||
| 41 | unregister_code(kc2); \ | ||
| 42 | } \ | ||
| 43 | return false; | ||
| 44 | |||
| 45 | // Always shifted | ||
| 46 | #define SHIFT_ALL(kc1, kc2) \ | ||
| 47 | if (record->event.pressed) { \ | ||
| 48 | timer_timeout_keymap(); \ | ||
| 49 | register_code(KC_LSFT); \ | ||
| 50 | if (lshift) { \ | ||
| 51 | unregister_code(kc2); \ | ||
| 52 | register_code(kc2); \ | ||
| 53 | add_to_prev(kc2); \ | ||
| 54 | } else { \ | ||
| 55 | unregister_code(kc1); \ | ||
| 56 | register_code(kc1); \ | ||
| 57 | add_to_prev(kc1); \ | ||
| 58 | } \ | ||
| 59 | } else { \ | ||
| 60 | unregister_code(kc1); \ | ||
| 61 | unregister_code(kc2); \ | ||
| 62 | unreg_prev(); \ | ||
| 63 | if (lshift) \ | ||
| 64 | register_code(KC_LSFT); \ | ||
| 65 | else \ | ||
| 66 | unregister_code(KC_LSFT); \ | ||
| 67 | } \ | ||
| 68 | return false; | ||
| 69 | |||
| 70 | // Never shifted | ||
| 71 | #define SHIFT_NO(kc1, kc2) \ | ||
| 72 | if (record->event.pressed) { \ | ||
| 73 | timer_timeout_keymap(); \ | ||
| 74 | unregister_code(KC_LSFT); \ | ||
| 75 | if (lshift) { \ | ||
| 76 | unregister_code(kc2); \ | ||
| 77 | register_code(kc2); \ | ||
| 78 | add_to_prev(kc2); \ | ||
| 79 | } else { \ | ||
| 80 | unregister_code(kc1); \ | ||
| 81 | register_code(kc1); \ | ||
| 82 | } \ | ||
| 83 | } else { \ | ||
| 84 | unregister_code(kc1); \ | ||
| 85 | unregister_code(kc2); \ | ||
| 86 | unreg_prev(); \ | ||
| 87 | if (lshift) \ | ||
| 88 | register_code(KC_LSFT); \ | ||
| 89 | else \ | ||
| 90 | unregister_code(KC_LSFT); \ | ||
| 91 | } \ | ||
| 92 | return false; | ||
| 93 | |||
| 94 | //Never RALT | ||
| 95 | #define RALT_NO(kc1, kc2) \ | ||
| 96 | if (record->event.pressed) { \ | ||
| 97 | timer_timeout_keymap(); \ | ||
| 98 | unregister_code(KC_RALT); \ | ||
| 99 | if (ralt) { \ | ||
| 100 | unregister_code(kc2); \ | ||
| 101 | register_code(kc2); \ | ||
| 102 | add_to_prev(kc2); \ | ||
| 103 | } else { \ | ||
| 104 | unregister_code(kc1); \ | ||
| 105 | register_code(kc1); \ | ||
| 106 | } \ | ||
| 107 | } else { \ | ||
| 108 | unregister_code(kc1); \ | ||
| 109 | unregister_code(kc2); \ | ||
| 110 | unreg_prev(); \ | ||
| 111 | if (ralt) \ | ||
| 112 | register_code(KC_RALT); \ | ||
| 113 | else \ | ||
| 114 | unregister_code(KC_RALT); \ | ||
| 115 | } \ | ||
| 116 | return false; | ||
