From a2a2ba0eec6aa5fffcc24d25d29883ccc0ae1816 Mon Sep 17 00:00:00 2001 From: leico Date: Mon, 4 Mar 2019 03:49:27 +0900 Subject: [PATCH] [Keymap] layout/community/ortho4x12/symbolic update (#5274) * change readme.md * diy LayerTap function * fixed forgot update_tri_layer correspound permissive hold * update README * change No_event of general shift * update symbolic layout * merge symbolic_general_shift to symbolic layout * update README.md * following code style * delete excess codes, change codes that don't follows the code style --- .../community/ortho_4x12/symbolic/README.md | 23 +-- .../community/ortho_4x12/symbolic/config.h | 3 +- .../community/ortho_4x12/symbolic/keymap.c | 138 +++++++++++++----- 3 files changed, 116 insertions(+), 48 deletions(-) diff --git a/layouts/community/ortho_4x12/symbolic/README.md b/layouts/community/ortho_4x12/symbolic/README.md index 37fbcd56a4..2c69d5160e 100644 --- a/layouts/community/ortho_4x12/symbolic/README.md +++ b/layouts/community/ortho_4x12/symbolic/README.md @@ -1,26 +1,24 @@ -# Symbolic ortho 4x12 layout +# Symbolic ortho 4x12 layout ## Features ### QWERTY based -![QWERTY layout](https://gist.githubusercontent.com/leico/cb50ecd12eb8ad906a69678f265cd52c/raw/4597497ecd00790312f1a3928b2e2c5cf17a6ac1/QWERTY.png) - +![QWERTY layout](https://gist.githubusercontent.com/leico/5bf4d9ff94f2068c5333739f7f1f88b4/raw/2af7fed6f282b6ac278e79433d15887f6b91ba3a/QWERTY.png) + * Default keymap * QWERTY layout * Hold and tap - * `Shift` and `Space` * `Left Ctrl` and `Tab` * Symmetric Modifiers * `Shift` * `Raise Layer` * `Lower Layer` * `GUI` - * `Reset` ### symbol charactor layer -![Raise layout](https://gist.githubusercontent.com/leico/cb50ecd12eb8ad906a69678f265cd52c/raw/4597497ecd00790312f1a3928b2e2c5cf17a6ac1/Raise.png) +![Raise layout](https://gist.githubusercontent.com/leico/5bf4d9ff94f2068c5333739f7f1f88b4/raw/2af7fed6f282b6ac278e79433d15887f6b91ba3a/Raise.png) * Raise Layer * assigned symbolic(punctuation) characters @@ -37,23 +35,31 @@ ### numbers and allows layer -![Lower layout](https://gist.githubusercontent.com/leico/cb50ecd12eb8ad906a69678f265cd52c/raw/4597497ecd00790312f1a3928b2e2c5cf17a6ac1/Lower.png) +![Lower layout](https://gist.githubusercontent.com/leico/5bf4d9ff94f2068c5333739f7f1f88b4/raw/2af7fed6f282b6ac278e79433d15887f6b91ba3a/Lower.png) * Lower Layer * entrust vim style arrows * also numkeys * additional, computer volume keys * transparent all modifiers +* **changed 2018/09/04** + * assign keys + * Home + * Page Down + * Page Up + * End + * Print Screen ### Numpads and F key layer -![Neutral layout](https://gist.githubusercontent.com/leico/cb50ecd12eb8ad906a69678f265cd52c/raw/4597497ecd00790312f1a3928b2e2c5cf17a6ac1/Neutral.png) +![Neutral layout](https://gist.githubusercontent.com/leico/5bf4d9ff94f2068c5333739f7f1f88b4/raw/2af7fed6f282b6ac278e79433d15887f6b91ba3a/Neutral.png) * visibled when Raise and Lower layer visibled * F keys assigned left hand side * Numpads assigned right hand side * for that reason, override `RGUI` key * transparent mostly modifiers +* visibled `Reset` key on both hands ### Goals @@ -63,7 +69,6 @@ * simple, minimal, easy learn * as soon as possible, don't disable any shortcuts - ### suggestions or find issues [post issues for my fork](https://github.com/leico/qmk_firmware/issues) diff --git a/layouts/community/ortho_4x12/symbolic/config.h b/layouts/community/ortho_4x12/symbolic/config.h index c29b077062..3f88b4cc17 100644 --- a/layouts/community/ortho_4x12/symbolic/config.h +++ b/layouts/community/ortho_4x12/symbolic/config.h @@ -20,8 +20,7 @@ along with this program. If not, see . #pragma once -// hold & tapping delay setting -#define TAPPING_TERM 100 + /* Use I2C or Serial, not both */ diff --git a/layouts/community/ortho_4x12/symbolic/keymap.c b/layouts/community/ortho_4x12/symbolic/keymap.c index 1e5494d96e..c292373711 100644 --- a/layouts/community/ortho_4x12/symbolic/keymap.c +++ b/layouts/community/ortho_4x12/symbolic/keymap.c @@ -19,6 +19,7 @@ enum custom_keycodes { R_RAISE }; + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Qwerty @@ -30,17 +31,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Tab | A | S | D | F | G || H | J | K | L | ; |Enter | * |------+------+------+------+------+------++------+------+------+------+------+------| * | | | | | | || | | | | | | - * | | Z | X | C | V | B || N | M | , | . | ! | | + * |Shift | Z | X | C | V | B || N | M | , | . | ! |Shift | * |------+------+------+------+------+------++------+------+------+------+------+------| - * | | | | | |LSFT_T||RSFT_T| | | | | | - * |Reset | Alt | GUI |LLower|LRaise|Space ||Space |RRaise|RLower| GUI | Del |Reset | + * | | | | | | || | | | | | | + * |LRaise| Alt | GUI | |LLower|Space ||Space |RLower| | GUI | Del |RRaise| * `------------------------------------------------------------------------------------' */ [_QWERTY] = LAYOUT_ortho_4x12( \ - KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ - LCTL_T(KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, \ - XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_EXLM, XXXXXXX, \ - RESET, KC_LALT, KC_LGUI, L_LOWER, L_RAISE, LSFT_T( KC_SPC ), RSFT_T( KC_SPC ), R_RAISE, R_LOWER, KC_RGUI, KC_DEL, RESET \ + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ + LCTL_T(KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_EXLM, KC_RSFT, \ + L_RAISE, KC_LALT, KC_LGUI, XXXXXXX, L_LOWER, KC_SPC, KC_SPC, R_LOWER, XXXXXXX, KC_RGUI, KC_DEL, R_RAISE \ ), /* Raise @@ -52,16 +53,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Tab | ~ | | | ( | ) | * || / | < | > | ' | : |Enter | * |------+------+------+------+------+------++------+------+------+------+------+------| * | | | | | | || | | | | | | - * | | ` | ^ | @ | $ | + || - | = | _ | " | ? | | + * |Shift | ` | ^ | @ | $ | + || - | = | _ | " | ? |Shift | * |------+------+------+------+------+------++------+------+------+------+------+------| - * | | | | | |LSFT_T||RSFT_T| | | | | | - * |Reset | Alt | GUI |LLower|LRaise|Space ||Space |RRaise|RLower| GUI | Del |Reset | + * | | | | | | || | | | | | | + * |LRaise| Alt | GUI | |LLower|Space ||Space |RLower| | GUI | Del |RRaise| * `------------------------------------------------------------------------------------' */ [_RAISE] = LAYOUT_ortho_4x12( \ _______, XXXXXXX, KC_AMPR, KC_LCBR, KC_RCBR, KC_PERC, KC_BSLS, KC_LBRC, KC_RBRC, KC_HASH, XXXXXXX, _______, \ - _______, KC_TILD, KC_PIPE, KC_LPRN, KC_RPRN, KC_ASTR, KC_SLSH, KC_LABK, KC_RABK, KC_QUOT, KC_COLN, _______, \ - _______, KC_GRV, KC_CIRC, KC_AT, KC_DLR, KC_PLUS, KC_MINS, KC_EQL, KC_UNDS, KC_DQUO, KC_QUES, _______, \ + _______, KC_TILD, KC_PIPE, KC_LPRN, KC_RPRN, KC_ASTR, KC_SLSH, KC_LABK, KC_RABK, KC_DQUO, KC_COLN, _______, \ + _______, KC_GRV, KC_CIRC, KC_AT, KC_DLR, KC_PLUS, KC_MINS, KC_EQL, KC_UNDS, KC_QUOT, KC_QUES, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ), /* Lower @@ -73,16 +74,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Tab | |VolDn |VolUp | Mute | || Left | Down | Up |Right | |Enter | * |------+------+------+------+------+------++------+------+------+------+------+------| * | | | | | | || | | | | | | - * | | | | | | || | | | | | | + * |Shift | | | | | PrSc || Home | PgDn | PgUp | End | |Shift | * |------+------+------+------+------+------++------+------+------+------+------+------| - * | | | | | |LSFT_T||RSFT_T| | | | | | - * |Reset | Alt | GUI |LLower|LRaise|Space ||Space |RRaise|RLower| GUI | Del |Reset | + * | | | | | | || | | | | | | + * |LRaise| Alt | GUI | |LLower|Space ||Space |RLower| | GUI | Del |RRaise| * `------------------------------------------------------------------------------------' */ [_LOWER] = LAYOUT_ortho_4x12( \ _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \ _______, XXXXXXX, KC_VOLD, KC_VOLU, KC_MUTE, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XXXXXXX, _______, \ - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, \ + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PSCR, KC_HOME, KC_PGDN, KC_PGUP, KC_END, XXXXXXX, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ), @@ -95,55 +96,113 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Tab | F5 | F6 | F7 | F8 | || * | / | 4 | 5 | 6 |Enter | * |------+------+------+------+------+------++------+------+------+------+------+------| * | | | | | | || | | | | | | - * | | F9 | F10 | F11 | F12 | || . | , | 7 | 8 | 9 | | + * |Shift | F9 | F10 | F11 | F12 | || . | , | 7 | 8 | 9 |Shift | * |------+------+------+------+------+------++------+------+------+------+------+------| - * | | | | | |LSFT_T||RSFT_T| | | | | | - * |Reset | Alt | GUI |LLower|LRaise|Space ||Space |RRaise|RLower| 0 | Del |Reset | + * | | | | | | || | | | | | | + * |LRaise| Alt | GUI |Reset |LLower|Space ||Space |RLower|Reset | 0 | Del |RRaise| * `------------------------------------------------------------------------------------' */ [_NEUTRAL] = LAYOUT_ortho_4x12( \ _______, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, KC_PPLS, KC_PMNS, KC_P1, KC_P2, KC_P3, _______, \ _______, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX, KC_PAST, KC_PSLS, KC_P4, KC_P5, KC_P6, _______, \ _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, KC_PDOT, KC_COMM, KC_P7, KC_P8, KC_P9, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P0, _______, _______ \ + _______, _______, _______, RESET, _______, _______, _______, _______, RESET, KC_P0, _______, _______ \ ) }; -void DualKeyPressed ( bool brother_state, uint8_t target ){ - if( brother_state ) return; +/**** Raise Layer functions *****/ - layer_on( target ); + /* RaisePressed function */ + /* called RaiseSwitch */ +void RaisePressed ( keyevent_t *event, bool brother_state ){ + + if( brother_state ) { return; } + + layer_on( _RAISE ); + update_tri_layer( _LOWER, _RAISE, _NEUTRAL ); + return; + +} + + + /* RaiseReleased function */ + /* called RaiseSwitch */ +void RaiseReleased ( bool brother_state ){ + + if( brother_state ) { return; } + + layer_off( _RAISE ); + update_tri_layer( _LOWER, _RAISE, _NEUTRAL ); return; } -void DualKeyReleased ( bool brother_state, uint8_t target1 ){ - if( brother_state ) return ; + /* RaiseSwitch function */ + /* called process_record_user */ +bool RaiseSwitch ( keyrecord_t *record, bool *key_state, bool brother ){ - layer_off( target1 ); + if( record -> event.pressed ) { + *key_state = true; + RaisePressed( &(record -> event), brother ); + } else { + *key_state = false; + RaiseReleased( brother ); + } + return false; + +} + + + + + + +/**** Lower layer functions ****/ + + /* LowerPressed function */ + /* call from LowerSwitch */ +void LowerPressed ( bool brother_state ){ + + if( brother_state ) { return; } + + layer_on( _LOWER ); + update_tri_layer(_LOWER, _RAISE, _NEUTRAL ); + return; +} + + /* LowerReleased function */ + /* call from LowerSwitch */ +void LowerReleased ( bool brother_state ){ + + if( brother_state ) { return; } + + layer_off( _LOWER ); + update_tri_layer(_LOWER, _RAISE, _NEUTRAL ); return ; } -bool LayerSwitch ( keyrecord_t *record, bool *key_state, bool brother, uint8_t layer ){ + /* LowerSwitch function */ + /* call from process_record_user */ +bool LowerSwitch ( keyrecord_t *record, bool *key_state, bool brother ){ if ( record -> event.pressed ) { *key_state = true; - DualKeyPressed( brother, layer ); - } - else { + LowerPressed( brother ); + } else { *key_state = false; - DualKeyReleased( brother, layer ); + LowerReleased( brother ); } - update_tri_layer(_LOWER, _RAISE, _NEUTRAL ); return false; - } + + +/**** process_record_user ****/ bool process_record_user(uint16_t keycode, keyrecord_t *record) { static bool l_lower = false; @@ -155,11 +214,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { - case L_LOWER : return LayerSwitch( record, &l_lower, r_lower, _LOWER ); break; - case R_LOWER : return LayerSwitch( record, &r_lower, l_lower, _LOWER ); break; - case L_RAISE : return LayerSwitch( record, &l_raise, r_raise, _RAISE ); break; - case R_RAISE : return LayerSwitch( record, &r_raise, l_raise, _RAISE ); break; + case L_LOWER : return LowerSwitch( record, &l_lower, r_lower ); break; + case R_LOWER : return LowerSwitch( record, &r_lower, l_lower ); break; + case L_RAISE : return RaiseSwitch( record, &l_raise, r_raise ); break; + case R_RAISE : return RaiseSwitch( record, &r_raise, l_raise ); break; + + default: break; } return true; } + + +