Skip to content

Commit

Permalink
[Keyboard] Skyloong GK61 Pro 48 (#21654)
Browse files Browse the repository at this point in the history
* Create GK61 PRO_48 Keyboard.

* update pro.c and config.h to save power when USB suspend.

* Update keyboards/skyloong/gk61/pro_48/info.json

OK,thank you.

* update info.json

* update layer indicator

* Update RGB animations---delete rainbow_beacon and rainbo_pinwheels.

* Cancel force_nkro

* Add caps lock indicator in rgb matrix.

* Update keyboards/skyloong/gk61/pro_48/pro_48.c

OK, thank you for your suggestion.

* Enable I2C DMA; Modified pro_48.c

* Update keyboards/skyloong/gk61/pro_48/info.json

OK, thank you for your suggestion.

* Update keyboards/skyloong/gk61/pro_48/info.json

OK, thanks.

* enable encoder map in default keymap.

* define g_suspend_state
  • Loading branch information
JZ-Skyloong authored Oct 13, 2023
1 parent 0d7d2f7 commit f150258
Show file tree
Hide file tree
Showing 11 changed files with 750 additions and 0 deletions.
18 changes: 18 additions & 0 deletions keyboards/skyloong/gk61/pro_48/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2023 linlin012 (@linlin012)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once


#define DRIVER_COUNT 1
#define RGB_MATRIX_LED_COUNT 64
#define CAPS_LOCK_INDEX 28
#define WIN_MOD_INDEX 16
#define MAC_MOD_INDEX 17
#define SDB A4

#define RGB_DISABLE_WHEN_USB_SUSPENDED
#define RGB_MATRIX_KEYPRESSES
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS

#define g_suspend_state rgb_matrix_get_suspend_state()
7 changes: 7 additions & 0 deletions keyboards/skyloong/gk61/pro_48/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2023 linlin012 (@linlin012)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#define HAL_USE_I2C TRUE

#include_next <halconf.h>
338 changes: 338 additions & 0 deletions keyboards/skyloong/gk61/pro_48/info.json

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions keyboards/skyloong/gk61/pro_48/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2021 JZ-Skyloong (@JZ-Skyloong)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
* │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │Bsp│
* ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
* │Tab│ Q │ W │ E | R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │
* ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
* │Cap│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ |Ent│
* ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
* │Sft│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ |Sft| │
* ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
* │Ctl│GUI│Alt│ │Spc│Mut│ │ |Spc|Alt│App│Ctl│ │Mo1|
* └───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘
*/
[0] = LAYOUT_all(
KC_ESC, 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_BSPC,
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_BSLS,
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_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_MUTE, KC_SPC, KC_RALT, KC_APP, KC_RCTL, MO(1)
),

[1] = LAYOUT_all(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______,
_______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)

};

#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI) }
};
#endif

1 change: 1 addition & 0 deletions keyboards/skyloong/gk61/pro_48/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes
68 changes: 68 additions & 0 deletions keyboards/skyloong/gk61/pro_48/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright 2021 JZ-Skyloong (@JZ-Skyloong)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

enum layer_names {
_WIN,
_MAC,
_WIN_INDEX,
_MAC_INDEX
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
* │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │Bsp│
* ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
* │Tab│ Q │ W │ E | R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │
* ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
* │Cap│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ |Ent│
* ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
* │Sft│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ |Sft| │
* ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
* │Ctl│GUI│Alt│ │Spc│Spc│Mut│ |Spc|Alt│App│Ctl│ │Mox|
* └───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘
*/
[_WIN] = LAYOUT_all(
KC_ESC, 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_BSPC,
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_BSLS,
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_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_MUTE, KC_SPC, KC_RALT, KC_APP, KC_RCTL, MO(_WIN_INDEX)
),

[_MAC] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_LALT, KC_LGUI, _______, _______, _______, _______, KC_RGUI, KC_RALT, _______, MO(_MAC_INDEX)
),

[_WIN_INDEX] = LAYOUT_all(
KC_GRV , KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL,
_______, _______, TO(0), TO(1), _______, _______, _______, _______, _______, _______, RGB_M_P, RGB_RMOD, RGB_RMOD, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_SPI, _______,
_______, _______, _______, _______, _______, _______, _______, _______, RGB_VAD, RGB_VAI, KC_UP, _______,
_______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______
),

