diff options
| author | XP <xiepeng90@me.com> | 2018-03-23 19:02:44 -0400 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-03-23 16:02:44 -0700 |
| commit | 8575249411ec41c9c7236c19dfbeb177758046de (patch) | |
| tree | 3f1dd226f121c56209440ef467c73ccfb113415b /keyboards/contra | |
| parent | 8621fd8bbdb23179fb838a77df7fc9362be62250 (diff) | |
| download | qmk_firmware-8575249411ec41c9c7236c19dfbeb177758046de.tar.gz qmk_firmware-8575249411ec41c9c7236c19dfbeb177758046de.zip | |
Add a basic keymap for Contra. (#2564)
Diffstat (limited to 'keyboards/contra')
| -rw-r--r-- | keyboards/contra/keymaps/basic/config.h | 42 | ||||
| -rw-r--r-- | keyboards/contra/keymaps/basic/keymap.c | 169 | ||||
| -rw-r--r-- | keyboards/contra/keymaps/basic/readme.md | 72 |
3 files changed, 283 insertions, 0 deletions
diff --git a/keyboards/contra/keymaps/basic/config.h b/keyboards/contra/keymaps/basic/config.h new file mode 100644 index 000000000..a1635f2ba --- /dev/null +++ b/keyboards/contra/keymaps/basic/config.h | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | #ifndef CONFIG_USER_H | ||
| 2 | #define CONFIG_USER_H | ||
| 3 | |||
| 4 | #include "config_common.h" | ||
| 5 | |||
| 6 | #ifdef AUDIO_ENABLE | ||
| 7 | #define STARTUP_SONG SONG(PLANCK_SOUND) | ||
| 8 | // #define STARTUP_SONG SONG(NO_SOUND) | ||
| 9 | |||
| 10 | #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ | ||
| 11 | SONG(COLEMAK_SOUND), \ | ||
| 12 | SONG(DVORAK_SOUND) \ | ||
| 13 | } | ||
| 14 | #endif | ||
| 15 | |||
| 16 | #define MUSIC_MASK (keycode != KC_NO) | ||
| 17 | |||
| 18 | /* | ||
| 19 | * MIDI options | ||
| 20 | */ | ||
| 21 | |||
| 22 | /* Prevent use of disabled MIDI features in the keymap */ | ||
| 23 | //#define MIDI_ENABLE_STRICT 1 | ||
| 24 | |||
| 25 | /* enable basic MIDI features: | ||
| 26 | - MIDI notes can be sent when in Music mode is on | ||
| 27 | */ | ||
| 28 | |||
| 29 | #define MIDI_BASIC | ||
| 30 | |||
| 31 | /* enable advanced MIDI features: | ||
| 32 | - MIDI notes can be added to the keymap | ||
| 33 | - Octave shift and transpose | ||
| 34 | - Virtual sustain, portamento, and modulation wheel | ||
| 35 | - etc. | ||
| 36 | */ | ||
| 37 | //#define MIDI_ADVANCED | ||
| 38 | |||
| 39 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
| 40 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
| 41 | |||
| 42 | #endif \ No newline at end of file | ||
diff --git a/keyboards/contra/keymaps/basic/keymap.c b/keyboards/contra/keymaps/basic/keymap.c new file mode 100644 index 000000000..95a96426a --- /dev/null +++ b/keyboards/contra/keymaps/basic/keymap.c | |||
| @@ -0,0 +1,169 @@ | |||
| 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 "contra.h" | ||
| 18 | #include "action_layer.h" | ||
| 19 | |||
| 20 | extern keymap_config_t keymap_config; | ||
| 21 | |||
| 22 | enum planck_layers { | ||
| 23 | _QWERTY, | ||
| 24 | _COLEMAK, | ||
| 25 | _LOWER, | ||
| 26 | _RAISE, | ||
| 27 | _ADJUST | ||
| 28 | }; | ||
| 29 | |||
| 30 | enum planck_keycodes { | ||
| 31 | QWERTY = SAFE_RANGE, | ||
| 32 | COLEMAK, | ||
| 33 | LOWER, | ||
| 34 | RAISE | ||
| 35 | }; | ||
| 36 | |||
| 37 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 38 | |||
| 39 | /* Qwerty | ||
| 40 | * ,-----------------------------------------------------------------------------------. | ||
| 41 | * | ` | Q | W | E | R | T | Y | U | I | O | P | Bksp | | ||
| 42 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 43 | * | Ctrl | A | S | D | F | G | H | J | K | L | ; | ' | | ||
| 44 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 45 | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | | ||
| 46 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 47 | * | Esc | Tab | Alt | GUI |Lower | Space |Raise | Left |Right | Up |Down | | ||
| 48 | * `-----------------------------------------------------------------------------------' | ||
| 49 | */ | ||
| 50 | [_QWERTY] = { | ||
| 51 | {KC_GRV, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, | ||
| 52 | {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, | ||
| 53 | {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, | ||
| 54 | {KC_ESC, KC_TAB, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_RGHT, KC_UP, KC_DOWN} | ||
| 55 | }, | ||
| 56 | |||
| 57 | /* Colemak | ||
| 58 | * ,-----------------------------------------------------------------------------------. | ||
| 59 | * | ` | Q | W | F | P | G | J | L | U | Y | ; | Bksp | | ||
| 60 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 61 | * | Ctrl | A | R | S | T | D | H | N | E | I | O | ' | | ||
| 62 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 63 | * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | | ||
| 64 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 65 | * | Esc | Tab | Alt | GUI |Lower | Space |Raise | Left |Right | Up |Down | | ||
| 66 | * `-----------------------------------------------------------------------------------' | ||
| 67 | */ | ||
| 68 | [_COLEMAK] = { | ||
| 69 | {KC_GRV, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, | ||
| 70 | {KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, | ||
| 71 | {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, | ||
| 72 | {KC_ESC, KC_TAB, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_RGHT, KC_UP, KC_DOWN} | ||
| 73 | }, | ||
| 74 | |||
| 75 | /* Lower | ||
| 76 | * ,-----------------------------------------------------------------------------------. | ||
| 77 | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | | ||
| 78 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 79 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | | ||
| 80 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 81 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | | | ||
| 82 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 83 | * | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 84 | * `-----------------------------------------------------------------------------------' | ||
| 85 | */ | ||
| 86 | [_LOWER] = { | ||
| 87 | {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, | ||
| 88 | {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, | ||
| 89 | {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______}, | ||
| 90 | {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} | ||
| 91 | }, | ||
| 92 | |||
| 93 | /* Raise | ||
| 94 | * ,-----------------------------------------------------------------------------------. | ||
| 95 | * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | | ||
| 96 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 97 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | | ||
| 98 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 99 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | | | ||
| 100 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 101 | * | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 102 | * `-----------------------------------------------------------------------------------' | ||
| 103 | */ | ||
| 104 | [_RAISE] = { | ||
| 105 | {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, | ||
| 106 | {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, | ||
| 107 | {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______}, | ||
| 108 | {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} | ||
| 109 | }, | ||
| 110 | |||
| 111 | /* Adjust (Lower + Raise) | ||
| 112 | * ,-----------------------------------------------------------------------------------. | ||
| 113 | * | | | | | | | | | | | | Del | | ||
| 114 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 115 | * | | | | | |AGnorm|AGswap|Qwerty|Colemk| | | | | ||
| 116 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 117 | * | | | | | | | | | | | | | | ||
| 118 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 119 | * | | | | | | | | | | | | | ||
| 120 | * `-----------------------------------------------------------------------------------' | ||
| 121 | */ | ||
| 122 | [_ADJUST] = { | ||
| 123 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL }, | ||
| 124 | {_______, _______, _______, _______, _______, AG_NORM, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______}, | ||
| 125 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, | ||
| 126 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} | ||
| 127 | } | ||
| 128 | |||
| 129 | |||
| 130 | }; | ||
| 131 | |||
| 132 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 133 | switch (keycode) { | ||
| 134 | case QWERTY: | ||
| 135 | if (record->event.pressed) { | ||
| 136 | print("mode just switched to qwerty and this is a huge string\n"); | ||
| 137 | set_single_persistent_default_layer(_QWERTY); | ||
| 138 | } | ||
| 139 | return false; | ||
| 140 | break; | ||
| 141 | case COLEMAK: | ||
| 142 | if (record->event.pressed) { | ||
| 143 | set_single_persistent_default_layer(_COLEMAK); | ||
| 144 | } | ||
| 145 | return false; | ||
| 146 | break; | ||
| 147 | case LOWER: | ||
| 148 | if (record->event.pressed) { | ||
| 149 | layer_on(_LOWER); | ||
| 150 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 151 | } else { | ||
| 152 | layer_off(_LOWER); | ||
| 153 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 154 | } | ||
| 155 | return false; | ||
| 156 | break; | ||
| 157 | case RAISE: | ||
| 158 | if (record->event.pressed) { | ||
| 159 | layer_on(_RAISE); | ||
| 160 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 161 | } else { | ||
| 162 | layer_off(_RAISE); | ||
| 163 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 164 | } | ||
| 165 | return false; | ||
| 166 | break; | ||
| 167 | } | ||
| 168 | return true; | ||
| 169 | } | ||
diff --git a/keyboards/contra/keymaps/basic/readme.md b/keyboards/contra/keymaps/basic/readme.md new file mode 100644 index 000000000..195bc2c1b --- /dev/null +++ b/keyboards/contra/keymaps/basic/readme.md | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | # A Basic Contra Layout | ||
| 2 | |||
| 3 | The *default* layout currently (as of Mar 19, 2018) has a lot of components from Planck's default layout and is not very suitable for a basic Contra board. This basic layout is developed from Planck's default layout but has removed the parts that's irrelevant to a Contra board. | ||
| 4 | |||
| 5 | My other keyboard is a HHKB and I don't use `Tab` or `Esc` key that much and hence the unusual placements for those keys. | ||
| 6 | |||
| 7 | ## QWERTY (Normal) Layer | ||
| 8 | ``` | ||
| 9 | ,-----------------------------------------------------------------------------------. | ||
| 10 | | ` | Q | W | E | R | T | Y | U | I | O | P | Bksp | | ||
| 11 | |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 12 | | Ctrl | A | S | D | F | G | H | J | K | L | ; | ' | | ||
| 13 | |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 14 | | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | | ||
| 15 | |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 16 | | Esc | Tab | Alt | GUI |Lower | Space |Raise | Left |Right | Up |Down | | ||
| 17 | `-----------------------------------------------------------------------------------' | ||
| 18 | ``` | ||
| 19 | |||
| 20 | ## Colemak Layer | ||
| 21 | Switch from `Adjust` layer. | ||
| 22 | ``` | ||
| 23 | ,-----------------------------------------------------------------------------------. | ||
| 24 | | ` | Q | W | F | P | G | J | L | U | Y | ; | Bksp | | ||
| 25 | |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 26 | | Ctrl | A | R | S | T | D | H | N | E | I | O | ' | | ||
| 27 | |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 28 | | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | | ||
| 29 | |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 30 | | Esc | Tab | Alt | GUI |Lower | Space |Raise | Left |Right | Up |Down | | ||
| 31 | `-----------------------------------------------------------------------------------' | ||
| 32 | ``` | ||
| 33 | |||
| 34 | ## Lower | ||
| 35 | ``` | ||
| 36 | ,-----------------------------------------------------------------------------------. | ||
| 37 | | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | | ||
| 38 | |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 39 | | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | | ||
| 40 | |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 41 | | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | | | ||
| 42 | |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 43 | | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 44 | `-----------------------------------------------------------------------------------' | ||
| 45 | ``` | ||
| 46 | |||
| 47 | ## Raise | ||
| 48 | ``` | ||
| 49 | ,-----------------------------------------------------------------------------------. | ||
| 50 | | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | | ||
| 51 | |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 52 | | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | | ||
| 53 | |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 54 | | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | | | ||
| 55 | |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 56 | | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 57 | `-----------------------------------------------------------------------------------' | ||
| 58 | ``` | ||
| 59 | |||
| 60 | ## Adjust | ||
| 61 | `AGnorm` and `AGswap` switches `alt` and `os` key on the keyboard. | ||
| 62 | ``` | ||
| 63 | ,-----------------------------------------------------------------------------------. | ||
| 64 | | | | | | | | | | | | | Del | | ||
| 65 | |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 66 | | | | | | |AGnorm|AGswap|Qwerty|Colemk| | | | | ||
| 67 | |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 68 | | | | | | | | | | | | | | | ||
| 69 | |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 70 | | | | | | | | | | | | | | ||
| 71 | `-----------------------------------------------------------------------------------' | ||
| 72 | ``` \ No newline at end of file | ||
