From e2aee8f9bbb0885ede2c2918244902bad9136659 Mon Sep 17 00:00:00 2001 From: moyi4681 Date: Tue, 11 Jan 2022 11:12:17 +0800 Subject: [PATCH] [Keyboard] add kbd67mkiirgb v4 support (#15024) Co-authored-by: Drashna Jaelre Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> --- keyboards/kbdfans/kbd67/mkiirgb/mkiirgb.h | 2 + keyboards/kbdfans/kbd67/mkiirgb/readme.md | 15 +++-- keyboards/kbdfans/kbd67/mkiirgb/v4/config.h | 70 ++++++++++++++++++++ keyboards/kbdfans/kbd67/mkiirgb/v4/readme.md | 18 +++++ keyboards/kbdfans/kbd67/mkiirgb/v4/rules.mk | 20 ++++++ keyboards/kbdfans/kbd67/mkiirgb/v4/v4.c | 49 ++++++++++++++ keyboards/kbdfans/kbd67/mkiirgb/v4/v4.h | 32 +++++++++ 7 files changed, 199 insertions(+), 7 deletions(-) create mode 100644 keyboards/kbdfans/kbd67/mkiirgb/v4/config.h create mode 100644 keyboards/kbdfans/kbd67/mkiirgb/v4/readme.md create mode 100644 keyboards/kbdfans/kbd67/mkiirgb/v4/rules.mk create mode 100644 keyboards/kbdfans/kbd67/mkiirgb/v4/v4.c create mode 100644 keyboards/kbdfans/kbd67/mkiirgb/v4/v4.h diff --git a/keyboards/kbdfans/kbd67/mkiirgb/mkiirgb.h b/keyboards/kbdfans/kbd67/mkiirgb/mkiirgb.h index c297a02e888..dadc230626d 100644 --- a/keyboards/kbdfans/kbd67/mkiirgb/mkiirgb.h +++ b/keyboards/kbdfans/kbd67/mkiirgb/mkiirgb.h @@ -22,5 +22,7 @@ #include "v2.h" #elif defined(KEYBOARD_kbdfans_kbd67_mkiirgb_v3) #include "v3.h" +#elif defined(KEYBOARD_kbdfans_kbd67_mkiirgb_v4) + #include "v4.h" #endif #include "quantum.h" diff --git a/keyboards/kbdfans/kbd67/mkiirgb/readme.md b/keyboards/kbdfans/kbd67/mkiirgb/readme.md index 58338df0f64..5b71c27f0ec 100644 --- a/keyboards/kbdfans/kbd67/mkiirgb/readme.md +++ b/keyboards/kbdfans/kbd67/mkiirgb/readme.md @@ -3,19 +3,20 @@ A customizable 65% RGB keyboard. * Keyboard Maintainer: [moyi4681](https://github.com/moyi4681) -* Hardware Supported: KBD67 Mk.II RGB V1, V2, and V3 +* Hardware Supported: KBD67 Mk.II RGB V1, V2, V3 and V4 * Hardware Availability: [kbdfans](https://kbdfans.myshopify.com/) -There are three versions of the KBD67 MKII RGB. Please use the appropriate firmware for your board. +There are four versions of the KBD67 MKII RGB. Please use the appropriate firmware for your board. * V1: STM32F303 (Arm), takes `.bin` files * V2: ATmega32U4 (AVR), takes `.hex` files -* V3: Atmega32U4 (AVR), takes `.bin` files +* V3 and V4: Atmega32U4 (AVR), takes `.bin` files Make example for this keyboard (after setting up your build environment): - make kbdfans/kbd67/mkiirgb/v1:default # Arm (STM32F303) - make kbdfans/kbd67/mkiirgb/v2:default # AVR (ATmega32U4) - make kbdfans/kbd67/mkiirgb/v3:default # AVR (ATmega32U4) - + make kbdfans/kbd67/mkiirgb/v1:default # Arm (STM32F303+IS31FL3731) + make kbdfans/kbd67/mkiirgb/v2:default # AVR (ATmega32U4+IS31FL3731) + make kbdfans/kbd67/mkiirgb/v3:default # AVR (ATmega32U4+IS31FL3741) + make kbdfans/kbd67/mkiirgb/v4:default # AVR (ATmega32U4+SK6812MINI) + 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). diff --git a/keyboards/kbdfans/kbd67/mkiirgb/v4/config.h b/keyboards/kbdfans/kbd67/mkiirgb/v4/config.h new file mode 100644 index 00000000000..3d633bed2ad --- /dev/null +++ b/keyboards/kbdfans/kbd67/mkiirgb/v4/config.h @@ -0,0 +1,70 @@ +/* Copyright 2021 DZTECH + * + * 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 "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x4B42 +#define PRODUCT_ID 0x1227 +#define DEVICE_VER 0x0004 +#define MANUFACTURER KBDFANS +#define PRODUCT KBD67 MKII RGB V4 + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 +#define MATRIX_ROW_PINS { B1, F1, B2, B3, C6 } +#define MATRIX_COL_PINS { F7, F6, F5, F4, B0, B7, D0, D1, D2, D3, D5, D4, D6, D7, B4} +#define UNUSED_PINS + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION +#define USB_SUSPEND_WAKEUP_DELAY 5000 + +#define RGB_DI_PIN C7 +#define RGBLED_NUM 68 +#define DRIVER_LED_TOTAL RGBLED_NUM +#define RGBLIGHT_EFFECT_BREATHING +#define RGBLIGHT_EFFECT_RAINBOW_MOOD +#define RGBLIGHT_EFFECT_RAINBOW_SWIRL +#define RGBLIGHT_EFFECT_SNAKE +#define RGBLIGHT_EFFECT_KNIGHT +#define RGBLIGHT_EFFECT_CHRISTMAS +#define RGBLIGHT_EFFECT_STATIC_GRADIENT +#define RGBLIGHT_EFFECT_RGB_TEST +#define RGBLIGHT_EFFECT_ALTERNATING +#define RGBLIGHT_EFFECT_TWINKLE + +#ifdef RGB_MATRIX_ENABLE +#define RGB_MATRIX_KEYPRESSES // reacts to keypresses +#define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash. +#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_ALL +#define RGB_MATRIX_HUE_STEP 8 +#define RGB_MATRIX_SAT_STEP 8 +#define RGB_MATRIX_VAL_STEP 8 +#define RGB_MATRIX_SPD_STEP 10 +#endif + +#define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 2 diff --git a/keyboards/kbdfans/kbd67/mkiirgb/v4/readme.md b/keyboards/kbdfans/kbd67/mkiirgb/v4/readme.md new file mode 100644 index 00000000000..b603992f699 --- /dev/null +++ b/keyboards/kbdfans/kbd67/mkiirgb/v4/readme.md @@ -0,0 +1,18 @@ +# KBD67MKIIRGBV4 + +A customizable 80% keyboard. + +* Keyboard Maintainer: [moyi4681](https://github.com/moyi4681) +* Hardware Supported: KBDFANS +* Hardware Availability: [kbdfans](https://kbdfans.myshopify.com/) + +Make example for this keyboard (after setting up your build environment): + + make kbdfans/kbd67/mkiirgb/v4:default + +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 esc in the keyboard then replug +* **Physical reset button**: Briefly press the button on the back of the PCB +* **Keycode in layout**: Press the key mapped to `RESET` \ No newline at end of file diff --git a/keyboards/kbdfans/kbd67/mkiirgb/v4/rules.mk b/keyboards/kbdfans/kbd67/mkiirgb/v4/rules.mk new file mode 100644 index 00000000000..bf2c1d1a6e0 --- /dev/null +++ b/keyboards/kbdfans/kbd67/mkiirgb/v4/rules.mk @@ -0,0 +1,20 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = lufa-ms + +# 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_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 diff --git a/keyboards/kbdfans/kbd67/mkiirgb/v4/v4.c b/keyboards/kbdfans/kbd67/mkiirgb/v4/v4.c new file mode 100644 index 00000000000..3c4b81132f8 --- /dev/null +++ b/keyboards/kbdfans/kbd67/mkiirgb/v4/v4.c @@ -0,0 +1,49 @@ +/* Copyright 2021 DZTECH + * + * 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 "v4.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 }, + { 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15 }, + { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,NO_LED, 43 }, + { 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, NO_LED,45, 44 }, + { 58, 59, 60, NO_LED, NO_LED, 61, NO_LED, NO_LED, NO_LED, 62, 63, 64, NO_LED,65, 66 } +}, { + {0,0},{15,0},{30,0},{45,0},{60,0},{75,0},{90,0},{105,0},{120,0},{135,0},{150,0},{165,0},{180,0},{203,0},{224,0}, + {224,16},{206,16},{188,16},{173,16},{158,16},{143,16},{128,16},{113,16},{98,16},{83,16}, {68,16},{53,16},{38,16},{23,16},{4,16}, + {6,32},{26,32},{41,32},{56,32},{71,32},{86,32},{101,32},{116,32},{131,32},{146,32},{161,32},{176,32},{201,32},{224,32}, + {224,48},{210,48},{189,48},{169,48},{154,48},{139,48},{124,48},{109,48},{94,48},{79,48},{64,48},{49,48},{34,48},{9,48}, + {2,64},{21,64},{39,64},{96,64},{152,64},{171,64},{195,64},{210,64},{224,64} +}, { + 1, 4, 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, 1, + 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, 1, + 1, 1, 1, 4, 1, 1, 1, 1, 1 +} }; + +__attribute__ ((weak)) +void rgb_matrix_indicators_user(void) { + if (host_keyboard_led_state().caps_lock) { + rgb_matrix_set_color(30, 0xFF, 0xFF, 0xFF); + } +} + +#endif diff --git a/keyboards/kbdfans/kbd67/mkiirgb/v4/v4.h b/keyboards/kbdfans/kbd67/mkiirgb/v4/v4.h new file mode 100644 index 00000000000..da507403d3d --- /dev/null +++ b/keyboards/kbdfans/kbd67/mkiirgb/v4/v4.h @@ -0,0 +1,32 @@ +/* Copyright 2021 DZTECH + * + * 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 XXX KC_NO +#include "quantum.h" +#define LAYOUT_65_ansi_blocker( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, k2C, K2E, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \ + K40, K41, K42, K45, K49, K4A, K4B, K4D, K4E \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, k2C, XXX, K2E }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, XXX, K3D, K3E }, \ + { K40, K41, K42, XXX, XXX, K45, XXX, XXX, XXX, K49, K4A, K4B, XXX, K4D, K4E } \ +}