From 16c848ca009f01752815bca5544e406bbaced7af Mon Sep 17 00:00:00 2001 From: Takeshi ISHII <2170248+mtei@users.noreply.github.com> Date: Wed, 13 Apr 2022 15:37:05 +0900 Subject: [PATCH] [Keymap] Change helix:froggy_106 keymap to use split_common (#16704) --- .../helix/rev2/keymaps/froggy_106/config.h | 6 + .../helix/rev2/keymaps/froggy_106/keymap.c | 366 ++++++++++++------ .../helix/rev2/keymaps/froggy_106/rules.mk | 11 +- 3 files changed, 270 insertions(+), 113 deletions(-) diff --git a/keyboards/helix/rev2/keymaps/froggy_106/config.h b/keyboards/helix/rev2/keymaps/froggy_106/config.h index 36c3f2a799..9affa1d296 100644 --- a/keyboards/helix/rev2/keymaps/froggy_106/config.h +++ b/keyboards/helix/rev2/keymaps/froggy_106/config.h @@ -25,6 +25,12 @@ along with this program. If not, see . #define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped this number of times again. */ #define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */ +// the froggy keymap does not use the right hand side, so sync_timer is not needed +#define DISABLE_SYNC_TIMER +// For the same reason, the following are also not needed +#undef SPLIT_LAYER_STATE_ENABLE +#undef SPLIT_LED_STATE_ENABLE + // If you need more program area, try select and reduce rgblight modes to use. // Selection of RGBLIGHT MODE to use. diff --git a/keyboards/helix/rev2/keymaps/froggy_106/keymap.c b/keyboards/helix/rev2/keymaps/froggy_106/keymap.c index 3a433e56fd..a92b05566e 100644 --- a/keyboards/helix/rev2/keymaps/froggy_106/keymap.c +++ b/keyboards/helix/rev2/keymaps/froggy_106/keymap.c @@ -5,7 +5,24 @@ #include "ssd1306.h" #endif -extern uint8_t is_master; +#define LAYOUT_half( \ + L00, L01, L02, L03, L04, L05, \ + L10, L11, L12, L13, L14, L15, \ + L20, L21, L22, L23, L24, L25, \ + L30, L31, L32, L33, L34, L35, L36, \ + L40, L41, L42, L43, L44, L45, L46 \ +) { \ + { L00, L01, L02, L03, L04, L05, KC_NO }, \ + { L10, L11, L12, L13, L14, L15, KC_NO }, \ + { L20, L21, L22, L23, L24, L25, KC_NO }, \ + { L30, L31, L32, L33, L34, L35, L36 }, \ + { L40, L41, L42, L43, L44, L45, L46 }, \ + { _______, _______, _______, _______, _______, _______, KC_NO }, \ + { _______, _______, _______, _______, _______, _______, KC_NO }, \ + { _______, _______, _______, _______, _______, _______, KC_NO }, \ + { _______, _______, _______, _______, _______, _______, _______ }, \ + { _______, _______, _______, _______, _______, _______, _______ } \ +} #define DELAY_TIME 75 static uint16_t key_timer; @@ -83,136 +100,136 @@ enum macro_keycodes { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Base - * ,-----------------------------------------. ,-----------------------------------------. - * | C+z | ; | [ | ( | < | { | | | | | | | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | KANA | P | K | R | A | F | | | | | | | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | BS | D | T | H | E | O | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Y | S | N | I | U |Space | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | Alt | Gui | Sym | Num | OPT | Ent | | | | | | | | - * `-------------------------------------------------------------------------------------------------' + * ,-----------------------------------------. + * | C+z | ; | [ | ( | < | { | + * |------+------+------+------+------+------| + * | KANA | P | K | R | A | F | + * |------+------+------+------+------+------| + * | BS | D | T | H | E | O | + * |------+------+------+------+------+------+------. + * | Shift| Y | S | N | I | U |Space | + * |------+------+------+------+------+------+------| + * | Ctrl | Alt | Gui | Sym | Num | OPT | Ent | + * `------------------------------------------------' */ - [_BASE] = LAYOUT( \ - LCTL(KC_Z), KC_SCLN, KC_LBRC, KC_LPRN, KC_LT, KC_LCBR, _______, _______, _______, _______, _______, _______, \ - KANA, KC_P, KC_K, KC_R, KC_A, KC_F, _______, _______, _______, _______, _______, _______, \ - KC_BSPC, KC_D, KC_T, KC_H, KC_E, KC_O, _______, _______, _______, _______, _______, _______, \ - OSM(MOD_LSFT), KC_Y, KC_S, KC_N, KC_I, KC_U, KC_SPC, _______, _______, _______, _______, _______, _______, _______, \ - OSM(MOD_LCTL), OSM(MOD_LALT), OSM(MOD_LGUI), L_SYM, L_NUM, OPT_TAP_SP, KC_ENT, _______, _______, _______, _______, _______, _______, _______ \ + [_BASE] = LAYOUT_half( \ + LCTL(KC_Z), KC_SCLN, KC_LBRC, KC_LPRN, KC_LT, KC_LCBR, \ + KANA, KC_P, KC_K, KC_R, KC_A, KC_F, \ + KC_BSPC, KC_D, KC_T, KC_H, KC_E, KC_O, \ + OSM(MOD_LSFT), KC_Y, KC_S, KC_N, KC_I, KC_U, KC_SPC, \ + OSM(MOD_LCTL), OSM(MOD_LALT), OSM(MOD_LGUI), L_SYM, L_NUM, OPT_TAP_SP, KC_ENT \ ), - [_BASE_106] = LAYOUT( \ - LCTL(KC_Z), JP_SCLN, JP_LBRC, JP_LPRN, JP_LABK, JP_LCBR, _______, _______, _______, _______, _______, _______, \ - KANA, KC_P, KC_K, KC_R, KC_A, KC_F, _______, _______, _______, _______, _______, _______, \ - KC_BSPC, KC_D, KC_T, KC_H, KC_E, KC_O, _______, _______, _______, _______, _______, _______, \ - OSM(MOD_LSFT), KC_Y, KC_S, KC_N, KC_I, KC_U, KC_SPC, _______, _______, _______, _______, _______, _______, _______, \ - OSM(MOD_LCTL), OSM(MOD_LALT), OSM(MOD_LGUI), L_SYM, L_NUM, OPT_TAP_SP, KC_ENT, _______, _______, _______, _______, _______, _______, _______ \ + [_BASE_106] = LAYOUT_half( \ + LCTL(KC_Z), JP_SCLN, JP_LBRC, JP_LPRN, JP_LABK, JP_LCBR, \ + KANA, KC_P, KC_K, KC_R, KC_A, KC_F, \ + KC_BSPC, KC_D, KC_T, KC_H, KC_E, KC_O, \ + OSM(MOD_LSFT), KC_Y, KC_S, KC_N, KC_I, KC_U, KC_SPC, \ + OSM(MOD_LCTL), OSM(MOD_LALT), OSM(MOD_LGUI), L_SYM, L_NUM, OPT_TAP_SP, KC_ENT \ ), /* Opt - * ,-----------------------------------------. ,-----------------------------------------. - * | Esc | : | ] | ) | > | } | | | | | | | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | EISU| J | M | B | ' | Tab | | | | | | | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | . | V | C | L | Z | Q | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| - * | | X | G | W | - | Del | Esc | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | , | DTOP | | | | | | | | | | - * `-------------------------------------------------------------------------------------------------' + * ,-----------------------------------------. + * | Esc | : | ] | ) | > | } | + * |------+------+------+------+------+------| + * | EISU| J | M | B | ' | Tab | + * |------+------+------+------+------+------| + * | . | V | C | L | Z | Q | + * |------+------+------+------+------+------+------. + * | | X | G | W | - | Del | Esc | + * |------+------+------+------+------+------+------| + * | | | | , | DTOP | | | + * `------------------------------------------------' */ - [_OPT] = LAYOUT( \ - KC_ESC, KC_COLN,KC_RBRC, KC_RPRN,KC_GT, KC_RCBR, _______, _______, _______, _______, _______, _______, \ - EISU, KC_J, KC_M, KC_B, KC_QUOT, KC_TAB, _______, _______, _______, _______, _______, _______, \ - KC_DOT, KC_V, KC_C, KC_L, KC_Z, KC_Q, _______, _______, _______, _______, _______, _______, \ - _______, KC_X, KC_G, KC_W, KC_MINUS, KC_DEL, KC_ESC, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______,_______, KC_COMM,DESKTOP, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + [_OPT] = LAYOUT_half( \ + KC_ESC, KC_COLN,KC_RBRC, KC_RPRN,KC_GT, KC_RCBR, \ + EISU, KC_J, KC_M, KC_B, KC_QUOT, KC_TAB, \ + KC_DOT, KC_V, KC_C, KC_L, KC_Z, KC_Q, \ + _______, KC_X, KC_G, KC_W, KC_MINUS, KC_DEL, KC_ESC, \ + _______, _______,_______, KC_COMM,DESKTOP, _______, _______ \ ), - [_OPT_106] = LAYOUT( \ - KC_ESC, JP_COLN,JP_RBRC, JP_RPRN,JP_RABK, JP_RCBR, _______, _______, _______, _______, _______, _______, \ - EISU, KC_J, KC_M, KC_B, JP_QUOT, KC_TAB, _______, _______, _______, _______, _______, _______, \ - KC_DOT, KC_V, KC_C, KC_L, KC_Z, KC_Q, _______, _______, _______, _______, _______, _______, \ - _______, KC_X, KC_G, KC_W, JP_MINS, KC_DEL, KC_ESC, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______,_______, KC_COMM,DESKTOP, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + [_OPT_106] = LAYOUT_half( \ + KC_ESC, JP_COLN,JP_RBRC, JP_RPRN,JP_RABK, JP_RCBR, \ + EISU, KC_J, KC_M, KC_B, JP_QUOT, KC_TAB, \ + KC_DOT, KC_V, KC_C, KC_L, KC_Z, KC_Q, \ + _______, KC_X, KC_G, KC_W, JP_MINS, KC_DEL, KC_ESC, \ + _______, _______,_______, KC_COMM,DESKTOP, _______, _______ \ ), /* Sym - * ,-----------------------------------------. ,-----------------------------------------. - * | Ins | GRV | | PU | PD | ^ | | | | | | | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | \ | # | = | ? | % | | | | | | | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | $ | upA | @ | ! | | | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| - * | CL | <- | dwA | -> | _ | & | | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| - * | | | PS | | ~ | | | | | | | | | | - * `-------------------------------------------------------------------------------------------------' + * ,-----------------------------------------. + * | Ins | GRV | | PU | PD | ^ | + * |------+------+------+------+------+------| + * | | \ | # | = | ? | % | + * |------+------+------+------+------+------| + * | | $ | upA | @ | ! | | | + * |------+------+------+------+------+------+------. + * | CL | <- | dwA | -> | _ | & | | + * |------+------+------+------+------+------+------+ + * | | | PS | | ~ | | | + * `------------------------------------------------' */ - [_SYM] = LAYOUT( \ - KC_INS, KC_GRV, _______, KC_PGUP, KC_PGDN, KC_CIRC, _______, _______, _______, _______, _______, _______, \ - _______, KC_BSLS, KC_HASH, KC_EQL, KC_QUES, KC_PERC, _______, _______, _______, _______, _______, _______, \ - _______, KC_DLR, KC_UP, KC_AT, KC_EXLM, KC_PIPE, _______, _______, _______, _______, _______, _______, \ - KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT,KC_UNDS, KC_AMPR, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, KC_PSCR, _______, KC_TILD, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + [_SYM] = LAYOUT_half( \ + KC_INS, KC_GRV, _______, KC_PGUP, KC_PGDN, KC_CIRC, \ + _______, KC_BSLS, KC_HASH, KC_EQL, KC_QUES, KC_PERC, \ + _______, KC_DLR, KC_UP, KC_AT, KC_EXLM, KC_PIPE, \ + KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT,KC_UNDS, KC_AMPR, _______, \ + _______, _______, KC_PSCR, _______, KC_TILD, _______, _______ \ ), - [_SYM_106] = LAYOUT( \ - KC_INS, JP_GRV, _______, KC_PGUP, KC_PGDN, JP_CIRC, _______, _______, _______, _______, _______, _______, \ - _______, JP_BSLS, JP_HASH, JP_EQL, JP_QUES, JP_PERC, _______, _______, _______, _______, _______, _______, \ - _______, JP_DLR, KC_UP, JP_AT, JP_EXLM, JP_PIPE, _______, _______, _______, _______, _______, _______, \ - KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT,JP_UNDS, JP_AMPR, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, KC_PSCR, _______, JP_TILD, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + [_SYM_106] = LAYOUT_half( \ + KC_INS, JP_GRV, _______, KC_PGUP, KC_PGDN, JP_CIRC, \ + _______, JP_BSLS, JP_HASH, JP_EQL, JP_QUES, JP_PERC, \ + _______, JP_DLR, KC_UP, JP_AT, JP_EXLM, JP_PIPE, \ + KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT,JP_UNDS, JP_AMPR, _______, \ + _______, _______, KC_PSCR, _______, JP_TILD, _______, _______ \ ), /* Raise - * ,-----------------------------------------. ,-----------------------------------------. - * | | | Func | home | End | | | | | | | | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | * | 7 | 8 | 9 | - | | | | | | | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | . | / | 4 | 5 | 6 | + | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| - * | LN | 0 | 1 | 2 | 3 |C+S+F1| | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| - * | | | . | , | | | | | | | | | | | - * `-------------------------------------------------------------------------------------------------' + * ,-----------------------------------------. + * | | | Func | home | End | | + * |------+------+------+------+------+------| + * | | * | 7 | 8 | 9 | - | + * |------+------+------+------+------+------| + * | . | / | 4 | 5 | 6 | + | + * |------+------+------+------+------+------+------. + * | LN | 0 | 1 | 2 | 3 |C+S+F1| | + * |------+------+------+------+------+------+------| + * | | | . | , | | | | + * `------------------------------------------------' */ - [_NUM] = LAYOUT( \ - _______, _______, OSL(_FUNC), KC_HOME, KC_END, _______, _______, _______, _______, _______, _______, _______, \ - _______, KC_ASTR, KC_P7, KC_P8, KC_P9, KC_MINS, _______, _______, _______, _______, _______, _______, \ - KC_DOT, KC_SLSH, KC_P4, KC_P5, KC_P6, KC_PLUS, _______, _______, _______, _______, _______, _______, \ - KC_NLCK, KC_P0, KC_P1, KC_P2, KC_P3, LCTL(S(KC_F1)), _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, KC_PDOT, KC_COMM, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + [_NUM] = LAYOUT_half( \ + _______, _______, OSL(_FUNC), KC_HOME, KC_END, _______, \ + _______, KC_ASTR, KC_P7, KC_P8, KC_P9, KC_MINS, \ + KC_DOT, KC_SLSH, KC_P4, KC_P5, KC_P6, KC_PLUS, \ + KC_NLCK, KC_P0, KC_P1, KC_P2, KC_P3, LCTL(S(KC_F1)), _______, \ + _______, _______, KC_PDOT, KC_COMM, _______, _______, _______ \ ), - [_NUM_106] = LAYOUT( \ - _______, _______, OSL(_FUNC), KC_HOME, KC_END, _______, _______, _______, _______, _______, _______, _______, \ - _______, JP_ASTR, KC_P7, KC_P8, KC_P9, JP_MINS, _______, _______, _______, _______, _______, _______, \ - KC_DOT, JP_SLSH, KC_P4, KC_P5, KC_P6, JP_PLUS, _______, _______, _______, _______, _______, _______, \ - KC_NLCK, KC_P0, KC_P1, KC_P2, KC_P3, LCTL(S(KC_F1)), _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, KC_PDOT, JP_COMM, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + [_NUM_106] = LAYOUT_half( \ + _______, _______, OSL(_FUNC), KC_HOME, KC_END, _______, \ + _______, JP_ASTR, KC_P7, KC_P8, KC_P9, JP_MINS, \ + KC_DOT, JP_SLSH, KC_P4, KC_P5, KC_P6, JP_PLUS, \ + KC_NLCK, KC_P0, KC_P1, KC_P2, KC_P3, LCTL(S(KC_F1)), _______, \ + _______, _______, KC_PDOT, JP_COMM, _______, _______, _______ \ ), /* Func - * ,-----------------------------------------. ,-----------------------------------------. - * |RGBRST| Hue |To101 | RST | Mac | Win | | | | | | | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | RGB1 | VAL+ | F7 | F8 | F9 |To106 | | | | | | | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | RGB2 | VAL- | F4 | F5 | F6 | F12 | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| - * | RGB3 | F10 | F1 | F2 | F3 | F11 | | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| - * |RGBOFF| | | | | | | | | | | | | | - * `-------------------------------------------------------------------------------------------------' + * ,-----------------------------------------. + * |RGBRST| Hue |To101 | RST | Mac | Win | + * |------+------+------+------+------+------| + * | RGB1 | VAL+ | F7 | F8 | F9 |To106 | + * |------+------+------+------+------+------| + * | RGB2 | VAL- | F4 | F5 | F6 | F12 | + * |------+------+------+------+------+------+------. + * | RGB3 | F10 | F1 | F2 | F3 | F11 | | + * |------+------+------+------+------+------+------| + * |RGBOFF| | | | | | | + * `------------------------------------------------' */ - [_FUNC] = LAYOUT( \ - RGBRST,RGB_HUI, TO_101, RESET, MAC, WIN, _______, _______, _______, _______, _______, _______, \ - RGB1, RGB_VAI, KC_F7, KC_F8, KC_F9, TO_106, _______, _______, _______, _______, _______, _______, \ - RGB2, RGB_VAD, KC_F4, KC_F5, KC_F6, KC_F12, _______, _______, _______, _______, _______, _______, \ - RGB3, KC_F10, KC_F1, KC_F2, KC_F3, KC_F11, _______, _______, _______, _______, _______, _______, _______, _______, \ - RGBOFF,_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + [_FUNC] = LAYOUT_half( \ + RGBRST,RGB_HUI, TO_101, RESET, MAC, WIN, \ + RGB1, RGB_VAI, KC_F7, KC_F8, KC_F9, TO_106, \ + RGB2, RGB_VAD, KC_F4, KC_F5, KC_F6, KC_F12, \ + RGB3, KC_F10, KC_F1, KC_F2, KC_F3, KC_F11, _______, \ + RGBOFF,_______, _______, _______, _______, _______, _______ \ ) }; #else @@ -317,7 +334,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef RGBLIGHT_ENABLE col = record->event.key.col; row = record->event.key.row; - if (record->event.pressed && ((row < 5 && is_master) || (row >= 5 && !is_master))) { + if (record->event.pressed && ((row < 5 && is_keyboard_master()) || (row >= 5 && !is_keyboard_master()))) { int end = keybuf_end; keybufs[end].col = col; keybufs[end].row = row % 5; @@ -807,14 +824,139 @@ void iota_gfx_task_user(void) { #endif matrix_clear(&matrix); - if(is_master){ + if (is_keyboard_master()) { render_status(&matrix); } matrix_update(&display, &matrix); } +#endif // end of SSD1306OLED + +//OLED update loop +#ifdef OLED_ENABLE + +// Render to OLED +void render_status(void) { + + // froggy logo + static char logo[4][17]= + { + {0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0}, + {0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0}, + {0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,0}, + {0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0}, + }; + + static char modectl[4][2][4]= + { + { + {0x65,0x66,0x67,0}, //WIN + {0x85,0x86,0x87,0}, //WIN + }, + { + {0xa5,0xa6,0xa7,0}, //US(101) + {0xc5,0xc6,0xc7,0}, //US(101) + }, + { + {0xbd,0xbe,0xbf,0}, //MAC + {0xdd,0xde,0xdf,0}, //MAC + }, + { + {0xba,0xbb,0xbc,0}, //JP(106) + {0xda,0xdb,0xdc,0}, //JP(106) + }, + }; + + static char indctr[8][2][4]= + { + // white icon + { + {0x60,0x61,0x62,0}, //NUM + {0x63,0x64,0} //FUNC + }, + { + {0x80,0x81,0x82,0}, //NUM + {0x83,0x84,0} //FUNC + }, + { + {0xa0,0xa1,0xa2,0}, //CAPS + {0xa3,0xa4,0} //SCLK + }, + { + {0xc0,0xc1,0xc2,0}, //CAPS + {0xc3,0xc4,0} //SCLK + }, + // Black icon + { + {0x75,0x76,0x77,0}, //NUM + {0x78,0x79,0} //FUNC + }, + { + {0x95,0x96,0x97,0}, //NUM + {0x98,0x99,0} //FUNC + }, + { + {0xb5,0xb6,0xb7,0}, //CAPS + {0xb8,0xb9,0} //SCLK + }, + { + {0xd5,0xd6,0xd7,0}, //CAPS + {0xd8,0xd9,0} //SCLK + }, + }; + + int rown = 0; + int rowf = 0; + int rowa = 0; + int rows = 0; + int rowm = 0; + int rowj = 1; + + //Set Indicator icon + if (host_keyboard_leds() & (1<