From 6149514e36a43be938042ba136830a32abbe9c28 Mon Sep 17 00:00:00 2001 From: peepeetee Date: Tue, 6 Apr 2021 21:37:20 -0500 Subject: [PATCH 1/4] add rgb matrix; disable rgb light --- keyboards/hub20/config.h | 73 +++++++++++++++++++++++++++------------- keyboards/hub20/hub20.c | 29 ++++++++++++++++ keyboards/hub20/rules.mk | 8 +++-- 3 files changed, 84 insertions(+), 26 deletions(-) diff --git a/keyboards/hub20/config.h b/keyboards/hub20/config.h index 8ebe1f9e2bdc..6d268affa39a 100644 --- a/keyboards/hub20/config.h +++ b/keyboards/hub20/config.h @@ -41,29 +41,56 @@ along with this program. If not, see . #define RGB_DI_PIN B15 #define RGBLED_NUM 27 -#define RGBLIGHT_HUE_STEP 8 -#define RGBLIGHT_SAT_STEP 8 -#define RGBLIGHT_VAL_STEP 8 -#define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ -#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ -// /*== all animations enable ==*/ -#define RGBLIGHT_ANIMATIONS -// /*== or choose animations ==*/ -// #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 -// /*== customize breathing effect ==*/ -// /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ -// #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 -// /*==== use exp() and sin() ====*/ -// #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 -// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 + +#define DRIVER_LED_TOTAL 27 +#ifdef RGB_DI_PIN + #define RGBLED_NUM 27 +#endif + +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_KEYPRESSES + +// This list in in the correct mode order. Next mode is the following line, previous mode is previous line. Loops around. +// #define DISABLE_RGB_MATRIX_SOLID_COLOR // Static single hue, no speed support +#define DISABLE_RGB_MATRIX_ALPHAS_MODS // Static dual hue, speed is hue for secondary hue +//#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN // Static gradient top to bottom, speed controls how much gradient changes +//#define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT // Static gradient top to bottom, speed controls how much gradient changes +//#define DISABLE_RGB_MATRIX_BREATHING // Single hue brightness cycling animation +#define DISABLE_RGB_MATRIX_BAND_SAT // Single hue band fading saturation scrolling left to right +#define DISABLE_RGB_MATRIX_BAND_VAL // Single hue band fading brightness scrolling left to right +#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT // Single hue 3 blade spinning pinwheel fades saturation +#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL // Single hue 3 blade spinning pinwheel fades brightness +#define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT // Single hue spinning spiral fades saturation +#define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL // Single hue spinning spiral fades brightness +#define DISABLE_RGB_MATRIX_CYCLE_ALL // Full keyboard solid hue cycling through full gradient +//#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT // Full gradient scrolling left to right +//#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN // Full gradient scrolling top to bottom +#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Full gradent Chevron shapped scrolling left to right +#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN // Full gradient scrolling out to in +#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL // Full dual gradients scrolling out to in +#define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL // Full gradient spinning pinwheel around center of keyboard +#define DISABLE_RGB_MATRIX_CYCLE_SPIRAL // Full gradient spinning spiral around center of keyboard +#define DISABLE_RGB_MATRIX_DUAL_BEACON // Full gradient spinning around center of keyboard +#define DISABLE_RGB_MATRIX_RAINBOW_BEACON // Full tighter gradient spinning around center of keyboard +#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS // Full dual gradients spinning two halfs of keyboard +//#define DISABLE_RGB_MATRIX_RAINDROPS // Randomly changes a single key's hue +//#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS // Randomly changes a single key's hue and saturation +// =================================================== Requires RGB_MATRIX_FRAMEBUFFER_EFFECTS ============================================================= +// #define DISABLE_RGB_MATRIX_TYPING_HEATMAP // How hot is your WPM! +//#define DISABLE_RGB_MATRIX_DIGITAL_RAIN // That famous computer simulation +// =================================================== RGB_MATRIX_KEYPRESSES OR RGB_MATRIX_KEYRELEASES ===================================================== +//#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE // Pulses keys hit to hue & value then fades value out +//#define DISABLE_RGB_MATRIX_SOLID_REACTIVE // Static single hue, pulses keys hit to shifted hue then fades to current hue +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE // Hue & value pulse near a single key hit then fades value out +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE // Hue & value pulse near multiple key hits then fades value out +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS // Hue & value pulse the same column and row of a single key hit then fades value out +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS // Hue & value pulse the same column and row of multiple key hits then fades value out +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS // Hue & value pulse away on the same column and row of a single key hit then fades value out +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS // Hue & value pulse away on the same column and row of multiple key hits then fades value out +#define DISABLE_RGB_MATRIX_SPLASH // Full gradient & value pulse away from a single key hit then fades value out +#define DISABLE_RGB_MATRIX_MULTISPLASH // Full gradient & value pulse away from multiple key hits then fades value out +#define DISABLE_RGB_MATRIX_SOLID_SPLASH // Hue & value pulse away from a single key hit then fades value out +#define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH // Hue & value pulse away from multiple key hits then fades value out /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 diff --git a/keyboards/hub20/hub20.c b/keyboards/hub20/hub20.c index 306ab788d9ca..ba2f7b74f23b 100644 --- a/keyboards/hub20/hub20.c +++ b/keyboards/hub20/hub20.c @@ -16,3 +16,32 @@ #include "hub20.h" +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { { + // Key Matrix to LED Index + {NO_LED,NO_LED,NO_LED,NO_LED}, + { 7, 8, 9, 10}, + { 11, 12, 13, 14}, + {15, 16, 17, 18}, + { 19, 20, 21, 22}, + { 23, 24, 25, 26} +}, { + // LED Index to Physical Position + { 190, 50}, { 111, 50}, { 35, 50}, {38, 0}, {38, 35}, {186, 35}, {186, 0}, // UNDERGLOW + { 0, 0}, {75, 0}, {150, 0}, {225, 0}, // row 4 + { 0, 16}, {75, 16}, {150, 16}, {225, 16}, // row 3 + { 0, 32}, {75, 32}, {150, 32}, {225, 32}, // row 2 + { 0, 48}, {75, 48}, {150, 48}, {225, 48}, // row 1 + { 0, 64}, {75, 64}, {150, 64}, {225, 64} // row 0 + +}, { + // LED Index to Flag + 2, 2, 2, 2, 2, 2, 2, // UNDERGLOW + 4, 4, 4, 4, // row 4 + 4, 4, 4, 4, // row 3 + 4, 4, 4, 4, // row 2 + 4, 4, 4, 4, // row 1 + 4, 4, 4, 4 // row 0 + +} }; +#endif diff --git a/keyboards/hub20/rules.mk b/keyboards/hub20/rules.mk index 9abb4f80a790..26ba5d3f42a1 100644 --- a/keyboards/hub20/rules.mk +++ b/keyboards/hub20/rules.mk @@ -7,16 +7,18 @@ MCU = STM32F072 BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug -COMMAND_ENABLE = yes # Commands for debug and configuration +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow BLUETOOTH_ENABLE = no # Enable Bluetooth AUDIO_ENABLE = no # Audio output +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 ENCODER_ENABLE = yes # Enter lower-power sleep mode when on the ChibiOS idle thread From 62f1edcf55e75108abc84282c74df73f2d39998c Mon Sep 17 00:00:00 2001 From: peepeetee <43021794+peepeetee@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:48:01 -0500 Subject: [PATCH 2/4] update header --- keyboards/hub20/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/hub20/config.h b/keyboards/hub20/config.h index 6d268affa39a..c887be097d4d 100644 --- a/keyboards/hub20/config.h +++ b/keyboards/hub20/config.h @@ -1,5 +1,5 @@ /* -Copyright 2020 joshajohnson +Copyright 2020 joshajohnson 2021 peepeetee 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 From fe371ce1a5464c20ba8bf77ae9a44c7b0812996e Mon Sep 17 00:00:00 2001 From: peepeetee <43021794+peepeetee@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:48:41 -0500 Subject: [PATCH 3/4] Update hub20.c --- keyboards/hub20/hub20.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/hub20/hub20.c b/keyboards/hub20/hub20.c index ba2f7b74f23b..ee11edfb170b 100644 --- a/keyboards/hub20/hub20.c +++ b/keyboards/hub20/hub20.c @@ -1,4 +1,4 @@ -/* Copyright 2020 joshajohnson +/* Copyright 2020 joshajohnson 2021 peepeetee * * 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 From c98051fe6a19cc8a5289682d8c34e2816a53bdf7 Mon Sep 17 00:00:00 2001 From: peepeetee Date: Wed, 7 Apr 2021 20:03:46 -0500 Subject: [PATCH 4/4] add todo items --- keyboards/hub20/hub20.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keyboards/hub20/hub20.c b/keyboards/hub20/hub20.c index ba2f7b74f23b..a58c89de8f0b 100644 --- a/keyboards/hub20/hub20.c +++ b/keyboards/hub20/hub20.c @@ -25,9 +25,11 @@ led_config_t g_led_config = { { {15, 16, 17, 18}, { 19, 20, 21, 22}, { 23, 24, 25, 26} + //todo: assign leds to keys differently for the different layouts }, { // LED Index to Physical Position { 190, 50}, { 111, 50}, { 35, 50}, {38, 0}, {38, 35}, {186, 35}, {186, 0}, // UNDERGLOW + //todo: underglow location needs to be recalculated. The top row is above row 4, and for now they have the same y value 0 { 0, 0}, {75, 0}, {150, 0}, {225, 0}, // row 4 { 0, 16}, {75, 16}, {150, 16}, {225, 16}, // row 3 { 0, 32}, {75, 32}, {150, 32}, {225, 32}, // row 2