~ruther/qmk_firmware

234e099c7242550dd0f662d9647ab9dda00f0c41 — skyloong 1 year, 9 months ago 21ed9b4
Added skyloong/Qk21 v1 Number Pad (#21467)

Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
A keyboards/skyloong/qk21/v1/config.h => keyboards/skyloong/qk21/v1/config.h +12 -0
@@ 0,0 1,12 @@
// Copyright 2021 JZ-Skyloong (@JZ-Skyloong)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

/* Enable num-lock LED */
#define NUM_LOCK_INDEX 13

#define RGB_MATRIX_LED_COUNT 21
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS  //Enable frame effects
#define RGB_MATRIX_KEYPRESSES  //Reacts to keypress
#define RGB_DISABLE_WHEN_USB_SUSPENDED   //turn off effects when suspended

A keyboards/skyloong/qk21/v1/info.json => keyboards/skyloong/qk21/v1/info.json +129 -0
@@ 0,0 1,129 @@
{
    "manufacturer": "JZ-Skyloong",
    "keyboard_name": "qk21",
    "maintainer": "linlin012",
    "bootloader": "atmel-dfu",
    "diode_direction": "ROW2COL",
    "features": {
        "bootmagic": true,
        "command": false,
        "console": false,
        "extrakey": true,
        "mousekey": true,
        "nkro": true,
        "rgb_matrix": true
    },
    "matrix_pins": {
        "cols": ["F7", "E6", "C7", "D5"],
        "rows": ["F0", "F1", "F4", "F5", "F6", "B4"]
    },
    "processor": "atmega32u4",
    "ws2812": {
        "pin": "B7"
    },
    "rgb_matrix":{
        "driver": "ws2812",
        "animations": {
            "alphas_mods": false,
            "band_pinwheel_sat": false,
            "band_pinwheel_val": false,
            "band_sat": false,
            "band_spiral_sat": false,
            "band_spiral_val": false,
            "breathing": true,
            "cycle_all": true,
            "cycle_left_right": false,
            "cycle_out_in": false,
            "cycle_out_in_dual": false,
            "cycle_pinwheel": true,
            "cycle_spiral": true,
            "cycle_up_down": true,
            "dual_beacom": false,
            "gradient_left_right": false,
            "gradient_up_down": false,
            "hue_breathing": false,
            "hue_pendulum": false,
            "hue_wave": false,
            "jellybean_raindrops": true,
            "pixel_fractal": false,
            "pixel_rain": true,
            "rainbow_moving_chevron":false,
            "rainbow_pinwheels": true,
            "raindrops": true,
            "ranbow_beacon": true,
            "typing_heatmap": true,
            "solid_reactive_simple": true,
            "solid_reactive_cross": true,
            "splash": true
        },
        "layout": [
            {"matrix": [5, 0], "x": 37, "y": 64, "flags": 4},
            {"matrix": [5, 2], "x": 149, "y": 64, "flags": 4},
            {"matrix": [5, 3], "x": 224, "y": 58, "flags": 4},

            {"matrix": [4, 0], "x": 0, "y": 51, "flags": 4},
            {"matrix": [4, 1], "x": 75, "y": 51, "flags": 4},
            {"matrix": [4, 2], "x": 149, "y": 51, "flags": 4},

            {"matrix": [3, 0], "x": 0, "y": 38, "flags": 4},
            {"matrix": [3, 1], "x": 75, "y": 38, "flags": 4},
            {"matrix": [3, 2], "x": 149, "y": 38, "flags": 4},
            {"matrix": [3, 3], "x": 224, "y": 31, "flags": 4},

            {"matrix": [2, 0], "x": 0, "y": 25, "flags": 4},
            {"matrix": [2, 1], "x": 75, "y": 25, "flags": 4},
            {"matrix": [2, 2], "x": 149, "y": 25, "flags": 4},

            {"matrix": [1, 0], "x": 0, "y": 12, "flags": 8},
            {"matrix": [1, 1], "x": 75, "y": 12, "flags": 4},
            {"matrix": [1, 2], "x": 149, "y": 12, "flags": 4},
            {"matrix": [1, 3], "x": 224, "y": 12, "flags": 4},

            {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4},
            {"matrix": [0, 1], "x": 75, "y": 0, "flags": 4},
            {"matrix": [0, 2], "x": 149, "y": 0, "flags": 4},
            {"matrix": [0, 3], "x": 224, "y": 0, "flags": 4}

        ],
        "hue_steps": 20,
        "max_brightness": 200,
        "sat_steps": 20,
        "speed_steps": 20,
        "val_steps": 20
    },
    "url": "https://github.com/JZ-Skyloong",
    "usb": {
        "device_version": "1.0.0",
        "pid": "0x6021",
        "vid": "0x1EA7",
        "max_power": 250
    },
    "community_layouts": ["numpad_6x4"],
    "layouts": {
        "LAYOUT_numpad_6x4": {
            "layout": [
                { "matrix": [0, 0], "x": 0, "y": 0 },
                { "matrix": [0, 1], "x": 1, "y": 0 },
                { "matrix": [0, 2], "x": 2, "y": 0 },
                { "matrix": [0, 3], "x": 3, "y": 0 },
                { "matrix": [1, 0], "x": 0, "y": 1 },
                { "matrix": [1, 1], "x": 1, "y": 1 },
                { "matrix": [1, 2], "x": 2, "y": 1 },
                { "matrix": [1, 3], "x": 3, "y": 1 },
                { "matrix": [2, 0], "x": 0, "y": 2 },
                { "matrix": [2, 1], "x": 1, "y": 2 },
                { "matrix": [2, 2], "x": 2, "y": 2 },
                { "matrix": [3, 0], "x": 0, "y": 3 },
                { "matrix": [3, 1], "x": 1, "y": 3 },
                { "matrix": [3, 2], "x": 2, "y": 3 },
                { "matrix": [3, 3], "x": 3, "y": 2, "h": 2 },
                { "matrix": [4, 0], "x": 0, "y": 4 },
                { "matrix": [4, 1], "x": 1, "y": 4 },
                { "matrix": [4, 2], "x": 2, "y": 4 },
                { "matrix": [5, 0], "x": 0, "y": 5, "w": 2 },
                { "matrix": [5, 2], "x": 2, "y": 5 },
                { "matrix": [5, 3], "x": 3, "y": 4, "h": 2 }
            ]
        }
    }
}

A keyboards/skyloong/qk21/v1/keymaps/default/keymap.c => keyboards/skyloong/qk21/v1/keymaps/default/keymap.c +54 -0
@@ 0,0 1,54 @@
// Copyright 2023 QMK
// 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
    )
};

