Compare commits

..

No commits in common. "pimoroni_mod" and "psp_joystick_mod" have entirely different histories.

19 changed files with 14 additions and 784 deletions

6
.env
View File

@ -1,3 +1,3 @@
export kb=crkbd
export kr=rev4_1/standard
export km=vial
kb=crkbd
kr=rev4_1/standard
km=vial

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
# OSX thumbnails cache file
.DS_Store
secret.h

View File

@ -1,5 +1,7 @@
.PHONY: git-submodule, qmk-clean, qmk-init, qmk-compile, qmk-flash, qmk-init-all, qmk-compile-all, vial-qmk-clean, vial-qmk-init, vial-qmk-compile, vial-qmk-flash, vial-qmk-init-all, vial-qmk-compile-all, update-all
include .env
KB := crkbd
KR := rev1
KM := default

View File

@ -3,14 +3,13 @@
#define SERIAL_USART_TX_PIN GP12
#define USB_VBUS_PIN GP13
#define SPLIT_HAND_PIN GP21
#define MASTER_RIGHT
#define I2C_DRIVER I2CD1
#define OLED_UPDATE_INTERVAL 50
#define I2C1_SDA_PIN GP6
#define I2C1_SCL_PIN GP7
#define RGB_DISABLE_WHEN_USB_SUSPENDED
#define RGB_MATRIX_SLEEP
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES
@ -25,10 +24,9 @@
#define SPLIT_POINTING_ENABLE
#define POINTING_DEVICE_RIGHT
#define POINTING_DEVICE_ROTATION_270
#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
#define AUTO_MOUSE_DEFAULT_LAYER 5
#define AUTO_MOUSE_TIME 1000
#define POINTING_DEVICE_INVERT_Y
#define LEADER_TIMEOUT 250
#define LEADER_PER_KEY_TIMING
#define ANALOG_JOYSTICK_X_AXIS_PIN 26
#define ANALOG_JOYSTICK_Y_AXIS_PIN 27
#define ANALOG_JOYSTICK_AXIS_MIN 256
#define ANALOG_JOYSTICK_AXIS_MAX 1023

View File

