From 88a783a8a769e604fa13947ee9c556f0dc1c95ad Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 18 Nov 2020 14:20:29 -0800 Subject: [Keyboard] PloopyCo update and fixes (#10936) This is based on feedback talking with crop_octagon about the device. Future trackballs will ship with ATMEL DFU for simplicity. This also includes some fixes and optimizations based on code review and tinkering on my own devices. --- keyboards/ploopyco/trackball/readme.md | 23 ------------------- keyboards/ploopyco/trackball/rev1/readme.md | 30 +++++++++++++++++++++++++ keyboards/ploopyco/trackball/rev1/rules.mk | 2 ++ keyboards/ploopyco/trackball/rev1_005/readme.md | 3 +++ keyboards/ploopyco/trackball/rev1_005/rules.mk | 2 ++ keyboards/ploopyco/trackball/rules.mk | 3 --- keyboards/ploopyco/trackball/trackball.c | 24 +++----------------- 7 files changed, 40 insertions(+), 47 deletions(-) create mode 100644 keyboards/ploopyco/trackball/rev1/readme.md create mode 100644 keyboards/ploopyco/trackball/rev1_005/readme.md (limited to 'keyboards/ploopyco/trackball') diff --git a/keyboards/ploopyco/trackball/readme.md b/keyboards/ploopyco/trackball/readme.md index bd88d5c5aa..714f610346 100644 --- a/keyboards/ploopyco/trackball/readme.md +++ b/keyboards/ploopyco/trackball/readme.md @@ -58,26 +58,3 @@ To configure/set your own array, there are two defines to use, `PLOOPY_DPI_OPTIO 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. - -# Programming QMK-DFU onto the PloopyCo Trackball - -If you would rather have DFU on this board, you can use the QMK-DFU bootloader on the device. To do so, you want to run: - - make ploopyco/trackball:default:production - -Once you have that, you'll need to [ISP Flash](https://docs.qmk.fm/#/isp_flashing_guide) the chip with the new bootloader hex file created (or the production hex), and set the fuses: - - -| Fuse | Setting | -|----------|------------------| -| Low | `0xDF` | -| High | `0xD8` or `0x98` | -| Extended | `0xCB` | - -Original (Caterina) settings: - -| Fuse | Setting | -|----------|------------------| -| Low | `0xFF` | -| High | `0xD8` | -| Extended | `0xFE` | diff --git a/keyboards/ploopyco/trackball/rev1/readme.md b/keyboards/ploopyco/trackball/rev1/readme.md new file mode 100644 index 0000000000..c0b0223723 --- /dev/null +++ b/keyboards/ploopyco/trackball/rev1/readme.md @@ -0,0 +1,30 @@ +See the [main readme](../readme.md) for more details. + +This is just the rev 1.001-1.004 trackball + +# Programming QMK-DFU onto the PloopyCo Trackball (Advanced) + +If you would rather have DFU on this board, you can use the QMK-DFU bootloader on the device. To do so, you want to run: + + make ploopyco/trackball:default:production + +Once you have that, you'll need to [ISP Flash](https://docs.qmk.fm/#/isp_flashing_guide) the chip with the new "production" hex file created (or the production hex), and set the fuses: + + +| Fuse | Setting | +|----------|------------------| +| Low | `0xDF` | +| High | `0xD8` or `0x98` | +| Extended | `0xCB` | + +Original (Caterina) settings: + +| Fuse | Setting | +|----------|------------------| +| Low | `0xFF` | +| High | `0xD8` | +| Extended | `0xFE` | + +If you're using QMK DFU, you'll also need to add `BOOTLOADER=qmk-dfu` to your keymap's rules.mk file, to ensure that the reboot/reset works correctly. Otherwise, it will jump right back into the firmware, like nothing happened. + +Additionally, once you've flashed the qmk-dfu bootloader onto your device, you will no longer be able to use the Arduino IDE to flash the board. You'll need to use the command line or QMK Toolbox to flash it. diff --git a/keyboards/ploopyco/trackball/rev1/rules.mk b/keyboards/ploopyco/trackball/rev1/rules.mk index e69de29bb2..6ded83e74b 100644 --- a/keyboards/ploopyco/trackball/rev1/rules.mk +++ b/keyboards/ploopyco/trackball/rev1/rules.mk @@ -0,0 +1,2 @@ +# Bootloader selection +BOOTLOADER = caterina diff --git a/keyboards/ploopyco/trackball/rev1_005/readme.md b/keyboards/ploopyco/trackball/rev1_005/readme.md new file mode 100644 index 0000000000..a923d16591 --- /dev/null +++ b/keyboards/ploopyco/trackball/rev1_005/readme.md @@ -0,0 +1,3 @@ +See the [main readme](../readme.md) for more details. + +This is just the rev 1.005+ trackball diff --git a/keyboards/ploopyco/trackball/rev1_005/rules.mk b/keyboards/ploopyco/trackball/rev1_005/rules.mk index e69de29bb2..bddd4e389e 100644 --- a/keyboards/ploopyco/trackball/rev1_005/rules.mk +++ b/keyboards/ploopyco/trackball/rev1_005/rules.mk @@ -0,0 +1,2 @@ +# Bootloader selection +BOOTLOADER = atmel-dfu diff --git a/keyboards/ploopyco/trackball/rules.mk b/keyboards/ploopyco/trackball/rules.mk index 9e252fbddb..4ec870e659 100644 --- a/keyboards/ploopyco/trackball/rules.mk +++ b/keyboards/ploopyco/trackball/rules.mk @@ -4,9 +4,6 @@ MCU = atmega32u4 # Processor frequency F_CPU = 8000000 -# Bootloader selection -BOOTLOADER = caterina - # Build Options # change yes to no to disable # diff --git a/keyboards/ploopyco/trackball/trackball.c b/keyboards/ploopyco/trackball/trackball.c index 7b7b680271..94f2843460 100644 --- a/keyboards/ploopyco/trackball/trackball.c +++ b/keyboards/ploopyco/trackball/trackball.c @@ -140,7 +140,7 @@ __attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) { if (debug_mouse) dprintf("Cons] X: %d, Y: %d\n", data.dx, data.dy); // dprintf("Elapsed:%u, X: %f Y: %\n", i, pgm_read_byte(firmware_data+i)); - process_mouse_user(mouse_report, data.dx, data.dy); + process_mouse_user(mouse_report, data.dx, -data.dy); } } @@ -172,27 +172,9 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { if (IS_MOUSEKEY_BUTTON(keycode)) { report_mouse_t currentReport = pointing_device_get_report(); if (record->event.pressed) { - if (keycode == KC_MS_BTN1) - currentReport.buttons |= MOUSE_BTN1; - else if (keycode == KC_MS_BTN2) - currentReport.buttons |= MOUSE_BTN2; - else if (keycode == KC_MS_BTN3) - currentReport.buttons |= MOUSE_BTN3; - else if (keycode == KC_MS_BTN4) - currentReport.buttons |= MOUSE_BTN4; - else if (keycode == KC_MS_BTN5) - currentReport.buttons |= MOUSE_BTN5; + currentReport.buttons |= 1 << (keycode - KC_MS_BTN1); } else { - if (keycode == KC_MS_BTN1) - currentReport.buttons &= ~MOUSE_BTN1; - else if (keycode == KC_MS_BTN2) - currentReport.buttons &= ~MOUSE_BTN2; - else if (keycode == KC_MS_BTN3) - currentReport.buttons &= ~MOUSE_BTN3; - else if (keycode == KC_MS_BTN4) - currentReport.buttons &= ~MOUSE_BTN4; - else if (keycode == KC_MS_BTN5) - currentReport.buttons &= ~MOUSE_BTN5; + currentReport.buttons &= ~(1 << (keycode - KC_MS_BTN1)); } pointing_device_set_report(currentReport); pointing_device_send(); -- cgit v1.2.3