summaryrefslogtreecommitdiff
path: root/keyboards
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2020-10-26 23:09:11 -0700
committerGitHub <noreply@github.com>2020-10-27 17:09:11 +1100
commit33074bcbadbafa3a359efda5a45a9412e4eca7d2 (patch)
tree5682dd93d88aa91a91b2e111f1b2a1e5604d7633 /keyboards
parent555b1640b26fa09ea5f6b5bc7ea07dc654a326f9 (diff)
[Keyboard] Bug fixes and improvements to PloopyCo devices (#10573)
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/ploopyco/mouse/config.h12
-rw-r--r--keyboards/ploopyco/mouse/info.json3
-rw-r--r--keyboards/ploopyco/mouse/keymaps/default/keymap.c4
-rw-r--r--keyboards/ploopyco/mouse/keymaps/default/readme.md2
-rw-r--r--keyboards/ploopyco/mouse/keymaps/drag_scroll/keymap.c62
-rw-r--r--keyboards/ploopyco/mouse/keymaps/drag_scroll/readme.md3
-rw-r--r--keyboards/ploopyco/mouse/keymaps/via/config.h21
-rw-r--r--keyboards/ploopyco/mouse/keymaps/via/keymap.c7
-rw-r--r--keyboards/ploopyco/mouse/mouse.c57
-rw-r--r--keyboards/ploopyco/mouse/mouse.h16
-rw-r--r--keyboards/ploopyco/mouse/readme.md17
-rw-r--r--keyboards/ploopyco/mouse/rules.mk4
-rw-r--r--keyboards/ploopyco/pmw3360.c (renamed from keyboards/ploopyco/pmw3600.c)13
-rw-r--r--keyboards/ploopyco/pmw3360.h (renamed from keyboards/ploopyco/pmw3600.h)0
-rw-r--r--keyboards/ploopyco/pmw3360_firmware.h (renamed from keyboards/ploopyco/pmw3600_firmware.h)0
-rw-r--r--keyboards/ploopyco/trackball/config.h27
-rw-r--r--keyboards/ploopyco/trackball/info.json3
-rw-r--r--keyboards/ploopyco/trackball/keymaps/default/keymap.c1
-rw-r--r--keyboards/ploopyco/trackball/keymaps/drag_scroll/keymap.c66
-rw-r--r--keyboards/ploopyco/trackball/keymaps/drag_scroll/readme.md3
-rw-r--r--keyboards/ploopyco/trackball/keymaps/via/config.h21
-rw-r--r--keyboards/ploopyco/trackball/keymaps/via/keymap.c12
-rw-r--r--keyboards/ploopyco/trackball/readme.md23
-rw-r--r--keyboards/ploopyco/trackball/rev1/config.h42
-rw-r--r--keyboards/ploopyco/trackball/rev1/rev1.h21
-rw-r--r--keyboards/ploopyco/trackball/rev1/rules.mk0
-rw-r--r--keyboards/ploopyco/trackball/rev1_005/config.h47
-rw-r--r--keyboards/ploopyco/trackball/rev1_005/rev1_005.h21
-rw-r--r--keyboards/ploopyco/trackball/rev1_005/rules.mk0
-rw-r--r--keyboards/ploopyco/trackball/rules.mk4
-rw-r--r--keyboards/ploopyco/trackball/trackball.c64
-rw-r--r--keyboards/ploopyco/trackball/trackball.h21
32 files changed, 536 insertions, 61 deletions
diff --git a/keyboards/ploopyco/mouse/config.h b/keyboards/ploopyco/mouse/config.h
index 787eb9a85e..db1c7d0020 100644
--- a/keyboards/ploopyco/mouse/config.h
+++ b/keyboards/ploopyco/mouse/config.h
@@ -24,7 +24,7 @@
#define VENDOR_ID 0x5043
#define PRODUCT_ID 0x4D6F
#define DEVICE_VER 0x0001
-#define MANUFACTURER Ploopyco
+#define MANUFACTURER PloopyCo
#define PRODUCT Mouse
/* key matrix size */
@@ -57,6 +57,7 @@
/* Much more so than a keyboard, speed matters for a mouse. So we'll go for as high
a polling rate as possible. */
#define USB_POLLING_INTERVAL_MS 1
+#define USB_MAX_POWER_CONSUMPTION 100
/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
@@ -71,3 +72,12 @@
/* Bootmagic Lite key configuration */
#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 3
+
+#define RGB_DI_PIN B5
+#define RGBLED_NUM 4
+#define RGBLIGHT_LIMIT_VAL 40
+#define RGBLIGHT_EFFECT_BREATHING
+#define RGBLIGHT_EFFECT_RAINBOW_MOOD
+#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
+
+// #define DEBUG_LED_PIN F7
diff --git a/keyboards/ploopyco/mouse/info.json b/keyboards/ploopyco/mouse/info.json
index 6763838dcf..142bf2bef4 100644
--- a/keyboards/ploopyco/mouse/info.json
+++ b/keyboards/ploopyco/mouse/info.json
@@ -1,7 +1,8 @@
{
"keyboard_name": "PloopyCo Mouse",
- "url": "",
+ "url": "www.ploopy.co",
"maintainer": "drashna",
+ "manufacturer": "Ploopy Corporation",
"width": 8,
"height": 3,
"layouts": {
diff --git a/keyboards/ploopyco/mouse/keymaps/default/keymap.c b/keyboards/ploopyco/mouse/keymaps/default/keymap.c
index c02d23d2ab..8145ffb1c3 100644
--- a/keyboards/ploopyco/mouse/keymaps/default/keymap.c
+++ b/keyboards/ploopyco/mouse/keymaps/default/keymap.c
@@ -17,7 +17,9 @@
*/
#include QMK_KEYBOARD_H
+// safe range starts at `PLOOPY_SAFE_RANGE` instead.
+
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(/* Base */
- C(KC_C), KC_BTN1, KC_BTN3, KC_BTN2, C(KC_C), KC_BTN4, KC_BTN5, C(KC_Z)),
+ C(KC_C), KC_BTN1, KC_BTN3, KC_BTN2, C(KC_V), KC_BTN4, KC_BTN5, DPI_CONFIG)
};
diff --git a/keyboards/ploopyco/mouse/keymaps/default/readme.md b/keyboards/ploopyco/mouse/keymaps/default/readme.md
index f965ef3c32..4618c83c05 100644
--- a/keyboards/ploopyco/mouse/keymaps/default/readme.md
+++ b/keyboards/ploopyco/mouse/keymaps/default/readme.md
@@ -1 +1 @@
-# The default keymap for Ploopyco Trackball
+# The default keymap for PloopyCo Mouse
diff --git a/keyboards/ploopyco/mouse/keymaps/drag_scroll/keymap.c b/keyboards/ploopyco/mouse/keymaps/drag_scroll/keymap.c
new file mode 100644
index 0000000000..438e2406fa
--- /dev/null
+++ b/keyboards/ploopyco/mouse/keymaps/drag_scroll/keymap.c
@@ -0,0 +1,62 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ * Copyright 2019 Sunjun Kim
+ * Copyright 2020 Ploopy Corporation
+ *
+ * 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
+
+// used for tracking the state
+bool is_drag_scroll = false;
+
+enum custom_keycodes {
+ DRAG_SCROLL = PLOOPY_SAFE_RANGE,
+};
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT(/* Base */
+ C(KC_C), KC_BTN1, KC_BTN3, KC_BTN2, C(KC_V), KC_BTN4, KC_BTN5, DPI_CONFIG)
+};
+
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case DRAG_SCROLL:
+ if (record->event.pressed) {
+ // this toggles the state each time you tap it
+ is_drag_scroll ^= 1;
+ }
+ break;
+ }
+ return true;
+}
+
+// The real magic is here.
+// This function is called to translate the processed sensor movement
+// from the mouse sensor and translates it into x and y movement for
+// the mouse report. Normally. So if "drag scroll" is toggled on,
+// moving the ball scrolls instead. You could remove the x or y here
+// to only scroll in one direction, if you wanted, as well. In fact,
+// there is no reason that you need to send this to the mouse report.
+// You could have it register a key, instead.
+void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
+ if (is_drag_scroll) {
+ mouse_report->h = x;
+ mouse_report->v = y;
+ } else {
+ mouse_report->x = x;
+ mouse_report->y = y;
+ }
+}
diff --git a/keyboards/ploopyco/mouse/keymaps/drag_scroll/readme.md b/keyboards/ploopyco/mouse/keymaps/drag_scroll/readme.md
new file mode 100644
index 0000000000..ddf5eb7084
--- /dev/null
+++ b/keyboards/ploopyco/mouse/keymaps/drag_scroll/readme.md
@@ -0,0 +1,3 @@
+# The Drag Scroll keymap for PloopyCo Mouse
+
+This is a sample keymap showing off what you can do with the custom callback drivers.
diff --git a/keyboards/ploopyco/mouse/keymaps/via/config.h b/keyboards/ploopyco/mouse/keymaps/via/config.h
new file mode 100644
index 0000000000..0ba4c7e0c8
--- /dev/null
+++ b/keyboards/ploopyco/mouse/keymaps/via/config.h
@@ -0,0 +1,21 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ * Copyright 2019 Sunjun Kim
+ * Copyright 2020 Ploopy Corporation
+ *
+ * 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
diff --git a/keyboards/ploopyco/mouse/keymaps/via/keymap.c b/keyboards/ploopyco/mouse/keymaps/via/keymap.c
index 27a0384381..cd8b7f6c6f 100644
--- a/keyboards/ploopyco/mouse/keymaps/via/keymap.c
+++ b/keyboards/ploopyco/mouse/keymaps/via/keymap.c
@@ -18,9 +18,12 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [0] = LAYOUT(/* Base */
- C(KC_C), KC_BTN1, KC_BTN3, KC_BTN2, C(KC_C), KC_BTN4, KC_BTN5, C(KC_Z)),
+ [0] = LAYOUT(C(KC_C), KC_BTN1, KC_BTN3, KC_BTN2, C(KC_V), KC_BTN4, KC_BTN5, C(KC_Z)),
[1] = LAYOUT(_______, _______, _______, _______, _______, _______, _______, _______),
[2] = LAYOUT(_______, _______, _______, _______, _______, _______, _______, _______),
[3] = LAYOUT(_______, _______, _______, _______, _______, _______, _______, _______),
+ [4] = LAYOUT(_______, _______, _______, _______, _______, _______, _______, _______),
+ [5] = LAYOUT(_______, _______, _______, _______, _______, _______, _______, _______),
+ [6] = LAYOUT(_______, _______, _______, _______, _______, _______, _______, _______),
+ [7] = LAYOUT(_______, _______, _______, _______, _______, _______, _______, _______)
};
diff --git a/keyboards/ploopyco/mouse/mouse.c b/keyboards/ploopyco/mouse/mouse.c
index 6a9bffbffe..fad4807c78 100644
--- a/keyboards/ploopyco/mouse/mouse.c
+++ b/keyboards/ploopyco/mouse/mouse.c
@@ -30,6 +30,19 @@
#ifndef OPT_SCALE
# define OPT_SCALE 1 // Multiplier for wheel
#endif
+#ifndef PLOOPY_DPI_OPTIONS
+# define PLOOPY_DPI_OPTIONS { 1200, 1600, 2400 }
+# ifndef PLOOPY_DPI_DEFAULT
+# define PLOOPY_DPI_DEFAULT 1
+# endif
+#endif
+#ifndef PLOOPY_DPI_DEFAULT
+# define PLOOPY_DPI_DEFAULT 0
+#endif
+
+keyboard_config_t keyboard_config;
+uint16_t dpi_array[] = PLOOPY_DPI_OPTIONS;
+#define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t))
// TODO: Implement libinput profiles
// https://wayland.freedesktop.org/libinput/doc/latest/pointer-acceleration.html
@@ -137,11 +150,18 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
}
// Update Timer to prevent accidental scrolls
- if ((record->event.key.col == 2) && (record->event.key.row == 0)) {
+ if ((record->event.key.col == 1) && (record->event.key.row == 0)) {
lastMidClick = timer_read();
is_scroll_clicked = record->event.pressed;
}
+ if (!process_record_user(keycode, record)) { return false; }
+
+ if (keycode == DPI_CONFIG && record->event.pressed) {
+ keyboard_config.dpi_config = (keyboard_config.dpi_config + 1) % DPI_OPTION_SIZE;
+ eeconfig_update_kb(keyboard_config.raw);
+ pmw_set_cpi(dpi_array[keyboard_config.dpi_config]);
+ }
/* If Mousekeys is disabled, then use handle the mouse button
* keycodes. This makes things simpler, and allows usage of
* the keycodes in a consistent manner. But only do this if
@@ -174,10 +194,11 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
currentReport.buttons &= ~MOUSE_BTN5;
}
pointing_device_set_report(currentReport);
+ pointing_device_send();
}
#endif
- return process_record_user(keycode, record);
+ return true;
}
// Hardware Setup
@@ -190,10 +211,6 @@ void keyboard_pre_init_kb(void) {
setPinInput(OPT_ENC1);
setPinInput(OPT_ENC2);
- // This is the debug LED.
- setPinOutput(F7);
- writePin(F7, debug_enable);
-
/* Ground all output pins connected to ground. This provides additional
* pathways to ground. If you're messing with this, know this: driving ANY
* of these pins high will cause a short. On the MCU. Ka-blooey.
@@ -206,6 +223,13 @@ void keyboard_pre_init_kb(void) {
writePinLow(unused_pins[i]);
}
#endif
+
+ // This is the debug LED.
+#if defined(DEBUG_LED_PIN)
+ setPinOutput(DEBUG_LED_PIN);
+ writePin(DEBUG_LED_PIN, debug_enable);
+#endif
+
keyboard_pre_init_user();
}
@@ -235,3 +259,24 @@ void pointing_device_task(void) {
pointing_device_send();
}
}
+
+void eeconfig_init_kb(void) {
+ keyboard_config.dpi_config = PLOOPY_DPI_DEFAULT;
+ eeconfig_update_kb(keyboard_config.raw);
+}
+
+void matrix_init_kb(void) {
+ // is safe to just read DPI setting since matrix init
+ // comes before pointing device init.
+ keyboard_config.raw = eeconfig_read_kb();
+ if (keyboard_config.dpi_config > DPI_OPTION_SIZE) {
+ eeconfig_init_kb();
+ }
+ matrix_init_user();
+}
+
+void keyboard_post_init_kb(void) {
+ pmw_set_cpi(dpi_array[keyboard_config.dpi_config]);
+
+ keyboard_post_init_user();
+}
diff --git a/keyboards/ploopyco/mouse/mouse.h b/keyboards/ploopyco/mouse/mouse.h
index 3c89d64d8c..f80449c187 100644
--- a/keyboards/ploopyco/mouse/mouse.h
+++ b/keyboards/ploopyco/mouse/mouse.h
@@ -20,7 +20,7 @@
#include "quantum.h"
#include "spi_master.h"
-#include "pmw3600.h"
+#include "pmw3360.h"
#include "analog.h"
#include "opt_encoder.h"
#include "pointing_device.h"
@@ -38,3 +38,17 @@ void process_wheel_user(report_mouse_t* mouse_report, int16_t h, int16_t v);
#define LAYOUT(BLL, BL, BM, BR, BRR, BF, BB, BDPI) \
{ {BL, BM, BR, BF, BB, BRR, BLL, BDPI}, }
+
+typedef union {
+ uint32_t raw;
+ struct {
+ uint8_t dpi_config;
+ };
+} keyboard_config_t;
+
+extern keyboard_config_t keyboard_config;
+
+enum ploopy_keycodes {
+ DPI_CONFIG = SAFE_RANGE,
+ PLOOPY_SAFE_RANGE,
+};
diff --git a/keyboards/ploopyco/mouse/readme.md b/keyboards/ploopyco/mouse/readme.md
index abfa643a44..a9b4b581a3 100644
--- a/keyboards/ploopyco/mouse/readme.md
+++ b/keyboards/ploopyco/mouse/readme.md
@@ -1,6 +1,6 @@
# Ploopyco Mouse
-![Ploopyco Mouse](https://i.redd.it/bf7bkzqzeti51.jpg)
+![Ploopyco Mouse](https://www.ploopy.co/uploads/1/2/7/6/127652558/s905404500980887952_p10_i19_w1414.jpeg)
It's a DIY, QMK Powered Trackball!!!!
@@ -14,7 +14,7 @@ Make example for this keyboard (after setting up your build environment):
make ploopyco/mouse:default:flash
-To jump to the bootloader, hold down "Button 4" (immediate right of the Mouse)
+To jump to the bootloader, hold down "Button 4" (the "forward" button on the left side)
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
@@ -40,9 +40,18 @@ This should allow you to more heavily customize the behavior.
Alternatively, the `process_wheel` and `process_mouse` functions can both be replaced too, to allow for even more functionality.
-Additionally, you can change the DPI/CPI or speed of the Mouse by calling `pmw_set_cpi` at any time. And tThe default can be changed by adding a define to the keymap's `config.h` file:
+Additionally, you can change the DPI/CPI or speed of the krackball by calling `pmw_set_cpi` at any time. Additionally, there is a `DPI_CONFIG` macro that will cycle through an array of options for the DPI. This is set to 1200, 1600, and 2400, but can be changed. 1600 is also set to the default.
+
+To configure/set your own array, there are two defines to use, `PLOOPY_DPI_OPTIONS` to set the array, and `PLOOPY_DPI_DEFAULT`.
+
+```c
+#define PLOOPY_DPI_OPTIONS { 1200, 1600, 2400 }
+#define PLOOPY_DPI_DEFAULT 1
+```
+The `PLOOPY_DPI_OPTIONS` array sets the values that you want to be able to cycle through, and the order they are in. The "default" define lets the firmware know which of these options is the default and should be loaded by default.
+
+The `DPI_CONFIG` macro will cycle through the values in the array, each time you hit it. And it stores this value in persistent memory, so it will load it the next time the device powers up.
- #define PMW_CPI 1600
# Programming QMK-DFU onto the PloopyCo Mouse
diff --git a/keyboards/ploopyco/mouse/rules.mk b/keyboards/ploopyco/mouse/rules.mk
index d77431b676..db72641d0c 100644
--- a/keyboards/ploopyco/mouse/rules.mk
+++ b/keyboards/ploopyco/mouse/rules.mk
@@ -5,7 +5,7 @@ MCU = atmega32u4
F_CPU = 8000000
# Bootloader selection
-BOOTLOADER = caterina
+BOOTLOADER = qmk-dfu
# Build Options
# change yes to no to disable
@@ -27,4 +27,4 @@ POINTING_DEVICE_ENABLE = yes
MOUSEKEY_ENABLE = no # Mouse keys
QUANTUM_LIB_SRC += analog.c spi_master.c
-SRC += pmw3600.c opt_encoder.c
+SRC += pmw3360.c opt_encoder.c
diff --git a/keyboards/ploopyco/pmw3600.c b/keyboards/ploopyco/pmw3360.c
index 93b47078ac..1bd03e8b92 100644
--- a/keyboards/ploopyco/pmw3600.c
+++ b/keyboards/ploopyco/pmw3360.c
@@ -17,8 +17,9 @@
*/
-#include "pmw3600.h"
-#include "pmw3600_firmware.h"
+#include "pmw3360.h"
+#include "pmw3360_firmware.h"
+
#ifdef CONSOLE_ENABLE
# include "print.h"
#endif
@@ -30,8 +31,9 @@ bool _inBurst = false;
#ifndef SPI_DIVISOR
# define SPI_DIVISOR 2
#endif
-
-static const int8_t ROTATIONAL_TRANSFORM_ANGLE = 20;
+#ifndef ROTATIONAL_TRANSFORM_ANGLE
+# define ROTATIONAL_TRANSFORM_ANGLE 0x00
+#endif
#ifdef CONSOLE_ENABLE
void print_byte(uint8_t byte) { dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); }
@@ -120,7 +122,6 @@ bool pmw_spi_init(void) {
pmw_upload_firmware();
- spi_write_adv(REG_Angle_Tune, constrain(ROTATIONAL_TRANSFORM_ANGLE, -30, 30));
spi_stop_adv();
wait_ms(10);
@@ -134,6 +135,8 @@ bool pmw_spi_init(void) {
void pmw_upload_firmware(void) {
spi_write_adv(REG_Config2, 0x00);
+ spi_write_adv(REG_Angle_Tune, constrain(ROTATIONAL_TRANSFORM_ANGLE, -30, 30));
+
spi_write_adv(REG_SROM_Enable, 0x1d);
wait_ms(10);
diff --git a/keyboards/ploopyco/pmw3600.h b/keyboards/ploopyco/pmw3360.h
index c1d5e3badb..c1d5e3badb 100644
--- a/keyboards/ploopyco/pmw3600.h
+++ b/keyboards/ploopyco/pmw3360.h
diff --git a/keyboards/ploopyco/pmw3600_firmware.h b/keyboards/ploopyco/pmw3360_firmware.h
index cca5a6a4d8..cca5a6a4d8 100644
--- a/keyboards/ploopyco/pmw3600_firmware.h
+++ b/keyboards/ploopyco/pmw3360_firmware.h
diff --git a/keyboards/ploopyco/trackball/config.h b/keyboards/ploopyco/trackball/config.h
index 57113d965b..66189c33ec 100644
--- a/keyboards/ploopyco/trackball/config.h
+++ b/keyboards/ploopyco/trackball/config.h
@@ -23,29 +23,14 @@
/* USB Device descriptor parameter */
#define VENDOR_ID 0x5043
#define PRODUCT_ID 0x5442
-#define DEVICE_VER 0x0001
-#define MANUFACTURER Ploopyco
-#define PRODUCT Trackball
+#define DEVICE_VER 0x0001
+#define MANUFACTURER PloopyCo
+#define PRODUCT Trackball
/* key matrix size */
#define MATRIX_ROWS 1
#define MATRIX_COLS 5
-/*
- * Keyboard Matrix Assignments
- *
- * Change this to how you wired your keyboard
- * COLS: AVR pins used for columns, left to right
- * ROWS: AVR pins used for rows, top to bottom
- * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
- * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
- *
- */
-#define DIRECT_PINS { { D4, D2, E6, B5, D7 } }
-
-// These pins are not broken out, and cannot be used normally.
-// They are set as output and pulled high, by default
-#define UNUSED_PINS { D1, D3, B4, B6, B7, D6, C7, F6, F5, F3 }
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
@@ -63,7 +48,13 @@
/* Much more so than a keyboard, speed matters for a mouse. So we'll go for as high
a polling rate as possible. */
#define USB_POLLING_INTERVAL_MS 1
+#define USB_MAX_POWER_CONSUMPTION 100
/* Bootmagic Lite key configuration */
#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 3
+
+#define ROTATIONAL_TRANSFORM_ANGLE 20
+
+// If board has a debug LED, you can enable it by defining this
+// #define DEBUG_LED_PIN F7
diff --git a/keyboards/ploopyco/trackball/info.json b/keyboards/ploopyco/trackball/info.json
index 84d512d8dd..c5e4527d8d 100644
--- a/keyboards/ploopyco/trackball/info.json
+++ b/keyboards/ploopyco/trackball/info.json
@@ -1,7 +1,8 @@
{
"keyboard_name": "PloopyCo Trackball",
- "url": "",
+ "url": "www.ploopy.co",
"maintainer": "drashna",
+ "manufacturer": "Ploopy Corporation",
"width": 8,
"height": 3,
"layouts": {
diff --git a/keyboards/ploopyco/trackball/keymaps/default/keymap.c b/keyboards/ploopyco/trackball/keymaps/default/keymap.c
index dc1ad1439f..40f70ab99b 100644
--- a/keyboards/ploopyco/trackball/keymaps/default/keymap.c
+++ b/keyboards/ploopyco/trackball/keymaps/default/keymap.c
@@ -17,6 +17,7 @@
*/
#include QMK_KEYBOARD_H
+// safe range starts at `PLOOPY_SAFE_RANGE` instead.
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT( /* Base */
diff --git a/keyboards/ploopyco/trackball/keymaps/drag_scroll/keymap.c b/keyboards/ploopyco/trackball/keymaps/drag_scroll/keymap.c
new file mode 100644
index 0000000000..7784bc8553
--- /dev/null
+++ b/keyboards/ploopyco/trackball/keymaps/drag_scroll/keymap.c
@@ -0,0 +1,66 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ * Copyright 2019 Sunjun Kim
+ * Copyright 2020 Ploopy Corporation
+ *
+ * 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
+
+// used for tracking the state
+bool is_drag_scroll = false;
+
+enum custom_keycodes {
+ DRAG_SCROLL = PLOOPY_SAFE_RANGE,
+};
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case DRAG_SCROLL:
+ if (record->event.pressed) {
+ // this toggles the state each time you tap it
+ is_drag_scroll ^= 1;
+ }
+ break;
+ }
+ return true;
+}
+
+// The real magic is here.
+// This function is called to translate the processed sensor movement
+// from the mouse sensor and translates it into x and y movement for
+// the mouse report. Normally. So if "drag scroll" is toggled on,
+// moving the ball scrolls instead. You could remove the x or y here
+// to only scroll in one direction, if you wanted, as well. In fact,
+// there is no reason that you need to send this to the mouse report.
+// You could have it register a key, instead.
+void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
+ if (is_drag_scroll) {
+ mouse_report->h = x;
+ mouse_report->v = y;
+ } else {
+ mouse_report->x = x;
+ mouse_report->y = y;
+ }
+}
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT( /* Base */
+ KC_BTN1, KC_BTN3, KC_BTN2,
+ KC_BTN4, LT(1, KC_BTN5)
+ ),
+ [1] = LAYOUT(
+ DRAG_SCROLL, _______, _______,
+ _______, _______
+ )
+};
diff --git a/keyboards/ploopyco/trackball/keymaps/drag_scroll/readme.md b/keyboards/ploopyco/trackball/keymaps/drag_scroll/readme.md
new file mode 100644
index 0000000000..cafa11bfc1
--- /dev/null
+++ b/keyboards/ploopyco/trackball/keymaps/drag_scroll/readme.md
@@ -0,0 +1,3 @@
+# The Drag Scroll keymap for Ploopyco Trackball
+
+This is a sample keymap showing off what you can do with the custom callback drivers.
diff --git a/keyboards/ploopyco/trackball/keymaps/via/config.h b/keyboards/ploopyco/trackball/keymaps/via/config.h
new file mode 100644
index 0000000000..0ba4c7e0c8
--- /dev/null
+++ b/keyboards/ploopyco/trackball/keymaps/via/config.h
@@ -0,0 +1,21 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ * Copyright 2019 Sunjun Kim
+ * Copyright 2020 Ploopy Corporation
+ *
+ * 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
diff --git a/keyboards/ploopyco/trackball/keymaps/via/keymap.c b/keyboards/ploopyco/trackball/keymaps/via/keymap.c
index dc1ad1439f..31539be2ec 100644
--- a/keyboards/ploopyco/trackball/keymaps/via/keymap.c
+++ b/keyboards/ploopyco/trackball/keymaps/via/keymap.c
@@ -19,8 +19,12 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [0] = LAYOUT( /* Base */
- KC_BTN1, KC_BTN3, KC_BTN2,
- KC_BTN4, KC_BTN5
- ),
+ [0] = LAYOUT( KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN4, KC_BTN5 ),
+ [1] = LAYOUT( _______, _______, _______, _______, _______ ),
+ [2] = LAYOUT( _______, _______, _______, _______, _______ ),
+ [3] = LAYOUT( _______, _______, _______, _______, _______ ),
+ [4] = LAYOUT( _______, _______, _______, _______, _______ ),
+ [5] = LAYOUT( _______, _______, _______, _______, _______ ),
+ [6] = LAYOUT( _______, _______, _______, _______, _______ ),
+ [7] = LAYOUT( _______, _______, _______, _______, _______ )
};
diff --git a/keyboards/ploopyco/trackball/readme.md b/keyboards/ploopyco/trackball/readme.md
index 76b9d6a762..a38fec21aa 100644
--- a/keyboards/ploopyco/trackball/readme.md
+++ b/keyboards/ploopyco/trackball/readme.md
@@ -12,12 +12,21 @@ Everything works. However the scroll wheel has some issues and acts very odd.
Make example for this keyboard (after setting up your build environment):
- make ploopyco/trackball:default:flash
+ make ploopyco/trackball/rev1:default:flash
+ make ploopyco/trackball/rev1_005:default:flash
To jump to the bootloader, hold down "Button 4" (immediate right of the trackball)
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
+## Revisions
+
+There are two main revisions for the PloopyCo Tracball, everything up to 1.004, and 1.005.
+
+In the 1.005 revision, button for was changed from pin B5 to B6, and the debug LED pin was changed from F7 to B5.
+
+The PCB should indicate which revision this is.
+
# Customzing your PloopyCo Trackball
While the defaults are designed so that it can be plugged in and used right away, there are a number of things that you may want to change. Such as adding DPI control, or to use the ball to scroll while holding a button. To allow for this sort of control, there is a callback for both the scroll wheel and the mouse censor.
@@ -40,9 +49,17 @@ This should allow you to more heavily customize the behavior.
Alternatively, the `process_wheel` and `process_mouse` functions can both be replaced too, to allow for even more functionality.
-Additionally, you can change the DPI/CPI or speed of the trackball by calling `pmw_set_cpi` at any time. And tThe default can be changed by adding a define to the keymap's `config.h` file:
+Additionally, you can change the DPI/CPI or speed of the trackball by calling `pmw_set_cpi` at any time. Additionally, there is a `DPI_CONFIG` macro that will cycle through an array of options for the DPI. This is set to 1200, 1600, and 2400, but can be changed. 1600 is also set to the default.
+
+To configure/set your own array, there are two defines to use, `PLOOPY_DPI_OPTIONS` to set the array, and `PLOOPY_DPI_DEFAULT`.
+
+```c
+#define PLOOPY_DPI_OPTIONS { 1200, 1600, 2400 }
+#define PLOOPY_DPI_DEFAULT 1
+```
+The `PLOOPY_DPI_OPTIONS` array sets the values that you want to be able to cycle through, and the order they are in. The "default" define lets the firmware know which of these options is the default and should be loaded by default.
- #define PMW_CPI 1600
+The `DPI_CONFIG` macro will cycle through the values in the array, each time you hit it. And it stores this value in persistent memory, so it will load it the next time the device powers up.
# Programming QMK-DFU onto the PloopyCo Trackball
diff --git a/keyboards/ploopyco/trackball/rev1/config.h b/keyboards/ploopyco/trackball/rev1/config.h
new file mode 100644
index 0000000000..2908f09602
--- /dev/null
+++ b/keyboards/ploopyco/trackball/rev1/config.h
@@ -0,0 +1,42 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ * Copyright 2019 Sunjun Kim
+ * Copyright 2020 Ploopy Corporation
+ *
+ * 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
+
+/*
+ * Keyboard Matrix Assignments
+ *
+ * Change this to how you wired your keyboard
+ * COLS: AVR pins used for columns, left to right
+ * ROWS: AVR pins used for rows, top to bottom
+ * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
+ * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
+ *
+ */
+#define DIRECT_PINS \
+ { \
+ { D4, D2, E6, B5, D7 } \
+ }
+
+// These pins are not broken out, and cannot be used normally.
+// They are set as output and pulled high, by default
+#define UNUSED_PINS \
+ { D1, D3, B4, B6, B7, D6, C7, F6, F5, F3, F7 }
+
+// If board has a debug LED, you can enable it by defining this
+#define DEBUG_LED_PIN F7
diff --git a/keyboards/ploopyco/trackball/rev1/rev1.h b/keyboards/ploopyco/trackball/rev1/rev1.h
new file mode 100644
index 0000000000..a82c20a116
--- /dev/null
+++ b/keyboards/ploopyco/trackball/rev1/rev1.h
@@ -0,0 +1,21 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ * Copyright 2019 Sunjun Kim
+ * Copyright 2020 Ploopy Corporation
+ *
+ * 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 "trackball.h"
diff --git a/keyboards/ploopyco/trackball/rev1/rules.mk b/keyboards/ploopyco/trackball/rev1/rules.mk
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/keyboards/ploopyco/trackball/rev1/rules.mk
diff --git a/keyboards/ploopyco/trackball/rev1_005/config.h b/keyboards/ploopyco/trackball/rev1_005/config.h
new file mode 100644
index 0000000000..83e70181de
--- /dev/null
+++ b/keyboards/ploopyco/trackball/rev1_005/config.h
@@ -0,0 +1,47 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ * Copyright 2019 Sunjun Kim
+ * Copyright 2020 Ploopy Corporation
+ *
+ * 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
+
+/*
+ * Keyboard Matrix Assignments
+ *
+ * Change this to how you wired your keyboard
+ * COLS: AVR pins used for columns, left to right
+ * ROWS: AVR pins used for rows, top to bottom
+ * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
+ * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
+ *
+ */
+#define DIRECT_PINS \
+ { \
+ { D4, D2, E6, B6, D7 } \
+ }
+
+// These pins are not broken out, and cannot be used normally.
+// They are set as output and pulled high, by default
+#define UNUSED_PINS \
+ { D1, D3, B4, B7, D6, C7, F6, F5, F3, F7 }
+
+// If board has a debug LED, you can enable it by defining this
+#define RGB_DI_PIN B5
+#define RGBLED_NUM 3
+#define RGBLIGHT_LIMIT_VAL 40
+#define RGBLIGHT_EFFECT_BREATHING
+#define RGBLIGHT_EFFECT_RAINBOW_MOOD
+#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
diff --git a/keyboards/ploopyco/trackball/rev1_005/rev1_005.h b/keyboards/ploopyco/trackball/rev1_005/rev1_005.h
new file mode 100644
index 0000000000..a82c20a116
--- /dev/null
+++ b/keyboards/ploopyco/trackball/rev1_005/rev1_005.h
@@ -0,0 +1,21 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ * Copyright 2019 Sunjun Kim
+ * Copyright 2020 Ploopy Corporation
+ *
+ * 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 "trackball.h"
diff --git a/keyboards/ploopyco/trackball/rev1_005/rules.mk b/keyboards/ploopyco/trackball/rev1_005/rules.mk
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/keyboards/ploopyco/trackball/rev1_005/rules.mk
diff --git a/keyboards/ploopyco/trackball/rules.mk b/keyboards/ploopyco/trackball/rules.mk
index d77431b676..9e252fbddb 100644
--- a/keyboards/ploopyco/trackball/rules.mk
+++ b/keyboards/ploopyco/trackball/rules.mk
@@ -27,4 +27,6 @@ POINTING_DEVICE_ENABLE = yes
MOUSEKEY_ENABLE = no # Mouse keys
QUANTUM_LIB_SRC += analog.c spi_master.c
-SRC += pmw3600.c opt_encoder.c
+SRC += pmw3360.c opt_encoder.c
+
+DEFAULT_FOLDER = ploopyco/trackball/rev1_005
diff --git a/keyboards/ploopyco/trackball/trackball.c b/keyboards/ploopyco/trackball/trackball.c
index 6a9bffbffe..7b7b680271 100644
--- a/keyboards/ploopyco/trackball/trackball.c
+++ b/keyboards/ploopyco/trackball/trackball.c
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include QMK_KEYBOARD_H
+#include "trackball.h"
#ifndef OPT_DEBOUNCE
# define OPT_DEBOUNCE 5 // (ms) Time between scroll events
@@ -30,6 +30,19 @@
#ifndef OPT_SCALE
# define OPT_SCALE 1 // Multiplier for wheel
#endif
+#ifndef PLOOPY_DPI_OPTIONS
+# define PLOOPY_DPI_OPTIONS { 1200, 1600, 2400 }
+# ifndef PLOOPY_DPI_DEFAULT
+# define PLOOPY_DPI_DEFAULT 1
+# endif
+#endif
+#ifndef PLOOPY_DPI_DEFAULT
+# define PLOOPY_DPI_DEFAULT 0
+#endif
+
+keyboard_config_t keyboard_config;
+uint16_t dpi_array[] = PLOOPY_DPI_OPTIONS;
+#define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t))
// TODO: Implement libinput profiles
// https://wayland.freedesktop.org/libinput/doc/latest/pointer-acceleration.html
@@ -132,16 +145,24 @@ __attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) {
}
bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
- if (debug_mouse) {
- dprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
+ if (true) {
+ xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
}
// Update Timer to prevent accidental scrolls
- if ((record->event.key.col == 2) && (record->event.key.row == 0)) {
+ if ((record->event.key.col == 1) && (record->event.key.row == 0)) {
lastMidClick = timer_read();
is_scroll_clicked = record->event.pressed;
}
+ if (!process_record_user(keycode, record)) { return false; }
+
+ if (keycode == DPI_CONFIG && record->event.pressed) {
+ keyboard_config.dpi_config = (keyboard_config.dpi_config + 1) % DPI_OPTION_SIZE;
+ eeconfig_update_kb(keyboard_config.raw);
+ pmw_set_cpi(dpi_array[keyboard_config.dpi_config]);
+ }
+
/* If Mousekeys is disabled, then use handle the mouse button
* keycodes. This makes things simpler, and allows usage of
* the keycodes in a consistent manner. But only do this if
@@ -174,10 +195,11 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
currentReport.buttons &= ~MOUSE_BTN5;
}
pointing_device_set_report(currentReport);
+ pointing_device_send();
}
#endif
- return process_record_user(keycode, record);
+ return true;
}
// Hardware Setup
@@ -190,10 +212,6 @@ void keyboard_pre_init_kb(void) {
setPinInput(OPT_ENC1);
setPinInput(OPT_ENC2);
- // This is the debug LED.
- setPinOutput(F7);
- writePin(F7, debug_enable);
-
/* Ground all output pins connected to ground. This provides additional
* pathways to ground. If you're messing with this, know this: driving ANY
* of these pins high will cause a short. On the MCU. Ka-blooey.
@@ -206,6 +224,13 @@ void keyboard_pre_init_kb(void) {
writePinLow(unused_pins[i]);
}
#endif
+
+ // This is the debug LED.
+#if defined(DEBUG_LED_PIN)
+ setPinOutput(DEBUG_LED_PIN);
+ writePin(DEBUG_LED_PIN, debug_enable);
+#endif
+
keyboard_pre_init_user();
}
@@ -235,3 +260,24 @@ void pointing_device_task(void) {
pointing_device_send();
}
}
+
+void eeconfig_init_kb(void) {
+ keyboard_config.dpi_config = PLOOPY_DPI_DEFAULT;
+ eeconfig_update_kb(keyboard_config.raw);
+}
+
+void matrix_init_kb(void) {
+ // is safe to just read DPI setting since matrix init
+ // comes before pointing device init.
+ keyboard_config.raw = eeconfig_read_kb();
+ if (keyboard_config.dpi_config > DPI_OPTION_SIZE) {
+ eeconfig_init_kb();
+ }
+ matrix_init_user();
+}
+
+void keyboard_post_init_kb(void) {
+ pmw_set_cpi(dpi_array[keyboard_config.dpi_config]);
+
+ keyboard_post_init_user();
+}
diff --git a/keyboards/ploopyco/trackball/trackball.h b/keyboards/ploopyco/trackball/trackball.h
index 959305a07e..c58be6c84a 100644
--- a/keyboards/ploopyco/trackball/trackball.h
+++ b/keyboards/ploopyco/trackball/trackball.h
@@ -20,10 +20,15 @@
#include "quantum.h"
#include "spi_master.h"
-#include "pmw3600.h"
+#include "pmw3360.h"
#include "analog.h"
#include "opt_encoder.h"
#include "pointing_device.h"
+#if defined(KEYBOARD_ploopyco_trackball_rev1)
+# include "rev1.h"
+#elif defined(KEYBOARD_ploopyco_trackball_rev1_005)
+# include "rev1_005.h"
+#endif
// Sensor defs
#define OPT_ENC1 F0
@@ -38,3 +43,17 @@ void process_wheel_user(report_mouse_t* mouse_report, int16_t h, int16_t v);
#define LAYOUT(BL, BM, BR, BF, BB) \
{ {BL, BM, BR, BF, BB}, }
+
+typedef union {
+ uint32_t raw;
+ struct {
+ uint8_t dpi_config;
+ };
+} keyboard_config_t;
+
+extern keyboard_config_t keyboard_config;
+
+enum ploopy_keycodes {
+ DPI_CONFIG = SAFE_RANGE,
+ PLOOPY_SAFE_RANGE,
+};