2022-07-26 19:50:45 +00:00
|
|
|
// Copyright 2022 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
#include QMK_KEYBOARD_H
|
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
2023-01-01 00:57:15 +00:00
|
|
|
[0] = LAYOUT(
|
|
|
|
KC_MPLY, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
RGB_TOG, XXXXXXX, XXXXXXX, 0x5011
|
2022-07-26 19:50:45 +00:00
|
|
|
),
|
2023-01-01 00:57:15 +00:00
|
|
|
[1] = LAYOUT(
|
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, 0x5012
|
2022-07-26 19:50:45 +00:00
|
|
|
),
|
2023-01-01 00:57:15 +00:00
|
|
|
[2] = LAYOUT(
|
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, 0x5013
|
2022-07-26 19:50:45 +00:00
|
|
|
),
|
2023-01-01 00:57:15 +00:00
|
|
|
[3] = LAYOUT(
|
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
USER00, USER01, USER03, USER05,
|
|
|
|
XXXXXXX, USER02, USER04, USER06,
|
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, 0x5010
|
2022-07-26 19:50:45 +00:00
|
|
|
)
|
|
|
|
};
|
|
|
|
|
|
|
|
#if defined(ENCODER_MAP_ENABLE)
|
|
|
|
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
|
|
|
|
{ ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(C(KC_Z), C(KC_Y)) },
|
|
|
|
{ ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
|
|
|
|
{ ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
|
|
|
|
{ ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
switch (keycode) {
|
|
|
|
case USER09:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
work_louder_config.led_level++;
|
|
|
|
if (work_louder_config.led_level > 4) {
|
2023-01-01 00:57:15 +00:00
|
|
|
work_louder_config.led_level = 1;
|
2022-07-26 19:50:45 +00:00
|
|
|
}
|
|
|
|
work_louder_micro_led_all_set((uint8_t)(work_louder_config.led_level * 255 / 4));
|
|
|
|
eeconfig_update_user(work_louder_config.raw);
|
|
|
|
layer_state_set_kb(layer_state);
|
|
|
|
}
|
|
|
|
break;
|
2023-01-01 00:57:15 +00:00
|
|
|
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;
|
2022-07-26 19:50:45 +00:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
eeconfig_update_user(work_louder_config.raw);
|
|
|
|
}
|
|
|
|
|
2023-01-01 00:57:15 +00:00
|
|
|
void keyboard_post_init_user(void) {
|
2022-07-26 19:50:45 +00:00
|
|
|
work_louder_config.raw = eeconfig_read_user();
|
|
|
|
work_louder_micro_led_all_set((uint8_t)(work_louder_config.led_level * 255 / 4));
|
|
|
|
}
|
2023-01-01 00:57:15 +00:00
|
|
|
|
|
|
|
void suspend_wakeup_init_user(void) {
|
|
|
|
layer_state_set_user(layer_state);
|
|
|
|
}
|