forked from qmk/qmk_userspace
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Figma keymap for Work Louder Micro
- Loading branch information
Showing
4 changed files
with
189 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2023 QMK | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
// #define MIDI_BASIC | ||
// #define NO_ACTION_ONESHOT | ||
|
||
#define USB_SUSPEND_WAKEUP_DELAY 200 | ||
|
||
#undef RGBLIGHT_DEFAULT_MODE | ||
#undef RGBLIGHT_DEFAULT_HUE | ||
|
||
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT | ||
#define RGBLIGHT_DEFAULT_HUE 159 | ||
#define RGBLIGHT_DEFAULT_SAT 8 | ||
#define RGBLIGHT_DEFAULT_VAL 98 | ||
|
||
#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_SOLID_COLOR | ||
#define RGB_MATRIX_DEFAULT_HUE 176 | ||
#define RGB_MATRIX_DEFAULT_SAT 232 | ||
#define RGB_MATRIX_DEFAULT_VAL 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
#include QMK_KEYBOARD_H | ||
|
||
|
||
/* THIS FILE WAS GENERATED! | ||
* | ||
* This file was generated by qmk json2c. You may or may not want to | ||
* edit it directly. | ||
*/ | ||
|
||
|
||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
[0] = LAYOUT(G(KC_T), KC_V, KC_P, KC_NO, S(KC_L), KC_R, KC_O, KC_L, A(KC_A), LCA(KC_V), LCA(KC_H), A(KC_D), RGB_TOG, KC_F, KC_C, TO(1)), | ||
[1] = LAYOUT(G(KC_T), KC_V, KC_P, KC_NO, KC_TRNS, KC_R, KC_O, KC_L, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_F, KC_C, TO(2)), | ||
[2] = LAYOUT(C(KC_T), KC_V, KC_P, KC_NO, S(KC_L), KC_R, KC_O, KC_L, A(KC_A), LSA(KC_V), LSA(KC_H), A(KC_D), KC_NO, KC_F, KC_C, TO(3)), | ||
[3] = LAYOUT(KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_M), KC_S, KC_T, KC_E, KC_NO, S(KC_S), KC_C, TO(0)) | ||
}; | ||
|
||
#if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) | ||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { | ||
{ ENCODER_CCW_CW(KC_MINS, KC_EQL), ENCODER_CCW_CW(G(KC_Z), LSG(KC_Z)) }, | ||
{ ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, | ||
{ ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(C(KC_Z), C(KC_Y)) }, | ||
{ ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) } | ||
}; | ||
#endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) | ||
|
||
|
||
typedef union { | ||
uint32_t raw; | ||
struct { | ||
uint8_t led_level : 3; | ||
}; | ||
} work_louder_config_t; | ||
|
||
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 QK_KB_9: | ||
if (record->event.pressed) { | ||
work_louder_config.led_level++; | ||
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 * WL_LED_MAX_BRIGHT / 4)); | ||
eeconfig_update_user(work_louder_config.raw); | ||
layer_state_set_kb(layer_state); | ||
} | ||
break; | ||
} | ||
return true; | ||
} | ||
|
||
|
||
layer_state_t layer_state_set_user(layer_state_t state) { | ||
layer_state_cmp(state, 1) ? work_louder_micro_led_1_on(): work_louder_micro_led_1_off(); | ||
layer_state_cmp(state, 2) ? work_louder_micro_led_2_on(): work_louder_micro_led_2_off(); | ||
layer_state_cmp(state, 3) ? work_louder_micro_led_3_on(): work_louder_micro_led_3_off(); | ||
|
||
return 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 * 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; | ||
} | ||
|
||
|
||
uint16_t keycode_config(uint16_t keycode) { | ||
return keycode; | ||
} | ||
|
||
uint8_t mod_config(uint8_t mod) { | ||
return mod; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
VIA_ENABLE = yes | ||
LTO_ENABLE = yes | ||
ENCODER_MAP_ENABLE = yes | ||
MAGIC_ENABLE = no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters