aboutsummaryrefslogtreecommitdiff
path: root/keyboards/mitosis/keymaps
diff options
context:
space:
mode:
authorMichael F. Lamb <mike@datagrok.org>2017-11-03 08:56:06 -0700
committerJack Humbert <jack.humb@gmail.com>2017-11-03 11:56:06 -0400
commite899cb8940da04fa2610604f0aab417db7fac119 (patch)
tree315c8b4b4ed73bc582af672740a64ccf2baa09fe /keyboards/mitosis/keymaps
parent80e489e122962abbfa63ff3383ff303144bfe6f2 (diff)
downloadqmk_firmware-e899cb8940da04fa2610604f0aab417db7fac119.tar.gz
qmk_firmware-e899cb8940da04fa2610604f0aab417db7fac119.zip
several improvements for mitosis:datagrok (#1960)
* mitosis/datagrok: reduce features from rules.mk * mitosis/datagrok: make both layer keys neighbor shift * mitosis/datagrok: (no-op) tweak some comments * mitosis/datagrok: set baudrate to 250k This requires a corresponding change to the mitosis wireless firmware: https://github.com/reversebias/mitosis/pull/10 * mitosis/datagrok: move design description from code comment to a readme * mitosis/datagrok: new layout, new shifted keys, efficient LED code This is experimental, but compiles and seems to work correctly. * mitosis/datagrok: whoops, move readme.md * mitosis/datagrok: a minor layout improvement simplifies custom-shifted code instead of [, .] [? !], using [, ?] [. !] greatly simplifies the code needed to perform the shifted-key switching. (And keeps , and . on the same keys that they are under qwerty.) also: layout improvements for symbols * mitosis/datagrok: make my code conform to QMK style guidelines * mitosis/datagrok: TODO note for layout table in README * mitosis/datagrok: remove led_set_user until i figure out other changes need to see if the corresponding changes needed in the keyboard-level code is okay. * mitosis/datagrok: simpler layer indicator * mitosis/datagrok: undo change to keyboard baud; make it in my layout dir. * mitosis/datagrok: apply same punctuation hack to qwerty layer * mitosis/datagrok: enable qwerty layer toggle * mitosis/datagrok: update readme
Diffstat (limited to 'keyboards/mitosis/keymaps')
-rw-r--r--keyboards/mitosis/keymaps/datagrok/config.h22
-rw-r--r--keyboards/mitosis/keymaps/datagrok/keymap.c200
-rw-r--r--keyboards/mitosis/keymaps/datagrok/readme.md74
-rw-r--r--keyboards/mitosis/keymaps/datagrok/rules.mk15
4 files changed, 229 insertions, 82 deletions
diff --git a/keyboards/mitosis/keymaps/datagrok/config.h b/keyboards/mitosis/keymaps/datagrok/config.h
new file mode 100644
index 000000000..3f303e04a
--- /dev/null
+++ b/keyboards/mitosis/keymaps/datagrok/config.h
@@ -0,0 +1,22 @@
1#ifndef CONFIG_USER_H
2#define CONFIG_USER_H
3
4#include "../../config.h"
5
6// I use a pro micro clocked at 8Mhz. It can't reach 1M baud, so this is the
7// next fastest possible baud without errors. I don't notice any difference in
8// behavior at this slower speed. (So I think it should maybe be the default,
9// to allow a single codebase to support both available flavors of pro micro.)
10// This requires a corresponding change to the wireless module firmware; see
11// https://github.com/reversebias/mitosis/pull/10
12#undef SERIAL_UART_BAUD // avoids redefinition warning
13#define SERIAL_UART_BAUD 250000
14
15// TODO: figure out which of these I can safely enable to reduce firmware size.
16//#define NO_ACTION_LAYER
17//#define NO_ACTION_TAPPING
18//#define NO_ACTION_ONESHOT // can't; errors
19//#define NO_ACTION_MACRO
20//#define NO_ACTION_FUNCTION
21
22#endif
diff --git a/keyboards/mitosis/keymaps/datagrok/keymap.c b/keyboards/mitosis/keymaps/datagrok/keymap.c
index e4460a9b6..36683fbc5 100644
--- a/keyboards/mitosis/keymaps/datagrok/keymap.c
+++ b/keyboards/mitosis/keymaps/datagrok/keymap.c
@@ -1,34 +1,12 @@
1#include "mitosis.h" 1#include "mitosis.h"
2 2
3// Arrows in a layer in the home position.
4// Fn+Arrows = PgUp PgDn Home End, which is intuitive for me
5//
6// Since QWERTY and WORKMAN keep angle brackets together, I wanted to place
7// other enclosing symbols on the same keys. So, 9 and 0 and [ and ] land there
8// in other layers. That informed the numbers placement, which informed the
9// function-key placement.
10//
11// To do:
12// - Improve LED indications (may require modding bluetooth firmware):
13// - Is any board nonresponsive (which one?)
14// - Does either board have a low battery?
15// - Use "shifted keys" hack to make programming symbols easier to type
16// - Add "media" keysyms, Insert, PrintScr, Pause/Break
17// - Dynamically toggle QWERTY or other layouts
18// - See if the henkans placement is at all useful for Japanese speakers, or
19// abuse different keysyms
20// - Overlay a 10key numpad somewhere
21// - Mod a speaker onto my receiver and enable tones
22// - Mod more indicator LEDs onto my receiver
23// - Do something with Num/Caps/Scroll lock?
24// - Improve tri-layer behavior
25
26enum mitosis_layers 3enum mitosis_layers
27{ 4{
28 _WORKMAN, 5 _xW, // workman
29 _FUNC, 6 _xQ, // qwerty
30 _NUMS, 7 _xS, // symbols
31 _NMFN 8 _xN, // numbers
9 _xF // functions
32}; 10};
33 11
34// Fillers to make layering more clear 12// Fillers to make layering more clear
@@ -38,67 +16,125 @@ enum mitosis_layers
38#define KC_LMTA KC_LALT // For fun, name the mods like the space cadet keyboard does 16#define KC_LMTA KC_LALT // For fun, name the mods like the space cadet keyboard does
39#define KC_RMTA KC_RALT // META 17#define KC_RMTA KC_RALT // META
40#define KC_LSUP KC_LGUI // SUPER 18#define KC_LSUP KC_LGUI // SUPER
41#define KC_RSUP KC_RGUI // 19#define KC_RSUP KC_RGUI //
42#define KC_RHYP KC_INT4 // HYPER (actually muhenkan 無変換 and henkan 変換) 20#define KC_RHYP KC_INT4 // HYPER (actually muhenkan 無変換 and henkan 変換)
43#define KC_LHYP KC_INT5 // or NFER/XFER. 21#define KC_LHYP KC_INT5 // or NFER/XFER.
44 22
45// I didn't want to mess about with new keymappings and custom logic etc. to 23// Momentary tri-state layers. Mitosis default keymap does this too but employs
46// enable tri-state layers like mitosis default does. This layout accomplishes 24// new keymappings and a bunch of conditional code. This simpler keymap
47// it with a small quirk that triggering both layers then releasing one 25// accomplishes it, but with a small quirk: triggering both layers then
48// out-of-order will leave the tri-state triggered. Which doesn't bother me. 26// releasing one out-of-order will leave the tri-state triggered until the
27// other is released. Which doesn't bother me.
49 28
50const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 29const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
51 [_WORKMAN] = { 30 [_xW] = {
52 {KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN}, 31 {KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN},
53 {KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I}, 32 {KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I},
54 {KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH}, 33 {KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_QUOT},
55 {XXXXXXX, MO(_NUMS), KC_LCTL, KC_LSFT, KC_BSPC, KC_SPC, KC_RSFT, KC_RCTL, MO(_NUMS), XXXXXXX}, 34 {XXXXXXX, KC_LSUP, KC_LCTL, MO(_xN), KC_LSFT, KC_RSFT, MO(_xN), KC_RCTL, KC_RSUP, XXXXXXX},
56 {XXXXXXX, KC_LHYP, KC_LSUP, KC_LMTA, MO(_FUNC), MO(_FUNC), KC_RMTA, KC_RSUP, KC_RHYP, XXXXXXX} 35 {XXXXXXX, KC_LHYP, KC_LMTA, MO(_xS), KC_BSPC, KC_SPC, MO(_xS), KC_RMTA, KC_RHYP, XXXXXXX}
57 }, 36 },
58 [_FUNC] = { 37 [_xQ] = {
59 {KC_ESC, _______, KC_UP, _______, _______, _______, _______, _______, _______, KC_QUOT}, 38 {KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P},
60 {KC_TAB, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, KC_GRV}, 39 {KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN},
61 {_______, _______, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, KC_BSLS}, 40 {KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_QUOT},
62 {XXXXXXX, MO(_NMFN), _______, _______, KC_DEL, KC_ENT, _______, _______, MO(_NMFN), XXXXXXX}, 41 {XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX},
63 {XXXXXXX, _______, _______, _______, ___M___, ___M___, _______, _______, _______, XXXXXXX}, 42 {XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX}
64 }, 43 },
65 [_NUMS] = { 44 [_xS] = {
66 {_______, _______, _______, _______, _______, _______, KC_1, KC_2, KC_3, KC_4}, 45 {KC_ESC, _______, KC_UP, _______, _______, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD},
67 {_______, _______, _______, _______, _______, _______, KC_5, KC_6, KC_7, KC_8}, 46 {KC_TAB, KC_LEFT, KC_DOWN, KC_RGHT, _______, KC_CIRC, KC_AMPR, KC_PIPE, KC_GRV, KC_UNDS},
68 {_______, _______, _______, _______, _______, _______, KC_MINS, KC_9, KC_0, KC_EQL}, 47 {KC_BSLS, KC_RPRN, KC_RCBR, KC_RBRC, KC_RABK, KC_LABK, KC_LBRC, KC_LCBR, KC_LPRN, KC_SLSH},
69 {XXXXXXX, ___M___, _______, _______, _______, _______, _______, _______, ___M___, XXXXXXX}, 48 {XXXXXXX, _______, _______, MO(_xF), _______, _______, MO(_xF), _______, _______, XXXXXXX},
70 {XXXXXXX, _______, _______, _______, MO(_NMFN), MO(_NMFN), _______, _______, _______, XXXXXXX}, 49 {XXXXXXX, _______, _______, ___M___, KC_DEL, KC_ENT, ___M___, _______, _______, XXXXXXX},
71 }, 50 },
72 [_NMFN] = { 51 [_xN] = {
73 {_______, _______, KC_PGUP, _______, _______, _______, KC_F1, KC_F2, KC_F3, KC_F4}, 52 {_______, _______, _______, _______, _______, KC_PSLS, KC_P7, KC_P8, KC_P9, KC_P0},
74 {_______, KC_HOME, KC_PGDN, KC_END, _______, _______, KC_F5, KC_F6, KC_F7, KC_F8}, 53 {_______, _______, _______, _______, _______, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS},
75 {_______, _______, _______, _______, _______, _______, KC_F8, KC_F9, KC_F10, KC_F12}, 54 {_______, _______, _______, _______, _______, KC_PMNS, KC_P1, KC_P2, KC_P3, KC_PEQL},
76 {XXXXXXX, ___M___, _______, _______, _______, _______, _______, _______, ___M___, XXXXXXX}, 55 {XXXXXXX, _______, _______, ___M___, _______, _______, ___M___, _______, _______, XXXXXXX},
77 {XXXXXXX, _______, _______, _______, ___M___, ___M___, _______, _______, _______, XXXXXXX}, 56 {XXXXXXX, _______, _______, MO(_xF), _______, KC_PENT, MO(_xF), _______, _______, XXXXXXX},
78 }, 57 },
58 [_xF] = {
59 {_______, _______, KC_PGUP, _______, KC_VOLU, KC_F13, KC_F7, KC_F8, KC_F9, KC_F10},
60 {_______, KC_HOME, KC_PGDN, KC_END, KC_VOLD, KC_F14, KC_F4, KC_F5, KC_F6, KC_F11},
61 {TG(_xQ), KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_F15, KC_F1, KC_F2, KC_F3, KC_F12},
62 {XXXXXXX, _______, _______, ___M___, _______, _______, ___M___, _______, _______, XXXXXXX},
63 {XXXXXXX, _______, _______, _______, ___M___, ___M___, _______, _______, _______, XXXXXXX},
64 },
79}; 65};
80 66
67// This is a hack to place <question mark> on <shift-comma> and <exclaimation
68// mark> on <shift-period>, when using an operating system configured for a
69// US/qwerty layout.
70bool comm_shifted = false;
71bool ques_shifted = false;
72bool process_record_user(uint16_t keycode, keyrecord_t *record) {
73 uint8_t shifted;
74 uint16_t s_keycode;
75 bool *k_shifted;
76
77 switch (keycode) {
78 case KC_COMM:
79 s_keycode = KC_SLSH;
80 k_shifted = &comm_shifted;
81 break;
82 case KC_DOT:
83 s_keycode = KC_1;
84 k_shifted = &ques_shifted;
85 break;
86 default:
87 return true;
88 }
89
90 shifted = get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT));
91
92 // Keydown. If shift is currently pressed, register its alternate keycode.
93 if (record->event.pressed && shifted) {
94 *k_shifted = true;
95 register_code(s_keycode);
96 return false;
97 // Keyup. If shift was pressed back when the key was pressed, unregister
98 // its alternate keycode.
99 } else if (!(record->event.pressed) && *k_shifted) {
100 *k_shifted = false;
101 unregister_code(s_keycode);
102 return false;
103 // Otherwise, behave as normal.
104 } else {
105 return true;
106 }
107}
108
109// Set the bits of A selected by MASK to the corresponding bits of B
110#define setbits(A, B, MASK) A = (A & (B | ~MASK)) | (B & MASK)
81void matrix_scan_user(void) { 111void matrix_scan_user(void) {
82 uint8_t layer = biton32(layer_state); 112 //
113 // Bit # 7 6 5 4 3 2 1 0
114 // layer_state: [ | | | _xF | _xN | _xS | _xQ | _xW ]
115 // usb_led [ | | |kana |cmps |scrl |caps | num ]
116 // PORTB: [ NC | 10 | 9 | 8 | 14 | 16 | 15 |rxled]
117 // PORTC: [ NC | 5 | | | | | | ]
118 // PORTD: [ 6 | NC |txled| 4 | tx* | rx* | grn | p29 ]
119 // PORTE: [ | 7 | | | | | | ]
120 // PORTF: [ a0 | a1 | red | blu | | | NC | NC ]
121 //
122 // PD0 is connected to the pairing switch and p29 on the wireless module.
123 // PF0,PF1,PB7,PC7,PD6 are not broken out by the pro micro board. I don't understand why.
124 // PB1-PB6,PD4,PD5,PD6,PF6,PF7 are not connected to the Mitosis receiver
125 // board. Each may be connected to an LED by way of a resistor (4.7k to
126 // match the others) for a total of 14 additional indicators.
83 127
84 switch (layer) { 128 // A simple (but technically inaccurate) model of the momentary layer state:
85 case _WORKMAN: 129 // Fn1 key makes _xS active; indicator = red
86 red_led_off; 130 // Fn2 key makes _xN active; indicator = blue
87 grn_led_off; 131 // Both keys make _xF active; indicator = purple
88 break; 132 // Toggling QWERTY mode makes indicator include green, so (red/blue/purple becomes yellow/cyan/white)
89 case _FUNC: 133
90 red_led_off; 134 // negated because for ports 0=LED on.
91 grn_led_on; 135 uint32_t portf_bits = ~(layer_state|layer_state<<1|(layer_state&0b100)<<3);
92 break; 136 setbits(PORTF, portf_bits, 0b00110000);
93 case _NUMS: 137 setbits(PORTD, ~layer_state, 0b00000010);
94 red_led_on; 138}
95 grn_led_off; 139
96 break; 140// vim: set sw=2 et:
97 case _NMFN:
98 red_led_on;
99 grn_led_on;
100 break;
101 default:
102 break;
103 }
104};
diff --git a/keyboards/mitosis/keymaps/datagrok/readme.md b/keyboards/mitosis/keymaps/datagrok/readme.md
new file mode 100644
index 000000000..a5b7b6c62
--- /dev/null
+++ b/keyboards/mitosis/keymaps/datagrok/readme.md
@@ -0,0 +1,74 @@
1![mitosis:datagrok layout image](https://i.imgur.com/Lt0t0nq.png)
2
3[Keyboard layout editor source](http://www.keyboard-layout-editor.com/#/gists/e1a6a7a480fd4984c0bed38ee35f6c4f)
4
5# a layout for the Mitosis
6
7- Emphasis on momentary modifiers, all usable from either hand, arranged
8 symmetrically, but distinguishable left/right by the OS. Shift, Fn1
9 ("Lower"), Fn2 ("Raise"), Super ("Windows"), Meta ("Alt"), Hyper.
10
11- Fn1 and Fn2 are used to momentary-enable (like a shift key) one of three layers:
12
13 - Fn1 (Red): Symbols layer
14 - Fn2 (Blue): Numbers layer
15 - Both: Functions layer
16
17- The base layer is a slight variant of [Workman][]. QWERTY may be toggled-on.
18
19- Paired programming symbols (braces, brackets, parentheses) are arranged
20 symmetrically in the symbols layer. `?` and `!` are moved to take the place
21 of `<` and `>`.
22
23- No OS keymap modification required.
24
25## Design notes
26
27- **I use an 8Mhz Pro Micro.** If you want to use this keymap with the standard
28 16Mhz Pro Micro specified in the Mitosis design:
29
30 - Remove the lines in `rules.mk` mentioning `F_CPU` and `F_USB`.
31 - Remove the lines in `config.h` mentioning `SERIAL_UART_BAUD`.
32
33- I'm learning a new key placement, so might as well go all out and use an
34 optimal non-QWERTY layout.
35
36- I like the way Workman feels and some of its advantages over Colemak.
37 Unfortunately, it was designed using a weighting system based on a standard
38 column-staggered keyboard so is probably not as optimal as one could achieve
39 on an ergonomic board like the Mitosis.
40
41- Arrows in the home position (on a layer). Mod+Arrows = PgUp/PgDn/Home/End,
42 which is intuitive for me
43
44### Abandoned ideas
45
46- ~~"Since QWERTY and Workman keep angle brackets together, place other
47 enclosing symbols on the same keys. This informs the numbers placement,
48 which informs the function-key placement."~~
49
50 - I tried this and it was bad. I don't like having to pick the right
51 modifier to get the right flavor of bracket. Instead, now, one modifier
52 activates a symbols layer where all brackets are easily accessible.
53
54- Space/Enter to the left of layer select for Enter doesn't work well; I always
55 trigger space first.
56
57- I used to have Blue layer on ring finger, but that was too hard to use in
58 conjunction with shift.
59
60## To do
61
62- Improve LED indications (may require modding bluetooth firmware):
63 - Is any board nonresponsive (which one?)
64 - Does either board have a low battery?
65- Add Insert, PrintScr, Pause/Break
66- Make QWERTY base layer for people who customize layout in software? Store
67 default base layer in eeprom?
68- See if the henkans placement is at all useful for Japanese speakers, or abuse
69 different keysyms
70- Mod a speaker onto my receiver and enable tones
71- Implement "layer lock" key
72- Improve tri-layer behavior
73
74[Workman]: https://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/
diff --git a/keyboards/mitosis/keymaps/datagrok/rules.mk b/keyboards/mitosis/keymaps/datagrok/rules.mk
new file mode 100644
index 000000000..767807299
--- /dev/null
+++ b/keyboards/mitosis/keymaps/datagrok/rules.mk
@@ -0,0 +1,15 @@
1# I use an 8Mhz Pro Micro
2F_CPU = 8000000
3# Necessary, with above change?
4F_USB = $(F_CPU)
5
6BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
7MOUSEKEY_ENABLE = no # Mouse keys(+4700)
8EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
9CONSOLE_ENABLE = no # Console for debug(+400)
10COMMAND_ENABLE = no # Commands for debug and configuration
11UNICODE_ENABLE = no # Unicode
12BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
13BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
14MIDI_ENABLE = no # MIDI controls
15# vim: set ts=8 noet: