Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Keyboard] Add Spleeb default and custom firmware #19481

Merged
merged 7 commits into from
Mar 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions keyboards/spleeb/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2022 Chris Hoage (@chrishoage)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

// Auto mouse layer makes use of the Cirque touchdown indicator which requires
// the touch sensor to be on the master side
#define MASTER_RIGHT

// Sync later, led, and mod state for use on OLED on slave side
#define SPLIT_LAYER_STATE_ENABLE
#define SPLIT_LED_STATE_ENABLE
#define SPLIT_MODS_ENABLE
// Transport dpi and enc mode for display on oled
#define SPLIT_TRANSACTION_IDS_KB RPC_ID_KB_CONFIG_SYNC

#ifdef POINTING_DEVICE_ENABLE
# define POINTING_DEVICE_AUTO_MOUSE_ENABLE
// Absolute mode allows for z/touchdown triggering of auto mouse layer with out
// moving finger
# define CIRQUE_PINNACLE_POSITION_MODE CIRQUE_PINNACLE_ABSOLUTE_MODE
# define POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
#endif // POINTING_DEVICE_ENABLE

#define I2C_DRIVER I2CD1
#define I2C1_SDA_PIN GP16
#define I2C1_SCL_PIN GP17

#ifdef OLED_ENABLE
# define OLED_DISPLAY_128X64
# define OLED_FONT_H "./lib/glcdfont.c"
#endif // OLED_ENABLE

