diff options
23 files changed, 80 insertions, 355 deletions
diff --git a/keyboards/work_louder/encoder_actions.c b/keyboards/work_louder/encoder_actions.c deleted file mode 100644 index b41a248a83..0000000000 --- a/keyboards/work_louder/encoder_actions.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2020 Neil Brian Ramirez - * Copyright 2021 drashna jael're (@drashna) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "encoder_actions.h" - -#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE) - -# ifdef ENCODERS -static uint8_t encoder_state[ENCODERS] = {0}; -static keypos_t encoder_cw[ENCODERS] = ENCODERS_CW_KEY; -static keypos_t encoder_ccw[ENCODERS] = ENCODERS_CCW_KEY; -# endif - -void encoder_action_unregister(void) { -# ifdef ENCODERS - for (int index = 0; index < ENCODERS; ++index) { - if (encoder_state[index]) { - keyevent_t encoder_event = (keyevent_t) { - .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], - .pressed = false, - .time = (timer_read() | 1) - }; - encoder_state[index] = 0; - action_exec(encoder_event); - } - } -# endif -} - -void encoder_action_register(uint8_t index, bool clockwise) { -# ifdef ENCODERS - keyevent_t encoder_event = (keyevent_t) { - .key = clockwise ? encoder_cw[index] : encoder_ccw[index], - .pressed = true, - .time = (timer_read() | 1) - }; - encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); - action_exec(encoder_event); -# endif -} - -void matrix_scan_kb(void) { - encoder_action_unregister(); - matrix_scan_user(); -} - -bool encoder_update_kb(uint8_t index, bool clockwise) { - encoder_action_register(index, clockwise); - // don't return user actions, because they are in the keymap - // encoder_update_user(index, clockwise); - return true; -}; - -#endif diff --git a/keyboards/work_louder/encoder_actions.h b/keyboards/work_louder/encoder_actions.h deleted file mode 100644 index 2484af52ae..0000000000 --- a/keyboards/work_louder/encoder_actions.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright 2020 Neil Brian Ramirez - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "quantum.h" - -void encoder_action_unregister(void); - -void encoder_action_register(uint8_t index, bool clockwise); diff --git a/keyboards/work_louder/loop/config.h b/keyboards/work_louder/loop/config.h index a2ad6030c8..141a377f1f 100644 --- a/keyboards/work_louder/loop/config.h +++ b/keyboards/work_louder/loop/config.h @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "config_common.h" /* key matrix size */ -#define MATRIX_ROWS 2 +#define MATRIX_ROWS 1 #define MATRIX_COLS 12 /* @@ -34,7 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #define MATRIX_ROW_PINS \ - { F5, NO_PIN } + { F5 } #define MATRIX_COL_PINS { B3, B2, B1, D6, D7, B4, B5, B6, C6, C7, F7, F6 } #define UNUSED_PINS @@ -195,8 +195,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define ENCODERS_PAD_A { D0, D2, D5 } #define ENCODERS_PAD_B { D1, D3, D4 } - -#define ENCODERS 3 - -#define ENCODERS_CW_KEY { { 0, 1 }, { 2, 1 }, { 4, 1 } } -#define ENCODERS_CCW_KEY { { 1, 1 }, { 3, 1 }, { 5, 1 } } diff --git a/keyboards/work_louder/loop/info.json b/keyboards/work_louder/loop/info.json index 5048d4af11..f83124a32d 100644 --- a/keyboards/work_louder/loop/info.json +++ b/keyboards/work_louder/loop/info.json @@ -1,11 +1,11 @@ { "keyboard_name": "Loop Pad", "manufacturer": "Work Louder", - "url": "", + "url": "https://worklouder.cc/", "maintainer": "Work Louder", "usb": { "vid": "0x574C", - "pid": "0x1DF8", + "pid": "0x1DF9", "device_version": "0.0.1" }, "layouts": { diff --git a/keyboards/work_louder/loop/keymaps/via/keymap.c b/keyboards/work_louder/loop/keymaps/via/keymap.c index 286c651361..f2f8f7d9a6 100644 --- a/keyboards/work_louder/loop/keymaps/via/keymap.c +++ b/keyboards/work_louder/loop/keymaps/via/keymap.c @@ -15,30 +15,28 @@ */ #include QMK_KEYBOARD_H -#define LAYOUT_via( \ - k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ - k00_a, k00_b, k01_a, k01_b, k02_a, k02_b \ -) { \ - { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \ - { k00_a, k00_b, k01_a, k01_b, k02_a, k02_b } \ -} - // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_via( - KC_MUTE, KC_MPLY, R_M_TOG, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, MO(1), - KC_VOLU, KC_VOLD, KC_MNXT, KC_MPRV, R_M_MOD, R_M_RMOD + [0] = LAYOUT( + KC_MUTE, KC_MPLY, R_M_TOG, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, MO(1) ), - [1] = LAYOUT_via( - QK_BOOT, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, MO(2), _______, - _______, _______, _______, _______, RGB_MOD, RGB_RMOD + [1] = LAYOUT( + QK_BOOT, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, MO(2), _______ ), - [2] = LAYOUT_via( - QK_BOOT, _______, R_M_TOG, R_M_MOD, R_M_HUI, R_M_HUD, R_M_SAI, R_M_SAD, R_M_VAI, R_M_VAD, _______, _______, - _______, _______, _______, _______, R_M_MOD, R_M_RMOD + [2] = LAYOUT( + QK_BOOT, _______, R_M_TOG, R_M_MOD, R_M_HUI, R_M_HUD, R_M_SAI, R_M_SAD, R_M_VAI, R_M_VAD, _______, _______ ), - [3] = LAYOUT_via( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______ + [3] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) }; +// clang-format on + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [0] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD), ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(R_M_RMOD, R_M_MOD) }, + [1] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, + [2] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, + [3] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, +}; +#endif diff --git a/keyboards/work_louder/loop/keymaps/via/rules.mk b/keyboards/work_louder/loop/keymaps/via/rules.mk index 6098ef3ad8..1189f4ad19 100644 --- a/keyboards/work_louder/loop/keymaps/via/rules.mk +++ b/keyboards/work_louder/loop/keymaps/via/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes LTO_ENABLE = yes - -SRC += encoder_actions.c +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/work_louder/loop/loop.c b/keyboards/work_louder/loop/loop.c index 5c0d108d19..6b4af7fcb6 100644 --- a/keyboards/work_louder/loop/loop.c +++ b/keyboards/work_louder/loop/loop.c @@ -16,7 +16,7 @@ #include "loop.h" -#if !defined(VIA_ENABLE) && defined(ENCODER_ENABLE) +#if defined(ENCODER_ENABLE) bool encoder_update_kb(uint8_t index, bool clockwise) { if (!encoder_update_user(index, clockwise)) { return false; } if (index == 0) { diff --git a/keyboards/work_louder/loop/loop.h b/keyboards/work_louder/loop/loop.h index cfc58146d1..a7376881b3 100644 --- a/keyboards/work_louder/loop/loop.h +++ b/keyboards/work_louder/loop/loop.h @@ -17,7 +17,6 @@ #pragma once #include "quantum.h" -#include "encoder_actions.h" #include "rgb_functions.h" /* This is a shortcut to help you visually see your layout. diff --git a/keyboards/work_louder/micro/info.json b/keyboards/work_louder/micro/info.json index 27d2736ad9..3905f226f8 100644 --- a/keyboards/work_louder/micro/info.json +++ b/keyboards/work_louder/micro/info.json @@ -30,7 +30,7 @@ "max_brightness": 255, "saturation_steps": 8 }, - "url": "", + "url": "https://worklouder.cc/", "usb": { "device_version": "1.0.0", "pid": "0xE6E3", diff --git a/keyboards/work_louder/micro/micro.c b/keyboards/work_louder/micro/micro.c index aae8048c59..80d3927417 100644 --- a/keyboards/work_louder/micro/micro.c +++ b/keyboards/work_louder/micro/micro.c @@ -26,7 +26,7 @@ led_config_t g_led_config = { { // clang-format on #endif -#if defined(ENCODER_ENABLE) && !defined(ENCODERS) && !defined(ENCODER_MAP_ENABLE) +#if defined(ENCODER_ENABLE) bool encoder_update_kb(uint8_t index, bool clockwise) { if (!encoder_update_user(index, clockwise)) { return false; diff --git a/keyboards/work_louder/nano/config.h b/keyboards/work_louder/nano/config.h index 4930101f53..7a7d03b8a3 100644 --- a/keyboards/work_louder/nano/config.h +++ b/keyboards/work_louder/nano/config.h @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* key matrix size */ #define MATRIX_ROWS 1 -#define MATRIX_COLS 5 +#define MATRIX_COLS 3 /* * Keyboard Matrix Assignments @@ -36,7 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MATRIX_ROW_PINS \ { F7 } #define MATRIX_COL_PINS \ - { B5, B6, C6, NO_PIN, NO_PIN } + { B5, B6, C6 } /* COL2ROW, ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -195,14 +195,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. { D7 } #define ENCODERS_PAD_B \ { B4 } - -#define ENCODERS 1 - -#define ENCODERS_CW_KEY \ - { \ - { 3, 0 } \ - } -#define ENCODERS_CCW_KEY \ - { \ - { 4, 0 } \ - } diff --git a/keyboards/work_louder/nano/info.json b/keyboards/work_louder/nano/info.json index afbcd5feea..46b083d0ef 100644 --- a/keyboards/work_louder/nano/info.json +++ b/keyboards/work_louder/nano/info.json @@ -1,11 +1,11 @@ { "keyboard_name": "Nano Pad", "manufacturer": "Work Louder", - "url": "", + "url": "https://worklouder.cc/", "maintainer": "Work Louder", "usb": { "vid": "0x574C", - "pid": "0xE6EF", + "pid": "0xE6F0", "device_version": "0.0.1" }, "layouts": { diff --git a/keyboards/work_louder/nano/keymaps/via/keymap.c b/keyboards/work_louder/nano/keymaps/via/keymap.c index 07451f52b2..612e8c8c03 100644 --- a/keyboards/work_louder/nano/keymaps/via/keymap.c +++ b/keyboards/work_louder/nano/keymaps/via/keymap.c @@ -15,31 +15,28 @@ */ #include QMK_KEYBOARD_H - -#define LAYOUT_via( \ - k00, k01, k02, \ - k00_a, k00_b \ -) { \ - { k00, k01, k02, k00_a, k00_b } \ -} - - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Base */ - [0] = LAYOUT_via( - KC_PSCR, MACRO00, MO(1), - KC_PGDN, KC_PGUP + [0] = LAYOUT( + KC_PSCR, MACRO00, MO(1) ), - [1] = LAYOUT_via( - QK_BOOT, MACRO01, _______, - _______, _______ + [1] = LAYOUT( + QK_BOOT, MACRO01, _______ ), - [2] = LAYOUT_via( - _______, _______, _______, - _______, _______ + [2] = LAYOUT( + _______, _______, _______ ), - [3] = LAYOUT_via( - _______, _______, _______, - _______, _______ + [3] = LAYOUT( + _______, _______, _______ ) }; + + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [0] = { ENCODER_CCW_CW(KC_PGDN, KC_PGDN) }, + [1] = { ENCODER_CCW_CW(_______, _______) }, + [2] = { ENCODER_CCW_CW(_______, _______) }, + [3] = { ENCODER_CCW_CW(_______, _______) }, +}; +#endif diff --git a/keyboards/work_louder/nano/keymaps/via/rules.mk b/keyboards/work_louder/nano/keymaps/via/rules.mk index 6098ef3ad8..1189f4ad19 100644 --- a/keyboards/work_louder/nano/keymaps/via/rules.mk +++ b/keyboards/work_louder/nano/keymaps/via/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes LTO_ENABLE = yes - -SRC += encoder_actions.c +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/work_louder/nano/nano.c b/keyboards/work_louder/nano/nano.c index 62d44ef133..96b633aa79 100644 --- a/keyboards/work_louder/nano/nano.c +++ b/keyboards/work_louder/nano/nano.c @@ -16,7 +16,7 @@ #include "nano.h" -#if !defined(VIA_ENABLE) && defined(ENCODER_ENABLE) +#if defined(ENCODER_ENABLE) bool encoder_update_kb(uint8_t index, bool clockwise) { if (!encoder_update_user(index, clockwise)) { return false; } if (clockwise) { diff --git a/keyboards/work_louder/nano/nano.h b/keyboards/work_louder/nano/nano.h index 6230d75ab7..cc152b8ccc 100644 --- a/keyboards/work_louder/nano/nano.h +++ b/keyboards/work_louder/nano/nano.h @@ -17,7 +17,6 @@ #pragma once #include "quantum.h" -#include "encoder_actions.h" #include "rgb_functions.h" /* This is a shortcut to help you visually see your layout. diff --git a/keyboards/work_louder/rgb_functions.c b/keyboards/work_louder/rgb_functions.c index c9106b3976..d0cb93ccbc 100644 --- a/keyboards/work_louder/rgb_functions.c +++ b/keyboards/work_louder/rgb_functions.c @@ -18,159 +18,15 @@ #include "rgb_functions.h" #ifdef RGBLIGHT_ENABLE -# include "ws2812.h" -# include <avr/interrupt.h> -# include <avr/io.h> -# include <util/delay.h> +#undef RGB_DI_PIN +#define RGB_DI_PIN RGBLIGHT_DI_PIN -# define pinmask(pin) (_BV((pin)&0xF)) +#define ws2812_setleds ws2812_rgb_setleds -/* - * Forward declare internal functions - * - * The functions take a byte-array and send to the data output as WS2812 bitstream. - * The length is the number of bytes to send - three per LED. - */ - -static inline void ws2812_sendarray_mask(uint8_t *data, uint16_t datlen, uint8_t masklo, uint8_t maskhi); - -/* - This routine writes an array of bytes with RGB values to the Dataout pin - using the fast 800kHz clockless WS2811/2812 protocol. -*/ - -// Timing in ns -# define w_zeropulse 350 -# define w_onepulse 900 -# define w_totalperiod 1250 - -// Fixed cycles used by the inner loop -# define w_fixedlow 2 -# define w_fixedhigh 4 -# define w_fixedtotal 8 - -// Insert NOPs to match the timing, if possible -# define w_zerocycles (((F_CPU / 1000) * w_zeropulse) / 1000000) -# define w_onecycles (((F_CPU / 1000) * w_onepulse + 500000) / 1000000) -# define w_totalcycles (((F_CPU / 1000) * w_totalperiod + 500000) / 1000000) - -// w1_nops - nops between rising edge and falling edge - low -# if w_zerocycles >= w_fixedlow -# define w1_nops (w_zerocycles - w_fixedlow) -# else -# define w1_nops 0 -# endif - -// w2_nops - nops between fe low and fe high -# if w_onecycles >= (w_fixedhigh + w1_nops) -# define w2_nops (w_onecycles - w_fixedhigh - w1_nops) -# else -# define w2_nops 0 -# endif - -// w3_nops - nops to complete loop -# if w_totalcycles >= (w_fixedtotal + w1_nops + w2_nops) -# define w3_nops (w_totalcycles - w_fixedtotal - w1_nops - w2_nops) -# else -# define w3_nops 0 -# endif - -// The only critical timing parameter is the minimum pulse length of the "0" -// Warn or throw error if this timing can not be met with current F_CPU settings. -# define w_lowtime ((w1_nops + w_fixedlow) * 1000000) / (F_CPU / 1000) -# if w_lowtime > 550 -# error "Light_ws2812: Sorry, the clock speed is too low. Did you set F_CPU correctly?" -# elif w_lowtime > 450 -# warning "Light_ws2812: The timing is critical and may only work on WS2812B, not on WS2812(S)." -# warning "Please consider a higher clockspeed, if possible" -# endif - -# define w_nop1 "nop \n\t" -# define w_nop2 "rjmp .+0 \n\t" -# define w_nop4 w_nop2 w_nop2 -# define w_nop8 w_nop4 w_nop4 -# define w_nop16 w_nop8 w_nop8 - -static inline void ws2812_sendarray_mask(uint8_t *data, uint16_t datlen, uint8_t masklo, uint8_t maskhi) { - uint8_t curbyte, ctr, sreg_prev; - - sreg_prev = SREG; - cli(); - - while (datlen--) { - curbyte = (*data++); - - asm volatile(" ldi %0,8 \n\t" - "loop%=: \n\t" - " out %2,%3 \n\t" // '1' [01] '0' [01] - re -# if (w1_nops & 1) - w_nop1 -# endif -# if (w1_nops & 2) - w_nop2 -# endif -# if (w1_nops & 4) - w_nop4 -# endif -# if (w1_nops & 8) - w_nop8 -# endif -# if (w1_nops & 16) - w_nop16 -# endif - " sbrs %1,7 \n\t" // '1' [03] '0' [02] - " out %2,%4 \n\t" // '1' [--] '0' [03] - fe-low - " lsl %1 \n\t" // '1' [04] '0' [04] -# if (w2_nops & 1) - w_nop1 -# endif -# if (w2_nops & 2) - w_nop2 -# endif -# if (w2_nops & 4) - w_nop4 -# endif -# if (w2_nops & 8) - w_nop8 -# endif -# if (w2_nops & 16) - w_nop16 -# endif - " out %2,%4 \n\t" // '1' [+1] '0' [+1] - fe-high -# if (w3_nops & 1) - w_nop1 -# endif -# if (w3_nops & 2) - w_nop2 -# endif -# if (w3_nops & 4) - w_nop4 -# endif -# if (w3_nops & 8) - w_nop8 -# endif -# if (w3_nops & 16) - w_nop16 -# endif - - " dec %0 \n\t" // '1' [+2] '0' [+2] - " brne loop%=\n\t" // '1' [+3] '0' [+4] - : "=&d"(ctr) - : "r"(curbyte), "I"(_SFR_IO_ADDR(PORTx_ADDRESS(RGBLIGHT_DI_PIN))), "r"(maskhi), "r"(masklo)); - } - - SREG = sreg_prev; -} +#include "ws2812.c" void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { - DDRx_ADDRESS(RGBLIGHT_DI_PIN) |= pinmask(RGBLIGHT_DI_PIN); - - uint8_t masklo = ~(pinmask(RGBLIGHT_DI_PIN)) & PORTx_ADDRESS(RGBLIGHT_DI_PIN); - uint8_t maskhi = pinmask(RGBLIGHT_DI_PIN) | PORTx_ADDRESS(RGBLIGHT_DI_PIN); - - ws2812_sendarray_mask((uint8_t *)start_led, num_leds * sizeof(LED_TYPE), masklo, maskhi); - - _delay_us(WS2812_TRST_US); + ws2812_setleds(start_led, num_leds); } #endif diff --git a/keyboards/work_louder/work_board/config.h b/keyboards/work_louder/work_board/config.h index a7f5e165b1..ee6da3682d 100644 --- a/keyboards/work_louder/work_board/config.h +++ b/keyboards/work_louder/work_board/config.h @@ -183,17 +183,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define ENCODERS_PAD_B \ { B1 } -#define ENCODERS 1 - -#define ENCODERS_CW_KEY \ - { \ - { 12, 1 } \ - } -#define ENCODERS_CCW_KEY \ - { \ - { 12, 2 } \ - } - /* Bootmagic Lite key configuration */ //#define BOOTMAGIC_LITE_ROW 0 //#define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/work_louder/work_board/info.json b/keyboards/work_louder/work_board/info.json index a67ad3e1a7..cfb6e92810 100644 --- a/keyboards/work_louder/work_board/info.json +++ b/keyboards/work_louder/work_board/info.json @@ -1,11 +1,11 @@ { "keyboard_name": "Work Board", "manufacturer": "Work Louder", - "url": "", + "url": "https://worklouder.cc/", "maintainer": "Work Louder", "usb": { "vid": "0x574C", - "pid": "0xDCD0", + "pid": "0xDCD1", "device_version": "0.0.1" }, "layouts": { diff --git a/keyboards/work_louder/work_board/keymaps/via/keymap.c b/keyboards/work_louder/work_board/keymaps/via/keymap.c index fff7248afa..e68babc1a0 100644 --- a/keyboards/work_louder/work_board/keymaps/via/keymap.c +++ b/keyboards/work_louder/work_board/keymaps/via/keymap.c @@ -30,46 +30,33 @@ enum tap_dances { #define LOWER FN_MO13 #define RAISE FN_MO23 -#define LAYOUT_via( \ - k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, \ - k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k0c_a, \ - k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k0c_b, \ - k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \ -) \ -{ \ - { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c }, \ - { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k0c_a }, \ - { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k0c_b }, \ - { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, ___ } \ -} - // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_QWERTY] = LAYOUT_via( + [_QWERTY] = LAYOUT( KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, USER09, - KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_VOLU, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , KC_VOLD, + KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT ), - [_LOWER] = LAYOUT_via( + [_LOWER] = LAYOUT( KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, _______, - KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_PGDN, - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______, KC_PGUP, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), - [_RAISE] = LAYOUT_via( + [_RAISE] = LAYOUT( KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, _______, - KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_DOWN, - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______, KC_UP, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), - [_ADJUST] = LAYOUT_via( + [_ADJUST] = LAYOUT( _______, QK_BOOT, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , R_M_TOG, - _______, _______, MU_MOD, R_M_TOG, R_M_MOD, R_M_HUI, R_M_HUD, R_M_SAI, R_M_SAD, R_M_VAI, R_M_VAD, _______, R_M_HUI, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, R_M_HUD, + _______, _______, MU_MOD, R_M_TOG, R_M_MOD, R_M_HUI, R_M_HUD, R_M_SAI, R_M_SAD, R_M_VAI, R_M_VAD, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) }; @@ -127,3 +114,12 @@ layer_state_t layer_state_set_user(layer_state_t state) { return state; } + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_QWERTY] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, + [_LOWER] = { ENCODER_CCW_CW(KC_PGUP, KC_PGDN) }, + [_RAISE] = { ENCODER_CCW_CW(KC_UP, KC_DOWN) }, + [_ADJUST] = { ENCODER_CCW_CW(R_M_HUI, R_M_HUD) }, +}; +#endif diff --git a/keyboards/work_louder/work_board/keymaps/via/rules.mk b/keyboards/work_louder/work_board/keymaps/via/rules.mk index 7964f4279c..bdad0201e1 100644 --- a/keyboards/work_louder/work_board/keymaps/via/rules.mk +++ b/keyboards/work_louder/work_board/keymaps/via/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes TAP_DANCE_ENABLE = yes - -SRC += encoder_actions.c +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/work_louder/work_board/work_board.c b/keyboards/work_louder/work_board/work_board.c index d25ea0cdba..bd969f3009 100644 --- a/keyboards/work_louder/work_board/work_board.c +++ b/keyboards/work_louder/work_board/work_board.c @@ -16,7 +16,7 @@ #include "work_board.h" -#if !defined(VIA_ENABLE) && defined(ENCODER_ENABLE) +#if defined(ENCODER_ENABLE) bool encoder_update_kb(uint8_t index, bool clockwise) { if (!encoder_update_user(index, clockwise)) { return false; diff --git a/keyboards/work_louder/work_board/work_board.h b/keyboards/work_louder/work_board/work_board.h index f1bc74b704..284eecc430 100644 --- a/keyboards/work_louder/work_board/work_board.h +++ b/keyboards/work_louder/work_board/work_board.h @@ -17,7 +17,6 @@ #pragma once #include "quantum.h" -#include "encoder_actions.h" #include "rgb_functions.h" #define ___ KC_NO |