diff options
| -rw-r--r-- | keyboards/meira/keymaps/takmiya/config.h | 24 | ||||
| -rw-r--r-- | keyboards/meira/keymaps/takmiya/keymap.c | 262 | ||||
| -rw-r--r-- | keyboards/meira/keymaps/takmiya/readme.md | 1 |
3 files changed, 287 insertions, 0 deletions
diff --git a/keyboards/meira/keymaps/takmiya/config.h b/keyboards/meira/keymaps/takmiya/config.h new file mode 100644 index 000000000..97210115b --- /dev/null +++ b/keyboards/meira/keymaps/takmiya/config.h | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | /* Copyright 2017 Cole Markham, WoodKeys.click | ||
| 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 | #ifndef CONFIG_USER_H | ||
| 18 | #define CONFIG_USER_H | ||
| 19 | |||
| 20 | #include "../../config.h" | ||
| 21 | |||
| 22 | // place overrides here | ||
| 23 | |||
| 24 | #endif | ||
diff --git a/keyboards/meira/keymaps/takmiya/keymap.c b/keyboards/meira/keymaps/takmiya/keymap.c new file mode 100644 index 000000000..48602dfaf --- /dev/null +++ b/keyboards/meira/keymaps/takmiya/keymap.c | |||
| @@ -0,0 +1,262 @@ | |||
| 1 | /* Copyright 2017 Cole Markham | ||
| 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 | #include "meira.h" | ||
| 17 | #include "issi.h" | ||
| 18 | #include "lighting.h" | ||
| 19 | |||
| 20 | #ifdef RGBLIGHT_ENABLE | ||
| 21 | //Following line allows macro to read current RGB settings | ||
| 22 | extern rgblight_config_t rgblight_config; | ||
| 23 | #endif | ||
| 24 | |||
| 25 | #define _QWERTY 0 | ||
| 26 | #define _LOWER 1 | ||
| 27 | #define _RAISE 2 | ||
| 28 | #define _ADJUST 16 | ||
| 29 | |||
| 30 | enum custom_keycodes { | ||
| 31 | QWERTY = SAFE_RANGE, | ||
| 32 | LOWER, | ||
| 33 | RAISE, | ||
| 34 | ADJUST, | ||
| 35 | }; | ||
| 36 | |||
| 37 | // define variables for reactive RGB | ||
| 38 | bool TOG_STATUS = false; | ||
| 39 | int RGB_current_mode; | ||
| 40 | |||
| 41 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 42 | /* Qwerty | ||
| 43 | * ,-----------------------------------------------------------------------------------. | ||
| 44 | * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | | ||
| 45 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 46 | * | Esc | A | S | D | F | G | H | J | K | L | ; | ' | | ||
| 47 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 48 | * | Shift| Z | X | C | V | B | N | M | , | . |//GUI |Enter | | ||
| 49 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 50 | * | Ctrl | GUI | Alt | GUI |Lower |Space |Enter |Raise | Left | Down | Up |Right | | ||
| 51 | * `-----------------------------------------------------------------------------------' | ||
| 52 | */ | ||
| 53 | [_QWERTY] = KEYMAP( \ | ||
| 54 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ | ||
| 55 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ | ||
| 56 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, GUI_T(KC_SLSH), KC_ENT, \ | ||
| 57 | KC_LCTL, KC_LGUI, KC_LALT, KC_RGUI, LOWER, KC_SPC, KC_ENT, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | ||
| 58 | ), | ||
| 59 | |||
| 60 | /* Lower | ||
| 61 | * ,-----------------------------------------------------------------------------------. | ||
| 62 | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | DEL | | ||
| 63 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 64 | * | | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | | ||
| 65 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 66 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | | | | ||
| 67 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 68 | * | | | | | | | | | Home | PgUp | PgDn | End | | ||
| 69 | * `-----------------------------------------------------------------------------------' | ||
| 70 | */ | ||
| 71 | [_LOWER] = KEYMAP( \ | ||
| 72 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ | ||
| 73 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ | ||
| 74 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), _______, _______, _______, \ | ||
| 75 | _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END \ | ||
| 76 | ), | ||
| 77 | |||
| 78 | /* Raise | ||
| 79 | * ,-----------------------------------------------------------------------------------. | ||
| 80 | * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | DEL | | ||
| 81 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 82 | * | | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | | ||
| 83 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 84 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | | | | ||
| 85 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 86 | * | | | | | | | | | Home | PgUp | PgDn | End | | ||
| 87 | * `-----------------------------------------------------------------------------------' | ||
| 88 | */ | ||
| 89 | [_RAISE] = KEYMAP( \ | ||
| 90 | KC_GRV , KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ | ||
| 91 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ | ||
| 92 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ | ||
| 93 | _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END \ | ||
| 94 | ), | ||
| 95 | |||
| 96 | /* Adjust (Lower + Raise) | ||
| 97 | * ,-----------------------------------------------------------------------------------. | ||
| 98 | * | | Reset| | | | | | | | | | Del | | ||
| 99 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 100 | * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty| | | | | | ||
| 101 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 102 | * | | | | | | | | | | | | | | ||
| 103 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 104 | * | | | | | | | | | | | | | ||
| 105 | * `-----------------------------------------------------------------------------------' | ||
| 106 | */ | ||
| 107 | [_ADJUST] = KEYMAP( \ | ||
| 108 | BL_TOGG, RESET, _______, KC_MRWD, KC_MPLY, KC_MFFD, KC_PSCR, _______, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, \ | ||
| 109 | BL_STEP, RGB_MOD, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______, \ | ||
| 110 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 111 | _______, KC_PSCR, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ | ||
| 112 | ) | ||
| 113 | }; | ||
| 114 | |||
| 115 | const uint16_t PROGMEM fn_actions[] = { | ||
| 116 | |||
| 117 | }; | ||
| 118 | |||
| 119 | // Setting ADJUST layer RGB back to default | ||
| 120 | void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { | ||
| 121 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { | ||
| 122 | #ifdef RGBLIGHT_ENABLE | ||
| 123 | rgblight_mode(RGB_current_mode); | ||
| 124 | #endif | ||
| 125 | layer_on(layer3); | ||
| 126 | } else { | ||
| 127 | layer_off(layer3); | ||
| 128 | } | ||
| 129 | } | ||
| 130 | |||
| 131 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
| 132 | { | ||
| 133 | // MACRODOWN only works in this function | ||
| 134 | switch(id) { | ||
| 135 | case 0: | ||
| 136 | if (record->event.pressed) { | ||
| 137 | register_code(KC_RSFT); | ||
| 138 | } else { | ||
| 139 | unregister_code(KC_RSFT); | ||
| 140 | } | ||
| 141 | break; | ||
| 142 | } | ||
| 143 | return MACRO_NONE; | ||
| 144 | }; | ||
| 145 | |||
| 146 | |||
| 147 | void matrix_init_user(void) { | ||
| 148 | |||
| 149 | } | ||
| 150 | |||
| 151 | void matrix_scan_user(void) { | ||
| 152 | |||
| 153 | } | ||
| 154 | |||
| 155 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 156 | switch (keycode) { | ||
| 157 | case QWERTY: | ||
| 158 | if (record->event.pressed) { | ||
| 159 | #ifdef AUDIO_ENABLE | ||
| 160 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
| 161 | #endif | ||
| 162 | // persistent_default_layer_set(1UL<<_QWERTY); | ||
| 163 | } | ||
| 164 | return false; | ||
| 165 | break; | ||
| 166 | case LOWER: | ||
| 167 | if (record->event.pressed) { | ||
| 168 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
| 169 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
| 170 | if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false | ||
| 171 | } else { | ||
| 172 | TOG_STATUS = !TOG_STATUS; | ||
| 173 | #ifdef RGBLIGHT_ENABLE | ||
| 174 | rgblight_mode(16); | ||
| 175 | #endif | ||
| 176 | } | ||
| 177 | layer_on(_LOWER); | ||
| 178 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 179 | } else { | ||
| 180 | #ifdef RGBLIGHT_ENABLE | ||
| 181 | rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change | ||
| 182 | #endif | ||
| 183 | TOG_STATUS = false; | ||
| 184 | layer_off(_LOWER); | ||
| 185 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 186 | } | ||
| 187 | return false; | ||
| 188 | break; | ||
| 189 | case RAISE: | ||
| 190 | if (record->event.pressed) { | ||
| 191 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
| 192 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
| 193 | if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false | ||
| 194 | } else { | ||
| 195 | TOG_STATUS = !TOG_STATUS; | ||
| 196 | #ifdef RGBLIGHT_ENABLE | ||
| 197 | rgblight_mode(15); | ||
| 198 | #endif | ||
| 199 | } | ||
| 200 | layer_on(_RAISE); | ||
| 201 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 202 | } else { | ||
| 203 | #ifdef RGBLIGHT_ENABLE | ||
| 204 | rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change | ||
| 205 | #endif | ||
| 206 | layer_off(_RAISE); | ||
| 207 | TOG_STATUS = false; | ||
| 208 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 209 | } | ||
| 210 | return false; | ||
| 211 | break; | ||
| 212 | case ADJUST: | ||
| 213 | // FIXME add RGB feedback | ||
| 214 | if (record->event.pressed) { | ||
| 215 | layer_on(_ADJUST); | ||
| 216 | } else { | ||
| 217 | layer_off(_ADJUST); | ||
| 218 | } | ||
| 219 | return false; | ||
| 220 | break; | ||
| 221 | case BL_TOGG: | ||
| 222 | #ifdef ISSI_ENABLE | ||
| 223 | if (record->event.pressed) { | ||
| 224 | print("Enabling backlight\n"); | ||
| 225 | issi_init(); | ||
| 226 | } | ||
| 227 | #endif | ||
| 228 | return false; | ||
| 229 | break; | ||
| 230 | case BL_STEP: | ||
| 231 | if (record->event.pressed) { | ||
| 232 | print("Stepping backlight\n"); | ||
| 233 | #ifdef BACKLIGHT_ENABLE | ||
| 234 | print("Really stepping backlight\n"); | ||
| 235 | backlight_step(); | ||
| 236 | #endif | ||
| 237 | |||
| 238 | } | ||
| 239 | return false; | ||
| 240 | break; | ||
| 241 | //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released | ||
| 242 | #ifdef RGBLIGHT_ENABLE | ||
| 243 | case RGB_MOD: | ||
| 244 | if (record->event.pressed) { | ||
| 245 | rgblight_mode(RGB_current_mode); | ||
| 246 | rgblight_step(); | ||
| 247 | RGB_current_mode = rgblight_config.mode; | ||
| 248 | } | ||
| 249 | return false; | ||
| 250 | break; | ||
| 251 | #endif | ||
| 252 | // case BL_INC: | ||
| 253 | // meira_inc_backlight_level(); | ||
| 254 | // return false; | ||
| 255 | // break; | ||
| 256 | } | ||
| 257 | return true; | ||
| 258 | } | ||
| 259 | |||
| 260 | void led_set_user(uint8_t usb_led) { | ||
| 261 | |||
| 262 | } | ||
diff --git a/keyboards/meira/keymaps/takmiya/readme.md b/keyboards/meira/keymaps/takmiya/readme.md new file mode 100644 index 000000000..40f48bb09 --- /dev/null +++ b/keyboards/meira/keymaps/takmiya/readme.md | |||
| @@ -0,0 +1 @@ | |||
| # The takmiya keymap for meira | |||