@ -58,15 +58,14 @@
"encoder": {
"right": {
"rotary": [
{"pin_a": "GP24", "pin_b": "GP26"},
{"pin_a": "GP27", "pin_b": "GP26"}
{"pin_a": "GP24", "pin_b": "GP7"},
{"pin_a": "GP6", "pin_b": "GP7"}
]
}
},
"transport": {
"protocol": "serial_usart",
"sync": {
"layer_state": true,
"matrix_state": true
},
"watchdog": true

View File

@ -1,4 +1,3 @@
SERIAL_DRIVER = vendor
POINTING_DEVICE_ENABLE = yes
POINTING_DEVICE_DRIVER = pimoroni_trackball
LEADER_ENABLE = yes
POINTING_DEVICE_DRIVER = analog_joystick

View File

@ -1,35 +0,0 @@
#pragma once
#define SERIAL_USART_TX_PIN GP12
#define USB_VBUS_PIN GP13
#define SPLIT_HAND_PIN GP21
#define MASTER_RIGHT
#define I2C_DRIVER I2CD1
#define OLED_UPDATE_INTERVAL 50
#define I2C1_SDA_PIN GP26
#define I2C1_SCL_PIN GP27
#define RGB_DISABLE_WHEN_USB_SUSPENDED
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES
#define USB_SUSPEND_WAKEUP_DELAY 200
/* RP2040- and hardware-specific config */
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#define DYNAMIC_KEYMAP_LAYER_COUNT 6
#define SPLIT_POINTING_ENABLE
#define POINTING_DEVICE_RIGHT
#define POINTING_DEVICE_ROTATION_270
#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
#define AUTO_MOUSE_DEFAULT_LAYER 5
#define AUTO_MOUSE_TIME 1000
#define LEADER_TIMEOUT 250
#define LEADER_PER_KEY_TIMING

View File

@ -1,5 +0,0 @@
#pragma once
#define HAL_USE_I2C TRUE
#include_next <halconf.h>

View File

@ -1,357 +0,0 @@
{
"maintainer": "foostan",
"manufacturer": "foostan",
"url": "https://github.com/foostan/crkbd",
"usb": {
"vid": "0x4653",
"device_version": "4.1.0"
},
"processor": "RP2040",
"bootloader": "rp2040",
"features": {
"bootmagic": true,
"extrakey": true,
"nkro": true,
"oled": true,
"rgblight": false,
"rgb_matrix": true,
"mousekey": true,
"encoder": true
},
"build": {
"lto": true
},
"diode_direction": "COL2ROW",
"matrix_pins": {
"direct":[
["GP22", "GP20", "GP23", "GP26", "GP29", "GP0", "GP4"],
["GP19", "GP18", "GP24", "GP27", "GP1", "GP2", "GP8"],
["GP17", "GP16", "GP25", "GP28", "GP3", "GP9", null],
[ null, null, null, "GP14", "GP15", "GP11", null]
]
},
"encoder": {
"rotary": [
{"pin_a": "GP5", "pin_b": "GP7"},
{"pin_a": "GP6", "pin_b": "GP7"}
]
},
"bootmagic": {
"enabled": true,
"matrix": [ 0, 1 ]
},
"split": {
"enabled": true,
"bootmagic": {
"matrix": [ 4, 1 ]
},
"matrix_pins": {
"right": {
"direct": [
[ "GP8", "GP9", "GP3", "GP2", "GP1", "GP6", "GP25"],
["GP11", "GP14", "GP4", "GP0", "GP28", "GP7", "GP23"],
["GP15", "GP18", "GP5", "GP29", "GP20", "GP22", null],
[ null, null, null, "GP16", "GP17", "GP19", null]
]
}
},
"encoder": {
"right": {
"rotary": [
{"pin_a": "GP24", "pin_b": "GP26"},
{"pin_a": "GP27", "pin_b": "GP26"}
]
}
},
"transport": {
"protocol": "serial_usart",
"sync": {
"layer_state": true,
"matrix_state": true
},
"watchdog": true
}
},
"community_layouts": [ "split_3x5_3", "split_3x6_3" ],
"layouts": {
"LAYOUT_split_3x5_3": {
"layout": [
{"matrix": [0, 1], "x": 0, "y": 0.3},
{"matrix": [0, 2], "x": 1, "y": 0.1},
{"matrix": [0, 3], "x": 2, "y": 0},
{"matrix": [0, 4], "x": 3, "y": 0.1},
{"matrix": [0, 5], "x": 4, "y": 0.2},
{"matrix": [4, 5], "x": 8, "y": 0.2},
{"matrix": [4, 4], "x": 9, "y": 0.1},
{"matrix": [4, 3], "x": 10, "y": 0},
{"matrix": [4, 2], "x": 11, "y": 0.1},
{"matrix": [4, 1], "x": 12, "y": 0.3},
{"matrix": [1, 1], "x": 0, "y": 1.3},
{"matrix": [1, 2], "x": 1, "y": 1.1},
{"matrix": [1, 3], "x": 2, "y": 1},
{"matrix": [1, 4], "x": 3, "y": 1.1},
{"matrix": [1, 5], "x": 4, "y": 1.2},
{"matrix": [5, 5], "x": 8, "y": 1.2},
{"matrix": [5, 4], "x": 9, "y": 1.1},
{"matrix": [5, 3], "x": 10, "y": 1},
{"matrix": [5, 2], "x": 11, "y": 1.1},
{"matrix": [5, 1], "x": 12, "y": 1.3},
{"matrix": [2, 1], "x": 0, "y": 2.3},
{"matrix": [2, 2], "x": 1, "y": 2.1},
{"matrix": [2, 3], "x": 2, "y": 2},
{"matrix": [2, 4], "x": 3, "y": 2.1},
{"matrix": [2, 5], "x": 4, "y": 2.2},
{"matrix": [6, 5], "x": 8, "y": 2.2},
{"matrix": [6, 4], "x": 9, "y": 2.1},
{"matrix": [6, 3], "x": 10, "y": 2},
{"matrix": [6, 2], "x": 11, "y": 2.1},
{"matrix": [6, 1], "x": 12, "y": 2.3},
{"matrix": [3, 3], "x": 3, "y": 3.7},
{"matrix": [3, 4], "x": 4, "y": 3.7},
{"matrix": [3, 5], "x": 5, "y": 3.2, "h": 1.5},
{"matrix": [7, 5], "x": 7, "y": 3.2, "h": 1.5},
{"matrix": [7, 4], "x": 8, "y": 3.7},
{"matrix": [7, 3], "x": 9, "y": 3.7}
]
},
"LAYOUT_split_3x6_3": {
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0.3},
{"matrix": [0, 1], "x": 1, "y": 0.3},
{"matrix": [0, 2], "x": 2, "y": 0.1},
{"matrix": [0, 3], "x": 3, "y": 0},
{"matrix": [0, 4], "x": 4, "y": 0.1},
{"matrix": [0, 5], "x": 5, "y": 0.2},
{"matrix": [4, 5], "x": 9, "y": 0.2},
{"matrix": [4, 4], "x": 10, "y": 0.1},
{"matrix": [4, 3], "x": 11, "y": 0},
{"matrix": [4, 2], "x": 12, "y": 0.1},
{"matrix": [4, 1], "x": 13, "y": 0.3},
{"matrix": [4, 0], "x": 14, "y": 0.3},
{"matrix": [1, 0], "x": 0, "y": 1.3},
{"matrix": [1, 1], "x": 1, "y": 1.3},
{"matrix": [1, 2], "x": 2, "y": 1.1},
{"matrix": [1, 3], "x": 3, "y": 1},
{"matrix": [1, 4], "x": 4, "y": 1.1},
{"matrix": [1, 5], "x": 5, "y": 1.2},
{"matrix": [5, 5], "x": 9, "y": 1.2},
{"matrix": [5, 4], "x": 10, "y": 1.1},
{"matrix": [5, 3], "x": 11, "y": 1},
{"matrix": [5, 2], "x": 12, "y": 1.1},
{"matrix": [5, 1], "x": 13, "y": 1.3},
{"matrix": [5, 0], "x": 14, "y": 1.3},
{"matrix": [2, 0], "x": 0, "y": 2.3},
{"matrix": [2, 1], "x": 1, "y": 2.3},
{"matrix": [2, 2], "x": 2, "y": 2.1},
{"matrix": [2, 3], "x": 3, "y": 2},
{"matrix": [2, 4], "x": 4, "y": 2.1},
{"matrix": [2, 5], "x": 5, "y": 2.2},
{"matrix": [6, 5], "x": 9, "y": 2.2},
{"matrix": [6, 4], "x": 10, "y": 2.1},
{"matrix": [6, 3], "x": 11, "y": 2},
{"matrix": [6, 2], "x": 12, "y": 2.1},
{"matrix": [6, 1], "x": 13, "y": 2.3},
{"matrix": [6, 0], "x": 14, "y": 2.3},
{"matrix": [3, 3], "x": 4, "y": 3.7},
{"matrix": [3, 4], "x": 5, "y": 3.7},
{"matrix": [3, 5], "x": 6, "y": 3.2, "h": 1.5},
{"matrix": [7, 5], "x": 8, "y": 3.2, "h": 1.5},
{"matrix": [7, 4], "x": 9, "y": 3.7},
{"matrix": [7, 3], "x": 10, "y": 3.7}
]
},
"LAYOUT_split_3x5_3_ex2": {
"layout": [
{"matrix": [0, 1], "x": 0, "y": 0.3},
{"matrix": [0, 2], "x": 1, "y": 0.1},
{"matrix": [0, 3], "x": 2, "y": 0},
{"matrix": [0, 4], "x": 3, "y": 0.1},
{"matrix": [0, 5], "x": 4, "y": 0.2},
{"matrix": [0, 6], "x": 5, "y": 0.7},
{"matrix": [4, 6], "x": 8, "y": 0.7},
{"matrix": [4, 5], "x": 9, "y": 0.2},
{"matrix": [4, 4], "x": 10, "y": 0.1},
{"matrix": [4, 3], "x": 11, "y": 0},
{"matrix": [4, 2], "x": 12, "y": 0.1},
{"matrix": [4, 1], "x": 13, "y": 0.3},
{"matrix": [1, 1], "x": 0, "y": 1.3},
{"matrix": [1, 2], "x": 1, "y": 1.1},
{"matrix": [1, 3], "x": 2, "y": 1},
{"matrix": [1, 4], "x": 3, "y": 1.1},
{"matrix": [1, 5], "x": 4, "y": 1.2},
{"matrix": [1, 6], "x": 5, "y": 1.7},
{"matrix": [5, 6], "x": 8, "y": 1.7},
{"matrix": [5, 5], "x": 9, "y": 1.2},
{"matrix": [5, 4], "x": 10, "y": 1.1},
{"matrix": [5, 3], "x": 11, "y": 1},
{"matrix": [5, 2], "x": 12, "y": 1.1},
{"matrix": [5, 1], "x": 13, "y": 1.3},
{"matrix": [2, 1], "x": 0, "y": 2.3},
{"matrix": [2, 2], "x": 1, "y": 2.1},
{"matrix": [2, 3], "x": 2, "y": 2},
{"matrix": [2, 4], "x": 3, "y": 2.1},
{"matrix": [2, 5], "x": 4, "y": 2.2},
{"matrix": [6, 5], "x": 9, "y": 2.2},
{"matrix": [6, 4], "x": 10, "y": 2.1},
{"matrix": [6, 3], "x": 11, "y": 2},
{"matrix": [6, 2], "x": 12, "y": 2.1},
{"matrix": [6, 1], "x": 13, "y": 2.3},
{"matrix": [3, 3], "x": 4, "y": 3.7},
{"matrix": [3, 4], "x": 5, "y": 3.7},
{"matrix": [3, 5], "x": 6, "y": 3.2, "h": 1.5},
{"matrix": [7, 5], "x": 8, "y": 3.2, "h": 1.5},
{"matrix": [7, 4], "x": 9, "y": 3.7},
{"matrix": [7, 3], "x": 10, "y": 3.7}
]
},
"LAYOUT_split_3x6_3_ex2": {
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0.3},
{"matrix": [0, 1], "x": 1, "y": 0.3},
{"matrix": [0, 2], "x": 2, "y": 0.1},
{"matrix": [0, 3], "x": 3, "y": 0},
{"matrix": [0, 4], "x": 4, "y": 0.1},
{"matrix": [0, 5], "x": 5, "y": 0.2},
{"matrix": [0, 6], "x": 6, "y": 0.7},
{"matrix": [4, 6], "x": 8, "y": 0.7},
{"matrix": [4, 5], "x": 9, "y": 0.2},
{"matrix": [4, 4], "x": 10, "y": 0.1},
{"matrix": [4, 3], "x": 11, "y": 0},
{"matrix": [4, 2], "x": 12, "y": 0.1},
{"matrix": [4, 1], "x": 13, "y": 0.3},
{"matrix": [4, 0], "x": 14, "y": 0.3},
{"matrix": [1, 0], "x": 0, "y": 1.3},
{"matrix": [1, 1], "x": 1, "y": 1.3},
{"matrix": [1, 2], "x": 2, "y": 1.1},
{"matrix": [1, 3], "x": 3, "y": 1},
{"matrix": [1, 4], "x": 4, "y": 1.1},
{"matrix": [1, 5], "x": 5, "y": 1.2},
{"matrix": [1, 6], "x": 6, "y": 1.7},
{"matrix": [5, 6], "x": 8, "y": 1.7},
{"matrix": [5, 5], "x": 9, "y": 1.2},
{"matrix": [5, 4], "x": 10, "y": 1.1},
{"matrix": [5, 3], "x": 11, "y": 1},
{"matrix": [5, 2], "x": 12, "y": 1.1},
{"matrix": [5, 1], "x": 13, "y": 1.3},
{"matrix": [5, 0], "x": 14, "y": 1.3},
{"matrix": [2, 0], "x": 0, "y": 2.3},
{"matrix": [2, 1], "x": 1, "y": 2.3},
{"matrix": [2, 2], "x": 2, "y": 2.1},
{"matrix": [2, 3], "x": 3, "y": 2},
{"matrix": [2, 4], "x": 4, "y": 2.1},
{"matrix": [2, 5], "x": 5, "y": 2.2},
{"matrix": [6, 5], "x": 9, "y": 2.2},
{"matrix": [6, 4], "x": 10, "y": 2.1},
{"matrix": [6, 3], "x": 11, "y": 2},
{"matrix": [6, 2], "x": 12, "y": 2.1},
{"matrix": [6, 1], "x": 13, "y": 2.3},
{"matrix": [6, 0], "x": 14, "y": 2.3},
{"matrix": [3, 3], "x": 4, "y": 3.7},
{"matrix": [3, 4], "x": 5, "y": 3.7},
{"matrix": [3, 5], "x": 6, "y": 3.2, "h": 1.5},
{"matrix": [7, 5], "x": 8, "y": 3.2, "h": 1.5},
{"matrix": [7, 4], "x": 9, "y": 3.7},
{"matrix": [7, 3], "x": 10, "y": 3.7}
]
}
},
"ws2812": {
"driver": "vendor",
"pin": "GP10"
},
"rgblight": {
"led_count": 46,
"split": true,
"split_count": [23, 23],
"max_brightness": 50,
"animations": {
"alternating": true,
"breathing": true,
"christmas": true,
"knight": true,
"rainbow_mood": true,
"rainbow_swirl": true,
"rgb_test": true,
"snake": true,
"static_gradient": true,
"twinkle": true
}
},
"rgb_matrix": {
"driver": "ws2812",
"max_brightness": 50,
"animations": {
"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,
"rainbow_moving_chevron": true,
"cycle_out_in": true,
"cycle_out_in_dual": 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
}
}
}