[_MAC_INDEX] = LAYOUT_all(
KC_GRV , KC_F14, KC_F15, C(KC_UP), G(KC_D), G(KC_SPC), LSG(KC_4), KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL,
_______, _______, TO(0), TO(1), _______, _______, _______, _______, _______, _______, RGB_M_P, RGB_RMOD, RGB_RMOD, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_SPI, _______,
_______, _______, _______, _______, _______, _______, _______, _______, RGB_VAD, RGB_VAI, KC_UP, _______,
_______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______
)
};

#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[_WIN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[_MAC] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
[_WIN_INDEX] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI) },
[_MAC_INDEX] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI) }
};
#endif

2 changes: 2 additions & 0 deletions keyboards/skyloong/gk61/pro_48/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes
11 changes: 11 additions & 0 deletions keyboards/skyloong/gk61/pro_48/mcuconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2023 linlin012 (@linlin012)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#include_next <mcuconf.h>

#undef STM32_I2C_USE_I2C1
#define STM32_I2C_USE_I2C1 TRUE

#undef STM32_I2C_USE_DMA
#define STM32_I2C_USE_DMA TRUE
227 changes: 227 additions & 0 deletions keyboards/skyloong/gk61/pro_48/pro_48.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
// Copyright 2023 linlin012 (@linlin012)
// SPDX-License-Identifier: GPL-2.0-or-later
#include "quantum.h"
_Bool FN_WIN = 0;
_Bool FN_MAC = 0;
_Bool L_WIN = 0;
_Bool L_MAC = 0;

#if defined(RGB_MATRIX_ENABLE) /*&& defined(CAPS_LOCK_INDEX)*/
const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
* | | G location
* | | | B location
* | | | | */
{0, CS1_SW1, CS2_SW1, CS3_SW1},
{0, CS1_SW2, CS2_SW2, CS3_SW2},
{0, CS1_SW3, CS2_SW3, CS3_SW3},
{0, CS1_SW4, CS2_SW4, CS3_SW4},
{0, CS1_SW5, CS2_SW5, CS3_SW5},
{0, CS1_SW6, CS2_SW6, CS3_SW6},
{0, CS1_SW7, CS2_SW7, CS3_SW7},
{0, CS1_SW8, CS2_SW8, CS3_SW8},
{0, CS1_SW9, CS2_SW9, CS3_SW9},
{0, CS1_SW10, CS2_SW10, CS3_SW10},
{0, CS1_SW11, CS2_SW11, CS3_SW11},
{0, CS16_SW1, CS17_SW1, CS18_SW1},
{0, CS16_SW2, CS17_SW2, CS18_SW2},
{0, CS16_SW3, CS17_SW3, CS18_SW3},

{0, CS4_SW1, CS5_SW1, CS6_SW1},
{0, CS4_SW2, CS5_SW2, CS6_SW2},
{0, CS4_SW3, CS5_SW3, CS6_SW3},
{0, CS4_SW4, CS5_SW4, CS6_SW4},
{0, CS4_SW5, CS5_SW5, CS6_SW5},
{0, CS4_SW6, CS5_SW6, CS6_SW6},
{0, CS4_SW7, CS5_SW7, CS6_SW7},
{0, CS4_SW8, CS5_SW8, CS6_SW8},
{0, CS4_SW9, CS5_SW9, CS6_SW9},
{0, CS4_SW10, CS5_SW10, CS6_SW10},
{0, CS4_SW11, CS5_SW11, CS6_SW11},
{0, CS16_SW4, CS17_SW4, CS18_SW4},
{0, CS16_SW5, CS17_SW5, CS18_SW5},
{0, CS16_SW6, CS17_SW6, CS18_SW6},

{0, CS7_SW1, CS8_SW1, CS9_SW1},
{0, CS7_SW2, CS8_SW2, CS9_SW2},
{0, CS7_SW3, CS8_SW3, CS9_SW3},
{0, CS7_SW4, CS8_SW4, CS9_SW4},
{0, CS7_SW5, CS8_SW5, CS9_SW5},
{0, CS7_SW6, CS8_SW6, CS9_SW6},
{0, CS7_SW7, CS8_SW7, CS9_SW7},
{0, CS7_SW8, CS8_SW8, CS9_SW8},
{0, CS7_SW9, CS8_SW9, CS9_SW9},
{0, CS7_SW10, CS8_SW10, CS9_SW10},
{0, CS7_SW11, CS8_SW11, CS9_SW11},
{0, CS16_SW7, CS17_SW7, CS18_SW7},
{0, CS16_SW8, CS17_SW8, CS18_SW8},

