~ruther/qmk_firmware

1b7a538353347e564edce2c78a7b155a50ac3c4b — casuanoob 1 year, 9 months ago 8813bdf
Bastard Keyboards: Add support for Dilemma Max (4x6_4) (#22064)

* tentatively add dilemma 4x6_4 WIP untested 
PR by Casuanoob.

Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
A keyboards/bastardkb/dilemma/4x6_4/4x6_4.c => keyboards/bastardkb/dilemma/4x6_4/4x6_4.c +59 -0
@@ 0,0 1,59 @@
/**
 * 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
 * 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 "quantum.h"

#ifdef SWAP_HANDS_ENABLE
const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
    /* Left hand, matrix positions */
    {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}},
    {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}},
    {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}},
    {{0, 8}, {1, 8}, {2, 8}, {3, 8}, {4, 8}, {5, 8}},
    {{0, 9}, {1, 9}, {2, 9}, {3, 9}, {4, 9}, {5, 9}},
    /* Right hand, matrix positions */
    {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}},
    {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}},
    {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}},
    {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}},
    {{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}}
};

#    ifdef ENCODER_MAP_ENABLE
const uint8_t PROGMEM encoder_hand_swap_config[NUM_ENCODERS] = {1, 0};
#    endif
#endif

#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_DOWN : KC_MS_WH_UP);
            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

A keyboards/bastardkb/dilemma/4x6_4/config.h => keyboards/bastardkb/dilemma/4x6_4/config.h +62 -0
@@ 0,0 1,62 @@
/**
 * 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/>.
 */

#pragma once

/* Handedness. */
#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
#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 500U

/* RGB matrix support. */
#define SPLIT_TRANSPORT_MIRROR
#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

// 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