View File

@ -1,6 +0,0 @@
#pragma once
#include_next <mcuconf.h>
#undef RP_I2C_USE_I2C1
#define RP_I2C_USE_I2C1 TRUE

View File

@ -1,52 +0,0 @@
{
"keyboard_name": "Corne v4 mini",
"usb": {
"pid": "0x0104"
},
"rgb_matrix": {
"split_count": [20, 20],
"layout": [
{"matrix": [3, 5], "x": 95, "y": 63, "flags": 4},
{"matrix": [2, 5], "x": 85, "y": 39, "flags": 4},
{"matrix": [1, 5], "x": 85, "y": 21, "flags": 4},
{"matrix": [0, 5], "x": 85, "y": 4, "flags": 4},
{"matrix": [0, 4], "x": 68, "y": 2, "flags": 4},
{"matrix": [1, 4], "x": 68, "y": 19, "flags": 4},
{"matrix": [2, 4], "x": 68, "y": 37, "flags": 4},
{"matrix": [3, 4], "x": 80, "y": 58, "flags": 4},
{"matrix": [3, 3], "x": 60, "y": 55, "flags": 4},
{"matrix": [2, 3], "x": 50, "y": 35, "flags": 4},
{"matrix": [1, 3], "x": 50, "y": 13, "flags": 4},
{"matrix": [0, 3], "x": 50, "y": 0, "flags": 4},
{"matrix": [0, 2], "x": 33, "y": 3, "flags": 4},
{"matrix": [1, 2], "x": 33, "y": 20, "flags": 4},
{"matrix": [2, 2], "x": 33, "y": 37, "flags": 4},
{"matrix": [2, 1], "x": 16, "y": 42, "flags": 4},
{"matrix": [1, 1], "x": 16, "y": 24, "flags": 4},
{"matrix": [0, 1], "x": 16, "y": 7, "flags": 4},
{"matrix": [0, 6], "x": 103, "y": 17, "flags": 4},
{"matrix": [1, 6], "x": 103, "y": 24, "flags": 4},
{"matrix": [7, 5], "x": 129, "y": 63, "flags": 4},
{"matrix": [6, 5], "x": 139, "y": 39, "flags": 4},
{"matrix": [5, 5], "x": 139, "y": 21, "flags": 4},
{"matrix": [4, 5], "x": 139, "y": 4, "flags": 4},
{"matrix": [4, 4], "x": 156, "y": 2, "flags": 4},
{"matrix": [5, 4], "x": 156, "y": 19, "flags": 4},
{"matrix": [6, 4], "x": 156, "y": 37, "flags": 4},
{"matrix": [7, 4], "x": 144, "y": 58, "flags": 4},
{"matrix": [7, 3], "x": 164, "y": 55, "flags": 4},
{"matrix": [6, 3], "x": 174, "y": 35, "flags": 4},
{"matrix": [5, 3], "x": 174, "y": 13, "flags": 4},
{"matrix": [4, 3], "x": 174, "y": 0, "flags": 4},
{"matrix": [4, 2], "x": 191, "y": 3, "flags": 4},
{"matrix": [5, 2], "x": 191, "y": 20, "flags": 4},
{"matrix": [6, 2], "x": 191, "y": 37, "flags": 4},
{"matrix": [6, 1], "x": 208, "y": 42, "flags": 4},
{"matrix": [5, 1], "x": 208, "y": 24, "flags": 4},
{"matrix": [4, 1], "x": 208, "y": 7, "flags": 4},
{"matrix": [4, 6], "x": 122, "y": 17, "flags": 4},
{"matrix": [5, 6], "x": 122, "y": 24, "flags": 4}
]
}
}

