~ruther/qmk_firmware

72cf966a88f8d2cfe7e6e2c3b455334fd9164bc5 — skyloong 2 years ago ba263f9
[Keyboard] Add skyloong/Dt40 (#21237)

Co-authored-by: jack <0x6a73@protonmail.com>
Co-authored-by: Less/Rikki <86894501+lesshonor@users.noreply.github.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
A keyboards/skyloong/dt40/config.h => keyboards/skyloong/dt40/config.h +36 -0
@@ 0,0 1,36 @@
/* Copyright 2021 JZ-Skyloong (@JZ-Skyloong)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#pragma once

#define RGB_MATRIX_LED_COUNT 44   //The number of LEDs connected
#define RGB_MATRIX_KEYPRESSES  //Reacts to keypress
#define RGB_DISABLE_WHEN_USB_SUSPENDED   //turn off effects when suspended

#define RGB_MATRIX_DEFAULT_VAL 150  //Sets the default mode, if none has been set
#define RGB_TRIGGER_ON_KEYDOWN  //Triggers RGB keypress events on key down
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS // enable framebuffer effects
#define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 1

//Set WS2812 driver
#define WS2812_TRST_US 200  //The Trst period between frames
//set ' WS2812_DRIVER = pwm ' in rule.mk
#define WS2812_PWM_DRIVER PWMD3
#define WS2812_PWM_CHANNEL 1
#define WS2812_PWM_PAL_MODE 2
#define WS2812_DMA_STREAM STM32_DMA1_STREAM3
#define WS2812_DMA_CHANNEL 3



A keyboards/skyloong/dt40/dt40.c => keyboards/skyloong/dt40/dt40.c +24 -0
@@ 0,0 1,24 @@
/* Copyright 2021 JZ-Skyloong (@JZ-Skyloong)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */



#include "quantum.h"

void board_init(void) {
    AFIO->MAPR |= AFIO_MAPR_USART1_REMAP | AFIO_MAPR_TIM3_REMAP_PARTIALREMAP;

}

A keyboards/skyloong/dt40/halconf.h => keyboards/skyloong/dt40/halconf.h +21 -0
@@ 0,0 1,21 @@
/* Copyright 2021 JZ-Skyloong (@JZ-Skyloong)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#pragma once

#define HAL_USE_PWM TRUE

#include_next <halconf.h>


A keyboards/skyloong/dt40/info.json => keyboards/skyloong/dt40/info.json +165 -0
@@ 0,0 1,165 @@
{
    "manufacturer": "JZ-Skyloong",
    "keyboard_name": "DT40",
    "maintainer": "JZ-Skyloong",
    "bootloader": "stm32duino",
    "diode_direction": "ROW2COL",
    "features": {
        "bootmagic": true,
        "command": false,
        "console": false,
        "extrakey": true,
        "mousekey": true,
        "nkro": true,
        "rgb_matrix": true
    },
    "matrix_pins": {
        "cols": ["B12", "B5", "B8", "B9", "B10", "B11", "A15", "B7", "A2", "A1", "A0"],
        "rows": ["B6", "B15", "B2", "B14"]
    },
    "processor": "STM32F103",
    "rgb_matrix": {
        "animations": {
            "alphas_mods": true,
            "band_pinwheel_sat": true,
            "band_pinwheel_val": true,
            "band_sat": true,
            "band_spiral_sat": true,
            "band_spiral_val": true,
            "breathing": true,
            "cycle_all": true,
            "cycle_left_right": true,
            "cycle_out_in": true,
            "cycle_out_in_dual": true,
            "cycle_pinwheel": true,
            "cycle_spiral": true,
            "cycle_up_down": true,
            "dual_beacom": true,
            "gradient_left_right": true,
            "gradient_up_down": true,
            "hue_breathing": true,
            "hue_pendulum": true,
            "hue_wave": true,
            "jellybean_raindrops": true,
            "pixel_fractal": true,
            "pixel_rain": true,
            "rainbow_moving_chevron": true,
            "rainbow_pinwheels": true,
            "raindrops": true,
            "ranbow_beacon": true
        },
        "driver": "WS2812",
        "hue_steps": 20,
        "layout": [
            {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4},
            {"matrix": [0, 1], "x": 28, "y": 0, "flags": 4},
            {"matrix": [0, 2], "x": 47, "y": 0, "flags": 4},
            {"matrix": [0, 3], "x": 65, "y": 0, "flags": 4},
            {"matrix": [0, 4], "x": 84, "y": 0, "flags": 4},
            {"matrix": [0, 5], "x": 103, "y": 0, "flags": 4},
            {"matrix": [0, 6], "x": 121, "y": 0, "flags": 4},
            {"matrix": [0, 7], "x": 140, "y": 0, "flags": 4},
            {"matrix": [0, 8], "x": 159, "y": 0, "flags": 4},
            {"matrix": [0, 9], "x": 177, "y": 0, "flags": 4},
            {"matrix": [0, 10], "x": 223, "y": 0, "flags": 4},
            {"matrix": [1, 0], "x": 0, "y": 21, "flags": 4},
            {"matrix": [1, 1], "x": 33, "y": 21, "flags": 4},
            {"matrix": [1, 2], "x": 51, "y": 21, "flags": 4},
            {"matrix": [1, 3], "x": 70, "y": 21, "flags": 4},
            {"matrix": [1, 4], "x": 89, "y": 21, "flags": 4},
            {"matrix": [1, 5], "x": 107, "y": 21, "flags": 4},
            {"matrix": [1, 6], "x": 126, "y": 21, "flags": 4},
            {"matrix": [1, 7], "x": 145, "y": 21, "flags": 4},
            {"matrix": [1, 8], "x": 182, "y": 21, "flags": 4},
            {"matrix": [1, 9], "x": 196, "y": 0, "flags": 4},
            {"matrix": [1, 10], "x": 219, "y": 21, "flags": 4},
            {"matrix": [2, 0], "x": 0, "y": 43, "flags": 4},
            {"matrix": [2, 1], "x": 42, "y": 43, "flags": 4},
            {"matrix": [2, 2], "x": 61, "y": 43, "flags": 4},
            {"matrix": [2, 3], "x": 79, "y": 43, "flags": 4},
            {"matrix": [2, 4], "x": 98, "y": 43, "flags": 4},
            {"matrix": [2, 5], "x": 117, "y": 43, "flags": 4},
            {"matrix": [2, 6], "x": 135, "y": 43, "flags": 4},
            {"matrix": [2, 7], "x": 154, "y": 43, "flags": 4},
            {"matrix": [2, 8], "x": 180, "y": 43, "flags": 4},
            {"matrix": [2, 9], "x": 205, "y": 43, "flags": 4},
            {"matrix": [2, 10], "x":224, "y": 43, "flags": 4},
            {"matrix": [3, 0], "x": 0, "y": 64, "flags": 4},
            {"matrix": [3, 1], "x": 23, "y": 64, "flags": 4},
            {"matrix": [3, 2], "x": 42, "y": 64, "flags": 4},
            {"matrix": [3, 3], "x": 63, "y": 64, "flags": 4},
            {"matrix": [3, 4], "x": 100, "y": 64, "flags": 4},
            {"matrix": [3, 5], "x": 163, "y":21, "flags": 4},
            {"matrix": [3, 6], "x": 145, "y": 64, "flags": 4},
            {"matrix": [3, 7], "x": 165, "y": 64, "flags": 4},
            {"matrix": [3, 8], "x": 187, "y": 64, "flags": 4},
            {"matrix": [3, 9], "x": 205, "y":64, "flags": 4},
            {"matrix": [3, 10], "x": 224, "y": 64, "flags": 4}
        ],
        "max_brightness": 180,
        "sat_steps": 20,
        "speed_steps": 20,
        "val_steps": 20
    },
    "url": "https://github.com/JZ-Skyloong",
    "usb": {
        "device_version": "1.0.0",
        "pid": "0x6040",
        "vid": "0x1EA7"
    },
    "ws2812": {
        "driver": "pwm",
        "pin": "B4"
    },
    "layouts": {
        "LAYOUT": {
            "layout": [
                {"matrix": [0, 0], "x": 0, "y": 0, "w": 1.5},
                {"matrix": [0, 1], "x": 1.5, "y": 0},
                {"matrix": [0, 2], "x": 2.5, "y": 0},
                {"matrix": [0, 3], "x": 3.5, "y": 0},
                {"matrix": [0, 4], "x": 4.5, "y": 0},
                {"matrix": [0, 5], "x": 5.5, "y": 0},
                {"matrix": [0, 6], "x": 6.5, "y": 0},
                {"matrix": [0, 7], "x": 7.5, "y": 0},
                {"matrix": [0, 8], "x": 8.5, "y": 0},
                {"matrix": [0, 9], "x": 9.5, "y": 0},
                {"matrix": [0, 10], "x": 11.5, "y": 0, "w": 1.5},
                {"matrix": [1, 0], "x": 0, "y": 1, "w": 1.75},
                {"matrix": [1, 1], "x": 1.75, "y": 1},
                {"matrix": [1, 2], "x": 2.75, "y": 1},
                {"matrix": [1, 3], "x": 3.75, "y": 1},
                {"matrix": [1, 4], "x": 4.75, "y": 1},
                {"matrix": [1, 5], "x": 5.75, "y": 1},
                {"matrix": [1, 6], "x": 6.75, "y": 1},
                {"matrix": [1, 7], "x": 7.75, "y": 1},
                {"matrix": [1, 8], "x": 9.75, "y": 1},
                {"matrix": [1, 9], "x": 10.5, "y": 0},
                {"matrix": [1, 10], "x": 10.75, "y": 1, "w": 2.25},
                {"matrix": [2, 0], "x": 0, "y": 2, "w": 2.25},
                {"matrix": [2, 1], "x": 2.25, "y": 2},
                {"matrix": [2, 2], "x": 3.25, "y": 2},
                {"matrix": [2, 3], "x": 4.25, "y": 2},
                {"matrix": [2, 4], "x": 5.25, "y": 2},
                {"matrix": [2, 5], "x": 6.25, "y": 2},
                {"matrix": [2, 6], "x": 7.25, "y": 2},
                {"matrix": [2, 7], "x": 8.25, "y": 2},
                {"matrix": [2, 8], "x": 9.25, "y": 2, "w": 1.75},
                {"matrix": [2, 9], "x": 11, "y": 2},
                {"matrix": [2, 10], "x": 12, "y": 2},
                {"matrix": [3, 0], "x": 0, "y": 3, "w": 1.25},
                {"matrix": [3, 1], "x": 1.25, "y": 3},
                {"matrix": [3, 2], "x": 2.25, "y": 3},
                {"matrix": [3, 3], "x": 3.25, "y": 3, "w": 1.25},
                {"matrix": [3, 4], "x": 4.5, "y": 3, "w": 3},
                {"matrix": [3, 5], "x": 8.75, "y": 1},
                {"matrix": [3, 6], "x": 7.5, "y": 3, "w": 1.25},
                {"matrix": [3, 7], "x": 8.75, "y": 3, "w": 1.25},
                {"matrix": [3, 8], "x": 10, "y": 3},
                {"matrix": [3, 9], "x": 11, "y": 3},
                {"matrix": [3, 10], "x": 12, "y": 3}
            ]
        }
    }
}


A keyboards/skyloong/dt40/keymaps/default/keymap.c => keyboards/skyloong/dt40/keymaps/default/keymap.c +30 -0
@@ 0,0 1,30 @@
/* Copyright 2021 JZ-Skyloong (@JZ-Skyloong)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* Base */
    [0] = LAYOUT(
        KC_ESC,     KC_Q,    KC_W,     KC_E,    KC_R,   KC_T,   KC_Y,     KC_U,      KC_O,      KC_I,    KC_BSPC,
       KC_CAPS,     KC_A,    KC_S,     KC_D,    KC_F,   KC_G,   KC_H,     KC_J,      KC_L,      KC_P,     KC_ENT,
       KC_LSFT,     KC_Z,    KC_X,     KC_C,    KC_V,   KC_B,   KC_N,     KC_M,   KC_RSFT,     KC_UP,    RGB_TOG,
       KC_LCTL,  KC_LALT,  KC_SPC,  KC_LWIN,  KC_SPC,   KC_K, KC_SPC, 	KC_APP,   KC_LEFT,   KC_DOWN,    KC_RGHT
    )
};



