From 192fe181c4dd605b29dd10b9b9acf7773dcd5ecb Mon Sep 17 00:00:00 2001 From: volatile_static <1043064987@qq.com> Date: Thu, 10 Aug 2023 13:14:21 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=2095?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 95/config.h | 25 +++ 95/halconf.h | 22 +++ 95/info.json | 302 ++++++++++++++++++++++++++++++++++++ 95/keymaps/default/keymap.c | 46 ++++++ 95/keymaps/vial/config.h | 7 + 95/keymaps/vial/keymap.c | 38 +++++ 95/keymaps/vial/rules.mk | 4 + 95/keymaps/vial/vial.json | 213 +++++++++++++++++++++++++ 95/light.c | 198 +++++++++++++++++++++++ 95/light.h | 6 + 95/matrix.c | 32 ++++ 95/mcuconf.h | 28 ++++ 95/readme.md | 27 ++++ 95/rules.mk | 1 + 95/vs95.c | 54 +++++++ 95/ws2812.h | 5 + README.md | 5 + 17 files changed, 1013 insertions(+) create mode 100644 95/config.h create mode 100644 95/halconf.h create mode 100644 95/info.json create mode 100644 95/keymaps/default/keymap.c create mode 100644 95/keymaps/vial/config.h create mode 100644 95/keymaps/vial/keymap.c create mode 100644 95/keymaps/vial/rules.mk create mode 100644 95/keymaps/vial/vial.json create mode 100644 95/light.c create mode 100644 95/light.h create mode 100644 95/matrix.c create mode 100644 95/mcuconf.h create mode 100644 95/readme.md create mode 100644 95/rules.mk create mode 100644 95/vs95.c create mode 100644 95/ws2812.h diff --git a/95/config.h b/95/config.h new file mode 100644 index 00000000..dd2c37d9 --- /dev/null +++ b/95/config.h @@ -0,0 +1,25 @@ +// Copyright 2023 ZJU (@VS) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT + +// #define WS2812_T1H 720 +// #define WS2812_T1L 355 +// #define WS2812_T0H 355 +// #define WS2812_T0L 680 +// #define WS2812_TIMING 900 + +#define WS2812_PWM_DRIVER PWMD3 +#define WS2812_DMA_CHANNEL 5 +#define WS2812_TRST_US 160 +#define WS2812_PWM_TARGET_PERIOD 1123595 + +#define RGB_DISABLE_WHEN_USB_SUSPENDED +#define RGB_MATRIX_LED_COUNT 94 +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_KEYPRESSES diff --git a/95/halconf.h b/95/halconf.h new file mode 100644 index 00000000..485d48ef --- /dev/null +++ b/95/halconf.h @@ -0,0 +1,22 @@ +/* Copyright 2020 QMK + * + * 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 . + */ + +#pragma once + +#define HAL_USE_PWM TRUE +#define HAL_USE_PAL TRUE + +#include_next diff --git a/95/info.json b/95/info.json new file mode 100644 index 00000000..c138e00f --- /dev/null +++ b/95/info.json @@ -0,0 +1,302 @@ +{ + "manufacturer": "ZJU", + "keyboard_name": "vs95", + "maintainer": "VS", + "bootloader": "stm32-dfu", + "diode_direction": "COL2ROW", + "features": { + "bootmagic": true, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true, + "combo": true, + "key_lock": true, + "encoder": true, + "rgblight": true, + "rgb_matrix": true + }, + "encoder": { + "rotary": [ + { "pin_a": "B0", "pin_b": "B1", "resolution": 4 } + ] + }, + "ws2812": { + "pin": "A7", + "driver": "pwm" + }, + "rgb_matrix": { + "driver": "WS2812", + "animations": { + "alphas_mods": true, + "gradient_up_down": true, + "gradient_left_right": true, + "breathing": true, + "band_sat": true, + "band_val": true, + "band_pinwheel_sat": true, + "band_pinwheel_val": true, + "band_spiral_sat": true, + "band_spiral_val": true, + "cycle_all": true, + "cycle_left_right": true, + "cycle_up_down": true, + "rainbow_moving_chevron": true, + "cycle_out_in": true, + "cycle_out_in_dual": true, + "cycle_pinwheel": true, + "cycle_spiral": true, + "dual_beacon": true, + "rainbow_beacon": true, + "rainbow_pinwheels": true, + "raindrops": true, + "jellybean_raindrops": true, + "hue_breathing": true, + "hue_pendulum": true, + "hue_wave": true, + "pixel_rain": true, + "pixel_flow": true, + "pixel_fractal": true, + "typing_heatmap": true, + "digital_rain": true, + "solid_reactive_simple": true, + "solid_reactive": true, + "solid_reactive_wide": true, + "solid_reactive_multiwide": true, + "solid_reactive_cross": true, + "solid_reactive_multicross": true, + "solid_reactive_nexus": true, + "solid_reactive_multinexus": true, + "splash": true, + "multisplash": true, + "solid_splash": true, + "solid_multisplash": true + }, + "layout": [ + {"flags": 4, "matrix": [0, 15], "x": 186.667, "y": 0}, + {"flags": 4, "matrix": [0, 14], "x": 174.222, "y": 0}, + {"flags": 4, "matrix": [0, 13], "x": 161.778, "y": 0}, + {"flags": 4, "matrix": [0, 12], "x": 149.333, "y": 0}, + {"flags": 4, "matrix": [0, 10], "x": 124.444, "y": 0}, + {"flags": 4, "matrix": [0, 9], "x": 112, "y": 0}, + {"flags": 4, "matrix": [0, 8], "x": 99.556, "y": 0}, + {"flags": 4, "matrix": [0, 7], "x": 87.111, "y": 0}, + {"flags": 4, "matrix": [0, 6], "x": 74.667, "y": 0}, + {"flags": 4, "matrix": [0, 5], "x": 62.222, "y": 0}, + {"flags": 4, "matrix": [0, 4], "x": 49.778, "y": 0}, + {"flags": 4, "matrix": [0, 3], "x": 37.333, "y": 0}, + {"flags": 4, "matrix": [0, 1], "x": 12.444, "y": 0}, + {"flags": 4, "matrix": [1, 17], "x": 224, "y": 12.8}, + {"flags": 4, "matrix": [1, 16], "x": 211.556, "y": 12.8}, + {"flags": 4, "matrix": [1, 15], "x": 199.111, "y": 12.8}, + {"flags": 4, "matrix": [1, 14], "x": 174.222, "y": 12.8}, + {"flags": 4, "matrix": [1, 13], "x": 161.778, "y": 12.8}, + {"flags": 4, "matrix": [1, 12], "x": 149.333, "y": 12.8}, + {"flags": 4, "matrix": [1, 11], "x": 136.889, "y": 12.8}, + {"flags": 4, "matrix": [1, 10], "x": 124.444, "y": 12.8}, + {"flags": 4, "matrix": [1, 9], "x": 112, "y": 12.8}, + {"flags": 4, "matrix": [1, 8], "x": 99.556, "y": 12.8}, + {"flags": 4, "matrix": [1, 7], "x": 87.111, "y": 12.8}, + {"flags": 4, "matrix": [1, 6], "x": 74.667, "y": 12.8}, + {"flags": 4, "matrix": [1, 5], "x": 62.222, "y": 12.8}, + {"flags": 4, "matrix": [1, 4], "x": 49.778, "y": 12.8}, + {"flags": 4, "matrix": [1, 3], "x": 37.333, "y": 12.8}, + {"flags": 4, "matrix": [1, 2], "x": 24.889, "y": 12.8}, + {"flags": 4, "matrix": [1, 1], "x": 12.444, "y": 12.8}, + {"flags": 4, "matrix": [1, 0], "x": 0, "y": 12.8}, + {"flags": 4, "matrix": [2, 17], "x": 224, "y": 25.6}, + {"flags": 4, "matrix": [2, 16], "x": 211.556, "y": 25.6}, + {"flags": 4, "matrix": [2, 15], "x": 199.111, "y": 25.6}, + {"flags": 4, "matrix": [2, 14], "x": 180.444, "y": 25.6}, + {"flags": 4, "matrix": [2, 13], "x": 168, "y": 25.6}, + {"flags": 4, "matrix": [2, 12], "x": 155.556, "y": 25.6}, + {"flags": 4, "matrix": [2, 11], "x": 143.111, "y": 25.6}, + {"flags": 4, "matrix": [2, 10], "x": 130.667, "y": 25.6}, + {"flags": 4, "matrix": [2, 9], "x": 118.222, "y": 25.6}, + {"flags": 4, "matrix": [2, 8], "x": 105.778, "y": 25.6}, + {"flags": 4, "matrix": [2, 7], "x": 93.333, "y": 25.6}, + {"flags": 4, "matrix": [2, 6], "x": 80.889, "y": 25.6}, + {"flags": 4, "matrix": [2, 5], "x": 68.444, "y": 25.6}, + {"flags": 4, "matrix": [2, 4], "x": 56, "y": 25.6}, + {"flags": 4, "matrix": [2, 3], "x": 43.556, "y": 25.6}, + {"flags": 4, "matrix": [2, 2], "x": 31.111, "y": 25.6}, + {"flags": 4, "matrix": [2, 1], "x": 12.444, "y": 25.6}, + {"flags": 4, "matrix": [2, 0], "x": 0, "y": 25.6}, + {"flags": 4, "matrix": [3, 17], "x": 224, "y": 38.4}, + {"flags": 4, "matrix": [3, 16], "x": 211.556, "y": 38.4}, + {"flags": 4, "matrix": [3, 15], "x": 199.111, "y": 38.4}, + {"flags": 4, "matrix": [3, 14], "x": 171.111, "y": 38.4}, + {"flags": 4, "matrix": [3, 12], "x": 149.333, "y": 38.4}, + {"flags": 4, "matrix": [3, 11], "x": 146.222, "y": 38.4}, + {"flags": 4, "matrix": [3, 10], "x": 133.778, "y": 38.4}, + {"flags": 4, "matrix": [3, 9], "x": 121.333, "y": 38.4}, + {"flags": 4, "matrix": [3, 8], "x": 108.889, "y": 38.4}, + {"flags": 4, "matrix": [3, 7], "x": 96.444, "y": 38.4}, + {"flags": 4, "matrix": [3, 6], "x": 84, "y": 38.4}, + {"flags": 4, "matrix": [3, 5], "x": 71.556, "y": 38.4}, + {"flags": 4, "matrix": [3, 4], "x": 59.111, "y": 38.4}, + {"flags": 4, "matrix": [3, 3], "x": 46.667, "y": 38.4}, + {"flags": 4, "matrix": [3, 2], "x": 34.222, "y": 38.4}, + {"flags": 4, "matrix": [3, 1], "x": 12.444, "y": 38.4}, + {"flags": 4, "matrix": [3, 0], "x": 0, "y": 38.4}, + {"flags": 4, "matrix": [4, 17], "x": 224, "y": 51.2}, + {"flags": 4, "matrix": [4, 16], "x": 211.556, "y": 51.2}, + {"flags": 4, "matrix": [4, 15], "x": 199.111, "y": 51.2}, + {"flags": 4, "matrix": [4, 13], "x": 164.889, "y": 51.2}, + {"flags": 4, "matrix": [4, 11], "x": 152.444, "y": 51.2}, + {"flags": 4, "matrix": [4, 10], "x": 140, "y": 51.2}, + {"flags": 4, "matrix": [4, 9], "x": 127.556, "y": 51.2}, + {"flags": 4, "matrix": [4, 8], "x": 115.111, "y": 51.2}, + {"flags": 4, "matrix": [4, 7], "x": 102.667, "y": 51.2}, + {"flags": 4, "matrix": [4, 6], "x": 90.222, "y": 51.2}, + {"flags": 4, "matrix": [4, 5], "x": 77.778, "y": 51.2}, + {"flags": 4, "matrix": [4, 4], "x": 65.333, "y": 51.2}, + {"flags": 4, "matrix": [4, 3], "x": 52.889, "y": 51.2}, + {"flags": 4, "matrix": [4, 2], "x": 40.444, "y": 51.2}, + {"flags": 4, "matrix": [4, 1], "x": 12.444, "y": 51.2}, + {"flags": 4, "matrix": [4, 0], "x": 0, "y": 51.2}, + {"flags": 4, "matrix": [5, 17], "x": 224, "y": 64}, + {"flags": 4, "matrix": [5, 16], "x": 211.556, "y": 64}, + {"flags": 4, "matrix": [5, 15], "x": 199.111, "y": 64}, + {"flags": 4, "matrix": [5, 14], "x": 174.222, "y": 64}, + {"flags": 4, "matrix": [5, 13], "x": 161.778, "y": 64}, + {"flags": 4, "matrix": [5, 11], "x": 136.889, "y": 64}, + {"flags": 4, "matrix": [5, 10], "x": 124.444, "y": 64}, + {"flags": 4, "matrix": [5, 6], "x": 90, "y": 64}, + {"flags": 4, "matrix": [5, 3], "x": 43.556, "y": 64}, + {"flags": 4, "matrix": [5, 2], "x": 28, "y": 64}, + {"flags": 4, "matrix": [5, 1], "x": 12.444, "y": 64}, + {"flags": 4, "matrix": [5, 0], "x": 0, "y": 64} + ] + }, + "rgblight": { + "led_count": 11, + "animations": { + "alternating": true, + "breathing": true, + "christmas": true, + "knight": true, + "rainbow_mood": true, + "rainbow_swirl": true, + "rgb_test": true, + "snake": true, + "static_gradient": true, + "twinkle": true + } + }, + "matrix_pins": { + "custom": true, + "custom_lite": true, + "cols": ["A15", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "C13", "C14", "C15", "A0", "A1", "A4", "A5", "A6", "A8", "B14"], + "rows": ["A13", "B13", "B12", "B15", "A10", "A9"] + }, + "processor": "STM32F401", + "board": "BLACKPILL_STM32_F401", + "url": "https://github.com/volatile-static/Keyboard", + "usb": { + "device_version": "1.0.0", + "pid": "0x0000", + "vid": "0xFEED" + }, + "layouts": { + "LAYOUT_96_ansi": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 1], "x": 1, "y": 0}, + {"matrix": [0, 3], "x": 3, "y": 0}, + {"matrix": [0, 4], "x": 4, "y": 0}, + {"matrix": [0, 5], "x": 5, "y": 0}, + {"matrix": [0, 6], "x": 6, "y": 0}, + {"matrix": [0, 7], "x": 7, "y": 0}, + {"matrix": [0, 8], "x": 8, "y": 0}, + {"matrix": [0, 9], "x": 9, "y": 0}, + {"matrix": [0, 10], "x": 10, "y": 0}, + {"matrix": [0, 12], "x": 12, "y": 0}, + {"matrix": [0, 13], "x": 13, "y": 0}, + {"matrix": [0, 14], "x": 14, "y": 0}, + {"matrix": [0, 15], "x": 15, "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": [1, 4], "x": 4, "y": 1}, + {"matrix": [1, 5], "x": 5, "y": 1}, + {"matrix": [1, 6], "x": 6, "y": 1}, + {"matrix": [1, 7], "x": 7, "y": 1}, + {"matrix": [1, 8], "x": 8, "y": 1}, + {"matrix": [1, 9], "x": 9, "y": 1}, + {"matrix": [1, 10], "x": 10, "y": 1}, + {"matrix": [1, 11], "x": 11, "y": 1}, + {"matrix": [1, 12], "x": 12, "y": 1}, + {"matrix": [1, 13], "x": 13, "y": 1}, + {"matrix": [1, 14], "x": 14, "y": 1, "w": 2}, + {"matrix": [1, 15], "x": 16, "y": 1}, + {"matrix": [1, 16], "x": 17, "y": 1}, + {"matrix": [1, 17], "x": 18, "y": 1}, + {"matrix": [2, 0], "x": 0, "y": 2}, + {"matrix": [2, 1], "x": 1, "y": 2, "w": 1.5}, + {"matrix": [2, 2], "x": 2.5, "y": 2}, + {"matrix": [2, 3], "x": 3.5, "y": 2}, + {"matrix": [2, 4], "x": 4.5, "y": 2}, + {"matrix": [2, 5], "x": 5.5, "y": 2}, + {"matrix": [2, 6], "x": 6.5, "y": 2}, + {"matrix": [2, 7], "x": 7.5, "y": 2}, + {"matrix": [2, 8], "x": 8.5, "y": 2}, + {"matrix": [2, 9], "x": 9.5, "y": 2}, + {"matrix": [2, 10], "x": 10.5, "y": 2}, + {"matrix": [2, 11], "x": 11.5, "y": 2}, + {"matrix": [2, 12], "x": 12.5, "y": 2}, + {"matrix": [2, 13], "x": 13.5, "y": 2}, + {"matrix": [2, 14], "x": 14.5, "y": 2, "w": 1.5}, + {"matrix": [2, 15], "x": 16, "y": 2}, + {"matrix": [2, 16], "x": 17, "y": 2}, + {"matrix": [2, 17], "x": 18, "y": 2}, + {"matrix": [3, 0], "x": 0, "y": 3}, + {"matrix": [3, 1], "x": 1, "y": 3, "w": 1.75}, + {"matrix": [3, 2], "x": 2.75, "y": 3}, + {"matrix": [3, 3], "x": 3.75, "y": 3}, + {"matrix": [3, 4], "x": 4.75, "y": 3}, + {"matrix": [3, 5], "x": 5.75, "y": 3}, + {"matrix": [3, 6], "x": 6.75, "y": 3}, + {"matrix": [3, 7], "x": 7.75, "y": 3}, + {"matrix": [3, 8], "x": 8.75, "y": 3}, + {"matrix": [3, 9], "x": 9.75, "y": 3}, + {"matrix": [3, 10], "x": 10.75, "y": 3}, + {"matrix": [3, 11], "x": 11.75, "y": 3}, + {"matrix": [3, 12], "x": 12, "y": 3}, + {"matrix": [3, 14], "x": 13.75, "y": 3, "w": 2.25}, + {"matrix": [3, 15], "x": 16, "y": 3}, + {"matrix": [3, 16], "x": 17, "y": 3}, + {"matrix": [3, 17], "x": 18, "y": 3}, + {"matrix": [4, 0], "x": 0, "y": 4}, + {"matrix": [4, 1], "x": 1, "y": 4, "w": 2.25}, + {"matrix": [4, 2], "x": 3.25, "y": 4}, + {"matrix": [4, 3], "x": 4.25, "y": 4}, + {"matrix": [4, 4], "x": 5.25, "y": 4}, + {"matrix": [4, 5], "x": 6.25, "y": 4}, + {"matrix": [4, 6], "x": 7.25, "y": 4}, + {"matrix": [4, 7], "x": 8.25, "y": 4}, + {"matrix": [4, 8], "x": 9.25, "y": 4}, + {"matrix": [4, 9], "x": 10.25, "y": 4}, + {"matrix": [4, 10], "x": 11.25, "y": 4}, + {"matrix": [4, 11], "x": 12.25, "y": 4}, + {"matrix": [4, 13], "x": 13.25, "y": 4, "w": 1.75}, + {"matrix": [4, 15], "x": 16, "y": 4}, + {"matrix": [4, 16], "x": 17, "y": 4}, + {"matrix": [4, 17], "x": 18, "y": 4}, + {"matrix": [5, 0], "x": 0, "y": 5, "w": 1}, + {"matrix": [5, 1], "x": 1, "y": 5, "w": 1.25}, + {"matrix": [5, 2], "x": 2.25, "y": 5, "w": 1.25}, + {"matrix": [5, 3], "x": 3.5, "y": 5, "w": 1.25}, + {"matrix": [5, 6], "x": 4.75, "y": 5, "w": 6.25}, + {"matrix": [5, 10], "x": 10, "y": 5}, + {"matrix": [5, 11], "x": 11, "y": 5}, + {"matrix": [5, 13], "x": 13, "y": 5}, + {"matrix": [5, 14], "x": 14, "y": 5}, + {"matrix": [5, 15], "x": 16, "y": 5}, + {"matrix": [5, 16], "x": 17, "y": 5}, + {"matrix": [5, 17], "x": 18, "y": 5} + ] + } + } +} \ No newline at end of file diff --git a/95/keymaps/default/keymap.c b/95/keymaps/default/keymap.c new file mode 100644 index 00000000..092802c1 --- /dev/null +++ b/95/keymaps/default/keymap.c @@ -0,0 +1,46 @@ +// Copyright 2023 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +/* Copyright 2021 QMK + * + * 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 . + */ + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ + * │Esc│F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│PSc│Scr│Pse│Vo-│Vo+│Mut│ + * ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┴───┼───┼───┼───┼───┤ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp│Num│ / │ * │ - │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┼───┼───┼───┤ + * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ 7 │ 8 │ 9 │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┼───┼───┤ + │ + * │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │ 4 │ 5 │ 6 │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┼───┼───┼───┤ + * │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │Shift │ ↑ │ 1 │ 2 │ 3 │ │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┼───┼───┤Ent│ + * │Ctrl│GUI │Alt │ Space │Alt│GUI│Ctl│ ← │ ↓ │ → │ 0 │ . │ │ + * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┴───┴───┴───┘ + */ + [0] = LAYOUT_96_ansi( + KC_MUTE, KC_ESC, 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, 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_BSPC, KC_P7, KC_P8, KC_P9, + KC_HOME, 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_P4, KC_P5, KC_P6, + KC_PGUP, 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_P1, KC_P2, KC_P3, + KC_PGDN, 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_P0, KC_UP, KC_LNUM, + KC_END, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ) +}; diff --git a/95/keymaps/vial/config.h b/95/keymaps/vial/config.h new file mode 100644 index 00000000..00667009 --- /dev/null +++ b/95/keymaps/vial/config.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +#define VIAL_KEYBOARD_UID {0x5C, 0xB4, 0xBA, 0x9C, 0x6D, 0x5C, 0xE4, 0x09} +#define VIAL_UNLOCK_COMBO_ROWS { 0, 1 } +#define VIAL_UNLOCK_COMBO_COLS { 0, 1 } diff --git a/95/keymaps/vial/keymap.c b/95/keymaps/vial/keymap.c new file mode 100644 index 00000000..178c8a80 --- /dev/null +++ b/95/keymaps/vial/keymap.c @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_96_ansi( + OSL(1), KC_ESC, 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, 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_BSPC, KC_P7, KC_P8, KC_P9, + KC_HOME, 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_P4, KC_P5, KC_P6, + KC_PGUP, 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_P1, KC_P2, KC_P3, + KC_PGDN, 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_P0, KC_UP, KC_NUM, + KC_END, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [1] = LAYOUT_96_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, C(KC_C), C(KC_V), QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [2] = LAYOUT_96_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; + +#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(KC_WH_U, KC_WH_D)}, + [2] = {ENCODER_CCW_CW(_______, _______)}, +}; +#endif diff --git a/95/keymaps/vial/rules.mk b/95/keymaps/vial/rules.mk new file mode 100644 index 00000000..a8611329 --- /dev/null +++ b/95/keymaps/vial/rules.mk @@ -0,0 +1,4 @@ +VIA_ENABLE = yes +VIAL_ENABLE = yes +ENCODER_MAP_ENABLE = yes +VIALRGB_ENABLE = yes diff --git a/95/keymaps/vial/vial.json b/95/keymaps/vial/vial.json new file mode 100644 index 00000000..e8ed3142 --- /dev/null +++ b/95/keymaps/vial/vial.json @@ -0,0 +1,213 @@ +{ + "lighting": "vialrgb", + "matrix": { + "rows": 6, + "cols": 18 + }, + "layouts": { + "keymap": [ + [ + "0,0", + { + "x": 0.25 + }, + "0,1", + { + "x": 1 + }, + "0,3", + "0,4", + "0,5", + "0,6", + { + "x": 0.5 + }, + "0,7", + "0,8", + "0,9", + "0,10", + { + "x": 0.5 + }, + "0,12", + "0,13", + "0,14", + "0,15", + { "x": 1 }, + "0,0\n\n\n\n\n\n\n\n\ne", + "0,1\n\n\n\n\n\n\n\n\ne" + ], + [ + { + "y": 0.5, + "t": "#800000" + }, + "1,0", + { + "x": 0.25 + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + "1,13", + { + "w": 2 + }, + "1,14", + { + "x": 0.25 + }, + "1,15", + "1,16", + "1,17" + ], + [ + "2,0", + { + "x": 0.25, + "w": 1.5 + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + "2,13", + { + "w": 1.5 + }, + "2,14", + { + "x": 0.25 + }, + "2,15", + "2,16", + "2,17" + ], + [ + "3,0", + { + "x": 0.25, + "w": 1.75 + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + "3,12", + { + "c": "#f8d615", + "w": 2.25 + }, + "3,14", + { + "x": 0.25, + "c": "#cccccc" + }, + "3,15", + "3,16", + "3,17" + ], + [ + "4,0", + { + "x": 0.25, + "w": 2.25 + }, + "4,1", + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "w": 2.75 + }, + "4,13", + { + "x": 0.25 + }, + "4,15", + { + "c": "#ac97d8" + }, + "4,16", + { + "c": "#cccccc" + }, + "4,17" + ], + [ + "5,0", + { + "x": 0.25, + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "w": 1.25 + }, + "5,3", + { + "w": 6.25 + }, + "5,6", + { + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,13", + { + "w": 1.25 + }, + "5,14", + { + "x": 0.25, + "c": "#ac97d8" + }, + "5,15", + "5,16", + "5,17" + ] + ] + } +} \ No newline at end of file diff --git a/95/light.c b/95/light.c new file mode 100644 index 00000000..97016927 --- /dev/null +++ b/95/light.c @@ -0,0 +1,198 @@ +#ifdef RGBLIGHT_ENABLE +#include "quantum.h" +#include "debug.h" + +#define LIGHT_PIN B10 +#define LIGHT_PWM_DRIVER PWMD2 +#define LIGHT_PWM_PAL_MODE 1 +#define LIGHT_PWM_CHANNEL 3 +#define LIGHT_DMA_CHANNEL 3 +#define LIGHT_DMA_STREAM STM32_DMA1_STREAM1 +#define LIGHT_TRST_US 300 + +/* --- PRIVATE CONSTANTS ---------------------------------------------------- */ + +#define LIGHT_PWM_FREQUENCY (STM32_SYSCLK / 2) /**< Clock frequency of PWM, must be valid with respect to system clock! */ +#define LIGHT_PWM_PERIOD (LIGHT_PWM_FREQUENCY / 800000) /**< Clock period in ticks. 1 / 800kHz = 1.25 uS (as per datasheet) */ + +/** + * @brief Number of bit-periods to hold the data line low at the end of a frame + * + * The reset period for each frame must be at least 50 uS; so we add in 50 bit-times + * of zeroes at the end. (50 bits)*(1.25 uS/bit) = 62.5 uS, which gives us some + * slack in the timing requirements + */ +#define LIGHT_COLOR_BITS (24) +#define LIGHT_RESET_BIT_N (1000 * LIGHT_TRST_US / WS2812_TIMING) +#define LIGHT_COLOR_BIT_N ((RGBLED_NUM + 3) * LIGHT_COLOR_BITS) /**< Number of data bits */ +#define LIGHT_BIT_N (LIGHT_COLOR_BIT_N + LIGHT_RESET_BIT_N) /**< Total number of bits in a frame */ +#define LIGHT_OUTPUT_MODE (PAL_MODE_ALTERNATE(LIGHT_PWM_PAL_MODE) | PAL_OUTPUT_TYPE_PUSHPULL | PAL_OUTPUT_SPEED_HIGHEST | PAL_PUPDR_FLOATING) + +/** + * @brief High period for a zero, in ticks + * + * Per the datasheet: + * WS2812: + * - T0H: 200 nS to 500 nS, inclusive + * - T0L: 650 nS to 950 nS, inclusive + * WS2812B: + * - T0H: 200 nS to 500 nS, inclusive + * - T0L: 750 nS to 1050 nS, inclusive + * SK6812: + * - T0H: 150 nS to 450 nS, inclusive + * - T0L: 750 nS to 1050 nS, inclusive + * + * The duty cycle is calculated for a high period of 350 nS. + */ +#define WS2812_DUTYCYCLE_0 16 +// (LIGHT_PWM_FREQUENCY / (1000000000 / 400)) + +/** + * @brief High period for a one, in ticks + * + * Per the datasheet: + * WS2812: + * - T1H: 550 nS to 850 nS, inclusive + * - T1L: 450 nS to 750 nS, inclusive + * WS2812B: + * - T1H: 750 nS to 1050 nS, inclusive + * - T1L: 200 nS to 500 nS, inclusive + * SK6812: + * - T1H: 450 nS to 750 nS, inclusive + * - T1L: 450 nS to 750 nS, inclusive + * + * The duty cycle is calculated for a high period of 800 nS. + * This is in the middle of the specifications of the WS2812 and WS2812B. + */ +#define WS2812_DUTYCYCLE_1 26 +// (LIGHT_PWM_FREQUENCY / (1000000000 / 500)) + +/* --- PRIVATE MACROS ------------------------------------------------------- */ + +/** + * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given bit + * + * @param[in] led: The led index [0, @ref WS2812_LED_N) + * @param[in] byte: The byte number [0, 2] + * @param[in] bit: The bit number [0, 7] + * + * @return The bit index + */ +#define WS2812_BIT(led, byte, bit) (LIGHT_COLOR_BITS * (led) + 8 * (byte) + (7 - (bit))) + +/** + * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given red bit + * + * @note The red byte is the middle byte in the color packet + * + * @param[in] led: The led index [0, @ref WS2812_LED_N) + * @param[in] bit: The bit number [0, 7] + * + * @return The bit index + */ +#define WS2812_RED_BIT(led, bit) WS2812_BIT((led), 1, (bit)) + +/** + * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given green bit + * + * @note The green byte is the first byte in the color packet + * + * @param[in] led: The led index [0, @ref WS2812_LED_N) + * @param[in] bit: The bit number [0, 7] + * + * @return The bit index + */ +#define WS2812_GREEN_BIT(led, bit) WS2812_BIT((led), 0, (bit)) + +/** + * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given blue bit + * + * @note The blue byte is the last byte in the color packet + * + * @param[in] led: The led index [0, @ref WS2812_LED_N) + * @param[in] bit: The bit index [0, 7] + * + * @return The bit index + */ +#define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 2, (bit)) + +// Used for 32-bit timer +#define WS2812_DMA_MEMORY_WIDTH STM32_DMA_CR_MSIZE_WORD +#define WS2812_DMA_PERIPHERAL_WIDTH STM32_DMA_CR_PSIZE_WORD + +/* --- PRIVATE VARIABLES ---------------------------------------------------- */ +static uint32_t light_frame_buffer[LIGHT_BIT_N + 1]; /**< Buffer for a frame */ + +/* --- PUBLIC FUNCTIONS ----------------------------------------------------- */ +/* + * Gedanke: Double-buffer type transactions: double buffer transfers using two memory pointers for +the memory (while the DMA is reading/writing from/to a buffer, the application can +write/read to/from the other buffer). + */ + +void light_init(void) { + // Initialize led frame buffer + uint32_t i; + for (i = 0; i < LIGHT_COLOR_BIT_N; i++) + light_frame_buffer[i] = WS2812_DUTYCYCLE_0; // All color bits are zero duty cycle + for (i = 0; i < LIGHT_RESET_BIT_N; i++) + light_frame_buffer[i + LIGHT_COLOR_BIT_N] = 0; // All reset bits are zero + + palSetLineMode(LIGHT_PIN, LIGHT_OUTPUT_MODE); // Set pin to output mode + + // PWM Configuration + static const PWMConfig ws2812_pwm_config = { + .frequency = LIGHT_PWM_FREQUENCY, + .period = LIGHT_PWM_PERIOD, // Mit dieser Periode wird UDE-Event erzeugt und ein neuer Wert (Länge LIGHT_BIT_N) vom DMA ins CCR geschrieben + .callback = NULL, + .channels = + { + [0 ... 3] = {.mode = PWM_OUTPUT_DISABLED, .callback = NULL}, // Channels default to disabled + [LIGHT_PWM_CHANNEL - 1] = {.mode = PWM_OUTPUT_ACTIVE_HIGH, .callback = NULL}, // Turn on the channel we care about + }, + .cr2 = 0, + .dier = TIM_DIER_UDE, // DMA on update event for next period + }; + + // Configure DMA + const stm32_dma_stream_t *dma = dmaStreamAlloc(STM32_DMA_STREAM_ID(1, 1), 10, NULL, NULL); + dmaStreamSetPeripheral(dma, &(LIGHT_PWM_DRIVER.tim->CCR[LIGHT_PWM_CHANNEL - 1])); + dmaStreamSetMemory0(dma, light_frame_buffer); + dmaStreamSetMode(dma, STM32_DMA_CR_CHSEL(LIGHT_DMA_CHANNEL) + | STM32_DMA_CR_DIR_M2P + | WS2812_DMA_PERIPHERAL_WIDTH + | WS2812_DMA_MEMORY_WIDTH + | STM32_DMA_CR_MINC + | STM32_DMA_CR_CIRC + | STM32_DMA_CR_PL(3) + ); + dmaStreamSetTransactionSize(dma, LIGHT_BIT_N); + // M2P: Memory 2 Periph; PL: Priority Level + + // Start DMA + dmaStreamEnable(dma); + + // Configure PWM + // NOTE: It's required that preload be enabled on the timer channel CCR register. This is currently enabled in the + // ChibiOS driver code, so we don't have to do anything special to the timer. If we did, we'd have to start the timer, + // disable counting, enable the channel, and then make whatever configuration changes we need. + pwmStart(&LIGHT_PWM_DRIVER, &ws2812_pwm_config); + pwmEnableChannel(&LIGHT_PWM_DRIVER, LIGHT_PWM_CHANNEL, 0); // Initial period is 0; output will be low until first duty cycle is DMA'd in +} + +void light_write_led(uint32_t led_number, uint8_t r, uint8_t g, uint8_t b) { + // Write color to frame buffer + for (uint8_t bit = 0; bit < 8; ++bit) { + light_frame_buffer[WS2812_RED_BIT(led_number, bit)] = ((r >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0; + light_frame_buffer[WS2812_GREEN_BIT(led_number, bit)] = ((g >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0; + light_frame_buffer[WS2812_BLUE_BIT(led_number, bit)] = ((b >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0; + } +} + +// override +void rgblight_call_driver(LED_TYPE *led_array, uint8_t num_leds) { + for (uint16_t i = 0; i < num_leds; i++) + light_write_led(i + 3, led_array[i].r, led_array[i].g, led_array[i].b); +} + +#endif diff --git a/95/light.h b/95/light.h new file mode 100644 index 00000000..558dfb18 --- /dev/null +++ b/95/light.h @@ -0,0 +1,6 @@ +enum led_indicators_t { + LED_SCROLL_LOCK = 0, LED_CAPS_LOCK, LED_NUM_LOCK +}; + +void light_init(void); +void light_write_led(uint32_t led_number, uint8_t r, uint8_t g, uint8_t b); diff --git a/95/matrix.c b/95/matrix.c new file mode 100644 index 00000000..80f56fd3 --- /dev/null +++ b/95/matrix.c @@ -0,0 +1,32 @@ + +#include "matrix.h" +#include "wait.h" + +static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS, + col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +void matrix_init_custom(void) { + for (uint8_t i = 1; i < MATRIX_ROWS; ++i) + setPinOutput(row_pins[i]); + for (uint8_t i = 0; i < MATRIX_COLS; ++i) + setPinInputHigh(col_pins[i]); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + bool changed = false; + for (int i = 0; i < MATRIX_ROWS; ++i) { + if (i > 0) + writePinHigh(row_pins[i - 1]); + writePinLow(row_pins[i]); + wait_us(6); + + matrix_row_t cols = 0; + for (uint8_t i = 0; i < MATRIX_COLS; ++i) + cols |= !readPin(col_pins[i]) << i; + + changed |= cols != current_matrix[i]; + current_matrix[i] = cols; + } + writePinHigh(row_pins[MATRIX_ROWS - 1]); + return changed; +} \ No newline at end of file diff --git a/95/mcuconf.h b/95/mcuconf.h new file mode 100644 index 00000000..b6a007b3 --- /dev/null +++ b/95/mcuconf.h @@ -0,0 +1,28 @@ +/* Copyright 2020 QMK + * + * 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 . + */ + +#pragma once + +#include_next + +#undef STM32_PWM_USE_TIM2 +#define STM32_PWM_USE_TIM2 TRUE + +#undef STM32_PWM_USE_TIM3 +#define STM32_PWM_USE_TIM3 TRUE + +#undef STM32_ST_USE_TIMER +#define STM32_ST_USE_TIMER 5 diff --git a/95/readme.md b/95/readme.md new file mode 100644 index 00000000..741a40d7 --- /dev/null +++ b/95/readme.md @@ -0,0 +1,27 @@ +# vs95 + +![vs95](imgur.com image replace me!) + +*A short description of the keyboard/project* + +* Keyboard Maintainer: [ZJU](https://github.com/VS) +* Hardware Supported: *The PCBs, controllers supported* +* Hardware Availability: *Links to where you can find this hardware* + +Make example for this keyboard (after setting up your build environment): + + make vs95:default + +Flashing example for this keyboard: + + make vs95: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 diff --git a/95/rules.mk b/95/rules.mk new file mode 100644 index 00000000..6f1a6813 --- /dev/null +++ b/95/rules.mk @@ -0,0 +1 @@ +SRC += matrix.c light.c diff --git a/95/vs95.c b/95/vs95.c new file mode 100644 index 00000000..8edfe3b4 --- /dev/null +++ b/95/vs95.c @@ -0,0 +1,54 @@ +#include "quantum.h" +#include "color.h" +#include "ws2812.h" +#include "light.h" + +void keyboard_post_init_kb(void) { + setPinOutput(A13); + setPinOutput(A14); + debug_config.enable = debug_config.matrix = debug_config.keyboard = true; + light_init(); + rgb_matrix_mode(RGB_MATRIX_TYPING_HEATMAP); + rgblight_mode(RGBLIGHT_MODE_TWINKLE_end); + + keyboard_post_init_user(); +} + +void housekeeping_task_kb(void) { + togglePin(A14); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t* record) { + return process_record_user(keycode, record); +} + +layer_state_t layer_state_set_kb(layer_state_t state) { + if (get_highest_layer(state)) + rgblight_mode(RGBLIGHT_MODE_SNAKE_end); + else + rgblight_mode(RGBLIGHT_MODE_TWINKLE_end); + return layer_state_set_user(state); +} + +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + HSV val = rgb_matrix_get_hsv(); + RGB rgb = hsv_to_rgb(val); + if (res) { + if (led_state.num_lock) + light_write_led(LED_NUM_LOCK, rgb.r, rgb.g, rgb.b); + else + light_write_led(LED_NUM_LOCK, RGB_OFF); + + if (led_state.caps_lock) + light_write_led(LED_CAPS_LOCK, rgb.r, rgb.g, rgb.b); + else + light_write_led(LED_CAPS_LOCK, RGB_OFF); + + if (led_state.scroll_lock) + light_write_led(LED_SCROLL_LOCK, rgb.r, rgb.g, rgb.b); + else + light_write_led(LED_SCROLL_LOCK, RGB_OFF); + } + return res; +} diff --git a/95/ws2812.h b/95/ws2812.h new file mode 100644 index 00000000..4b9d6fd6 --- /dev/null +++ b/95/ws2812.h @@ -0,0 +1,5 @@ +#pragma once +#include_next "ws2812.h" + +#undef WS2812_LED_COUNT +#define WS2812_LED_COUNT 94 diff --git a/README.md b/README.md index 869b04c3..048fd08f 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/volatile-static/Keyboard?color=lime) ![GitHub forks](https://img.shields.io/github/forks/volatile-static/Keyboard?color=red&style=social) +# 95 + + 兼容QMK与[Vial](https://get.vial.today/)的USB键盘。 + # 104 Powered by [SpinalHDL](https://github.com/SpinalHDL) @@ -39,6 +43,7 @@ # 选型手册 | 键数 | 主控 | 协议 | RGB | 扫描方式 | 其他 | | :---: | :---: | :---: | :---: | :---: | :---: | +| 95 | STM32F401CCU6 | USB | 全 | GPIO | 带USB-hub和旋钮 | | 104 | EP4CE6E22 | USB + PS/2 | 一半 | 全键无冲 | [购买](https://market.m.taobao.com/app/idleFish-F2e/widle-taobao-rax/page-detail?wh_weex=true&wx_navbar_transparent=true&id=637588964083&ut_sk=1.X7R74tmmaOsDAD0RHKo4TqAp_21407387_1613018144287.Copy.detail.637588964083.2206517679956&forceFlush=1) | | 17 | nRF52810QC | BLE | 全 | TCA8418 | 18650供电 | | 4 | STM32F103C8 | USB | 无 | GPIO | - |