summaryrefslogtreecommitdiff
path: root/keyboards/work_louder/micro/keymaps/via
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2022-07-26 12:50:45 -0700
committerGitHub <noreply@github.com>2022-07-26 20:50:45 +0100
commit5f36285fc5905913aea0671e037bb343fd84391f (patch)
treefe678b41ae43d5ff42546a828f0028325eb55c05 /keyboards/work_louder/micro/keymaps/via
parent9dbc0473efd64ae246e171fe0201708725c9eeda (diff)
[Keyboard] Add work louder micro (#17586)
* [Keyboard] Add work louder micro * Update keyboards/work_louder/micro/readme.md * Update readme * Update kb config files * Update to use encoder map Co-authored-by: Tom Barnes <barnestom@me.com>
Diffstat (limited to 'keyboards/work_louder/micro/keymaps/via')
-rw-r--r--keyboards/work_louder/micro/keymaps/via/keymap.c92
-rw-r--r--keyboards/work_louder/micro/keymaps/via/rules.mk3
2 files changed, 95 insertions, 0 deletions
diff --git a/keyboards/work_louder/micro/keymaps/via/keymap.c b/keyboards/work_louder/micro/keymaps/via/keymap.c
new file mode 100644
index 0000000000..da910af6b2
--- /dev/null
+++ b/keyboards/work_louder/micro/keymaps/via/keymap.c
@@ -0,0 +1,92 @@
+// 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] = {
+ LAYOUT(
+ KC_MPLY, KC_9, KC_0, KC_NO,
+ KC_5, KC_6, KC_7, KC_8,
+ KC_1, KC_2, KC_3, KC_4,
+ TO(1), KC_DOT, KC_COMM, USER09
+ ),
+ LAYOUT(
+ _______, _______, _______, _______,
+ _______, _______, _______, _______,
+ _______, _______, _______, _______,
+ TO(2), _______, _______, _______
+
+ ),
+ LAYOUT(
+ _______, _______, _______, _______,
+ _______, _______, _______, _______,
+ _______, _______, _______, _______,
+ TO(3), _______, _______, _______
+ ),
+ LAYOUT(
+ _______, _______, _______, _______,
+ _______, _______, _______, _______,
+ _______, _______, _______, _______,
+ TO(0), _______, _______, _______
+ )
+};
+
+#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) {
+#ifdef CONSOLE_ENABLE
+ uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
+#endif
+
+ switch (keycode) {
+ case USER09:
+ if (record->event.pressed) {
+ work_louder_config.led_level++;
+ if (work_louder_config.led_level > 4) {
+ work_louder_config.led_level = 0;
+ }
+ 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;
+ }
+ 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);
+}
+
+void matrix_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));
+}
diff --git a/keyboards/work_louder/micro/keymaps/via/rules.mk b/keyboards/work_louder/micro/keymaps/via/rules.mk
new file mode 100644
index 0000000000..70cf4224c0
--- /dev/null
+++ b/keyboards/work_louder/micro/keymaps/via/rules.mk
@@ -0,0 +1,3 @@
+VIA_ENABLE = yes
+ENCODER_MAP_ENABLE = yes
+LTO_ENABLE = yes