A keyboards/skyloong/dt40/keymaps/via/keymap.c => keyboards/skyloong/dt40/keymaps/via/keymap.c +59 -0
@@ 0,0 1,59 @@
/* Copyright 2021 JZ-Skyloong (@JZ-Skyloong)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#include QMK_KEYBOARD_H

// Defines names for use in layer keycodes and the keymap
enum layer_names {
    _QWERTY,
    _LOWER,
    _RAISE,
    _ADJUST,
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* Base */
    [_QWERTY] = LAYOUT(
         KC_ESC,     KC_Q,    KC_W,      KC_E,     KC_R,   KC_T,    KC_Y,     KC_U,      KC_O,      KC_I,   KC_BSPC,
        KC_CAPS,     KC_A,    KC_S,      KC_D,     KC_F,   KC_G,    KC_H,     KC_J,      KC_L,      KC_P,    KC_ENT,
        KC_LSFT,     KC_Z,    KC_X,      KC_C,     KC_V,   KC_B,    KC_N,     KC_M,   KC_RSFT,     KC_UP,     MO(3),
        KC_LCTL,  KC_LALT,   MO(1),   KC_LWIN,   KC_SPC,   KC_K,   MO(2),   KC_APP,   KC_LEFT,   KC_DOWN,   KC_RGHT
    ),

    [_LOWER] = LAYOUT(
         RGB_TOG,  RGB_M_P,  RGB_M_R,  RGB_M_B, RGB_M_SW, _______, _______, _______,   KC_EQL, KC_MINS,  _______,
         _______,  _______,  _______,  _______,  _______, _______, _______, _______,  KC_RBRC, KC_BSLS,  _______,
         _______,  _______,  _______,  _______,  _______, _______, _______, _______,  _______, RGB_VAI,  _______,
         _______,  _______,  _______,  _______,  _______, KC_LBRC, _______, _______, RGB_RMOD, RGB_VAD,  RGB_MOD
    ),

    [_RAISE] = LAYOUT(
        _______,     KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_9,    KC_8, _______,
         KC_TAB,   KC_GRV, _______, _______, _______, _______, _______, KC_SCLN, _______,    KC_0, _______,
        _______,  _______, _______, _______, _______, KC_COMM,  KC_DOT, KC_SLSH, _______, _______, _______,
        _______,  _______, _______, _______, _______, KC_QUOT, _______, _______, _______, _______, _______
    ),

    [_ADJUST] = LAYOUT(
        _______,   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F9,   KC_F8, _______,
        _______, _______, _______, _______, _______, _______, _______, _______,  KC_F12,  KC_F10, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______, _______, _______, _______, _______,  KC_F11, _______, _______, _______, _______, _______
    )

};


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