{0, CS10_SW1, CS11_SW1, CS12_SW1},
{0, CS10_SW2, CS11_SW2, CS12_SW2},
{0, CS10_SW3, CS11_SW3, CS12_SW3},
{0, CS10_SW4, CS11_SW4, CS12_SW4},
{0, CS10_SW5, CS11_SW5, CS12_SW5},
{0, CS10_SW6, CS11_SW6, CS12_SW6},
{0, CS10_SW7, CS11_SW7, CS12_SW7},
{0, CS10_SW8, CS11_SW8, CS12_SW8},
{0, CS10_SW9, CS11_SW9, CS12_SW9},
{0, CS10_SW10, CS11_SW10, CS12_SW10},
{0, CS10_SW11, CS11_SW11, CS12_SW11},
{0, CS16_SW9, CS17_SW9, CS18_SW9},

{0, CS13_SW1, CS14_SW1, CS15_SW1},
{0, CS13_SW2, CS14_SW2, CS15_SW2},
{0, CS13_SW3, CS14_SW3, CS15_SW3},
{0, CS13_SW4, CS14_SW4, CS15_SW4},
{0, CS13_SW5, CS14_SW5, CS15_SW5},
{0, CS13_SW5, CS14_SW5, CS15_SW5},
{0, CS13_SW6, CS14_SW6, CS15_SW6},
{0, CS13_SW7, CS14_SW7, CS15_SW7},
{0, CS13_SW8, CS14_SW8, CS15_SW8},
{0, CS13_SW9, CS14_SW9, CS15_SW9},
{0, CS13_SW10, CS14_SW10, CS15_SW10}
};

bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) {
return false;
}

if (host_keyboard_led_state().caps_lock) {
RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 255, 255, 255);
} else {
if (!rgb_matrix_get_flags()) {
RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 0, 0, 0);
}
}

switch (get_highest_layer(layer_state)) {
case 2:{
RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255);
if (!rgb_matrix_get_flags()) {
RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0);
}
} break;
case 3:{
RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255);
if (!rgb_matrix_get_flags()) {
RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0);
}
} break;

case 0:{
if (L_WIN) {
RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255);
if (!rgb_matrix_get_flags()) {
RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0);
}
}else{
if (!rgb_matrix_get_flags()) {
RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0);
}
}
} break;

case 1:{
if (L_MAC) {
RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255);
if (!rgb_matrix_get_flags()) {
RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0);
}
}else{
if (!rgb_matrix_get_flags()) {
RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0);
}
}
} break;

default:{
if (!rgb_matrix_get_flags()) {
RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0);
RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0);
}
}
}
return false;
}


void suspend_power_down_kb(void) {
writePinLow(SDB);
suspend_power_down_user();
}

void suspend_wakeup_init_kb(void) {
writePinHigh(SDB);
suspend_wakeup_init_user();
}
#endif

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) {
# ifdef RGB_MATRIX_ENABLE
case RGB_TOG:
if (record->event.pressed) {
switch (rgb_matrix_get_flags()) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_set_color_all(0, 0, 0);
} break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
} break;
}
}
return false;
# endif
case TO(0):
if (record->event.pressed) {
L_WIN = 1;
set_single_persistent_default_layer(0); // Save default layer 0 to eeprom
} else {
L_WIN = 0;
}
return true; // continue all further processing of this key

case MO(2):
if (record->event.pressed) {
FN_WIN = 1;
} else {
FN_WIN = 0;
}
return true; // continue all further processing of this key

case TO(1):
if (record->event.pressed) {
L_MAC = 1;
set_single_persistent_default_layer(1); //Save default layer 1 to eeprom
} else {
L_MAC = 0;
}
return true; // continue all further processing of this key

case MO(3):
if (record->event.pressed) {
FN_MAC = 1;
} else {
FN_MAC = 0;
}
return true; // continue all further processing of this key
default:
return true;
}
}

void board_init(void) {
// JTAG-DP Disabled and SW-DP Disabled
AFIO->MAPR = (AFIO->MAPR & ~AFIO_MAPR_SWJ_CFG_Msk) | AFIO_MAPR_SWJ_CFG_DISABLE;
# ifdef RGB_MATRIX_ENABLE
setPinOutput(SDB);
writePinHigh(SDB);
# endif
}
Loading

0 comments on commit f150258

Please sign in to comment.