A keyboards/bastardkb/dilemma/4x6_4/halconf.h => keyboards/bastardkb/dilemma/4x6_4/halconf.h +22 -0
@@ 0,0 1,22 @@
/**
 * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
 *
 * 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 HAL_USE_SPI TRUE

#include_next <halconf.h>

A keyboards/bastardkb/dilemma/4x6_4/info.json => keyboards/bastardkb/dilemma/4x6_4/info.json +265 -0
@@ 0,0 1,265 @@
{
    "keyboard_name": "Dilemma Max",
    "usb": {
        "device_version": "1.0.0",
        "pid": "0x1837"
    },
    "processor": "RP2040",
    "bootloader": "rp2040",
    "board": "GENERIC_RP_RP2040",
    "matrix_pins": {
        "cols": ["GP14", "GP8", "GP9", "GP7", "GP6", "GP28"],
        "rows": ["GP15", "GP4", "GP5", "GP27", "GP26"]
    },
    "diode_direction": "ROW2COL",
    "split": {
        "enabled": true,
        "soft_serial_pin": "GP1",
        "bootmagic": {
            "matrix": [5, 0]
        }
    },
    "encoder": {
        "enabled" : true,
        "rotary" : [
            {"pin_a": "GP25", "pin_b": "GP24"}
        ]
    },
    "features": {
        "bootmagic": true,
        "command": false,
        "console": false,
        "extrakey": true,
        "mousekey": true,
        "nkro": true,
        "rgb_matrix": true,
        "caps_word": true
    },
    "ws2812": {
        "pin": "GP10",
        "driver": "vendor"
    },
    "rgb_matrix": {
        "driver": "ws2812",
        "split_count": [52, 52],
        "max_brightness": 176,
        "center_point": [112, 28],
        "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": 81, "y": 4, "flags": 2},
            {"x": 65, "y": 2, "flags": 2},
            {"x": 40, "y": 0, "flags": 2},
            {"x": 29, "y": 9, "flags": 2},
            {"x": 16, "y": 9, "flags": 2},
            {"x": 0, "y": 16, "flags": 2},
            {"x": 0, "y": 29, "flags": 2},
            {"x": 0, "y": 40, "flags": 2},
            {"x": 5, "y": 50, "flags": 2},
            {"x": 17, "y": 49, "flags": 2},
            {"x": 28, "y": 44, "flags": 2},
            {"x": 40, "y": 43, "flags": 2},
            {"x": 49, "y": 51, "flags": 2},
            {"x": 62, "y": 53, "flags": 2},
            {"x": 73, "y": 56, "flags": 2},
            {"x": 85, "y": 59, "flags": 2},
            {"x": 100, "y": 64, "flags": 2},
            {"x": 106, "y": 55, "flags": 2},
            {"x": 107, "y": 45, "flags": 2},
            {"x": 91, "y": 51, "flags": 2},
            {"x": 94, "y": 40, "flags": 2},
            {"x": 108, "y": 33, "flags": 2},
            {"x": 106, "y": 25, "flags": 2},
            {"x": 108, "y": 16, "flags": 2},

            {"matrix": [0, 5], "x": 75, "y": 10, "flags": 4},
            {"matrix": [0, 4], "x": 62, "y": 9, "flags": 4},
            {"matrix": [0, 3], "x": 49, "y": 6, "flags": 4},
            {"matrix": [0, 2], "x": 35, "y": 10, "flags": 4},
            {"matrix": [0, 1], "x": 22, "y": 16, "flags": 4},
            {"matrix": [0, 0], "x": 9, "y": 16, "flags": 1},
            {"matrix": [1, 0], "x": 9, "y": 27, "flags": 1},
            {"matrix": [1, 1], "x": 22, "y": 27, "flags": 4},
            {"matrix": [1, 2], "x": 35, "y": 20, "flags": 4},
            {"matrix": [1, 3], "x": 49, "y": 17, "flags": 4},
            {"matrix": [1, 4], "x": 62, "y": 19, "flags": 4},
            {"matrix": [1, 5], "x": 75, "y": 21, "flags": 4},
            {"matrix": [2, 5], "x": 75, "y": 31, "flags": 4},
            {"matrix": [2, 4], "x": 62, "y": 30, "flags": 4},
            {"matrix": [2, 3], "x": 49, "y": 27, "flags": 4},
            {"matrix": [2, 2], "x": 35, "y": 31, "flags": 4},
            {"matrix": [2, 1], "x": 22, "y": 37, "flags": 4},
            {"matrix": [2, 0], "x": 9, "y": 37, "flags": 1},
            {"matrix": [3, 0], "x": 9, "y": 48, "flags": 1},
            {"matrix": [3, 1], "x": 22, "y": 48, "flags": 4},
            {"matrix": [3, 2], "x": 35, "y": 41, "flags": 4},
            {"matrix": [3, 3], "x": 49, "y": 38, "flags": 4},
            {"matrix": [3, 4], "x": 62, "y": 40, "flags": 4},
            {"matrix": [3, 5], "x": 75, "y": 42, "flags": 4},
            {"matrix": [4, 3], "x": 54, "y": 51, "flags": 4},
            {"matrix": [4, 1], "x": 68, "y": 53, "flags": 4},
            {"matrix": [4, 2], "x": 81, "y": 57, "flags": 4},
            {"matrix": [4, 4], "x": 92, "y": 64, "flags": 4},

            {"x": 143, "y": 4, "flags": 2},
            {"x": 159, "y": 2, "flags": 2},
            {"x": 184, "y": 0, "flags": 2},
            {"x": 195, "y": 9, "flags": 2},
            {"x": 208, "y": 9, "flags": 2},
            {"x": 224, "y": 16, "flags": 2},
            {"x": 224, "y": 29, "flags": 2},
            {"x": 224, "y": 40, "flags": 2},
            {"x": 219, "y": 50, "flags": 2},
            {"x": 207, "y": 49, "flags": 2},
            {"x": 196, "y": 44, "flags": 2},
            {"x": 184, "y": 43, "flags": 2},
            {"x": 176, "y": 51, "flags": 2},
            {"x": 162, "y": 53, "flags": 2},
            {"x": 151, "y": 56, "flags": 2},
            {"x": 139, "y": 59, "flags": 2},
            {"x": 124, "y": 64, "flags": 2},
            {"x": 118, "y": 55, "flags": 2},
            {"x": 117, "y": 45, "flags": 2},
            {"x": 133, "y": 51, "flags": 2},
            {"x": 130, "y": 40, "flags": 2},
            {"x": 116, "y": 33, "flags": 2},
            {"x": 118, "y": 25, "flags": 2},
            {"x": 116, "y": 16, "flags": 2},

            {"matrix": [5, 5], "x": 149, "y": 10, "flags": 4},
            {"matrix": [5, 4], "x": 162, "y": 9, "flags": 4},
            {"matrix": [5, 3], "x": 175, "y": 6, "flags": 4},
            {"matrix": [5, 2], "x": 189, "y": 10, "flags": 4},
            {"matrix": [5, 1], "x": 202, "y": 16, "flags": 4},
            {"matrix": [5, 0], "x": 215, "y": 16, "flags": 1},
            {"matrix": [6, 0], "x": 215, "y": 27, "flags": 1},
            {"matrix": [6, 1], "x": 202, "y": 27, "flags": 4},
            {"matrix": [6, 2], "x": 189, "y": 20, "flags": 4},
            {"matrix": [6, 3], "x": 175, "y": 17, "flags": 4},
            {"matrix": [6, 4], "x": 162, "y": 19, "flags": 4},
            {"matrix": [6, 5], "x": 149, "y": 21, "flags": 4},
            {"matrix": [7, 5], "x": 149, "y": 31, "flags": 4},
            {"matrix": [7, 4], "x": 162, "y": 30, "flags": 4},
            {"matrix": [7, 3], "x": 175, "y": 27, "flags": 4},
            {"matrix": [7, 2], "x": 189, "y": 31, "flags": 4},
            {"matrix": [7, 1], "x": 202, "y": 37, "flags": 4},
            {"matrix": [7, 0], "x": 215, "y": 37, "flags": 1},
            {"matrix": [8, 0], "x": 215, "y": 48, "flags": 1},
            {"matrix": [8, 1], "x": 202, "y": 48, "flags": 4},
            {"matrix": [8, 2], "x": 189, "y": 41, "flags": 4},
            {"matrix": [8, 3], "x": 175, "y": 38, "flags": 4},
            {"matrix": [8, 4], "x": 162, "y": 40, "flags": 4},
            {"matrix": [8, 5], "x": 149, "y": 42, "flags": 4},
            {"matrix": [9, 4], "x": 170, "y": 51, "flags": 4},
            {"matrix": [9, 2], "x": 156, "y": 53, "flags": 4},
            {"matrix": [9, 1], "x": 143, "y": 57, "flags": 4},
            {"matrix": [9, 3], "x": 132, "y": 64, "flags": 4}
        ]
    },
    "layouts": {
        "LAYOUT": {
            "layout": [
                {"label":"L00", "matrix": [0, 0], "x":0, "y":0},
                {"label":"L01", "matrix": [0, 1], "x":1, "y":0},
                {"label":"L02", "matrix": [0, 2], "x":2, "y":0},
                {"label":"L03", "matrix": [0, 3], "x":3, "y":0},
                {"label":"L04", "matrix": [0, 4], "x":4, "y":0},
                {"label":"L05", "matrix": [0, 5], "x":5, "y":0},
                {"label":"R05", "matrix": [5, 5], "x":8, "y":0},
                {"label":"R04", "matrix": [5, 4], "x":9, "y":0},
                {"label":"R03", "matrix": [5, 3], "x":10, "y":0},
                {"label":"R02", "matrix": [5, 2], "x":11, "y":0},
                {"label":"R01", "matrix": [5, 1], "x":12, "y":0},
                {"label":"R00", "matrix": [5, 0], "x":13, "y":0},
                {"label":"L10", "matrix": [1, 0], "x":0, "y":1},
                {"label":"L11", "matrix": [1, 1], "x":1, "y":1},
                {"label":"L12", "matrix": [1, 2], "x":2, "y":1},
                {"label":"L13", "matrix": [1, 3], "x":3, "y":1},
                {"label":"L14", "matrix": [1, 4], "x":4, "y":1},
                {"label":"L15", "matrix": [1, 5], "x":5, "y":1},
                {"label":"R15", "matrix": [6, 5], "x":8, "y":1},
                {"label":"R14", "matrix": [6, 4], "x":9, "y":1},
                {"label":"R13", "matrix": [6, 3], "x":10, "y":1},
                {"label":"R12", "matrix": [6, 2], "x":11, "y":1},
                {"label":"R11", "matrix": [6, 1], "x":12, "y":1},
                {"label":"R10", "matrix": [6, 0], "x":13, "y":1},
                {"label":"L20", "matrix": [2, 0], "x":0, "y":2},
                {"label":"L21", "matrix": [2, 1], "x":1, "y":2},
                {"label":"L22", "matrix": [2, 2], "x":2, "y":2},
                {"label":"L23", "matrix": [2, 3], "x":3, "y":2},
                {"label":"L24", "matrix": [2, 4], "x":4, "y":2},
                {"label":"L25", "matrix": [2, 5], "x":5, "y":2},
                {"label":"R25", "matrix": [7, 5], "x":8, "y":2},
                {"label":"R24", "matrix": [7, 4], "x":9, "y":2},
                {"label":"R23", "matrix": [7, 3], "x":10, "y":2},
                {"label":"R22", "matrix": [7, 2], "x":11, "y":2},
                {"label":"R21", "matrix": [7, 1], "x":12, "y":2},
                {"label":"R20", "matrix": [7, 0], "x":13, "y":2},
                {"label":"L30", "matrix": [3, 0], "x":0, "y":3},
                {"label":"L31", "matrix": [3, 1], "x":1, "y":3},
                {"label":"L32", "matrix": [3, 2], "x":2, "y":3},
                {"label":"L33", "matrix": [3, 3], "x":3, "y":3},
                {"label":"L34", "matrix": [3, 4], "x":4, "y":3},
                {"label":"L35", "matrix": [3, 5], "x":5, "y":3},
                {"label":"R35", "matrix": [8, 5], "x":8, "y":3},
                {"label":"R34", "matrix": [8, 4], "x":9, "y":3},
                {"label":"R33", "matrix": [8, 3], "x":10, "y":3},
                {"label":"R32", "matrix": [8, 2], "x":11, "y":3},
                {"label":"R31", "matrix": [8, 1], "x":12, "y":3},
                {"label":"R30", "matrix": [8, 0], "x":13, "y":3},
                {"label":"L43", "matrix": [4, 3], "x":2.5, "y":4},
                {"label":"L41", "matrix": [4, 1], "x":3.5, "y":4},
                {"label":"L42", "matrix": [4, 2], "x":4.5, "y":4},
                {"label":"L44", "matrix": [4, 4], "x":5.5, "y":4},
                {"label":"R44", "matrix": [9, 4], "x":7.5, "y":4},
                {"label":"R42", "matrix": [9, 2], "x":8.5, "y":4},
                {"label":"R41", "matrix": [9, 1], "x":9.5, "y":4},
                {"label":"R43", "matrix": [9, 3], "x":10.5, "y":4}
            ]
        }
    }
}

A keyboards/bastardkb/dilemma/4x6_4/keymaps/default/keymap.c => keyboards/bastardkb/dilemma/4x6_4/keymaps/default/keymap.c +73 -0
@@ 0,0 1,73 @@
/**
 * 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/>.
 */
