aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/planck/keymaps/corvec/config.h53
-rw-r--r--keyboards/planck/keymaps/corvec/keymap.c207
-rw-r--r--keyboards/planck/keymaps/corvec/readme.md28
-rw-r--r--keyboards/planck/keymaps/corvec/rules.mk5
-rw-r--r--keyboards/planck/keymaps/corvec/tapdance.c156
5 files changed, 449 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/corvec/config.h b/keyboards/planck/keymaps/corvec/config.h
new file mode 100644
index 000000000..a7f450606
--- /dev/null
+++ b/keyboards/planck/keymaps/corvec/config.h
@@ -0,0 +1,53 @@
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#define PERMISSIVE_HOLD
43
44// AutoShift config
45#define AUTO_SHIFT_TIMEOUT 135
46#define NO_AUTO_SHIFT_SPECIAL
47// #define NO_AUTO_SHIFT_NUMERIC
48// #define NO_AUTO_SHIFT_ALPHA
49
50// TapDance config
51#define TAPPING_TERM 150
52
53#endif
diff --git a/keyboards/planck/keymaps/corvec/keymap.c b/keyboards/planck/keymaps/corvec/keymap.c
new file mode 100644
index 000000000..ea98927c2
--- /dev/null
+++ b/keyboards/planck/keymaps/corvec/keymap.c
@@ -0,0 +1,207 @@
1/* Copyright 2015-2018 Jack Humbert, Corey Kump
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
20extern keymap_config_t keymap_config;
21
22enum planck_layers {
23 _COLEMAK,
24 _QWERTY,
25 _LOWER,
26 _LEANDOWN,
27 _RAISE,
28 _WOBBLE,
29 _PLOVER,
30 _ADJUST
31};
32
33/* This include relies on the layer constants above and so must be declared after them */
34#include "tapdance.c"
35
36enum planck_keycodes {
37 QWERTY = SAFE_RANGE,
38 COLEMAK,
39 LOWER,
40 RAISE,
41 BACKLIT
42};
43
44#define KC_ KC_TRNS
45#define KC_____ KC_TRNS
46#define KC_XXXX KC_NO
47#define KC_LOWR LOWER
48#define KC_RASE RAISE
49
50/**
51 * Custom Corvec Bindings
52 *
53 * Previously used but currently unused bindings are commented out.
54 **/
55
56// Activate the Wobble layer
57#define KC_WOBL MO(_WOBBLE)
58// Dual function with Raise
59#define KC_RESC LT(_RAISE, KC_ESC)
60// Dual functions with Lower
61#define KC_LENT LT(_LOWER, KC_ENT)
62#define KC_LQUT LT(_LEANDOWN, KC_QUOT)
63// Dual functions with Shift
64#define KC_SDEL MT(MOD_LSFT, KC_DEL)
65#define KC_SAPP MT(MOD_LSFT, KC_APP)
66
67/**
68 * Functions taking advantage of tap dance:
69 **/
70// Tap once: quote. Hold: LEANDOWN layer. Tap twice: minus.
71#define KC_TQTD TD(TD_QUOT_LEAN_MINS)
72// Tap once: [. Hold: RALT. Tap twice: {
73#define KC_TALT TD(TD_LBRC_RALT_LCBR)
74// Tap once: ]. Hold: RGUI. Tap twice: }
75#define KC_TGUI TD(TD_RBRC_RGUI_RCBR)
76
77
78const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
79
80 [_COLEMAK] = KC_KEYMAP(
81 //-----+----+----+----+----+----+----+----+----+----+----+----
82 TAB , Q , W , F , P , G , J , L , U , Y ,SCLN,BSPC,
83 //-----+----+----+----+----+----+----+----+----+----+----+----
84 RESC, A , R , S , T , D , H , N , E , I , O ,TQTD,
85 //-----+----+----+----+----+----+----+----+----+----+----+----
86 LSFT, Z , X , C , V , B , K , M ,COMM,DOT ,SLSH,RSFT,
87 //-----+----+----+----+----+----+----+----+----+----+----+----
88 LCTL,LGUI,WOBL,LALT,LENT, SPC, SPC,RASE,SDEL,TALT,TGUI,RCTL
89 ),
90
91 [_QWERTY] = KC_KEYMAP(
92 //-----+----+----+----+----+----+----+----+----+----+----+----
93 TAB , Q , W , E , R , T , Y , U , I , O , P ,BSPC,
94 //-----+----+----+----+----+----+----+----+----+----+----+----
95 RESC, A , S , D , F , G , H , J , K , L ,SCLN,TQTD,
96 //-----+----+----+----+----+----+----+----+----+----+----+----
97 LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,RSFT,
98 //-----+----+----+----+----+----+----+----+----+----+----+----
99 LCTL,LGUI,WOBL,LALT,LENT, SPC, SPC,RASE,RALT,SAPP,RGUI,RCTL
100 ),
101
102 [_LOWER] = KC_KEYMAP(
103 GRV ,EXLM, AT ,HASH, DLR,PERC,CIRC,AMPR,ASTR,LPRN,RPRN,____,
104 ____,LPRN,RPRN,LBRC,RBRC,XXXX,LEFT,DOWN, UP ,RGHT,XXXX,MINS,
105 ____,BSLS,TILD,PIPE,EQL ,UNDS,HOME,PGDN,PGUP,END ,BSLS,____,
106 ____,____,____,____,____,____,____,____,____,____,____,____
107 ),
108
109 [_LEANDOWN] = KC_KEYMAP(
110 GRV ,EXLM, AT ,HASH, DLR,PERC,CIRC,AMPR,ASTR,LPRN,RPRN,____,
111 ____,LPRN,RPRN,LBRC,RBRC,LCBR,LCBR,DLR ,PERC,CIRC,____,____,
112 ____,BSLS,TILD,PIPE,EQL ,UNDS,HOME,EXLM, AT ,HASH,BSLS,____,
113 ____,____,____,____,____,____,____,____,LEFT,DOWN, UP ,RGHT
114 ),
115
116 [_RAISE] = KC_KEYMAP(
117 GRV , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,____,
118 ____,LPRN,RPRN,LCBR,RCBR,XXXX,XXXX, 4 , 5 , 6 ,PPLS,MINS,
119 ____,BSLS,TILD,PIPE,EQL ,UNDS,XXXX, 1 , 2 , 3 ,PAST,____,
120 ____,____,____,____,____,____,____,____,____,____,____,____
121 ),
122
123 [_WOBBLE] = KC_KEYMAP(
124 GRV , F1 , F2 , F3 , F4 , NO ,MUTE,VOLD,VOLU, NO , NO , DEL,
125 , F5 , F6 , F7 , F8 , NO ,MPRV,MPLY,MSTP,MNXT, NO ,BSLS,
126 , F9 , F10, F11, F12, NO , NO , NO , NO , INS,PSCR, ,
127 , , , , , , , , , , ,
128 ),
129
130/* Adjust (Lower + Raise)
131 * ,-----------------------------------------------------------------------------------.
132 * |Colemk| | Debug|RGB Tg|RGB Md|RGB H+|RGB H-|RGB S+|RGB S-|RGB V+|RGB V-|Qwerty|
133 * |------+------+------+------+------+-------------+------+------+------+------+------|
134 * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk| |AS On | AS + |
135 * |------+------+------+------+------+------|------+------+------+------+------+------|
136 * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof|TermOn|TermOf|AS Rep|AS Off| AS - |
137 * |------+------+------+------+------+------+------+------+------+------+------+------|
138 * | | | | | | | | | | | Reset|
139 * `-----------------------------------------------------------------------------------'
140 */
141
142[_ADJUST] = {
143 {COLEMAK, _______, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, QWERTY },
144 {_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, _______, KC_ASON, KC_ASUP},
145 {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF,KC_ASRP, KC_ASOFF,KC_ASDN},
146 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET }
147}
148
149
150};
151
152#ifdef AUDIO_ENABLE
153 float plover_song[][2] = SONG(PLOVER_SOUND);
154 float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
155#endif
156
157bool process_record_user(uint16_t keycode, keyrecord_t *record) {
158 switch (keycode) {
159 case QWERTY:
160 if (record->event.pressed) {
161 print("mode just switched to qwerty and this is a huge string\n");
162 set_single_persistent_default_layer(_QWERTY);
163 }
164 return false;
165 break;
166 case COLEMAK:
167 if (record->event.pressed) {
168 set_single_persistent_default_layer(_COLEMAK);
169 }
170 return false;
171 break;
172 case LOWER:
173 if (record->event.pressed) {
174 layer_on(_LOWER);
175 update_tri_layer(_LOWER, _RAISE, _ADJUST);
176 } else {
177 layer_off(_LOWER);
178 update_tri_layer(_LOWER, _RAISE, _ADJUST);
179 }
180 return false;
181 break;
182 case RAISE:
183 if (record->event.pressed) {
184 layer_on(_RAISE);
185 update_tri_layer(_LOWER, _RAISE, _ADJUST);
186 } else {
187 layer_off(_RAISE);
188 update_tri_layer(_LOWER, _RAISE, _ADJUST);
189 }
190 return false;
191 break;
192 case BACKLIT:
193 if (record->event.pressed) {
194 register_code(KC_RSFT);
195 #ifdef BACKLIGHT_ENABLE
196 backlight_step();
197 #endif
198 PORTE &= ~(1<<6);
199 } else {
200 unregister_code(KC_RSFT);
201 PORTE |= (1<<6);
202 }
203 return false;
204 break;
205 }
206 return true;
207}
diff --git a/keyboards/planck/keymaps/corvec/readme.md b/keyboards/planck/keymaps/corvec/readme.md
new file mode 100644
index 000000000..055914555
--- /dev/null
+++ b/keyboards/planck/keymaps/corvec/readme.md
@@ -0,0 +1,28 @@
1# Corvec's Planck Layout
2
3This layout is a development-focused layout with an emphasis on ergonomics. It is intended to be used in Colemak mode,
4but has a full-QWERTY mode for gaming compatibility.
5
6It utilizes redundancy for common keys so that they are more easily accessible in every task. For example, the common
7layers, Raise and Lower, both can be activated with two different keys, each pressed with either hand. Certain symbols
8( \~|+_ ) are on both layers, since the keys they take up are a bit out of the way. The minus symbol is available on the
9quote key in a variety of ways - both layers, as well as via tap dance.
10
11The right-hand Lower activation key activates a slightly different layer. The keys accessed by the opposite hand are the
12same as the Lower layer, but the keys on the right hand differ. For this reason, we refer to this instead as the
13Leandown layer.
14
15Auto-shift is enabled, but there are also three shift keys, since typing with auto-shift is by necessity slow.
16
17Movement is done Vim-style, on the hjkl / hnei keys, on the Lower layer so that it is easiest to activate it.
18The arrow keys are mimicked by Home/PgDn/PgUp/End on the next row.
19
20The arrow keys and broad navigation keys are replaced by a symbol-pad on the Leandown layer. However, in order to allow
21single-hand navigation, the bottom right corner cluster becomes arrow keys.
22
23Media keys are in the same location as the arrow keys, but are on the Wobble layer instead.
24
25Toggle layers are minimized so that the state of the keyboard is more predictable. Shift Toggle is in the works, but
26will not be included until it can be set to deactivate automatically.
27
28Delete is accessible from the third Shift key.
diff --git a/keyboards/planck/keymaps/corvec/rules.mk b/keyboards/planck/keymaps/corvec/rules.mk
new file mode 100644
index 000000000..c17a31a23
--- /dev/null
+++ b/keyboards/planck/keymaps/corvec/rules.mk
@@ -0,0 +1,5 @@
1AUTO_SHIFT_ENABLE = yes
2TAP_DANCE_ENABLE = yes
3API_SYSEX_ENABLE = no
4CONSOLE_ENABLE = no
5EXTRAKEY_ENABLE = no
diff --git a/keyboards/planck/keymaps/corvec/tapdance.c b/keyboards/planck/keymaps/corvec/tapdance.c
new file mode 100644
index 000000000..a597fe29f
--- /dev/null
+++ b/keyboards/planck/keymaps/corvec/tapdance.c
@@ -0,0 +1,156 @@
1/**
2 * Tap Dance config and functions
3 **/
4/* Copyright 2018 Corey Kump
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20enum {
21 SINGLE_TAP = 1,
22 SINGLE_HOLD = 2,
23 DOUBLE_TAP = 3,
24 DOUBLE_SINGLE_TAP = 4,
25 UNKNOWN_TAPS = 5
26};
27
28typedef struct {
29 bool is_press_action;
30 int state;
31} tap;
32
33int cur_dance (qk_tap_dance_state_t *state) {
34 if (state->count == 1) {
35 if (state->interrupted || !state->pressed) {
36 return SINGLE_TAP;
37 } else {
38 return SINGLE_HOLD;
39 }
40 }
41 if (state->count == 2) {
42 if (state->interrupted) {
43 return DOUBLE_SINGLE_TAP;
44 } else if (!state->pressed) {
45 return DOUBLE_TAP;
46 }
47 }
48 return UNKNOWN_TAPS;
49}
50
51/**
52 * quote
53 **/
54
55static tap quote_state = {
56 .is_press_action = true,
57 .state = 0
58};
59
60void quote_finished(qk_tap_dance_state_t *state, void *user_data) {
61 quote_state.state = cur_dance(state);
62 switch(quote_state.state) {
63 case SINGLE_TAP: register_code(KC_QUOT); break;
64 case SINGLE_HOLD: layer_on(_LEANDOWN); break;
65 case DOUBLE_TAP: register_code(KC_MINS); break;
66 case DOUBLE_SINGLE_TAP: register_code(KC_QUOT); unregister_code(KC_QUOT); register_code(KC_QUOT); break;
67 }
68}
69void quote_reset(qk_tap_dance_state_t *state, void *user_data) {
70 switch(quote_state.state) {
71 case SINGLE_TAP: unregister_code(KC_QUOT); break;
72 case SINGLE_HOLD: layer_off(_LEANDOWN); break;
73 case DOUBLE_TAP: unregister_code(KC_MINS); break;
74 case DOUBLE_SINGLE_TAP: unregister_code(KC_QUOT); break;
75 }
76 quote_state.state = 0;
77}
78
79/**
80 * ralt / left bracket / left curly brace
81 **/
82
83static tap ralt_state = {
84 .is_press_action = true,
85 .state = 0
86};
87
88void ralt_finished(qk_tap_dance_state_t *state, void *user_data) {
89 ralt_state.state = cur_dance(state);
90 switch(ralt_state.state) {
91 case SINGLE_TAP: register_code(KC_LBRC); break;
92 case SINGLE_HOLD: register_code(KC_RALT); break;
93 case DOUBLE_TAP: register_code(KC_LSFT); register_code(KC_LBRC); break;
94 // fallback to alt because it's the primary purpose of this key
95 case DOUBLE_SINGLE_TAP: register_code(KC_RALT); break;
96 }
97}
98void ralt_reset(qk_tap_dance_state_t *state, void *user_data) {
99 switch(ralt_state.state) {
100 case SINGLE_TAP: unregister_code(KC_LBRC); break;
101 case SINGLE_HOLD: unregister_code(KC_RALT); break;
102 case DOUBLE_TAP: unregister_code(KC_LBRC); unregister_code(KC_LSFT); break;
103 case DOUBLE_SINGLE_TAP: unregister_code(KC_RALT); break;
104 }
105 ralt_state.state = 0;
106}
107
108/**
109 * rgui / right bracket / right curly brace
110 **/
111
112static tap rgui_state = {
113 .is_press_action = true,
114 .state = 0
115};
116
117void rgui_finished(qk_tap_dance_state_t *state, void *user_data) {
118 rgui_state.state = cur_dance(state);
119 switch(rgui_state.state) {
120 case SINGLE_TAP: register_code(KC_RBRC); break;
121 case SINGLE_HOLD: register_code(KC_RGUI); break;
122 case DOUBLE_TAP: register_code(KC_LSFT); register_code(KC_RBRC); break;
123 // fallback to alt because it's the primary purpose of this key
124 case DOUBLE_SINGLE_TAP: register_code(KC_RGUI); break;
125 }
126}
127void rgui_reset(qk_tap_dance_state_t *state, void *user_data) {
128 switch(rgui_state.state) {
129 case SINGLE_TAP: unregister_code(KC_RBRC); break;
130 case SINGLE_HOLD: unregister_code(KC_RGUI); break;
131 case DOUBLE_TAP: unregister_code(KC_RBRC); unregister_code(KC_LSFT); break;
132 case DOUBLE_SINGLE_TAP: unregister_code(KC_RGUI); break;
133 }
134 rgui_state.state = 0;
135}
136
137/**
138 * Define the available tap dance keys
139 **/
140
141enum {
142 TD_ALT_SHIFT = 0,
143 TD_LQUT_MINS,
144 TD_QUOT_LEAN_MINS,
145 TD_LBRC_RALT_LCBR,
146 TD_RBRC_RGUI_RCBR
147};
148
149qk_tap_dance_action_t tap_dance_actions[] = {
150 // Tap once for Alt, twice for Shift
151 [TD_ALT_SHIFT] = ACTION_TAP_DANCE_DOUBLE(KC_RALT, KC_RSFT),
152 [TD_QUOT_LEAN_MINS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, quote_finished, quote_reset),
153 [TD_LBRC_RALT_LCBR] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ralt_finished, ralt_reset),
154 [TD_RBRC_RGUI_RCBR] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rgui_finished, rgui_reset)
155};
156