diff options
| author | Skyler Lewis <sblnog@gmail.com> | 2018-12-11 13:43:56 -0700 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-12-11 12:43:56 -0800 |
| commit | 200ee8e7973f47dd3a497b65c6ecf7ee3f5051ab (patch) | |
| tree | 2070b58a8de293ce0a0d5f42dbab13e371aff458 /keyboards/dichotomy | |
| parent | 7c63c0a95075f6fb4dd94d020ceb5816e6bcca2c (diff) | |
| download | qmk_firmware-200ee8e7973f47dd3a497b65c6ecf7ee3f5051ab.tar.gz qmk_firmware-200ee8e7973f47dd3a497b65c6ecf7ee3f5051ab.zip | |
Keymap: Dichotomy keymap by alairock (#4608)
* dichotemy layout for alairock
* dichotemy layout for alairock
* complete overhaul
* fix suggestions
Diffstat (limited to 'keyboards/dichotomy')
| -rw-r--r-- | keyboards/dichotomy/keymaps/alairock/keymap.c | 196 |
1 files changed, 196 insertions, 0 deletions
diff --git a/keyboards/dichotomy/keymaps/alairock/keymap.c b/keyboards/dichotomy/keymaps/alairock/keymap.c new file mode 100644 index 000000000..f39a226b7 --- /dev/null +++ b/keyboards/dichotomy/keymaps/alairock/keymap.c | |||
| @@ -0,0 +1,196 @@ | |||
| 1 | // this is the style you want to emulate. | ||
| 2 | // This is the canonical layout file for the Quantum project. If you want to add another keyboard, | ||
| 3 | |||
| 4 | #include QMK_KEYBOARD_H | ||
| 5 | |||
| 6 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 7 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 8 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 9 | // entirely and just use numbers. | ||
| 10 | #define _QWERTY 0 | ||
| 11 | #define _LOWER 1 | ||
| 12 | #define _RAISE 2 | ||
| 13 | #define _MOUSE 8 | ||
| 14 | #define _ADJUST 16 | ||
| 15 | |||
| 16 | |||
| 17 | enum dichotomy_keycodes | ||
| 18 | { | ||
| 19 | QWERTY = SAFE_RANGE, | ||
| 20 | LOWER, | ||
| 21 | RAISE, | ||
| 22 | ADJUST, | ||
| 23 | MOUKEY, | ||
| 24 | MS_BTN1, | ||
| 25 | MS_BTN2, | ||
| 26 | MS_BTN3 | ||
| 27 | }; | ||
| 28 | |||
| 29 | #define RED_BRIGHTNESS 3 | ||
| 30 | #define GREEN_BRIGHTNESS 2 | ||
| 31 | #define BLUE_BRIGHTNESS 2 | ||
| 32 | |||
| 33 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 34 | |||
| 35 | |||
| 36 | [_QWERTY] = LAYOUT( /* Base layout, nearly qwerty but with modifications because it's not a full keyboard. Obviously. */ | ||
| 37 | KC_ESCAPE, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, | ||
| 38 | KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, | ||
| 39 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, MOUKEY, | ||
| 40 | KC_LCTL, KC_LALT, MOUKEY, KC_RGUI, KC_RALT, KC_RCTL, | ||
| 41 | MS_BTN3, SFT_T(KC_ESCAPE), KC_LGUI, KC_BSPC, KC_SPC, RAISE, LOWER, MS_BTN3 | ||
| 42 | ), | ||
| 43 | |||
| 44 | [_RAISE] = LAYOUT( /* Shifted layout, small changes (because angle brackets have been moved to thumb cluster buttons) */ | ||
| 45 | _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, | ||
| 46 | _______, _______, KC_VOLD, KC_VOLU, KC_MPLY, KC_MFFD, KC_MUTE, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, _______, | ||
| 47 | _______, _______, _______, _______, _______, KC_MRWD, _______, _______, _______, KC_BSLS, KC_QUOT, _______, | ||
| 48 | _______, _______, _______, _______, _______, _______, | ||
| 49 | _______, _______, KC_LABK, _______, _______, KC_RABK, _______, _______ | ||
| 50 | ), | ||
| 51 | |||
| 52 | [_LOWER] = LAYOUT( /* Number layout, basically the main function layer */ | ||
| 53 | _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, | ||
| 54 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, _______, | ||
| 55 | _______, KC_TILD, KC_GRV, KC_F13, KC_F14, KC_F15, KC_F16, KC_F7, KC_F8, KC_F9, KC_F10, _______, | ||
| 56 | _______, _______, _______, _______, _______, _______, | ||
| 57 | _______, RAISE, _______, _______, _______, _______, _______, _______ | ||
| 58 | ), | ||
| 59 | |||
| 60 | [_ADJUST] = LAYOUT( /* Shifted number/function layout, for per-key control. Only active when shift is held, and number is toggled or held */ | ||
| 61 | _______, _______, _______, _______, _______, _______, _______, _______, KC_UP, _______, _______, _______, | ||
| 62 | _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, | ||
| 63 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 64 | _______, _______, _______, _______, _______, _______, | ||
| 65 | _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 66 | ), | ||
| 67 | |||
| 68 | [_MOUSE] = LAYOUT( /* Mouse layer, including buttons for clicking. */ | ||
| 69 | _______, _______, _______, _______, _______, _______, KC_VOLU, KC_HOME, KC_PGUP, _______, _______, _______, | ||
| 70 | _______, _______, _______, _______, _______, _______, _______, MS_BTN1, MS_BTN2, _______, _______, _______, | ||
| 71 | _______, _______, _______, _______, _______, _______, KC_VOLD, KC_END, KC_PGDN, _______, _______, _______, | ||
| 72 | _______, _______, _______, _______, KC_UP, _______, | ||
| 73 | _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______ | ||
| 74 | ) | ||
| 75 | |||
| 76 | }; // end keymaps block | ||
| 77 | |||
| 78 | static bool shift_held = false; | ||
| 79 | static bool shift_suspended = false; | ||
| 80 | report_mouse_t currentReport = {}; | ||
| 81 | |||
| 82 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 83 | switch (keycode) { | ||
| 84 | case QWERTY: | ||
| 85 | if (record->event.pressed) { | ||
| 86 | set_single_persistent_default_layer(_QWERTY); | ||
| 87 | } | ||
| 88 | return false; | ||
| 89 | break; | ||
| 90 | case LOWER: | ||
| 91 | if (record->event.pressed) { | ||
| 92 | layer_on(_LOWER); | ||
| 93 | grn_led_on(); | ||
| 94 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 95 | } else { | ||
| 96 | layer_off(_LOWER); | ||
| 97 | grn_led_off(); | ||
| 98 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 99 | } | ||
| 100 | return false; | ||
| 101 | break; | ||
| 102 | //SHIFT is handled as LSHIFT in the general case - 'toggle' shoudl activate caps, while the layer is only active when shift is held. | ||
| 103 | case RAISE: | ||
| 104 | if (record->event.pressed) { | ||
| 105 | layer_on(_RAISE); | ||
| 106 | red_led_on(); | ||
| 107 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 108 | } else { | ||
| 109 | layer_off(_RAISE); | ||
| 110 | red_led_off(); | ||
| 111 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 112 | } | ||
| 113 | return false; | ||
| 114 | break; | ||
| 115 | case ADJUST: | ||
| 116 | if (record->event.pressed) { | ||
| 117 | layer_on(_ADJUST); | ||
| 118 | } else { | ||
| 119 | layer_off(_ADJUST); | ||
| 120 | } | ||
| 121 | return false; | ||
| 122 | break; | ||
| 123 | //MOUSE layer needs to be handled the same way as NUMKEY, but differently from shift | ||
| 124 | case MOUKEY: | ||
| 125 | if (record->event.pressed) { | ||
| 126 | layer_on(_MOUSE); | ||
| 127 | blu_led_on(); | ||
| 128 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 129 | } else { | ||
| 130 | layer_off(_MOUSE); | ||
| 131 | blu_led_off(); | ||
| 132 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 133 | } | ||
| 134 | return false; | ||
| 135 | break; | ||
| 136 | |||
| 137 | //mouse buttons, for 1-3, to update the mouse report: | ||
| 138 | case MS_BTN1: | ||
| 139 | currentReport = pointing_device_get_report(); | ||
| 140 | if (record->event.pressed) { | ||
| 141 | if (shift_held && shift_suspended){ | ||
| 142 | register_code(KC_LSFT); | ||
| 143 | shift_suspended = false; | ||
| 144 | } | ||
| 145 | //update mouse report here | ||
| 146 | currentReport.buttons |= MOUSE_BTN1; //MOUSE_BTN1 is a const defined in report.h | ||
| 147 | } else { | ||
| 148 | //update mouse report here | ||
| 149 | currentReport.buttons &= ~MOUSE_BTN1; | ||
| 150 | } | ||
| 151 | pointing_device_set_report(currentReport); | ||
| 152 | return false; | ||
| 153 | break; | ||
| 154 | case MS_BTN2: | ||
| 155 | currentReport = pointing_device_get_report(); | ||
| 156 | if (record->event.pressed) { | ||
| 157 | if (shift_held && shift_suspended){ | ||
| 158 | register_code(KC_LSFT); | ||
| 159 | shift_suspended = false; | ||
| 160 | } | ||
| 161 | //update mouse report here | ||
| 162 | currentReport.buttons |= MOUSE_BTN2; //MOUSE_BTN2 is a const defined in report.h | ||
| 163 | } else { | ||
| 164 | //update mouse report here | ||
| 165 | currentReport.buttons &= ~MOUSE_BTN2; | ||
| 166 | } | ||
| 167 | pointing_device_set_report(currentReport); | ||
| 168 | return false; | ||
| 169 | break; | ||
| 170 | case MS_BTN3: | ||
| 171 | currentReport = pointing_device_get_report(); | ||
| 172 | if (record->event.pressed) { | ||
| 173 | if (shift_held && shift_suspended){ | ||
| 174 | register_code(KC_LSFT); | ||
| 175 | shift_suspended = false; | ||
| 176 | } | ||
| 177 | //update mouse report here | ||
| 178 | currentReport.buttons |= MOUSE_BTN3; //MOUSE_BTN3 is a const defined in report.h | ||
| 179 | } else { | ||
| 180 | //update mouse report here | ||
| 181 | currentReport.buttons &= ~MOUSE_BTN3; | ||
| 182 | } | ||
| 183 | pointing_device_set_report(currentReport); | ||
| 184 | return false; | ||
| 185 | break; | ||
| 186 | //Additionally, if NS_ keys are in use, then shift may be held (but is | ||
| 187 | //disabled for the unshifted keycodes to be send. Check the bool and | ||
| 188 | //register shift as necessary. | ||
| 189 | // default: | ||
| 190 | // if (shift_held){ | ||
| 191 | // register_code(KC_LSFT); | ||
| 192 | // } | ||
| 193 | // break; | ||
| 194 | } | ||
| 195 | return true; | ||
| 196 | }; | ||
