Updates related to trackball

This commit is contained in:
Danny Oh 2024-07-11 11:35:09 -05:00
parent 4645625100
commit 3b673ea3d4
15 changed files with 558 additions and 43 deletions

6
.env
View File

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

View File

@ -1,7 +1,5 @@
.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 .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 KB := crkbd
KR := rev1 KR := rev1
KM := default KM := default

View File

@ -3,11 +3,12 @@
#define SERIAL_USART_TX_PIN GP12 #define SERIAL_USART_TX_PIN GP12
#define USB_VBUS_PIN GP13 #define USB_VBUS_PIN GP13
#define SPLIT_HAND_PIN GP21 #define SPLIT_HAND_PIN GP21
#define MASTER_RIGHT
#define I2C_DRIVER I2CD1 #define I2C_DRIVER I2CD1
#define OLED_UPDATE_INTERVAL 50 #define OLED_UPDATE_INTERVAL 50
#define I2C1_SDA_PIN GP26 #define I2C1_SDA_PIN GP6
#define I2C1_SCL_PIN GP27 #define I2C1_SCL_PIN GP7
#define RGB_MATRIX_SLEEP #define RGB_MATRIX_SLEEP
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_FRAMEBUFFER_EFFECTS

View File

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

View File

@ -0,0 +1,31 @@
#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_MATRIX_SLEEP
#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

View File

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

View File

@ -0,0 +1,357 @@
{
"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

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

View File

@ -0,0 +1,52 @@
{
"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

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

View File

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

View File

@ -0,0 +1,58 @@
{
"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,11 +1,12 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#include <drivers/sensors/pimoroni_trackball.h> #include "drivers/sensors/pimoroni_trackball.h"
enum custom_keycodes { enum custom_keycodes {
DRAG_SCROLL = QK_USER_0, DRAG_SCROLL = QK_USER_0,
BALL_HUE, BALL_HUE,
BALL_SAT, BALL_SAT,
BALL_VAL, BALL_VAL,
BALL_SPEED,
SAVE_CONF, SAVE_CONF,
}; };
@ -58,18 +59,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//|--------+--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------+--------| //|--------+--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------+--------|
KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RGUI KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RGUI
//`--------------------------' `--------------------------' //`--------------------------' `--------------------------'
),
[5] = LAYOUT_split_3x6_3_ex2(
//,--------------------------------------------------------------. ,--------------------------------------------------------------.
QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DRAG_SCROLL, XXXXXXX, BALL_HUE, BALL_SAT, BALL_VAL, SAVE_CONF,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------' `--------+--------+--------+--------+--------+--------+--------|
RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------+--------|
KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RGUI
//`--------------------------' `--------------------------'
) )
}; };
#else #else
@ -121,18 +110,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT
//`--------------------------' `--------------------------' //`--------------------------' `--------------------------'
),
[5] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DRAG_SCROLL, XXXXXXX, BALL_HUE, BALL_SAT, BALL_VAL, SAVE_CONF,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT
//`--------------------------' `--------------------------'
) )
}; };
#endif #endif
@ -147,10 +124,6 @@ bool set_scrolling = false;
float scroll_accumulated_h = 0; float scroll_accumulated_h = 0;
float scroll_accumulated_v = 0; float scroll_accumulated_v = 0;
void pointing_device_init_user(void) { void pointing_device_init_user(void) {
set_auto_mouse_layer(5); set_auto_mouse_layer(5);
set_auto_mouse_enable(true); set_auto_mouse_enable(true);
@ -162,6 +135,7 @@ void pointing_device_init_user(void) {
static bool hue_mode_enabled = 0; static bool hue_mode_enabled = 0;
static bool sat_mode_enabled = 0; static bool sat_mode_enabled = 0;
static bool val_mode_enabled = 0; static bool val_mode_enabled = 0;
static bool speed_mode_enabled = 0;
typedef union { typedef union {
uint32_t raw; uint32_t raw;
@ -207,10 +181,15 @@ void eeconfig_init_user(void) {
eeconfig_update_user(user_config.raw); eeconfig_update_user(user_config.raw);
} }
// void suspend_power_down_user(void) { void suspend_power_down_user(void) {
// trackball_set_brightness(0); rgb_matrix_set_suspend_state(true);
/* trackball_sleep(); */ trackball_set_hsv(0, 0, 0);
// } }
void suspend_wakeup_init_user(void) {
rgb_matrix_set_suspend_state(false);
trackball_set_hsv(tb_hue, tb_saturation,tb_value);
}
bool is_mouse_record_user(uint16_t keycode, keyrecord_t* record) { bool is_mouse_record_user(uint16_t keycode, keyrecord_t* record) {
switch(keycode) { switch(keycode) {
@ -218,6 +197,7 @@ bool is_mouse_record_user(uint16_t keycode, keyrecord_t* record) {
case BALL_HUE: case BALL_HUE:
case BALL_SAT: case BALL_SAT:
case BALL_VAL: case BALL_VAL:
case BALL_SPEED:
return true; return true;
default: default:
return false; return false;
@ -239,6 +219,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case BALL_VAL: case BALL_VAL:
val_mode_enabled = record->event.pressed; val_mode_enabled = record->event.pressed;
break; break;
case BALL_SPEED:
speed_mode_enabled = record->event.pressed;
break;
case SAVE_CONF: case SAVE_CONF:
user_config.tb_value = tb_value; user_config.tb_value = tb_value;
user_config.tb_hue = tb_hue; user_config.tb_hue = tb_hue;
@ -269,18 +252,30 @@ report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) {
// Clear the X and Y values of the mouse report // Clear the X and Y values of the mouse report
mouse_report.x = 0; mouse_report.x = 0;
mouse_report.y = 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) { } else if (hue_mode_enabled) {
// adjust ball hue // adjust ball hue
tb_hue += mouse_report.y; tb_hue += mouse_report.y;
trackball_set_hsv(tb_hue | 1, tb_saturation, tb_value); 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) { } else if (sat_mode_enabled) {
// adjust ball saturation // adjust ball saturation
tb_saturation += mouse_report.y * 2; tb_saturation += mouse_report.y * 2;
trackball_set_hsv(tb_hue, tb_saturation | 1, tb_value); 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) { } else if (val_mode_enabled) {
// adjust ball value // adjust ball value
tb_value += mouse_report.y * 2; tb_value += mouse_report.y * 2;
trackball_set_hsv(tb_hue, tb_saturation, tb_value | 1); 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; return mouse_report;
} }
@ -290,6 +285,10 @@ layer_state_t layer_state_set_user(layer_state_t state) {
uint8_t layer = get_highest_layer(state); uint8_t layer = get_highest_layer(state);
if (layer != AUTO_MOUSE_DEFAULT_LAYER) { if (layer != AUTO_MOUSE_DEFAULT_LAYER) {
set_scrolling = false; set_scrolling = false;
hue_mode_enabled = false;
sat_mode_enabled = false;
val_mode_enabled = false;
speed_mode_enabled = false;
} }
switch (layer) { switch (layer) {
@ -327,6 +326,5 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[1] = { 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), }, [1] = { 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), },
[2] = { 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), }, [2] = { 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), },
[3] = { 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), }, [3] = { 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), },
[5] = { 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), },
}; };
#endif #endif