forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create gk21 pro rgb number pad keyboard
- Loading branch information
Showing
11 changed files
with
421 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright 2023 linlin012 (@linlin012) | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#pragma once | ||
|
||
#define AW20216S_EN_PIN_1 B5 | ||
#define AW20216S_CS_PIN_1 B12 | ||
#define NUM_LOCK_INDEX 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_SPI TRUE | ||
|
||
#include_next <halconf.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
{ | ||
"manufacturer": "skyloong", | ||
"keyboard_name": "GK21 Pro V1.0.0", | ||
"maintainer": "NaturalZh", | ||
"bootloader": "stm32duino", | ||
"debounce": 10, | ||
"diode_direction": "ROW2COL", | ||
"encoder": { | ||
"rotary": [ | ||
{"pin_a": "A3", "pin_b": "A2", "resolution": 2}, | ||
{"pin_a": "A1", "pin_b": "A0", "resolution": 2}, | ||
{"pin_a": "A15", "pin_b": "B3", "resolution": 2}, | ||
{"pin_a": "B7", "pin_b": "B6", "resolution": 2} | ||
] | ||
}, | ||
"features": { | ||
"bootmagic": true, | ||
"command": true, | ||
"console": false, | ||
"encoder": true, | ||
"extrakey": true, | ||
"mousekey": true, | ||
"nkro": true, | ||
"rgb_matrix": true | ||
}, | ||
"build": { | ||
"debounce_type": "asym_eager_defer_pk" | ||
}, | ||
"matrix_pins": { | ||
"cols": ["A7", "B0", "B1", "C13"], | ||
"rows": ["A10", "A9", "A8", "A6", "A5", "A4"] | ||
}, | ||
"processor": "STM32F103", | ||
"rgb_matrix": { | ||
"animations": { | ||
"breathing": true, | ||
"band_spiral_val": true, | ||
"cycle_all": true, | ||
"cycle_left_right": true, | ||
"cycle_up_down": true, | ||
"cycle_out_in": true, | ||
"cycle_out_in_dual": true, | ||
"rainbow_moving_chevron": true, | ||
"cycle_pinwheel": true, | ||
"cycle_spiral": true, | ||
"dual_beacon": true, | ||
"raindrops": true, | ||
"jellybean_raindrops": true, | ||
"pixel_rain": true, | ||
"typing_heatmap":true, | ||
"digital_rain": true, | ||
"solid_reactive_simple": true, | ||
"solid_reactive_multiwide": true, | ||
"solid_reactive_multinexus": true, | ||
"splash": true, | ||
"solid_splash": true | ||
}, | ||
"driver": "aw20216s", | ||
"layout": [ | ||
{"matrix": [0, 0], "x": 0, "y": 0, "flags": 4}, | ||
{"matrix": [0, 1], "x": 74.7, "y": 0, "flags": 4}, | ||
{"matrix": [0, 2], "x": 149.3, "y": 0, "flags": 4}, | ||
{"matrix": [0, 3], "x": 224, "y": 0, "flags": 4}, | ||
|
||
{"matrix": [1, 0], "x": 0, "y": 12.8, "flags": 4}, | ||
{"matrix": [1, 1], "x": 74.7, "y": 12.8, "flags": 4}, | ||
{"matrix": [1, 2], "x": 149.3, "y": 12.8, "flags": 4}, | ||
{"matrix": [1, 3], "x": 224, "y": 12.8, "flags": 4}, | ||
|
||
{"matrix": [2, 0], "x": 0, "y": 25.6, "flags": 4}, | ||
{"matrix": [2, 1], "x": 74.7, "y": 25.6, "flags": 4}, | ||
{"matrix": [2, 2], "x": 149.3, "y": 25.6, "flags": 4}, | ||
|
||
{"matrix": [3, 0], "x": 0, "y": 38.4, "flags": 4}, | ||
{"matrix": [3, 1], "x": 74.7, "y": 38.4, "flags": 4}, | ||
{"matrix": [3, 2], "x": 149.3, "y": 38.4, "flags": 4}, | ||
{"matrix": [3, 3], "x": 224, "y": 32, "flags": 4}, | ||
|
||
{"matrix": [4, 0], "x": 0, "y": 51.2, "flags": 4}, | ||
{"matrix": [4, 1], "x": 74.7, "y": 51.2, "flags": 4}, | ||
{"matrix": [4, 2], "x": 149.3, "y": 51.2, "flags": 4}, | ||
|
||
{"matrix": [5, 0], "x": 0, "y": 64, "flags": 4}, | ||
{"matrix": [5, 2], "x": 149.3, "y": 64, "flags": 4}, | ||
{"matrix": [5, 3], "x": 224, "y": 57.6, "flags": 4} | ||
], | ||
"max_brightness": 200, | ||
"hue_steps": 20, | ||
"sat_steps": 20, | ||
"speed_steps": 20, | ||
"val_steps": 20, | ||
"sleep": true, | ||
"default": | ||
{"animation": "cycle_up_down"} | ||
}, | ||
"url": "https://github.com/NaturalZh", | ||
"usb": { | ||
"device_version": "1.0.0", | ||
"pid": "0x6A21", | ||
"vid": "0x1EA7", | ||
"max_power": 380 | ||
}, | ||
"community_layouts": ["numpad_6x4"], | ||
"layouts": { | ||
"LAYOUT_numpad_6x4": { | ||
"layout": [ | ||
{"label":"ESC","matrix": [0, 0], "x": 0, "y": 0}, | ||
{"label":"TAB","matrix": [0, 1], "x": 1, "y": 0}, | ||
{"label":"Fn","matrix": [0, 2], "x": 2, "y": 0}, | ||
{"label":"BS","matrix": [0, 3], "x": 3, "y": 0}, | ||
|
||
{"label":"NUM","matrix": [1, 0], "x": 0, "y": 1}, | ||
{"label":"/","matrix": [1, 1], "x": 1, "y": 1}, | ||
{"label":"*","matrix": [1, 2], "x": 2, "y": 1}, | ||
{"label":"-","matrix": [1, 3], "x": 3, "y": 1}, | ||
|
||
{"label":"7","matrix": [2, 0], "x": 0, "y": 2}, | ||
{"label":"8","matrix": [2, 1], "x": 1, "y": 2}, | ||
{"label":"9","matrix": [2, 2], "x": 2, "y": 2}, | ||
|
||
{"label":"4","matrix": [3, 0], "x": 0, "y": 3}, | ||
{"label":"5","matrix": [3, 1], "x": 1, "y": 3}, | ||
{"label":"6","matrix": [3, 2], "x": 2, "y": 3}, | ||
{"label":"+","matrix": [3, 3], "x": 3, "y": 2, "h":2}, | ||
|
||
{"label":"1","matrix": [4, 0], "x": 0, "y": 4}, | ||
{"label":"2","matrix": [4, 1], "x": 1, "y": 4}, | ||
{"label":"3","matrix": [4, 2], "x": 2, "y": 4}, | ||
|
||
{"label":"0","matrix": [5, 0], "x": 0, "y": 5, "w": 2}, | ||
{"label":"Dot","matrix": [5, 2], "x": 2, "y": 5}, | ||
{"label":"Ent","matrix": [5, 3], "x": 3, "y": 4, "h": 2} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// 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│Tab│MO1│Bsp│ | ||
* ├───┼───┼───┼───┤ | ||
* │Num│ / │ * │ - │ | ||
* ├───┼───┼───┼───┤ | ||
* │ 7 │ 8 │ 9 │ │ | ||
* ├───┼───┼───┤ + │ | ||
* │ 4 │ 5 │ 6 │ │ | ||
* ├───┼───┼───┼───┤ | ||
* │ 1 │ 2 │ 3 │ │ | ||
* ├───┴───┼───┤Ent│ | ||
* │ 0 │ . │ │ | ||
* └───────┴───┴───┘ | ||
*/ | ||
[0] = LAYOUT_numpad_6x4( | ||
KC_ESC, KC_TAB, MO(1), KC_BSPC, | ||
KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, | ||
KC_P7, KC_P8, KC_P9, | ||
KC_P4, KC_P5, KC_P6, KC_PPLS, | ||
KC_P1, KC_P2, KC_P3, | ||
KC_P0, KC_PDOT, KC_PENT | ||
), | ||
|
||
/* | ||
* ┌───┐───┬───┬───┐ | ||
* │Rst│MOD│MO1│Bsp│ | ||
* └───┘───┼───┼───┤ | ||
* │Num│HUD│HUI│VAD│ | ||
* ┌───┬───┬───┐───┤ | ||
* │Hom│ ↑ │PgU│ │ | ||
* ├───┼───┼───┤VAI│ | ||
* │ ← │ │ → │ │ | ||
* ├───┼───┼───┤───┤ | ||
* │End│ ↓ │PgD│ │ | ||
* ├───┴───┼───┤TOG│ | ||
* │Insert │Del│ │ | ||
* └───────┴───┘───┘ | ||
*/ | ||
[1] = LAYOUT_numpad_6x4( | ||
QK_BOOT, RGB_MOD, _______, _______, | ||
_______, RGB_HUD, RGB_HUI, RGB_VAD, | ||
KC_HOME, KC_UP, KC_PGUP, | ||
KC_LEFT, RGB_M_SW, KC_RGHT, RGB_VAI, | ||
KC_END, KC_DOWN, KC_PGDN, | ||
KC_INS, KC_DEL, 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), ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(G(KC_LEFT)), C(G(KC_RIGHT))), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL))}, | ||
[1] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(G(KC_LEFT)), C(G(KC_RIGHT))), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL))} | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ENCODER_MAP_ENABLE = yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// 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│Tab│MO1│Bsp│ | ||
* ├───┼───┼───┼───┤ | ||
* │Num│ / │ * │ - │ | ||
* ├───┼───┼───┼───┤ | ||
* │ 7 │ 8 │ 9 │ │ | ||
* ├───┼───┼───┤ + │ | ||
* │ 4 │ 5 │ 6 │ │ | ||
* ├───┼───┼───┼───┤ | ||
* │ 1 │ 2 │ 3 │ │ | ||
* ├───┴───┼───┤Ent│ | ||
* │ 0 │ . │ │ | ||
* └───────┴───┴───┘ | ||
*/ | ||
[0] = LAYOUT_numpad_6x4( | ||
KC_ESC, KC_TAB, MO(1), KC_BSPC, | ||
KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, | ||
KC_P7, KC_P8, KC_P9, | ||
KC_P4, KC_P5, KC_P6, KC_PPLS, | ||
KC_P1, KC_P2, KC_P3, | ||
KC_P0, KC_PDOT, KC_PENT | ||
), | ||
|
||
[1] = LAYOUT_numpad_6x4( | ||
KC_MUTE, RGB_TOG, _______, _______, | ||
_______, RGB_SPD, RGB_SPI, RGB_VAD, | ||
_______, _______, _______, | ||
_______, RGB_RMOD, RGB_MOD, RGB_VAI, | ||
_______, _______, _______, | ||
_______, _______, KC_PENT | ||
) | ||
}; | ||
|
||
#if defined(ENCODER_MAP_ENABLE) | ||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { | ||
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(G(KC_LEFT)), C(G(KC_RIGHT))), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL))}, | ||
[1] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(G(KC_LEFT)), C(G(KC_RIGHT))), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL))} | ||
}; | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
VIA_ENABLE = yes | ||
ENCODER_MAP_ENABLE = yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_SPI_USE_SPI2 | ||
#define STM32_SPI_USE_SPI2 TRUE | ||
|
||
#undef STM32_SPI_USE_DMA | ||
#define STM32_SPI_USE_DMA TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
// Copyright 2023 NaturalZh (@NaturalZh) | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#include "quantum.h" | ||
|
||
int FN_ON = 0; | ||
bool WIN_LOCK = 0; | ||
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 aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT] = { | ||
/* Refer to aw20216 manual for these locations | ||
* driver | ||
* | R location | ||
* | | G location | ||
* | | | B location | ||
* | | | | */ | ||
{0, CS3_SW1, CS2_SW1, CS1_SW1}, | ||
{0, CS6_SW1, CS5_SW1, CS4_SW1}, | ||
{0, CS9_SW1, CS8_SW1, CS7_SW1}, | ||
{0, CS12_SW1, CS11_SW1, CS10_SW1}, | ||
|
||
{0, CS3_SW2, CS2_SW2, CS1_SW2}, | ||
{0, CS6_SW2, CS5_SW2, CS4_SW2}, | ||
{0, CS9_SW2, CS8_SW2, CS7_SW2}, | ||
{0, CS12_SW2, CS11_SW2, CS10_SW2}, | ||
|
||
{0, CS3_SW3, CS2_SW3, CS1_SW3}, | ||
{0, CS6_SW3, CS5_SW3, CS4_SW3}, | ||
{0, CS9_SW3, CS8_SW3, CS7_SW3}, | ||
|
||
{0, CS3_SW4, CS2_SW4, CS1_SW4}, | ||
{0, CS6_SW4, CS5_SW4, CS4_SW4}, | ||
{0, CS9_SW4, CS8_SW4, CS7_SW4}, | ||
{0, CS12_SW4, CS11_SW4, CS10_SW4}, | ||
|
||
{0, CS3_SW5, CS2_SW5, CS1_SW5}, | ||
{0, CS6_SW5, CS5_SW5, CS4_SW5}, | ||
{0, CS9_SW5, CS8_SW5, CS7_SW5}, | ||
|
||
{0, CS3_SW6, CS2_SW6, CS1_SW6}, | ||
{0, CS9_SW6, CS8_SW6, CS7_SW6}, | ||
{0, CS12_SW6, CS11_SW6, CS10_SW6} | ||
}; | ||
|
||
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().num_lock) { | ||
RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_INDEX, 255, 255, 255); | ||
} else { | ||
if (!rgb_matrix_get_flags()) { | ||
RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_INDEX, 0, 0, 0); | ||
} | ||
} | ||
return true; | ||
} | ||
#endif | ||
|
||
void suspend_power_down_kb(void) { | ||
gpio_write_pin_low(AW20216S_EN_PIN_1); | ||
suspend_power_down_user(); | ||
} | ||
|
||
void suspend_wakeup_init_kb(void) { | ||
gpio_write_pin_high(AW20216S_EN_PIN_1); | ||
suspend_wakeup_init_user(); | ||
} | ||
bool shutdown_kb(bool jump_to_bootloader) { | ||
gpio_write_pin_low(AW20216S_EN_PIN_1); | ||
return true; | ||
} | ||
|
||
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 RGB_VAI: | ||
rgb_matrix_set_flags(LED_FLAG_ALL); //Turn on the LED effect. | ||
return true; | ||
|
||
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 | ||
gpio_set_pin_output(AW20216S_EN_PIN_1); | ||
gpio_write_pin_high(AW20216S_EN_PIN_1); | ||
# endif | ||
} |
Oops, something went wrong.