diff options
author | Drashna Jaelre <drashna@live.com> | 2023-01-10 16:35:33 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-10 16:35:33 -0800 |
commit | a1676c3b8c3f5f5d713196d99ac358ba5fb021ef (patch) | |
tree | 4eef2364fa41fffa200a18c83258900fd53793e9 /keyboards/work_louder/micro | |
parent | 5e5b19cf94d46db06cf43a834b7fd8a112d9e527 (diff) |
[Keyboard] Work Louder updates for via v3 (#19555)
Diffstat (limited to 'keyboards/work_louder/micro')
-rw-r--r-- | keyboards/work_louder/micro/config.h | 28 | ||||
-rw-r--r-- | keyboards/work_louder/micro/info.json | 6 | ||||
-rw-r--r-- | keyboards/work_louder/micro/keymaps/via/config.h | 5 | ||||
-rw-r--r-- | keyboards/work_louder/micro/keymaps/via/keymap.c | 97 |
4 files changed, 99 insertions, 37 deletions
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; +} |