diff options
Diffstat (limited to 'keyboards/horrortroll')
13 files changed, 738 insertions, 5 deletions
diff --git a/keyboards/horrortroll/chinese_pcb/m63_rgb/config.h b/keyboards/horrortroll/chinese_pcb/m63_rgb/config.h new file mode 100644 index 0000000000..2983971258 --- /dev/null +++ b/keyboards/horrortroll/chinese_pcb/m63_rgb/config.h @@ -0,0 +1,107 @@ +/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x7516 +#define PRODUCT_ID 0x6002 +#define DEVICE_VER 0x0001 +#define MANUFACTURER HorrorTroll +#define PRODUCT M63 RGB + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 14 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { B3, B4, A0, A2, A3 } +#define MATRIX_COL_PINS { B0, B1, B2, B10, A7, A6, A5, A4, B5, B6, A1, B7, B8, B9 } + +#define BOOTMAGIC_LITE_ROW 3 +#define BOOTMAGIC_LITE_COLUMN 5 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Forcing to use NKRO instead 6KRO */ +#define FORCE_NKRO + +/* Change USB Polling Rate to 1000hz and a larger keys per scan for elite gaming */ +#define USB_POLLING_INTERVAL_MS 1 +#define QMK_KEYS_PER_SCAN 12 + +#ifdef RGB_MATRIX_ENABLE + #define DRIVER_LED_TOTAL 75 + #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 + #define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS + #define RGB_MATRIX_KEYPRESSES + #define RGB_MATRIX_FRAMEBUFFER_EFFECTS + + /* RGB Matrix config */ + #define RGB_DI_PIN B15 + + /* RGB Matrix effect */ + #define ENABLE_RGB_MATRIX_ALPHAS_MODS + #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN + #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT + #define ENABLE_RGB_MATRIX_BREATHING + #define ENABLE_RGB_MATRIX_BAND_SAT + #define ENABLE_RGB_MATRIX_BAND_VAL + #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT + #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL + #define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT + #define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL + #define ENABLE_RGB_MATRIX_CYCLE_ALL + #define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT + #define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN + #define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON + #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN + #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL + #define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL + #define ENABLE_RGB_MATRIX_CYCLE_SPIRAL + #define ENABLE_RGB_MATRIX_DUAL_BEACON + #define ENABLE_RGB_MATRIX_RAINBOW_BEACON + #define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS + #define ENABLE_RGB_MATRIX_RAINDROPS + #define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS + #define ENABLE_RGB_MATRIX_HUE_BREATHING + #define ENABLE_RGB_MATRIX_HUE_PENDULUM + #define ENABLE_RGB_MATRIX_HUE_WAVE + #define ENABLE_RGB_MATRIX_PIXEL_RAIN + #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL +// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined + #define ENABLE_RGB_MATRIX_TYPING_HEATMAP + #define ENABLE_RGB_MATRIX_DIGITAL_RAIN +// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS + #define ENABLE_RGB_MATRIX_SPLASH + #define ENABLE_RGB_MATRIX_MULTISPLASH + #define ENABLE_RGB_MATRIX_SOLID_SPLASH + #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH +#endif diff --git a/keyboards/horrortroll/chinese_pcb/m63_rgb/info.json b/keyboards/horrortroll/chinese_pcb/m63_rgb/info.json new file mode 100644 index 0000000000..651e58a100 --- /dev/null +++ b/keyboards/horrortroll/chinese_pcb/m63_rgb/info.json @@ -0,0 +1,78 @@ +{ + "keyboard_name": "M63 RGB", + "url": "", + "maintainer": "HorrorTroll", + "layouts": { + "LAYOUT_60_ansi_arrow": { + "layout": [ + {"label":"Esc", "x":0, "y":0}, + {"label":"1!", "x":1, "y":0}, + {"label":"2@", "x":2, "y":0}, + {"label":"3#", "x":3, "y":0}, + {"label":"4$", "x":4, "y":0}, + {"label":"5%", "x":5, "y":0}, + {"label":"6^", "x":6, "y":0}, + {"label":"7&", "x":7, "y":0}, + {"label":"8*", "x":8, "y":0}, + {"label":"9(", "x":9, "y":0}, + {"label":"0)", "x":10, "y":0}, + {"label":"-_", "x":11, "y":0}, + {"label":"=+", "x":12, "y":0}, + {"label":"Backspace", "x":13, "y":0, "w":2}, + + {"label":"Tab", "x":0, "y":1, "w":1.5}, + {"label":"Q", "x":1.5, "y":1}, + {"label":"W", "x":2.5, "y":1}, + {"label":"E", "x":3.5, "y":1}, + {"label":"R", "x":4.5, "y":1}, + {"label":"T", "x":5.5, "y":1}, + {"label":"Y", "x":6.5, "y":1}, + {"label":"U", "x":7.5, "y":1}, + {"label":"I", "x":8.5, "y":1}, + {"label":"O", "x":9.5, "y":1}, + {"label":"P", "x":10.5, "y":1}, + {"label":"[{", "x":11.5, "y":1}, + {"label":"]}", "x":12.5, "y":1}, + {"label":"\\|", "x":13.5, "y":1, "w":1.5}, + + {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, + {"label":"A", "x":1.75, "y":2}, + {"label":"S", "x":2.75, "y":2}, + {"label":"D", "x":3.75, "y":2}, + {"label":"F", "x":4.75, "y":2}, + {"label":"G", "x":5.75, "y":2}, + {"label":"H", "x":6.75, "y":2}, + {"label":"J", "x":7.75, "y":2}, + {"label":"K", "x":8.75, "y":2}, + {"label":"L", "x":9.75, "y":2}, + {"label":";:", "x":10.75, "y":2}, + {"label":"'\"", "x":11.75, "y":2}, + {"label":"Enter", "x":12.75, "y":2, "w":2.25}, + + {"label":"Shift", "x":0, "y":3, "w":2.25}, + {"label":"Z", "x":2.25, "y":3}, + {"label":"X", "x":3.25, "y":3}, + {"label":"C", "x":4.25, "y":3}, + {"label":"V", "x":5.25, "y":3}, + {"label":"B", "x":6.25, "y":3}, + {"label":"N", "x":7.25, "y":3}, + {"label":"M", "x":8.25, "y":3}, + {"label":",<", "x":9.25, "y":3}, + {"label":".>", "x":10.25, "y":3}, + {"label":"Shift", "x":11.25, "y":3, "w":1.75}, + {"label":"\u2191", "x":13, "y":3}, + {"label":"/?", "x":14, "y":3}, + + {"label":"Ctrl", "x":0, "y":4, "w":1.25}, + {"label":"Win", "x":1.25, "y":4, "w":1.25}, + {"label":"Alt", "x":2.5, "y":4, "w":1.25}, + {"label":"Space", "x":3.75, "y":4, "w":6.25}, + {"label":"Alt", "x":10, "y":4}, + {"label":"Fn", "x":11, "y":4}, + {"label":"\u2190", "x":12, "y":4}, + {"label":"\u2193", "x":13, "y":4}, + {"label":"\u2192", "x":14, "y":4} + ] + } + } +} diff --git a/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/default/keymap.c b/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/default/keymap.c new file mode 100644 index 0000000000..8f421c22f5 --- /dev/null +++ b/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/default/keymap.c @@ -0,0 +1,187 @@ +/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 <string.h> +#include <math.h> + +#include <lib/lib8tion/lib8tion.h> + +#include QMK_KEYBOARD_H + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +enum layer_names { + _BASE = 0, + _FN = 1 +}; + +enum user_rgb_mode { + RGB_MODE_ALL, + RGB_MODE_KEYLIGHT, + RGB_MODE_UNDERGLOW, + RGB_MODE_NONE, +}; + +typedef union { + uint32_t raw; + struct { + uint8_t rgb_mode :8; + }; +} user_config_t; + +user_config_t user_config; + +// enum layer_keycodes { }; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Bakspc│ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + │ Tab │ q │ w │ e │ r │ t │ y │ u │ i │ o │ p │ [ │ ] │ \ │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + │ Caps │ a │ s │ d │ f │ g │ h │ j │ k │ l │ ; │ ' │ Enter │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴┬───┬───┤ + │ LShift │ z │ x │ c │ v │ b │ n │ m │ , │ . │ RSft │ ↑ │ / │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬───┼───┼───┤ + │LCrl│GUI │LAlt│ Space │RAt│Fn │ ← │ ↓ │ → │ + └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + │ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ } │ | │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ " │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴┬───┬───┤ + │ LShift │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ RSft │ │ ? │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬───┼───┼───┤ + │ │ │ │ │ │ │ │ │ │ + └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 */ + [_BASE] = LAYOUT_60_ansi_arrow( + 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, RSFT_T(KC_SLSH), KC_UP, KC_SLSH, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_LEFT, KC_DOWN, KC_RIGHT + ), + +/* + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + │ ` │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│ Delete│ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + │Reset│ │ │ │ │ │ │ │Ins│ │PSc│ │Hui│ Mod │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + │ │ │ │ │ │ │ │ │ │Tog│ │ │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴┬───┬───┤ + │ │ │ │Cal│ │ │ │Mut│VoD│VoU│ │Vai│ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬───┼───┼───┤ + │ │ │ │ │ │ │Spd│Vad│Spi│ + └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 */ + [_FN] = LAYOUT_60_ansi_arrow( + 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, + RESET, _______, _______, _______, _______, _______, _______, _______, KC_INS, _______, KC_PSCR, _______, RGB_HUI, RGB_MOD, + _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, + _______, _______, _______, KC_CALC, _______, _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_VAI, _______, + _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_VAD, RGB_SPI + ), +}; + +void keyboard_post_init_user(void) { + user_config.raw = eeconfig_read_user(); + switch (user_config.rgb_mode) { + case RGB_MODE_ALL: + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + break; + case RGB_MODE_KEYLIGHT: + rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR); + rgb_matrix_set_color_all(0, 0, 0); + break; + case RGB_MODE_UNDERGLOW: + rgb_matrix_set_flags(LED_FLAG_UNDERGLOW); + rgb_matrix_set_color_all(0, 0, 0); + break; + case RGB_MODE_NONE: + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + break; + } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR); + rgb_matrix_set_color_all(0, 0, 0); + user_config.rgb_mode = RGB_MODE_KEYLIGHT; + } + break; + case (LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR): { + rgb_matrix_set_flags(LED_FLAG_UNDERGLOW); + rgb_matrix_set_color_all(0, 0, 0); + user_config.rgb_mode = RGB_MODE_UNDERGLOW; + } + break; + case (LED_FLAG_UNDERGLOW): { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + user_config.rgb_mode = RGB_MODE_NONE; + } + break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + user_config.rgb_mode = RGB_MODE_ALL; + } + break; + } + eeconfig_update_user(user_config.raw); + } + return false; + } + + return true; +} + +void rgb_matrix_indicators_user(void) { + HSV hsv = rgb_matrix_config.hsv; + uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1)); + hsv.h = time; + RGB rgb = hsv_to_rgb(hsv); + + if ((rgb_matrix_get_flags() & LED_FLAG_KEYLIGHT)) { + if (host_keyboard_led_state().caps_lock) { + rgb_matrix_set_color(28, rgb.r, rgb.g, rgb.b); + } + } else { + if (host_keyboard_led_state().caps_lock) { + rgb_matrix_set_color(28, rgb.r, rgb.g, rgb.b); + } else { + rgb_matrix_set_color(28, 0, 0, 0); + } + } +} diff --git a/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/default/readme.md b/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/default/readme.md new file mode 100644 index 0000000000..01ff3523b9 --- /dev/null +++ b/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/default/readme.md @@ -0,0 +1,3 @@ +# Default Layout + +Keymap is default 63 qwerty, 60% arrow layout diff --git a/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/via/config.h b/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/via/config.h new file mode 100644 index 0000000000..fe6aa8c1f7 --- /dev/null +++ b/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/via/config.h @@ -0,0 +1,23 @@ +/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 DYNAMIC_KEYMAP_LAYER_COUNT 2 + +#ifdef RGB_MATRIX_ENABLE + #define VIA_QMK_RGBLIGHT_ENABLE +#endif diff --git a/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/via/keymap.c b/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/via/keymap.c new file mode 100644 index 0000000000..8f421c22f5 --- /dev/null +++ b/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/via/keymap.c @@ -0,0 +1,187 @@ +/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 <string.h> +#include <math.h> + +#include <lib/lib8tion/lib8tion.h> + +#include QMK_KEYBOARD_H + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +enum layer_names { + _BASE = 0, + _FN = 1 +}; + +enum user_rgb_mode { + RGB_MODE_ALL, + RGB_MODE_KEYLIGHT, + RGB_MODE_UNDERGLOW, + RGB_MODE_NONE, +}; + +typedef union { + uint32_t raw; + struct { + uint8_t rgb_mode :8; + }; +} user_config_t; + +user_config_t user_config; + +// enum layer_keycodes { }; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Bakspc│ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + │ Tab │ q │ w │ e │ r │ t │ y │ u │ i │ o │ p │ [ │ ] │ \ │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + │ Caps │ a │ s │ d │ f │ g │ h │ j │ k │ l │ ; │ ' │ Enter │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴┬───┬───┤ + │ LShift │ z │ x │ c │ v │ b │ n │ m │ , │ . │ RSft │ ↑ │ / │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬───┼───┼───┤ + │LCrl│GUI │LAlt│ Space │RAt│Fn │ ← │ ↓ │ → │ + └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + │ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ } │ | │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ " │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴┬───┬───┤ + │ LShift │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ RSft │ │ ? │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬───┼───┼───┤ + │ │ │ │ │ │ │ │ │ │ + └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 */ + [_BASE] = LAYOUT_60_ansi_arrow( + 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, RSFT_T(KC_SLSH), KC_UP, KC_SLSH, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_LEFT, KC_DOWN, KC_RIGHT + ), + +/* + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + │ ` │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│ Delete│ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + │Reset│ │ │ │ │ │ │ │Ins│ │PSc│ │Hui│ Mod │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + │ │ │ │ │ │ │ │ │ │Tog│ │ │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴┬───┬───┤ + │ │ │ │Cal│ │ │ │Mut│VoD│VoU│ │Vai│ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬───┼───┼───┤ + │ │ │ │ │ │ │Spd│Vad│Spi│ + └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 */ + [_FN] = LAYOUT_60_ansi_arrow( + 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, + RESET, _______, _______, _______, _______, _______, _______, _______, KC_INS, _______, KC_PSCR, _______, RGB_HUI, RGB_MOD, + _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, + _______, _______, _______, KC_CALC, _______, _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_VAI, _______, + _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_VAD, RGB_SPI + ), +}; + +void keyboard_post_init_user(void) { + user_config.raw = eeconfig_read_user(); + switch (user_config.rgb_mode) { + case RGB_MODE_ALL: + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + break; + case RGB_MODE_KEYLIGHT: + rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR); + rgb_matrix_set_color_all(0, 0, 0); + break; + case RGB_MODE_UNDERGLOW: + rgb_matrix_set_flags(LED_FLAG_UNDERGLOW); + rgb_matrix_set_color_all(0, 0, 0); + break; + case RGB_MODE_NONE: + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + break; + } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR); + rgb_matrix_set_color_all(0, 0, 0); + user_config.rgb_mode = RGB_MODE_KEYLIGHT; + } + break; + case (LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR): { + rgb_matrix_set_flags(LED_FLAG_UNDERGLOW); + rgb_matrix_set_color_all(0, 0, 0); + user_config.rgb_mode = RGB_MODE_UNDERGLOW; + } + break; + case (LED_FLAG_UNDERGLOW): { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + user_config.rgb_mode = RGB_MODE_NONE; + } + break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + user_config.rgb_mode = RGB_MODE_ALL; + } + break; + } + eeconfig_update_user(user_config.raw); + } + return false; + } + + return true; +} + +void rgb_matrix_indicators_user(void) { + HSV hsv = rgb_matrix_config.hsv; + uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1)); + hsv.h = time; + RGB rgb = hsv_to_rgb(hsv); + + if ((rgb_matrix_get_flags() & LED_FLAG_KEYLIGHT)) { + if (host_keyboard_led_state().caps_lock) { + rgb_matrix_set_color(28, rgb.r, rgb.g, rgb.b); + } + } else { + if (host_keyboard_led_state().caps_lock) { + rgb_matrix_set_color(28, rgb.r, rgb.g, rgb.b); + } else { + rgb_matrix_set_color(28, 0, 0, 0); + } + } +} diff --git a/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/via/readme.md b/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/via/readme.md new file mode 100644 index 0000000000..c60a188047 --- /dev/null +++ b/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/via/readme.md @@ -0,0 +1,3 @@ +# Default Layout with VIA + +Keymap is default 63 qwerty, 60% arrow layout diff --git a/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/via/rules.mk b/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/horrortroll/chinese_pcb/m63_rgb/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/horrortroll/chinese_pcb/m63_rgb/m63_rgb.c b/keyboards/horrortroll/chinese_pcb/m63_rgb/m63_rgb.c new file mode 100644 index 0000000000..ef1eabddf8 --- /dev/null +++ b/keyboards/horrortroll/chinese_pcb/m63_rgb/m63_rgb.c @@ -0,0 +1,49 @@ +/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 "m63_rgb.h" + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }, + { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 }, + { 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, NO_LED, 40 }, + { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, NO_LED, 52, 53 }, + { 54, 55, 56, NO_LED, NO_LED, 57, NO_LED, NO_LED, NO_LED, 58, 59, 60, 61, 62 } +}, { + // Key matrix (0 -> 62) + {0 , 0}, {16 , 0}, {33 , 0}, {49 , 0}, {66 , 0}, {82 , 0}, {99 , 0}, {115, 0}, {132, 0}, {148, 0}, {165, 0}, {181, 0}, {198, 0}, {214, 0}, + {3 , 16}, {23 , 16}, {39 , 16}, {56 , 16}, {72 , 16}, {88 , 16}, {105, 16}, {121, 16}, {138, 16}, {154, 16}, {171, 16}, {187, 16}, {204, 16}, {220, 16}, + {5 , 32}, {26 , 32}, {42 , 32}, {59 , 32}, {75 , 32}, {92 , 32}, {108, 32}, {124, 32}, {141, 32}, {157, 32}, {174, 32}, {190, 32}, {214, 32}, + {8 , 48}, {28 , 48}, {48 , 48}, {65 , 48}, {81 , 48}, {98 , 48}, {114, 48}, {131, 48}, {147, 48}, {164, 48}, {186, 48}, {208, 48}, {224, 48}, + {2 , 64}, {20 , 64}, {38 , 64}, {100, 64}, {160, 64}, {176, 64}, {192, 64}, {208, 64}, {224, 64}, + + // Underglow (63 -> 74) + {216, 56}, {181, 57}, {138, 59}, {105, 58}, {52 , 60}, {10 , 60}, + {20 , 12}, {54 , 12}, {102, 10}, {145, 13}, {182, 9}, {211, 10}, +}, { + // Key matrix (0 -> 62) + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, + 1, 1, 1, 4, 1, 1, 4, 4, 4, + + // Underglow (63 -> 74) + 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2 +} }; +#endif diff --git a/keyboards/horrortroll/chinese_pcb/m63_rgb/m63_rgb.h b/keyboards/horrortroll/chinese_pcb/m63_rgb/m63_rgb.h new file mode 100644 index 0000000000..b2461758e2 --- /dev/null +++ b/keyboards/horrortroll/chinese_pcb/m63_rgb/m63_rgb.h @@ -0,0 +1,48 @@ +/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 "quantum.h" + +#define XXX KC_NO + +/* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │00 │01 │02 │03 │04 │05 │06 │07 │08 │09 │0A │0B │0C │0D │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │10 │11 │12 │13 │14 │15 │16 │17 │18 │19 │1A │1B │1C │1D │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │20 │21 │22 │23 │24 │25 │26 │27 │28 │29 │2A │2B │2D │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴┬───┬───┤ + * │30 │31 │32 │33 │34 │35 │36 │37 │38 │39 │3A │3C │3D │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬───┼───┼───┤ + * │40 │41 │42 │45 │49 │4A │4B │4C │4D │ + * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┘ + */ + +#define LAYOUT_60_ansi_arrow( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3C, K3D, \ + K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, XXX, K2D }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, XXX, K3C, K3D }, \ + { K40, K41, K42, XXX, XXX, K45, XXX, XXX, XXX, K49, K4A, K4B, K4C, K4D } \ +} diff --git a/keyboards/horrortroll/chinese_pcb/m63_rgb/readme.md b/keyboards/horrortroll/chinese_pcb/m63_rgb/readme.md new file mode 100644 index 0000000000..7ec01047b1 --- /dev/null +++ b/keyboards/horrortroll/chinese_pcb/m63_rgb/readme.md @@ -0,0 +1,24 @@ +# M63 RGB + +Support STM32F072CBU6 keyboard. + +* Keyboard Maintainer: [HorrorTroll](https://github.com/HorrorTroll) +* Hardware Supported: STM32F072CBU6 + +Make example for this keyboard (after setting up your build environment): + + make horrortroll/chinese_pcb/m63_rgb:default + +Flashing example for this keyboard: + + make horrortroll/chinese_pcb/m63_rgb: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 (3,5) in the matrix (B key) and plug in the keyboard +* **Physical reset button**: Press and hold the button on the back of the PCB, then plug in the keyboard +* **Keycode in layout**: Press the key mapped to `RESET` if it is available diff --git a/keyboards/horrortroll/chinese_pcb/m63_rgb/rules.mk b/keyboards/horrortroll/chinese_pcb/m63_rgb/rules.mk new file mode 100644 index 0000000000..9291499b77 --- /dev/null +++ b/keyboards/horrortroll/chinese_pcb/m63_rgb/rules.mk @@ -0,0 +1,22 @@ +# MCU name +MCU = STM32F072 + +# Bootloader selection +BOOTLOADER = stm32-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +# RGB Matrix enabled +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 diff --git a/keyboards/horrortroll/chinese_pcb/readme.md b/keyboards/horrortroll/chinese_pcb/readme.md index 4667678753..3aa0ce6195 100644 --- a/keyboards/horrortroll/chinese_pcb/readme.md +++ b/keyboards/horrortroll/chinese_pcb/readme.md @@ -2,12 +2,13 @@ This is a folder for collection code of Chinese PCB, where they only sold one-time limited on Taobao and no source code or contact info of Maker. Everything was re-write by using multimeter and sometimes with ISP/ICP flashing! -## List for the reason why these keyboard in here: +## List for those keyboard in here: <details> <summary>Click to expand!</summary> - | Keyboard name | MCU | Layout | LED | OLED | Other | Reason | - | ------------- | ----------- | ------------- | ---- | ---- | ----- | ---------------------------------------------------- | - | Devil68 Pro | Atmega32U4 | 68 Keys (65%) | RGB | No | No | Lost contact info of Maker on Taobao, no source code | - | | | | | | | | + | Keyboard name | MCU | Layout | Hotswap | LED | OLED | Other | + | ------------- | ------------- | ------------- | ------- | ---- | ---- | ----- | + | Devil68 Pro | Atmega32U4 | 68 Keys (65%) | Yes | RGB | No | No | + | M63 RGB | STM32F072CBU6 | 63 Keys (60%) | Yes | RGB | No | No | + | | | | | | | | </details> |