View File

@ -1,5 +0,0 @@
#pragma once
#ifndef OLED_FONT_H
# define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c"
#endif

View File

@ -1,4 +0,0 @@
SERIAL_DRIVER = vendor
POINTING_DEVICE_ENABLE = yes
POINTING_DEVICE_DRIVER = pimoroni_trackball
LEADER_ENABLE = yes

View File

@ -1,58 +0,0 @@
{
"keyboard_name": "Corne v4",
"usb": {
"pid": "0x0004"
},
"rgb_matrix": {
"split_count": [23, 23],
"layout": [
{"matrix": [3, 5], "x": 95, "y": 63, "flags": 4},
{"matrix": [2, 5], "x": 85, "y": 39, "flags": 4},
{"matrix": [1, 5], "x": 85, "y": 21, "flags": 4},
{"matrix": [0, 5], "x": 85, "y": 4, "flags": 4},
{"matrix": [0, 4], "x": 68, "y": 2, "flags": 4},
{"matrix": [1, 4], "x": 68, "y": 19, "flags": 4},
{"matrix": [2, 4], "x": 68, "y": 37, "flags": 4},
{"matrix": [3, 4], "x": 80, "y": 58, "flags": 4},
{"matrix": [3, 3], "x": 60, "y": 55, "flags": 4},
{"matrix": [2, 3], "x": 50, "y": 35, "flags": 4},
{"matrix": [1, 3], "x": 50, "y": 13, "flags": 4},
{"matrix": [0, 3], "x": 50, "y": 0, "flags": 4},
{"matrix": [0, 2], "x": 33, "y": 3, "flags": 4},
{"matrix": [1, 2], "x": 33, "y": 20, "flags": 4},
{"matrix": [2, 2], "x": 33, "y": 37, "flags": 4},
{"matrix": [2, 1], "x": 16, "y": 42, "flags": 4},
{"matrix": [1, 1], "x": 16, "y": 24, "flags": 4},
{"matrix": [0, 1], "x": 16, "y": 7, "flags": 4},
{"matrix": [0, 0], "x": 0, "y": 7, "flags": 4},
{"matrix": [1, 0], "x": 0, "y": 24, "flags": 4},
{"matrix": [2, 0], "x": 0, "y": 41, "flags": 4},
{"matrix": [0, 6], "x": 103, "y": 17, "flags": 4},
{"matrix": [1, 6], "x": 103, "y": 24, "flags": 4},
{"matrix": [7, 5], "x": 129, "y": 63, "flags": 4},
{"matrix": [6, 5], "x": 139, "y": 39, "flags": 4},
{"matrix": [5, 5], "x": 139, "y": 21, "flags": 4},
{"matrix": [4, 5], "x": 139, "y": 4, "flags": 4},
{"matrix": [4, 4], "x": 156, "y": 2, "flags": 4},
{"matrix": [5, 4], "x": 156, "y": 19, "flags": 4},
{"matrix": [6, 4], "x": 156, "y": 37, "flags": 4},
{"matrix": [7, 4], "x": 144, "y": 58, "flags": 4},
{"matrix": [7, 3], "x": 164, "y": 55, "flags": 4},
{"matrix": [6, 3], "x": 174, "y": 35, "flags": 4},
{"matrix": [5, 3], "x": 174, "y": 13, "flags": 4},
{"matrix": [4, 3], "x": 174, "y": 0, "flags": 4},
{"matrix": [4, 2], "x": 191, "y": 3, "flags": 4},
{"matrix": [5, 2], "x": 191, "y": 20, "flags": 4},
{"matrix": [6, 2], "x": 191, "y": 37, "flags": 4},
{"matrix": [6, 1], "x": 208, "y": 42, "flags": 4},
{"matrix": [5, 1], "x": 208, "y": 24, "flags": 4},
{"matrix": [4, 1], "x": 208, "y": 7, "flags": 4},
{"matrix": [4, 0], "x": 224, "y": 7, "flags": 4},
{"matrix": [5, 0], "x": 224, "y": 24, "flags": 4},
{"matrix": [6, 0], "x": 224, "y": 41, "flags": 4},
{"matrix": [4, 6], "x": 122, "y": 17, "flags": 4},
{"matrix": [5, 6], "x": 122, "y": 24, "flags": 4}
]
}
}