A keyboards/skyloong/dt40/mcuconf.h => keyboards/skyloong/dt40/mcuconf.h +24 -0
@@ 0,0 1,24 @@
/* Copyright 2021 JZ-Skyloong (@JZ-Skyloong)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */



#pragma once

#include_next <mcuconf.h>

#undef STM32_PWM_USE_TIM3
#define STM32_PWM_USE_TIM3 TRUE

A keyboards/skyloong/dt40/readme.md => keyboards/skyloong/dt40/readme.md +32 -0
@@ 0,0 1,32 @@
# DT40

![DT40](https://i.imgur.com/3QemSZ0h.jpg)

## The PCB features:
* QMK & VIA compatibility
* RGB Matrix backlight
* Thin body & Simple keys


The following is the QMK Firmware for the Destop 40% keylayout -  designed in Dongguan Jizhi Electronic Technology Co., Ltd
* Keyboard Maintainer: [JZ-Skyloong](https://github.com/JZ-Skyloong)
* Hardware Supported: DestopPCB for Skyloong keylayout 40%, STM32F103C8T6
* Hardware Availability: http://www.skyloong.com.cn

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

    make skyloong/dt40:default

Flashing example for this keyboard:

    make skyloong/dt40: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/dt40/rules.mk => keyboards/skyloong/dt40/rules.mk +1 -0
@@ 0,0 1,1 @@
# This file intentionally left blank