diff options
| author | Philippe Voinov <philippevoinov@gmail.com> | 2017-10-03 19:45:22 +0200 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-10-03 07:45:22 -1000 |
| commit | efbc4d2295f1a68b5d07bc706220e993fffb40f4 (patch) | |
| tree | 069c26fc35d4225290adde57fa1c205d75458536 | |
| parent | 67eeb889ba333063da6430cb4bb41485ea721497 (diff) | |
| download | qmk_firmware-efbc4d2295f1a68b5d07bc706220e993fffb40f4.tar.gz qmk_firmware-efbc4d2295f1a68b5d07bc706220e993fffb40f4.zip | |
Add new planck layout (#1778)
* Custom layout: tehwalris
* Prevent stuck modifiers.
| -rw-r--r-- | keyboards/planck/keymaps/tehwalris/config.h | 44 | ||||
| -rw-r--r-- | keyboards/planck/keymaps/tehwalris/keymap.c | 128 | ||||
| -rw-r--r-- | keyboards/planck/keymaps/tehwalris/rules.mk | 3 |
3 files changed, 175 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/tehwalris/config.h b/keyboards/planck/keymaps/tehwalris/config.h new file mode 100644 index 000000000..4725e1426 --- /dev/null +++ b/keyboards/planck/keymaps/tehwalris/config.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #ifndef CONFIG_USER_H | ||
| 2 | #define CONFIG_USER_H | ||
| 3 | |||
| 4 | #include "../../config.h" | ||
| 5 | |||
| 6 | #define PREVENT_STUCK_MODIFIERS | ||
| 7 | |||
| 8 | #ifdef AUDIO_ENABLE | ||
| 9 | // #define STARTUP_SONG SONG(PLANCK_SOUND) | ||
| 10 | #define STARTUP_SONG SONG(NO_SOUND) | ||
| 11 | |||
| 12 | #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ | ||
| 13 | SONG(COLEMAK_SOUND), \ | ||
| 14 | SONG(DVORAK_SOUND) \ | ||
| 15 | } | ||
| 16 | #endif | ||
| 17 | |||
| 18 | #define MUSIC_MASK (keycode != KC_NO) | ||
| 19 | |||
| 20 | /* | ||
| 21 | * MIDI options | ||
| 22 | */ | ||
| 23 | |||
| 24 | /* Prevent use of disabled MIDI features in the keymap */ | ||
| 25 | //#define MIDI_ENABLE_STRICT 1 | ||
| 26 | |||
| 27 | /* enable basic MIDI features: | ||
| 28 | - MIDI notes can be sent when in Music mode is on | ||
| 29 | */ | ||
| 30 | |||
| 31 | #define MIDI_BASIC | ||
| 32 | |||
| 33 | /* enable advanced MIDI features: | ||
| 34 | - MIDI notes can be added to the keymap | ||
| 35 | - Octave shift and transpose | ||
| 36 | - Virtual sustain, portamento, and modulation wheel | ||
| 37 | - etc. | ||
| 38 | */ | ||
| 39 | //#define MIDI_ADVANCED | ||
| 40 | |||
| 41 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
| 42 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
| 43 | |||
| 44 | #endif | ||
diff --git a/keyboards/planck/keymaps/tehwalris/keymap.c b/keyboards/planck/keymaps/tehwalris/keymap.c new file mode 100644 index 000000000..f36bad3ed --- /dev/null +++ b/keyboards/planck/keymaps/tehwalris/keymap.c | |||
| @@ -0,0 +1,128 @@ | |||
| 1 | /* Copyright 2015-2017 Jack Humbert | ||
| 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 | #include "planck.h" | ||
| 18 | #include "action_layer.h" | ||
| 19 | |||
| 20 | extern keymap_config_t keymap_config; | ||
| 21 | |||
| 22 | enum planck_layers { | ||
| 23 | DVORAK, | ||
| 24 | OVL_L, // Left overlay | ||
| 25 | OVL_R, // Right overlay | ||
| 26 | OVL_C, // Corner overlay | ||
| 27 | OVL_N, // Number overlay | ||
| 28 | OVL_F, // F-key overlay | ||
| 29 | }; | ||
| 30 | |||
| 31 | enum planck_keycodes { | ||
| 32 | UMLT_A = SAFE_RANGE, | ||
| 33 | UMLT_O, | ||
| 34 | UMLT_U, | ||
| 35 | }; | ||
| 36 | |||
| 37 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 38 | |||
| 39 | [DVORAK] = { | ||
| 40 | {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, OSL(OVL_C)}, | ||
| 41 | {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT }, | ||
| 42 | {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT }, | ||
| 43 | {KC_LGUI, MO(OVL_N), KC_LCTL, KC_RCTL, KC_BSPC, MO(OVL_L), MO(OVL_R), KC_SPC, KC_LALT, MO(OVL_F), KC_RALT, KC_RGUI } | ||
| 44 | }, | ||
| 45 | |||
| 46 | [OVL_L] = { | ||
| 47 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RGHT, _______}, | ||
| 48 | {_______, KC_UNDS, KC_MINS, KC_BSLS, KC_SLSH, KC_PLUS, KC_DLR, KC_LEFT, KC_EQL, KC_LCBR, KC_RCBR, _______}, | ||
| 49 | {_______, KC_SCLN, _______, _______, _______, _______, _______, _______, KC_GRV, KC_HASH, KC_PIPE, _______}, | ||
| 50 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} | ||
| 51 | }, | ||
| 52 | |||
| 53 | [OVL_R] = { | ||
| 54 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, | ||
| 55 | {_______, KC_LBRC, KC_RBRC, KC_LPRN, KC_RPRN, KC_EXLM, KC_CIRC, KC_QUES, KC_PERC, KC_AMPR, KC_ASTR, _______}, | ||
| 56 | {_______, KC_TILD, KC_AT, KC_DOWN, KC_UP, _______, _______, _______, _______, _______, _______, _______}, | ||
| 57 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} | ||
| 58 | }, | ||
| 59 | |||
| 60 | [OVL_C] = { | ||
| 61 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_END, _______}, | ||
| 62 | {_______, UMLT_A, UMLT_O, _______, UMLT_U, _______, _______, KC_HOME, _______, _______, _______, _______}, | ||
| 63 | {_______, _______, _______, KC_PGDN, KC_PGUP, _______, _______, _______, _______, _______, _______, _______}, | ||
| 64 | {_______, _______, _______, _______, KC_DEL, _______, _______, KC_INS, _______, _______, _______, _______} | ||
| 65 | }, | ||
| 66 | |||
| 67 | [OVL_N] = { | ||
| 68 | {_______, _______, _______, _______, _______, _______, _______, KC_7, KC_8, KC_9, _______, _______}, | ||
| 69 | {_______, KC_PLUS, KC_UNDS, KC_LPRN, KC_RPRN, _______, _______, KC_4, KC_5, KC_6, _______, _______}, | ||
| 70 | {_______, KC_ASTR, KC_SLSH, _______, _______, _______, _______, KC_1, KC_2, KC_3, KC_EQL, _______}, | ||
| 71 | {_______, _______, _______, _______, _______, _______, _______, KC_0, _______, _______, _______, _______} | ||
| 72 | }, | ||
| 73 | |||
| 74 | [OVL_F] = { | ||
| 75 | {_______, _______, _______, _______, _______, _______, _______, KC_F7, KC_F8, KC_F9, _______, _______}, | ||
| 76 | {_______, _______, _______, _______, _______, _______, _______, KC_F4, KC_F5, KC_F6, _______, _______}, | ||
| 77 | {_______, _______, _______, _______, _______, _______, _______, KC_F1, KC_F2, KC_F3, _______, _______}, | ||
| 78 | {_______, _______, _______, _______, _______, _______, _______, KC_F10, KC_F11, KC_F12, _______, _______} | ||
| 79 | } | ||
| 80 | |||
| 81 | }; | ||
| 82 | |||
| 83 | static bool is_left_shift_pressed = false; | ||
| 84 | static bool is_right_shift_pressed = false; | ||
| 85 | |||
| 86 | // This will only work on linux with xkbmap option "compose:prsc" | ||
| 87 | void press_umlaut_of(uint16_t keycode) { | ||
| 88 | bool is_shift_pressed = (is_left_shift_pressed || is_right_shift_pressed); | ||
| 89 | register_code(KC_PSCREEN); | ||
| 90 | unregister_code(KC_PSCREEN); | ||
| 91 | if (!is_shift_pressed) { | ||
| 92 | register_code(KC_LSFT); | ||
| 93 | } | ||
| 94 | register_code(KC_QUOT); | ||
| 95 | unregister_code(KC_QUOT); | ||
| 96 | if (!is_shift_pressed) { | ||
| 97 | unregister_code(KC_LSFT); | ||
| 98 | } | ||
| 99 | register_code(keycode); | ||
| 100 | unregister_code(keycode); | ||
| 101 | } | ||
| 102 | |||
| 103 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 104 | switch (keycode) { | ||
| 105 | case KC_LSFT: | ||
| 106 | is_left_shift_pressed = record->event.pressed; | ||
| 107 | break; | ||
| 108 | case KC_RSFT: | ||
| 109 | is_right_shift_pressed = record->event.pressed; | ||
| 110 | break; | ||
| 111 | case UMLT_A: | ||
| 112 | if (record->event.pressed) { | ||
| 113 | press_umlaut_of(KC_A); | ||
| 114 | } | ||
| 115 | break; | ||
| 116 | case UMLT_O: | ||
| 117 | if (record->event.pressed) { | ||
| 118 | press_umlaut_of(KC_O); | ||
| 119 | } | ||
| 120 | break; | ||
| 121 | case UMLT_U: | ||
| 122 | if (record->event.pressed) { | ||
| 123 | press_umlaut_of(KC_U); | ||
| 124 | } | ||
| 125 | break; | ||
| 126 | } | ||
| 127 | return true; | ||
| 128 | } | ||
diff --git a/keyboards/planck/keymaps/tehwalris/rules.mk b/keyboards/planck/keymaps/tehwalris/rules.mk new file mode 100644 index 000000000..457a3d01d --- /dev/null +++ b/keyboards/planck/keymaps/tehwalris/rules.mk | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | ifndef QUANTUM_DIR | ||
| 2 | include ../../../../Makefile | ||
| 3 | endif | ||
