[Keyboard] Work Louder updates for via v3 (#19555)

master
Drashna Jaelre 2023-01-10 16:35:33 -08:00 committed by GitHub
parent 5e5b19cf94
commit a1676c3b8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 308 additions and 116 deletions

View File

@ -41,15 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DIODE_DIRECTION COL2ROW #define DIODE_DIRECTION COL2ROW
//#define LED_NUM_LOCK_PIN B0 #define USB_MAX_POWER_CONSUMPTION 100
//#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 RGBLIGHT_DI_PIN E6 #define RGBLIGHT_DI_PIN E6
//# define RGBLIGHT_HUE_STEP 8 //# define RGBLIGHT_HUE_STEP 8
@ -65,7 +57,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_EFFECT_KNIGHT #define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_CHRISTMAS #define RGBLIGHT_EFFECT_CHRISTMAS
#define RGBLIGHT_EFFECT_STATIC_GRADIENT #define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_RGB_TEST
#define RGBLIGHT_EFFECT_TWINKLE #define RGBLIGHT_EFFECT_TWINKLE
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT
@ -84,6 +75,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_MATRIX_DISABLE_KEYCODES #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_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_DISABLE_WHEN_USB_SUSPENDED
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
// #define RGB_MATRIX_KEYPRESSES
// RGB Matrix Animation modes. Explicitly enabled // RGB Matrix Animation modes. Explicitly enabled
// For full list of effects, see: // For full list of effects, see:
@ -121,18 +114,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define ENABLE_RGB_MATRIX_TYPING_HEATMAP #define ENABLE_RGB_MATRIX_TYPING_HEATMAP
#define ENABLE_RGB_MATRIX_DIGITAL_RAIN #define ENABLE_RGB_MATRIX_DIGITAL_RAIN
// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined // 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_SIMPLE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
#define ENABLE_RGB_MATRIX_SPLASH // #define ENABLE_RGB_MATRIX_SPLASH
#define ENABLE_RGB_MATRIX_MULTISPLASH // #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH // #define ENABLE_RGB_MATRIX_SOLID_SPLASH
#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH // #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5 #define DEBOUNCE 5

View File

@ -14,15 +14,15 @@
{"label": "k01", "x": 1, "y": 0}, {"label": "k01", "x": 1, "y": 0},
{"label": "k02", "x": 2, "y": 0}, {"label": "k02", "x": 2, "y": 0},
{"label": "k03", "x": 3, "y": 1, "w": 0}, {"label": "k03", "x": 3, "y": 0},
{"label": "k04", "x": 4, "y": 1, "w": 0}, {"label": "k04", "x": 4, "y": 0},
{"label": "k05", "x": 5, "y": 1, "w": 0}, {"label": "k05", "x": 5, "y": 0},
{"label": "k06", "x": 6, "y": 1, "w": 0}, {"label": "k06", "x": 6, "y": 0},
{"label": "k07", "x": 7, "y": 1, "w": 0}, {"label": "k07", "x": 7, "y": 0},
{"label": "k08", "x": 8, "y": 1, "w": 0}, {"label": "k08", "x": 8, "y": 0},
{"label": "k09", "x": 9, "y": 1, "w": 0}, {"label": "k09", "x": 9, "y": 0},
{"label": "k0a", "x": 10, "y": 1, "w": 0}, {"label": "k0a", "x": 10, "y": 0},
{"label": "k0b", "x": 11, "y": 1, "w": 0} {"label": "k0b", "x": 11, "y": 0}
] ]
} }
} }

View File

@ -9,13 +9,15 @@
* Feature disable options * Feature disable options
* These options are also useful to firmware size reduction. * These options are also useful to firmware size reduction.
*/ */
#define USB_MAX_POWER_CONSUMPTION 100
#define RGB_DI_PIN D1 #define RGB_DI_PIN D1
#define RGB_MATRIX_LED_COUNT 12 #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_MATRIX_DISABLE_KEYCODES
#define RGB_DISABLE_WHEN_USB_SUSPENDED #define RGB_DISABLE_WHEN_USB_SUSPENDED
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_FRAMEBUFFER_EFFECTS
// #define RGB_MATRIX_KEYPRESSES
#define RGBLIGHT_DI_PIN D2 #define RGBLIGHT_DI_PIN D2
#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ #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_TYPING_HEATMAP
#define ENABLE_RGB_MATRIX_DIGITAL_RAIN #define ENABLE_RGB_MATRIX_DIGITAL_RAIN
// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined // 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_SIMPLE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
#define ENABLE_RGB_MATRIX_SPLASH // #define ENABLE_RGB_MATRIX_SPLASH
#define ENABLE_RGB_MATRIX_MULTISPLASH // #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH // #define ENABLE_RGB_MATRIX_SOLID_SPLASH
#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH // #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* disable debug print */ /* disable debug print */
//#define NO_DEBUG //#define NO_DEBUG