A keyboards/skyloong/qk21/v1/keymaps/via/keymap.c => keyboards/skyloong/qk21/v1/keymaps/via/keymap.c +54 -0
@@ 0,0 1,54 @@
// Copyright 2023 QMK
// 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
    )
};

A keyboards/skyloong/qk21/v1/keymaps/via/rules.mk => keyboards/skyloong/qk21/v1/keymaps/via/rules.mk +1 -0
@@ 0,0 1,1 @@
VIA_ENABLE = yes

A keyboards/skyloong/qk21/v1/readme.md => keyboards/skyloong/qk21/v1/readme.md +27 -0
@@ 0,0 1,27 @@
# qk21_V1

![qk21](https://i.imgur.com/d65CJC5h.jpg)

The following is the QMK Firmware for the number pad 6x4 keylayout - designed in Dongguan Jizhi Electronic Technology Co., Ltd

* Keyboard Maintainer: [linlin012](https://github.com/linlin012)
* Hardware Supported: JK172-RGB(4028)-U PCBs, MEGA32U4-MU 
* Hardware Availability: http://www.skyloong.com.cn

Make example for this keyboard (after setting up your build environment):

    make skyloong/qk21/v1:default

Flashing example for this keyboard:

    make skyloong/qk21/v1:default:flash

See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

## Bootloader

Enter the bootloader in 3 ways:

* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available

A keyboards/skyloong/qk21/v1/rules.mk => keyboards/skyloong/qk21/v1/rules.mk +1 -0
@@ 0,0 1,1 @@
# This file intentionally left blank

A keyboards/skyloong/qk21/v1/v1.c => keyboards/skyloong/qk21/v1/v1.c +49 -0
@@ 0,0 1,49 @@
// Copyright 2021 JZ-Skyloong (@JZ-Skyloong)
// SPDX-License-Identifier: GPL-2.0-or-later

#include "quantum.h"

#if defined(RGB_MATRIX_ENABLE) && defined(NUM_LOCK_INDEX)

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
    }
    return true;
}

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;
    }
    // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue);

    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  // NUM_LOCK_INDEX


Do not follow this link