View File

@ -1,28 +1,5 @@
#include QMK_KEYBOARD_H
#include "drivers/sensors/pimoroni_trackball.h"
#include "secret.h"
#ifndef SECRET_1
#define SECRET_1 secret
#endif
#ifndef SECRET_2
#define SECRET_2 secret
#endif
#ifndef EMAIL_1
#define EMAIL_1 email
#endif
#ifndef EMAIL_2
#define EMAIL_2 email
#endif
enum custom_keycodes {
DRAG_SCROLL = QK_USER_0,
BALL_HUE,
BALL_SAT,
BALL_VAL,
BALL_SPEED,
SAVE_CONF,
};
#ifdef LAYOUT_split_3x6_3_ex2
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@ -128,228 +105,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
#endif
bool set_scrolling = false;
// Modify these values to adjust the scrolling speed
#define SCROLL_DIVISOR_H 8.0
#define SCROLL_DIVISOR_V 8.0
// Variables to store accumulated scroll values
float scroll_accumulated_h = 0;
float scroll_accumulated_v = 0;
void pointing_device_init_user(void) {
set_auto_mouse_layer(5);
set_auto_mouse_enable(true);
}
/* Trackball related stuff */
static bool hue_mode_enabled = 0;
static bool sat_mode_enabled = 0;
static bool val_mode_enabled = 0;
static bool speed_mode_enabled = 0;
typedef union {
uint32_t raw;
struct {
uint8_t tb_hue :8;
uint8_t tb_value :8;
uint8_t tb_saturation :8;
};
} user_config_t;
user_config_t user_config;
static uint8_t tb_hue = 1;
static uint8_t tb_saturation = 255;
static uint8_t tb_value = 255;
#ifndef MIN
# define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
void trackball_set_hsv(uint8_t hue, uint8_t sat, uint8_t brightness) {
RGB rgb = hsv_to_rgb((HSV){hue, sat, brightness});
uint8_t white = MIN(rgb.r, MIN(rgb.g, rgb.b));
rgb.r -= white;
rgb.g -= white;
rgb.b -= white;
pimoroni_trackball_set_rgbw(rgb.r, rgb.g, rgb.b, white);
}
void keyboard_post_init_user(void) {
user_config.raw = eeconfig_read_user();
tb_hue = user_config.tb_hue;
tb_saturation = user_config.tb_saturation;
tb_value = user_config.tb_value;
trackball_set_hsv(tb_hue, tb_saturation,tb_value);
}
void eeconfig_init_user(void) {
user_config.raw = 0;
user_config.tb_hue = 80;
user_config.tb_saturation = 80;
user_config.tb_value = 80;
eeconfig_update_user(user_config.raw);
}
void suspend_power_down_user(void) {
trackball_set_hsv(0, 0, 0);
}
void suspend_wakeup_init_user(void) {
trackball_set_hsv(tb_hue, tb_saturation,tb_value);
}
bool is_mouse_record_user(uint16_t keycode, keyrecord_t* record) {
switch(keycode) {
case DRAG_SCROLL:
case BALL_HUE:
case BALL_SAT:
case BALL_VAL:
case BALL_SPEED:
return true;
default:
return false;
}
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case DRAG_SCROLL:
// Toggle set_scrolling when DRAG_SCROLL key is pressed or released
set_scrolling = record->event.pressed;
break;
case BALL_HUE:
hue_mode_enabled = record->event.pressed;
break;
case BALL_SAT:
sat_mode_enabled = record->event.pressed;
break;
case BALL_VAL:
val_mode_enabled = record->event.pressed;
break;
case BALL_SPEED:
speed_mode_enabled = record->event.pressed;
break;
case SAVE_CONF:
user_config.tb_value = tb_value;
user_config.tb_hue = tb_hue;
user_config.tb_saturation = tb_saturation;
eeconfig_update_user(user_config.raw);
break;
case C(KC_PAGE_UP): // for changing tabs
case C(KC_PAGE_DOWN): // for changing tabs
case A(KC_LEFT): // for back nav
case A(KC_RIGHT): // for forward nav
auto_mouse_keyevent(record->event.pressed);
break;
default:
break;
}
return true;
}
report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) {
// Check if drag scrolling is active
if (set_scrolling) {
// Calculate and accumulate scroll values based on mouse movement and divisors
scroll_accumulated_h += (float)mouse_report.x / SCROLL_DIVISOR_H;
scroll_accumulated_v += (float)mouse_report.y / SCROLL_DIVISOR_V;
// Assign integer parts of accumulated scroll values to the mouse report
mouse_report.h = (int8_t)scroll_accumulated_h;
mouse_report.v = (int8_t)scroll_accumulated_v;
// Update accumulated scroll values by subtracting the integer parts
scroll_accumulated_h -= (int8_t)scroll_accumulated_h;
scroll_accumulated_v -= (int8_t)scroll_accumulated_v;
// Clear the X and Y values of the mouse report
mouse_report.x = 0;
mouse_report.y = 0;
} else if (speed_mode_enabled) {
mouse_report.x = mouse_report.x * 2;
mouse_report.y = mouse_report.y * 2;
} else if (hue_mode_enabled) {
// adjust ball hue
tb_hue += mouse_report.y;
trackball_set_hsv(tb_hue | 1, tb_saturation, tb_value);
// Clear the X and Y values of the mouse report
mouse_report.x = 0;
mouse_report.y = 0;
} else if (sat_mode_enabled) {
// adjust ball saturation
tb_saturation += mouse_report.y * 2;
trackball_set_hsv(tb_hue, tb_saturation | 1, tb_value);
// Clear the X and Y values of the mouse report
mouse_report.x = 0;
mouse_report.y = 0;
} else if (val_mode_enabled) {
// adjust ball value
tb_value += mouse_report.y * 2;
trackball_set_hsv(tb_hue, tb_saturation, tb_value | 1);
// Clear the X and Y values of the mouse report
mouse_report.x = 0;
mouse_report.y = 0;
}
return mouse_report;
}
// Function to handle layer changes and disable drag scrolling when not in AUTO_MOUSE_DEFAULT_LAYER
layer_state_t layer_state_set_user(layer_state_t state) {
uint8_t layer = get_highest_layer(state);
if (layer != AUTO_MOUSE_DEFAULT_LAYER) {
set_scrolling = false;
hue_mode_enabled = false;
sat_mode_enabled = false;
val_mode_enabled = false;
speed_mode_enabled = false;
}
switch (layer) {
case 1:
trackball_set_hsv(tb_hue + 40, tb_saturation, tb_value > 60 ? tb_value - 60 : 0);
break;
case 2:
// numbers + nav
trackball_set_hsv(tb_hue + 80, tb_saturation, tb_value > 60 ? tb_value - 60 : 0);
break;
case 3:
// symbols
trackball_set_hsv(tb_hue + 80, tb_saturation, tb_value > 60 ? tb_value - 60 : 0);
break;
case 4:
// media
trackball_set_hsv(tb_hue + 80, tb_saturation, tb_value > 60 ? tb_value - 60 : 0);
break;
case 5:
// mouse layer
trackball_set_hsv(tb_hue, tb_saturation, tb_value);
break;
default:
trackball_set_hsv(tb_hue, tb_saturation, tb_value > 60 ? tb_value - 60 : 0);
break;
}
return state;
}
void leader_end_user(void) {
if (leader_sequence_two_keys(KC_D, KC_A)) {
SEND_STRING(SECRET_1);
} else if (leader_sequence_three_keys(KC_T, KC_A, KC_O)) {
SEND_STRING(SECRET_2);
} else if (leader_sequence_two_keys(KC_E, KC_O)) {
SEND_STRING(EMAIL_1);
} else if (leader_sequence_two_keys(KC_E, KC_S)) {
SEND_STRING(EMAIL_2);
}
}
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[0] = { ENCODER_CCW_CW(RGB_MOD, RGB_RMOD), ENCODER_CCW_CW(RGB_HUI, RGB_HUD), ENCODER_CCW_CW(RGB_VAI, RGB_VAD), ENCODER_CCW_CW(RGB_SAI, RGB_SAD), },