Browse Source

Bastard Keyboards: Add support for Dilemma v2 (3x5+3) (#22185)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Charly Delay <charly@delay.gg>
casuanoob 2 năm trước cách đây
mục cha
commit
06b9925156

+ 71 - 61
keyboards/bastardkb/dilemma/3x5_3/3x5_3.c

@@ -2,6 +2,7 @@
  * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna)
  * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com>
  * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
+ * Copyright 2023 casuanoob <casuanoob@hotmail.com> (@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
@@ -19,65 +20,74 @@
 
 #include "quantum.h"
 
-/**
- * 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
- *                 ╰────────────╯ ╰────────────╯
- */
-// clang-format off
+#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
+
 #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
-    // 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
-}, {
-    /* 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
-}, {
-    /* 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
-    /* 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
-} };
-#endif
-// clang-format on
+// 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, 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 = 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

+ 13 - 9
keyboards/bastardkb/dilemma/3x5_3/config.h

@@ -1,5 +1,6 @@
 /**
  * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
+ * Copyright 2023 casuanoob <casuanoob@hotmail.com> (@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,32 +22,35 @@
 #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
 
 /* Cirque trackpad over SPI. */
+#define SPI_DRIVER SPID0
 #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
+#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U
 
 /* 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_MAXIMUM_BRIGHTNESS 50
 #    define RGB_DISABLE_WHEN_USB_SUSPENDED
 #    define RGB_MATRIX_KEYPRESSES
+#    define RGB_MATRIX_FRAMEBUFFER_EFFECTS
+
+// Startup values.
+#    define RGB_MATRIX_DEFAULT_VAL 128
+#    define RGB_MATRIX_DEFAULT_SPD 32
 #endif

+ 0 - 1
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 <halconf.h>

+ 168 - 10
keyboards/bastardkb/dilemma/3x5_3/info.json

@@ -2,28 +2,186 @@
     "keyboard_name": "Dilemma (3x5+3) Assembled",
     "usb": {
         "device_version": "2.0.0",
-        "pid": "0x1835"
-    },
-    "rgb_matrix": {
-        "driver": "ws2812"
+        "pid": "0x1836"
     },
+    "processor": "RP2040",
+    "bootloader": "rp2040",
+    "board": "GENERIC_RP_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]
+        }
+    },
+    "encoder": {
+        "enabled" : true,
+        "rotary" : [
+            {"pin_a": "GP25", "pin_b": "GP24"}
+        ]
     },
-    "rgblight": {
-        "split_count": [18, 18]
+    "features": {
+        "bootmagic": true,
+        "command": false,
+        "console": false,
+        "extrakey": true,
+        "mousekey": true,
+        "nkro": true,
+        "rgb_matrix": true,
+        "caps_word": true,
+        "tri_layer": true
     },
     "ws2812": {
-        "pin": "GP0",
+        "pin": "GP10",
         "driver": "vendor"
     },
-    "processor": "RP2040",
-    "bootloader": "rp2040",
+    "rgb_matrix": {
+        "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},
+            {"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": 1},
+
+            {"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},
+            {"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": 1},
+
+            {"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": 1},
+
+            {"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},
+            {"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": 1},
+
+            {"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": {

+ 0 - 64
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

+ 10 - 14
keyboards/bastardkb/dilemma/3x5_3/keymaps/default/keymap.c

@@ -24,8 +24,8 @@ enum dilemma_keymap_layers {
     LAYER_NUM,
 };
 
-#define NAV MO(LAYER_NAV)
-#define SYM MO(LAYER_SYM)
+#define NAV QK_TRI_LAYER_LOWER
+#define SYM QK_TRI_LAYER_UPPER
 
 // clang-format off
 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -33,11 +33,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 +45,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,
+       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 +59,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 +73,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);
-}

+ 23 - 0
keyboards/bastardkb/dilemma/3x5_3/keymaps/via/config.h

@@ -0,0 +1,23 @@
+/**
+ * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly)
+ * Copyright 2023 casuanoob <casuanoob@hotmail.com> (@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 <http://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#define DYNAMIC_KEYMAP_LAYER_COUNT 8
+
+#define SPLIT_LAYER_STATE_ENABLE
+#define SPLIT_LED_STATE_ENABLE

+ 170 - 0
keyboards/bastardkb/dilemma/3x5_3/keymaps/via/keymap.c

@@ -0,0 +1,170 @@
+/**
+ * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
+ * Copyright 2023 casuanoob <casuanoob@hotmail.com> (@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 <http://www.gnu.org/licenses/>.
+ */
+
+#include QMK_KEYBOARD_H
+
+enum dilemma_keymap_layers {
+    LAYER_BASE = 0,
+    LAYER_FUNCTION,
+    LAYER_NAVIGATION,
+    LAYER_MEDIA,
+    LAYER_POINTER,
+    LAYER_NUMERAL,
+    LAYER_SYMBOLS,
+};
+
+// 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 PT_Z LT(LAYER_POINTER, KC_Z)
+#define PT_SLSH LT(LAYER_POINTER, KC_SLSH)
+
+#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). */
+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.
+ *
+ * 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.
+ */
+  [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 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.
+ */
+  [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, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, 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.
+ *
+ * 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.
+ */
+  [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.
+ *
+ * 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`.
+ */
+  [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
+  ),
+};
+// 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][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)},
+    [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

+ 47 - 0
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
+```

+ 2 - 0
keyboards/bastardkb/dilemma/3x5_3/keymaps/via/rules.mk

@@ -0,0 +1,2 @@
+VIA_ENABLE = yes
+ENCODER_MAP_ENABLE = yes

+ 2 - 5
keyboards/bastardkb/dilemma/3x5_3/mcuconf.h

@@ -19,8 +19,5 @@
 
 #include_next <mcuconf.h>
 
-#undef RP_SPI_USE_SPI1
-#define RP_SPI_USE_SPI1 TRUE
-
-#undef RP_I2C_USE_I2C1
-#define RP_I2C_USE_I2C1 TRUE
+#undef RP_SPI_USE_SPI0
+#define RP_SPI_USE_SPI0 TRUE

+ 2 - 2
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).

+ 0 - 20
keyboards/bastardkb/dilemma/3x5_3/rules.mk

@@ -1,24 +1,4 @@
-# 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 = no            # Enable N-Key Rollover
-BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
-RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
-AUDIO_ENABLE = no           # Audio output
-
-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

+ 3 - 0
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