From d93b2e0b8beece90268af57179270c49af678431 Mon Sep 17 00:00:00 2001 From: Charly Delay Date: Thu, 6 Apr 2023 00:21:49 +0900 Subject: [PATCH 01/21] Update Dilemma 3x5+3 config ahead of upcoming release --- keyboards/bastardkb/dilemma/3x5_3/3x5_3.c | 123 +++++++---- keyboards/bastardkb/dilemma/3x5_3/config.h | 87 +++++++- keyboards/bastardkb/dilemma/3x5_3/halconf.h | 1 - keyboards/bastardkb/dilemma/3x5_3/info.json | 2 +- .../dilemma/3x5_3/keymaps/default/keymap.c | 2 +- .../dilemma/3x5_3/keymaps/via/config.h | 23 ++ .../dilemma/3x5_3/keymaps/via/keymap.c | 209 ++++++++++++++++++ .../dilemma/3x5_3/keymaps/via/readme.md | 47 ++++ .../dilemma/3x5_3/keymaps/via/rules.mk | 2 + keyboards/bastardkb/dilemma/3x5_3/mcuconf.h | 3 - keyboards/bastardkb/dilemma/3x5_3/readme.md | 4 +- keyboards/bastardkb/dilemma/3x5_3/rules.mk | 6 +- keyboards/bastardkb/dilemma/config.h | 3 + keyboards/bastardkb/dilemma/dilemma.c | 1 + 14 files changed, 454 insertions(+), 59 deletions(-) create mode 100644 keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h create mode 100644 keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c create mode 100644 keyboards/bastardkb/dilemma/3x5_3/keymaps/via/readme.md create mode 100644 keyboards/bastardkb/dilemma/3x5_3/keymaps/via/rules.mk diff --git a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c index b9787f473ee8..0540ac0d52e4 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c +++ b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c @@ -2,6 +2,7 @@ * Copyright 2020 Christopher Courtney (@drashna) * Copyright 2021 Quentin LEBASTARD * Copyright 2022 Charly Delay (@0xcharly) + * Copyright 2023 casuanoob (@casuanoob) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Publicw License as published by @@ -22,62 +23,102 @@ /** * LEDs index. * - * ╭────────────────────╮ ╭────────────────────╮ - * 2 3 8 9 12 30 27 26 21 20 - * ├────────────────────┤ ├────────────────────┤ - * 1 4 7 10 13 31 28 25 22 19 - * ├────────────────────┤ ├────────────────────┤ - * 0 5 6 11 14 32 29 24 23 18 - * ╰────────────────────╯ ╰────────────────────╯ - * 15 16 17 35 34 33 - * ╰────────────╯ ╰────────────╯ + * 0 - 17 Underglow 36 - 53 Underglow + * ╭────────────────────╮ ╭────────────────────╮ + * 22 21 20 19 18 54 55 56 57 58 + * ├────────────────────┤ ├────────────────────┤ + * 23 24 25 26 27 63 62 61 60 59 + * ├────────────────────┤ ├────────────────────┤ + * 32 31 30 29 28 64 65 66 67 68 + * ╰────────────────────╯ ╰────────────────────╯ + * 33 34 35 71 70 69 + * ╰────────────╯ ╰────────────╯ */ // clang-format off #ifdef RGB_MATRIX_ENABLE led_config_t g_led_config = { { /* Key Matrix to LED index. */ // Left split. - { 2, 3, 8, 9, 12 }, // Top row - { 1, 4, 7, 10, 13 }, // Middle row - { 0, 5, 6, 11, 14 }, // Bottom row - { 17, NO_LED, 15, 16, NO_LED }, // Thumb cluster + { 22, 21, 20, 19, 18 }, // Top row + { 23, 24, 25, 26, 27 }, // Middle row + { 32, 31, 30, 29, 28 }, // Bottom row + { 34, 35, 33, NO_LED, NO_LED }, // Thumb cluster // Right split. - { 20, 21, 26, 27, 30 }, // Top row - { 19, 22, 25, 28, 31 }, // Middle row - { 18, 23, 24, 29, 32 }, // Bottom row - { 35, NO_LED, 33, 34, NO_LED }, // Thumb cluster + { 58, 57, 56, 55, 54 }, // Top row + { 59, 60, 61, 62, 63 }, // Middle row + { 68, 67, 66, 65, 64 }, // Bottom row + { 70, 71, 69, NO_LED, NO_LED }, // Thumb cluster }, { /* LED index to physical position. */ - // Left split. - /* index=0 */ { 0, 42 }, { 0, 21 }, { 0, 0 }, // col 1 (left most) - /* index=3 */ { 18, 0 }, { 18, 21 }, { 18, 42 }, // col 2 - /* index=6 */ { 36, 42 }, { 36, 21 }, { 36, 0 }, - /* index=9 */ { 54, 0 }, { 54, 21 }, { 54, 42 }, - /* index=12 */ { 72, 0 }, { 72, 21 }, { 72, 42 }, - /* index=15 */ { 72, 64 }, { 90, 64 }, { 108, 64 }, // Thumb cluster - // Right split. - /* index=18 */ { 224, 42 }, { 224, 21 }, { 224, 0 }, // col 10 (right most) - /* index=21 */ { 206, 0 }, { 206, 21 }, { 206, 42 }, // col 9 - /* index=24 */ { 188, 42 }, { 188, 21 }, { 188, 0 }, - /* index=27 */ { 170, 0 }, { 170, 21 }, { 170, 42 }, - /* index=30 */ { 152, 0 }, { 152, 21 }, { 152, 42 }, - /* index=33 */ { 152, 64 }, { 134, 64 }, { 116, 64 }, // Thumb cluster + // Left split underglow. + /* index=0 */ { 82, 0 }, { 60, 0 }, { 22, 0 }, { 15, 0 }, // Top 4 + /* index=4 */ { 0, 25 }, { 0, 40 }, { 0, 55 }, // Pinky edge 3 + /* index=7 */ { 15, 45 }, { 30, 45 }, { 35, 60 }, { 55, 62 }, // Bottom 8 + /* index=11 */ { 72, 64 }, { 90, 64 }, { 98, 47 }, { 107, 40 }, + /* index=15 */ { 110, 33 }, { 110, 19 }, { 110, 5 }, // Inner edge 3 + // Left split per-key. + /* index=18 */ { 73, 11 }, { 56, 9 }, { 39, 5 }, { 22, 10 }, { 5, 15 }, // row 1 (left most) 90, 107 + /* index=23 */ { 5, 30 }, { 22, 25 }, { 39, 20 }, { 56, 24 }, { 73, 26 }, // row 2 (middle) + /* index=28 */ { 73, 41 }, { 56, 39 }, { 39, 35 }, { 22, 25 }, { 5, 45 }, // row 3 (left most) + /* index=33 */ { 45, 51 }, { 64, 53 }, { 81, 60 }, // Thumb cluster + // Right split underglow. + /* index=36 */ { 142, 0 }, { 164, 0 }, { 202, 0 }, { 209, 0 }, // Top 4 + /* index=40 */ { 224, 25 }, { 224, 40 }, { 224, 55 }, // Pinky edge 3 + /* index=43 */ { 209, 45 }, { 194, 45 }, { 189, 60 }, { 169, 62 }, // Bottom 8 + /* index=47 */ { 152, 64 }, { 134, 64 }, { 126, 47 }, { 117, 40 }, + /* index=51 */ { 114, 33 }, { 114, 19 }, { 114, 5 }, // Inner edge 3 + // Right split per-key. + /* index=54 */ { 151, 11 }, { 168, 9 }, { 185, 5 }, { 202, 10 }, { 219, 15 }, // row 1 (right most) 117 134 + /* index=59 */ { 219, 30 }, { 202, 25 }, { 185, 20 }, { 168, 24 }, { 151, 26 }, // row 2 (middle) + /* index=64 */ { 151, 41 }, { 168, 39 }, { 185, 35 }, { 202, 25 }, { 219, 45 }, // row 3 (right most) + /* index=69 */ { 179, 51 }, { 160, 53 }, { 143, 60 }, // Thumb cluster }, { /* LED index to flag. */ - // Left split. - /* index=0 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 1 - /* index=3 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 2 - /* index=6 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, - /* index=9 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, - /* index=12 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, - /* index=15 */ LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, // Thumb cluster - // Right split. - /* index=18 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 10 - /* index=21 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 9 + // Left split underglow. + /* index=0 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, + /* index=3 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, + /* index=6 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, + /* index=9 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, + /* index=12 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, + /* index=15 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, + // Left split per-key. + /* index=18 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 1 + /* index=21 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 2 /* index=24 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, /* index=27 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, /* index=30 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, /* index=33 */ LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, // Thumb cluster + // Right split underglow. + /* index=36 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, + /* index=39 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, + /* index=42 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, + /* index=45 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, + /* index=48 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, + /* index=51 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, + // Right split per-key. + /* index=54 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 10 + /* index=57 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 9 + /* index=60 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, + /* index=63 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, + /* index=66 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, + /* index=69 */ LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, // Thumb cluster } }; #endif // clang-format on + +#ifdef ENCODER_ENABLE +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { + return false; + } + switch (index) { + case 0: // Left-half encoder, mouse scroll. + tap_code(clockwise ? KC_MS_WH_UP : KC_MS_WH_DOWN); + break; + case 1: // Right-half encoder, volume control. + tap_code(clockwise ? KC_AUDIO_VOL_UP : KC_AUDIO_VOL_DOWN); + break; + } + return true; +} +#endif // ENCODER_ENABLE diff --git a/keyboards/bastardkb/dilemma/3x5_3/config.h b/keyboards/bastardkb/dilemma/3x5_3/config.h index 8604597ff8ab..ccbc4e2f5895 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/config.h +++ b/keyboards/bastardkb/dilemma/3x5_3/config.h @@ -1,5 +1,6 @@ /** * Copyright 2022 Charly Delay (@0xcharly) + * Copyright 2023 casuanoob (@casuanoob) * * 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 @@ -21,33 +22,101 @@ #define SPLIT_HAND_PIN GP29 #define SPLIT_HAND_PIN_LOW_IS_LEFT // High -> right, Low -> left. +/* VBUS detection. */ +#define USB_VBUS_PIN GP19 + /* CRC. */ #define CRC8_USE_TABLE #define CRC8_OPTIMIZE_SPEED +/* Encoders. */ +#define ENCODERS_PAD_A \ + { GP25 } +#define ENCODERS_PAD_B \ + { GP24 } + /* Cirque trackpad over SPI. */ #define SPI_SCK_PIN GP22 #define SPI_MOSI_PIN GP23 #define SPI_MISO_PIN GP20 #define POINTING_DEVICE_CS_PIN GP21 - -/* OLED over i2c. */ -#define I2C1_CLOCK_SPEED 400000 -#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_16_9 -#define OLED_DISPLAY_HEIGHT 128 +#undef CIRQUE_PINNACLE_DIAMETER_MM +#define CIRQUE_PINNACLE_DIAMETER_MM 40 /* Reset. */ #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP17 -#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 1000U + +/* Bootmagic. */ +#define BOOTMAGIC_LITE_ROW_RIGHT 4 +#define BOOTMAGIC_LITE_COLUMN_RIGHT 0 /* RGB matrix support. */ #ifdef RGB_MATRIX_ENABLE # define SPLIT_TRANSPORT_MIRROR -# define RGB_MATRIX_LED_COUNT 36 -# define RGB_MATRIX_SPLIT { 18, 18 } +# define RGB_MATRIX_LED_COUNT 72 +# define RGB_MATRIX_SPLIT { 36, 36 } # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 50 -# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS # define RGB_DISABLE_WHEN_USB_SUSPENDED # define RGB_MATRIX_KEYPRESSES +# define RGB_MATRIX_FRAMEBUFFER_EFFECTS + +// Startup values. +# define RGB_MATRIX_DEFAULT_HUE 0 +# define RGB_MATRIX_DEFAULT_SAT 255 +# define RGB_MATRIX_DEFAULT_VAL 64 +# define RGB_MATRIX_DEFAULT_HSV RGB_MATRIX_DEFAULT_HUE, RGB_MATRIX_DEFAULT_SAT, RGB_MATRIX_DEFAULT_VAL + +// Rainbow swirl as startup mode. +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT + +// Slow swirl at startup. +# define RGB_MATRIX_DEFAULT_SPD 32 + +// Enable all animations on ARM boards since they have plenty of memory +// available for it. +# define ENABLE_RGB_MATRIX_ALPHAS_MODS +# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_BREATHING +# define ENABLE_RGB_MATRIX_BAND_SAT +# define ENABLE_RGB_MATRIX_BAND_VAL +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_DUAL_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +# define ENABLE_RGB_MATRIX_HUE_BREATHING +# define ENABLE_RGB_MATRIX_HUE_PENDULUM +# define ENABLE_RGB_MATRIX_HUE_WAVE +# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL +# define ENABLE_RGB_MATRIX_PIXEL_FLOW +# define ENABLE_RGB_MATRIX_PIXEL_RAIN +# define ENABLE_RGB_MATRIX_TYPING_HEATMAP +# define ENABLE_RGB_MATRIX_DIGITAL_RAIN +# 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 #endif diff --git a/keyboards/bastardkb/dilemma/3x5_3/halconf.h b/keyboards/bastardkb/dilemma/3x5_3/halconf.h index b79b0f9e8867..57d15376d63a 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/halconf.h +++ b/keyboards/bastardkb/dilemma/3x5_3/halconf.h @@ -17,7 +17,6 @@ #pragma once -#define HAL_USE_I2C TRUE #define HAL_USE_SPI TRUE #include_next diff --git a/keyboards/bastardkb/dilemma/3x5_3/info.json b/keyboards/bastardkb/dilemma/3x5_3/info.json index 4ab43d6a8e84..3eb718f19cba 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/info.json +++ b/keyboards/bastardkb/dilemma/3x5_3/info.json @@ -2,7 +2,7 @@ "keyboard_name": "Dilemma (3x5+3) Assembled", "usb": { "device_version": "2.0.0", - "pid": "0x1835" + "pid": "0x1836" }, "rgb_matrix": { "driver": "ws2812" diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c index 30fef9bbeb01..7b2f7eaf7094 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ KC_LSFT, KC_LCTL, KC_LALT, KC_RGUI, KC_VOLD, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSPC, // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ - QK_BOOT, EE_CLR, KC_MPRV, KC_MNXT, KC_MPLY, XXXXXXX, KC_PGDN, KC_PGUP, XXXXXXX, KC_ENT, + QK_BOOT, EE_CLR, KC_MPRV, KC_MNXT, KC_MPLY, XXXXXXX, KC_PGDN, KC_PGUP, XXXXXXX, KC_ENT, // ╰─────────────────────────────────────────────┤ ├─────────────────────────────────────────────╯ KC_A, _______, KC_LSFT, KC_SPC, _______, KC_A // ╰───────────────────────────╯ ╰──────────────────────────╯ diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h new file mode 100644 index 000000000000..ba44df95a8c8 --- /dev/null +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h @@ -0,0 +1,23 @@ +/** + * Copyright 2021 Charly Delay (@0xcharly) + * Copyright 2023 casuanoob (@casuanoob) + * + * 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 2 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 . + */ +#pragma once + +#ifdef VIA_ENABLE +/* VIA configuration. */ +# define DYNAMIC_KEYMAP_LAYER_COUNT 8 +#endif // VIA_ENABLE diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c new file mode 100644 index 000000000000..be921e5f1c5f --- /dev/null +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c @@ -0,0 +1,209 @@ +/** + * Copyright 2022 Charly Delay (@0xcharly) + * Copyright 2023 casuanoob (@casuanoob) + * + * 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 2 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 . + */ + +#include QMK_KEYBOARD_H + +enum dilemma_keymap_layers { + LAYER_BASE = 0, + LAYER_FUNCTION, + LAYER_NAVIGATION, + LAYER_POINTER, + LAYER_NUMERAL, + LAYER_SYMBOLS, +}; + +// Automatically enable sniping-mode on the pointer layer. +// #define DILEMMA_AUTO_SNIPING_ON_LAYER LAYER_POINTER + +#define SPC_NAV LT(LAYER_NAVIGATION, KC_SPC) +#define TAB_FUN LT(LAYER_FUNCTION, KC_TAB) +#define ENT_SYM LT(LAYER_SYMBOLS, KC_ENT) +#define BSP_NUM LT(LAYER_NUMERAL, KC_BSPC) +#define _L_PTR(KC) LT(LAYER_POINTER, KC) + +#ifndef POINTING_DEVICE_ENABLE +# define DRGSCRL KC_NO +# define DPI_MOD KC_NO +# define S_D_MOD KC_NO +# define SNIPING KC_NO +#endif // !POINTING_DEVICE_ENABLE + +// clang-format off +/** \brief QWERTY layout (3 rows, 10 columns). */ +#define LAYOUT_LAYER_BASE \ + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, \ + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \ + CW_TOGG, TAB_FUN, SPC_NAV, ENT_SYM, BSP_NUM, KC_MUTE + +/** Convenience row shorthands. */ +#define _______________DEAD_HALF_ROW_______________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#define ______________HOME_ROW_GACS_L______________ KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX +#define ______________HOME_ROW_GACS_R______________ XXXXXXX, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI + +/* + * Layers used on the Dilemma. + * + * These layers started off heavily inspired by the Miryoku layout, but trimmed + * down and tailored for a stock experience that is meant to be fundation for + * further personalization. + * + * See https://github.com/manna-harbour/miryoku for the original layout. + */ + +/** + * \brief Function layer. + * + * Secondary right-hand layer has function keys mirroring the numerals on the + * primary layer with extras on the pinkie column, plus system keys on the inner + * column. App is on the tertiary thumb key and other thumb keys are duplicated + * from the base layer to enable auto-repeat. + */ +#define LAYOUT_LAYER_FUNCTION \ + _______________DEAD_HALF_ROW_______________, KC_PSCR, KC_F7, KC_F8, KC_F9, KC_F12, \ + ______________HOME_ROW_GACS_L______________, KC_SCRL, KC_F4, KC_F5, KC_F6, KC_F11, \ + _______________DEAD_HALF_ROW_______________, KC_PAUS, KC_F1, KC_F2, KC_F3, KC_F10, \ + XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + +/** \brief Mouse emulation and pointer functions. */ +#define LAYOUT_LAYER_POINTER \ + QK_BOOT, EE_CLR, XXXXXXX, DPI_MOD, S_D_MOD, S_D_MOD, DPI_MOD, XXXXXXX, EE_CLR, QK_BOOT, \ + ______________HOME_ROW_GACS_L______________, ______________HOME_ROW_GACS_R______________, \ + _______, DRGSCRL, SNIPING, KC_BTN3, XXXXXXX, XXXXXXX, KC_BTN3, SNIPING, DRGSCRL, _______, \ + KC_BTN3, KC_BTN2, KC_BTN1, KC_BTN1, KC_BTN2, KC_BTN3 + +/** + * \brief Navigation layer. + * + * Primary right-hand layer (left home thumb) is navigation and editing. Cursor + * keys are on the home position, line and page movement below, clipboard above, + * caps lock and insert on the inner column. Thumb keys are duplicated from the + * base layer to avoid having to layer change mid edit and to enable auto-repeat. + */ +#define LAYOUT_LAYER_NAVIGATION \ + _______________DEAD_HALF_ROW_______________, _______________DEAD_HALF_ROW_______________, \ + ______________HOME_ROW_GACS_L______________, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, \ + _______________DEAD_HALF_ROW_______________, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, \ + XXXXXXX, XXXXXXX, _______, KC_ENT, KC_BSPC, KC_DEL + +/** + * \brief Numeral layout. + * + * Primary left-hand layer (right home thumb) is numerals and symbols. Numerals + * are in the standard numpad locations with symbols in the remaining positions. + * `KC_DOT` is duplicated from the base layer. + */ +#define LAYOUT_LAYER_NUMERAL \ + KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, _______________DEAD_HALF_ROW_______________, \ + KC_SCLN, KC_4, KC_5, KC_6, KC_EQL, ______________HOME_ROW_GACS_R______________, \ + KC_DOT, KC_1, KC_2, KC_3, KC_BSLS, _______________DEAD_HALF_ROW_______________, \ + KC_DOT, KC_MINS, KC_0, XXXXXXX, _______, XXXXXXX + +/** + * \brief Symbols layer. + * + * Secondary left-hand layer has shifted symbols in the same locations to reduce + * chording when using mods with shifted symbols. `KC_LPRN` is duplicated next to + * `KC_RPRN`. + */ +#define LAYOUT_LAYER_SYMBOLS \ + KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR, _______________DEAD_HALF_ROW_______________, \ + KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS, ______________HOME_ROW_GACS_R______________, \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, _______________DEAD_HALF_ROW_______________, \ + KC_LPRN, KC_GRV, KC_UNDS, _______, XXXXXXX, XXXXXXX + +/** + * \brief Add Home Row mod to a layout. + * + * Expects a 10-key per row layout. Adds support for GACS (Gui, Alt, Ctl, Shift) + * home row. The layout passed in parameter must contain at least 20 keycodes. + * + * This is meant to be used with `LAYER_ALPHAS_QWERTY` defined above, eg.: + * + * HOME_ROW_MOD_GACS(LAYER_ALPHAS_QWERTY) + */ +#define _HOME_ROW_MOD_GACS( \ + L00, L01, L02, L03, L04, R05, R06, R07, R08, R09, \ + L10, L11, L12, L13, L14, R15, R16, R17, R18, R19, \ + ...) \ + L00, L01, L02, L03, L04, \ + R05, R06, R07, R08, R09, \ + LGUI_T(L10), LALT_T(L11), LCTL_T(L12), LSFT_T(L13), L14, \ + R15, RSFT_T(R16), RCTL_T(R17), LALT_T(R18), RGUI_T(R19), \ + __VA_ARGS__ +#define HOME_ROW_MOD_GACS(...) _HOME_ROW_MOD_GACS(__VA_ARGS__) + +/** + * \brief Add pointer layer keys to a layout. + * + * Expects a 10-key per row layout. The layout passed in parameter must contain + * at least 30 keycodes. + * + * This is meant to be used with `LAYER_ALPHAS_QWERTY` defined above, eg.: + * + * POINTER_MOD(LAYER_ALPHAS_QWERTY) + */ +#define _POINTER_MOD( \ + L00, L01, L02, L03, L04, R05, R06, R07, R08, R09, \ + L10, L11, L12, L13, L14, R15, R16, R17, R18, R19, \ + L20, L21, L22, L23, L24, R25, R26, R27, R28, R29, \ + ...) \ + L00, L01, L02, L03, L04, \ + R05, R06, R07, R08, R09, \ + L10, L11, L12, L13, L14, \ + R15, R16, R17, R18, R19, \ + _L_PTR(L20), L21, L22, L23, L24, \ + R25, R26, R27, R28, _L_PTR(R29), \ + __VA_ARGS__ +#define POINTER_MOD(...) _POINTER_MOD(__VA_ARGS__) + +#define LAYOUT_wrapper(...) LAYOUT_split_3x5_3(__VA_ARGS__) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [LAYER_BASE] = LAYOUT_wrapper( + POINTER_MOD(HOME_ROW_MOD_GACS(LAYOUT_LAYER_BASE)) + ), + [LAYER_FUNCTION] = LAYOUT_wrapper(LAYOUT_LAYER_FUNCTION), + [LAYER_NAVIGATION] = LAYOUT_wrapper(LAYOUT_LAYER_NAVIGATION), + [LAYER_NUMERAL] = LAYOUT_wrapper(LAYOUT_LAYER_NUMERAL), + [LAYER_POINTER] = LAYOUT_wrapper(LAYOUT_LAYER_POINTER), + [LAYER_SYMBOLS] = LAYOUT_wrapper(LAYOUT_LAYER_SYMBOLS), +}; +// clang-format on + +#ifdef POINTING_DEVICE_ENABLE +# ifdef DILEMMA_AUTO_SNIPING_ON_LAYER +layer_state_t layer_state_set_user(layer_state_t state) { + dilemma_set_pointer_sniping_enabled(layer_state_cmp(state, DILEMMA_AUTO_SNIPING_ON_LAYER)); + return state; +} +# endif // DILEMMA_AUTO_SNIPING_ON_LAYER +#endif // POINTING_DEVICE_ENABLE + +#ifdef ENCODER_MAP_ENABLE +// clang-format off +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [LAYER_BASE] = {ENCODER_CCW_CW(KC_WH_D, KC_WH_U), ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [LAYER_FUNCTION] = {ENCODER_CCW_CW(KC_DOWN, KC_UP), ENCODER_CCW_CW(KC_LEFT, KC_RGHT)}, + [LAYER_NAVIGATION] = {ENCODER_CCW_CW(KC_PGDN, KC_PGUP), ENCODER_CCW_CW(KC_VOLU, KC_VOLD)}, + [LAYER_POINTER] = {ENCODER_CCW_CW(RGB_HUD, RGB_HUI), ENCODER_CCW_CW(RGB_SAD, RGB_SAI)}, + [LAYER_NUMERAL] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(RGB_SPD, RGB_SPI)}, + [LAYER_SYMBOLS] = {ENCODER_CCW_CW(RGB_RMOD, RGB_MOD), ENCODER_CCW_CW(KC_LEFT, KC_RGHT)}, +}; +// clang-format on +#endif // ENCODER_MAP_ENABLE diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/readme.md b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/readme.md new file mode 100644 index 000000000000..4552f0948dc2 --- /dev/null +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/readme.md @@ -0,0 +1,47 @@ +# Dilemma `via` keymap + +The Dilemma `via` keymap is based on a QWERTY layout with [home row mods](https://precondition.github.io/home-row-mods) and [Miryoku-inspired layers](https://github.com/manna-harbour/miryoku), and some features and changes specific to the Dilemma. + +This layout also supports VIA. + +## Customizing the keymap + +### Dynamic DPI scaling + +Use the following keycodes to change the default DPI: + +- `POINTER_DEFAULT_DPI_FORWARD`: increases the DPI; decreases when shifted; +- `POINTER_DEFAULT_DPI_REVERSE`: decreases the DPI; increases when shifted. + +There's a maximum of 16 possible values for the sniping mode DPI. See the [Dilemma documentation](../../README.md) for more information. + +Use the following keycodes to change the sniping mode DPI: + +- `POINTER_SNIPING_DPI_FORWARD`: increases the DPI; decreases when shifted; +- `POINTER_SNIPING_DPI_REVERSE`: decreases the DPI; increases when shifted. + +There's a maximum of 4 possible values for the sniping mode DPI. See the [Dilemma documentation](../../README.md) for more information. + +### Drag-scroll + +Use the `DRAGSCROLL_MODE` keycode to enable drag-scroll on hold. Use the `DRAGSCROLL_TOGGLE` keycode to enable/disable drag-scroll on key press. + +### Circular scroll + +By default, the firmware is configured to enable the circular scroll feature on Cirque trackpad. + +To disable this, add the following to your keymap: + +```c +#undef POINTING_DEVICE_GESTURES_SCROLL_ENABLE +``` + +### Sniping + +Use the `SNIPING_MODE` keycode to enable sniping mode on hold. Use the `SNIPING_TOGGLE` keycode to enable/disable sniping mode on key press. + +Change the value of `DILEMMA_AUTO_SNIPING_ON_LAYER` to automatically enable sniping mode on layer change. By default, sniping mode is enabled on the pointer layer: + +```c +#define DILEMMA_AUTO_SNIPING_ON_LAYER LAYER_POINTER +``` \ No newline at end of file diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/rules.mk b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/rules.mk new file mode 100644 index 000000000000..715838ecc5d9 --- /dev/null +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +ENCODER_MAP_ENABLE = yes +VIA_ENABLE = yes diff --git a/keyboards/bastardkb/dilemma/3x5_3/mcuconf.h b/keyboards/bastardkb/dilemma/3x5_3/mcuconf.h index f194dd225ced..81821c159dca 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/mcuconf.h +++ b/keyboards/bastardkb/dilemma/3x5_3/mcuconf.h @@ -21,6 +21,3 @@ #undef RP_SPI_USE_SPI1 #define RP_SPI_USE_SPI1 TRUE - -#undef RP_I2C_USE_I2C1 -#define RP_I2C_USE_I2C1 TRUE diff --git a/keyboards/bastardkb/dilemma/3x5_3/readme.md b/keyboards/bastardkb/dilemma/3x5_3/readme.md index bfddbc9efc38..b57df90921cf 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/readme.md +++ b/keyboards/bastardkb/dilemma/3x5_3/readme.md @@ -1,5 +1,5 @@ -# Next generation Dilemma keyboard +# Dilemma v2 (3x5+3 assembled) This keyboard is an updated version of the [3x5+2 Dilemma](../3x5_2/). -This is still under active development, and not available publicly yet. +The Dilemma v2 is available at [bastardkb.com](https://bastardkb.com). diff --git a/keyboards/bastardkb/dilemma/3x5_3/rules.mk b/keyboards/bastardkb/dilemma/3x5_3/rules.mk index 3cdb41160c21..735186b24783 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/rules.mk +++ b/keyboards/bastardkb/dilemma/3x5_3/rules.mk @@ -6,10 +6,14 @@ MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = no # Enable N-Key Rollover +NKRO_ENABLE = yes # Enable N-Key Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output +MAGIC_ENABLE = yes # Magic keycodes +TRI_LAYER_ENABLE = yes # Tri Layers +CAPS_WORD_ENABLE = yes # Caps Word +ENCODER_ENABLE = yes # Enable encoder support AUDIO_SUPPORTED = no # Audio is not supported RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default diff --git a/keyboards/bastardkb/dilemma/config.h b/keyboards/bastardkb/dilemma/config.h index d282c635eab4..0da85ec99ade 100644 --- a/keyboards/bastardkb/dilemma/config.h +++ b/keyboards/bastardkb/dilemma/config.h @@ -26,6 +26,9 @@ // Pointing device is on the right split. #define POINTING_DEVICE_RIGHT +// Enables support for extended i16 mouse reports (instead of i8). +#define MOUSE_EXTENDED_REPORT + // Limits the frequency that the sensor is polled for motion. #define POINTING_DEVICE_TASK_THROTTLE_MS 10 diff --git a/keyboards/bastardkb/dilemma/dilemma.c b/keyboards/bastardkb/dilemma/dilemma.c index 7c87fdcadd61..2f75cbc0a0e3 100644 --- a/keyboards/bastardkb/dilemma/dilemma.c +++ b/keyboards/bastardkb/dilemma/dilemma.c @@ -2,6 +2,7 @@ * Copyright 2020 Christopher Courtney (@drashna) * Copyright 2021 Quentin LEBASTARD * Copyright 2022 Charly Delay (@0xcharly) + * Copyright 2023 casuanoob (@casuanoob) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Publicw License as published by From 3cc1788acc67c02eed212b43a431da73bbd207f0 Mon Sep 17 00:00:00 2001 From: Charly Delay Date: Tue, 8 Aug 2023 22:37:54 +0900 Subject: [PATCH 02/21] Fix Dilemma 3x5+3 RGB pin definition --- keyboards/bastardkb/dilemma/3x5_3/info.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/info.json b/keyboards/bastardkb/dilemma/3x5_3/info.json index 3eb718f19cba..d64694229bba 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/info.json +++ b/keyboards/bastardkb/dilemma/3x5_3/info.json @@ -19,7 +19,7 @@ "split_count": [18, 18] }, "ws2812": { - "pin": "GP0", + "pin": "GP10", "driver": "vendor" }, "processor": "RP2040", From 9353250cdcf94a6ac70560f9049162735675ae1c Mon Sep 17 00:00:00 2001 From: casuanoob Date: Sun, 3 Sep 2023 02:43:43 +1000 Subject: [PATCH 03/21] migrate dilemma 3x5_3 RGB layout to info.json --- keyboards/bastardkb/dilemma/3x5_3/info.json | 126 ++++++++++++++++++-- 1 file changed, 118 insertions(+), 8 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/info.json b/keyboards/bastardkb/dilemma/3x5_3/info.json index d64694229bba..2f3f21fa0484 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/info.json +++ b/keyboards/bastardkb/dilemma/3x5_3/info.json @@ -4,26 +4,136 @@ "device_version": "2.0.0", "pid": "0x1836" }, - "rgb_matrix": { - "driver": "ws2812" - }, + "processor": "RP2040", + "bootloader": "rp2040", "matrix_pins": { "cols": ["GP8", "GP9", "GP7", "GP6", "GP28"], "rows": ["GP4", "GP5", "GP27", "GP26"] }, "diode_direction": "ROW2COL", "split": { - "soft_serial_pin": "GP1" + "enabled": true, + "soft_serial_pin": "GP1", + "bootmagic": { + "matrix": [4, 0] + }, }, - "rgblight": { - "split_count": [18, 18] + "encoder": { + "enabled" : true, + "rotary" : [ + {"pin_a": "GP25", "pin_b": "GP24"} + ] + }, + "features": { + "bootmagic": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true + }, + "caps_word": { + "enabled": true, }, "ws2812": { "pin": "GP10", "driver": "vendor" }, - "processor": "RP2040", - "bootloader": "rp2040", + "rgb_matrix": { + "driver": "ws2812", + "split_count": [36, 36], + "max_brightness": 128, + "layout": [ + {"x": 82, "y": 0, "flags": 2}, + {"x": 60, "y": 0, "flags": 2}, + {"x": 22, "y": 0, "flags": 2}, + {"x": 15, "y": 0, "flags": 2}, + + {"x": 0, "y": 25, "flags": 2}, + {"x": 0, "y": 40, "flags": 2}, + {"x": 0, "y": 55, "flags": 2}, + + {"x": 15, "y": 45, "flags": 2}, + {"x": 30, "y": 45, "flags": 2}, + {"x": 35, "y": 60, "flags": 2}, + {"x": 55, "y": 62, "flags": 2}, + + {"x": 72, "y": 64, "flags": 2}, + {"x": 90, "y": 64, "flags": 2}, + {"x": 98, "y": 47, "flags": 2}, + {"x": 107, "y": 40, "flags": 2}, + + {"x": 110, "y": 33, "flags": 2}, + {"x": 110, "y": 19, "flags": 2}, + {"x": 110, "y": 5, "flags": 2}, + + {"matrix": [0, 4], "x": 73, "y": 11, "flags": 4}, + {"matrix": [0, 3], "x": 56, "y": 9, "flags": 4}, + {"matrix": [0, 2], "x": 39, "y": 5, "flags": 4}, + {"matrix": [0, 1], "x": 22, "y": 10, "flags": 4}, + {"matrix": [0, 0], "x": 5, "y": 15, "flags": 4}, + + {"matrix": [1, 0], "x": 5, "y": 30, "flags": 4}, + {"matrix": [1, 1], "x": 22, "y": 25, "flags": 4}, + {"matrix": [1, 2], "x": 39, "y": 20, "flags": 4}, + {"matrix": [1, 3], "x": 56, "y": 24, "flags": 4}, + {"matrix": [1, 4], "x": 73, "y": 26, "flags": 4}, + + {"matrix": [2, 4], "x": 73, "y": 41, "flags": 4}, + {"matrix": [2, 3], "x": 56, "y": 39, "flags": 4}, + {"matrix": [2, 2], "x": 39, "y": 35, "flags": 4}, + {"matrix": [2, 1], "x": 22, "y": 40, "flags": 4}, + {"matrix": [2, 0], "x": 5, "y": 45, "flags": 4}, + + {"matrix": [3, 2], "x": 45, "y": 51, "flags": 4}, + {"matrix": [3, 0], "x": 64, "y": 53, "flags": 4}, + {"matrix": [3, 1], "x": 81, "y": 60, "flags": 4}, + + {"x": 142, "y": 0, "flags": 2}, + {"x": 164, "y": 0, "flags": 2}, + {"x": 202, "y": 0, "flags": 2}, + {"x": 209, "y": 0, "flags": 2}, + + {"x": 224, "y": 25, "flags": 2}, + {"x": 224, "y": 40, "flags": 2}, + {"x": 224, "y": 55, "flags": 2}, + + {"x": 209, "y": 45, "flags": 2}, + {"x": 194, "y": 45, "flags": 2}, + {"x": 189, "y": 60, "flags": 2}, + {"x": 169, "y": 62, "flags": 2}, + + {"x": 152, "y": 64, "flags": 2}, + {"x": 134, "y": 64, "flags": 2}, + {"x": 126, "y": 47, "flags": 2}, + {"x": 117, "y": 40, "flags": 2}, + + {"x": 114, "y": 33, "flags": 2}, + {"x": 114, "y": 19, "flags": 2}, + {"x": 114, "y": 5, "flags": 2}, + + {"matrix": [4, 4], "x": 151, "y": 11, "flags": 4}, + {"matrix": [4, 3], "x": 168, "y": 9, "flags": 4}, + {"matrix": [4, 2], "x": 185, "y": 5, "flags": 4}, + {"matrix": [4, 1], "x": 202, "y": 10, "flags": 4}, + {"matrix": [4, 0], "x": 219, "y": 15, "flags": 4}, + + {"matrix": [5, 0], "x": 219, "y": 30, "flags": 4}, + {"matrix": [5, 1], "x": 202, "y": 25, "flags": 4}, + {"matrix": [5, 2], "x": 185, "y": 20, "flags": 4}, + {"matrix": [5, 3], "x": 168, "y": 24, "flags": 4}, + {"matrix": [5, 4], "x": 151, "y": 26, "flags": 4}, + + {"matrix": [6, 4], "x": 151, "y": 41, "flags": 4}, + {"matrix": [6, 3], "x": 168, "y": 39, "flags": 4}, + {"matrix": [6, 2], "x": 185, "y": 35, "flags": 4}, + {"matrix": [6, 1], "x": 202, "y": 40, "flags": 4}, + {"matrix": [6, 0], "x": 219, "y": 45, "flags": 4}, + + {"matrix": [7, 2], "x": 179, "y": 51, "flags": 4}, + {"matrix": [7, 0], "x": 160, "y": 53, "flags": 4}, + {"matrix": [7, 1], "x": 143, "y": 60, "flags": 4} + ] + }, "community_layouts": ["split_3x5_3"], "layouts": { "LAYOUT_split_3x5_3": { From 701b0734eb94d2404acb5cbb8aa05bd88b2cb21b Mon Sep 17 00:00:00 2001 From: casuanoob Date: Thu, 7 Sep 2023 06:23:16 +1000 Subject: [PATCH 04/21] Migrate Dilemma 3x5_3 to info.json Remove rgb matrix layout macro from 3x5_3.c Remove defines from config.h and rules.mk that are now in info.json Refactor default keymap to use core tri-layer subsystem Added default keymap readme --- keyboards/bastardkb/dilemma/3x5_3/3x5_3.c | 86 ------------------- keyboards/bastardkb/dilemma/3x5_3/config.h | 13 --- .../dilemma/3x5_3/keymaps/default/keymap.c | 23 +++-- .../dilemma/3x5_3/keymaps/default/readme.md | 3 + keyboards/bastardkb/dilemma/3x5_3/rules.mk | 21 +++-- 5 files changed, 25 insertions(+), 121 deletions(-) create mode 100644 keyboards/bastardkb/dilemma/3x5_3/keymaps/default/readme.md diff --git a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c index 0540ac0d52e4..8a1fa43a578f 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c +++ b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c @@ -20,92 +20,6 @@ #include "quantum.h" -/** - * LEDs index. - * - * 0 - 17 Underglow 36 - 53 Underglow - * ╭────────────────────╮ ╭────────────────────╮ - * 22 21 20 19 18 54 55 56 57 58 - * ├────────────────────┤ ├────────────────────┤ - * 23 24 25 26 27 63 62 61 60 59 - * ├────────────────────┤ ├────────────────────┤ - * 32 31 30 29 28 64 65 66 67 68 - * ╰────────────────────╯ ╰────────────────────╯ - * 33 34 35 71 70 69 - * ╰────────────╯ ╰────────────╯ - */ -// clang-format off -#ifdef RGB_MATRIX_ENABLE -led_config_t g_led_config = { { - /* Key Matrix to LED index. */ - // Left split. - { 22, 21, 20, 19, 18 }, // Top row - { 23, 24, 25, 26, 27 }, // Middle row - { 32, 31, 30, 29, 28 }, // Bottom row - { 34, 35, 33, NO_LED, NO_LED }, // Thumb cluster - // Right split. - { 58, 57, 56, 55, 54 }, // Top row - { 59, 60, 61, 62, 63 }, // Middle row - { 68, 67, 66, 65, 64 }, // Bottom row - { 70, 71, 69, NO_LED, NO_LED }, // Thumb cluster -}, { - /* LED index to physical position. */ - // Left split underglow. - /* index=0 */ { 82, 0 }, { 60, 0 }, { 22, 0 }, { 15, 0 }, // Top 4 - /* index=4 */ { 0, 25 }, { 0, 40 }, { 0, 55 }, // Pinky edge 3 - /* index=7 */ { 15, 45 }, { 30, 45 }, { 35, 60 }, { 55, 62 }, // Bottom 8 - /* index=11 */ { 72, 64 }, { 90, 64 }, { 98, 47 }, { 107, 40 }, - /* index=15 */ { 110, 33 }, { 110, 19 }, { 110, 5 }, // Inner edge 3 - // Left split per-key. - /* index=18 */ { 73, 11 }, { 56, 9 }, { 39, 5 }, { 22, 10 }, { 5, 15 }, // row 1 (left most) 90, 107 - /* index=23 */ { 5, 30 }, { 22, 25 }, { 39, 20 }, { 56, 24 }, { 73, 26 }, // row 2 (middle) - /* index=28 */ { 73, 41 }, { 56, 39 }, { 39, 35 }, { 22, 25 }, { 5, 45 }, // row 3 (left most) - /* index=33 */ { 45, 51 }, { 64, 53 }, { 81, 60 }, // Thumb cluster - // Right split underglow. - /* index=36 */ { 142, 0 }, { 164, 0 }, { 202, 0 }, { 209, 0 }, // Top 4 - /* index=40 */ { 224, 25 }, { 224, 40 }, { 224, 55 }, // Pinky edge 3 - /* index=43 */ { 209, 45 }, { 194, 45 }, { 189, 60 }, { 169, 62 }, // Bottom 8 - /* index=47 */ { 152, 64 }, { 134, 64 }, { 126, 47 }, { 117, 40 }, - /* index=51 */ { 114, 33 }, { 114, 19 }, { 114, 5 }, // Inner edge 3 - // Right split per-key. - /* index=54 */ { 151, 11 }, { 168, 9 }, { 185, 5 }, { 202, 10 }, { 219, 15 }, // row 1 (right most) 117 134 - /* index=59 */ { 219, 30 }, { 202, 25 }, { 185, 20 }, { 168, 24 }, { 151, 26 }, // row 2 (middle) - /* index=64 */ { 151, 41 }, { 168, 39 }, { 185, 35 }, { 202, 25 }, { 219, 45 }, // row 3 (right most) - /* index=69 */ { 179, 51 }, { 160, 53 }, { 143, 60 }, // Thumb cluster -}, { - /* LED index to flag. */ - // Left split underglow. - /* index=0 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, - /* index=3 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, - /* index=6 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, - /* index=9 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, - /* index=12 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, - /* index=15 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, - // Left split per-key. - /* index=18 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 1 - /* index=21 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 2 - /* index=24 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, - /* index=27 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, - /* index=30 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, - /* index=33 */ LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, // Thumb cluster - // Right split underglow. - /* index=36 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, - /* index=39 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, - /* index=42 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, - /* index=45 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, - /* index=48 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, - /* index=51 */ LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, - // Right split per-key. - /* index=54 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 10 - /* index=57 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 9 - /* index=60 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, - /* index=63 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, - /* index=66 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, - /* index=69 */ LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, // Thumb cluster -} }; -#endif -// clang-format on - #ifdef ENCODER_ENABLE bool encoder_update_kb(uint8_t index, bool clockwise) { if (!encoder_update_user(index, clockwise)) { diff --git a/keyboards/bastardkb/dilemma/3x5_3/config.h b/keyboards/bastardkb/dilemma/3x5_3/config.h index ccbc4e2f5895..924b37c217c4 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/config.h +++ b/keyboards/bastardkb/dilemma/3x5_3/config.h @@ -29,12 +29,6 @@ #define CRC8_USE_TABLE #define CRC8_OPTIMIZE_SPEED -/* Encoders. */ -#define ENCODERS_PAD_A \ - { GP25 } -#define ENCODERS_PAD_B \ - { GP24 } - /* Cirque trackpad over SPI. */ #define SPI_SCK_PIN GP22 #define SPI_MOSI_PIN GP23 @@ -47,16 +41,9 @@ #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP17 -/* Bootmagic. */ -#define BOOTMAGIC_LITE_ROW_RIGHT 4 -#define BOOTMAGIC_LITE_COLUMN_RIGHT 0 - /* RGB matrix support. */ #ifdef RGB_MATRIX_ENABLE # define SPLIT_TRANSPORT_MIRROR -# define RGB_MATRIX_LED_COUNT 72 -# define RGB_MATRIX_SPLIT { 36, 36 } -# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 50 # define RGB_DISABLE_WHEN_USB_SUSPENDED # define RGB_MATRIX_KEYPRESSES # define RGB_MATRIX_FRAMEBUFFER_EFFECTS diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c index 7b2f7eaf7094..9c19afc30a2e 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c @@ -15,6 +15,7 @@ * along with this program. If not, see . */ +#include "keycodes.h" #include QMK_KEYBOARD_H enum dilemma_keymap_layers { @@ -24,8 +25,8 @@ enum dilemma_keymap_layers { LAYER_NUM, }; -#define NAV MO(LAYER_NAV) -#define SYM MO(LAYER_SYM) +#define NAV TRI_LAYER_LOWER_LAYER +#define SYM TRI_LAYER_UPPER_LAYER // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -33,11 +34,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ╭─────────────────────────────────────────────╮ ╭─────────────────────────────────────────────╮ KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ - KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, // ╰─────────────────────────────────────────────┤ ├─────────────────────────────────────────────╯ - KC_A, NAV, CW_TOGG, KC_SPC, SYM, KC_A + KC_LCTL, NAV, KC_LGUI, KC_SPC, SYM, KC_A // ╰───────────────────────────╯ ╰──────────────────────────╯ ), @@ -45,11 +46,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ╭─────────────────────────────────────────────╮ ╭─────────────────────────────────────────────╮ KC_TAB, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLU, XXXXXXX, KC_HOME, KC_UP, KC_END, KC_DEL, // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ - KC_LSFT, KC_LCTL, KC_LALT, KC_RGUI, KC_VOLD, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSPC, + KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, KC_VOLD, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSPC, // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ QK_BOOT, EE_CLR, KC_MPRV, KC_MNXT, KC_MPLY, XXXXXXX, KC_PGDN, KC_PGUP, XXXXXXX, KC_ENT, // ╰─────────────────────────────────────────────┤ ├─────────────────────────────────────────────╯ - KC_A, _______, KC_LSFT, KC_SPC, _______, KC_A + XXXXXXX, _______, KC_LSFT, KC_SPC, _______, KC_ESC // ╰───────────────────────────╯ ╰──────────────────────────╯ ), @@ -59,9 +60,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ KC_MINS, KC_ASTR, KC_EQL, KC_UNDS, KC_DLR, KC_HASH, KC_RGUI, KC_RALT, KC_RCTL, KC_RSFT, // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ - KC_PLUS, KC_PIPE, KC_AT, KC_SLSH, KC_PERC, _______, KC_BSLS, KC_AMPR, KC_QUES, KC_EXLM, + KC_PLUS, KC_PIPE, KC_AT, KC_SLSH, KC_PERC, KC_SCLN, KC_BSLS, KC_AMPR, KC_QUES, KC_EXLM, // ╰─────────────────────────────────────────────┤ ├─────────────────────────────────────────────╯ - KC_A, _______, KC_LSFT, KC_SPC, _______, KC_A + KC_ESC, _______, KC_LSFT, KC_SPC, _______, XXXXXXX // ╰───────────────────────────╯ ╰──────────────────────────╯ ), @@ -73,12 +74,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, // ╰─────────────────────────────────────────────┤ ├─────────────────────────────────────────────╯ - KC_A, _______, KC_LSFT, KC_SPC, _______, KC_A + XXXXXXX, _______, KC_LSFT, KC_SPC, _______, XXXXXXX // ╰───────────────────────────╯ ╰──────────────────────────╯ ), }; // clang-format on - -layer_state_t layer_state_set_user(layer_state_t state) { - return update_tri_layer_state(state, LAYER_NAV, LAYER_SYM, LAYER_NUM); -} diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/readme.md b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/readme.md new file mode 100644 index 000000000000..f0b085006b54 --- /dev/null +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/readme.md @@ -0,0 +1,3 @@ +# Dilemma 3x5+3 default keymap + +> :bulb: Have a look at the [`via` keymap](../via) for a more feature-rich layout. diff --git a/keyboards/bastardkb/dilemma/3x5_3/rules.mk b/keyboards/bastardkb/dilemma/3x5_3/rules.mk index 735186b24783..e698642e4f5b 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/rules.mk +++ b/keyboards/bastardkb/dilemma/3x5_3/rules.mk @@ -1,28 +1,31 @@ # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control +#BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +#MOUSEKEY_ENABLE = yes # Mouse keys +#EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover +#NKRO_ENABLE = yes # Enable N-Key Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output MAGIC_ENABLE = yes # Magic keycodes TRI_LAYER_ENABLE = yes # Tri Layers -CAPS_WORD_ENABLE = yes # Caps Word -ENCODER_ENABLE = yes # Enable encoder support +#CAPS_WORD_ENABLE = yes # Caps Word +#ENCODER_ENABLE = yes # Enable encoder support AUDIO_SUPPORTED = no # Audio is not supported -RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default +#RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default RGBLIGHT_SUPPORTED = no # RGB underglow is supported, but not enabled by default -RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality +#RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality SERIAL_DRIVER = vendor POINTING_DEVICE_ENABLE = yes POINTING_DEVICE_DRIVER = cirque_pinnacle_spi -SPLIT_KEYBOARD = yes +#SPLIT_KEYBOARD = yes + +# RP2040-specific options +PICO_INTRINSICS_ENABLED = no # ATM Unsupported by ChibiOS. From c67956ea1f06b9ec538fc24a2f51364230a0db2f Mon Sep 17 00:00:00 2001 From: casuanoob Date: Thu, 7 Sep 2023 14:21:27 +1000 Subject: [PATCH 05/21] 3x5_3 remove unused settings --- keyboards/bastardkb/dilemma/3x5_3/rules.mk | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/rules.mk b/keyboards/bastardkb/dilemma/3x5_3/rules.mk index e698642e4f5b..6f3cca530133 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/rules.mk +++ b/keyboards/bastardkb/dilemma/3x5_3/rules.mk @@ -1,31 +1,18 @@ -# Build Options -# change yes to no to disable -# -#BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -#MOUSEKEY_ENABLE = yes # Mouse keys -#EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration -#NKRO_ENABLE = yes # Enable N-Key Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output MAGIC_ENABLE = yes # Magic keycodes TRI_LAYER_ENABLE = yes # Tri Layers -#CAPS_WORD_ENABLE = yes # Caps Word -#ENCODER_ENABLE = yes # Enable encoder support AUDIO_SUPPORTED = no # Audio is not supported -#RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default RGBLIGHT_SUPPORTED = no # RGB underglow is supported, but not enabled by default -#RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality SERIAL_DRIVER = vendor POINTING_DEVICE_ENABLE = yes POINTING_DEVICE_DRIVER = cirque_pinnacle_spi -#SPLIT_KEYBOARD = yes - # RP2040-specific options PICO_INTRINSICS_ENABLED = no # ATM Unsupported by ChibiOS. From 7661fa1611d6a374f4e75e69705ae7b6a80ea7ee Mon Sep 17 00:00:00 2001 From: casuanoob Date: Thu, 14 Sep 2023 18:11:31 +1000 Subject: [PATCH 06/21] 3x5_3 explicitly set some defaults some things were only working because "processor: RP2040" defaults to GENERIC_PROMICRO_RP2040. explicitly set "board": "GENERIC_RP_RP2040" instead. correctly enable SPI0 and SPID0 instead of SPI1 --- keyboards/bastardkb/dilemma/3x5_3/config.h | 2 ++ keyboards/bastardkb/dilemma/3x5_3/info.json | 7 ++++--- keyboards/bastardkb/dilemma/3x5_3/mcuconf.h | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/config.h b/keyboards/bastardkb/dilemma/3x5_3/config.h index 924b37c217c4..305d2e280ae1 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/config.h +++ b/keyboards/bastardkb/dilemma/3x5_3/config.h @@ -30,6 +30,7 @@ #define CRC8_OPTIMIZE_SPEED /* Cirque trackpad over SPI. */ +#define SPI_DRIVER SPID0 #define SPI_SCK_PIN GP22 #define SPI_MOSI_PIN GP23 #define SPI_MISO_PIN GP20 @@ -40,6 +41,7 @@ /* Reset. */ #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP17 +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U /* RGB matrix support. */ #ifdef RGB_MATRIX_ENABLE diff --git a/keyboards/bastardkb/dilemma/3x5_3/info.json b/keyboards/bastardkb/dilemma/3x5_3/info.json index 2f3f21fa0484..4638735cd6e8 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/info.json +++ b/keyboards/bastardkb/dilemma/3x5_3/info.json @@ -6,6 +6,7 @@ }, "processor": "RP2040", "bootloader": "rp2040", + "board": "GENERIC_RP_RP2040", "matrix_pins": { "cols": ["GP8", "GP9", "GP7", "GP6", "GP28"], "rows": ["GP4", "GP5", "GP27", "GP26"] @@ -16,7 +17,7 @@ "soft_serial_pin": "GP1", "bootmagic": { "matrix": [4, 0] - }, + } }, "encoder": { "enabled" : true, @@ -32,7 +33,7 @@ "rgb_matrix": true }, "caps_word": { - "enabled": true, + "enabled": true }, "ws2812": { "pin": "GP10", @@ -41,7 +42,7 @@ "rgb_matrix": { "driver": "ws2812", "split_count": [36, 36], - "max_brightness": 128, + "max_brightness": 176, "layout": [ {"x": 82, "y": 0, "flags": 2}, {"x": 60, "y": 0, "flags": 2}, diff --git a/keyboards/bastardkb/dilemma/3x5_3/mcuconf.h b/keyboards/bastardkb/dilemma/3x5_3/mcuconf.h index 81821c159dca..52b726a56d5f 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/mcuconf.h +++ b/keyboards/bastardkb/dilemma/3x5_3/mcuconf.h @@ -19,5 +19,5 @@ #include_next -#undef RP_SPI_USE_SPI1 -#define RP_SPI_USE_SPI1 TRUE +#undef RP_SPI_USE_SPI0 +#define RP_SPI_USE_SPI0 TRUE From cb9ede0fed9fcb826d3b454c8efd4dd73c9e28af Mon Sep 17 00:00:00 2001 From: casuanoob Date: Tue, 3 Oct 2023 00:28:06 +1100 Subject: [PATCH 07/21] 3x5_3 Apply changes for data-driven update mirror the changes requested by reviewers in the Dilemma Max PR move rgb animation enabling to info.json remove redefinitions of default rgbmatrix values move rules.mk _enable to info.json --- keyboards/bastardkb/dilemma/3x5_3/config.h | 55 ------------------- keyboards/bastardkb/dilemma/3x5_3/info.json | 55 +++++++++++++++++-- .../dilemma/3x5_3/keymaps/default/readme.md | 2 - .../dilemma/3x5_3/keymaps/via/config.h | 5 +- keyboards/bastardkb/dilemma/3x5_3/rules.mk | 14 ----- 5 files changed, 52 insertions(+), 79 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/config.h b/keyboards/bastardkb/dilemma/3x5_3/config.h index 305d2e280ae1..7a493d2e9fea 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/config.h +++ b/keyboards/bastardkb/dilemma/3x5_3/config.h @@ -51,61 +51,6 @@ # define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Startup values. -# define RGB_MATRIX_DEFAULT_HUE 0 -# define RGB_MATRIX_DEFAULT_SAT 255 # define RGB_MATRIX_DEFAULT_VAL 64 -# define RGB_MATRIX_DEFAULT_HSV RGB_MATRIX_DEFAULT_HUE, RGB_MATRIX_DEFAULT_SAT, RGB_MATRIX_DEFAULT_VAL - -// Rainbow swirl as startup mode. -# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT - -// Slow swirl at startup. # define RGB_MATRIX_DEFAULT_SPD 32 - -// Enable all animations on ARM boards since they have plenty of memory -// available for it. -# define ENABLE_RGB_MATRIX_ALPHAS_MODS -# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_BREATHING -# define ENABLE_RGB_MATRIX_BAND_SAT -# define ENABLE_RGB_MATRIX_BAND_VAL -# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -# define ENABLE_RGB_MATRIX_CYCLE_ALL -# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN -# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL -# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL -# define ENABLE_RGB_MATRIX_DUAL_BEACON -# define ENABLE_RGB_MATRIX_RAINBOW_BEACON -# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS -# define ENABLE_RGB_MATRIX_RAINDROPS -# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -# define ENABLE_RGB_MATRIX_HUE_BREATHING -# define ENABLE_RGB_MATRIX_HUE_PENDULUM -# define ENABLE_RGB_MATRIX_HUE_WAVE -# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL -# define ENABLE_RGB_MATRIX_PIXEL_FLOW -# define ENABLE_RGB_MATRIX_PIXEL_RAIN -# define ENABLE_RGB_MATRIX_TYPING_HEATMAP -# define ENABLE_RGB_MATRIX_DIGITAL_RAIN -# 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 #endif diff --git a/keyboards/bastardkb/dilemma/3x5_3/info.json b/keyboards/bastardkb/dilemma/3x5_3/info.json index 4638735cd6e8..78aa63c71132 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/info.json +++ b/keyboards/bastardkb/dilemma/3x5_3/info.json @@ -27,13 +27,14 @@ }, "features": { "bootmagic": true, + "command": false, + "console": false, "extrakey": true, "mousekey": true, "nkro": true, - "rgb_matrix": true - }, - "caps_word": { - "enabled": true + "rgb_matrix": true, + "caps_word": true, + "tri_layer": true }, "ws2812": { "pin": "GP10", @@ -43,6 +44,52 @@ "driver": "ws2812", "split_count": [36, 36], "max_brightness": 176, + "animations": { + "solid_color": true, + "alphas_mods": true, + "gradient_up_down": true, + "gradient_left_right": true, + "breathing": true, + "band_sat": true, + "band_val": true, + "band_pinwheel_sat": true, + "band_pinwheel_val": true, + "band_spiral_sat": true, + "band_spiral_val": true, + "cycle_all": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_out_in": true, + "cycle_out_in_dual": true, + "rainbow_moving_chevron": true, + "cycle_pinwheel": true, + "cycle_spiral": true, + "dual_beacon": true, + "rainbow_beacon": true, + "rainbow_pinwheels": true, + "raindrops": true, + "jellybean_raindrops": true, + "hue_breathing": true, + "hue_pendulum": true, + "hue_wave": true, + "pixel_fractal": true, + "pixel_flow": true, + "pixel_rain": true, + "typing_heatmap": true, + "digital_rain": true, + "solid_reactive_simple": true, + "solid_reactive": true, + "solid_reactive_wide": true, + "solid_reactive_multiwide": true, + "solid_reactive_cross": true, + "solid_reactive_multicross": true, + "solid_reactive_nexus": true, + "solid_reactive_multinexus": true, + "splash": true, + "multisplash": true, + "solid_splash": true, + "solid_multisplash": true + }, "layout": [ {"x": 82, "y": 0, "flags": 2}, {"x": 60, "y": 0, "flags": 2}, diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/readme.md b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/readme.md index f0b085006b54..8da7a74bf034 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/readme.md +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/readme.md @@ -1,3 +1 @@ # Dilemma 3x5+3 default keymap - -> :bulb: Have a look at the [`via` keymap](../via) for a more feature-rich layout. diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h index ba44df95a8c8..24322f990440 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h @@ -17,7 +17,4 @@ */ #pragma once -#ifdef VIA_ENABLE -/* VIA configuration. */ -# define DYNAMIC_KEYMAP_LAYER_COUNT 8 -#endif // VIA_ENABLE +#define DYNAMIC_KEYMAP_LAYER_COUNT 8 diff --git a/keyboards/bastardkb/dilemma/3x5_3/rules.mk b/keyboards/bastardkb/dilemma/3x5_3/rules.mk index 6f3cca530133..4923c2c84a50 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/rules.mk +++ b/keyboards/bastardkb/dilemma/3x5_3/rules.mk @@ -1,18 +1,4 @@ -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -MAGIC_ENABLE = yes # Magic keycodes -TRI_LAYER_ENABLE = yes # Tri Layers - -AUDIO_SUPPORTED = no # Audio is not supported -RGBLIGHT_SUPPORTED = no # RGB underglow is supported, but not enabled by default - SERIAL_DRIVER = vendor POINTING_DEVICE_ENABLE = yes POINTING_DEVICE_DRIVER = cirque_pinnacle_spi - -# RP2040-specific options -PICO_INTRINSICS_ENABLED = no # ATM Unsupported by ChibiOS. From e49b98c3e63080ee2bd9bd92af48a94fbecaefff Mon Sep 17 00:00:00 2001 From: casuanoob Date: Tue, 3 Oct 2023 01:08:41 +1100 Subject: [PATCH 08/21] 3x5_3 Add RGB indicators to `via` keymap Change RGB Matrix flags to Indicator on the pinky columns. Add per-layer underglow colours for each layer. Add caps lock indication on the pinky columns. Add full red RGB on bootloader entry. --- keyboards/bastardkb/dilemma/3x5_3/info.json | 12 ++-- .../dilemma/3x5_3/keymaps/default/keymap.c | 1 - .../dilemma/3x5_3/keymaps/default/readme.md | 1 - .../dilemma/3x5_3/keymaps/via/keymap.c | 62 ++++++++++++++++++- .../dilemma/3x5_3/keymaps/via/rules.mk | 2 +- keyboards/bastardkb/dilemma/dilemma.c | 1 - 6 files changed, 68 insertions(+), 11 deletions(-) delete mode 100644 keyboards/bastardkb/dilemma/3x5_3/keymaps/default/readme.md diff --git a/keyboards/bastardkb/dilemma/3x5_3/info.json b/keyboards/bastardkb/dilemma/3x5_3/info.json index 78aa63c71132..f3a39613302c 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/info.json +++ b/keyboards/bastardkb/dilemma/3x5_3/info.json @@ -118,9 +118,9 @@ {"matrix": [0, 3], "x": 56, "y": 9, "flags": 4}, {"matrix": [0, 2], "x": 39, "y": 5, "flags": 4}, {"matrix": [0, 1], "x": 22, "y": 10, "flags": 4}, - {"matrix": [0, 0], "x": 5, "y": 15, "flags": 4}, + {"matrix": [0, 0], "x": 5, "y": 15, "flags": 1}, - {"matrix": [1, 0], "x": 5, "y": 30, "flags": 4}, + {"matrix": [1, 0], "x": 5, "y": 30, "flags": 1}, {"matrix": [1, 1], "x": 22, "y": 25, "flags": 4}, {"matrix": [1, 2], "x": 39, "y": 20, "flags": 4}, {"matrix": [1, 3], "x": 56, "y": 24, "flags": 4}, @@ -130,7 +130,7 @@ {"matrix": [2, 3], "x": 56, "y": 39, "flags": 4}, {"matrix": [2, 2], "x": 39, "y": 35, "flags": 4}, {"matrix": [2, 1], "x": 22, "y": 40, "flags": 4}, - {"matrix": [2, 0], "x": 5, "y": 45, "flags": 4}, + {"matrix": [2, 0], "x": 5, "y": 45, "flags": 1}, {"matrix": [3, 2], "x": 45, "y": 51, "flags": 4}, {"matrix": [3, 0], "x": 64, "y": 53, "flags": 4}, @@ -163,9 +163,9 @@ {"matrix": [4, 3], "x": 168, "y": 9, "flags": 4}, {"matrix": [4, 2], "x": 185, "y": 5, "flags": 4}, {"matrix": [4, 1], "x": 202, "y": 10, "flags": 4}, - {"matrix": [4, 0], "x": 219, "y": 15, "flags": 4}, + {"matrix": [4, 0], "x": 219, "y": 15, "flags": 1}, - {"matrix": [5, 0], "x": 219, "y": 30, "flags": 4}, + {"matrix": [5, 0], "x": 219, "y": 30, "flags": 1}, {"matrix": [5, 1], "x": 202, "y": 25, "flags": 4}, {"matrix": [5, 2], "x": 185, "y": 20, "flags": 4}, {"matrix": [5, 3], "x": 168, "y": 24, "flags": 4}, @@ -175,7 +175,7 @@ {"matrix": [6, 3], "x": 168, "y": 39, "flags": 4}, {"matrix": [6, 2], "x": 185, "y": 35, "flags": 4}, {"matrix": [6, 1], "x": 202, "y": 40, "flags": 4}, - {"matrix": [6, 0], "x": 219, "y": 45, "flags": 4}, + {"matrix": [6, 0], "x": 219, "y": 45, "flags": 1}, {"matrix": [7, 2], "x": 179, "y": 51, "flags": 4}, {"matrix": [7, 0], "x": 160, "y": 53, "flags": 4}, diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c index 9c19afc30a2e..b87784bbb94b 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c @@ -15,7 +15,6 @@ * along with this program. If not, see . */ -#include "keycodes.h" #include QMK_KEYBOARD_H enum dilemma_keymap_layers { diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/readme.md b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/readme.md deleted file mode 100644 index 8da7a74bf034..000000000000 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/readme.md +++ /dev/null @@ -1 +0,0 @@ -# Dilemma 3x5+3 default keymap diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c index be921e5f1c5f..5c49e6d391f4 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c @@ -195,6 +195,58 @@ layer_state_t layer_state_set_user(layer_state_t state) { # endif // DILEMMA_AUTO_SNIPING_ON_LAYER #endif // POINTING_DEVICE_ENABLE +#ifdef RGB_MATRIX_ENABLE +// Forward-declare this helper function since it is defined in rgb_matrix.c. +void rgb_matrix_update_pwm_buffers(void); + +// Layer state indicator +bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + if (host_keyboard_led_state().caps_lock) { + for (int i = led_min; i <= led_max; i++) { + if (g_led_config.flags[i] & LED_FLAG_MODIFIER) { + rgb_matrix_set_color(i, RGB_RED); + } + } + } + + uint8_t layer = get_highest_layer(layer_state); + if (layer > 0) { + RGB rgb; + switch (get_highest_layer(layer_state)) { + case 1: + rgb = (RGB){RGB_BLUE}; + break; + case 2: + rgb = (RGB){RGB_CORAL}; + break; + case 3: + rgb = (RGB){RGB_GREEN}; + break; + case 4: + rgb = (RGB){RGB_YELLOW}; + break; + case 5: + rgb = (RGB){RGB_PINK}; + break; + case 6: + rgb = (RGB){RGB_MAGENTA}; + break; + case 7: + default: + rgb = (RGB){RGB_RED}; + break; + }; + + for (int i = led_min; i <= led_max; i++) { + if ( g_led_config.flags[i] & LED_FLAG_UNDERGLOW) { + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + }; + } + return false; +}; +#endif // RGB_MATRIX_ENABLE + #ifdef ENCODER_MAP_ENABLE // clang-format off const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { @@ -206,4 +258,12 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { [LAYER_SYMBOLS] = {ENCODER_CCW_CW(RGB_RMOD, RGB_MOD), ENCODER_CCW_CW(KC_LEFT, KC_RGHT)}, }; // clang-format on -#endif // ENCODER_MAP_ENABLE +#endif // ENCODER_MAP_ENABL + +void shutdown_user(void) { +#ifdef RGB_MATRIX_ENABLE + rgb_matrix_sethsv_noeeprom(HSV_RED); + rgb_matrix_update_pwm_buffers(); +#endif // RGB_MATRIX_ENABLE +} + diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/rules.mk b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/rules.mk index 715838ecc5d9..f1adcab005e8 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/rules.mk +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/rules.mk @@ -1,2 +1,2 @@ -ENCODER_MAP_ENABLE = yes VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/bastardkb/dilemma/dilemma.c b/keyboards/bastardkb/dilemma/dilemma.c index 2f75cbc0a0e3..7c87fdcadd61 100644 --- a/keyboards/bastardkb/dilemma/dilemma.c +++ b/keyboards/bastardkb/dilemma/dilemma.c @@ -2,7 +2,6 @@ * Copyright 2020 Christopher Courtney (@drashna) * Copyright 2021 Quentin LEBASTARD * Copyright 2022 Charly Delay (@0xcharly) - * Copyright 2023 casuanoob (@casuanoob) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Publicw License as published by From 845b1da03fc61d23c25be9fbaa1f181bfcdd87a0 Mon Sep 17 00:00:00 2001 From: casuanoob <96005765+casuanoob@users.noreply.github.com> Date: Tue, 3 Oct 2023 02:21:56 +1100 Subject: [PATCH 09/21] 3x5_3 via keymap indicators data sync --- keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h index 24322f990440..790d6bf751dd 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h @@ -18,3 +18,6 @@ #pragma once #define DYNAMIC_KEYMAP_LAYER_COUNT 8 + +#define SPLIT_LAYER_STATE_ENABLE +#define SPLIT_LED_STATE_ENABLE From cb9ac02f6ac6bec59b79d6c502eec998ba1adcad Mon Sep 17 00:00:00 2001 From: casuanoob Date: Tue, 3 Oct 2023 03:43:22 +1100 Subject: [PATCH 10/21] 3x5_3 fix RGB Matrix indicators Convert values from HSV to respect brightness settings --- keyboards/bastardkb/dilemma/3x5_3/config.h | 2 +- .../dilemma/3x5_3/keymaps/via/keymap.c | 34 +++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/config.h b/keyboards/bastardkb/dilemma/3x5_3/config.h index 7a493d2e9fea..aaac4c880a98 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/config.h +++ b/keyboards/bastardkb/dilemma/3x5_3/config.h @@ -51,6 +51,6 @@ # define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Startup values. -# define RGB_MATRIX_DEFAULT_VAL 64 +# define RGB_MATRIX_DEFAULT_VAL 128 # define RGB_MATRIX_DEFAULT_SPD 32 #endif diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c index 5c49e6d391f4..6f0a9eda2330 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +#include "color.h" #include QMK_KEYBOARD_H enum dilemma_keymap_layers { @@ -203,45 +204,50 @@ void rgb_matrix_update_pwm_buffers(void); bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { if (host_keyboard_led_state().caps_lock) { for (int i = led_min; i <= led_max; i++) { - if (g_led_config.flags[i] & LED_FLAG_MODIFIER) { - rgb_matrix_set_color(i, RGB_RED); + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { + rgb_matrix_set_color(i, rgb_matrix_get_val() + 76, 0x00, 0x00); } } } uint8_t layer = get_highest_layer(layer_state); if (layer > 0) { - RGB rgb; + HSV hsv = rgb_matrix_get_hsv(); switch (get_highest_layer(layer_state)) { case 1: - rgb = (RGB){RGB_BLUE}; + hsv = (HSV){HSV_BLUE}; break; case 2: - rgb = (RGB){RGB_CORAL}; + hsv = (HSV){HSV_AZURE}; break; case 3: - rgb = (RGB){RGB_GREEN}; + hsv = (HSV){HSV_ORANGE}; break; case 4: - rgb = (RGB){RGB_YELLOW}; + hsv = (HSV){HSV_SPRINGGREEN}; break; case 5: - rgb = (RGB){RGB_PINK}; + hsv = (HSV){HSV_TEAL}; break; case 6: - rgb = (RGB){RGB_MAGENTA}; + hsv = (HSV){HSV_PURPLE}; break; case 7: default: - rgb = (RGB){RGB_RED}; + hsv = (HSV){HSV_RED}; break; }; - for (int i = led_min; i <= led_max; i++) { - if ( g_led_config.flags[i] & LED_FLAG_UNDERGLOW) { + if (hsv.v > rgb_matrix_get_val()) { + hsv.v = rgb_matrix_get_val() + 22; + } + RGB rgb = hsv_to_rgb(hsv); + + for (uint8_t i = led_min; i < led_max; i++) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_UNDERGLOW)) { rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } - }; + } } return false; }; @@ -262,7 +268,7 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { void shutdown_user(void) { #ifdef RGB_MATRIX_ENABLE - rgb_matrix_sethsv_noeeprom(HSV_RED); + rgb_matrix_set_color_all(rgb_matrix_get_val(), 0x00, 0x00); rgb_matrix_update_pwm_buffers(); #endif // RGB_MATRIX_ENABLE } From 8631ab4d364738d50d54f384600be58984960934 Mon Sep 17 00:00:00 2001 From: casuanoob Date: Tue, 3 Oct 2023 04:04:18 +1100 Subject: [PATCH 11/21] fix bstiq build failure --- .../dilemma/3x5_3/keymaps/bstiq/config.h | 64 ------------------- 1 file changed, 64 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/bstiq/config.h b/keyboards/bastardkb/dilemma/3x5_3/keymaps/bstiq/config.h index cfdafc4a512c..4626c7b14164 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/bstiq/config.h +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/bstiq/config.h @@ -66,67 +66,3 @@ # define DILEMMA_DRAGSCROLL_REVERSE_X // #define DILEMMA_DRAGSCROLL_REVERSE_Y #endif // POINTING_DEVICE_ENABLE - -/** RGB Matrix. */ - -#ifdef RGB_MATRIX_ENABLE -// Enable all animations on ARM boards since they have plenty of memory -// available for it. -# define ENABLE_RGB_MATRIX_ALPHAS_MODS -# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_BREATHING -# define ENABLE_RGB_MATRIX_BAND_SAT -# define ENABLE_RGB_MATRIX_BAND_VAL -# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -# define ENABLE_RGB_MATRIX_CYCLE_ALL -# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN -# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL -# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL -# define ENABLE_RGB_MATRIX_DUAL_BEACON -# define ENABLE_RGB_MATRIX_RAINBOW_BEACON -# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS -# define ENABLE_RGB_MATRIX_RAINDROPS -# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -# define ENABLE_RGB_MATRIX_HUE_BREATHING -# define ENABLE_RGB_MATRIX_HUE_PENDULUM -# define ENABLE_RGB_MATRIX_HUE_WAVE -# define ENABLE_RGB_MATRIX_TYPING_HEATMAP -# define ENABLE_RGB_MATRIX_DIGITAL_RAIN -# 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 - -// Limit maximum brightness to keep power consumption reasonable, and avoid -// disconnects. -# undef RGB_MATRIX_MAXIMUM_BRIGHTNESS -# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 64 - -// Rainbow swirl as startup mode. -# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT - -// Slow swirl at startup. -# define RGB_MATRIX_DEFAULT_SPD 32 - -// Startup values. -# define RGB_MATRIX_DEFAULT_HUE 0 -# define RGB_MATRIX_DEFAULT_SAT 255 -# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS -#endif // RGB_MATRIX_ENABLE From ec3e89b7235fce34c63c6b9529fefe8e0644d988 Mon Sep 17 00:00:00 2001 From: casuanoob Date: Tue, 3 Oct 2023 16:00:00 +1100 Subject: [PATCH 12/21] limit rgb/hsv values to 255 or under --- keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c index 6f0a9eda2330..aea133eb1e15 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c @@ -197,6 +197,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { #endif // POINTING_DEVICE_ENABLE #ifdef RGB_MATRIX_ENABLE +#define rgb_min(a,b) (((a)<(b))?(a):(b)) // Forward-declare this helper function since it is defined in rgb_matrix.c. void rgb_matrix_update_pwm_buffers(void); @@ -205,7 +206,7 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { if (host_keyboard_led_state().caps_lock) { for (int i = led_min; i <= led_max; i++) { if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { - rgb_matrix_set_color(i, rgb_matrix_get_val() + 76, 0x00, 0x00); + rgb_matrix_set_color(i, rgb_min(rgb_matrix_get_val() + 76, 255), 0x00, 0x00); } } } @@ -224,7 +225,7 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { hsv = (HSV){HSV_ORANGE}; break; case 4: - hsv = (HSV){HSV_SPRINGGREEN}; + hsv = (HSV){HSV_GREEN}; break; case 5: hsv = (HSV){HSV_TEAL}; @@ -239,7 +240,7 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { }; if (hsv.v > rgb_matrix_get_val()) { - hsv.v = rgb_matrix_get_val() + 22; + hsv.v = rgb_min(rgb_matrix_get_val() + 22, 255); } RGB rgb = hsv_to_rgb(hsv); From 83ed1b0ea3fc0ed47e844b563e179a6d3ec29842 Mon Sep 17 00:00:00 2001 From: casuanoob <96005765+casuanoob@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:37:17 +1100 Subject: [PATCH 13/21] Apply suggestions from code review Co-authored-by: Drashna Jaelre --- keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c index aea133eb1e15..c8a7d954a3db 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c @@ -16,7 +16,6 @@ * along with this program. If not, see . */ -#include "color.h" #include QMK_KEYBOARD_H enum dilemma_keymap_layers { From 1ab771ec12cee4ebdcada264099a6b8711b9bb23 Mon Sep 17 00:00:00 2001 From: casuanoob Date: Tue, 14 Nov 2023 02:31:56 +1100 Subject: [PATCH 14/21] 3x5_3 remove layout wrapper from via keymap - wrapper macros removed to conform with pristine keymap requirement - readded miryoku inspired ESC_MEDIA layer --- .../dilemma/3x5_3/keymaps/via/keymap.c | 141 +++++++----------- 1 file changed, 51 insertions(+), 90 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c index c8a7d954a3db..a976becfb893 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c @@ -22,6 +22,7 @@ enum dilemma_keymap_layers { LAYER_BASE = 0, LAYER_FUNCTION, LAYER_NAVIGATION, + LAYER_MEDIA, LAYER_POINTER, LAYER_NUMERAL, LAYER_SYMBOLS, @@ -30,11 +31,13 @@ enum dilemma_keymap_layers { // Automatically enable sniping-mode on the pointer layer. // #define DILEMMA_AUTO_SNIPING_ON_LAYER LAYER_POINTER +#define ESC_MED LT(LAYER_MEDIA, KC_ESC) #define SPC_NAV LT(LAYER_NAVIGATION, KC_SPC) #define TAB_FUN LT(LAYER_FUNCTION, KC_TAB) #define ENT_SYM LT(LAYER_SYMBOLS, KC_ENT) #define BSP_NUM LT(LAYER_NUMERAL, KC_BSPC) -#define _L_PTR(KC) LT(LAYER_POINTER, KC) +#define PT_Z LT(LAYER_POINTER, KC_Z) +#define PT_SLSH LT(LAYER_POINTER, KC_SLSH) #ifndef POINTING_DEVICE_ENABLE # define DRGSCRL KC_NO @@ -45,16 +48,13 @@ enum dilemma_keymap_layers { // clang-format off /** \brief QWERTY layout (3 rows, 10 columns). */ -#define LAYOUT_LAYER_BASE \ - KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ - KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, \ - KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \ - CW_TOGG, TAB_FUN, SPC_NAV, ENT_SYM, BSP_NUM, KC_MUTE - -/** Convenience row shorthands. */ -#define _______________DEAD_HALF_ROW_______________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX -#define ______________HOME_ROW_GACS_L______________ KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX -#define ______________HOME_ROW_GACS_R______________ XXXXXXX, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [LAYER_BASE] = LAYOUT_split_3x5_3( + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, + LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, RSFT_T(KC_J), RCTL_T(KC_K), RALT_T(KC_L), RGUI_T(KC_QUOT), + PT_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, PT_SLSH, + ESC_MED, TAB_FUN, SPC_NAV, ENT_SYM, BSP_NUM, KC_MUTE + ), /* * Layers used on the Dilemma. @@ -74,18 +74,12 @@ enum dilemma_keymap_layers { * column. App is on the tertiary thumb key and other thumb keys are duplicated * from the base layer to enable auto-repeat. */ -#define LAYOUT_LAYER_FUNCTION \ - _______________DEAD_HALF_ROW_______________, KC_PSCR, KC_F7, KC_F8, KC_F9, KC_F12, \ - ______________HOME_ROW_GACS_L______________, KC_SCRL, KC_F4, KC_F5, KC_F6, KC_F11, \ - _______________DEAD_HALF_ROW_______________, KC_PAUS, KC_F1, KC_F2, KC_F3, KC_F10, \ + [LAYER_FUNCTION] = LAYOUT_split_3x5_3( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PSCR, KC_F7, KC_F8, KC_F9, KC_F12, + KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_SCRL, KC_F4, KC_F5, KC_F6, KC_F11, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PAUS, KC_F1, KC_F2, KC_F3, KC_F10, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX - -/** \brief Mouse emulation and pointer functions. */ -#define LAYOUT_LAYER_POINTER \ - QK_BOOT, EE_CLR, XXXXXXX, DPI_MOD, S_D_MOD, S_D_MOD, DPI_MOD, XXXXXXX, EE_CLR, QK_BOOT, \ - ______________HOME_ROW_GACS_L______________, ______________HOME_ROW_GACS_R______________, \ - _______, DRGSCRL, SNIPING, KC_BTN3, XXXXXXX, XXXXXXX, KC_BTN3, SNIPING, DRGSCRL, _______, \ - KC_BTN3, KC_BTN2, KC_BTN1, KC_BTN1, KC_BTN2, KC_BTN3 + ), /** * \brief Navigation layer. @@ -95,11 +89,33 @@ enum dilemma_keymap_layers { * caps lock and insert on the inner column. Thumb keys are duplicated from the * base layer to avoid having to layer change mid edit and to enable auto-repeat. */ -#define LAYOUT_LAYER_NAVIGATION \ - _______________DEAD_HALF_ROW_______________, _______________DEAD_HALF_ROW_______________, \ - ______________HOME_ROW_GACS_L______________, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, \ - _______________DEAD_HALF_ROW_______________, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, \ + [LAYER_NAVIGATION] = LAYOUT_split_3x5_3( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, XXXXXXX, XXXXXXX, _______, KC_ENT, KC_BSPC, KC_DEL + ), + +/** + * \brief Media layer. + * + * Tertiary left- and right-hand layer is media and RGB control. This layer is + * symmetrical to accomodate the left- and right-hand trackball. + */ + [LAYER_MEDIA] = LAYOUT_split_3x5_3( + XXXXXXX,RGB_RMOD, RGB_TOG, RGB_MOD, XXXXXXX, XXXXXXX,RGB_RMOD, RGB_TOG, RGB_MOD, XXXXXXX, + KC_MPRV, KC_VOLD, KC_MUTE, KC_VOLU, KC_MNXT, KC_MPRV, KC_VOLD, KC_MUTE, KC_VOLU, KC_MNXT, + XXXXXXX, XXXXXXX, XXXXXXX, EE_CLR, QK_BOOT, QK_BOOT, EE_CLR, XXXXXXX, XXXXXXX, XXXXXXX, + _______, KC_MPLY, KC_MSTP, KC_MSTP, KC_MPLY, KC_MUTE + ), + +/** \brief Mouse emulation and pointer functions. */ + [LAYER_POINTER] = LAYOUT_split_3x5_3( + QK_BOOT, EE_CLR, XXXXXXX, DPI_MOD, S_D_MOD, S_D_MOD, DPI_MOD, XXXXXXX, EE_CLR, QK_BOOT, + KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, XXXXXXX, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, + _______, DRGSCRL, SNIPING, KC_BTN3, XXXXXXX, XXXXXXX, KC_BTN3, SNIPING, DRGSCRL, _______, + KC_BTN3, KC_BTN2, KC_BTN1, KC_BTN1, KC_BTN2, KC_BTN3 + ), /** * \brief Numeral layout. @@ -108,11 +124,12 @@ enum dilemma_keymap_layers { * are in the standard numpad locations with symbols in the remaining positions. * `KC_DOT` is duplicated from the base layer. */ -#define LAYOUT_LAYER_NUMERAL \ - KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, _______________DEAD_HALF_ROW_______________, \ - KC_SCLN, KC_4, KC_5, KC_6, KC_EQL, ______________HOME_ROW_GACS_R______________, \ - KC_DOT, KC_1, KC_2, KC_3, KC_BSLS, _______________DEAD_HALF_ROW_______________, \ + [LAYER_NUMERAL] = LAYOUT_split_3x5_3( + KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_SCLN, KC_4, KC_5, KC_6, KC_EQL, XXXXXXX, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, + KC_DOT, KC_1, KC_2, KC_3, KC_BSLS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_DOT, KC_MINS, KC_0, XXXXXXX, _______, XXXXXXX + ), /** * \brief Symbols layer. @@ -121,68 +138,12 @@ enum dilemma_keymap_layers { * chording when using mods with shifted symbols. `KC_LPRN` is duplicated next to * `KC_RPRN`. */ -#define LAYOUT_LAYER_SYMBOLS \ - KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR, _______________DEAD_HALF_ROW_______________, \ - KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS, ______________HOME_ROW_GACS_R______________, \ - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, _______________DEAD_HALF_ROW_______________, \ + [LAYER_SYMBOLS] = LAYOUT_split_3x5_3( + KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS, XXXXXXX, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LPRN, KC_GRV, KC_UNDS, _______, XXXXXXX, XXXXXXX - -/** - * \brief Add Home Row mod to a layout. - * - * Expects a 10-key per row layout. Adds support for GACS (Gui, Alt, Ctl, Shift) - * home row. The layout passed in parameter must contain at least 20 keycodes. - * - * This is meant to be used with `LAYER_ALPHAS_QWERTY` defined above, eg.: - * - * HOME_ROW_MOD_GACS(LAYER_ALPHAS_QWERTY) - */ -#define _HOME_ROW_MOD_GACS( \ - L00, L01, L02, L03, L04, R05, R06, R07, R08, R09, \ - L10, L11, L12, L13, L14, R15, R16, R17, R18, R19, \ - ...) \ - L00, L01, L02, L03, L04, \ - R05, R06, R07, R08, R09, \ - LGUI_T(L10), LALT_T(L11), LCTL_T(L12), LSFT_T(L13), L14, \ - R15, RSFT_T(R16), RCTL_T(R17), LALT_T(R18), RGUI_T(R19), \ - __VA_ARGS__ -#define HOME_ROW_MOD_GACS(...) _HOME_ROW_MOD_GACS(__VA_ARGS__) - -/** - * \brief Add pointer layer keys to a layout. - * - * Expects a 10-key per row layout. The layout passed in parameter must contain - * at least 30 keycodes. - * - * This is meant to be used with `LAYER_ALPHAS_QWERTY` defined above, eg.: - * - * POINTER_MOD(LAYER_ALPHAS_QWERTY) - */ -#define _POINTER_MOD( \ - L00, L01, L02, L03, L04, R05, R06, R07, R08, R09, \ - L10, L11, L12, L13, L14, R15, R16, R17, R18, R19, \ - L20, L21, L22, L23, L24, R25, R26, R27, R28, R29, \ - ...) \ - L00, L01, L02, L03, L04, \ - R05, R06, R07, R08, R09, \ - L10, L11, L12, L13, L14, \ - R15, R16, R17, R18, R19, \ - _L_PTR(L20), L21, L22, L23, L24, \ - R25, R26, R27, R28, _L_PTR(R29), \ - __VA_ARGS__ -#define POINTER_MOD(...) _POINTER_MOD(__VA_ARGS__) - -#define LAYOUT_wrapper(...) LAYOUT_split_3x5_3(__VA_ARGS__) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [LAYER_BASE] = LAYOUT_wrapper( - POINTER_MOD(HOME_ROW_MOD_GACS(LAYOUT_LAYER_BASE)) ), - [LAYER_FUNCTION] = LAYOUT_wrapper(LAYOUT_LAYER_FUNCTION), - [LAYER_NAVIGATION] = LAYOUT_wrapper(LAYOUT_LAYER_NAVIGATION), - [LAYER_NUMERAL] = LAYOUT_wrapper(LAYOUT_LAYER_NUMERAL), - [LAYER_POINTER] = LAYOUT_wrapper(LAYOUT_LAYER_POINTER), - [LAYER_SYMBOLS] = LAYOUT_wrapper(LAYOUT_LAYER_SYMBOLS), }; // clang-format on From 1d81e54c357f5ae86798c647851898777e10ac7d Mon Sep 17 00:00:00 2001 From: casuanoob Date: Thu, 16 Nov 2023 00:27:19 +1100 Subject: [PATCH 15/21] 3x5_3 migrate RGB indicator code to kb level - use *_kb function to keep via keymap pristine - allows user to override default behaviour easily from keymap level --- keyboards/bastardkb/dilemma/3x5_3/3x5_3.c | 57 +++++++++++++++++ .../dilemma/3x5_3/keymaps/via/keymap.c | 63 ++----------------- 2 files changed, 61 insertions(+), 59 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c index 8a1fa43a578f..55c11982a2bd 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c +++ b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c @@ -36,3 +36,60 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { return true; } #endif // ENCODER_ENABLE + +#ifdef RGB_MATRIX_ENABLE +#define rgb_min(a,b) (((a)<(b))?(a):(b)) + +// Layer state indicator +bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { + if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) { return false; } + if (host_keyboard_led_state().caps_lock) { + for (int i = led_min; i <= led_max; i++) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { + rgb_matrix_set_color(i, rgb_min(rgb_matrix_get_val() + 76, 255), 0x00, 0x00); + } + } + } + + uint8_t layer = get_highest_layer(layer_state); + if (layer > 0) { + HSV hsv = rgb_matrix_get_hsv(); + switch (get_highest_layer(layer_state)) { + case 1: + hsv = (HSV){HSV_BLUE}; + break; + case 2: + hsv = (HSV){HSV_AZURE}; + break; + case 3: + hsv = (HSV){HSV_ORANGE}; + break; + case 4: + hsv = (HSV){HSV_GREEN}; + break; + case 5: + hsv = (HSV){HSV_TEAL}; + break; + case 6: + hsv = (HSV){HSV_PURPLE}; + break; + case 7: + default: + hsv = (HSV){HSV_RED}; + break; + }; + + if (hsv.v > rgb_matrix_get_val()) { + hsv.v = rgb_min(rgb_matrix_get_val() + 22, 255); + } + RGB rgb = hsv_to_rgb(hsv); + + for (uint8_t i = led_min; i < led_max; i++) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_UNDERGLOW)) { + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + } + } + return false; +}; +#endif // RGB_MATRIX_ENABLE diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c index a976becfb893..d8c3349d94e8 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c @@ -156,64 +156,6 @@ layer_state_t layer_state_set_user(layer_state_t state) { # endif // DILEMMA_AUTO_SNIPING_ON_LAYER #endif // POINTING_DEVICE_ENABLE -#ifdef RGB_MATRIX_ENABLE -#define rgb_min(a,b) (((a)<(b))?(a):(b)) -// Forward-declare this helper function since it is defined in rgb_matrix.c. -void rgb_matrix_update_pwm_buffers(void); - -// Layer state indicator -bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - if (host_keyboard_led_state().caps_lock) { - for (int i = led_min; i <= led_max; i++) { - if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { - rgb_matrix_set_color(i, rgb_min(rgb_matrix_get_val() + 76, 255), 0x00, 0x00); - } - } - } - - uint8_t layer = get_highest_layer(layer_state); - if (layer > 0) { - HSV hsv = rgb_matrix_get_hsv(); - switch (get_highest_layer(layer_state)) { - case 1: - hsv = (HSV){HSV_BLUE}; - break; - case 2: - hsv = (HSV){HSV_AZURE}; - break; - case 3: - hsv = (HSV){HSV_ORANGE}; - break; - case 4: - hsv = (HSV){HSV_GREEN}; - break; - case 5: - hsv = (HSV){HSV_TEAL}; - break; - case 6: - hsv = (HSV){HSV_PURPLE}; - break; - case 7: - default: - hsv = (HSV){HSV_RED}; - break; - }; - - if (hsv.v > rgb_matrix_get_val()) { - hsv.v = rgb_min(rgb_matrix_get_val() + 22, 255); - } - RGB rgb = hsv_to_rgb(hsv); - - for (uint8_t i = led_min; i < led_max; i++) { - if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_UNDERGLOW)) { - rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); - } - } - } - return false; -}; -#endif // RGB_MATRIX_ENABLE - #ifdef ENCODER_MAP_ENABLE // clang-format off const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { @@ -227,8 +169,11 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { // clang-format on #endif // ENCODER_MAP_ENABL -void shutdown_user(void) { #ifdef RGB_MATRIX_ENABLE +// Forward-declare this helper function since it is defined in rgb_matrix.c. +void rgb_matrix_update_pwm_buffers(void); + +void shutdown_user(void) { rgb_matrix_set_color_all(rgb_matrix_get_val(), 0x00, 0x00); rgb_matrix_update_pwm_buffers(); #endif // RGB_MATRIX_ENABLE From 58dd4bf3f37b9ef18fbe00e52e3a6a3ac6362df1 Mon Sep 17 00:00:00 2001 From: casuanoob Date: Thu, 16 Nov 2023 00:29:02 +1100 Subject: [PATCH 16/21] 3x5_3 fix typo in default keymap - accidentally put the wrong keycode name in, which broke the layers --- keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c index b87784bbb94b..4185bba7d996 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c @@ -24,8 +24,8 @@ enum dilemma_keymap_layers { LAYER_NUM, }; -#define NAV TRI_LAYER_LOWER_LAYER -#define SYM TRI_LAYER_UPPER_LAYER +#define NAV QK_TRI_LAYER_LOWER +#define SYM QK_TRI_LAYER_UPPER // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { From 1359d26dc0715bbcc534bf501187317d0bc58340 Mon Sep 17 00:00:00 2001 From: casuanoob Date: Thu, 16 Nov 2023 13:06:10 +1100 Subject: [PATCH 17/21] 3x5_3 make via keymap pristine - move shutdown function to 3x5_3.c --- keyboards/bastardkb/dilemma/3x5_3/3x5_3.c | 8 ++++++++ .../bastardkb/dilemma/3x5_3/keymaps/via/keymap.c | 13 +------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c index 55c11982a2bd..5d8d24137676 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c +++ b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c @@ -92,4 +92,12 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { } return false; }; + +// Forward-declare this helper function since it is defined in rgb_matrix.c. +void rgb_matrix_update_pwm_buffers(void); + +__attribute__((weak)) void shutdown_user(void) { + rgb_matrix_set_color_all(rgb_matrix_get_val(), 0x00, 0x00); + rgb_matrix_update_pwm_buffers(); +} #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c index d8c3349d94e8..59c4450cd7b7 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c @@ -167,15 +167,4 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { [LAYER_SYMBOLS] = {ENCODER_CCW_CW(RGB_RMOD, RGB_MOD), ENCODER_CCW_CW(KC_LEFT, KC_RGHT)}, }; // clang-format on -#endif // ENCODER_MAP_ENABL - -#ifdef RGB_MATRIX_ENABLE -// Forward-declare this helper function since it is defined in rgb_matrix.c. -void rgb_matrix_update_pwm_buffers(void); - -void shutdown_user(void) { - rgb_matrix_set_color_all(rgb_matrix_get_val(), 0x00, 0x00); - rgb_matrix_update_pwm_buffers(); -#endif // RGB_MATRIX_ENABLE -} - +#endif // ENCODER_MAP_ENABLE From a2e758bf9bd04c4d7d2776166b74215059421291 Mon Sep 17 00:00:00 2001 From: casuanoob Date: Wed, 22 Nov 2023 23:14:52 +1100 Subject: [PATCH 18/21] 3x5_3 rearrange some keycodes --- keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c index 59c4450cd7b7..a4c6a3711c2f 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c @@ -105,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [LAYER_MEDIA] = LAYOUT_split_3x5_3( XXXXXXX,RGB_RMOD, RGB_TOG, RGB_MOD, XXXXXXX, XXXXXXX,RGB_RMOD, RGB_TOG, RGB_MOD, XXXXXXX, KC_MPRV, KC_VOLD, KC_MUTE, KC_VOLU, KC_MNXT, KC_MPRV, KC_VOLD, KC_MUTE, KC_VOLU, KC_MNXT, - XXXXXXX, XXXXXXX, XXXXXXX, EE_CLR, QK_BOOT, QK_BOOT, EE_CLR, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, KC_MPLY, KC_MSTP, KC_MSTP, KC_MPLY, KC_MUTE ), From 75b977f288f9a07fe0122af92ff9e8b6d01ded00 Mon Sep 17 00:00:00 2001 From: casuanoob Date: Fri, 1 Dec 2023 15:57:31 +1100 Subject: [PATCH 19/21] 3x5_3 rebase and fix compile PR #21060 added the new shutdown_kb callback to dilemma.c, so can be removed from 3x5_3.c --- keyboards/bastardkb/dilemma/3x5_3/3x5_3.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c index 5d8d24137676..55c11982a2bd 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c +++ b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c @@ -92,12 +92,4 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { } return false; }; - -// Forward-declare this helper function since it is defined in rgb_matrix.c. -void rgb_matrix_update_pwm_buffers(void); - -__attribute__((weak)) void shutdown_user(void) { - rgb_matrix_set_color_all(rgb_matrix_get_val(), 0x00, 0x00); - rgb_matrix_update_pwm_buffers(); -} #endif // RGB_MATRIX_ENABLE From a6d0807d2927e980c598c771d621433c3f6777dc Mon Sep 17 00:00:00 2001 From: casuanoob Date: Sat, 2 Dec 2023 02:19:19 +1100 Subject: [PATCH 20/21] 3x5_3 use MIN from util.h Per Drashna's suggestion, no need to redefine existing minmax macro --- keyboards/bastardkb/dilemma/3x5_3/3x5_3.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c index 55c11982a2bd..0a5ba1518145 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c +++ b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c @@ -38,15 +38,13 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { #endif // ENCODER_ENABLE #ifdef RGB_MATRIX_ENABLE -#define rgb_min(a,b) (((a)<(b))?(a):(b)) - // Layer state indicator bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) { return false; } if (host_keyboard_led_state().caps_lock) { for (int i = led_min; i <= led_max; i++) { if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { - rgb_matrix_set_color(i, rgb_min(rgb_matrix_get_val() + 76, 255), 0x00, 0x00); + rgb_matrix_set_color(i, MIN(rgb_matrix_get_val() + 76, 255), 0x00, 0x00); } } } @@ -80,7 +78,7 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { }; if (hsv.v > rgb_matrix_get_val()) { - hsv.v = rgb_min(rgb_matrix_get_val() + 22, 255); + hsv.v = MIN(rgb_matrix_get_val() + 22, 255); } RGB rgb = hsv_to_rgb(hsv); From 806339adfb54d441bf6190fe24209597104212da Mon Sep 17 00:00:00 2001 From: casuanoob <96005765+casuanoob@users.noreply.github.com> Date: Thu, 7 Dec 2023 06:08:13 +1100 Subject: [PATCH 21/21] Fix outdated encoder_map impl `[2]` is deprecated for `[NUM_DIRECTIONS]`, missed it when updating Co-authored-by: Ryan --- keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c index a4c6a3711c2f..dacef2231efb 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c @@ -158,7 +158,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { #ifdef ENCODER_MAP_ENABLE // clang-format off -const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [LAYER_BASE] = {ENCODER_CCW_CW(KC_WH_D, KC_WH_U), ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, [LAYER_FUNCTION] = {ENCODER_CCW_CW(KC_DOWN, KC_UP), ENCODER_CCW_CW(KC_LEFT, KC_RGHT)}, [LAYER_NAVIGATION] = {ENCODER_CCW_CW(KC_PGDN, KC_PGUP), ENCODER_CCW_CW(KC_VOLU, KC_VOLD)},