#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP17
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 1000U
124 changes: 124 additions & 0 deletions keyboards/spleeb/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"manufacturer": "Chris Hoage",
"keyboard_name": "spleeb",
"maintainer": "chrishoage",
"bootloader": "rp2040",
"diode_direction": "COL2ROW",
"encoder": {
"enabled": true,
"rotary": [
{
"pin_a": "GP4",
"pin_b": "GP21",
"resolution": 2
}
]
},
"features": {
"nkro": true
},
"matrix_pins": {
"cols": ["GP23", "GP20", "GP22", "GP26", "GP27", "GP28", "GP29"],
"rows": ["GP5", "GP6", "GP7", "GP8", "GP9"]
},
"processor": "RP2040",
"board": "QMK_PM2040",
"secure": {
waffle87 marked this conversation as resolved.
Show resolved Hide resolved
"idle_timeout": 60000,
"unlock_sequence": [
[5, 0],
[5, 1]
],
"unlock_timeout": 5000
},
"split": {
"enabled": true,
"soft_serial_pin": "GP1",
"encoder": {
"right": {
"rotary": [
{
"pin_a": "GP21",
"pin_b": "GP4"
}
]
}
}
},
"url": "https://github.com/chrishoage/spleeb",
"usb": {
"device_version": "0.0.1",
"pid": "0x4242",
"vid": "0xFEED"
},
"layouts": {
"LAYOUT": {
"layout": [
{ "matrix": [0, 0], "x": 0, "y": 0.6 },
{ "matrix": [0, 1], "x": 1, "y": 0.6 },
{ "matrix": [0, 2], "x": 2, "y": 0.2 },
{ "matrix": [0, 3], "x": 3, "y": 0 },
{ "matrix": [0, 4], "x": 4, "y": 0.2 },
{ "matrix": [0, 5], "x": 5, "y": 0.4 },
{ "matrix": [0, 6], "x": 6, "y": 0.9 },
{ "matrix": [5, 6], "x": 9.75, "y": 0.9 },
{ "matrix": [5, 5], "x": 10.75, "y": 0.4 },
{ "matrix": [5, 4], "x": 11.75, "y": 0.2 },
{ "matrix": [5, 3], "x": 12.75, "y": 0 },
{ "matrix": [5, 2], "x": 13.75, "y": 0.2 },
{ "matrix": [5, 1], "x": 14.75, "y": 0.6 },
{ "matrix": [5, 0], "x": 15.75, "y": 0.6 },
{ "matrix": [1, 0], "x": 0, "y": 1.6 },
{ "matrix": [1, 1], "x": 1, "y": 1.6 },
{ "matrix": [1, 2], "x": 2, "y": 1.2 },
{ "matrix": [1, 3], "x": 3, "y": 1 },
{ "matrix": [1, 4], "x": 4, "y": 1.2 },
{ "matrix": [1, 5], "x": 5, "y": 1.4 },
{ "matrix": [1, 6], "x": 6, "y": 1.9 },
{ "matrix": [6, 6], "x": 9.75, "y": 1.9 },
{ "matrix": [6, 5], "x": 10.75, "y": 1.4 },
{ "matrix": [6, 4], "x": 11.75, "y": 1.2 },
{ "matrix": [6, 3], "x": 12.75, "y": 1 },
{ "matrix": [6, 2], "x": 13.75, "y": 1.2 },
{ "matrix": [6, 1], "x": 14.75, "y": 1.6 },
{ "matrix": [6, 0], "x": 15.75, "y": 1.6 },
{ "matrix": [2, 0], "x": 0, "y": 2.6 },
{ "matrix": [2, 1], "x": 1, "y": 2.6 },
{ "matrix": [2, 2], "x": 2, "y": 2.2 },
{ "matrix": [2, 3], "x": 3, "y": 2 },
{ "matrix": [2, 4], "x": 4, "y": 2.2 },
{ "matrix": [2, 5], "x": 5, "y": 2.4 },
{ "matrix": [2, 6], "x": 6, "y": 2.9 },
{ "matrix": [7, 6], "x": 9.75, "y": 2.9 },
{ "matrix": [7, 5], "x": 10.75, "y": 2.4 },
{ "matrix": [7, 4], "x": 11.75, "y": 2.2 },
{ "matrix": [7, 3], "x": 12.75, "y": 2 },
{ "matrix": [7, 2], "x": 13.75, "y": 2.2 },
{ "matrix": [7, 1], "x": 14.75, "y": 2.6 },
{ "matrix": [7, 0], "x": 15.75, "y": 2.6 },
{ "matrix": [3, 1], "x": 1, "y": 3.6 },
{ "matrix": [3, 2], "x": 2, "y": 3.2 },
{ "matrix": [3, 3], "x": 3, "y": 3 },
{ "matrix": [3, 4], "x": 4, "y": 3.2 },
{ "matrix": [3, 5], "x": 5, "y": 3.4 },
{ "matrix": [3, 6], "x": 7.2, "y": 3.15 },
{ "matrix": [8, 6], "x": 8.6, "y": 3.15 },
{ "matrix": [8, 5], "x": 10.75, "y": 3.4 },
{ "matrix": [8, 4], "x": 11.75, "y": 3.2 },
{ "matrix": [8, 3], "x": 12.75, "y": 3 },
{ "matrix": [8, 2], "x": 13.75, "y": 3.2 },
{ "matrix": [8, 1], "x": 14.75, "y": 3.6 },
{ "matrix": [4, 2], "x": 3, "y": 4.45 },
{ "matrix": [4, 3], "x": 4, "y": 4.45 },
{ "matrix": [4, 4], "x": -0.15, "y": 4.65 },
{ "h": 1.25, "matrix": [4, 5], "x": 0.85, "y": 4.4 },
{ "h": 1.25, "matrix": [4, 6], "x": 1.85, "y": 4.4 },
{ "h": 1.25, "matrix": [9, 6], "x": -3.1, "y": 4.6 },
{ "h": 1.25, "matrix": [9, 5], "x": -2.1, "y": 4.6 },
{ "matrix": [9, 4], "x": -1.1, "y": 4.85 },
{ "matrix": [9, 3], "x": 11.75, "y": 4.45 },
{ "matrix": [9, 2], "x": 12.75, "y": 4.45 }
]
}
}
}
15 changes: 15 additions & 0 deletions keyboards/spleeb/keymaps/chrishoage/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2022 Chris Hoage (@chrishoage)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#define AUTO_MOUSE_TIME 250

#define CIRQUE_PINNACLE_DIAMETER_MM 35
#define POINTING_DEVICE_ROTATION_180

#define SPLEEB_DRAGSCROLL_REVERSE_X
#define SPLEEB_ENCODER_MODE_MAP_ENABLE

#define BOOTMAGIC_LITE_ROW 5
#define BOOTMAGIC_LITE_COLUMN 6
127 changes: 127 additions & 0 deletions keyboards/spleeb/keymaps/chrishoage/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// Copyright 2022 Chris Hoage (@chrishoage)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

// Double tap TD(0) to enter bootloader
static void enter_qk_boot(qk_tap_dance_state_t *state, void *user_data) {
if (state->count >= 2) {
reset_keyboard();
reset_tap_dance(state);
}
}

enum SpleebLayer { _BASE = 0, _FN, _MOUSE };

qk_tap_dance_action_t tap_dance_actions[] = {[0] = ACTION_TAP_DANCE_FN(enter_qk_boot)};

// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[_BASE] = LAYOUT(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, KC_BSPC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MINS, KC_EQL, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT,
KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LBRC, KC_RBRC, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_RSFT,
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_MUTE, ENC_STR, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH,
KC_LCTL, KC_LALT, KC_LGUI, KC_ENT, MO(1), MO(1), KC_SPC, KC_RGUI, KC_RALT, KC_RCTL
),

[_FN] = LAYOUT(
KC_PAUS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_ESC, KC_DEL, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_PSCR,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_TRNS, KC_TRNS,
KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TRNS, QK_RBT,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ENC_STL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TD(0),
KC_TRNS, KC_TRNS, KC_TRNS, KC_SPC, KC_TRNS, KC_TRNS, KC_ENT, KC_TRNS, KC_TRNS, KC_TRNS
),

[_MOUSE] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
DRGSCRL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, SNIPING, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN3, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
};
// clang-format on

bool encoder_update_user(uint8_t index, bool clockwise) {
if (get_mods() & MOD_MASK_GUI) {
// When GUI is held trigger [ ] to move workspaces
tap_code(clockwise ? KC_RBRC : KC_LBRC);
return false;
}

if (get_mods() & MOD_MASK_CTRL) {
// When CTRL is hled trigger page up/down to move tabs (Firefox, VSCode)
tap_code(clockwise ? KC_PGDN : KC_PGUP);
return false;
}

if (get_mods() & MOD_MASK_ALT) {
// When ALT is held trigger up/down to move line up/down
tap_code(clockwise ? KC_DOWN : KC_UP);
return false;
}

// Defer to encoder_update_kb to trigger spleeb_encoder_mode_trigger
return true;
}

enum spleeb_enc_mode {
DEF_DPI,
SNP_DPI,
VOL,
SEL,
};

void spleeb_encoder_mode_trigger(uint8_t mode, bool clockwise) {
dprintf("spleeb_encoder_mode_trigger m: %u, c: %u\n", mode, clockwise);
switch (mode) {
case DEF_DPI:
spleeb_cycle_pointer_default_dpi(clockwise);
break;
case SNP_DPI:
spleeb_cycle_pointer_sniping_dpi(clockwise);
break;
case VOL:
tap_code(clockwise ? KC_VOLU : KC_VOLD);
break;
case SEL: {
bool is_shift = get_mods() & MOD_MASK_SHIFT;
uint16_t dir = clockwise ? KC_RIGHT : KC_LEFT;
if (is_shift) {
tap_code(dir);
} else {
tap_code16(LSFT(LCTL(dir)));
}
break;
}

default:
break;
}
}

const char *spleeb_encoder_mode_string(uint8_t mode) {
switch (mode) {
case DEF_DPI:
return "df dpi";
case SNP_DPI:
return "sn dpi";
case VOL:
return "volume";
case SEL:
return "select";
}

return get_u8_str(mode, ' ');
}

void pointing_device_init_user(void) {
set_auto_mouse_layer(_MOUSE);
}

const spleeb_enc_mode_t spleeb_encoder_mode_map[NUM_ENCODERS][SPLEEB_ENCODER_MODE_COUNT] = {
[0] = {SPLEEB_ENC_MODE(VOL), SPLEEB_ENC_MODE(SEL)},
[1] = {SPLEEB_ENC_MODE(DEF_DPI), SPLEEB_ENC_MODE(SNP_DPI), SPLEEB_ENC_MODE(SEL)},
};
11 changes: 11 additions & 0 deletions keyboards/spleeb/keymaps/chrishoage/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
TAP_DANCE_ENABLE = yes
BOOTMAGIC_ENABLE = yes
MOUSEKEY_ENABLE = yes
EXTRAKEY_ENABLE = yes
ENCODER_ENABLE = yes

POINTING_DEVICE_ENABLE = yes
POINTING_DEVICE_DRIVER = cirque_pinnacle_i2c

OLED_ENABLE = yes
OLED_DRIVER = SSD1306
33 changes: 33 additions & 0 deletions keyboards/spleeb/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2022 Chris Hoage (@chrishoage)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[0] = LAYOUT(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, KC_BSPC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MINS, KC_EQL, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT,
KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LBRC, KC_RBRC, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_RSFT,
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_NO, KC_NO, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH,
KC_LCTL, KC_LALT, KC_LGUI, KC_ENT, MO(1), MO(1), KC_SPC, KC_RGUI, KC_RALT, KC_RCTL
),

[1] = LAYOUT(
KC_PAUS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_ESC, KC_DEL, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_PSCR,
KC_LCAP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_SPC, KC_TRNS, KC_TRNS, KC_ENT, KC_TRNS, KC_TRNS, KC_TRNS
),

[2] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
};
// clang-format on
Loading