diff options
author | Michael F. Lamb <mike@datagrok.org> | 2018-09-04 08:55:31 -0700 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-09-04 08:55:31 -0700 |
commit | 224b4dea9805412d0f4b677dc22c1c4fca79a9de (patch) | |
tree | a4fa63e4f4fff33c5dceb6963a498412a9bb213f | |
parent | 40718d2ca3590b34c3d41b8988fc055dc6b55add (diff) | |
download | qmk_firmware-224b4dea9805412d0f4b677dc22c1c4fca79a9de.tar.gz qmk_firmware-224b4dea9805412d0f4b677dc22c1c4fca79a9de.zip |
mitosis:datagrok add layer select, more layouts (#3835)
* mitosis:datagrok: fix typo'd inconsistent brace arrangement
(thank you @cari66ean)
* mitosis:datagrok: add makefile argument MITOSIS_DATAGROK_SLOWUART
* mitosis:datagrok: return backspace to opposite space, use TT(), more
- move backspace back to its position opposite space
- move del to red+backspace
- move tab back to tap-leftshift
- move printscreen/scrolllock/pause to blue+left pinky column
- use TT() instead of MO() to stick a layer on if wanted
- indentation that my text editor wants
- default to no audio; i can enable it at compile time.
* mitosis:datagrok: modularize features, add default layer rotator key
* mitosis: add MITOSIS_DATAGROK_BOTTOMSPACE makefile argument
* mitosis:datagrok: README improvements; document new features
* mitosis:datagrok: dot. not "number pad dot." in numbers layer
* mitosis:datagrok remove unnecessary _user audio code
* mitosis:datagrok: return to MO() for red/blue, keep TT() for purple
in this way, the LED still updates quickly when red or blue is pressed,
but we can still lock the purple layer on for 10-key numpad operation
with red+tapping blue.
* mitosis:datagrok: add colemak and dvorak default layers
* mitosis:datagrok update readme re: available default layouts
* mitosis: remove unneeded code that was overriding led_set_user
also, add some comments
* mitosis:datagrok: updated led setting code for new layers
also, place into led_set_user where it belongs, not matrix_scan_user.
* mitosis:datagrok: update LEDs when setting the default layer
maybe this should go into default_layer_set?
* mitosis:datagrok update readme with new imgur links + other improvements
* mitosis:datagrok fix typo in image urls
* mitosis:datagrok remove useless #include (ty @drashna)
* mitosis:datagrok undo unnecessary change to quantum/quantum.h
i can put the extern float definition in my own keymap code. (ty @drashna)
* mitosis:datagrok move customized layout to my keymap
no need to modify keyboard-level mitosis.h. (ty @drashna)
* mitosis:datagrok update comment describing my led indicator logic
* datagrok:mitosis update readme to document LED indicator.
-rw-r--r-- | keyboards/mitosis/keymaps/datagrok/config.h | 41 | ||||
-rw-r--r-- | keyboards/mitosis/keymaps/datagrok/keymap.c | 233 | ||||
-rw-r--r-- | keyboards/mitosis/keymaps/datagrok/readme.md | 145 | ||||
-rw-r--r-- | keyboards/mitosis/keymaps/datagrok/rules.mk | 25 | ||||
-rw-r--r-- | keyboards/mitosis/mitosis.c | 19 | ||||
-rw-r--r-- | keyboards/mitosis/mitosis.h | 19 |
6 files changed, 319 insertions, 163 deletions
diff --git a/keyboards/mitosis/keymaps/datagrok/config.h b/keyboards/mitosis/keymaps/datagrok/config.h index 9edb950cf1..1c70a3791a 100644 --- a/keyboards/mitosis/keymaps/datagrok/config.h +++ b/keyboards/mitosis/keymaps/datagrok/config.h @@ -1,12 +1,21 @@ #ifndef CONFIG_USER_H #define CONFIG_USER_H -#include "../../config.h" +#ifdef MITOSIS_DATAGROK_SLOWUART +// This is the highest possible baud rate that a pro micro clocked at 8Mhz can +// support without errors. I don't notice any difference in behavior at this +// slower speed. (So I think it should maybe be the default, to allow a single +// codebase to support both available flavors of pro micro.) This requires a +// corresponding change to the wireless module firmware; see +// https://github.com/reversebias/mitosis/pull/10 +#undef SERIAL_UART_BAUD // avoids redefinition warning +#define SERIAL_UART_BAUD 250000 +#endif // I want to place an underscore as tap behavior on the right shift key. But // RSFT_T(KC_UNDS) doesn't work; mod-tap doesn't work with pre-shifted keys. So -// instead we take advantage of Space Cadet Shift that does something similar -// and just tweak it to use the -_ key instead of 0) See +// instead I take advantage of Space Cadet Shift that does something similar +// and just tweak it to use the -/_ key instead of 0/). See // https://github.com/qmk/qmk_firmware/pull/2055 #define RSPC_KEY KC_MINS @@ -18,11 +27,12 @@ //#define NO_ACTION_FUNCTION #ifdef AUDIO_ENABLE -#define STARTUP_SONG SONG(PLANCK_SOUND) -// #define STARTUP_SONG SONG(NO_SOUND) -#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ - SONG(COLEMAK_SOUND), \ - SONG(DVORAK_SOUND) \ +#define STARTUP_SONG SONG(MARIO_MUSHROOM) +#define DEFAULT_LAYER_SONGS { \ + SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_SOUND), \ + SONG(ZELDA_TREASURE), \ } #define AUDIO_VOICES #define AUDIO_CLICKY @@ -30,3 +40,18 @@ #endif #endif + +#define LAYOUT_bottomspace( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, \ + k31, k32, k33, k34, k35, k36, k37, k38, \ + k41, k42, k43, k44, k45, k46, k47, k48 \ + ) \ + { \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09 }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19 }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29 }, \ + { KC_NO, k31, k32, k43, k44, k45, k46, k37, k38, KC_NO }, \ + { KC_NO, k41, k42, k33, k34, k35, k36, k47, k48, KC_NO } \ + } diff --git a/keyboards/mitosis/keymaps/datagrok/keymap.c b/keyboards/mitosis/keymaps/datagrok/keymap.c index 4fda3f839f..ae3b954700 100644 --- a/keyboards/mitosis/keymaps/datagrok/keymap.c +++ b/keyboards/mitosis/keymaps/datagrok/keymap.c @@ -1,16 +1,34 @@ #include QMK_KEYBOARD_H + #ifdef AUDIO_ENABLE #include "audio.h" +#ifdef DEFAULT_LAYER_SONGS +extern float default_layer_songs[][][]; +#endif #endif enum mitosis_layers -{ + { _xQ, // qwerty + _xC, // colemak + _xD, // dvorak _xW, // workman _xS, // symbols _xN, // numbers _xF // functions -}; + }; + +enum mitosis_keycodes + { + KC_LAYO = SAFE_RANGE + }; + +// Setting MITOSIS_DATAGROK_BOTTOMSPACE in rules.mk will swap the upper and +// lower center four thumb-keys. See keymaps/datagrok/rules.mk. +#ifdef MITOSIS_DATAGROK_BOTTOMSPACE +#undef LAYOUT +#define LAYOUT LAYOUT_bottomspace +#endif // Fillers to make layering more clear #define _______ KC_TRNS // Transparent @@ -31,58 +49,125 @@ enum mitosis_layers const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_xQ] = LAYOUT( - KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, - KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, - KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_QUOT, - /*, */ KC_LGUI, KC_LCTL, MO(_xS), KC_TAB, KC_SPC, MO(_xS), KC_RCTL, KC_RGUI, - /*, */ KC_HENK, KC_LALT, MO(_xN), KC_LSFT, KC_RSPC, MO(_xN), KC_RALT, KC_MHEN), + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_QUOT, + /*, */ KC_LGUI, KC_LCTL, MO(_xS), KC_BSPC, KC_SPC, MO(_xS), KC_RCTL, KC_RGUI, + /*, */ KC_HENK, KC_LALT, MO(_xN), LSFT_T(KC_TAB), KC_RSPC, MO(_xN), KC_RALT, KC_MHEN), + [_xC] = LAYOUT( + KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, + KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_QUOT, + /*, */ _______, _______, _______, _______, _______, _______, _______, _______, + /*, */ _______, _______, _______, _______, _______, _______, _______, _______), + [_xD] = LAYOUT( + KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, + KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, + KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, + /*, */ _______, _______, _______, _______, _______, _______, _______, _______, + /*, */ _______, _______, _______, _______, _______, _______, _______, _______), [_xW] = LAYOUT( - KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, - KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, - KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_QUOT, - /*, */ _______, _______, _______, _______, _______, _______, _______, _______, - /*, */ _______, _______, _______, _______, _______, _______, _______, _______), + KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, + KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, + KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_QUOT, + /*, */ _______, _______, _______, _______, _______, _______, _______, _______, + /*, */ _______, _______, _______, _______, _______, _______, _______, _______), [_xS] = LAYOUT( - KC_ESC, KC_GRV , KC_UP, KC_EQL , KC_TILD, KC_PLUS, KC_CIRC, KC_AMPR, KC_PERC, KC_MINS, - KC_BSPC, KC_LEFT, KC_DOWN, KC_RGHT, _______, KC_PIPE, KC_AT, KC_DLR, KC_HASH, KC_ENT, - KC_BSLS, KC_LABK, KC_LCBR, KC_LPRN, KC_LBRC, KC_RBRC, KC_RCBR, KC_RPRN, KC_RABK, KC_SLSH, - /*, */ _______, _______, _______, _______, _______, _______, _______, _______, - /*, */ _______, _______, MO(_xF), _______, _______, MO(_xF), _______, _______), + KC_ESC, KC_GRV , KC_UP, KC_EQL , KC_TILD, KC_PLUS, KC_CIRC, KC_AMPR, KC_PERC, KC_MINS, + _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, KC_PIPE, KC_AT, KC_DLR, KC_HASH, KC_ENT, + KC_BSLS, KC_LABK, KC_LCBR, KC_LPRN, KC_LBRC, KC_RBRC, KC_RPRN, KC_RCBR, KC_RABK, KC_SLSH, + /*, */ _______, _______, _______, KC_DEL, _______, _______, _______, _______, + /*, */ _______, _______, TT(_xF), _______, _______, TT(_xF), _______, _______), [_xN] = LAYOUT( - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_PPLS, KC_7, KC_8, KC_9, KC_PMNS, - _______, KC_F4, KC_F5, KC_F6, KC_F11, KC_NLCK, KC_4, KC_5, KC_6, KC_PENT, - _______, KC_F1, KC_F2, KC_F3, KC_F12, KC_PAST, KC_1, KC_2, KC_3, KC_PSLS, - /*, */ _______, _______, MO(_xF), _______, _______, MO(_xF), KC_0, KC_PDOT, - /*, */ _______, _______, _______, _______, _______, _______, _______, _______), + KC_PSCR, KC_F7, KC_F8, KC_F9, KC_F10, KC_PPLS, KC_7, KC_8, KC_9, KC_PMNS, + KC_SLCK, KC_F4, KC_F5, KC_F6, KC_F11, KC_NLCK, KC_4, KC_5, KC_6, KC_PENT, + KC_PAUS, KC_F1, KC_F2, KC_F3, KC_F12, KC_PAST, KC_1, KC_2, KC_3, KC_PSLS, + /*, */ _______, _______, TT(_xF), _______, _______, TT(_xF), KC_0, KC_DOT, + /*, */ _______, _______, _______, _______, _______, _______, _______, _______), [_xF] = LAYOUT( - RESET, KC_INS, KC_PGUP, KC_DEL, KC_VOLU, KC_PPLS, KC_P7, KC_P8, KC_P9, KC_PMNS, - CK_TOGG, KC_HOME, KC_PGDN, KC_END, KC_VOLD, KC_NLCK, KC_P4, KC_P5, KC_P6, KC_PENT, - TG(_xW), KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_PAST, KC_P1, KC_P2, KC_P3, KC_PSLS, - /*, */ CK_UP, MU_TOG, _______, _______, _______, _______, KC_P0, KC_PDOT, - /*, */ CK_DOWN, MU_MOD, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS), + RESET, KC_INS, KC_PGUP, DEBUG, KC_VOLU, KC_PPLS, KC_P7, KC_P8, KC_P9, KC_PMNS, + CK_TOGG, KC_HOME, KC_PGDN, KC_END, KC_VOLD, KC_NLCK, KC_P4, KC_P5, KC_P6, KC_PENT, + KC_LAYO, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_PAST, KC_P1, KC_P2, KC_P3, KC_PSLS, + /*, */ CK_UP, MU_TOG, _______, _______, _______, _______, KC_P0, KC_PDOT, + /*, */ CK_DOWN, MU_MOD, _______, _______, _______, _______, _______, _______), }; +const bool defaultlayers[] = { + [_xQ] = true, + [_xC] = true, + [_xD] = true, + [_xW] = true, + [_xS] = false, + [_xN] = false, + [_xF] = false, +}; +const size_t defaultlayers_n = sizeof(defaultlayers) / sizeof(defaultlayers[0]); + +// New keycode KC_LAYO rotates between available default layers (for e.g., +// selecting a base layout). Shift+KC_LAYO makes the current one persistent. +bool process_record_layout(uint16_t keycode, keyrecord_t *record) { + uint32_t default_layer; + uint8_t i; + #if defined(AUDIO_ENABLE) + float saved_song[][2] = SONG(COIN_SOUND); + #endif + + if (keycode != KC_LAYO || !record->event.pressed) { + return true; + } -// This is a hack to place <question mark> on <shift-comma> and <exclaimation + if (get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))) { // shift pressed + // save default layer. whatever the current default layer is, store that + eeconfig_update_default_layer(default_layer_state); + #if defined(AUDIO_ENABLE) + PLAY_SONG(saved_song); + #endif + } else { + // rotate default layer. + // find the current default layer + default_layer = biton32(default_layer_state); + // find next valid default layer + for (i = 1; i < defaultlayers_n; i++) { + if (defaultlayers[(default_layer + i) % defaultlayers_n]) { + break; + } + } + if (i == defaultlayers_n) { + // we fell out of the loop without finding another default layer to switch + // to. + return false; + } + default_layer = (default_layer + i) % defaultlayers_n; + default_layer_set(1U<<default_layer); + led_set(host_keyboard_leds()); + #if defined(AUDIO_ENABLE) && defined(DEFAULT_LAYER_SONGS) + PLAY_SONG(default_layer_songs[default_layer]); + #endif + } + return false; +} + +// This is a hack to place <question mark> on <shift-comma> and <exclamation // mark> on <shift-period>, when using an operating system configured for a // US/qwerty layout. +// cdeq = "comma dot exclamation question" bool comm_shifted = false; bool ques_shifted = false; -bool process_record_user(uint16_t keycode, keyrecord_t *record) { +bool process_record_cdeq(uint16_t keycode, keyrecord_t *record) { uint8_t shifted; uint16_t s_keycode; bool *k_shifted; switch (keycode) { - case KC_COMM: - s_keycode = KC_SLSH; - k_shifted = &comm_shifted; - break; - case KC_DOT: - s_keycode = KC_1; - k_shifted = &ques_shifted; - break; - default: - return true; + case KC_COMM: + s_keycode = KC_SLSH; + k_shifted = &comm_shifted; + break; + case KC_DOT: + s_keycode = KC_1; + k_shifted = &ques_shifted; + break; + default: + return true; } shifted = get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)); @@ -104,47 +189,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } -#ifdef AUDIO_ENABLE -float tone_qwerty[][2] = SONG(QWERTY_SOUND); -float tone_dyn_macro_rec[][2] = SONG(DVORAK_SOUND); -float tone_dyn_macro_play[][2] = SONG(COLEMAK_SOUND); -float tone_fnpc[][2] = SONG(PLOVER_SOUND); -float tone_fnmac[][2] = SONG(PLOVER_GOODBYE_SOUND); - -void startup_user() -{ - float tone_startup[][2] = SONG(STARTUP_SOUND); - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user() -{ - float tone_goodbye[][2] = SONG(GOODBYE_SOUND); - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - PLAY_SONG(music_scale); +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return \ + process_record_cdeq(keycode, record) && \ + process_record_layout(keycode, record); } -#endif - // Set the bits of A selected by MASK to the corresponding bits of B #define setbits(A, B, MASK) A = (A & (B | ~MASK)) | (B & MASK) -void matrix_scan_user(void) { + +void led_set_user(uint8_t usb_leds) { + // A simple (but technically inaccurate) model of the momentary layer state: + // Red layer active -> indicator = red + // Blue layer active -> indicator = blue + // Purple layer active -> indicator = purple + // the Pro Micro tx LED displays Num Lock status. // + // Workman layout active -> indicator = green + // Workman red layer -> indicator = yellow (red + green) + // Workman blue layer -> indicator = cyan (blue + green) + // Workman purple layer -> indicator = white (red + blue + green) + // Bit # 7 6 5 4 3 2 1 0 - // layer_state: [ | | | _xF | _xN | _xS | _xQ | _xW ] + // layer_state: [ | _xF | _xN | _xS | _xW | _xD | _xC | _xQ ] // usb_led [ | | |kana |cmps |scrl |caps | num ] // PORTB: [ NC | 10 | 9 | 8 | 14 | 16 | 15 |rxled] // PORTC: [ NC | 5 | | | | | | ] @@ -158,16 +225,16 @@ void matrix_scan_user(void) { // board. Each may be connected to an LED by way of a resistor (4.7k to // match the others) for a total of 14 additional indicators. - // A simple (but technically inaccurate) model of the momentary layer state: - // Fn1 key makes _xS active; indicator = red - // Fn2 key makes _xN active; indicator = blue - // Both keys make _xF active; indicator = purple - // Toggling QWERTY mode makes indicator include green, so (red/blue/purple becomes yellow/cyan/white) - + uint32_t portf_bits = \ + ((layer_state|default_layer_state)&0b01100000)>>1 | \ + ((layer_state|default_layer_state)&0b00010000)<<1 | \ + ((layer_state|default_layer_state)&0b01000000)>>2; + uint32_t portd_bits = \ + (usb_leds&0b1)<<5 | \ + ((layer_state|default_layer_state)&0b1000)>>2; // negated because for ports 0=LED on. - uint32_t portf_bits = ~(layer_state|layer_state<<1|(layer_state&0b100)<<3); - setbits(PORTF, portf_bits, 0b00110000); - setbits(PORTD, ~layer_state, 0b00000010); + setbits(PORTF, ~portf_bits, 0b00110000); + setbits(PORTD, ~portd_bits, 0b00100010); } // vim: set sw=2 et: diff --git a/keyboards/mitosis/keymaps/datagrok/readme.md b/keyboards/mitosis/keymaps/datagrok/readme.md index 9b159b98a0..22d7f4d2fc 100644 --- a/keyboards/mitosis/keymaps/datagrok/readme.md +++ b/keyboards/mitosis/keymaps/datagrok/readme.md @@ -1,54 +1,59 @@ # a layout for the Mitosis - Emphasis on momentary modifiers, all usable from either hand, arranged symmetrically, but left/right distinguishable by the OS. - Shift, Red ("Lower"), Blue ("Raise"), Super ("Windows"), Meta ("Alt"), Hyper (actually Henkan/Muhenkan). + I place left- and right-versions of Shift, GUI ("Super"), and Alt ("Meta"), and Henkan/Muhenkan (which I plan to overload for "Hyper"). + I'm going for a [Space Cadet](https://en.wikipedia.org/wiki/Space-cadet_keyboard) aesthetic; I want a keyboard that can (even just in theory) make use of all the bucky bits my operating system can support. -- Red and Blue are used to momentary-enable (like a shift key) one of three layers: +- Red key and Blue key momentary-enable (like a shift key) one of three layers: - Red: Symbols layer - Blue: Numbers layer - "Purple" (both Red and Blue): Functions layer + + This tri-state layer mechanism is a bit similar to Planck and Preonic's "Raise," "Lower," and "Adjust." - The base layer is QWERTY. - A slight variant of [Workman][] may be toggled using `Red`+`Blue`+`Z`. + [Colemak][], [Dvorak][], and [Workman][] may be toggled using `Red`+`Blue`+`Z`. + When you find the one you like, save it with `Shift`+`Red`+`Blue`+`Z`. - Minimize hand travel, so as not to lose orientation with home row. -- `?` and `!` are moved to take the place of `<` and `>`. Rationale: unmodded - and shifted keys should be for prose, while symbols useful for programming - should be colocated on their own layer. +- `?` and `!` are moved to take the place of `<` and `>`. + Rationale: unmodded and shifted keys should be for prose, while symbols useful for programming should be colocated on their own layer. - Key positions chosen for mnemonics. For example, you can distinguish between alphanumeric numerals and keypad numerals, but they occupy the same key positions. ## Layout Images -![mitosis:datagrok layout base layer](https://imgur.com/9LoLQUk.png) +![mitosis:datagrok layout base layer](https://i.imgur.com/tap5Pjf.png) Base layer. Notes: - customized comma and period, which have exclamation point and question mark on their shift layer. -- tap right-shift for underscore +- tap right-shift for underscore, tap left-shift for tab. -![mitosis:datagrok layout red layer](https://imgur.com/B5bnPGM.png) +![mitosis:datagrok layout red layer](https://i.imgur.com/sMGr34T.png) Red layer. Intended for common navigation and programming symbols. Notes: - symmetric layout of paired braces/brackets/slashes for easier memorization - arrows placed directly on home position -![mitosis:datagrok layout blue layer](https://imgur.com/HGJ4G1U.png) +![mitosis:datagrok layout blue layer](https://i.imgur.com/dDb2563.png) Blue layer. Intended for "number pad." Notes: -- Keycodes generated for numbers, enter key, and mathematical symbols are from the alphanumeric keys, not keypad. This way they are not influenced by the state of Num Lock. If you want to send the keypad equivalents, just use Red and Blue modifiers simultaneously. +- Keycodes generated for numbers, enter key, and mathematical symbols are from the alphanumeric keys, not keypad. + This way they are not influenced by the state of Num Lock. + If you want to send the keypad equivalents, just press Blue as well to access keypad numbers in the same positions in the Purple layer. -![mitosis:datagrok layout purple layer](https://imgur.com/lNsKDtA.png) +![mitosis:datagrok layout purple layer](https://i.imgur.com/pESzy2u.png) Purple (Red+Blue) layer. Intended for "true keypad" and various functions. Notes: - Numbers on this layer send Keypad codes, so the result will be affected by the state of Num Lock. -- "Switch Layout" toggles the alphabet keys between QWERTY and Workman -- Page Up / Page Down / Home / End are placed on similar arrows -- To press Print Screen it is necessary to use the left-side Red and Blue modifiers. +- "Switch Layout" toggles the alphabet keys between QWERTY, Colemak, Dvorak, and Workman. + Shift + "Switch Layout" stores the currently selected alphabet layout in eeprom, so the selection persists across reboots and computers. +- Page Up / Page Down / Home / End are placed on corresponding arrow keys. Keyboard layout editor sources: [base](http://www.keyboard-layout-editor.com/#/gists/bc2d06a3203d1bc3a14ed2245cf39643) @@ -56,14 +61,41 @@ Keyboard layout editor sources: [blue](http://www.keyboard-layout-editor.com/#/gists/240e807f3d7e1d3ddabe1b69ee675048) [purple](http://www.keyboard-layout-editor.com/#/gists/9559f0f8bb1ee47677c8f2b4d766829d) -[Imgur album](https://imgur.com/a/KSoVgPx) +[Imgur album](https://imgur.com/a/hm4bbdM) + +## Indicators + +- When Red layer is active, the RGB indicator turns red. +- When Blue layer is active, the RGB indicator turns blue. +- When Purple layer is active, the RGB indicator turns purple. +- When the Workman layer is active, the RGB indicator turns green. + Currently, this means that activating the Red layer while using the Workman layout will make the indicator show yellow. (red + green.) +- The Num Lock status is shown on the Pro Micro tx LED. +- If you attach a speaker to PC6 (pin 5) and compile with AUDIO_ENABLE=yes, music will be played at startup, when switching default layers, and when saving the default layer. + +## Variants + +Some additional compile-time options for this layout are available by editing rules.mk or compiling like so: + +Normal compilation: + +```make mitosis:datagrok``` + +Swap Space onto bottom thumb row: swaps Red/Backspace/Space/Red with Blue/Shift/Shift/Blue: + +```make mitosis:datagrok MITOSIS_DATAGROK_BOTTOMSPACE=yes``` + +Lower baud UART. Useful when using an 8Mhz pro micro; corresponding changes required in wireless firmware. See rules.mk for details. + +```make mitosis:datagrok MITOSIS_DATAGROK_SLOWUART=yes``` ## Design notes ### Workman layout -- I'm learning a new physical key placement, so I might as well go all-out and - use an optimal non-QWERTY layout. +- I'm learning a new physical key placement, so I might as well go all-out and use an optimal non-QWERTY layout. + Bonus: it's easy to switch back to QWERTY on a traditional row-staggered keyboard. + The designer of the Mitosis had [a similar experience](https://www.reddit.com/r/MechanicalKeyboards/comments/66588f/wireless_split_qmk_mitosis/dgfr22q/). - I like the way Workman feels and some of its advantages over Colemak. Unfortunately, it was designed using a weighting system based on a standard @@ -78,14 +110,10 @@ Keyboard layout editor sources: The next fastest baudrate that works without errors is 250k baud. So if you want to do the same: - - Set the Pro Micro clock rate correctly in `rules.mk`: + - Set the Pro Micro clock and baud rate correctly in `rules.mk`: ``` F_CPU = 800000 - ``` - - Configure it to communicate at 250k baud in `config.h`: - ``` - #undef SERIAL_UART_BAUD // avoids redefinition warning - #define SERIAL_UART_BAUD 250000 + MITOSIS_DATAGROK_SLOWUART = yes ``` - Configure the receiver's wireless module to communicate at 250k baud in `main.c`. See https://github.com/reversebias/mitosis/pull/10 ``` @@ -99,7 +127,7 @@ Keyboard layout editor sources: - Arrow keys are in the home position on the Red layer. - - Blue+Arrows = PgUp/PgDn/Home/End, which is intuitive for me. + - Blue+Arrows = PgUp/PgDn/Home/End, which is intuitive for me and similar to what is done on Apple and some Dell keyboards. - The number pad: I placed the ten-key number pad on the Blue layer. However, this would do the wrong thing when Num Lock was not enabled. @@ -111,11 +139,7 @@ Keyboard layout editor sources: - The Function-keys are arranged to mimic the order of the ten-key pad. - Enter is now in a more qwerty-familiar location, and may be activated with one hand. - Numpad Enter is in the same position. - -- Rather than place Backspace opposite Space, I intentionally place it on a layer where it takes some effort to activate. - Backspace is one of the keys I most dislike on a QWERTY keyboard because it moves me away from homerow and I need to use it so often. - Rather than make it easier to strike, I want to discourage myself from using it by learning to type more accurately. + Numpad Enter is in the same position for mnemonics. - Why do I dislike [snake\_case](https://en.wikipedia.org/wiki/Snake_case) (`__variable_names_that_use_underscores_`)? Maybe because it's hard to type all those underscores requiring the shift key? @@ -126,6 +150,22 @@ Keyboard layout editor sources: ### Current +- Discard "intentionally difficult backspace" idea. + Tab returns to left-shift. + Del returns to Red+Backspace +- "High Profile mode:" Swap Red/Backspace/Space/Red with Blue/Shift/Shift/Blue (placing space on lower thumb keys) using `MITOSIS_DATAGROK_BOTTOMSPACE=yes` when compiling. +- Move Print Screen / Scroll Lock / Pause to pinky column on Blue layer. +- Let's try using TT instead of MO so we can e.g. lock-on the keypad. + - We still use MO for first modifier, so e.g. Red + tapping Blue will lock purple. + So far it feels a bit janky, we'll see. +- One key `KC_LAYO` to cycle through available base layers instead of a dedicated key for each; + Shift + `KC_LAYO` stores current base layer selection in eeprom so it comes back after disconnecting or a reset. +- Added Colemak and Dvorak as default layers that may be selected. +- Set UART to 250kbaud with make argument `MITOSIS_DATAGROK_SLOWUART=yes`, for use with 8Mhz Pro Micros. +- Display Num Lock status on tx LED + +### 0.6.60 + - Experiment: no-modifier underscore on right shift key. - New combined numbers + keypad arrangement. No more worrying about Num Lock key. @@ -168,27 +208,33 @@ Keyboard layout editor sources: ### Abandoned ideas -- "Since QWERTY and Workman keep angle brackets together, place other - enclosing symbols on the same keys. This informs the numbers placement, - which informs the function-key placement." +- Abandoned: intentionally-difficult backspace. + "Backspace is one of the keys I most dislike on a QWERTY keyboard because it moves me away from homerow and I need to use it so often. + Rather than make it easier to strike, I want to discourage myself from using it and train myself to type more accurately." + + - Many other people like an easy-to-reach backspace. + - Many other split-spacebar ergo boards place backspace at the thumbs. + - I can still train myself to type well with it in an easy location. + - I couldn't think of anything really better to put opposite space. - - I tried this and it was bad. I don't like having to pick the right - modifier to get the right flavor of bracket. Instead, now, one modifier - activates a symbols layer where all brackets are easily accessible. +- Abandoned: pile all brackets onto one pair of keys. + "Since QWERTY and Workman keep angle brackets together, place other enclosing symbols on the same keys." -- Space/Enter to the left of layer select for Enter + - I didn't like having to pick the right modifier to get the right flavor of bracket. + Instead, now, one modifier activates a symbols layer where all brackets are easily accessible. - - Doesn't work well; I always trigger space first when mashing the keys +- Abandoned: chorded Enter without proper chording detection + + - I tried to make Red+Space = Enter with the intention that I could hit both with my thumb. + That didn't work well; I always trigger space first when mashing the keys simultaneously. ~~This might not continue to be true if I change the angle at which I strike the keys e.g. with a neoprene base or a wrist support.~~ Even with a wrist rest or low-profile, this is hard to do with one hand. Need to adjust the firmware to understand chorded thumb keys. -- I used to have Blue on ring finger, but that was too hard to use in - conjunction with shift. - ## To do +- Ctrl+'+' doesn't seem to work; fix. - **Shared Layouts.** Figure out how to make use of QMK's common `layouts/` - **Chorded Combos.** @@ -203,16 +249,23 @@ Keyboard layout editor sources: Do any of my applications use it? Should I have the firmware ensure it is set how I want it? Maybe cause it to be momentary active with Blue? - See [@drashna's comment](https://github.com/qmk/qmk_firmware/pull/2366#issuecomment-404951953) -- Store default base layer in eeprom? + See [@drashna's comment](https://github.com/qmk/qmk_firmware/pull/2366#issuecomment-404951953) for code to force it always-on, which I don't know if I want. +- ~~Store default layer in eeprom?~~ +- Allow "!? on ,." to be easily toggled-off. +- Modularize "!? on ,." so it can be easily used on any QMK keyboard. (about half done) - See if the henkan/muhenkan placement is at all useful for Japanese speakers, or abuse different keysyms for Left/Right Hyper. (Original space cadet used scancodes 145/175. 145 is LANG2, 175 is "reserved" in USB HID spec.) - Implement "layer lock" key +- Feature parity with popular boards e.g. Planck? + - Layers for ~~Dvorak, Coleman,~~ Plover + - More music and midi stuff + - Macros? - Improve tri-layer behavior -- Find a better location for PrintScr/SysRq, Scroll Lock, Pause/Break, Caps Lock. -- ~~Figure out where to place non-numpad numbers so we don't need num lock turned - on to type them?~~ +- Find out what `update_tri_layer_state` offers that my simple layers arrangement lacks. +- ~~Find a better location for Caps Lock, PrintScr/SysRq, Scroll Lock, Pause/Break,~~. + Placed on Blue layer. Caps will be Shift+"Layer Lock," once I get that working. +- ~~Figure out where to place non-numpad numbers so we don't need num lock turned on to type them?~~ - ~~Add Insert, PrintScr, Pause/Break~~ - ~~Make QWERTY base layer for people who customize layout in software?~~ I default to QWERTY now. diff --git a/keyboards/mitosis/keymaps/datagrok/rules.mk b/keyboards/mitosis/keymaps/datagrok/rules.mk index a321a67b28..215e58a7d1 100644 --- a/keyboards/mitosis/keymaps/datagrok/rules.mk +++ b/keyboards/mitosis/keymaps/datagrok/rules.mk @@ -1,4 +1,19 @@ -AUDIO_ENABLE = yes # audio output +# Space and "Red" modifier are keys I want in the easiest-to-reach position in +# the thumb row. Depending on the angle and height of the Mitosis and the type +# of keycaps you use, the upper row or the lower row of thumb keys might be more +# comfortable for you. I put red/space on the upper row and blue/shift on the +# lower, but to swap that, set MITOSIS_DATAGROK_BOTTOMSPACE = yes. This has the +# effect of swapping only the four center keys on the upper row of thumb keys with that +# of the lower row of thumb keys. +MITOSIS_DATAGROK_BOTTOMSPACE = no + +# I used to use a pro micro clocked at 8Mhz. It can't reach the same baud rate +# that the standard 16Mhz-clocked pro micro can, so the baud rate needs to be +# lowered. Set this to "yes" to do that. See also +# https://github.com/reversebias/mitosis/pull/10 +MITOSIS_DATAGROK_SLOWUART = no + +AUDIO_ENABLE = no # audio output FAUXCLICKY_ENABLE = no BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = no # Mouse keys(+4700) @@ -9,4 +24,12 @@ UNICODE_ENABLE = no # Unicode BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID MIDI_ENABLE = no # MIDI controls + +ifeq ($(strip $(MITOSIS_DATAGROK_BOTTOMSPACE)), yes) + OPT_DEFS += -DMITOSIS_DATAGROK_BOTTOMSPACE +endif +ifeq ($(strip $(MITOSIS_DATAGROK_SLOWUART)), yes) + OPT_DEFS += -DMITOSIS_DATAGROK_SLOWUART +endif + # vim: set ts=8 noet: diff --git a/keyboards/mitosis/mitosis.c b/keyboards/mitosis/mitosis.c index f965f2a048..1ca7276e41 100644 --- a/keyboards/mitosis/mitosis.c +++ b/keyboards/mitosis/mitosis.c @@ -5,13 +5,12 @@ void uart_init(void) { } void led_init(void) { - DDRD |= (1<<1); - PORTD |= (1<<1); - DDRF |= (1<<4) | (1<<5); - PORTF |= (1<<4) | (1<<5); + DDRD |= (1<<1); // Pin to green, set as output + PORTD |= (1<<1); // Turn it off + DDRF |= (1<<4) | (1<<5); // Pins to red and blue, set as output + PORTF |= (1<<4) | (1<<5); // Turn them off } - void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up @@ -20,16 +19,6 @@ void matrix_init_kb(void) { led_init(); } -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - matrix_scan_user(); -} - -void led_set_kb(uint8_t usb_led) { - -} - #ifdef SWAP_HANDS_ENABLE __attribute__ ((weak)) const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/mitosis/mitosis.h b/keyboards/mitosis/mitosis.h index 5dd7cc778d..4b73f0407a 100644 --- a/keyboards/mitosis/mitosis.h +++ b/keyboards/mitosis/mitosis.h @@ -53,15 +53,14 @@ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, \ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, \ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, \ - k31, k32, k33, k34, k35, k36, k37, k38, \ - k41, k42, k43, k44, k45, k46, k47, k48 \ + k31, k32, k33, k34, k35, k36, k37, k38, \ + k41, k42, k43, k44, k45, k46, k47, k48 \ ) \ -{ \ - { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09 }, \ - { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19 }, \ - { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29 }, \ - { KC_NO, k31, k32, k33, k34, k35, k36, k37, k38, KC_NO }, \ - { KC_NO, k41, k42, k43, k44, k45, k46, k47, k48, KC_NO } \ -} - + { \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09 }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19 }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29 }, \ + { KC_NO, k31, k32, k33, k34, k35, k36, k37, k38, KC_NO }, \ + { KC_NO, k41, k42, k43, k44, k45, k46, k47, k48, KC_NO } \ + } #endif |