summaryrefslogtreecommitdiffstats
path: root/keyboards
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-06-21 13:00:11 -0700
committerGitHub <noreply@github.com>2021-06-21 21:00:11 +0100
commit6901411bca0760ceb8acbe1f0c95feaed9d2aaeb (patch)
treefdcc973f99e6dab858455f6eebd380a12ecc8675 /keyboards
parentb491c7994aa1931fd000cc93a1bf70453d462c40 (diff)
Move optical sensor code to drivers folder (#13044)
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/draculad/keymaps/pimoroni/keymap.c2
-rw-r--r--keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.c177
-rw-r--r--keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.h35
-rw-r--r--keyboards/draculad/keymaps/pimoroni/rules.mk2
-rw-r--r--keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.h2
-rw-r--r--keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.c221
-rw-r--r--keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.h103
-rw-r--r--keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360_firmware.h300
-rw-r--r--keyboards/handwired/dactyl_manuform/5x6_right_trackball/rules.mk2
-rw-r--r--keyboards/oddball/adns/adns.c219
-rw-r--r--keyboards/oddball/adns/adns.h35
-rw-r--r--keyboards/oddball/adns/adns9800_srom_A6.h3078
-rw-r--r--keyboards/oddball/optical_sensor/optical_sensor.h2
-rw-r--r--keyboards/oddball/rules.mk2
-rw-r--r--keyboards/ploopyco/adns5050.c197
-rw-r--r--keyboards/ploopyco/adns5050.h79
-rw-r--r--keyboards/ploopyco/mouse/mouse.h2
-rw-r--r--keyboards/ploopyco/mouse/rules.mk2
-rw-r--r--keyboards/ploopyco/pmw3360.c218
-rw-r--r--keyboards/ploopyco/pmw3360.h103
-rw-r--r--keyboards/ploopyco/pmw3360_firmware.h300
-rw-r--r--keyboards/ploopyco/trackball/rules.mk2
-rw-r--r--keyboards/ploopyco/trackball/trackball.h2
-rw-r--r--keyboards/ploopyco/trackball_mini/rules.mk2
-rw-r--r--keyboards/ploopyco/trackball_mini/trackball_mini.h2
-rw-r--r--keyboards/ploopyco/trackball_nano/rules.mk2
-rw-r--r--keyboards/ploopyco/trackball_nano/trackball_nano.h2
27 files changed, 14 insertions, 5079 deletions
diff --git a/keyboards/draculad/keymaps/pimoroni/keymap.c b/keyboards/draculad/keymaps/pimoroni/keymap.c
index 87cbe3cd3a..762ae26c70 100644
--- a/keyboards/draculad/keymaps/pimoroni/keymap.c
+++ b/keyboards/draculad/keymaps/pimoroni/keymap.c
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
-#include "pimoroni_trackball.h"
+#include "drivers/sensors/pimoroni_trackball.h"
#include "pointing_device.h"
diff --git a/keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.c b/keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.c
deleted file mode 100644
index c4f4a0441a..0000000000
--- a/keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
- *
- * 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 "pimoroni_trackball.h"
-#include "i2c_master.h"
-
-static uint8_t scrolling = 0;
-static int16_t x_offset = 0;
-static int16_t y_offset = 0;
-static int16_t h_offset = 0;
-static int16_t v_offset = 0;
-static float precisionSpeed = 1;
-
-static uint16_t i2c_timeout_timer;
-
-#ifndef I2C_TIMEOUT
-# define I2C_TIMEOUT 100
-#endif
-#ifndef I2C_WAITCHECK
-# define I2C_WAITCHECK 1000
-#endif
-#ifndef MOUSE_DEBOUNCE
-# define MOUSE_DEBOUNCE 5
-#endif
-
-void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white) {
- uint8_t data[] = {0x00, red, green, blue, white};
- i2c_transmit(TRACKBALL_WRITE, data, sizeof(data), I2C_TIMEOUT);
-}
-
-int16_t mouse_offset(uint8_t positive, uint8_t negative, int16_t scale) {
- int16_t offset = (int16_t)positive - (int16_t)negative;
- int16_t magnitude = (int16_t)(scale * offset * offset * precisionSpeed);
- return offset < 0 ? -magnitude : magnitude;
-}
-
-void update_member(int8_t* member, int16_t* offset) {
- if (*offset > 127) {
- *member = 127;
- *offset -= 127;
- } else if (*offset < -127) {
- *member = -127;
- *offset += 127;
- } else {
- *member = *offset;
- *offset = 0;
- }
-}
-
-__attribute__((weak)) void trackball_check_click(bool pressed, report_mouse_t* mouse) {
- if (pressed) {
- mouse->buttons |= MOUSE_BTN1;
- } else {
- mouse->buttons &= ~MOUSE_BTN1;
- }
-}
-
-bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
- 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);
- }
-
-
- if (!process_record_user(keycode, record)) { return false; }
-
-/* 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
- * Mousekeys is not enable, so it's not handled twice.
- */
-#ifndef MOUSEKEY_ENABLE
- if (IS_MOUSEKEY_BUTTON(keycode)) {
- report_mouse_t currentReport = pointing_device_get_report();
- if (record->event.pressed) {
- currentReport.buttons |= 1 << (keycode - KC_MS_BTN1);
- } else {
- currentReport.buttons &= ~(1 << (keycode - KC_MS_BTN1));
- }
- pointing_device_set_report(currentReport);
- pointing_device_send();
- }
-#endif
-
- return true;
-}
-
-void trackball_register_button(bool pressed, enum mouse_buttons button) {
- report_mouse_t currentReport = pointing_device_get_report();
- if (pressed) {
- currentReport.buttons |= button;
- } else {
- currentReport.buttons &= ~button;
- }
- pointing_device_set_report(currentReport);
-}
-
-float trackball_get_precision(void) { return precisionSpeed; }
-void trackball_set_precision(float precision) { precisionSpeed = precision; }
-bool trackball_is_scrolling(void) { return scrolling; }
-void trackball_set_scrolling(bool scroll) { scrolling = scroll; }
-
-
-__attribute__((weak)) void pointing_device_init(void) { trackball_set_rgbw(0x80, 0x00, 0x00, 0x00); }
-
-void pointing_device_task(void) {
- static bool debounce;
- static uint16_t debounce_timer;
- uint8_t state[5] = {};
- if (timer_elapsed(i2c_timeout_timer) > I2C_WAITCHECK) {
- if (i2c_readReg(TRACKBALL_WRITE, 0x04, state, 5, I2C_TIMEOUT) == I2C_STATUS_SUCCESS) {
- if (!state[4] && !debounce) {
- if (scrolling) {
-#ifdef PIMORONI_TRACKBALL_INVERT_X
- h_offset += mouse_offset(state[2], state[3], 1);
-#else
- h_offset -= mouse_offset(state[2], state[3], 1);
-#endif
-#ifdef PIMORONI_TRACKBALL_INVERT_Y
- v_offset += mouse_offset(state[1], state[0], 1);
-#else
- v_offset -= mouse_offset(state[1], state[0], 1);
-#endif
- } else {
-#ifdef PIMORONI_TRACKBALL_INVERT_X
- x_offset -= mouse_offset(state[2], state[3], 5);
-#else
- x_offset += mouse_offset(state[2], state[3], 5);
-#endif
-#ifdef PIMORONI_TRACKBALL_INVERT_Y
- y_offset -= mouse_offset(state[1], state[0], 5);
-#else
- y_offset += mouse_offset(state[1], state[0], 5);
-#endif
- }
- } else {
- if (state[4]) {
- debounce = true;
- debounce_timer = timer_read();
- }
- }
- } else {
- i2c_timeout_timer = timer_read();
- }
- }
-
- if (timer_elapsed(debounce_timer) > MOUSE_DEBOUNCE) debounce = false;
-
- report_mouse_t mouse = pointing_device_get_report();
- // trackball_check_click(state[4] & (1 << 7), &mouse);
-
-#ifndef PIMORONI_TRACKBALL_ROTATE
- update_member(&mouse.x, &x_offset);
- update_member(&mouse.y, &y_offset);
- update_member(&mouse.h, &h_offset);
- update_member(&mouse.v, &v_offset);
-#else
- update_member(&mouse.x, &y_offset);
- update_member(&mouse.y, &x_offset);
- update_member(&mouse.h, &v_offset);
- update_member(&mouse.v, &h_offset);
-#endif
- pointing_device_set_report(mouse);
- pointing_device_send();
-}
diff --git a/keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.h b/keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.h
deleted file mode 100644
index cfcd5a47a1..0000000000
--- a/keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
- *
- * 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 "quantum.h"
-#include "pointing_device.h"
-
-#ifndef TRACKBALL_ADDRESS
-# define TRACKBALL_ADDRESS 0x0A
-#endif
-#define TRACKBALL_WRITE ((TRACKBALL_ADDRESS << 1) | I2C_WRITE)
-#define TRACKBALL_READ ((TRACKBALL_ADDRESS << 1) | I2C_READ)
-
-void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white);
-void trackball_check_click(bool pressed, report_mouse_t *mouse);
-void trackball_register_button(bool pressed, enum mouse_buttons button);
-
-float trackball_get_precision(void);
-void trackball_set_precision(float precision);
-bool trackball_is_scrolling(void);
-void trackball_set_scrolling(bool scroll); \ No newline at end of file
diff --git a/keyboards/draculad/keymaps/pimoroni/rules.mk b/keyboards/draculad/keymaps/pimoroni/rules.mk
index 547a02f26f..d8dc92fbfc 100644
--- a/keyboards/draculad/keymaps/pimoroni/rules.mk
+++ b/keyboards/draculad/keymaps/pimoroni/rules.mk
@@ -1,6 +1,6 @@
# only uncomment on the side you have your trackball on
POINTING_DEVICE_ENABLE = yes
-SRC += pimoroni_trackball.c
+SRC += drivers/sensors/pimoroni_trackball.c
QUANTUM_LIB_SRC += i2c_master.c
OLED_DRIVER_ENABLE = yes
MOUSEKEY_ENABLE = no
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.h b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.h
index c8650f73d3..ed408563f7 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.h
+++ b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.h
@@ -19,7 +19,7 @@
#include "dactyl_manuform.h"
#include "quantum.h"
#include "spi_master.h"
-#include "pmw3360.h"
+#include "drivers/sensors/pmw3360.h"
#include "pointing_device.h"
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.c b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.c
deleted file mode 100644
index 59e3495127..0000000000
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/* 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/>.
- */
-
-#ifdef POINTING_DEVICE_ENABLE
-
-#include "wait.h"
-#include "debug.h"
-#include "print.h"
-#include "pmw3360.h"
-#include "pmw3360_firmware.h"
-
-bool _inBurst = false;
-
-#ifndef PMW_CPI
-# define PMW_CPI 1600
-#endif
-#ifndef SPI_DIVISOR
-# define SPI_DIVISOR 2
-#endif
-#ifndef ROTATIONAL_TRANSFORM_ANGLE
-# define ROTATIONAL_TRANSFORM_ANGLE 0x00
-#endif
-
-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')); }
-
-bool spi_start_adv(void) {
- bool status = spi_start(SPI_SS_PIN, false, 3, SPI_DIVISOR);
- wait_us(1);
- return status;
-}
-
-void spi_stop_adv(void) {
- wait_us(1);
- spi_stop();
-}
-
-spi_status_t spi_write_adv(uint8_t reg_addr, uint8_t data) {
- if (reg_addr != REG_Motion_Burst) {
- _inBurst = false;
- }
-
- spi_start_adv();
- // send address of the register, with MSBit = 1 to indicate it's a write
- spi_status_t status = spi_write(reg_addr | 0x80);
- status = spi_write(data);
-
- // tSCLK-NCS for write operation
- wait_us(20);
-
- // tSWW/tSWR (=120us) minus tSCLK-NCS. Could be shortened, but is looks like a safe lower bound
- wait_us(100);
- spi_stop();
- return status;
-}
-
-uint8_t spi_read_adv(uint8_t reg_addr) {
- spi_start_adv();
- // send adress of the register, with MSBit = 0 to indicate it's a read
- spi_write(reg_addr & 0x7f);
-
- uint8_t data = spi_read();
-
- // tSCLK-NCS for read operation is 120ns
- wait_us(1);
-
- // tSRW/tSRR (=20us) minus tSCLK-NCS
- wait_us(19);
-
- spi_stop();
- return data;
-}
-
-void pmw_set_cpi(uint16_t cpi) {
- int cpival = constrain((cpi / 100) - 1, 0, 0x77); // limits to 0--119
-
- spi_start_adv();
- spi_write_adv(REG_Config1, cpival);
- spi_stop();
-}
-
-bool pmw_spi_init(void) {
- spi_init();
- _inBurst = false;
-
- spi_stop();
- spi_start_adv();
- spi_stop();
-
- spi_write_adv(REG_Shutdown, 0xb6); // Shutdown first
- wait_ms(300);
-
- spi_start_adv();
- wait_us(40);
- spi_stop_adv();
- wait_us(40);
-
- spi_write_adv(REG_Power_Up_Reset, 0x5a);
- wait_ms(50);
-
- spi_read_adv(REG_Motion);
- spi_read_adv(REG_Delta_X_L);
- spi_read_adv(REG_Delta_X_H);
- spi_read_adv(REG_Delta_Y_L);
- spi_read_adv(REG_Delta_Y_H);
-
- pmw_upload_firmware();
-
- spi_stop_adv();
-
- wait_ms(10);
- pmw_set_cpi(PMW_CPI);
-
- wait_ms(1);
-
- return pmw_check_signature();
-}
-
-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);
-
- spi_write_adv(REG_SROM_Enable, 0x18);
-
- spi_start_adv();
- spi_write(REG_SROM_Load_Burst | 0x80);
- wait_us(15);
-
- unsigned char c;
- for (int i = 0; i < firmware_length; i++) {
- c = (unsigned char)pgm_read_byte(firmware_data + i);
- spi_write(c);
- wait_us(15);
- }
- wait_us(200);
-
- spi_read_adv(REG_SROM_ID);
-
- spi_write_adv(REG_Config2, 0x00);
-
- spi_stop();
- wait_ms(10);
-}
-
-bool pmw_check_signature(void) {
- uint8_t pid = spi_read_adv(REG_Product_ID);
- uint8_t iv_pid = spi_read_adv(REG_Inverse_Product_ID);
- uint8_t SROM_ver = spi_read_adv(REG_SROM_ID);
- return (pid == 0x42 && iv_pid == 0xBD && SROM_ver == 0x04); // signature for SROM 0x04
-}
-
-report_pmw_t pmw_read_burst(void) {
- if (!_inBurst) {
- dprintf("burst on");
- spi_write_adv(REG_Motion_Burst, 0x00);
- _inBurst = true;
- }
-
- spi_start_adv();
- spi_write(REG_Motion_Burst);
- wait_us(35); // waits for tSRAD
-
- report_pmw_t data;
- data.motion = 0;
- data.dx = 0;
- data.mdx = 0;
- data.dy = 0;
- data.mdx = 0;
-
- data.motion = spi_read();
- spi_write(0x00); // skip Observation
- data.dx = spi_read();
- data.mdx = spi_read();
- data.dy = spi_read();
- data.mdy = spi_read();
-
- spi_stop();
-
- print_byte(data.motion);
- print_byte(data.dx);
- print_byte(data.mdx);
- print_byte(data.dy);
- print_byte(data.mdy);
- dprintf("\n");
-
- data.isMotion = (data.motion & 0x80) != 0;
- data.isOnSurface = (data.motion & 0x08) == 0;
- data.dx |= (data.mdx << 8);
- data.dx = data.dx * -1;
- data.dy |= (data.mdy << 8);
- data.dy = data.dy * -1;
-
- spi_stop();
-
- if (data.motion & 0b111) { // panic recovery, sometimes burst mode works weird.
- _inBurst = false;
- }
-
- return data;
-}
-
-#endif
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.h b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.h
deleted file mode 100644
index c1d5e3badb..0000000000
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* 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 "spi_master.h"
-
-// Registers
-#define REG_Product_ID 0x00
-#define REG_Revision_ID 0x01
-#define REG_Motion 0x02
-#define REG_Delta_X_L 0x03
-#define REG_Delta_X_H 0x04
-#define REG_Delta_Y_L 0x05
-#define REG_Delta_Y_H 0x06
-#define REG_SQUAL 0x07
-#define REG_Raw_Data_Sum 0x08
-#define REG_Maximum_Raw_data 0x09
-#define REG_Minimum_Raw_data 0x0A
-#define REG_Shutter_Lower 0x0B
-#define REG_Shutter_Upper 0x0C
-#define REG_Control 0x0D
-#define REG_Config1 0x0F
-#define REG_Config2 0x10
-#define REG_Angle_Tune 0x11
-#define REG_Frame_Capture 0x12
-#define REG_SROM_Enable 0x13
-#define REG_Run_Downshift 0x14
-#define REG_Rest1_Rate_Lower 0x15
-#define REG_Rest1_Rate_Upper 0x16
-#define REG_Rest1_Downshift 0x17
-#define REG_Rest2_Rate_Lower 0x18
-#define REG_Rest2_Rate_Upper 0x19
-#define REG_Rest2_Downshift 0x1A
-#define REG_Rest3_Rate_Lower 0x1B
-#define REG_Rest3_Rate_Upper 0x1C
-#define REG_Observation 0x24
-#define REG_Data_Out_Lower 0x25
-#define REG_Data_Out_Upper 0x26
-#define REG_Raw_Data_Dump 0x29
-#define REG_SROM_ID 0x2A
-#define REG_Min_SQ_Run 0x2B
-#define REG_Raw_Data_Threshold 0x2C
-#define REG_Config5 0x2F
-#define REG_Power_Up_Reset 0x3A
-#define REG_Shutdown 0x3B
-#define REG_Inverse_Product_ID 0x3F
-#define REG_LiftCutoff_Tune3 0x41
-#define REG_Angle_Snap 0x42
-#define REG_LiftCutoff_Tune1 0x4A
-#define REG_Motion_Burst 0x50
-#define REG_LiftCutoff_Tune_Timeout 0x58
-#define REG_LiftCutoff_Tune_Min_Length 0x5A
-#define REG_SROM_Load_Burst 0x62
-#define REG_Lift_Config 0x63
-#define REG_Raw_Data_Burst 0x64
-#define REG_LiftCutoff_Tune2 0x65
-
-#ifdef CONSOLE_ENABLE
-void print_byte(uint8_t byte);
-#endif
-
-typedef struct {
- int8_t motion;
- bool isMotion; // True if a motion is detected.
- bool isOnSurface; // True when a chip is on a surface
- int16_t dx; // displacement on x directions. Unit: Count. (CPI * Count = Inch value)
- int8_t mdx;
- int16_t dy; // displacement on y directions.
- int8_t mdy;
-} report_pmw_t;
-
-
-
-bool spi_start_adv(void);
-void spi_stop_adv(void);
-spi_status_t spi_write_adv(uint8_t reg_addr, uint8_t data);
-uint8_t spi_read_adv(uint8_t reg_addr);
-bool pmw_spi_init(void);
-void pmw_set_cpi(uint16_t cpi);
-void pmw_upload_firmware(void);
-bool pmw_check_signature(void);
-report_pmw_t pmw_read_burst(void);
-
-
-#define degToRad(angleInDegrees) ((angleInDegrees)*M_PI / 180.0)
-#define radToDeg(angleInRadians) ((angleInRadians)*180.0 / M_PI)
-#define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360_firmware.h b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360_firmware.h
deleted file mode 100644
index cca5a6a4d8..0000000000
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360_firmware.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/* 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
-
-// clang-format off
-// Firmware Blob foor PMW3360
-const uint16_t firmware_length = 4094;
-// clang-format off
-const uint8_t firmware_data[] PROGMEM = { // SROM 0x04
-0x01, 0x04, 0x8e, 0x96, 0x6e, 0x77, 0x3e, 0xfe, 0x7e, 0x5f, 0x1d, 0xb8, 0xf2, 0x66, 0x4e,
-0xff, 0x5d, 0x19, 0xb0, 0xc2, 0x04, 0x69, 0x54, 0x2a, 0xd6, 0x2e, 0xbf, 0xdd, 0x19, 0xb0,
-0xc3, 0xe5, 0x29, 0xb1, 0xe0, 0x23, 0xa5, 0xa9, 0xb1, 0xc1, 0x00, 0x82, 0x67, 0x4c, 0x1a,
-0x97, 0x8d, 0x79, 0x51, 0x20, 0xc7, 0x06, 0x8e, 0x7c, 0x7c, 0x7a, 0x76, 0x4f, 0xfd, 0x59,
-0x30, 0xe2, 0x46, 0x0e, 0x9e, 0xbe, 0xdf, 0x1d, 0x99, 0x91, 0xa0, 0xa5, 0xa1, 0xa9, 0xd0,
-0x22, 0xc6, 0xef, 0x5c, 0x1b, 0x95, 0x89, 0x90, 0xa2, 0xa7, 0xcc, 0xfb, 0x55, 0x28, 0xb3,
-0xe4, 0x4a, 0xf7, 0x6c, 0x3b, 0xf4, 0x6a, 0x56, 0x2e, 0xde, 0x1f, 0x9d, 0xb8, 0xd3, 0x05,
-0x88, 0x92, 0xa6, 0xce, 0x1e, 0xbe, 0xdf, 0x1d, 0x99, 0xb0, 0xe2, 0x46, 0xef, 0x5c, 0x07,
-0x11, 0x5d, 0x98, 0x0b, 0x9d, 0x94, 0x97, 0xee, 0x4e, 0x45, 0x33, 0x6b, 0x44, 0xc7, 0x29,
-0x56, 0x27, 0x30, 0xc6, 0xa7, 0xd5, 0xf2, 0x56, 0xdf, 0xb4, 0x38, 0x62, 0xcb, 0xa0, 0xb6,
-0xe3, 0x0f, 0x84, 0x06, 0x24, 0x05, 0x65, 0x6f, 0x76, 0x89, 0xb5, 0x77, 0x41, 0x27, 0x82,
-0x66, 0x65, 0x82, 0xcc, 0xd5, 0x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