#include QMK_KEYBOARD_H

enum dilemma_keymap_layers {
    LAYER_BASE = 0,
    LAYER_LOWER,
    LAYER_RAISE,
};

#define LOWER MO(LAYER_LOWER)
#define RAISE MO(LAYER_RAISE)

// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  [LAYER_BASE] = LAYOUT(
  // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮
        KC_ESC,    KC_1,    KC_2,    KC_3,    KC_4,    KC_5,       KC_6,    KC_7,    KC_8,    KC_9,    KC_0, KC_MINS,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
        KC_TAB,    KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,       KC_Y,    KC_U,    KC_I,    KC_O,    KC_P, KC_BSLS,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       KC_LSFT,    KC_A,    KC_S,    KC_D,    KC_F,    KC_G,       KC_H,    KC_J,    KC_K,    KC_L, KC_SCLN, KC_QUOT,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       KC_LCTL,    KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,       KC_N,    KC_M, KC_COMM,  KC_DOT, KC_SLSH, KC_LALT,
  // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯
                         KC_LALT, KC_BSPC,  KC_SPC,   LOWER,      RAISE,  KC_ENT,  KC_DEL, KC_LGUI
  //                    ╰───────────────────────────────────╯ ╰───────────────────────────────────╯
  ),

  [LAYER_LOWER] = LAYOUT(
  // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮
       KC_TILD, KC_EXLM,   KC_AT, KC_HASH,  KC_DLR, KC_PERC,    KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_UNDS,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       RGB_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,    KC_LBRC,   KC_P7,   KC_P8,   KC_P9, KC_RBRC, XXXXXXX,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       RGB_TOG, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX,    KC_PPLS,   KC_P4,   KC_P5,   KC_P6, KC_PMNS, KC_PEQL,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
      RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX,  EE_CLR, QK_BOOT,    KC_PAST,   KC_P1,   KC_P2,   KC_P3, KC_PSLS, KC_PDOT,
  // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯
                         XXXXXXX, XXXXXXX, XXXXXXX, _______,    _______, _______, _______, _______
  //                    ╰───────────────────────────────────╯ ╰───────────────────────────────────╯
  ),

  [LAYER_RAISE] = LAYOUT(
  // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮
        KC_F12,   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,      KC_F6,   KC_F7,   KC_F8,   KC_F9,  KC_F10,  KC_F11,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       KC_MNXT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,    XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLU,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       KC_MPLY, KC_LEFT,   KC_UP, KC_DOWN, KC_RGHT, XXXXXXX,    XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, KC_MUTE,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       KC_MPRV, KC_HOME, KC_PGUP, KC_PGDN,  KC_END, XXXXXXX,    QK_BOOT,  EE_CLR, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD,
  // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯
                         _______, _______, _______, _______,    _______, XXXXXXX, XXXXXXX, XXXXXXX
  //                    ╰───────────────────────────────────╯ ╰───────────────────────────────────╯
  ),
};
// clang-format on

