From c98f57fa7d4bd37d6e721e56a2f79046de6d46ed Mon Sep 17 00:00:00 2001 From: ploopyco Date: Tue, 20 May 2025 12:15:52 -0400 Subject: [PATCH 1/7] working implementation --- keyboards/ploopyco/common/as5600.c | 69 +++++++++++++++++++ keyboards/ploopyco/common/as5600.h | 43 ++++++++++++ keyboards/ploopyco/dial/config.h | 29 ++++++++ keyboards/ploopyco/dial/info.json | 27 ++++++++ .../ploopyco/dial/keymaps/default/keymap.c | 32 +++++++++ keyboards/ploopyco/dial/post_rules.mk | 4 ++ keyboards/ploopyco/dial/readme.md | 33 +++++++++ .../ploopyco/dial/rev1_001/keyboard.json | 10 +++ keyboards/ploopyco/dial/rev1_001/readme.md | 3 + keyboards/ploopyco/ploopyco.c | 56 ++++++++++++++- 10 files changed, 305 insertions(+), 1 deletion(-) create mode 100644 keyboards/ploopyco/common/as5600.c create mode 100644 keyboards/ploopyco/common/as5600.h create mode 100644 keyboards/ploopyco/dial/config.h create mode 100644 keyboards/ploopyco/dial/info.json create mode 100644 keyboards/ploopyco/dial/keymaps/default/keymap.c create mode 100644 keyboards/ploopyco/dial/post_rules.mk create mode 100644 keyboards/ploopyco/dial/readme.md create mode 100644 keyboards/ploopyco/dial/rev1_001/keyboard.json create mode 100644 keyboards/ploopyco/dial/rev1_001/readme.md diff --git a/keyboards/ploopyco/common/as5600.c b/keyboards/ploopyco/common/as5600.c new file mode 100644 index 00000000000..4ded20c7f3d --- /dev/null +++ b/keyboards/ploopyco/common/as5600.c @@ -0,0 +1,69 @@ +/* Copyright 2025 Colin Lam, Ploopy Corporation (contact@ploopy.co) + * + * 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 . + */ + +#include "as5600.h" +#include "print.h" + +void as5600_init(void) { + i2c_init(); +} + +uint16_t get_rawangle(void) { + uint8_t data[] = {0, 0}; + i2c_status_t s = i2c_read_register(AS5600_I2C_ADDRESS, REG_RAWANGLE, data, 2, 100); + if (s == I2C_STATUS_TIMEOUT) { + printf("Timeout on get_rawangle()\n"); + } else if (s == I2C_STATUS_ERROR) { + printf("Error on get_rawangle()\n"); + } else { + ; + } + uint16_t rawangle = data[0] << 8 | data[1]; + return rawangle; +} + +bool is_magnet_too_high(void) { + uint8_t data[] = {0}; + i2c_read_register(AS5600_I2C_ADDRESS, REG_STATUS, data, 1, 100); + uint8_t v = (data[0] >> 3) & 0x1; + if (v == 1) { + return true; + } else { + return false; + } +} + +bool is_magnet_too_low(void) { + uint8_t data[] = {0}; + i2c_read_register(AS5600_I2C_ADDRESS, REG_STATUS, data, 1, 100); + uint8_t v = (data[0] >> 4) & 0x1; + if (v == 1) { + return true; + } else { + return false; + } +} + +bool is_magnet_present(void) { + uint8_t data[] = {0}; + i2c_read_register(AS5600_I2C_ADDRESS, REG_STATUS, data, 1, 100); + uint8_t v = (data[0] >> 5) & 0x1; + if (v == 1) { + return true; + } else { + return false; + } +} diff --git a/keyboards/ploopyco/common/as5600.h b/keyboards/ploopyco/common/as5600.h new file mode 100644 index 00000000000..06c2dcbbdaa --- /dev/null +++ b/keyboards/ploopyco/common/as5600.h @@ -0,0 +1,43 @@ +/* Copyright 2025 Colin Lam, Ploopy Corporation (contact@ploopy.co) + * + * 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 . + */ + +#pragma once + +#define POINTING_DEVICE_AS5600_ENABLE true + +#include +#include +#include "i2c_master.h" + +#define AS5600_I2C_ADDRESS (0x36 << 1) + +#define REG_ZMCO 0x00 +#define REG_ZPOS 0x01 +#define REG_MPOS 0x03 +#define REG_MANG 0x05 +#define REG_CONF 0x07 +#define REG_RAWANGLE 0x0c +#define REG_ANGLE 0x0e +#define REG_STATUS 0x0b +#define REG_AGC 0x1a +#define REG_MAGNITUDE 0x1b +#define REG_BURN 0xff + +void as5600_init(void); +uint16_t get_rawangle(void); +bool is_magnet_too_high(void); +bool is_magnet_too_low(void); +bool is_magnet_present(void); diff --git a/keyboards/ploopyco/dial/config.h b/keyboards/ploopyco/dial/config.h new file mode 100644 index 00000000000..83905682f8d --- /dev/null +++ b/keyboards/ploopyco/dial/config.h @@ -0,0 +1,29 @@ +/* Copyright 2023 Colin Lam (Ploopy Corporation) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * Copyright 2019 Sunjun Kim + * + * 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 . + */ + +#pragma once + +#define I2C_DRIVER I2CD1 +#define I2C1_SDA_PIN GP22 +#define I2C1_SCL_PIN GP23 + +#define UNUSABLE_PINS \ + { GP0, GP1, GP2, GP3, GP4, GP5, GP6, GP7, GP8, GP9, GP10, GP11, GP12, \ + GP13, GP14, GP15, GP16, GP17, GP18, GP19, GP20, GP21, GP24, GP25, \ + GP26, GP27, GP29 } + diff --git a/keyboards/ploopyco/dial/info.json b/keyboards/ploopyco/dial/info.json new file mode 100644 index 00000000000..4823554bf1f --- /dev/null +++ b/keyboards/ploopyco/dial/info.json @@ -0,0 +1,27 @@ +{ + "keyboard_name": "Ploopy Dial", + "url": "www.ploopy.co", + "maintainer": "ploopyco", + "manufacturer": "Ploopy Corporation", + "processor": "RP2040", + "bootloader": "rp2040", + "usb": { + "vid": "0x5043", + "pid": "0x63C3", + "max_power": 100 + }, + "features": { + "extrakey": true, + "mousekey": true, + "nkro": true, + "pointing_device": true, + "console": true + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"x": 0, "y": 0, "matrix": [0, 0]} + ] + } + } +} diff --git a/keyboards/ploopyco/dial/keymaps/default/keymap.c b/keyboards/ploopyco/dial/keymaps/default/keymap.c new file mode 100644 index 00000000000..1e790a6bfc2 --- /dev/null +++ b/keyboards/ploopyco/dial/keymaps/default/keymap.c @@ -0,0 +1,32 @@ +/* TODO CHANGE LATER */ + + +/* Copyright 2023 Colin Lam (Ploopy Corporation) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * Copyright 2019 Sunjun Kim + * + * 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 . + */ +#include QMK_KEYBOARD_H + +// Dummy +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {{{ KC_NO }}}; + +void keyboard_post_init_user(void) { + // Customise these values to desired behaviour + debug_enable=true; + debug_matrix=true; + debug_keyboard=true; + debug_mouse=true; +} diff --git a/keyboards/ploopyco/dial/post_rules.mk b/keyboards/ploopyco/dial/post_rules.mk new file mode 100644 index 00000000000..15a5cab6548 --- /dev/null +++ b/keyboards/ploopyco/dial/post_rules.mk @@ -0,0 +1,4 @@ +VPATH += keyboards/ploopyco/common +SRC += as5600.c +I2C_DRIVER_REQUIRED = yes +POINTING_DEVICE_DRIVER = custom diff --git a/keyboards/ploopyco/dial/readme.md b/keyboards/ploopyco/dial/readme.md new file mode 100644 index 00000000000..e8ccacb5f6b --- /dev/null +++ b/keyboards/ploopyco/dial/readme.md @@ -0,0 +1,33 @@ +/* TODO CHANGE LATER */ + +# Ploopyco Madromys Trackball + +It's a DIY, QMK-powered trackball! + +* Keyboard Maintainer: [PloopyCo](https://github.com/ploopyco) +* Hardware Supported: RP2040 +* Hardware Availability: [Store](https://ploopy.co), [GitHub](https://github.com/ploopyco) + +Make example for this keyboard (after setting up your build environment): + + qmk compile -kb ploopyco/madromys -km default + +# Building Firmware + +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). + +# Triggering the Bootloader + +[Do you see those two golden holes in the board](https://ploopy.co/wp-content/uploads/2023/11/boot.jpg)? Those are called **vias**. They act exactly like a switch does. Right now, that switch is OFF. However, if you take a paperclip or a pair of metal tweezers and touch those two vias, the two vias will form an electrical connection. Effectively, that switch turns ON. + +Go ahead and connect the two vias, and then (while the vias are connected) plug in the Madromys board into your computer. + +The computer should recognise that a mass storage device was just plugged in. Once this is done, you should be able to drag and drop files onto the Madromys board, as if the board was a USB drive. Feel free to remove the tweezers or paperclip at this point. + +If you want to upload a new firmware file (a ".uf2" file, like "madromys_awesome_version.uf2" or something), just drag it into the folder, and it'll automatically install on the Madromys board and restart itself, in normal operating mode. You're done! + +**TIP**: If your firmware is in some kind of strange state and uploading new firmware isn't fixing it, try uploading [a flash nuke](https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/circuitpython#flash-resetting-uf2-3083182) to the Madromys board before flashing the new firmware. It wipes the memory of the Madromys board completely clean, which can help clear a few types of errors. + +# Customizing your Ploopy Madromys + +You can find customziation options [here](../readme.md). diff --git a/keyboards/ploopyco/dial/rev1_001/keyboard.json b/keyboards/ploopyco/dial/rev1_001/keyboard.json new file mode 100644 index 00000000000..8c148ea974f --- /dev/null +++ b/keyboards/ploopyco/dial/rev1_001/keyboard.json @@ -0,0 +1,10 @@ +{ + "usb": { + "device_version": "1.0.0" + }, + "matrix_pins": { + "direct": [ + [null] + ] + } +} diff --git a/keyboards/ploopyco/dial/rev1_001/readme.md b/keyboards/ploopyco/dial/rev1_001/readme.md new file mode 100644 index 00000000000..95bec623e81 --- /dev/null +++ b/keyboards/ploopyco/dial/rev1_001/readme.md @@ -0,0 +1,3 @@ +This is the R1.001 version of Dial. Future versions may have other features. + +See the [main readme](../readme.md) for more details. diff --git a/keyboards/ploopyco/ploopyco.c b/keyboards/ploopyco/ploopyco.c index 57f2a26b8c3..2b6014ee2b9 100644 --- a/keyboards/ploopyco/ploopyco.c +++ b/keyboards/ploopyco/ploopyco.c @@ -19,6 +19,9 @@ #include "ploopyco.h" #include "analog.h" #include "opt_encoder.h" +#include "as5600.h" +#include "print.h" +#include "wait.h" // for legacy support #if defined(OPT_DEBOUNCE) && !defined(PLOOPY_SCROLL_DEBOUNCE) @@ -58,6 +61,13 @@ # define ENCODER_BUTTON_COL 0 #endif +#ifdef POINTING_DEVICE_AS5600_ENABLE +// Variables specific to the Dial +uint16_t current_position = 0; +// Dial will have 16 positions +const uint16_t SCROLL_DISTANCE = 64; +#endif + keyboard_config_t keyboard_config; uint16_t dpi_array[] = PLOOPY_DPI_OPTIONS; #define DPI_OPTION_SIZE ARRAY_SIZE(dpi_array) @@ -163,6 +173,27 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { mouse_report.y = 0; } +#ifdef POINTING_DEVICE_AS5600_ENABLE + // Get AS5600 rawangle + uint16_t ra = get_rawangle(); + int16_t delta = (int16_t)(ra - current_position); + + // Wrap into [-2048, 2047] to get shortest direction + if (delta > 2048) { + delta -= 4096; + } else if (delta < -2048) { + delta += 4096; + } + + if (delta >= SCROLL_DISTANCE) { + current_position = ra; + mouse_report.v = 1; + } else if (delta <= -SCROLL_DISTANCE) { + current_position = ra; + mouse_report.v = -1; + } +#endif + return pointing_device_task_user(mouse_report); } @@ -204,7 +235,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { void keyboard_pre_init_kb(void) { // debug_enable = true; // debug_matrix = true; - // debug_mouse = true; + //debug_mouse = true; // debug_encoder = true; /* Ground all output pins connected to ground. This provides additional @@ -237,6 +268,29 @@ void pointing_device_init_kb(void) { pointing_device_set_cpi(dpi_array[keyboard_config.dpi_config]); } +#ifdef POINTING_DEVICE_AS5600_ENABLE +void keyboard_post_init_kb(void) { + // Init the AS5600 controlling the Dial + as5600_init(); + + uint16_t ra = get_rawangle(); + + int closest = 0; + int min_dist = 4096; + + for (int i = 0; i < 4096; i += SCROLL_DISTANCE) { + int diff = abs((int) ra - i); + int dist = diff < (4096 - diff) ? diff : (4096 - diff); + if (dist < min_dist) { + min_dist = dist; + closest = i; + } + } + + current_position = closest; +} +#endif + void eeconfig_init_kb(void) { keyboard_config.dpi_config = PLOOPY_DPI_DEFAULT; eeconfig_update_kb(keyboard_config.raw); From fa24602e74433b7452012a3bb6ac8b0b641e9473 Mon Sep 17 00:00:00 2001 From: ploopyco Date: Tue, 20 May 2025 14:03:25 -0400 Subject: [PATCH 2/7] working --- keyboards/ploopyco/dial/config.h | 2 ++ keyboards/ploopyco/ploopyco.c | 32 +++++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/keyboards/ploopyco/dial/config.h b/keyboards/ploopyco/dial/config.h index 83905682f8d..880a985032c 100644 --- a/keyboards/ploopyco/dial/config.h +++ b/keyboards/ploopyco/dial/config.h @@ -18,6 +18,8 @@ #pragma once +#define POINTING_DEVICE_HIRES_SCROLL_ENABLE 0 + #define I2C_DRIVER I2CD1 #define I2C1_SDA_PIN GP22 #define I2C1_SCL_PIN GP23 diff --git a/keyboards/ploopyco/ploopyco.c b/keyboards/ploopyco/ploopyco.c index 2b6014ee2b9..00d683c3e5c 100644 --- a/keyboards/ploopyco/ploopyco.c +++ b/keyboards/ploopyco/ploopyco.c @@ -21,7 +21,6 @@ #include "opt_encoder.h" #include "as5600.h" #include "print.h" -#include "wait.h" // for legacy support #if defined(OPT_DEBOUNCE) && !defined(PLOOPY_SCROLL_DEBOUNCE) @@ -185,13 +184,32 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { delta += 4096; } - if (delta >= SCROLL_DISTANCE) { - current_position = ra; - mouse_report.v = 1; - } else if (delta <= -SCROLL_DISTANCE) { - current_position = ra; - mouse_report.v = -1; + if (is_hires_scroll_on()) { + // Establish a deadzone to prevent spurious inputs + // 4 was found to be a good number experimentally + if (delta > 4 || delta < -4) { + current_position = ra; + mouse_report.v = delta; + } + } else { + // Certain operating systems, like MacOS, don't play well with the + // high-res scrolling implementation. For more details, see: + // https://github.com/qmk/qmk_firmware/issues/17585#issuecomment-2325248167 + // 128 gives the scroll wheels "ticks". + if (delta > 128) { + current_position = ra; + mouse_report.v = 1; + } else if (delta < 128) { + current_position = ra; + mouse_report.v = -1; + } } + + + + /* + + */ #endif return pointing_device_task_user(mouse_report); From 85770691d88a76f5b1339d7a88f14453ed1770c8 Mon Sep 17 00:00:00 2001 From: ploopyco Date: Tue, 20 May 2025 14:32:42 -0400 Subject: [PATCH 3/7] macos fallback for highres scrolling --- keyboards/ploopyco/dial/info.json | 3 ++- keyboards/ploopyco/ploopyco.c | 37 ++++++++----------------------- 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/keyboards/ploopyco/dial/info.json b/keyboards/ploopyco/dial/info.json index 4823554bf1f..0bbd23bb8bc 100644 --- a/keyboards/ploopyco/dial/info.json +++ b/keyboards/ploopyco/dial/info.json @@ -15,7 +15,8 @@ "mousekey": true, "nkro": true, "pointing_device": true, - "console": true + "console": true, + "os_detection": true }, "layouts": { "LAYOUT": { diff --git a/keyboards/ploopyco/ploopyco.c b/keyboards/ploopyco/ploopyco.c index 00d683c3e5c..a5365852504 100644 --- a/keyboards/ploopyco/ploopyco.c +++ b/keyboards/ploopyco/ploopyco.c @@ -20,7 +20,6 @@ #include "analog.h" #include "opt_encoder.h" #include "as5600.h" -#include "print.h" // for legacy support #if defined(OPT_DEBOUNCE) && !defined(PLOOPY_SCROLL_DEBOUNCE) @@ -61,10 +60,8 @@ #endif #ifdef POINTING_DEVICE_AS5600_ENABLE -// Variables specific to the Dial uint16_t current_position = 0; -// Dial will have 16 positions -const uint16_t SCROLL_DISTANCE = 64; +os_variant_t d_os = OS_UNSURE; #endif keyboard_config_t keyboard_config; @@ -184,7 +181,7 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { delta += 4096; } - if (is_hires_scroll_on()) { + if (d_os == OS_WINDOWS || d_os == OS_LINUX) { // Establish a deadzone to prevent spurious inputs // 4 was found to be a good number experimentally if (delta > 4 || delta < -4) { @@ -196,20 +193,14 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { // high-res scrolling implementation. For more details, see: // https://github.com/qmk/qmk_firmware/issues/17585#issuecomment-2325248167 // 128 gives the scroll wheels "ticks". - if (delta > 128) { + if (delta >= 128) { current_position = ra; mouse_report.v = 1; - } else if (delta < 128) { + } else if (delta <= -128) { current_position = ra; mouse_report.v = -1; } } - - - - /* - - */ #endif return pointing_device_task_user(mouse_report); @@ -290,22 +281,12 @@ void pointing_device_init_kb(void) { void keyboard_post_init_kb(void) { // Init the AS5600 controlling the Dial as5600_init(); + current_position = get_rawangle(); +} - uint16_t ra = get_rawangle(); - - int closest = 0; - int min_dist = 4096; - - for (int i = 0; i < 4096; i += SCROLL_DISTANCE) { - int diff = abs((int) ra - i); - int dist = diff < (4096 - diff) ? diff : (4096 - diff); - if (dist < min_dist) { - min_dist = dist; - closest = i; - } - } - - current_position = closest; +bool process_detected_host_os_kb(os_variant_t detected_os) { + d_os = detected_os; + return true; } #endif From 9956da626376bd8ab0e6a4346f69afdac06a8c64 Mon Sep 17 00:00:00 2001 From: ploopyco Date: Thu, 12 Jun 2025 12:46:53 -0400 Subject: [PATCH 4/7] renamed; refactored --- keyboards/ploopyco/common/as5600.h | 16 +++++++++++++-- keyboards/ploopyco/dial/rev1_001/readme.md | 3 --- keyboards/ploopyco/{dial => knob}/config.h | 5 +---- keyboards/ploopyco/{dial => knob}/info.json | 2 +- .../{dial => knob}/keymaps/default/keymap.c | 13 ++++-------- .../ploopyco/{dial => knob}/post_rules.mk | 0 keyboards/ploopyco/{dial => knob}/readme.md | 20 +++++++++---------- .../{dial => knob}/rev1_001/keyboard.json | 0 keyboards/ploopyco/knob/rev1_001/readme.md | 3 +++ keyboards/ploopyco/ploopyco.c | 10 ++++------ 10 files changed, 36 insertions(+), 36 deletions(-) delete mode 100644 keyboards/ploopyco/dial/rev1_001/readme.md rename keyboards/ploopyco/{dial => knob}/config.h (85%) rename keyboards/ploopyco/{dial => knob}/info.json (94%) rename keyboards/ploopyco/{dial => knob}/keymaps/default/keymap.c (79%) rename keyboards/ploopyco/{dial => knob}/post_rules.mk (100%) rename keyboards/ploopyco/{dial => knob}/readme.md (64%) rename keyboards/ploopyco/{dial => knob}/rev1_001/keyboard.json (100%) create mode 100644 keyboards/ploopyco/knob/rev1_001/readme.md diff --git a/keyboards/ploopyco/common/as5600.h b/keyboards/ploopyco/common/as5600.h index 06c2dcbbdaa..68ac3cbe30f 100644 --- a/keyboards/ploopyco/common/as5600.h +++ b/keyboards/ploopyco/common/as5600.h @@ -16,12 +16,24 @@ #pragma once -#define POINTING_DEVICE_AS5600_ENABLE true - #include #include #include "i2c_master.h" +#define POINTING_DEVICE_AS5600_ENABLE true +#define POINTING_DEVICE_AS5600_TICK_COUNT 128 + +// 12 was found to be a good value experimentally, balancing good +// responsiveness with low backlash. +#define POINTING_DEVICE_AS5600_DEADZONE 12 + +// The speed divisor decreases the speed. 1 is base speed; 2 is divided by 2, +// 3 is divided by 3, and so forth. For best results, make sure that +// POINTING_DEVICE_AS5600_SPEED_DIV is an integer divisor of +// POINTING_DEVICE_AS5600_DEADZONE (i.e. 3 is an integer divisor of 12, but +// 5 is not). +#define POINTING_DEVICE_AS5600_SPEED_DIV 2 + #define AS5600_I2C_ADDRESS (0x36 << 1) #define REG_ZMCO 0x00 diff --git a/keyboards/ploopyco/dial/rev1_001/readme.md b/keyboards/ploopyco/dial/rev1_001/readme.md deleted file mode 100644 index 95bec623e81..00000000000 --- a/keyboards/ploopyco/dial/rev1_001/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -This is the R1.001 version of Dial. Future versions may have other features. - -See the [main readme](../readme.md) for more details. diff --git a/keyboards/ploopyco/dial/config.h b/keyboards/ploopyco/knob/config.h similarity index 85% rename from keyboards/ploopyco/dial/config.h rename to keyboards/ploopyco/knob/config.h index 880a985032c..ee69f242d78 100644 --- a/keyboards/ploopyco/dial/config.h +++ b/keyboards/ploopyco/knob/config.h @@ -1,6 +1,4 @@ -/* Copyright 2023 Colin Lam (Ploopy Corporation) - * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) - * Copyright 2019 Sunjun Kim +/* Copyright 2025 Colin Lam (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 @@ -28,4 +26,3 @@ { GP0, GP1, GP2, GP3, GP4, GP5, GP6, GP7, GP8, GP9, GP10, GP11, GP12, \ GP13, GP14, GP15, GP16, GP17, GP18, GP19, GP20, GP21, GP24, GP25, \ GP26, GP27, GP29 } - diff --git a/keyboards/ploopyco/dial/info.json b/keyboards/ploopyco/knob/info.json similarity index 94% rename from keyboards/ploopyco/dial/info.json rename to keyboards/ploopyco/knob/info.json index 0bbd23bb8bc..b1641f5772b 100644 --- a/keyboards/ploopyco/dial/info.json +++ b/keyboards/ploopyco/knob/info.json @@ -1,5 +1,5 @@ { - "keyboard_name": "Ploopy Dial", + "keyboard_name": "Ploopy Knob", "url": "www.ploopy.co", "maintainer": "ploopyco", "manufacturer": "Ploopy Corporation", diff --git a/keyboards/ploopyco/dial/keymaps/default/keymap.c b/keyboards/ploopyco/knob/keymaps/default/keymap.c similarity index 79% rename from keyboards/ploopyco/dial/keymaps/default/keymap.c rename to keyboards/ploopyco/knob/keymaps/default/keymap.c index 1e790a6bfc2..93c23584e1f 100644 --- a/keyboards/ploopyco/dial/keymaps/default/keymap.c +++ b/keyboards/ploopyco/knob/keymaps/default/keymap.c @@ -1,9 +1,4 @@ -/* TODO CHANGE LATER */ - - /* Copyright 2023 Colin Lam (Ploopy Corporation) - * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) - * Copyright 2019 Sunjun Kim * * 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 @@ -25,8 +20,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {{{ KC_NO }}}; void keyboard_post_init_user(void) { // Customise these values to desired behaviour - debug_enable=true; - debug_matrix=true; - debug_keyboard=true; - debug_mouse=true; + // debug_enable=true; + // debug_matrix=true; + // debug_keyboard=true; + // debug_mouse=true; } diff --git a/keyboards/ploopyco/dial/post_rules.mk b/keyboards/ploopyco/knob/post_rules.mk similarity index 100% rename from keyboards/ploopyco/dial/post_rules.mk rename to keyboards/ploopyco/knob/post_rules.mk diff --git a/keyboards/ploopyco/dial/readme.md b/keyboards/ploopyco/knob/readme.md similarity index 64% rename from keyboards/ploopyco/dial/readme.md rename to keyboards/ploopyco/knob/readme.md index e8ccacb5f6b..6629726e86b 100644 --- a/keyboards/ploopyco/dial/readme.md +++ b/keyboards/ploopyco/knob/readme.md @@ -1,16 +1,14 @@ -/* TODO CHANGE LATER */ +# Ploopyco Knob -# Ploopyco Madromys Trackball - -It's a DIY, QMK-powered trackball! +It's a DIY, QMK-powered knob! * Keyboard Maintainer: [PloopyCo](https://github.com/ploopyco) * Hardware Supported: RP2040 -* Hardware Availability: [Store](https://ploopy.co), [GitHub](https://github.com/ploopyco) +* Hardware Availability: [Store](https://ploopy.co/knob), [GitHub](https://github.com/ploopyco) Make example for this keyboard (after setting up your build environment): - qmk compile -kb ploopyco/madromys -km default + qmk compile -kb ploopyco/knob/rev1_001 -km default # Building Firmware @@ -20,14 +18,14 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to [Do you see those two golden holes in the board](https://ploopy.co/wp-content/uploads/2023/11/boot.jpg)? Those are called **vias**. They act exactly like a switch does. Right now, that switch is OFF. However, if you take a paperclip or a pair of metal tweezers and touch those two vias, the two vias will form an electrical connection. Effectively, that switch turns ON. -Go ahead and connect the two vias, and then (while the vias are connected) plug in the Madromys board into your computer. +Go ahead and connect the two vias, and then (while the vias are connected) plug in the Knob board into your computer. -The computer should recognise that a mass storage device was just plugged in. Once this is done, you should be able to drag and drop files onto the Madromys board, as if the board was a USB drive. Feel free to remove the tweezers or paperclip at this point. +The computer should recognise that a mass storage device was just plugged in. Once this is done, you should be able to drag and drop files onto the Knob board, as if the board was a USB drive. Feel free to remove the tweezers or paperclip at this point. -If you want to upload a new firmware file (a ".uf2" file, like "madromys_awesome_version.uf2" or something), just drag it into the folder, and it'll automatically install on the Madromys board and restart itself, in normal operating mode. You're done! +If you want to upload a new firmware file (a ".uf2" file, like "knob_awesome_version.uf2" or something), just drag it into the folder, and it'll automatically install on the Knob board and restart itself, in normal operating mode. You're done! -**TIP**: If your firmware is in some kind of strange state and uploading new firmware isn't fixing it, try uploading [a flash nuke](https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/circuitpython#flash-resetting-uf2-3083182) to the Madromys board before flashing the new firmware. It wipes the memory of the Madromys board completely clean, which can help clear a few types of errors. +**TIP**: If your firmware is in some kind of strange state and uploading new firmware isn't fixing it, try uploading [a flash nuke](https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/circuitpython#flash-resetting-uf2-3083182) to the Knob board before flashing the new firmware. It wipes the memory of the Knob board completely clean, which can help clear a few types of errors. -# Customizing your Ploopy Madromys +# Customizing your Ploopy Knob You can find customziation options [here](../readme.md). diff --git a/keyboards/ploopyco/dial/rev1_001/keyboard.json b/keyboards/ploopyco/knob/rev1_001/keyboard.json similarity index 100% rename from keyboards/ploopyco/dial/rev1_001/keyboard.json rename to keyboards/ploopyco/knob/rev1_001/keyboard.json diff --git a/keyboards/ploopyco/knob/rev1_001/readme.md b/keyboards/ploopyco/knob/rev1_001/readme.md new file mode 100644 index 00000000000..0c23bf73eda --- /dev/null +++ b/keyboards/ploopyco/knob/rev1_001/readme.md @@ -0,0 +1,3 @@ +This is the R1.001 version of the Knob. Future versions may have other features. + +See the [main readme](../readme.md) for more details. diff --git a/keyboards/ploopyco/ploopyco.c b/keyboards/ploopyco/ploopyco.c index a5365852504..9f8b83e2e7f 100644 --- a/keyboards/ploopyco/ploopyco.c +++ b/keyboards/ploopyco/ploopyco.c @@ -183,20 +183,18 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { if (d_os == OS_WINDOWS || d_os == OS_LINUX) { // Establish a deadzone to prevent spurious inputs - // 4 was found to be a good number experimentally - if (delta > 4 || delta < -4) { + if (delta > POINTING_DEVICE_AS5600_DEADZONE || delta < -POINTING_DEVICE_AS5600_DEADZONE) { current_position = ra; - mouse_report.v = delta; + mouse_report.v = delta / POINTING_DEVICE_AS5600_SPEED_DIV; } } else { // Certain operating systems, like MacOS, don't play well with the // high-res scrolling implementation. For more details, see: // https://github.com/qmk/qmk_firmware/issues/17585#issuecomment-2325248167 - // 128 gives the scroll wheels "ticks". - if (delta >= 128) { + if (delta >= POINTING_DEVICE_AS5600_TICK_COUNT) { current_position = ra; mouse_report.v = 1; - } else if (delta <= -128) { + } else if (delta <= -POINTING_DEVICE_AS5600_TICK_COUNT) { current_position = ra; mouse_report.v = -1; } From 2b18366fb87cb814b51dcf837478ec7e78a044d3 Mon Sep 17 00:00:00 2001 From: ploopyco Date: Thu, 12 Jun 2025 14:04:25 -0400 Subject: [PATCH 5/7] updated readme --- keyboards/ploopyco/knob/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/ploopyco/knob/readme.md b/keyboards/ploopyco/knob/readme.md index 6629726e86b..0489ba44197 100644 --- a/keyboards/ploopyco/knob/readme.md +++ b/keyboards/ploopyco/knob/readme.md @@ -16,7 +16,7 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to # Triggering the Bootloader -[Do you see those two golden holes in the board](https://ploopy.co/wp-content/uploads/2023/11/boot.jpg)? Those are called **vias**. They act exactly like a switch does. Right now, that switch is OFF. However, if you take a paperclip or a pair of metal tweezers and touch those two vias, the two vias will form an electrical connection. Effectively, that switch turns ON. +[Do you see those two golden holes in the board](https://ploopy.co/wp-content/uploads/2025/06/knob-vias.jpg)? Those are called **vias**. They act exactly like a switch does. Right now, that switch is OFF. However, if you take a paperclip or a pair of metal tweezers and touch those two vias, the two vias will form an electrical connection. Effectively, that switch turns ON. Go ahead and connect the two vias, and then (while the vias are connected) plug in the Knob board into your computer. From 54f553c49495ef924f3268541cd9f12e52a009c5 Mon Sep 17 00:00:00 2001 From: ploopyco Date: Wed, 18 Jun 2025 11:59:34 -0400 Subject: [PATCH 6/7] fixes --- keyboards/ploopyco/common/as5600.h | 1 - keyboards/ploopyco/knob/config.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/ploopyco/common/as5600.h b/keyboards/ploopyco/common/as5600.h index 68ac3cbe30f..608d272072d 100644 --- a/keyboards/ploopyco/common/as5600.h +++ b/keyboards/ploopyco/common/as5600.h @@ -20,7 +20,6 @@ #include #include "i2c_master.h" -#define POINTING_DEVICE_AS5600_ENABLE true #define POINTING_DEVICE_AS5600_TICK_COUNT 128 // 12 was found to be a good value experimentally, balancing good diff --git a/keyboards/ploopyco/knob/config.h b/keyboards/ploopyco/knob/config.h index ee69f242d78..9b7d9f5c1a2 100644 --- a/keyboards/ploopyco/knob/config.h +++ b/keyboards/ploopyco/knob/config.h @@ -17,6 +17,7 @@ #pragma once #define POINTING_DEVICE_HIRES_SCROLL_ENABLE 0 +#define POINTING_DEVICE_AS5600_ENABLE true #define I2C_DRIVER I2CD1 #define I2C1_SDA_PIN GP22 From 099d0aef6853498fbab412c726d5fb1f439e1b95 Mon Sep 17 00:00:00 2001 From: ploopyco Date: Fri, 20 Jun 2025 13:46:35 -0400 Subject: [PATCH 7/7] refactored os detection --- keyboards/ploopyco/ploopyco.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/keyboards/ploopyco/ploopyco.c b/keyboards/ploopyco/ploopyco.c index 9f8b83e2e7f..72fad42aba0 100644 --- a/keyboards/ploopyco/ploopyco.c +++ b/keyboards/ploopyco/ploopyco.c @@ -61,7 +61,6 @@ #ifdef POINTING_DEVICE_AS5600_ENABLE uint16_t current_position = 0; -os_variant_t d_os = OS_UNSURE; #endif keyboard_config_t keyboard_config; @@ -181,7 +180,7 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { delta += 4096; } - if (d_os == OS_WINDOWS || d_os == OS_LINUX) { + if (detected_host_os() == OS_WINDOWS || detected_host_os() == OS_LINUX) { // Establish a deadzone to prevent spurious inputs if (delta > POINTING_DEVICE_AS5600_DEADZONE || delta < -POINTING_DEVICE_AS5600_DEADZONE) { current_position = ra; @@ -281,11 +280,6 @@ void keyboard_post_init_kb(void) { as5600_init(); current_position = get_rawangle(); } - -bool process_detected_host_os_kb(os_variant_t detected_os) { - d_os = detected_os; - return true; -} #endif void eeconfig_init_kb(void) {