Rework and expand Pointing Device support (#14343)
Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2020 Alexander Tulloh
|
||||
/* 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
|
||||
@@ -16,20 +16,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#define ANALOG_JOYSTICK_X_AXIS_PIN B4
|
||||
#define ANALOG_JOYSTICK_Y_AXIS_PIN B5
|
||||
|
||||
typedef struct {
|
||||
/* 100 - 12000 CPI supported */
|
||||
uint16_t cpi;
|
||||
} config_pmw_t;
|
||||
|
||||
typedef struct {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
} report_pmw_t;
|
||||
|
||||
void pmw_init(void);
|
||||
config_pmw_t pmw_get_config(void);
|
||||
void pmw_set_config(config_pmw_t);
|
||||
/* Reads and clears the current delta values on the PMW sensor */
|
||||
report_pmw_t pmw_get_report(void);
|
||||
#define ANALOG_JOYSTICK_CLICK_PIN E6
|
@@ -29,98 +29,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// Joystick
|
||||
// Set Pins
|
||||
// uint8_t xPin = 8; // VRx / /B4
|
||||
// uint8_t yPin = 7; // VRy // B5
|
||||
uint8_t swPin = E6; // SW
|
||||
|
||||
// Set Parameters
|
||||
uint16_t minAxisValue = 0;
|
||||
uint16_t maxAxisValue = 1023;
|
||||
|
||||
uint8_t maxCursorSpeed = 2;
|
||||
uint8_t precisionSpeed = 1;
|
||||
uint8_t speedRegulator = 20; // Lower Values Create Faster Movement
|
||||
|
||||
int8_t xPolarity = 1;
|
||||
int8_t yPolarity = 1;
|
||||
|
||||
uint8_t cursorTimeout = 10;
|
||||
|
||||
int16_t xOrigin, yOrigin;
|
||||
|
||||
uint16_t lastCursor = 0;
|
||||
|
||||
int16_t axisCoordinate(uint8_t pin, uint16_t origin) {
|
||||
int8_t direction;
|
||||
int16_t distanceFromOrigin;
|
||||
int16_t range;
|
||||
|
||||
int16_t position = analogReadPin(pin);
|
||||
|
||||
if (origin == position) {
|
||||
return 0;
|
||||
} else if (origin > position) {
|
||||
distanceFromOrigin = origin - position;
|
||||
range = origin - minAxisValue;
|
||||
direction = -1;
|
||||
} else {
|
||||
distanceFromOrigin = position - origin;
|
||||
range = maxAxisValue - origin;
|
||||
direction = 1;
|
||||
}
|
||||
|
||||
float percent = (float)distanceFromOrigin / range;
|
||||
int16_t coordinate = (int16_t)(percent * 100);
|
||||
if (coordinate < 0) {
|
||||
return 0;
|
||||
} else if (coordinate > 100) {
|
||||
return 100 * direction;
|
||||
} else {
|
||||
return coordinate * direction;
|
||||
}
|
||||
}
|
||||
|
||||
int8_t axisToMouseComponent(uint8_t pin, int16_t origin, uint8_t maxSpeed, int8_t polarity) {
|
||||
int coordinate = axisCoordinate(pin, origin);
|
||||
if (coordinate != 0) {
|
||||
float percent = (float)coordinate / 100;
|
||||
if (get_mods() & MOD_BIT(KC_LSFT)) {
|
||||
return percent * precisionSpeed * polarity * (abs(coordinate) / speedRegulator);
|
||||
} else {
|
||||
return percent * maxCursorSpeed * polarity * (abs(coordinate) / speedRegulator);
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void pointing_device_task(void) {
|
||||
report_mouse_t report = pointing_device_get_report();
|
||||
|
||||
// todo read as one vector
|
||||
if (timer_elapsed(lastCursor) > cursorTimeout) {
|
||||
lastCursor = timer_read();
|
||||
report.x = axisToMouseComponent(B4, xOrigin, maxCursorSpeed, xPolarity);
|
||||
report.y = axisToMouseComponent(B5, yOrigin, maxCursorSpeed, yPolarity);
|
||||
}
|
||||
//
|
||||
if (!readPin(E6)) {
|
||||
report.buttons |= MOUSE_BTN1;
|
||||
} else {
|
||||
report.buttons &= ~MOUSE_BTN1;
|
||||
}
|
||||
|
||||
pointing_device_set_report(report);
|
||||
pointing_device_send();
|
||||
}
|
||||
|
||||
void matrix_init_keymap(void) {
|
||||
// init pin? Is needed?
|
||||
setPinInputHigh(E6);
|
||||
// Account for drift
|
||||
xOrigin = analogReadPin(B4);
|
||||
yOrigin = analogReadPin(B5);
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
RGBLIGHT_ENABLE = no
|
||||
CONSOLE_ENABLE = no
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
POINTING_DEVICE_DRIVER = analog_joystick
|
||||
RGBLIGHT_ENABLE = no
|
||||
CONSOLE_ENABLE = no
|
||||
|
||||
BOOTLOADER = qmk-dfu
|
||||
|
||||
SRC += analog.c
|
||||
BOOTLOADER = qmk-dfu
|
||||
|
@@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
#define ROTATIONAL_TRANSFORM_ANGLE -25
|
||||
#define POINTING_DEVICE_INVERT_X
|
||||
|
||||
/* Bootmagic Lite key configuration */
|
||||
#define BOOTMAGIC_LITE_ROW 0
|
||||
|
@@ -174,7 +174,11 @@ bool tap_toggling = false;
|
||||
# define TAP_CHECK TAPPING_TERM
|
||||
# endif
|
||||
|
||||
void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y) {
|
||||
report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) {
|
||||
int8_t x = mouse_report.x, y = mouse_report.y;
|
||||
mouse_report.x = 0;
|
||||
mouse_report.y = 0;
|
||||
|
||||
if (x != 0 && y != 0) {
|
||||
mouse_timer = timer_read();
|
||||
# ifdef OLED_ENABLE
|
||||
@@ -185,13 +189,14 @@ void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y) {
|
||||
x = (x > 0 ? x * x / 16 + x : -x * x / 16 + x);
|
||||
y = (y > 0 ? y * y / 16 + y : -y * y / 16 + y);
|
||||
}
|
||||
mouse_report->x = x;
|
||||
mouse_report->y = y;
|
||||
mouse_report.x = x;
|
||||
mouse_report.y = y;
|
||||
if (!layer_state_is(_MOUSE)) {
|
||||
layer_on(_MOUSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mouse_report;
|
||||
}
|
||||
|
||||
void matrix_scan_keymap(void) {
|
||||
|
@@ -16,11 +16,11 @@ AUDIO_ENABLE = no # Audio output
|
||||
SWAP_HANDS_ENABLE = yes
|
||||
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
POINTING_DEVICE_DRIVER = pmw3360
|
||||
MOUSE_SHARED_EP = no
|
||||
|
||||
SPLIT_KEYBOARD = yes
|
||||
|
||||
SRC += drivers/sensors/pmw3360.c
|
||||
QUANTUM_LIB_SRC += spi_master.c tm_sync.c
|
||||
QUANTUM_LIB_SRC += tm_sync.c
|
||||
|
||||
DEFAULT_FOLDER = handwired/tractyl_manuform/5x6_right/teensy2pp
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include "tractyl_manuform.h"
|
||||
#include "transactions.h"
|
||||
#include <string.h>
|
||||
#include "drivers/sensors/pmw3360.h"
|
||||
|
||||
kb_config_data_t kb_config;
|
||||
kb_mouse_report_t sync_mouse_report;
|
||||
@@ -82,6 +81,6 @@ void housekeeping_task_sync(void) {
|
||||
void trackball_set_cpi(uint16_t cpi) {
|
||||
kb_config.device_cpi = cpi;
|
||||
if (!is_keyboard_left()) {
|
||||
pmw_set_cpi(cpi);
|
||||
pointing_device_set_cpi(cpi);
|
||||
}
|
||||
}
|
||||
|
@@ -34,55 +34,7 @@ keyboard_config_t keyboard_config;
|
||||
uint16_t dpi_array[] = TRACKBALL_DPI_OPTIONS;
|
||||
#define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t))
|
||||
|
||||
bool BurstState = false; // init burst state for Trackball module
|
||||
uint16_t MotionStart = 0; // Timer for accel, 0 is resting state
|
||||
|
||||
__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y) {
|
||||
mouse_report->x = x;
|
||||
mouse_report->y = y;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void process_mouse(void) {
|
||||
report_pmw_t data = pmw_read_burst();
|
||||
// Reset timer if stopped moving
|
||||
if (!data.isMotion) {
|
||||
if (MotionStart != 0) MotionStart = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.isOnSurface) {
|
||||
// Set timer if new motion
|
||||
if (MotionStart == 0) {
|
||||
if (debug_mouse) dprintf("Starting motion.\n");
|
||||
MotionStart = timer_read();
|
||||
}
|
||||
|
||||
if (debug_mouse) {
|
||||
dprintf("Delt] d: %d t: %u\n", abs(data.dx) + abs(data.dy), MotionStart);
|
||||
}
|
||||
if (debug_mouse) {
|
||||
dprintf("Pre ] X: %d, Y: %d\n", data.dx, data.dy);
|
||||
}
|
||||
#if defined(PROFILE_LINEAR)
|
||||
float scale = float(timer_elaspsed(MotionStart)) / 1000.0;
|
||||
data.dx *= scale;
|
||||
data.dy *= scale;
|
||||
#elif defined(PROFILE_INVERSE)
|
||||
// TODO
|
||||
#else
|
||||
// no post processing
|
||||
#endif
|
||||
|
||||
// Wrap to HID size
|
||||
data.dx = constrain(data.dx, -127, 127);
|
||||
data.dy = constrain(data.dy, -127, 127);
|
||||
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));
|
||||
|
||||
sync_mouse_report.x = -data.dx;
|
||||
sync_mouse_report.y = data.dy;
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
if (!process_record_user(keycode, record)) {
|
||||
@@ -109,11 +61,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
#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));
|
||||
}
|
||||
currentReport.buttons = pointing_device_handle_buttons(currentReport.buttons, record->event.pressed, keycode - KC_MS_BTN1);
|
||||
pointing_device_set_report(currentReport);
|
||||
pointing_device_send();
|
||||
}
|
||||
@@ -145,33 +93,28 @@ void keyboard_post_init_kb(void) {
|
||||
}
|
||||
|
||||
#ifdef POINTING_DEVICE_ENABLE
|
||||
void pointing_device_init(void) {
|
||||
if (!is_keyboard_left()) {
|
||||
// initialize ball sensor
|
||||
pmw_spi_init();
|
||||
}
|
||||
void pointing_device_init_kb(void) {
|
||||
trackball_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
pointing_device_init_user();
|
||||
}
|
||||
|
||||
void pointing_device_task(void) {
|
||||
report_mouse_t mouse_report = pointing_device_get_report();
|
||||
|
||||
report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
|
||||
if (is_keyboard_left()) {
|
||||
if (is_keyboard_master()) {
|
||||
transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(sync_mouse_report), &sync_mouse_report);
|
||||
process_mouse_user(&mouse_report, sync_mouse_report.x, sync_mouse_report.y);
|
||||
mouse_report.x = sync_mouse_report.x;
|
||||
mouse_report.y = sync_mouse_report.y;
|
||||
pointing_device_task_user(mouse_report);
|
||||
}
|
||||
} else {
|
||||
process_mouse();
|
||||
if (is_keyboard_master()) {
|
||||
process_mouse_user(&mouse_report, sync_mouse_report.x, sync_mouse_report.y);
|
||||
sync_mouse_report.x = 0;
|
||||
sync_mouse_report.y = 0;
|
||||
pointing_device_task_user(mouse_report);
|
||||
} else {
|
||||
sync_mouse_report.x = mouse_report.x;
|
||||
sync_mouse_report.y = mouse_report.y;
|
||||
}
|
||||
}
|
||||
|
||||
pointing_device_set_report(mouse_report);
|
||||
pointing_device_send();
|
||||
return mouse_report;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -58,3 +58,6 @@
|
||||
/* Bootmagic Lite key configuration */
|
||||
// #define BOOTMAGIC_LITE_ROW 0
|
||||
// #define BOOTMAGIC_LITE_COLUMN 0
|
||||
|
||||
#define ADNS9800_CS_PIN SPI_SS_PIN
|
||||
#define PMW3360_CS_PIN SPI_SS_PIN
|
||||
|
@@ -1 +0,0 @@
|
||||
#define ADNS_9800
|
1
keyboards/oddball/keymaps/default/rules.mk
Normal file
1
keyboards/oddball/keymaps/default/rules.mk
Normal file
@@ -0,0 +1 @@
|
||||
POINTING_DEVICE_DRIVER = adns9800
|
@@ -1 +0,0 @@
|
||||
#define PMW_3360
|
1
keyboards/oddball/keymaps/pmw3360/rules.mk
Normal file
1
keyboards/oddball/keymaps/pmw3360/rules.mk
Normal file
@@ -0,0 +1 @@
|
||||
POINTING_DEVICE_DRIVER = pmw3360
|
@@ -16,21 +16,17 @@
|
||||
|
||||
#include "oddball.h"
|
||||
#include "pointing_device.h"
|
||||
#include "optical_sensor/optical_sensor.h"
|
||||
|
||||
#define CLAMP_HID(value) value < -127 ? -127 : value > 127 ? 127 : value
|
||||
extern const pointing_device_driver_t pointing_device_driver;
|
||||
|
||||
static bool scroll_pressed;
|
||||
static bool mouse_buttons_dirty;
|
||||
static int8_t scroll_h;
|
||||
static int8_t scroll_v;
|
||||
|
||||
void pointing_device_init(void){
|
||||
void pointing_device_init_kb(void){
|
||||
if(!is_keyboard_master())
|
||||
return;
|
||||
|
||||
optical_sensor_init();
|
||||
|
||||
// read config from EEPROM and update if needed
|
||||
|
||||
config_oddball_t kb_config;
|
||||
@@ -41,21 +37,17 @@ void pointing_device_init(void){
|
||||
eeconfig_update_kb(kb_config.raw);
|
||||
}
|
||||
|
||||
optical_sensor_set_config((config_optical_sensor_t){ kb_config.cpi });
|
||||
pointing_device_set_cpi(kb_config.cpi);
|
||||
}
|
||||
|
||||
void pointing_device_task(void){
|
||||
if(!is_keyboard_master())
|
||||
return;
|
||||
report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
|
||||
if (!is_keyboard_master()) return mouse_report;
|
||||
|
||||
report_mouse_t mouse_report = pointing_device_get_report();
|
||||
report_optical_sensor_t sensor_report = optical_sensor_get_report();
|
||||
|
||||
int8_t clamped_x = CLAMP_HID(sensor_report.x);
|
||||
int8_t clamped_y = CLAMP_HID(sensor_report.y);
|
||||
|
||||
if(scroll_pressed) {
|
||||
int8_t clamped_x = mouse_report.x, clamped_y = mouse_report.y;
|
||||
mouse_report.x = 0;
|
||||
mouse_report.y = 0;
|
||||
|
||||
if (scroll_pressed) {
|
||||
// accumulate scroll
|
||||
scroll_h += clamped_x;
|
||||
scroll_v += clamped_y;
|
||||
@@ -65,33 +57,21 @@ void pointing_device_task(void){
|
||||
|
||||
// clear accumulated scroll on assignment
|
||||
|
||||
if(scaled_scroll_h != 0){
|
||||
if (scaled_scroll_h != 0) {
|
||||
mouse_report.h = -scaled_scroll_h;
|
||||
scroll_h = 0;
|
||||
scroll_h = 0;
|
||||
}
|
||||
|
||||
if(scaled_scroll_v != 0){
|
||||
if (scaled_scroll_v != 0) {
|
||||
mouse_report.v = -scaled_scroll_v;
|
||||
scroll_v = 0;
|
||||
scroll_v = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
mouse_report.x = -clamped_x;
|
||||
mouse_report.y = clamped_y;
|
||||
}
|
||||
|
||||
pointing_device_set_report(mouse_report);
|
||||
|
||||
// only send report on change as even sending report with no change is treated as movement
|
||||
if(mouse_buttons_dirty ||
|
||||
mouse_report.x != 0 ||
|
||||
mouse_report.y != 0 ||
|
||||
mouse_report.h != 0 ||
|
||||
mouse_report.v != 0){
|
||||
|
||||
mouse_buttons_dirty = false;
|
||||
pointing_device_send();
|
||||
}
|
||||
return mouse_report;
|
||||
}
|
||||
|
||||
static void on_cpi_button(uint16_t cpi, keyrecord_t *record) {
|
||||
@@ -99,7 +79,7 @@ static void on_cpi_button(uint16_t cpi, keyrecord_t *record) {
|
||||
if(!record->event.pressed)
|
||||
return;
|
||||
|
||||
optical_sensor_set_config((config_optical_sensor_t){ cpi });
|
||||
pointing_device_set_cpi(cpi);
|
||||
|
||||
config_oddball_t kb_config;
|
||||
kb_config.cpi = cpi;
|
||||
@@ -165,5 +145,5 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,53 +0,0 @@
|
||||
/* Copyright 2020 Alexander Tulloh
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* common interface for opitcal sensors */
|
||||
|
||||
#if defined ADNS_9800
|
||||
#include "drivers/sensors/adns9800.h"
|
||||
#define config_optical_sensor_t config_adns_t
|
||||
#define report_optical_sensor_t report_adns_t
|
||||
#define optical_sensor_init adns_init
|
||||
#define optical_sensor_get_config adns_get_config
|
||||
#define optical_sensor_set_config adns_set_config
|
||||
#define optical_sensor_get_report adns_get_report
|
||||
#elif defined PMW_3360
|
||||
#include "../pmw/pmw.h"
|
||||
#define config_optical_sensor_t config_pmw_t
|
||||
#define report_optical_sensor_t report_pmw_t
|
||||
#define optical_sensor_init pmw_init
|
||||
#define optical_sensor_get_config pmw_get_config
|
||||
#define optical_sensor_set_config pmw_set_config
|
||||
#define optical_sensor_get_report pmw_get_report
|
||||
#else
|
||||
/* fallback stub */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct {
|
||||
uint16_t cpi;
|
||||
} config_optical_sensor_t;
|
||||
|
||||
typedef struct {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
} report_optical_sensor_t;
|
||||
|
||||
#define optical_sensor_init(){ }
|
||||
#define optical_sensor_get_config() (config_optical_sensor_t){ }
|
||||
#define optical_sensor_set_config(config_optical_sensor_t){ }
|
||||
#define optical_sensor_get_report() (report_optical_sensor_t){ }
|
||||
#endif
|
@@ -1,226 +0,0 @@
|
||||
/* Copyright 2020 Alexander Tulloh
|
||||
*
|
||||
* 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 "spi_master.h"
|
||||
#include "quantum.h"
|
||||
#include "pmw3360_srom_0x04.h"
|
||||
#include "pmw.h"
|
||||
|
||||
// registers
|
||||
#define Product_ID 0x00
|
||||
#define Revision_ID 0x01
|
||||
#define Motion 0x02
|
||||
#define Delta_X_L 0x03
|
||||
#define Delta_X_H 0x04
|
||||
#define Delta_Y_L 0x05
|
||||
#define Delta_Y_H 0x06
|
||||
#define SQUAL 0x07
|
||||
#define Raw_Data_Sum 0x08
|
||||
#define Maximum_Raw_data 0x09
|
||||
#define Minimum_Raw_data 0x0A
|
||||
#define Shutter_Lower 0x0B
|
||||
#define Shutter_Upper 0x0C
|
||||
#define Control 0x0D
|
||||
#define Config1 0x0F
|
||||
#define Config2 0x10
|
||||
#define Angle_Tune 0x11
|
||||
#define Frame_Capture 0x12
|
||||
#define SROM_Enable 0x13
|
||||
#define Run_Downshift 0x14
|
||||
#define Rest1_Rate_Lower 0x15
|
||||
#define Rest1_Rate_Upper 0x16
|
||||
#define Rest1_Downshift 0x17
|
||||
#define Rest2_Rate_Lower 0x18
|
||||
#define Rest2_Rate_Upper 0x19
|
||||
#define Rest2_Downshift 0x1A
|
||||
#define Rest3_Rate_Lower 0x1B
|
||||
#define Rest3_Rate_Upper 0x1C
|
||||
#define Observation 0x24
|
||||
#define Data_Out_Lower 0x25
|
||||
#define Data_Out_Upper 0x26
|
||||
#define Raw_Data_Dump 0x29
|
||||
#define SROM_ID 0x2A
|
||||
#define Min_SQ_Run 0x2B
|
||||
#define Raw_Data_Threshold 0x2C
|
||||
#define Config5 0x2F
|
||||
#define Power_Up_Reset 0x3A
|
||||
#define Shutdown 0x3B
|
||||
#define Inverse_Product_ID 0x3F
|
||||
#define LiftCutoff_Tune3 0x41
|
||||
#define Angle_Snap 0x42
|
||||
#define LiftCutoff_Tune1 0x4A
|
||||
#define Motion_Burst 0x50
|
||||
#define LiftCutoff_Tune_Timeout 0x58
|
||||
#define LiftCutoff_Tune_Min_Length 0x5A
|
||||
#define SROM_Load_Burst 0x62
|
||||
#define Lift_Config 0x63
|
||||
#define Raw_Data_Burst 0x64
|
||||
#define LiftCutoff_Tune2 0x65
|
||||
|
||||
#define PMW_CLOCK_SPEED 70000000
|
||||
#define MIN_CPI 100
|
||||
#define MAX_CPI 12000
|
||||
#define CPI_STEP 100
|
||||
#define CLAMP_CPI(value) value < MIN_CPI ? MIN_CPI : value > MAX_CPI ? MAX_CPI : value
|
||||
#define SPI_MODE 3
|
||||
#define SPI_DIVISOR (F_CPU / PMW_CLOCK_SPEED)
|
||||
#define US_BETWEEN_WRITES 180
|
||||
#define US_BETWEEN_READS 20
|
||||
#define US_BEFORE_MOTION 35
|
||||
|
||||
#define MSB1 0x80
|
||||
|
||||
extern const uint16_t pmw_firmware_length;
|
||||
extern const uint8_t pmw_firmware_data[];
|
||||
|
||||
void pmw_spi_start(void){
|
||||
spi_start(SPI_SS_PIN, false, SPI_MODE, SPI_DIVISOR);
|
||||
}
|
||||
|
||||
void pmw_write(uint8_t reg_addr, uint8_t data){
|
||||
|
||||
pmw_spi_start();
|
||||
spi_write(reg_addr | MSB1 );
|
||||
spi_write(data);
|
||||
spi_stop();
|
||||
wait_us(US_BETWEEN_WRITES);
|
||||
}
|
||||
|
||||
uint8_t pmw_read(uint8_t reg_addr){
|
||||
|
||||
pmw_spi_start();
|
||||
spi_write(reg_addr & 0x7f );
|
||||
uint8_t data = spi_read();
|
||||
spi_stop();
|
||||
wait_us(US_BETWEEN_READS);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void pmw_init() {
|
||||
|
||||
setPinOutput(SPI_SS_PIN);
|
||||
|
||||
spi_init();
|
||||
|
||||
// reboot
|
||||
pmw_write(Power_Up_Reset, 0x5a);
|
||||
wait_ms(50);
|
||||
|
||||
// read registers and discard
|
||||
pmw_read(Motion);
|
||||
pmw_read(Delta_X_L);
|
||||
pmw_read(Delta_X_H);
|
||||
pmw_read(Delta_Y_L);
|
||||
pmw_read(Delta_Y_H);
|
||||
|
||||
// upload firmware
|
||||
|
||||
// disable rest mode
|
||||
pmw_write(Config2, 0x20);
|
||||
|
||||
// enable initialisation
|
||||
pmw_write(SROM_Enable, 0x1d);
|
||||
|
||||
// wait a frame
|
||||
wait_ms(10);
|
||||
|
||||
// start SROM download
|
||||
pmw_write(SROM_Enable, 0x18);
|
||||
|
||||
// write the SROM file
|
||||
|
||||
pmw_spi_start();
|
||||
|
||||
spi_write(SROM_Load_Burst | 0x80);
|
||||
wait_us(15);
|
||||
|
||||
// send all bytes of the firmware
|
||||
unsigned char c;
|
||||
for(int i = 0; i < pmw_firmware_length; i++){
|
||||
c = (unsigned char)pgm_read_byte(pmw_firmware_data + i);
|
||||
spi_write(c);
|
||||
wait_us(15);
|
||||
}
|
||||
|
||||
spi_stop();
|
||||
wait_us(US_BETWEEN_WRITES);
|
||||
|
||||
// read id
|
||||
pmw_read(SROM_ID);
|
||||
|
||||
// wired mouse
|
||||
pmw_write(Config2, 0x00);
|
||||
|
||||
// first motion burst; write anything
|
||||
pmw_write(Motion_Burst, 0xFF);
|
||||
writePinLow(SPI_SS_PIN);
|
||||
}
|
||||
|
||||
config_pmw_t pmw_get_config(void) {
|
||||
uint8_t config_1 = pmw_read(Config1);
|
||||
return (config_pmw_t){ (config_1 & 0xFF) * CPI_STEP };
|
||||
}
|
||||
|
||||
void pmw_set_config(config_pmw_t config) {
|
||||
uint8_t config_1 = (CLAMP_CPI(config.cpi) / CPI_STEP) & 0xFF;
|
||||
pmw_write(Config1, config_1);
|
||||
}
|
||||
|
||||
static int16_t convertDeltaToInt(uint8_t high, uint8_t low){
|
||||
|
||||
// join bytes into twos compliment
|
||||
uint16_t twos_comp = (high << 8) | low;
|
||||
|
||||
// convert twos comp to int
|
||||
if (twos_comp & 0x8000)
|
||||
return -1 * (~twos_comp + 1);
|
||||
|
||||
return twos_comp;
|
||||
}
|
||||
|
||||
report_pmw_t pmw_get_report(void) {
|
||||
|
||||
report_pmw_t report = {0, 0};
|
||||
|
||||
pmw_spi_start();
|
||||
|
||||
// start burst mode
|
||||
spi_write(Motion_Burst & 0x7f);
|
||||
|
||||
wait_us(US_BEFORE_MOTION);
|
||||
|
||||
uint8_t motion = spi_read();
|
||||
|
||||
if(motion & 0x80) {
|
||||
|
||||
// clear observation register
|
||||
spi_read();
|
||||
|
||||
// delta registers
|
||||
uint8_t delta_x_l = spi_read();
|
||||
uint8_t delta_x_h = spi_read();
|
||||
uint8_t delta_y_l = spi_read();
|
||||
uint8_t delta_y_h = spi_read();
|
||||
|
||||
report.x = convertDeltaToInt(delta_x_h, delta_x_l);
|
||||
report.y = convertDeltaToInt(delta_y_h, delta_y_l);
|
||||
}
|
||||
|
||||
spi_stop();
|
||||
|
||||
return report;
|
||||
}
|
@@ -1,280 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "progmem.h"
|
||||
|
||||
const uint16_t pmw_firmware_length = 4094;
|
||||
|
||||
const uint8_t pmw_firmware_data[] PROGMEM = {
|
||||
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, 0xe6, 0x20, 0xd5, 0x27, 0x17, 0xc5, 0xf8, 0x03, 0x23, 0x7c,
|
||||
0x5f, 0x64, 0xa5, 0x1d, 0xc1, 0xd6, 0x36, 0xcb, 0x4c, 0xd4, 0xdb, 0x66, 0xd7, 0x8b, 0xb1,
|
||||
0x99, 0x7e, 0x6f, 0x4c, 0x36, 0x40, 0x06, 0xd6, 0xeb, 0xd7, 0xa2, 0xe4, 0xf4, 0x95, 0x51,
|
||||
0x5a, 0x54, 0x96, 0xd5, 0x53, 0x44, 0xd7, 0x8c, 0xe0, 0xb9, 0x40, 0x68, 0xd2, 0x18, 0xe9,
|
||||
0xdd, 0x9a, 0x23, 0x92, 0x48, 0xee, 0x7f, 0x43, 0xaf, 0xea, 0x77, 0x38, 0x84, 0x8c, 0x0a,
|
||||
0x72, 0xaf, 0x69, 0xf8, 0xdd, 0xf1, 0x24, 0x83, 0xa3, 0xf8, 0x4a, 0xbf, 0xf5, 0x94, 0x13,
|
||||
0xdb, 0xbb, 0xd8, 0xb4, 0xb3, 0xa0, 0xfb, 0x45, 0x50, 0x60, 0x30, 0x59, 0x12, 0x31, 0x71,
|
||||
0xa2, 0xd3, 0x13, 0xe7, 0xfa, 0xe7, 0xce, 0x0f, 0x63, 0x15, 0x0b, 0x6b, 0x94, 0xbb, 0x37,
|
||||
0x83, 0x26, 0x05, 0x9d, 0xfb, 0x46, 0x92, 0xfc, 0x0a, 0x15, 0xd1, 0x0d, 0x73, 0x92, 0xd6,
|
||||
0x8c, 0x1b, 0x8c, 0xb8, 0x55, 0x8a, 0xce, 0xbd, 0xfe, 0x8e, 0xfc, 0xed, 0x09, 0x12, 0x83,
|
||||
0x91, 0x82, 0x51, 0x31, 0x23, 0xfb, 0xb4, 0x0c, 0x76, 0xad, 0x7c, 0xd9, 0xb4, 0x4b, 0xb2,
|
||||
0x67, 0x14, 0x09, 0x9c, 0x7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, 0xe2,
|
||||
0xf0, 0x08, 0x99, 0xfc, 0x70, 0xee, 0x24, 0xa7, 0x7e, 0xee, 0x1e, 0x20, 0x69, 0x7d, 0x44,
|
||||
0xbf, 0x87, 0x42, 0xdf, 0x88, 0x3b, 0x0c, 0xda, 0x42, 0xc9, 0x04, 0xf9, 0x45, 0x50, 0xfc,
|
||||
0x83, 0x8f, 0x11, 0x6a, 0x72, 0xbc, 0x99, 0x95, 0xf0, 0xac, 0x3d, 0xa7, 0x3b, 0xcd, 0x1c,
|
||||
0xe2, 0x88, 0x79, 0x37, 0x11, 0x5f, 0x39, 0x89, 0x95, 0x0a, 0x16, 0x84, 0x7a, 0xf6, 0x8a,
|
||||
0xa4, 0x28, 0xe4, 0xed, 0x83, 0x80, 0x3b, 0xb1, 0x23, 0xa5, 0x03, 0x10, 0xf4, 0x66, 0xea,
|
||||
0xbb, 0x0c, 0x0f, 0xc5, 0xec, 0x6c, 0x69, 0xc5, 0xd3, 0x24, 0xab, 0xd4, 0x2a, 0xb7, 0x99,
|
||||
0x88, 0x76, 0x08, 0xa0, 0xa8, 0x95, 0x7c, 0xd8, 0x38, 0x6d, 0xcd, 0x59, 0x02, 0x51, 0x4b,
|
||||
0xf1, 0xb5, 0x2b, 0x50, 0xe3, 0xb6, 0xbd, 0xd0, 0x72, 0xcf, 0x9e, 0xfd, 0x6e, 0xbb, 0x44,
|
||||
0xc8, 0x24, 0x8a, 0x77, 0x18, 0x8a, 0x13, 0x06, 0xef, 0x97, 0x7d, 0xfa, 0x81, 0xf0, 0x31,
|
||||
0xe6, 0xfa, 0x77, 0xed, 0x31, 0x06, 0x31, 0x5b, 0x54, 0x8a, 0x9f, 0x30, 0x68, 0xdb, 0xe2,
|
||||
0x40, 0xf8, 0x4e, 0x73, 0xfa, 0xab, 0x74, 0x8b, 0x10, 0x58, 0x13, 0xdc, 0xd2, 0xe6, 0x78,
|
||||
0xd1, 0x32, 0x2e, 0x8a, 0x9f, 0x2c, 0x58, 0x06, 0x48, 0x27, 0xc5, 0xa9, 0x5e, 0x81, 0x47,
|
||||
0x89, 0x46, 0x21, 0x91, 0x03, 0x70, 0xa4, 0x3e, 0x88, 0x9c, 0xda, 0x33, 0x0a, 0xce, 0xbc,
|
||||
0x8b, 0x8e, 0xcf, 0x9f, 0xd3, 0x71, 0x80, 0x43, 0xcf, 0x6b, 0xa9, 0x51, 0x83, 0x76, 0x30,
|
||||
0x82, 0xc5, 0x6a, 0x85, 0x39, 0x11, 0x50, 0x1a, 0x82, 0xdc, 0x1e, 0x1c, 0xd5, 0x7d, 0xa9,
|
||||
0x71, 0x99, 0x33, 0x47, 0x19, 0x97, 0xb3, 0x5a, 0xb1, 0xdf, 0xed, 0xa4, 0xf2, 0xe6, 0x26,
|
||||
0x84, 0xa2, 0x28, 0x9a, 0x9e, 0xdf, 0xa6, 0x6a, 0xf4, 0xd6, 0xfc, 0x2e, 0x5b, 0x9d, 0x1a,
|
||||
0x2a, 0x27, 0x68, 0xfb, 0xc1, 0x83, 0x21, 0x4b, 0x90, 0xe0, 0x36, 0xdd, 0x5b, 0x31, 0x42,
|
||||
0x55, 0xa0, 0x13, 0xf7, 0xd0, 0x89, 0x53, 0x71, 0x99, 0x57, 0x09, 0x29, 0xc5, 0xf3, 0x21,
|
||||
0xf8, 0x37, 0x2f, 0x40, 0xf3, 0xd4, 0xaf, 0x16, 0x08, 0x36, 0x02, 0xfc, 0x77, 0xc5, 0x8b,
|
||||
0x04, 0x90, 0x56, 0xb9, 0xc9, 0x67, 0x9a, 0x99, 0xe8, 0x00, 0xd3, 0x86, 0xff, 0x97, 0x2d,
|
||||
0x08, 0xe9, 0xb7, 0xb3, 0x91, 0xbc, 0xdf, 0x45, 0xc6, 0xed, 0x0f, 0x8c, 0x4c, 0x1e, 0xe6,
|
||||
0x5b, 0x6e, 0x38, 0x30, 0xe4, 0xaa, 0xe3, 0x95, 0xde, 0xb9, 0xe4, 0x9a, 0xf5, 0xb2, 0x55,
|
||||
0x9a, 0x87, 0x9b, 0xf6, 0x6a, 0xb2, 0xf2, 0x77, 0x9a, 0x31, 0xf4, 0x7a, 0x31, 0xd1, 0x1d,
|
||||
0x04, 0xc0, 0x7c, 0x32, 0xa2, 0x9e, 0x9a, 0xf5, 0x62, 0xf8, 0x27, 0x8d, 0xbf, 0x51, 0xff,
|
||||
0xd3, 0xdf, 0x64, 0x37, 0x3f, 0x2a, 0x6f, 0x76, 0x3a, 0x7d, 0x77, 0x06, 0x9e, 0x77, 0x7f,
|
||||
0x5e, 0xeb, 0x32, 0x51, 0xf9, 0x16, 0x66, 0x9a, 0x09, 0xf3, 0xb0, 0x08, 0xa4, 0x70, 0x96,
|
||||
0x46, 0x30, 0xff, 0xda, 0x4f, 0xe9, 0x1b, 0xed, 0x8d, 0xf8, 0x74, 0x1f, 0x31, 0x92, 0xb3,
|
||||
0x73, 0x17, 0x36, 0xdb, 0x91, 0x30, 0xd6, 0x88, 0x55, 0x6b, 0x34, 0x77, 0x87, 0x7a, 0xe7,
|
||||
0xee, 0x06, 0xc6, 0x1c, 0x8c, 0x19, 0x0c, 0x48, 0x46, 0x23, 0x5e, 0x9c, 0x07, 0x5c, 0xbf,
|
||||
0xb4, 0x7e, 0xd6, 0x4f, 0x74, 0x9c, 0xe2, 0xc5, 0x50, 0x8b, 0xc5, 0x8b, 0x15, 0x90, 0x60,
|
||||
0x62, 0x57, 0x29, 0xd0, 0x13, 0x43, 0xa1, 0x80, 0x88, 0x91, 0x00, 0x44, 0xc7, 0x4d, 0x19,
|
||||
0x86, 0xcc, 0x2f, 0x2a, 0x75, 0x5a, 0xfc, 0xeb, 0x97, 0x2a, 0x70, 0xe3, 0x78, 0xd8, 0x91,
|
||||
0xb0, 0x4f, 0x99, 0x07, 0xa3, 0x95, 0xea, 0x24, 0x21, 0xd5, 0xde, 0x51, 0x20, 0x93, 0x27,
|
||||
0x0a, 0x30, 0x73, 0xa8, 0xff, 0x8a, 0x97, 0xe9, 0xa7, 0x6a, 0x8e, 0x0d, 0xe8, 0x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 0x07, 0x74, 0x1e, 0xe4, 0xd0, 0x80, 0x21, 0xd6,
|
||||
0xee, 0x6b, 0x6c, 0x4f, 0xbf, 0xf5, 0xb7, 0xd9, 0x09, 0x87, 0x2f, 0xa9, 0x14, 0xbe, 0x27,
|
||||
0xd9, 0x72, 0x50, 0x01, 0xd4, 0x13, 0x73, 0xa6, 0xa7, 0x51, 0x02, 0x75, 0x25, 0xe1, 0xb3,
|
||||
0x45, 0x34, 0x7d, 0xa8, 0x8e, 0xeb, 0xf3, 0x16, 0x49, 0xcb, 0x4f, 0x8c, 0xa1, 0xb9, 0x36,
|
||||
0x85, 0x39, 0x75, 0x5d, 0x08, 0x00, 0xae, 0xeb, 0xf6, 0xea, 0xd7, 0x13, 0x3a, 0x21, 0x5a,
|
||||
0x5f, 0x30, 0x84, 0x52, 0x26, 0x95, 0xc9, 0x14, 0xf2, 0x57, 0x55, 0x6b, 0xb1, 0x10, 0xc2,
|
||||
0xe1, 0xbd, 0x3b, 0x51, 0xc0, 0xb7, 0x55, 0x4c, 0x71, 0x12, 0x26, 0xc7, 0x0d, 0xf9, 0x51,
|
||||
0xa4, 0x38, 0x02, 0x05, 0x7f, 0xb8, 0xf1, 0x72, 0x4b, 0xbf, 0x71, 0x89, 0x14, 0xf3, 0x77,
|
||||
0x38, 0xd9, 0x71, 0x24, 0xf3, 0x00, 0x11, 0xa1, 0xd8, 0xd4, 0x69, 0x27, 0x08, 0x37, 0x35,
|
||||
0xc9, 0x11, 0x9d, 0x90, 0x1c, 0x0e, 0xe7, 0x1c, 0xff, 0x2d, 0x1e, 0xe8, 0x92, 0xe1, 0x18,
|
||||
0x10, 0x95, 0x7c, 0xe0, 0x80, 0xf4, 0x96, 0x43, 0x21, 0xf9, 0x75, 0x21, 0x64, 0x38, 0xdd,
|
||||
0x9f, 0x1e, 0x95, 0x16, 0xda, 0x56, 0x1d, 0x4f, 0x9a, 0x53, 0xb2, 0xe2, 0xe4, 0x18, 0xcb,
|
||||
0x6b, 0x1a,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, 0x92, 0x25, 0x8b, 0xbf,
|
||||
0xa2, 0x45, 0x55, 0x7a, 0xa7, 0x6f, 0x8b, 0x57, 0x5b, 0xcf, 0x0e, 0xcb, 0x1d, 0xfb, 0x20,
|
||||
0x82, 0x77, 0xa8, 0x8c, 0xcc, 0x16, 0xce, 0x1d, 0xfa, 0xde, 0xcc, 0x0b, 0x62, 0xfe, 0xcc,
|
||||
0xe1, 0xb7, 0xf0, 0xc3, 0x81, 0x64, 0x73, 0x40, 0xa0, 0xc2, 0x4d, 0x89, 0x11, 0x75, 0x33,
|
||||
0x55, 0x33, 0x8d, 0xe8, 0x4a, 0xfd, 0xea, 0x6e, 0x30, 0x0b, 0xd7, 0x31, 0x2c, 0xde, 0x47,
|
||||
0xe3, 0xbf, 0xf8, 0x55, 0x42, 0xe2, 0x7f, 0x59, 0xe5, 0x17, 0xef, 0x99, 0x34, 0x69, 0x91,
|
||||
0xb1, 0x23, 0x8e, 0x20, 0x87, 0x2d, 0xa8, 0xfe, 0xd5, 0x8a, 0xf3, 0x84, 0x3a, 0xf0, 0x37,
|
||||
0xe4, 0x09, 0x00, 0x54, 0xee, 0x67, 0x49, 0x93, 0xe4, 0x81, 0x70, 0xe3, 0x90, 0x4d, 0xef,
|
||||
0xfe, 0x41, 0xb7, 0x99, 0x7b, 0xc1, 0x83, 0xba, 0x62, 0x12, 0x6f, 0x7d, 0xde, 0x6b, 0xaf,
|
||||
0xda, 0x16, 0xf9, 0x55, 0x51, 0xee, 0xa6, 0x0c, 0x2b, 0x02, 0xa3, 0xfd, 0x8d, 0xfb, 0x30,
|
||||
0x17, 0xe4, 0x6f, 0xdf, 0x36, 0x71, 0xc4, 0xca, 0x87, 0x25, 0x48, 0xb0, 0x47, 0xec, 0xea,
|
||||
0xb4, 0xbf, 0xa5, 0x4d, 0x9b, 0x9f, 0x02, 0x93, 0xc4, 0xe3, 0xe4, 0xe8, 0x42, 0x2d, 0x68,
|
||||
0x81, 0x15, 0x0a, 0xeb, 0x84, 0x5b, 0xd6, 0xa8, 0x74, 0xfb, 0x7d, 0x1d, 0xcb, 0x2c, 0xda,
|
||||
0x46, 0x2a, 0x76, 0x62, 0xce, 0xbc, 0x5c, 0x9e, 0x8b, 0xe7, 0xcf, 0xbe, 0x78, 0xf5, 0x7c,
|
||||
0xeb, 0xb3, 0x3a, 0x9c, 0xaa, 0x6f, 0xcc, 0x72, 0xd1, 0x59, 0xf2, 0x11, 0x23, 0xd6, 0x3f,
|
||||
0x48, 0xd1, 0xb7, 0xce, 0xb0, 0xbf, 0xcb, 0xea, 0x80, 0xde, 0x57, 0xd4, 0x5e, 0x97, 0x2f,
|
||||
0x75, 0xd1, 0x50, 0x8e, 0x80, 0x2c, 0x66, 0x79, 0xbf, 0x72, 0x4b, 0xbd, 0x8a, 0x81, 0x6c,
|
||||
0xd3, 0xe1, 0x01, 0xdc, 0xd2, 0x15, 0x26, 0xc5, 0x36, 0xda, 0x2c, 0x1a, 0xc0, 0x27, 0x94,
|
||||
0xed, 0xb7, 0x9b, 0x85, 0x0b, 0x5e, 0x80, 0x97, 0xc5, 0xec, 0x4f, 0xec, 0x88, 0x5d, 0x50,
|
||||
0x07, 0x35, 0x47, 0xdc, 0x0b, 0x3b, 0x3d, 0xdd, 0x60, 0xaf, 0xa8, 0x5d, 0x81, 0x38, 0x24,
|
||||
0x25, 0x5d, 0x5c, 0x15, 0xd1, 0xde, 0xb3, 0xab, 0xec, 0x05, 0x69, 0xef, 0x83, 0xed, 0x57,
|
||||
0x54, 0xb8, 0x64, 0x64, 0x11, 0x16, 0x32, 0x69, 0xda, 0x9f, 0x2d, 0x7f, 0x36, 0xbb, 0x44,
|
||||
0x5a, 0x34, 0xe8, 0x7f, 0xbf, 0x03, 0xeb, 0x00, 0x7f, 0x59, 0x68, 0x22, 0x79, 0xcf, 0x73,
|
||||
0x6c, 0x2c, 0x29, 0xa7, 0xa1, 0x5f, 0x38, 0xa1, 0x1d, 0xf0, 0x20, 0x53, 0xe0, 0x1a, 0x63,
|
||||
0x14, 0x58, 0x71, 0x10, 0xaa, 0x08, 0x0c, 0x3e, 0x16, 0x1a, 0x60, 0x22, 0x82, 0x7f, 0xba,
|
||||
0xa4, 0x43, 0xa0, 0xd0, 0xac, 0x1b, 0xd5, 0x6b, 0x64, 0xb5, 0x14, 0x93, 0x31, 0x9e, 0x53,
|
||||
0x50, 0xd0, 0x57, 0x66, 0xee, 0x5a, 0x4f, 0xfb, 0x03, 0x2a, 0x69, 0x58, 0x76, 0xf1, 0x83,
|
||||
0xf7, 0x4e, 0xba, 0x8c, 0x42, 0x06, 0x60, 0x5d, 0x6d, 0xce, 0x60, 0x88, 0xae, 0xa4, 0xc3,
|
||||
0xf1, 0x03, 0xa5, 0x4b, 0x98, 0xa1, 0xff, 0x67, 0xe1, 0xac, 0xa2, 0xb8, 0x62, 0xd7, 0x6f,
|
||||
0xa0, 0x31, 0xb4, 0xd2, 0x77, 0xaf, 0x21, 0x10, 0x06, 0xc6, 0x9a, 0xff, 0x1d, 0x09, 0x17,
|
||||
0x0e, 0x5f, 0xf1, 0xaa, 0x54, 0x34, 0x4b, 0x45, 0x8a, 0x87, 0x63, 0xa6, 0xdc, 0xf9, 0x24,
|
||||
0x30, 0x67, 0xc6, 0xb2, 0xd6, 0x61, 0x33, 0x69, 0xee, 0x50, 0x61, 0x57, 0x28, 0xe7, 0x7e,
|
||||
0xee, 0xec, 0x3a, 0x5a, 0x73, 0x4e, 0xa8, 0x8d, 0xe4, 0x18, 0xea, 0xec, 0x41, 0x64, 0xc8,
|
||||
0xe2, 0xe8, 0x66, 0xb6, 0x2d, 0xb6, 0xfb, 0x6a, 0x6c, 0x16, 0xb3, 0xdd, 0x46, 0x43, 0xb9,
|
||||
0x73, 0x00, 0x6a, 0x71, 0xed, 0x4e, 0x9d, 0x25, 0x1a, 0xc3, 0x3c, 0x4a, 0x95, 0x15, 0x99,
|
||||
0x35, 0x81, 0x14, 0x02, 0xd6, 0x98, 0x9b, 0xec, 0xd8, 0x23, 0x3b, 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xbf, 0x85, 0x49, 0x79, 0x35, 0x2e, 0x56, 0x7b, 0x41, 0x14, 0x39, 0x47,
|
||||
0x83, 0x26, 0xaa, 0x07, 0x89, 0x98, 0x11, 0x1b, 0x86, 0xe7, 0x73, 0x7a, 0xd8, 0x7d, 0x78,
|
||||
0x61, 0x53, 0xe9, 0x79, 0xf5, 0x36, 0x8d, 0x44, 0x92, 0x84, 0xf9, 0x13, 0x50, 0x58, 0x3b,
|
||||
0xa4, 0x6a, 0x36, 0x65, 0x49, 0x8e, 0x3c, 0x0e, 0xf1, 0x6f, 0xd2, 0x84, 0xc4, 0x7e, 0x8e,
|
||||
0x3f, 0x39, 0xae, 0x7c, 0x84, 0xf1, 0x63, 0x37, 0x8e, 0x3c, 0xcc, 0x3e, 0x44, 0x81, 0x45,
|
||||
0xf1, 0x4b, 0xb9, 0xed, 0x6b, 0x36, 0x5d, 0xbb, 0x20, 0x60, 0x1a, 0x0f, 0xa3, 0xaa, 0x55,
|
||||
0x77, 0x3a, 0xa9, 0xae, 0x37, 0x4d, 0xba, 0xb8, 0x86, 0x6b, 0xbc, 0x08, 0x50, 0xf6, 0xcc,
|
||||
0xa4, 0xbd, 0x1d, 0x40, 0x72, 0xa5, 0x86, 0xfa, 0xe2, 0x10, 0xae, 0x3d, 0x58, 0x4b, 0x97,
|
||||
0xf3, 0x43, 0x74, 0xa9, 0x9e, 0xeb, 0x21, 0xb7, 0x01, 0xa4, 0x86, 0x93, 0x97, 0xee, 0x2f,
|
||||
0x4f, 0x3b, 0x86, 0xa1, 0x41, 0x6f, 0x41, 0x26, 0x90, 0x78, 0x5c, 0x7f, 0x30, 0x38, 0x4b,
|
||||
0x3f, 0xaa, 0xec, 0xed, 0x5c, 0x6f, 0x0e, 0xad, 0x43, 0x87, 0xfd, 0x93, 0x35, 0xe6, 0x01,
|
||||
0xef, 0x41, 0x26, 0x90, 0x99, 0x9e, 0xfb, 0x19, 0x5b, 0xad, 0xd2, 0x91, 0x8a, 0xe0, 0x46,
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 0x2d, 0x37, 0x5d, 0xaa, 0xfb, 0x49, 0x68, 0xa0, 0x9c,
|
||||
0x50, 0x86, 0x7f, 0x68, 0x56, 0x57, 0xf9, 0x79, 0x18, 0x39, 0xd4, 0xe0, 0x01, 0x84, 0x33,
|
||||
0x61, 0xca, 0xa5, 0xd2, 0xd6, 0xe4, 0xc9, 0x8a, 0x4a, 0x23, 0x44, 0x4e, 0xbc, 0xf0, 0xdc,
|
||||
0x24, 0xa1, 0xa0, 0xc4, 0xe2, 0x07, 0x3c, 0x10, 0xc4, 0xb5, 0x25, 0x4b, 0x65, 0x63, 0xf4,
|
||||
0x80, 0xe7, 0xcf, 0x61, 0xb1, 0x71, 0x82, 0x21, 0x87, 0x2c, 0xf5, 0x91, 0x00, 0x32, 0x0c,
|
||||
0xec, 0xa9, 0xb5, 0x9a, 0x74, 0x85, 0xe3, 0x36, 0x8f, 0x76, 0x4f, 0x9c, 0x6d, 0xce, 0xbc,
|
||||
0xad, 0x0a, 0x4b, 0xed, 0x76, 0x04, 0xcb, 0xc3, 0xb9, 0x33, 0x9e, 0x01, 0x93, 0x96, 0x69,
|
||||
0x7d, 0xc5, 0xa2, 0x45, 0x79, 0x9b, 0x04, 0x5c, 0x84, 0x09, 0xed, 0x88, 0x43, 0xc7, 0xab,
|
||||
0x93, 0x14, 0x26, 0xa1, 0x40, 0xb5, 0xce, 0x4e, 0xbf, 0x2a, 0x42, 0x85, 0x3e, 0x2c, 0x3b,
|
||||
0x54, 0xe8, 0x12, 0x1f, 0x0e, 0x97, 0x59, 0xb2, 0x27, 0x89, 0xfa, 0xf2, 0xdf, 0x8e, 0x68,
|
||||
0x59, 0xdc, 0x06, 0xbc, 0xb6, 0x85, 0x0d, 0x06, 0x22, 0xec, 0xb1, 0xcb, 0xe5, 0x04, 0xe6,
|
||||
0x3d, 0xb3, 0xb0, 0x41, 0x73, 0x08, 0x3f, 0x3c, 0x58, 0x86, 0x63, 0xeb, 0x50, 0xee, 0x1d,
|
||||
0x2c, 0x37, 0x74, 0xa9, 0xd3, 0x18, 0xa3, 0x47, 0x6e, 0x93, 0x54, 0xad, 0x0a, 0x5d, 0xb8,
|
||||
0x2a, 0x55, 0x5d, 0x78, 0xf6, 0xee, 0xbe, 0x8e, 0x3c, 0x76, 0x69, 0xb9, 0x40, 0xc2, 0x34,
|
||||
0xec, 0x2a, 0xb9, 0xed, 0x7e, 0x20, 0xe4, 0x8d, 0x00, 0x38, 0xc7, 0xe6, 0x8f, 0x44, 0xa8,
|
||||
0x86, 0xce, 0xeb, 0x2a, 0xe9, 0x90, 0xf1, 0x4c, 0xdf, 0x32, 0xfb, 0x73, 0x1b, 0x6d, 0x92,
|
||||
0x1e, 0x95, 0xfe, 0xb4, 0xdb, 0x65, 0xdf, 0x4d, 0x23, 0x54, 0x89, 0x48, 0xbf, 0x4a, 0x2e,
|
||||
0x70, 0xd6, 0xd7, 0x62, 0xb4, 0x33, 0x29, 0xb1, 0x3a, 0x33, 0x4c, 0x23, 0x6d, 0xa6, 0x76,
|
||||
0xa5, 0x21, 0x63, 0x48, 0xe6, 0x90, 0x5d, 0xed, 0x90, 0x95, 0x0b, 0x7a, 0x84, 0xbe, 0xb8,
|
||||
0x0d, 0x5e, 0x63, 0x0c, 0x62, 0x26, 0x4c, 0x14, 0x5a, 0xb3, 0xac, 0x23, 0xa4, 0x74, 0xa7,
|
||||
0x6f, 0x33, 0x30, 0x05, 0x60, 0x01, 0x42, 0xa0, 0x28, 0xb7, 0xee, 0x19, 0x38, 0xf1, 0x64,
|
||||
0x80, 0x82, 0x43, 0xe1, 0x41, 0x27, 0x1f, 0x1f, 0x90, 0x54, 0x7a, 0xd5, 0x23, 0x2e, 0xd1,
|
||||
0x3d, 0xcb, 0x28, 0xba, 0x58, 0x7f, 0xdc, 0x7c, 0x91, 0x24, 0xe9, 0x28, 0x51, 0x83, 0x6e,
|
||||
0xc5, 0x56, 0x21, 0x42, 0xed, 0xa0, 0x56, 0x22, 0xa1, 0x40, 0x80, 0x6b, 0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 0x0b,
|
||||
0x75, 0x68, 0x52, 0x07, 0x8c, 0x9a, 0x97, 0x8d, 0x79, 0x70, 0x62, 0x46, 0xef, 0x5c, 0x1b,
|
||||
0x95, 0x89, 0x71, 0x41, 0xe1, 0x21, 0xa1, 0xa1, 0xa1, 0xc0, 0x02, 0x67, 0x4c, 0x1a, 0xb6,
|
||||
0xcf, 0xfd, 0x78, 0x53, 0x24, 0xab, 0xb5, 0xc9, 0xf1, 0x60, 0x23, 0xa5, 0xc8, 0x12, 0x87,
|
||||
0x6d, 0x58, 0x13, 0x85, 0x88, 0x92, 0x87, 0x6d, 0x58, 0x32, 0xc7, 0x0c, 0x9a, 0x97, 0xac,
|
||||
0xda, 0x36, 0xee, 0x5e, 0x3e, 0xdf, 0x1d, 0xb8, 0xf2, 0x66, 0x2f, 0xbd, 0xf8, 0x72, 0x47,
|
||||
0xed, 0x58, 0x13, 0x85, 0x88, 0x92, 0x87, 0x8c, 0x7b, 0x55, 0x09, 0x90, 0xa2, 0xc6, 0xef,
|
||||
0x3d, 0xf8, 0x53, 0x24, 0xab, 0xd4, 0x2a, 0xb7, 0xec, 0x5a, 0x36, 0xee, 0x5e, 0x3e, 0xdf,
|
||||
0x3c, 0xfa, 0x76, 0x4f, 0xfd, 0x59, 0x30, 0xe2, 0x46, 0xef, 0x3d, 0xf8, 0x53, 0x05, 0x69,
|
||||
0x31, 0xc1, 0x00, 0x82, 0x86, 0x8e, 0x7f, 0x5d, 0x19, 0xb0, 0xe2, 0x27, 0xcc, 0xfb, 0x74,
|
||||
0x4b, 0x14, 0x8b, 0x94, 0x8b, 0x75, 0x68, 0x33, 0xc5, 0x08, 0x92, 0x87, 0x8c, 0x9a, 0xb6,
|
||||
0xcf, 0x1c, 0xba, 0xd7, 0x0d, 0x98, 0xb2, 0xe6, 0x2f, 0xdc, 0x1b, 0x95, 0x89, 0x71, 0x60,
|
||||
0x23, 0xc4, 0x0a, 0x96, 0x8f, 0x9c, 0xba, 0xf6, 0x6e, 0x3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xf0, 0x43, 0x04, 0x8a, 0x96, 0xae, 0xde, 0x3e, 0xdf, 0x1d, 0x99, 0x91, 0xa0,
|
||||
0xc2, 0x06, 0x6f, 0x3d, 0xf8, 0x72, 0x47, 0x0c, 0x9a, 0x97, 0x8d, 0x98, 0x93, 0x85, 0x88,
|
||||
0x73, 0x45, 0xe9, 0x31, 0xe0, 0x23, 0xa5, 0xa9, 0xd0, 0x03, 0x84, 0x8a, 0x96, 0xae, 0xde,
|
||||
0x1f, 0xbc, 0xdb, 0x15, 0xa8, 0xd2, 0x26, 0xce, 0xff, 0x5d, 0x19, 0x91, 0x81, 0x80, 0x82,
|
||||
0x67, 0x2d, 0xd8, 0x13, 0xa4, 0xab, 0xd4, 0x0b, 0x94, 0xaa, 0xb7, 0xcd, 0xf9, 0x51, 0x20,
|
||||
0xa3, 0xa5, 0xc8, 0xf3, 0x45, 0xe9, 0x50, 0x22, 0xc6, 0xef, 0x5c, 0x3a, 0xd7, 0x0d, 0x98,
|
||||
0x93, 0x85, 0x88, 0x73, 0x64, 0x4a, 0xf7, 0x4d, 0xf9, 0x51, 0x20, 0xa3, 0xc4, 0x0a, 0x96,
|
||||
0xae, 0xde, 0x3e, 0xfe, 0x7e, 0x7e, 0x7e, 0x5f, 0x3c, 0xfa, 0x76, 0x4f, 0xfd, 0x78, 0x72,
|
||||
0x66, 0x2f, 0xbd, 0xd9, 0x30, 0xc3, 0xe5, 0x48, 0x12, 0x87, 0x8c, 0x7b, 0x55, 0x28, 0xd2,
|
||||
0x07, 0x8c, 0x9a, 0x97, 0xac, 0xda, 0x17, 0x8d, 0x79, 0x51, 0x20, 0xa3, 0xc4, 0xeb, 0x54,
|
||||
0x0b, 0x94, 0x8b, 0x94, 0xaa, 0xd6, 0x2e, 0xbf, 0xfc, 0x5b, 0x15, 0xa8, 0xd2, 0x26, 0xaf,
|
||||
0xdc, 0x1b, 0xb4, 0xea, 0x37, 0xec, 0x3b, 0xf4, 0x6a, 0x37, 0xcd, 0x18, 0x93, 0x85, 0x69,
|
||||
0x31, 0xc1, 0xe1, 0x40, 0xe3, 0x25, 0xc8, 0x12, 0x87, 0x8c, 0x9a, 0xb6, 0xcf, 0xfd, 0x59,
|
||||
0x11, 0xa0, 0xc2, 0x06, 0x8e, 0x7f, 0x5d, 0x38, 0xf2, 0x47, 0x0c, 0x7b, 0x74, 0x6a, 0x37,
|
||||
0xec, 0x5a, 0x36, 0xee, 0x3f, 0xfc, 0x7a, 0x76, 0x4f, 0x1c, 0x9b, 0x95, 0x89, 0x71, 0x41,
|
||||
0x00, 0x63, 0x44, 0xeb, 0x54, 0x2a, 0xd6, 0x0f, 0x9c, 0xba, 0xd7, 0x0d, 0x98, 0x93, 0x85,
|
||||
0x69, 0x31, 0xc1, 0x00, 0x82, 0x86, 0x8e, 0x9e, 0xbe, 0xdf, 0x3c, 0xfa, 0x57, 0x2c, 0xda,
|
||||
0x36, 0xee, 0x3f, 0xfc, 0x5b, 0x15, 0x89, 0x71, 0x41, 0x00, 0x82, 0x86, 0x8e, 0x7f, 0x5d,
|
||||
0x38, 0xf2, 0x47, 0xed, 0x58, 0x13, 0xa4, 0xca, 0xf7, 0x4d, 0xf9, 0x51, 0x01, 0x80, 0x63,
|
||||
0x44, 0xeb, 0x54, 0x2a, 0xd6, 0x2e, 0xbf, 0xdd, 0x19, 0x91, 0xa0, 0xa3, 0xa5, 0xa9, 0xb1,
|
||||
0xe0, 0x42, 0x06, 0x8e, 0x7f, 0x5d, 0x19, 0x91, 0xa0, 0xa3, 0xc4, 0x0a, 0x96, 0x8f, 0x7d,
|
||||
0x78, 0x72, 0x47, 0x0c, 0x7b, 0x74, 0x6a, 0x56, 0x2e, 0xde, 0x1f, 0xbc, 0xfa, 0x57, 0x0d,
|
||||
0x79, 0x51, 0x01, 0x61, 0x21, 0xa1, 0xc0, 0xe3, 0x25, 0xa9, 0xb1, 0xc1, 0xe1, 0x40, 0x02,
|
||||
0x67, 0x4c, 0x1a, 0x97, 0x8d, 0x98, 0x93, 0xa4, 0xab, 0xd4, 0x2a, 0xd6, 0x0f, 0x9c, 0x9b,
|
||||
0xb4, 0xcb, 0x14, 0xaa, 0xb7, 0xcd, 0xf9, 0x51, 0x20, 0xa3, 0xc4, 0xeb, 0x35, 0xc9, 0xf1,
|
||||
0x60, 0x42, 0x06, 0x8e, 0x7f, 0x7c, 0x7a, 0x76, 0x6e, 0x3f, 0xfc, 0x7a, 0x76, 0x6e, 0x5e,
|
||||
0x3e, 0xfe, 0x7e, 0x5f, 0x3c, 0xdb, 0x15, 0x89, 0x71, 0x41, 0xe1, 0x21, 0xc0, 0xe3, 0x44,
|
||||
0xeb, 0x54, 0x2a, 0xb7, 0xcd, 0xf9, 0x70, 0x62, 0x27, 0xad, 0xd8, 0x32, 0xc7, 0x0c, 0x7b,
|
||||
0x74, 0x4b, 0x14, 0xaa, 0xb7, 0xec, 0x3b, 0xd5, 0x28, 0xd2, 0x07, 0x6d, 0x39, 0xd1, 0x20,
|
||||
0xc2, 0xe7, 0x4c, 0x1a, 0x97, 0x8d, 0x98, 0xb2, 0xc7, 0x0c, 0x59, 0x28, 0xf3, 0x9b };
|
@@ -21,7 +21,3 @@ SPLIT_KEYBOARD = yes
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
|
||||
DEFAULT_FOLDER = oddball/v1
|
||||
|
||||
SRC += spi_master.c
|
||||
SRC += drivers/sensors/adns9800.c
|
||||
SRC += pmw/pmw.c
|
||||
|
@@ -31,7 +31,8 @@
|
||||
# define OPT_SCALE 1 // Multiplier for wheel
|
||||
#endif
|
||||
#ifndef PLOOPY_DPI_OPTIONS
|
||||
# define PLOOPY_DPI_OPTIONS { 1200, 1600, 2400 }
|
||||
# define PLOOPY_DPI_OPTIONS \
|
||||
{ 1200, 1600, 2400 }
|
||||
# ifndef PLOOPY_DPI_DEFAULT
|
||||
# define PLOOPY_DPI_DEFAULT 1
|
||||
# endif
|
||||
@@ -40,10 +41,10 @@
|
||||
# define PLOOPY_DPI_DEFAULT 0
|
||||
#endif
|
||||
#ifndef PLOOPY_DRAGSCROLL_DPI
|
||||
# define PLOOPY_DRAGSCROLL_DPI 100 // Fixed-DPI Drag Scroll
|
||||
# define PLOOPY_DRAGSCROLL_DPI 100 // Fixed-DPI Drag Scroll
|
||||
#endif
|
||||
#ifndef PLOOPY_DRAGSCROLL_MULTIPLIER
|
||||
# define PLOOPY_DRAGSCROLL_MULTIPLIER 0.75 // Variable-DPI Drag Scroll
|
||||
# define PLOOPY_DRAGSCROLL_MULTIPLIER 0.75 // Variable-DPI Drag Scroll
|
||||
#endif
|
||||
|
||||
keyboard_config_t keyboard_config;
|
||||
@@ -65,13 +66,7 @@ uint8_t OptLowPin = OPT_ENC1;
|
||||
bool debug_encoder = false;
|
||||
bool is_drag_scroll = false;
|
||||
|
||||
__attribute__((weak)) void process_wheel_user(report_mouse_t* mouse_report, int16_t h, int16_t v) {
|
||||
mouse_report->h = h;
|
||||
mouse_report->v = v;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void process_wheel(report_mouse_t* mouse_report) {
|
||||
// TODO: Replace this with interrupt driven code, polling is S L O W
|
||||
void process_wheel(report_mouse_t* mouse_report) {
|
||||
// Lovingly ripped from the Ploopy Source
|
||||
|
||||
// If the mouse wheel was just released, do not scroll.
|
||||
@@ -99,56 +94,25 @@ __attribute__((weak)) void process_wheel(report_mouse_t* mouse_report) {
|
||||
int dir = opt_encoder_handler(p1, p2);
|
||||
|
||||
if (dir == 0) return;
|
||||
process_wheel_user(mouse_report, mouse_report->h, (int)(mouse_report->v + (dir * OPT_SCALE)));
|
||||
mouse_report->v = (int8_t)(dir * OPT_SCALE);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
|
||||
mouse_report->x = x;
|
||||
mouse_report->y = y;
|
||||
}
|
||||
__attribute__((weak)) report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
|
||||
process_wheel(&mouse_report);
|
||||
|
||||
__attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) {
|
||||
report_pmw_t data = pmw_read_burst();
|
||||
if (data.isOnSurface && data.isMotion) {
|
||||
// Reset timer if stopped moving
|
||||
if (!data.isMotion) {
|
||||
if (MotionStart != 0) MotionStart = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set timer if new motion
|
||||
if ((MotionStart == 0) && data.isMotion) {
|
||||
if (debug_mouse) dprintf("Starting motion.\n");
|
||||
MotionStart = timer_read();
|
||||
}
|
||||
|
||||
if (debug_mouse) {
|
||||
dprintf("Delt] d: %d t: %u\n", abs(data.dx) + abs(data.dy), MotionStart);
|
||||
}
|
||||
if (debug_mouse) {
|
||||
dprintf("Pre ] X: %d, Y: %d\n", data.dx, data.dy);
|
||||
}
|
||||
#if defined(PROFILE_LINEAR)
|
||||
float scale = float(timer_elaspsed(MotionStart)) / 1000.0;
|
||||
data.dx *= scale;
|
||||
data.dy *= scale;
|
||||
#elif defined(PROFILE_INVERSE)
|
||||
// TODO
|
||||
if (is_drag_scroll) {
|
||||
mouse_report.h = mouse_report.x;
|
||||
#ifdef PLOOPY_DRAGSCROLL_INVERT
|
||||
// Invert vertical scroll direction
|
||||
mouse_report.v = -mouse_report.y;
|
||||
#else
|
||||
// no post processing
|
||||
mouse_report.v = mouse_report.y;
|
||||
#endif
|
||||
// apply multiplier
|
||||
// data.dx *= mouse_multiplier;
|
||||
// data.dy *= mouse_multiplier;
|
||||
|
||||
// Wrap to HID size
|
||||
data.dx = constrain(data.dx, -127, 127);
|
||||
data.dy = constrain(data.dy, -127, 127);
|
||||
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);
|
||||
mouse_report.x = 0;
|
||||
mouse_report.y = 0;
|
||||
}
|
||||
|
||||
return pointing_device_task_user(mouse_report);
|
||||
}
|
||||
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
@@ -169,7 +133,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
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]);
|
||||
pointing_device_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
}
|
||||
|
||||
if (keycode == DRAG_SCROLL) {
|
||||
@@ -180,9 +144,9 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
is_drag_scroll ^= 1;
|
||||
}
|
||||
#ifdef PLOOPY_DRAGSCROLL_FIXED
|
||||
pmw_set_cpi(is_drag_scroll ? PLOOPY_DRAGSCROLL_DPI : dpi_array[keyboard_config.dpi_config]);
|
||||
pointing_device_set_cpi(is_drag_scroll ? PLOOPY_DRAGSCROLL_DPI : dpi_array[keyboard_config.dpi_config]);
|
||||
#else
|
||||
pmw_set_cpi(is_drag_scroll ? (dpi_array[keyboard_config.dpi_config] * PLOOPY_DRAGSCROLL_MULTIPLIER) : dpi_array[keyboard_config.dpi_config]);
|
||||
pointing_device_set_cpi(is_drag_scroll ? (dpi_array[keyboard_config.dpi_config] * PLOOPY_DRAGSCROLL_MULTIPLIER) : dpi_array[keyboard_config.dpi_config]);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -194,11 +158,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
#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));
|
||||
}
|
||||
currentReport.buttons = pointing_device_handle_buttons(currentReport.buttons, record->event.pressed, keycode - KC_MS_BTN1);
|
||||
pointing_device_set_report(currentReport);
|
||||
pointing_device_send();
|
||||
}
|
||||
@@ -240,35 +200,12 @@ void keyboard_pre_init_kb(void) {
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
void pointing_device_init(void) {
|
||||
// initialize ball sensor
|
||||
pmw_spi_init();
|
||||
void pointing_device_init_kb(void) {
|
||||
pointing_device_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
// initialize the scroll wheel's optical encoder
|
||||
opt_encoder_init();
|
||||
}
|
||||
|
||||
|
||||
void pointing_device_task(void) {
|
||||
report_mouse_t mouse_report = pointing_device_get_report();
|
||||
process_wheel(&mouse_report);
|
||||
process_mouse(&mouse_report);
|
||||
|
||||
if (is_drag_scroll) {
|
||||
mouse_report.h = mouse_report.x;
|
||||
#ifdef PLOOPY_DRAGSCROLL_INVERT
|
||||
// Invert vertical scroll direction
|
||||
mouse_report.v = -mouse_report.y;
|
||||
#else
|
||||
mouse_report.v = mouse_report.y;
|
||||
#endif
|
||||
mouse_report.x = 0;
|
||||
mouse_report.y = 0;
|
||||
}
|
||||
|
||||
pointing_device_set_report(mouse_report);
|
||||
pointing_device_send();
|
||||
}
|
||||
|
||||
void eeconfig_init_kb(void) {
|
||||
keyboard_config.dpi_config = PLOOPY_DPI_DEFAULT;
|
||||
eeconfig_update_kb(keyboard_config.raw);
|
||||
@@ -284,9 +221,3 @@ void matrix_init_kb(void) {
|
||||
}
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
void keyboard_post_init_kb(void) {
|
||||
pmw_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
|
||||
keyboard_post_init_user();
|
||||
}
|
||||
|
@@ -19,11 +19,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
#include "spi_master.h"
|
||||
#include "drivers/sensors/pmw3360.h"
|
||||
#include "analog.h"
|
||||
#include "opt_encoder.h"
|
||||
#include "pointing_device.h"
|
||||
|
||||
// Sensor defs
|
||||
#define OPT_ENC1 F0
|
||||
@@ -31,10 +28,7 @@
|
||||
#define OPT_ENC1_MUX 0
|
||||
#define OPT_ENC2_MUX 4
|
||||
|
||||
void process_mouse(report_mouse_t* mouse_report);
|
||||
void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y);
|
||||
void process_wheel(report_mouse_t* mouse_report);
|
||||
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}, }
|
||||
|
@@ -22,7 +22,8 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
POINTING_DEVICE_DRIVER = pmw3360
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
|
||||
QUANTUM_LIB_SRC += analog.c spi_master.c
|
||||
SRC += drivers/sensors/pmw3360.c opt_encoder.c
|
||||
QUANTUM_LIB_SRC += analog.c
|
||||
SRC += opt_encoder.c
|
||||
|
@@ -19,9 +19,10 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
POINTING_DEVICE_DRIVER = pmw3360
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
|
||||
QUANTUM_LIB_SRC += analog.c spi_master.c
|
||||
SRC += drivers/sensors/pmw3360.c opt_encoder.c
|
||||
QUANTUM_LIB_SRC += analog.c
|
||||
SRC += opt_encoder.c
|
||||
|
||||
DEFAULT_FOLDER = ploopyco/trackball/rev1_005
|
||||
|
@@ -65,12 +65,7 @@ uint8_t OptLowPin = OPT_ENC1;
|
||||
bool debug_encoder = false;
|
||||
bool is_drag_scroll = false;
|
||||
|
||||
__attribute__((weak)) void process_wheel_user(report_mouse_t* mouse_report, int16_t h, int16_t v) {
|
||||
mouse_report->h = h;
|
||||
mouse_report->v = v;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void process_wheel(report_mouse_t* mouse_report) {
|
||||
void process_wheel(report_mouse_t* mouse_report) {
|
||||
// TODO: Replace this with interrupt driven code, polling is S L O W
|
||||
// Lovingly ripped from the Ploopy Source
|
||||
|
||||
@@ -99,56 +94,25 @@ __attribute__((weak)) void process_wheel(report_mouse_t* mouse_report) {
|
||||
int dir = opt_encoder_handler(p1, p2);
|
||||
|
||||
if (dir == 0) return;
|
||||
process_wheel_user(mouse_report, mouse_report->h, (int)(mouse_report->v + (dir * OPT_SCALE)));
|
||||
mouse_report->v = (int8_t)(dir * OPT_SCALE);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
|
||||
mouse_report->x = x;
|
||||
mouse_report->y = y;
|
||||
}
|
||||
report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
|
||||
process_wheel(&mouse_report);
|
||||
|
||||
__attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) {
|
||||
report_pmw_t data = pmw_read_burst();
|
||||
if (data.isOnSurface && data.isMotion) {
|
||||
// Reset timer if stopped moving
|
||||
if (!data.isMotion) {
|
||||
if (MotionStart != 0) MotionStart = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set timer if new motion
|
||||
if ((MotionStart == 0) && data.isMotion) {
|
||||
if (debug_mouse) dprintf("Starting motion.\n");
|
||||
MotionStart = timer_read();
|
||||
}
|
||||
|
||||
if (debug_mouse) {
|
||||
dprintf("Delt] d: %d t: %u\n", abs(data.dx) + abs(data.dy), MotionStart);
|
||||
}
|
||||
if (debug_mouse) {
|
||||
dprintf("Pre ] X: %d, Y: %d\n", data.dx, data.dy);
|
||||
}
|
||||
#if defined(PROFILE_LINEAR)
|
||||
float scale = float(timer_elaspsed(MotionStart)) / 1000.0;
|
||||
data.dx *= scale;
|
||||
data.dy *= scale;
|
||||
#elif defined(PROFILE_INVERSE)
|
||||
// TODO
|
||||
if (is_drag_scroll) {
|
||||
mouse_report.h = mouse_report.x;
|
||||
#ifdef PLOOPY_DRAGSCROLL_INVERT
|
||||
// Invert vertical scroll direction
|
||||
mouse_report.v = -mouse_report.y;
|
||||
#else
|
||||
// no post processing
|
||||
mouse_report.v = mouse_report.y;
|
||||
#endif
|
||||
// apply multiplier
|
||||
// data.dx *= mouse_multiplier;
|
||||
// data.dy *= mouse_multiplier;
|
||||
|
||||
// Wrap to HID size
|
||||
data.dx = constrain(data.dx, -127, 127);
|
||||
data.dy = constrain(data.dy, -127, 127);
|
||||
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);
|
||||
mouse_report.x = 0;
|
||||
mouse_report.y = 0;
|
||||
}
|
||||
|
||||
return pointing_device_task_user(mouse_report);
|
||||
}
|
||||
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
@@ -169,7 +133,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
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]);
|
||||
pointing_device_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
}
|
||||
|
||||
if (keycode == DRAG_SCROLL) {
|
||||
@@ -180,9 +144,9 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
is_drag_scroll ^= 1;
|
||||
}
|
||||
#ifdef PLOOPY_DRAGSCROLL_FIXED
|
||||
pmw_set_cpi(is_drag_scroll ? PLOOPY_DRAGSCROLL_DPI : dpi_array[keyboard_config.dpi_config]);
|
||||
pointing_device_set_cpi(is_drag_scroll ? PLOOPY_DRAGSCROLL_DPI : dpi_array[keyboard_config.dpi_config]);
|
||||
#else
|
||||
pmw_set_cpi(is_drag_scroll ? (dpi_array[keyboard_config.dpi_config] * PLOOPY_DRAGSCROLL_MULTIPLIER) : dpi_array[keyboard_config.dpi_config]);
|
||||
pointing_device_set_cpi(is_drag_scroll ? (dpi_array[keyboard_config.dpi_config] * PLOOPY_DRAGSCROLL_MULTIPLIER) : dpi_array[keyboard_config.dpi_config]);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -194,11 +158,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
#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));
|
||||
}
|
||||
currentReport.buttons = pointing_device_handle_buttons(record->event.pressed, keycode - KC_MS_BTN1);
|
||||
pointing_device_set_report(currentReport);
|
||||
pointing_device_send();
|
||||
}
|
||||
@@ -239,35 +199,12 @@ void keyboard_pre_init_kb(void) {
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
void pointing_device_init(void) {
|
||||
// initialize ball sensor
|
||||
pmw_spi_init();
|
||||
void pointing_device_init_kb(void) {
|
||||
pmw3360_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
// initialize the scroll wheel's optical encoder
|
||||
opt_encoder_init();
|
||||
}
|
||||
|
||||
|
||||
void pointing_device_task(void) {
|
||||
report_mouse_t mouse_report = pointing_device_get_report();
|
||||
process_wheel(&mouse_report);
|
||||
process_mouse(&mouse_report);
|
||||
|
||||
if (is_drag_scroll) {
|
||||
mouse_report.h = mouse_report.x;
|
||||
#ifdef PLOOPY_DRAGSCROLL_INVERT
|
||||
// Invert vertical scroll direction
|
||||
mouse_report.v = -mouse_report.y;
|
||||
#else
|
||||
mouse_report.v = mouse_report.y;
|
||||
#endif
|
||||
mouse_report.x = 0;
|
||||
mouse_report.y = 0;
|
||||
}
|
||||
|
||||
pointing_device_set_report(mouse_report);
|
||||
pointing_device_send();
|
||||
}
|
||||
|
||||
void eeconfig_init_kb(void) {
|
||||
keyboard_config.dpi_config = PLOOPY_DPI_DEFAULT;
|
||||
eeconfig_update_kb(keyboard_config.raw);
|
||||
@@ -285,7 +222,7 @@ void matrix_init_kb(void) {
|
||||
}
|
||||
|
||||
void keyboard_post_init_kb(void) {
|
||||
pmw_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
pointing_device_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
|
||||
keyboard_post_init_user();
|
||||
}
|
||||
|
@@ -19,11 +19,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
#include "spi_master.h"
|
||||
#include "drivers/sensors/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)
|
||||
@@ -36,10 +33,7 @@
|
||||
#define OPT_ENC1_MUX 0
|
||||
#define OPT_ENC2_MUX 4
|
||||
|
||||
void process_mouse(report_mouse_t* mouse_report);
|
||||
void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y);
|
||||
void process_wheel(report_mouse_t* mouse_report);
|
||||
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}, }
|
||||
|
@@ -56,3 +56,9 @@
|
||||
|
||||
// If board has a debug LED, you can enable it by defining this
|
||||
// #define DEBUG_LED_PIN F7
|
||||
|
||||
#define ADNS5050_SCLK_PIN B7
|
||||
#define ADNS5050_SDIO_PIN C6
|
||||
#define ADNS5050_CS_PIN B4
|
||||
|
||||
#define POINTING_DEVICE_ROTATION_90
|
||||
|
@@ -44,7 +44,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
// 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) {
|
||||
void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y) {
|
||||
if (is_drag_scroll) {
|
||||
mouse_report->h = x;
|
||||
mouse_report->v = y;
|
||||
|
@@ -1,9 +1,6 @@
|
||||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
||||
# Processor frequency
|
||||
F_CPU = 16000000
|
||||
|
||||
# Bootloader selection
|
||||
BOOTLOADER = atmel-dfu
|
||||
|
||||
@@ -22,9 +19,10 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
POINTING_DEVICE_DRIVER = adns5050
|
||||
MOUSEKEY_ENABLE = no # Mouse keys
|
||||
|
||||
QUANTUM_LIB_SRC += analog.c
|
||||
SRC += drivers/sensors/adns5050.c opt_encoder.c
|
||||
SRC += opt_encoder.c
|
||||
|
||||
DEFAULT_FOLDER = ploopyco/trackball_mini/rev1_001
|
||||
|
@@ -37,20 +37,17 @@
|
||||
# define OPT_SCALE 1 // Multiplier for wheel
|
||||
#endif
|
||||
|
||||
#define PLOOPY_DPI_OPTIONS { CPI375, CPI750, CPI1375 }
|
||||
#define PLOOPY_DPI_OPTIONS \
|
||||
{ 375, 750, 1375 }
|
||||
#define PLOOPY_DPI_DEFAULT 2
|
||||
|
||||
#ifndef PLOOPY_DRAGSCROLL_DPI
|
||||
# define PLOOPY_DRAGSCROLL_DPI CPI375 // Fixed-DPI Drag Scroll
|
||||
# define PLOOPY_DRAGSCROLL_DPI 375 // Fixed-DPI Drag Scroll
|
||||
#endif
|
||||
#ifndef PLOOPY_DRAGSCROLL_MULTIPLIER
|
||||
# define PLOOPY_DRAGSCROLL_MULTIPLIER 0.75 // Variable-DPI Drag Scroll
|
||||
#endif
|
||||
|
||||
// Transformation constants for delta-X and delta-Y
|
||||
const static float ADNS_X_TRANSFORM = -1.0;
|
||||
const static float ADNS_Y_TRANSFORM = 1.0;
|
||||
|
||||
keyboard_config_t keyboard_config;
|
||||
uint16_t dpi_array[] = PLOOPY_DPI_OPTIONS;
|
||||
#define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t))
|
||||
@@ -70,12 +67,7 @@ uint8_t OptLowPin = OPT_ENC1;
|
||||
bool debug_encoder = false;
|
||||
bool is_drag_scroll = false;
|
||||
|
||||
__attribute__((weak)) void process_wheel_user(report_mouse_t* mouse_report, int16_t h, int16_t v) {
|
||||
mouse_report->h = h;
|
||||
mouse_report->v = v;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void process_wheel(report_mouse_t* mouse_report) {
|
||||
void process_wheel(report_mouse_t* mouse_report) {
|
||||
// If the mouse wheel was just released, do not scroll.
|
||||
if (timer_elapsed(lastMidClick) < SCROLL_BUTT_DEBOUNCE)
|
||||
return;
|
||||
@@ -103,33 +95,31 @@ __attribute__((weak)) void process_wheel(report_mouse_t* mouse_report) {
|
||||
if (dir == 0)
|
||||
return;
|
||||
|
||||
process_wheel_user(mouse_report, mouse_report->h, (int)(mouse_report->v + (dir * OPT_SCALE)));
|
||||
mouse_report->v = (int8_t)(dir * OPT_SCALE);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
|
||||
mouse_report->x = x;
|
||||
mouse_report->y = y;
|
||||
void pointing_device_init_kb(void) {
|
||||
opt_encoder_init();
|
||||
|
||||
// set the DPI.
|
||||
pointing_device_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) {
|
||||
report_adns_t data = adns_read_burst();
|
||||
report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
|
||||
|
||||
if (data.dx != 0 || data.dy != 0) {
|
||||
if (debug_mouse)
|
||||
dprintf("Raw ] X: %d, Y: %d\n", data.dx, data.dy);
|
||||
|
||||
// Apply delta-X and delta-Y transformations.
|
||||
// x and y are swapped
|
||||
// the sensor is rotated
|
||||
// by 90 degrees
|
||||
float xt = (float) data.dy * ADNS_X_TRANSFORM;
|
||||
float yt = (float) data.dx * ADNS_Y_TRANSFORM;
|
||||
|
||||
int16_t xti = (int16_t)xt;
|
||||
int16_t yti = (int16_t)yt;
|
||||
|
||||
process_mouse_user(mouse_report, xti, yti);
|
||||
if (is_drag_scroll) {
|
||||
mouse_report.h = mouse_report.x;
|
||||
#ifdef PLOOPY_DRAGSCROLL_INVERT
|
||||
// Invert vertical scroll direction
|
||||
mouse_report.v = -mouse_report.y;
|
||||
#else
|
||||
mouse_report.v = mouse_report.y;
|
||||
#endif
|
||||
mouse_report.x = 0;
|
||||
mouse_report.y = 0;
|
||||
}
|
||||
|
||||
return pointing_device_task_user(mouse_report);
|
||||
}
|
||||
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
@@ -147,7 +137,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
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);
|
||||
adns_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
pointing_device_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
}
|
||||
|
||||
if (keycode == DRAG_SCROLL) {
|
||||
@@ -157,7 +147,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
{
|
||||
is_drag_scroll ^= 1;
|
||||
}
|
||||
adns_set_cpi(is_drag_scroll ? PLOOPY_DRAGSCROLL_DPI : dpi_array[keyboard_config.dpi_config]);
|
||||
pointing_device_set_cpi(is_drag_scroll ? PLOOPY_DRAGSCROLL_DPI : dpi_array[keyboard_config.dpi_config]);
|
||||
}
|
||||
|
||||
/* If Mousekeys is disabled, then use handle the mouse button
|
||||
@@ -168,11 +158,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
#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));
|
||||
}
|
||||
currentReport.buttons = pointing_device_handle_buttons(currentReport.buttons, record->event.pressed, keycode - KC_MS_BTN1);
|
||||
pointing_device_set_report(currentReport);
|
||||
pointing_device_send();
|
||||
}
|
||||
@@ -207,48 +193,6 @@ void keyboard_pre_init_kb(void) {
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
void pointing_device_init(void) {
|
||||
adns_init();
|
||||
opt_encoder_init();
|
||||
|
||||
// reboot the adns.
|
||||
// if the adns hasn't initialized yet, this is harmless.
|
||||
adns_write_reg(REG_CHIP_RESET, 0x5a);
|
||||
|
||||
// wait maximum time before adns is ready.
|
||||
// this ensures that the adns is actuall ready after reset.
|
||||
wait_ms(55);
|
||||
|
||||
// read a burst from the adns and then discard it.
|
||||
// gets the adns ready for write commands
|
||||
// (for example, setting the dpi).
|
||||
adns_read_burst();
|
||||
|
||||
// set the DPI.
|
||||
adns_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
}
|
||||
|
||||
void pointing_device_task(void) {
|
||||
report_mouse_t mouse_report = pointing_device_get_report();
|
||||
process_wheel(&mouse_report);
|
||||
process_mouse(&mouse_report);
|
||||
|
||||
if (is_drag_scroll) {
|
||||
mouse_report.h = mouse_report.x;
|
||||
#ifdef PLOOPY_DRAGSCROLL_INVERT
|
||||
// Invert vertical scroll direction
|
||||
mouse_report.v = -mouse_report.y;
|
||||
#else
|
||||
mouse_report.v = mouse_report.y;
|
||||
#endif
|
||||
mouse_report.x = 0;
|
||||
mouse_report.y = 0;
|
||||
}
|
||||
|
||||
pointing_device_set_report(mouse_report);
|
||||
pointing_device_send();
|
||||
}
|
||||
|
||||
void eeconfig_init_kb(void) {
|
||||
keyboard_config.dpi_config = PLOOPY_DPI_DEFAULT;
|
||||
eeconfig_update_kb(keyboard_config.raw);
|
||||
|
@@ -20,10 +20,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
#include "drivers/sensors/adns5050.h"
|
||||
#include "analog.h"
|
||||
#include "opt_encoder.h"
|
||||
#include "pointing_device.h"
|
||||
|
||||
// Sensor defs
|
||||
#define OPT_ENC1 F0
|
||||
@@ -31,10 +29,7 @@
|
||||
#define OPT_ENC1_MUX 0
|
||||
#define OPT_ENC2_MUX 4
|
||||
|
||||
void process_mouse(report_mouse_t* mouse_report);
|
||||
void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y);
|
||||
void process_wheel(report_mouse_t* mouse_report);
|
||||
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}, }
|
||||
|
@@ -45,3 +45,9 @@
|
||||
a polling rate as possible. */
|
||||
#define USB_POLLING_INTERVAL_MS 1
|
||||
#define USB_MAX_POWER_CONSUMPTION 100
|
||||
|
||||
#define ADNS5050_SCLK_PIN B7
|
||||
#define ADNS5050_SDIO_PIN C6
|
||||
#define ADNS5050_CS_PIN B4
|
||||
|
||||
#define POINTING_DEVICE_ROTATION_90
|
||||
|
@@ -21,14 +21,14 @@
|
||||
// safe range starts at `PLOOPY_SAFE_RANGE` instead.
|
||||
uint8_t scroll_enabled = 0;
|
||||
uint8_t lock_state = 0;
|
||||
int16_t delta_x = 0;
|
||||
int16_t delta_y = 0;
|
||||
int8_t delta_x = 0;
|
||||
int8_t delta_y = 0;
|
||||
|
||||
void process_mouse_user(report_mouse_t *mouse_report, int16_t x, int16_t y) {
|
||||
if (scroll_enabled) {
|
||||
delta_x += x;
|
||||
void process_mouse_user(report_mouse_t *mouse_report, int8_t x, int8_t y) {
|
||||
if (scroll_enabled) {
|
||||
delta_x += x;
|
||||
delta_y += y;
|
||||
|
||||
|
||||
if (delta_x > 60) {
|
||||
mouse_report->h = 1;
|
||||
delta_x = 0;
|
||||
@@ -44,10 +44,10 @@ void process_mouse_user(report_mouse_t *mouse_report, int16_t x, int16_t y) {
|
||||
mouse_report->v = 1;
|
||||
delta_y = 0;
|
||||
}
|
||||
} else {
|
||||
mouse_report->x = x;
|
||||
} else {
|
||||
mouse_report->x = x;
|
||||
mouse_report->y = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
@@ -62,7 +62,7 @@ bool led_update_user(led_t led_state) {
|
||||
scroll_timer = timer_read();
|
||||
lock_count = 0;
|
||||
}
|
||||
|
||||
|
||||
if (led_state.num_lock != lock_state) {
|
||||
lock_count++;
|
||||
|
||||
@@ -73,7 +73,7 @@ bool led_update_user(led_t led_state) {
|
||||
delta_y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
lock_state = led_state.num_lock;
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,9 +1,6 @@
|
||||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
||||
# Processor frequency
|
||||
F_CPU = 16000000
|
||||
|
||||
# Bootloader selection
|
||||
BOOTLOADER = atmel-dfu
|
||||
|
||||
@@ -22,9 +19,7 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
POINTING_DEVICE_DRIVER = adns5050
|
||||
MOUSEKEY_ENABLE = no # Mouse keys
|
||||
|
||||
QUANTUM_LIB_SRC += analog.c
|
||||
SRC += drivers/sensors/adns5050.c opt_encoder.c
|
||||
|
||||
DEFAULT_FOLDER = ploopyco/trackball_nano/rev1_001
|
||||
|
@@ -37,7 +37,8 @@
|
||||
#endif
|
||||
|
||||
#ifndef PLOOPY_DPI_OPTIONS
|
||||
# define PLOOPY_DPI_OPTIONS { CPI375, CPI750, CPI1375 }
|
||||
# define PLOOPY_DPI_OPTIONS \
|
||||
{ 375, 750, 1375 }
|
||||
# ifndef PLOOPY_DPI_DEFAULT
|
||||
# define PLOOPY_DPI_DEFAULT 2
|
||||
# endif
|
||||
@@ -49,12 +50,8 @@
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { };
|
||||
|
||||
// Transformation constants for delta-X and delta-Y
|
||||
const static float ADNS_X_TRANSFORM = -1.0;
|
||||
const static float ADNS_Y_TRANSFORM = 1.0;
|
||||
|
||||
keyboard_config_t keyboard_config;
|
||||
uint16_t dpi_array[] = PLOOPY_DPI_OPTIONS;
|
||||
uint16_t dpi_array[] = PLOOPY_DPI_OPTIONS;
|
||||
#define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t))
|
||||
|
||||
// TODO: Implement libinput profiles
|
||||
@@ -63,77 +60,13 @@ uint16_t dpi_array[] = PLOOPY_DPI_OPTIONS;
|
||||
// Valid options are ACC_NONE, ACC_LINEAR, ACC_CUSTOM, ACC_QUADRATIC
|
||||
|
||||
// Trackball State
|
||||
bool is_scroll_clicked = false;
|
||||
bool BurstState = false; // init burst state for Trackball module
|
||||
uint16_t MotionStart = 0; // Timer for accel, 0 is resting state
|
||||
uint16_t lastScroll = 0; // Previous confirmed wheel event
|
||||
uint16_t lastMidClick = 0; // Stops scrollwheel from being read if it was pressed
|
||||
uint8_t OptLowPin = OPT_ENC1;
|
||||
bool debug_encoder = false;
|
||||
bool is_scroll_clicked = false;
|
||||
bool BurstState = false; // init burst state for Trackball module
|
||||
uint16_t MotionStart = 0; // Timer for accel, 0 is resting state
|
||||
|
||||
__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
|
||||
mouse_report->x = x;
|
||||
mouse_report->y = y;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) {
|
||||
report_adns_t data = adns_read_burst();
|
||||
|
||||
if (data.dx != 0 || data.dy != 0) {
|
||||
if (debug_mouse)
|
||||
dprintf("Raw ] X: %d, Y: %d\n", data.dx, data.dy);
|
||||
|
||||
// Apply delta-X and delta-Y transformations.
|
||||
// x and y are swapped
|
||||
// the sensor is rotated
|
||||
// by 90 degrees
|
||||
float xt = (float) data.dy * ADNS_X_TRANSFORM;
|
||||
float yt = (float) data.dx * ADNS_Y_TRANSFORM;
|
||||
|
||||
int16_t xti = (int16_t)xt;
|
||||
int16_t yti = (int16_t)yt;
|
||||
|
||||
process_mouse_user(mouse_report, xti, yti);
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
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 == 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);
|
||||
adns_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
|
||||
* 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 pointing_device_init_kb(void) {
|
||||
// set the DPI.
|
||||
pointing_device_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
}
|
||||
|
||||
// Hardware Setup
|
||||
@@ -143,9 +76,6 @@ void keyboard_pre_init_kb(void) {
|
||||
// debug_mouse = true;
|
||||
// debug_encoder = true;
|
||||
|
||||
setPinInput(OPT_ENC1);
|
||||
setPinInput(OPT_ENC2);
|
||||
|
||||
/* 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.
|
||||
@@ -162,34 +92,6 @@ void keyboard_pre_init_kb(void) {
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
void pointing_device_init(void) {
|
||||
adns_init();
|
||||
opt_encoder_init();
|
||||
|
||||
// reboot the adns.
|
||||
// if the adns hasn't initialized yet, this is harmless.
|
||||
adns_write_reg(REG_CHIP_RESET, 0x5a);
|
||||
|
||||
// wait maximum time before adns is ready.
|
||||
// this ensures that the adns is actuall ready after reset.
|
||||
wait_ms(55);
|
||||
|
||||
// read a burst from the adns and then discard it.
|
||||
// gets the adns ready for write commands
|
||||
// (for example, setting the dpi).
|
||||
adns_read_burst();
|
||||
|
||||
// set the DPI.
|
||||
adns_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
||||
}
|
||||
|
||||
void pointing_device_task(void) {
|
||||
report_mouse_t mouse_report = pointing_device_get_report();
|
||||
process_mouse(&mouse_report);
|
||||
pointing_device_set_report(mouse_report);
|
||||
pointing_device_send();
|
||||
}
|
||||
|
||||
void eeconfig_init_kb(void) {
|
||||
keyboard_config.dpi_config = PLOOPY_DPI_DEFAULT;
|
||||
eeconfig_update_kb(keyboard_config.raw);
|
||||
|
@@ -20,19 +20,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
#include "drivers/sensors/adns5050.h"
|
||||
#include "analog.h"
|
||||
#include "opt_encoder.h"
|
||||
#include "pointing_device.h"
|
||||
|
||||
// Sensor defs
|
||||
#define OPT_ENC1 F0
|
||||
#define OPT_ENC2 F4
|
||||
#define OPT_ENC1_MUX 0
|
||||
#define OPT_ENC2_MUX 4
|
||||
|
||||
void process_mouse(report_mouse_t* mouse_report);
|
||||
void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y);
|
||||
|
||||
#define LAYOUT(k00) {{ KC_NO }}
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
EEPROM_DRIVER = i2c
|
||||
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
SRC += drivers/sensors/pimoroni_trackball.c
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
POINTING_DEVICE_DRIVER = pimoroni_trackball
|
||||
|
Reference in New Issue
Block a user