From a1676c3b8c3f5f5d713196d99ac358ba5fb021ef Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Tue, 10 Jan 2023 16:35:33 -0800 Subject: [Keyboard] Work Louder updates for via v3 (#19555) --- keyboards/work_louder/loop/config.h | 37 +++--- keyboards/work_louder/loop/info.json | 18 +-- keyboards/work_louder/micro/config.h | 28 +++-- keyboards/work_louder/micro/info.json | 6 +- keyboards/work_louder/micro/keymaps/via/config.h | 5 - keyboards/work_louder/micro/keymaps/via/keymap.c | 97 ++++++++++++--- keyboards/work_louder/nano/config.h | 38 +++--- keyboards/work_louder/numpad/config.h | 50 +++++++- keyboards/work_louder/numpad/info.json | 2 +- keyboards/work_louder/work_board/config.h | 5 +- .../work_louder/work_board/keymaps/via/keymap.c | 138 +++++++++++++++++---- 11 files changed, 308 insertions(+), 116 deletions(-) delete mode 100644 keyboards/work_louder/micro/keymaps/via/config.h diff --git a/keyboards/work_louder/loop/config.h b/keyboards/work_louder/loop/config.h index 9ad0e83a2c..3c72561094 100644 --- a/keyboards/work_louder/loop/config.h +++ b/keyboards/work_louder/loop/config.h @@ -41,15 +41,7 @@ along with this program. If not, see . #define DIODE_DIRECTION COL2ROW -//#define LED_NUM_LOCK_PIN B0 -//#define LED_CAPS_LOCK_PIN B1 -//#define LED_SCROLL_LOCK_PIN B2 -//#define LED_COMPOSE_PIN B3 -//#define LED_KANA_PIN B4 - -//#define BACKLIGHT_PIN B7 -//#define BACKLIGHT_LEVELS 3 -//#define BACKLIGHT_BREATHING +#define USB_MAX_POWER_CONSUMPTION 100 #define RGBLIGHT_DI_PIN E6 //# define RGBLIGHT_HUE_STEP 8 @@ -65,7 +57,6 @@ along with this program. If not, see . #define RGBLIGHT_EFFECT_KNIGHT #define RGBLIGHT_EFFECT_CHRISTMAS #define RGBLIGHT_EFFECT_STATIC_GRADIENT -#define RGBLIGHT_EFFECT_RGB_TEST #define RGBLIGHT_EFFECT_TWINKLE #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT @@ -84,6 +75,8 @@ along with this program. If not, see . #define RGB_MATRIX_DISABLE_KEYCODES #define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT // Sets the default mode, if none has been set #define RGB_DISABLE_WHEN_USB_SUSPENDED +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +// #define RGB_MATRIX_KEYPRESSES // RGB Matrix Animation modes. Explicitly enabled // For full list of effects, see: @@ -121,18 +114,18 @@ along with this program. If not, see . #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 +// #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 /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 diff --git a/keyboards/work_louder/loop/info.json b/keyboards/work_louder/loop/info.json index 67b9d1f06d..86de1624f1 100644 --- a/keyboards/work_louder/loop/info.json +++ b/keyboards/work_louder/loop/info.json @@ -14,15 +14,15 @@ {"label": "k01", "x": 1, "y": 0}, {"label": "k02", "x": 2, "y": 0}, - {"label": "k03", "x": 3, "y": 1, "w": 0}, - {"label": "k04", "x": 4, "y": 1, "w": 0}, - {"label": "k05", "x": 5, "y": 1, "w": 0}, - {"label": "k06", "x": 6, "y": 1, "w": 0}, - {"label": "k07", "x": 7, "y": 1, "w": 0}, - {"label": "k08", "x": 8, "y": 1, "w": 0}, - {"label": "k09", "x": 9, "y": 1, "w": 0}, - {"label": "k0a", "x": 10, "y": 1, "w": 0}, - {"label": "k0b", "x": 11, "y": 1, "w": 0} + {"label": "k03", "x": 3, "y": 0}, + {"label": "k04", "x": 4, "y": 0}, + {"label": "k05", "x": 5, "y": 0}, + {"label": "k06", "x": 6, "y": 0}, + {"label": "k07", "x": 7, "y": 0}, + {"label": "k08", "x": 8, "y": 0}, + {"label": "k09", "x": 9, "y": 0}, + {"label": "k0a", "x": 10, "y": 0}, + {"label": "k0b", "x": 11, "y": 0} ] } } diff --git a/keyboards/work_louder/micro/config.h b/keyboards/work_louder/micro/config.h index 2c37e9b4ec..cb11d27955 100644 --- a/keyboards/work_louder/micro/config.h +++ b/keyboards/work_louder/micro/config.h @@ -9,13 +9,15 @@ * Feature disable options * These options are also useful to firmware size reduction. */ +#define USB_MAX_POWER_CONSUMPTION 100 #define RGB_DI_PIN D1 #define RGB_MATRIX_LED_COUNT 12 -#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255 +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 #define RGB_MATRIX_DISABLE_KEYCODES #define RGB_DISABLE_WHEN_USB_SUSPENDED #define RGB_MATRIX_FRAMEBUFFER_EFFECTS +// #define RGB_MATRIX_KEYPRESSES #define RGBLIGHT_DI_PIN D2 #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ @@ -55,18 +57,18 @@ #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 +// #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 /* disable debug print */ //#define NO_DEBUG diff --git a/keyboards/work_louder/micro/info.json b/keyboards/work_louder/micro/info.json index 1417ba0cde..b3bfcd6a13 100644 --- a/keyboards/work_louder/micro/info.json +++ b/keyboards/work_louder/micro/info.json @@ -22,13 +22,13 @@ "processor": "atmega32u4", "rgblight": { "animations": { - "alternating": true, + "alternating": false, "breathing": true, "christmas": true, "knight": true, "rainbow_mood": true, "rainbow_swirl": true, - "rgb_test": true, + "rgb_test": false, "snake": true, "static_gradient": true, "twinkle": true @@ -36,7 +36,7 @@ "brightness_steps": 8, "hue_steps": 8, "led_count": 8, - "max_brightness": 255, + "max_brightness": 150, "saturation_steps": 8 }, "url": "https://worklouder.cc/", diff --git a/keyboards/work_louder/micro/keymaps/via/config.h b/keyboards/work_louder/micro/keymaps/via/config.h deleted file mode 100644 index 4a39333883..0000000000 --- a/keyboards/work_louder/micro/keymaps/via/config.h +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2022 QMK -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once -#undef RGBLIGHT_EFFECT_TWINKLE diff --git a/keyboards/work_louder/micro/keymaps/via/keymap.c b/keyboards/work_louder/micro/keymaps/via/keymap.c index d4be308b2a..8cc41e1e50 100644 --- a/keyboards/work_louder/micro/keymaps/via/keymap.c +++ b/keyboards/work_louder/micro/keymaps/via/keymap.c @@ -8,25 +8,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_MPLY, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - RGB_TOG, XXXXXXX, XXXXXXX, 0x5011 + RGB_TOG, XXXXXXX, XXXXXXX, TO(1) ), [1] = LAYOUT( XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, 0x5012 + XXXXXXX, XXXXXXX, XXXXXXX, TO(2) ), [2] = LAYOUT( XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, 0x5013 + XXXXXXX, XXXXXXX, XXXXXXX, TO(3) ), [3] = LAYOUT( XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, USER00, USER01, USER03, USER05, XXXXXXX, USER02, USER04, USER06, - XXXXXXX, XXXXXXX, XXXXXXX, 0x5010 + XXXXXXX, XXXXXXX, XXXXXXX, TO(0) ) }; @@ -49,6 +49,8 @@ typedef union { work_louder_config_t work_louder_config; +#define WL_LED_MAX_BRIGHT 75 + bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case USER09: @@ -57,21 +59,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (work_louder_config.led_level > 4) { work_louder_config.led_level = 1; } - work_louder_micro_led_all_set((uint8_t)(work_louder_config.led_level * 255 / 4)); + work_louder_micro_led_all_set((uint8_t)(work_louder_config.led_level * WL_LED_MAX_BRIGHT / 4)); eeconfig_update_user(work_louder_config.raw); layer_state_set_kb(layer_state); } break; - case 0x5000 ... 0x500F: - if (record->event.pressed) { - layer_move(keycode - 0x5000); - } - return false; break; - case 0x5010 ... 0x501F: - if (record->event.pressed) { - layer_move(keycode - 0x5010); - } - return false; break; } return true; } @@ -88,14 +80,87 @@ layer_state_t layer_state_set_user(layer_state_t state) { void eeconfig_init_user(void) { work_louder_config.raw = 0; work_louder_config.led_level = 1; + work_louder_micro_led_all_set((uint8_t)(work_louder_config.led_level * WL_LED_MAX_BRIGHT / 4)); eeconfig_update_user(work_louder_config.raw); } void keyboard_post_init_user(void) { work_louder_config.raw = eeconfig_read_user(); - work_louder_micro_led_all_set((uint8_t)(work_louder_config.led_level * 255 / 4)); + work_louder_micro_led_all_set((uint8_t)(work_louder_config.led_level * WL_LED_MAX_BRIGHT / 4)); } void suspend_wakeup_init_user(void) { layer_state_set_user(layer_state); } + + +enum via_indicator_value { + id_wl_brightness = 1, + id_wl_layer, // placeholder +}; + +void wl_config_set_value(uint8_t *data) { + // data = [ value_id, value_data ] + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + + switch (*value_id) { + case id_wl_brightness: + work_louder_config.led_level = (uint8_t)*value_data; + work_louder_micro_led_all_set((uint8_t)(work_louder_config.led_level * WL_LED_MAX_BRIGHT / 4)); + layer_state_set_kb(layer_state); + break; + // case id_wl_layer: + // layer_move(*value_data); + // break; + } +} + +void wl_config_get_value(uint8_t *data) { + // data = [ value_id, value_data ] + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + + switch (*value_id) { + case id_wl_brightness: + *value_data = work_louder_config.led_level; + break; + // case id_wl_layer: + // *value_data = get_highest_layer(layer_state); + // break; + } +} + +void wl_config_save(void) { + eeconfig_update_user(work_louder_config.raw); +} + +void via_custom_value_command_kb(uint8_t *data, uint8_t length) { + uint8_t *command_id = &(data[0]); + uint8_t *channel_id = &(data[1]); + uint8_t *value_id_and_data = &(data[2]); + + if (*channel_id == id_custom_channel) { + switch (*command_id) { + case id_custom_set_value: { + wl_config_set_value(value_id_and_data); + break; + } + case id_custom_get_value: { + wl_config_get_value(value_id_and_data); + break; + } + case id_custom_save: { + wl_config_save(); + break; + } + default: { + // Unhandled message. + *command_id = id_unhandled; + break; + } + } + return; + } + *command_id = id_unhandled; +} diff --git a/keyboards/work_louder/nano/config.h b/keyboards/work_louder/nano/config.h index 8d3732e825..cd97fd740a 100644 --- a/keyboards/work_louder/nano/config.h +++ b/keyboards/work_louder/nano/config.h @@ -41,15 +41,7 @@ along with this program. If not, see . /* COL2ROW, ROW2COL */ #define DIODE_DIRECTION COL2ROW -//#define LED_NUM_LOCK_PIN B0 -//#define LED_CAPS_LOCK_PIN B1 -//#define LED_SCROLL_LOCK_PIN B2 -//#define LED_COMPOSE_PIN B3 -//#define LED_KANA_PIN B4 - -//#define BACKLIGHT_PIN B7 -//#define BACKLIGHT_LEVELS 3 -//#define BACKLIGHT_BREATHING +#define USB_MAX_POWER_CONSUMPTION 100 #define RGBLIGHT_DI_PIN C7 #define RGBLED_NUM 6 @@ -66,8 +58,8 @@ along with this program. If not, see . #define RGBLIGHT_EFFECT_KNIGHT #define RGBLIGHT_EFFECT_CHRISTMAS #define RGBLIGHT_EFFECT_STATIC_GRADIENT -#define RGBLIGHT_EFFECT_RGB_TEST #define RGBLIGHT_EFFECT_TWINKLE + #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT #define RGBLIGHT_DEFAULT_HUE 170 @@ -84,6 +76,8 @@ along with this program. If not, see . #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 #define RGB_MATRIX_DISABLE_KEYCODES #define RGB_DISABLE_WHEN_USB_SUSPENDED +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +// #define RGB_MATRIX_KEYPRESSES // RGB Matrix Animation modes. Explicitly enabled // For full list of effects, see: @@ -121,18 +115,18 @@ along with this program. If not, see . #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 +// #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 /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 diff --git a/keyboards/work_louder/numpad/config.h b/keyboards/work_louder/numpad/config.h index 762e5e654b..79ce6df6cf 100644 --- a/keyboards/work_louder/numpad/config.h +++ b/keyboards/work_louder/numpad/config.h @@ -22,11 +22,59 @@ // #define RGB_DI_PIN D1 #define RGB_MATRIX_LED_COUNT 16 -#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255 +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 #define RGB_MATRIX_DISABLE_KEYCODES #define RGB_DISABLE_WHEN_USB_SUSPENDED #define RGB_MATRIX_FRAMEBUFFER_EFFECTS + + #define RGBLIGHT_DI_PIN D2 #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9 #define RGBLIGHT_DEFAULT_HUE 213 + +#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_FLOW +#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 diff --git a/keyboards/work_louder/numpad/info.json b/keyboards/work_louder/numpad/info.json index b5117c91d3..dbae02e573 100644 --- a/keyboards/work_louder/numpad/info.json +++ b/keyboards/work_louder/numpad/info.json @@ -62,7 +62,7 @@ "brightness_steps": 8, "hue_steps": 8, "led_count": 8, - "max_brightness": 255, + "max_brightness": 120, "pin": "D1", "saturation_steps": 8, "sleep": true diff --git a/keyboards/work_louder/work_board/config.h b/keyboards/work_louder/work_board/config.h index 6dea07c518..e7d23ed7ee 100644 --- a/keyboards/work_louder/work_board/config.h +++ b/keyboards/work_louder/work_board/config.h @@ -41,6 +41,8 @@ along with this program. If not, see . /* COL2ROW, ROW2COL */ #define DIODE_DIRECTION COL2ROW +#define USB_MAX_POWER_CONSUMPTION 100 + #define RGBLIGHT_DI_PIN D2 //# define RGBLIGHT_HUE_STEP 8 //# define RGBLIGHT_SAT_STEP 8 @@ -55,7 +57,6 @@ along with this program. If not, see . #define RGBLIGHT_EFFECT_KNIGHT #define RGBLIGHT_EFFECT_CHRISTMAS #define RGBLIGHT_EFFECT_STATIC_GRADIENT -#define RGBLIGHT_EFFECT_RGB_TEST #define RGBLIGHT_EFFECT_TWINKLE #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9 @@ -73,6 +74,8 @@ along with this program. If not, see . #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 #define RGB_MATRIX_DISABLE_KEYCODES #define RGB_DISABLE_WHEN_USB_SUSPENDED +// #define RGB_MATRIX_FRAMEBUFFER_EFFECTS +// #define RGB_MATRIX_KEYPRESSES // RGB Matrix Animation modes. Explicitly enabled // For full list of effects, see: diff --git a/keyboards/work_louder/work_board/keymaps/via/keymap.c b/keyboards/work_louder/work_board/keymaps/via/keymap.c index 9ae3b36262..f0929bb9c9 100644 --- a/keyboards/work_louder/work_board/keymaps/via/keymap.c +++ b/keyboards/work_louder/work_board/keymaps/via/keymap.c @@ -16,12 +16,7 @@ #include QMK_KEYBOARD_H -enum planck_layers { - _QWERTY, - _LOWER, - _RAISE, - _ADJUST -}; +enum planck_layers { _QWERTY, _LOWER, _RAISE, _ADJUST }; enum tap_dances { ENC_TAP, @@ -59,6 +54,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_QWERTY] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_LOWER] = { ENCODER_CCW_CW(KC_PGDN, KC_PGUP) }, + [_RAISE] = { ENCODER_CCW_CW(R_M_RMOD, R_M_MOD) }, + [_ADJUST] = { ENCODER_CCW_CW(R_M_HUI, R_M_HUD) }, +}; +#endif +// clang-format on + void dance_enc_finished(qk_tap_dance_state_t *state, void *user_data) { if (state->count == 1) { register_code(KC_MPLY); @@ -84,11 +89,25 @@ qk_tap_dance_action_t tap_dance_actions[] = { [ENC_TAP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_enc_finished, dance_enc_reset), }; +typedef union { + uint32_t raw; + struct { + uint8_t led_level : 3; + }; +} work_louder_config_t; + +work_louder_config_t work_louder_config; + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (keycode == USER09) { preprocess_tap_dance(TD(ENC_TAP), record); return process_tap_dance(TD(ENC_TAP), record); + } else if (keycode == USER10 && record->event.pressed) { + work_louder_config.led_level ^= true; + eeconfig_update_user(work_louder_config.raw); + layer_state_set_kb(layer_state); } + return true; } @@ -97,26 +116,99 @@ layer_state_t layer_state_set_user(layer_state_t state) { writePinLow(B3); writePinLow(B7); - switch (get_highest_layer(state)) { - case 1: - writePinHigh(B2); - break; - case 2: - writePinHigh(B3); - break; - case 3: - writePinHigh(B7); - break; + if (work_louder_config.led_level) { + switch (get_highest_layer(state)) { + case 1: + writePinHigh(B2); + break; + case 2: + writePinHigh(B3); + break; + case 3: + writePinHigh(B7); + break; + } } return state; } -#ifdef ENCODER_MAP_ENABLE -const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { - [_QWERTY] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, - [_LOWER] = { ENCODER_CCW_CW(KC_PGDN, KC_PGUP) }, - [_RAISE] = { ENCODER_CCW_CW(R_M_RMOD, R_M_MOD) }, - [_ADJUST] = { ENCODER_CCW_CW(R_M_HUI, R_M_HUD) }, +void eeconfig_init_user(void) { + work_louder_config.raw = 0; + work_louder_config.led_level = true; + eeconfig_update_user(work_louder_config.raw); +} + +void keyboard_post_init_user(void) { + work_louder_config.raw = eeconfig_read_user(); +} + +enum via_indicator_value { + id_wl_brightness = 1, + id_wl_layer, // placeholder }; -#endif + +void wl_config_set_value(uint8_t *data) { + // data = [ value_id, value_data ] + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + + switch (*value_id) { + case id_wl_brightness: + work_louder_config.led_level = (bool)*value_data; + layer_state_set_kb(layer_state); + break; + // case id_wl_layer: + // layer_move(*value_data); + // break; + } +} + +void wl_config_get_value(uint8_t *data) { + // data = [ value_id, value_data ] + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + + switch (*value_id) { + case id_wl_brightness: + *value_data = work_louder_config.led_level; + break; + // case id_wl_layer: + // *value_data = get_highest_layer(layer_state); + // break; + } +} + +void wl_config_save(void) { + eeconfig_update_user(work_louder_config.raw); +} + +void via_custom_value_command_kb(uint8_t *data, uint8_t length) { + uint8_t *command_id = &(data[0]); + uint8_t *channel_id = &(data[1]); + uint8_t *value_id_and_data = &(data[2]); + + if (*channel_id == id_custom_channel) { + switch (*command_id) { + case id_custom_set_value: { + wl_config_set_value(value_id_and_data); + break; + } + case id_custom_get_value: { + wl_config_get_value(value_id_and_data); + break; + } + case id_custom_save: { + wl_config_save(); + break; + } + default: { + // Unhandled message. + *command_id = id_unhandled; + break; + } + } + return; + } + *command_id = id_unhandled; +} -- cgit v1.2.3