Skip to content

Commit

Permalink
[Keyboard] Work Louder updates for via v3 (qmk#19555)
Browse files Browse the repository at this point in the history
  • Loading branch information
drashna authored Jan 11, 2023
1 parent 5e5b19c commit a1676c3
Show file tree
Hide file tree
Showing 11 changed files with 308 additions and 116 deletions.
37 changes: 15 additions & 22 deletions keyboards/work_louder/loop/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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
Expand All @@ -65,7 +57,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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
Expand All @@ -84,6 +75,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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:
Expand Down Expand Up @@ -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_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
Expand Down
18 changes: 9 additions & 9 deletions keyboards/work_louder/loop/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}
]
}
}
Expand Down
28 changes: 15 additions & 13 deletions keyboards/work_louder/micro/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions keyboards/work_louder/micro/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@
"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
},
"brightness_steps": 8,
"hue_steps": 8,
"led_count": 8,
"max_brightness": 255,
"max_brightness": 150,
"saturation_steps": 8
},
"url": "https://worklouder.cc/",
Expand Down
5 changes: 0 additions & 5 deletions keyboards/work_louder/micro/keymaps/via/config.h

This file was deleted.

97 changes: 81 additions & 16 deletions keyboards/work_louder/micro/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
};

Expand All @@ -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:
Expand All @@ -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;
}
Expand All @@ -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;
}
38 changes: 16 additions & 22 deletions keyboards/work_louder/nano/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* 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
Expand All @@ -66,8 +58,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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

Expand All @@ -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_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:
Expand Down Expand Up @@ -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_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
Expand Down
Loading

0 comments on commit a1676c3

Please sign in to comment.