A keyboards/bastardkb/dilemma/4x6_4/keymaps/default/readme.md => keyboards/bastardkb/dilemma/4x6_4/keymaps/default/readme.md +2 -0
@@ 0,0 1,2 @@
# Dilemma Max (4x6+4) default keymap


A keyboards/bastardkb/dilemma/4x6_4/keymaps/via/config.h => keyboards/bastardkb/dilemma/4x6_4/keymaps/via/config.h +20 -0
@@ 0,0 1,20 @@
/**
 * 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

A keyboards/bastardkb/dilemma/4x6_4/keymaps/via/keymap.c => keyboards/bastardkb/dilemma/4x6_4/keymaps/via/keymap.c +132 -0
@@ 0,0 1,132 @@
/**
 * 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/>.
 */
#include QMK_KEYBOARD_H

enum dilemma_keymap_layers {
    LAYER_BASE = 0,
    LAYER_LOWER,
    LAYER_RAISE,
    LAYER_POINTER,
};

// Automatically enable sniping-mode on the pointer layer.
// #define DILEMMA_AUTO_SNIPING_ON_LAYER LAYER_POINTER

#define LOWER MO(LAYER_LOWER)
#define RAISE MO(LAYER_RAISE)
#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
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  [LAYER_BASE] = LAYOUT(
  // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮
        KC_ESC,    KC_1,    KC_2,    KC_3,    KC_4,    KC_5,       KC_6,    KC_7,    KC_8,    KC_9,    KC_0, KC_MINS,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
        KC_TAB,    KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,       KC_Y,    KC_U,    KC_I,    KC_O,    KC_P, KC_BSLS,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       KC_LSFT,    KC_A,    KC_S,    KC_D,    KC_F,    KC_G,       KC_H,    KC_J,    KC_K,    KC_L, KC_SCLN, KC_QUOT,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       KC_LCTL,    PT_Z,    KC_X,    KC_C,    KC_V,    KC_B,       KC_N,    KC_M, KC_COMM,  KC_DOT, PT_SLSH, KC_LALT,
  // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯
                         KC_LALT, KC_BSPC,  KC_SPC,   LOWER,      RAISE,  KC_ENT, KC_DEL,  KC_MUTE
  //                    ╰───────────────────────────────────╯ ╰───────────────────────────────────╯
  ),

  [LAYER_LOWER] = LAYOUT(
  // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮
       KC_TILD, KC_EXLM,   KC_AT, KC_HASH,  KC_DLR, KC_PERC,    KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_UNDS,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       RGB_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,    KC_LBRC,   KC_P7,   KC_P8,   KC_P9, KC_RBRC, XXXXXXX,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       RGB_TOG, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX,    KC_PPLS,   KC_P4,   KC_P5,   KC_P6, KC_PMNS, KC_PEQL,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
      RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,    KC_PAST,   KC_P1,   KC_P2,   KC_P3, KC_PSLS, KC_PDOT,
  // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯
                         XXXXXXX, XXXXXXX, XXXXXXX, _______,    XXXXXXX, _______, XXXXXXX, XXXXXXX
  //                    ╰───────────────────────────────────╯ ╰───────────────────────────────────╯
  ),

  [LAYER_RAISE] = LAYOUT(
  // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮
        KC_F12,   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,      KC_F6,   KC_F7,   KC_F8,   KC_F9,  KC_F10,  KC_F11,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       KC_MNXT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,    XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLU,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       KC_MPLY, KC_LEFT,   KC_UP, KC_DOWN, KC_RGHT, XXXXXXX,    XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, KC_MUTE,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       KC_MPRV, KC_HOME, KC_PGUP, KC_PGDN,  KC_END, XXXXXXX,    XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD,
  // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯
                         XXXXXXX, _______, _______, XXXXXXX,    _______, XXXXXXX, XXXXXXX, XXXXXXX
  //                    ╰───────────────────────────────────╯ ╰───────────────────────────────────╯
  ),

  [LAYER_POINTER] = LAYOUT(
  // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮
       XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,    XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DPI_MOD, S_D_MOD,    S_D_MOD, DPI_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       XXXXXXX, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX,    XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, XXXXXXX,
  // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤
       XXXXXXX, _______, DRGSCRL, SNIPING, EE_CLR,  QK_BOOT,    QK_BOOT, EE_CLR,  SNIPING, DRGSCRL, _______, XXXXXXX,
  // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯
                         XXXXXXX, KC_BTN2, KC_BTN1, KC_BTN3,    KC_BTN3, KC_BTN1, KC_BTN2, 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_ENABLEE

#ifdef RGB_MATRIX_ENABLE
// Forward-declare this helper function since it is defined in rgb_matrix.c.
void rgb_matrix_update_pwm_buffers(void);
#endif

#ifdef ENCODER_MAP_ENABLE
// clang-format off
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
    [LAYER_BASE]       = {ENCODER_CCW_CW(KC_WH_U, KC_WH_D), ENCODER_CCW_CW(KC_VOLU, KC_VOLD)},
    [LAYER_LOWER]      = {ENCODER_CCW_CW(KC_UP, KC_DOWN), ENCODER_CCW_CW(KC_LEFT, KC_RGHT)},
    [LAYER_RAISE]      = {ENCODER_CCW_CW(KC_PGUP, KC_PGDN), ENCODER_CCW_CW(KC_VOLU, KC_VOLD)},
    [LAYER_POINTER]    = {ENCODER_CCW_CW(RGB_HUD, RGB_HUI), ENCODER_CCW_CW(RGB_SAD, RGB_SAI)},
};
// clang-format on
#endif // ENCODER_MAP_ENABLE