View File

@ -22,13 +22,13 @@
"processor": "atmega32u4", "processor": "atmega32u4",
"rgblight": { "rgblight": {
"animations": { "animations": {
"alternating": true, "alternating": false,
"breathing": true, "breathing": true,
"christmas": true, "christmas": true,
"knight": true, "knight": true,
"rainbow_mood": true, "rainbow_mood": true,
"rainbow_swirl": true, "rainbow_swirl": true,
"rgb_test": true, "rgb_test": false,
"snake": true, "snake": true,
"static_gradient": true, "static_gradient": true,
"twinkle": true "twinkle": true
@ -36,7 +36,7 @@
"brightness_steps": 8, "brightness_steps": 8,
"hue_steps": 8, "hue_steps": 8,
"led_count": 8, "led_count": 8,
"max_brightness": 255, "max_brightness": 150,
"saturation_steps": 8 "saturation_steps": 8
}, },
"url": "https://worklouder.cc/", "url": "https://worklouder.cc/",

View File

@ -1,5 +0,0 @@
// Copyright 2022 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#undef RGBLIGHT_EFFECT_TWINKLE

View File

@ -8,25 +8,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_MPLY, XXXXXXX, XXXXXXX, XXXXXXX, KC_MPLY, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
RGB_TOG, XXXXXXX, XXXXXXX, 0x5011 RGB_TOG, XXXXXXX, XXXXXXX, TO(1)
), ),
[1] = LAYOUT( [1] = LAYOUT(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, 0x5012 XXXXXXX, XXXXXXX, XXXXXXX, TO(2)
), ),
[2] = LAYOUT( [2] = LAYOUT(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, 0x5013 XXXXXXX, XXXXXXX, XXXXXXX, TO(3)
), ),
[3] = LAYOUT( [3] = LAYOUT(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
USER00, USER01, USER03, USER05, USER00, USER01, USER03, USER05,
XXXXXXX, USER02, USER04, USER06, 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; work_louder_config_t work_louder_config;
#define WL_LED_MAX_BRIGHT 75
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {
case USER09: case USER09:
@ -57,21 +59,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (work_louder_config.led_level > 4) { if (work_louder_config.led_level > 4) {
work_louder_config.led_level = 1; 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); eeconfig_update_user(work_louder_config.raw);
layer_state_set_kb(layer_state); layer_state_set_kb(layer_state);
} }
break; 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; return true;
} }
@ -88,14 +80,87 @@ layer_state_t layer_state_set_user(layer_state_t state) {
void eeconfig_init_user(void) { void eeconfig_init_user(void) {
work_louder_config.raw = 0; work_louder_config.raw = 0;
work_louder_config.led_level = 1; 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); eeconfig_update_user(work_louder_config.raw);
} }
void keyboard_post_init_user(void) { void keyboard_post_init_user(void) {
work_louder_config.raw = eeconfig_read_user(); 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) { void suspend_wakeup_init_user(void) {
layer_state_set_user(layer_state); 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;
}

View File

@ -41,15 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* COL2ROW, ROW2COL */ /* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW #define DIODE_DIRECTION COL2ROW
//#define LED_NUM_LOCK_PIN B0 #define USB_MAX_POWER_CONSUMPTION 100
//#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 RGBLIGHT_DI_PIN C7 #define RGBLIGHT_DI_PIN C7
#define RGBLED_NUM 6 #define RGBLED_NUM 6
@ -66,8 +58,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_EFFECT_KNIGHT #define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_CHRISTMAS #define RGBLIGHT_EFFECT_CHRISTMAS
#define RGBLIGHT_EFFECT_STATIC_GRADIENT #define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_RGB_TEST
#define RGBLIGHT_EFFECT_TWINKLE #define RGBLIGHT_EFFECT_TWINKLE
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT
#define RGBLIGHT_DEFAULT_HUE 170 #define RGBLIGHT_DEFAULT_HUE 170
@ -84,6 +76,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120
#define RGB_MATRIX_DISABLE_KEYCODES #define RGB_MATRIX_DISABLE_KEYCODES
#define RGB_DISABLE_WHEN_USB_SUSPENDED #define RGB_DISABLE_WHEN_USB_SUSPENDED
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
// #define RGB_MATRIX_KEYPRESSES
// RGB Matrix Animation modes. Explicitly enabled // RGB Matrix Animation modes. Explicitly enabled
// For full list of effects, see: // For full list of effects, see:
@ -121,18 +115,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define ENABLE_RGB_MATRIX_TYPING_HEATMAP #define ENABLE_RGB_MATRIX_TYPING_HEATMAP
#define ENABLE_RGB_MATRIX_DIGITAL_RAIN #define ENABLE_RGB_MATRIX_DIGITAL_RAIN
// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined // 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_SIMPLE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
#define ENABLE_RGB_MATRIX_SPLASH // #define ENABLE_RGB_MATRIX_SPLASH
#define ENABLE_RGB_MATRIX_MULTISPLASH // #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH // #define ENABLE_RGB_MATRIX_SOLID_SPLASH
#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH // #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5 #define DEBOUNCE 5

View File

@ -22,11 +22,59 @@
// #define RGB_DI_PIN D1 // #define RGB_DI_PIN D1
#define RGB_MATRIX_LED_COUNT 16 #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_MATRIX_DISABLE_KEYCODES
#define RGB_DISABLE_WHEN_USB_SUSPENDED #define RGB_DISABLE_WHEN_USB_SUSPENDED
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGBLIGHT_DI_PIN D2 #define RGBLIGHT_DI_PIN D2
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9 #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9
#define RGBLIGHT_DEFAULT_HUE 213 #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

View File

@ -62,7 +62,7 @@
"brightness_steps": 8, "brightness_steps": 8,
"hue_steps": 8, "hue_steps": 8,
"led_count": 8, "led_count": 8,
"max_brightness": 255, "max_brightness": 120,
"pin": "D1", "pin": "D1",
"saturation_steps": 8, "saturation_steps": 8,
"sleep": true "sleep": true

View File

@ -41,6 +41,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* COL2ROW, ROW2COL */ /* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW #define DIODE_DIRECTION COL2ROW
#define USB_MAX_POWER_CONSUMPTION 100
#define RGBLIGHT_DI_PIN D2 #define RGBLIGHT_DI_PIN D2
//# define RGBLIGHT_HUE_STEP 8 //# define RGBLIGHT_HUE_STEP 8
//# define RGBLIGHT_SAT_STEP 8 //# define RGBLIGHT_SAT_STEP 8
@ -55,7 +57,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_EFFECT_KNIGHT #define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_CHRISTMAS #define RGBLIGHT_EFFECT_CHRISTMAS
#define RGBLIGHT_EFFECT_STATIC_GRADIENT #define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_RGB_TEST
#define RGBLIGHT_EFFECT_TWINKLE #define RGBLIGHT_EFFECT_TWINKLE
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9 #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9
@ -73,6 +74,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120
#define RGB_MATRIX_DISABLE_KEYCODES #define RGB_MATRIX_DISABLE_KEYCODES
#define RGB_DISABLE_WHEN_USB_SUSPENDED #define RGB_DISABLE_WHEN_USB_SUSPENDED
// #define RGB_MATRIX_FRAMEBUFFER_EFFECTS
// #define RGB_MATRIX_KEYPRESSES
// RGB Matrix Animation modes. Explicitly enabled // RGB Matrix Animation modes. Explicitly enabled
// For full list of effects, see: // For full list of effects, see:

View File

@ -16,12 +16,7 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
enum planck_layers { enum planck_layers { _QWERTY, _LOWER, _RAISE, _ADJUST };
_QWERTY,
_LOWER,
_RAISE,
_ADJUST
};
enum tap_dances { enum tap_dances {
ENC_TAP, 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) { void dance_enc_finished(qk_tap_dance_state_t *state, void *user_data) {
if (state->count == 1) { if (state->count == 1) {
register_code(KC_MPLY); 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), [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) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (keycode == USER09) { if (keycode == USER09) {
preprocess_tap_dance(TD(ENC_TAP), record); preprocess_tap_dance(TD(ENC_TAP), record);
return process_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; return true;
} }
@ -97,6 +116,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
writePinLow(B3); writePinLow(B3);
writePinLow(B7); writePinLow(B7);
if (work_louder_config.led_level) {
switch (get_highest_layer(state)) { switch (get_highest_layer(state)) {
case 1: case 1:
writePinHigh(B2); writePinHigh(B2);
@ -108,15 +128,87 @@ layer_state_t layer_state_set_user(layer_state_t state) {
writePinHigh(B7); writePinHigh(B7);
break; break;
} }
}
return state; return state;
} }
#ifdef ENCODER_MAP_ENABLE void eeconfig_init_user(void) {
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { work_louder_config.raw = 0;
[_QWERTY] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, work_louder_config.led_level = true;
[_LOWER] = { ENCODER_CCW_CW(KC_PGDN, KC_PGUP) }, eeconfig_update_user(work_louder_config.raw);
[_RAISE] = { ENCODER_CCW_CW(R_M_RMOD, R_M_MOD) }, }
[_ADJUST] = { ENCODER_CCW_CW(R_M_HUI, R_M_HUD) },
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;
}