From 5155f3efaa6386a5fb3d66e24e82bd7b083bcdae Mon Sep 17 00:00:00 2001 From: lalalademaxiya1 <2831039915@qq.com> Date: Tue, 17 Oct 2023 14:14:05 +0800 Subject: Add k8_pro jis version --- keyboards/keychron/k8_pro/ansi/info.json | 100 --------------------- keyboards/keychron/k8_pro/info.json | 100 +++++++++++++++++++++ .../k8_pro/jis/rgb/keymaps/default/keymap.c | 2 +- .../k8_pro/jis/white/keymaps/default/keymap.c | 2 +- .../keychron/k8_pro/jis/white/keymaps/via/keymap.c | 2 +- keyboards/keychron/k8_pro/k8_pro.c | 29 ++++-- keyboards/keychron/k8_pro/readme.md | 10 +++ 7 files changed, 137 insertions(+), 108 deletions(-) delete mode 100644 keyboards/keychron/k8_pro/ansi/info.json diff --git a/keyboards/keychron/k8_pro/ansi/info.json b/keyboards/keychron/k8_pro/ansi/info.json deleted file mode 100644 index f4045d38f3..0000000000 --- a/keyboards/keychron/k8_pro/ansi/info.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "layouts": { - "LAYOUT_ansi_87": { - "layout": [ - {"matrix":[0, 0], "x":0, "y":0}, - {"matrix":[0, 1], "x":2, "y":0}, - {"matrix":[0, 2], "x":3, "y":0}, - {"matrix":[0, 3], "x":4, "y":0}, - {"matrix":[0, 4], "x":5, "y":0}, - {"matrix":[0, 5], "x":6.5, "y":0}, - {"matrix":[0, 6], "x":7.5, "y":0}, - {"matrix":[0, 7], "x":8.5, "y":0}, - {"matrix":[0, 8], "x":9.5, "y":0}, - {"matrix":[0, 9], "x":11, "y":0}, - {"matrix":[0,10], "x":12, "y":0}, - {"matrix":[0,11], "x":13, "y":0}, - {"matrix":[0,12], "x":14, "y":0}, - {"matrix":[0,14], "x":15.25, "y":0}, - {"matrix":[0,15], "x":16.25, "y":0}, - {"matrix":[0,16], "x":17.25, "y":0}, - - {"matrix":[1, 0], "x":0, "y":1.25}, - {"matrix":[1, 1], "x":1, "y":1.25}, - {"matrix":[1, 2], "x":2, "y":1.25}, - {"matrix":[1, 3], "x":3, "y":1.25}, - {"matrix":[1, 4], "x":4, "y":1.25}, - {"matrix":[1, 5], "x":5, "y":1.25}, - {"matrix":[1, 6], "x":6, "y":1.25}, - {"matrix":[1, 7], "x":7, "y":1.25}, - {"matrix":[1, 8], "x":8, "y":1.25}, - {"matrix":[1, 9], "x":9, "y":1.25}, - {"matrix":[1,10], "x":10, "y":1.25}, - {"matrix":[1,11], "x":11, "y":1.25}, - {"matrix":[1,12], "x":12, "y":1.25}, - {"matrix":[1,13], "x":13, "y":1.25, "w":2}, - {"matrix":[1,14], "x":15.25, "y":1.25}, - {"matrix":[1,15], "x":16.25, "y":1.25}, - {"matrix":[1,16], "x":17.25, "y":1.25}, - - {"matrix":[2, 0], "x":0, "y":2.25, "w":1.5}, - {"matrix":[2, 1], "x":1.5, "y":2.25}, - {"matrix":[2, 2], "x":2.5, "y":2.25}, - {"matrix":[2, 3], "x":3.5, "y":2.25}, - {"matrix":[2, 4], "x":4.5, "y":2.25}, - {"matrix":[2, 5], "x":5.5, "y":2.25}, - {"matrix":[2, 6], "x":6.5, "y":2.25}, - {"matrix":[2, 7], "x":7.5, "y":2.25}, - {"matrix":[2, 8], "x":8.5, "y":2.25}, - {"matrix":[2, 9], "x":9.5, "y":2.25}, - {"matrix":[2,10], "x":10.5, "y":2.25}, - {"matrix":[2,11], "x":11.5, "y":2.25}, - {"matrix":[2,12], "x":12.5, "y":2.25}, - {"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5}, - {"matrix":[2,14], "x":15.25, "y":2.25}, - {"matrix":[2,15], "x":16.25, "y":2.25}, - {"matrix":[2,16], "x":17.25, "y":2.25}, - - {"matrix":[3, 0], "x":0, "y":3.25, "w":1.75}, - {"matrix":[3, 1], "x":1.75, "y":3.25}, - {"matrix":[3, 2], "x":2.75, "y":3.25}, - {"matrix":[3, 3], "x":3.75, "y":3.25}, - {"matrix":[3, 4], "x":4.75, "y":3.25}, - {"matrix":[3, 5], "x":5.75, "y":3.25}, - {"matrix":[3, 6], "x":6.75, "y":3.25}, - {"matrix":[3, 7], "x":7.75, "y":3.25}, - {"matrix":[3, 8], "x":8.75, "y":3.25}, - {"matrix":[3, 9], "x":9.75, "y":3.25}, - {"matrix":[3,10], "x":10.75, "y":3.25}, - {"matrix":[3,11], "x":11.75, "y":3.25}, - {"matrix":[3,13], "x":12.75, "y":3.25, "w":2.25}, - - {"matrix":[4, 0], "x":0, "y":4.25, "w":2.25}, - {"matrix":[4, 2], "x":2.25, "y":4.25}, - {"matrix":[4, 3], "x":3.25, "y":4.25}, - {"matrix":[4, 4], "x":4.25, "y":4.25}, - {"matrix":[4, 5], "x":5.25, "y":4.25}, - {"matrix":[4, 6], "x":6.25, "y":4.25}, - {"matrix":[4, 7], "x":7.25, "y":4.25}, - {"matrix":[4, 8], "x":8.25, "y":4.25}, - {"matrix":[4, 9], "x":9.25, "y":4.25}, - {"matrix":[4,10], "x":10.25, "y":4.25}, - {"matrix":[4,11], "x":11.25, "y":4.25}, - {"matrix":[4,13], "x":12.25, "y":4.25, "w":2.75}, - {"matrix":[4,15], "x":16.25, "y":4.25}, - - {"matrix":[5, 0], "x":0, "y":5.25, "w":1.25}, - {"matrix":[5, 1], "x":1.25, "y":5.25, "w":1.25}, - {"matrix":[5, 2], "x":2.5, "y":5.25, "w":1.25}, - {"matrix":[5, 6], "x":3.75, "y":5.25, "w":6.25}, - {"matrix":[5,10], "x":10, "y":5.25, "w":1.25}, - {"matrix":[5,11], "x":11.25, "y":5.25, "w":1.25}, - {"matrix":[5,12], "x":12.5, "y":5.25, "w":1.25}, - {"matrix":[5,13], "x":13.75, "y":5.25, "w":1.25}, - {"matrix":[5,14], "x":15.25, "y":5.25}, - {"matrix":[5,15], "x":16.25, "y":5.25}, - {"matrix":[5,16], "x":17.25, "y":5.25} - ] - } - } -} \ No newline at end of file diff --git a/keyboards/keychron/k8_pro/info.json b/keyboards/keychron/k8_pro/info.json index f19075b3b8..c5f2fe00b1 100644 --- a/keyboards/keychron/k8_pro/info.json +++ b/keyboards/keychron/k8_pro/info.json @@ -220,6 +220,106 @@ {"matrix":[5,15], "x":16.25, "y":5.25}, {"matrix":[5,16], "x":17.25, "y":5.25} ] + }, + "LAYOUT_91_jis": { + "layout": [ + {"matrix":[0,0], "x":0, "y":0}, + {"matrix":[0,1], "x":2, "y":0}, + {"matrix":[0,2], "x":3, "y":0}, + {"matrix":[0,3], "x":4, "y":0}, + {"matrix":[0,4], "x":5, "y":0}, + {"matrix":[0,5], "x":6.5, "y":0}, + {"matrix":[0,6], "x":7.5, "y":0}, + {"matrix":[0,7], "x":8.5, "y":0}, + {"matrix":[0,8], "x":9.5, "y":0}, + {"matrix":[0,9], "x":11, "y":0}, + {"matrix":[0,10], "x":12, "y":0}, + {"matrix":[0,11], "x":13, "y":0}, + {"matrix":[0,12], "x":14, "y":0}, + {"matrix":[0,14], "x":15.25, "y":0}, + {"matrix":[0,15], "x":16.25, "y":0}, + {"matrix":[0,16], "x":17.25, "y":0}, + + {"matrix":[1,0], "x":0, "y":1.25}, + {"matrix":[1,1], "x":1, "y":1.25}, + {"matrix":[1,2], "x":2, "y":1.25}, + {"matrix":[1,3], "x":3, "y":1.25}, + {"matrix":[1,4], "x":4, "y":1.25}, + {"matrix":[1,5], "x":5, "y":1.25}, + {"matrix":[1,6], "x":6, "y":1.25}, + {"matrix":[1,7], "x":7, "y":1.25}, + {"matrix":[1,8], "x":8, "y":1.25}, + {"matrix":[1,9], "x":9, "y":1.25}, + {"matrix":[1,10], "x":10, "y":1.25}, + {"matrix":[1,11], "x":11, "y":1.25}, + {"matrix":[1,12], "x":12, "y":1.25}, + {"matrix":[1,13], "x":13, "y":1.25}, + {"matrix":[0,13], "x":14, "y":1.25}, + {"matrix":[1,14], "x":15.25, "y":1.25}, + {"matrix":[1,15], "x":16.25, "y":1.25}, + {"matrix":[1,16], "x":17.25, "y":1.25}, + + {"matrix":[2,0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2,1], "x":1.5, "y":2.25}, + {"matrix":[2,2], "x":2.5, "y":2.25}, + {"matrix":[2,3], "x":3.5, "y":2.25}, + {"matrix":[2,4], "x":4.5, "y":2.25}, + {"matrix":[2,5], "x":5.5, "y":2.25}, + {"matrix":[2,6], "x":6.5, "y":2.25}, + {"matrix":[2,7], "x":7.5, "y":2.25}, + {"matrix":[2,8], "x":8.5, "y":2.25}, + {"matrix":[2,9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + {"matrix":[2,15], "x":16.25, "y":2.25}, + {"matrix":[2,16], "x":17.25, "y":2.25}, + + {"matrix":[3,0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3,1], "x":1.75, "y":3.25}, + {"matrix":[3,2], "x":2.75, "y":3.25}, + {"matrix":[3,3], "x":3.75, "y":3.25}, + {"matrix":[3,4], "x":4.75, "y":3.25}, + {"matrix":[3,5], "x":5.75, "y":3.25}, + {"matrix":[3,6], "x":6.75, "y":3.25}, + {"matrix":[3,7], "x":7.75, "y":3.25}, + {"matrix":[3,8], "x":8.75, "y":3.25}, + {"matrix":[3,9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,13], "x":12.75, "y":3.25}, + {"matrix":[2,13], "x":13.75, "y":2.25, "w":1.25, "h":2}, + + {"matrix":[4,0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4,2], "x":2.25, "y":4.25}, + {"matrix":[4,3], "x":3.25, "y":4.25}, + {"matrix":[4,4], "x":4.25, "y":4.25}, + {"matrix":[4,5], "x":5.25, "y":4.25}, + {"matrix":[4,6], "x":6.25, "y":4.25}, + {"matrix":[4,7], "x":7.25, "y":4.25}, + {"matrix":[4,8], "x":8.25, "y":4.25}, + {"matrix":[4,9], "x":9.25, "y":4.25}, + {"matrix":[4,10], "x":10.25, "y":4.25}, + {"matrix":[4,11], "x":11.25, "y":4.25}, + {"matrix":[4,12], "x":12.25, "y":4.25}, + {"matrix":[4,13], "x":13.25, "y":4.25, "w":1.75}, + {"matrix":[4,15], "x":16.25, "y":4.25}, + + {"matrix":[5,0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5,1], "x":1.25, "y":5.25}, + {"matrix":[5,2], "x":2.25, "y":5.25, "w":1.25}, + {"matrix":[5,3], "x":3.5, "y":5.25}, + {"matrix":[5,6], "x":4.5, "y":5.25, "w":4.75}, + {"matrix":[5,9], "x":9.25, "y":5.25}, + {"matrix":[5,10], "x":10.25, "y":5.25, "w":1.25}, + {"matrix":[5,11], "x":11.5, "y":5.25, "w":1.25}, + {"matrix":[5,12], "x":12.75, "y":5.25}, + {"matrix":[5,13], "x":13.75, "y":5.25, "w":1.25}, + {"matrix":[5,14], "x":15.25, "y":5.25}, + {"matrix":[5,15], "x":16.25, "y":5.25}, + {"matrix":[5,16], "x":17.25, "y":5.25} + ] } } } diff --git a/keyboards/keychron/k8_pro/jis/rgb/keymaps/default/keymap.c b/keyboards/keychron/k8_pro/jis/rgb/keymaps/default/keymap.c index 2cfef1be83..3e08645930 100755 --- a/keyboards/keychron/k8_pro/jis/rgb/keymaps/default/keymap.c +++ b/keyboards/keychron/k8_pro/jis/rgb/keymaps/default/keymap.c @@ -26,7 +26,7 @@ enum layers{ // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_91_jis( - KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, diff --git a/keyboards/keychron/k8_pro/jis/white/keymaps/default/keymap.c b/keyboards/keychron/k8_pro/jis/white/keymaps/default/keymap.c index 5e4916ad83..0a4e1bc28b 100755 --- a/keyboards/keychron/k8_pro/jis/white/keymaps/default/keymap.c +++ b/keyboards/keychron/k8_pro/jis/white/keymaps/default/keymap.c @@ -26,7 +26,7 @@ enum layers{ // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_91_jis( - KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, BL_STEP, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, BL_STEP, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, diff --git a/keyboards/keychron/k8_pro/jis/white/keymaps/via/keymap.c b/keyboards/keychron/k8_pro/jis/white/keymaps/via/keymap.c index 7415a2643f..1eff064b7a 100755 --- a/keyboards/keychron/k8_pro/jis/white/keymaps/via/keymap.c +++ b/keyboards/keychron/k8_pro/jis/white/keymaps/via/keymap.c @@ -26,7 +26,7 @@ enum layers{ // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_91_jis( - KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, BL_STEP, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, BL_STEP, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, diff --git a/keyboards/keychron/k8_pro/k8_pro.c b/keyboards/keychron/k8_pro/k8_pro.c index 5fb63f9c6b..ba0cd7e819 100644 --- a/keyboards/keychron/k8_pro/k8_pro.c +++ b/keyboards/keychron/k8_pro/k8_pro.c @@ -36,9 +36,10 @@ typedef struct PACKED { uint8_t keycode[3]; } key_combination_t; -static uint32_t power_on_indicator_timer_buffer; -static uint32_t siri_timer_buffer = 0; -static uint8_t mac_keycode[4] = {KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD}; +static uint32_t factory_timer_buffer = 0; +static uint32_t power_on_indicator_timer_buffer = 0; +static uint32_t siri_timer_buffer = 0; +static uint8_t mac_keycode[4] = {KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD}; key_combination_t key_comb_list[4] = { {2, {KC_LWIN, KC_TAB}}, // Task (win) @@ -60,7 +61,11 @@ static void pairing_key_timer_cb(void *arg) { bool dip_switch_update_kb(uint8_t index, bool active) { if (index == 0) { +#ifdef INVERT_OS_SWITCH_STATE + default_layer_set(1UL << (!active ? 2 : 0)); +#else default_layer_set(1UL << (active ? 2 : 0)); +#endif } dip_switch_update_user(index, active); @@ -137,7 +142,9 @@ void keyboard_post_init_kb(void) { #ifdef KC_BLUETOOTH_ENABLE /* Currently we don't use this reset pin */ - palSetLineMode(CKBT51_RESET_PIN, PAL_MODE_UNCONNECTED); + // palSetLineMode(CKBT51_RESET_PIN, PAL_MODE_UNCONNECTED); + palSetLineMode(CKBT51_RESET_PIN, PAL_MODE_OUTPUT_PUSHPULL); + palWriteLine(CKBT51_RESET_PIN, PAL_HIGH); /* IMPORTANT: DO NOT enable internal pull-up resistor * as there is an external pull-down resistor. @@ -159,6 +166,16 @@ void keyboard_post_init_kb(void) { } void matrix_scan_kb(void) { + if (factory_timer_buffer && timer_elapsed32(factory_timer_buffer) > 2000) { + factory_timer_buffer = 0; + if (bt_factory_reset) { + bt_factory_reset = false; + palWriteLine(CKBT51_RESET_PIN, PAL_LOW); + wait_ms(5); + palWriteLine(CKBT51_RESET_PIN, PAL_HIGH); + } + } + if (power_on_indicator_timer_buffer) { if (sync_timer_elapsed32(power_on_indicator_timer_buffer) > POWER_ON_LED_DURATION) { power_on_indicator_timer_buffer = 0; @@ -190,6 +207,7 @@ static void ckbt51_param_init(void) { /* Set bluetooth device name */ // ckbt51_set_local_name(STR(PRODUCT)); ckbt51_set_local_name(PRODUCT); + wait_ms(10); /* Set bluetooth parameters */ module_param_t param = {.event_mode = 0x02, .connected_idle_timeout = 7200, @@ -201,12 +219,13 @@ static void ckbt51_param_init(void) { .verndor_id = 0, // Must be 0x3434 .product_id = PRODUCT_ID}; ckbt51_set_param(¶m); + wait_ms(10); } void bluetooth_enter_disconnected_kb(uint8_t host_idx) { if (bt_factory_reset) { - bt_factory_reset = false; ckbt51_param_init(); + factory_timer_buffer = timer_read32(); } /* CKBT51 bluetooth module boot time is slower, it enters disconnected after boot, so we place initialization here. */ diff --git a/keyboards/keychron/k8_pro/readme.md b/keyboards/keychron/k8_pro/readme.md index b9161db566..1c0a151909 100644 --- a/keyboards/keychron/k8_pro/readme.md +++ b/keyboards/keychron/k8_pro/readme.md @@ -11,10 +11,20 @@ A customizable 87 keys TKL keyboard. Make example for this keyboard (after setting up your build environment): make keychron/k8_pro/ansi/rgb:default + make keychron/k8_pro/ansi/white:default + make keychron/k8_pro/iso/rgb:default + make keychron/k8_pro/iso/white:default + make keychron/k8_pro/jis/rgb:default + make keychron/k8_pro/jis/white:default Flashing example for this keyboard: make keychron/k8_pro/ansi/rgb:default:flash + make keychron/k8_pro/ansi/white:default:flash + make keychron/k8_pro/iso/rgb:default:flash + make keychron/k8_pro/iso/white:default:flash + make keychron/k8_pro/jis/rgb:default:flash + make keychron/k8_pro/jis/white:default:flash **Reset Key**: Connect the USB cable, toggle mode switch to "Off", hold down the *Esc* key or reset button underneath space bar, then toggle then switch to "Cable". -- cgit v1.2.3