void shutdown_user(void) {
#ifdef RGB_MATRIX_ENABLE
    rgb_matrix_sethsv_noeeprom(HSV_RED);
    rgb_matrix_update_pwm_buffers();
#endif // RGB_MATRIX_ENABLE
}

A keyboards/bastardkb/dilemma/4x6_4/keymaps/via/readme.md => keyboards/bastardkb/dilemma/4x6_4/keymaps/via/readme.md +47 -0
@@ 0,0 1,47 @@
# Dilemma Max `via` keymap

The Dilemma Max `via` keymap is based on the original [Dactyl Manuform](../../../../../handwired/dactyl_manuform) default keymap, with 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
```

A keyboards/bastardkb/dilemma/4x6_4/keymaps/via/rules.mk => keyboards/bastardkb/dilemma/4x6_4/keymaps/via/rules.mk +2 -0
@@ 0,0 1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

A keyboards/bastardkb/dilemma/4x6_4/mcuconf.h => keyboards/bastardkb/dilemma/4x6_4/mcuconf.h +23 -0
@@ 0,0 1,23 @@
/**
 * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
 *
 * 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

#include_next <mcuconf.h>

#undef RP_SPI_USE_SPI0
#define RP_SPI_USE_SPI0 TRUE

A keyboards/bastardkb/dilemma/4x6_4/readme.md => keyboards/bastardkb/dilemma/4x6_4/readme.md +5 -0
@@ 0,0 1,5 @@
# Dilemma Max (4x6+4)

This keyboard is an upsized version of the [3x5+3 Dilemma](../3x5_3/).

The Dilemma Max is available at [bastardkb.com](https://bastardkb.com).

A keyboards/bastardkb/dilemma/4x6_4/rules.mk => keyboards/bastardkb/dilemma/4x6_4/rules.mk +6 -0
@@ 0,0 1,6 @@
TRI_LAYER_ENABLE = yes		# Tri Layers

SERIAL_DRIVER = vendor

POINTING_DEVICE_ENABLE = yes
POINTING_DEVICE_DRIVER = cirque_pinnacle_spi

M keyboards/bastardkb/dilemma/readme.md => keyboards/bastardkb/dilemma/readme.md +10 -5
@@ 1,16 1,21 @@
# Dilemma

A very small keyboard made for ergonomic enthusiasts.
A family of split keyboards with embedded RP2040 controllers, support for Cirque GlidePoint circle trackpads, and SPI + I2C breakouts for other peripherals

-   Keyboard Maintainer: [Bastard Keyboards](https://github.com/Bastardkb/)
-   Hardware Supported: RP2040-based controller (_eg._ Splinky, Elite-c, ...)
-   Hardware Supported: [Bastardkb Dilemma](https://github.com/Bastardkb/Dilemma)
-   Hardware Availability: [Bastardkb.com](https://bastardkb.com/)

A pre-assembled version (with embedded controller) is also available.
A DIY version of the 3x5_2 PCB with promicro compatible footprint is also available.

Make example for this keyboard (after setting up your build environment):

    make bastardkb/dilemma/3x5_2/splinky:default
    make bastardkb/dilemma/3x5_2/assembled:default
    make bastardkb/dilemma/3x5_3:default
    make bastardkb/dilemma/4x6_4:default

Flashing example for this keyboard:

    make bastardkb/dilemma/3x5_3:default:flash
    make bastardkb/dilemma/4x6_4:default:flash

See the [keyboard build instructions](http://docs.bastardkb.com/)

Do not follow this link