|
@@ -16,7 +16,7 @@
|
|
|
* along with this program. If not, see <http:
|
|
|
*/
|
|
|
|
|
|
-#include QMK_KEYBOARD_H
|
|
|
+#include "trackball.h"
|
|
|
|
|
|
#ifndef OPT_DEBOUNCE
|
|
|
# define OPT_DEBOUNCE 5
|
|
@@ -30,6 +30,19 @@
|
|
|
#ifndef OPT_SCALE
|
|
|
# define OPT_SCALE 1
|
|
|
#endif
|
|
|
+#ifndef PLOOPY_DPI_OPTIONS
|
|
|
+# define PLOOPY_DPI_OPTIONS { 1200, 1600, 2400 }
|
|
|
+# ifndef PLOOPY_DPI_DEFAULT
|
|
|
+# define PLOOPY_DPI_DEFAULT 1
|
|
|
+# endif
|
|
|
+#endif
|
|
|
+#ifndef PLOOPY_DPI_DEFAULT
|
|
|
+# define PLOOPY_DPI_DEFAULT 0
|
|
|
+#endif
|
|
|
+
|
|
|
+keyboard_config_t keyboard_config;
|
|
|
+uint16_t dpi_array[] = PLOOPY_DPI_OPTIONS;
|
|
|
+#define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t))
|
|
|
|
|
|
|
|
|
|
|
@@ -132,16 +145,24 @@ __attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) {
|
|
|
}
|
|
|
|
|
|
bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
|
|
- if (debug_mouse) {
|
|
|
- dprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
|
|
|
+ if (true) {
|
|
|
+ xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
|
|
|
}
|
|
|
|
|
|
|
|
|
- if ((record->event.key.col == 2) && (record->event.key.row == 0)) {
|
|
|
+ if ((record->event.key.col == 1) && (record->event.key.row == 0)) {
|
|
|
lastMidClick = timer_read();
|
|
|
is_scroll_clicked = record->event.pressed;
|
|
|
}
|
|
|
|
|
|
+ if (!process_record_user(keycode, record)) { return false; }
|
|
|
+
|
|
|
+ if (keycode == DPI_CONFIG && record->event.pressed) {
|
|
|
+ keyboard_config.dpi_config = (keyboard_config.dpi_config + 1) % DPI_OPTION_SIZE;
|
|
|
+ eeconfig_update_kb(keyboard_config.raw);
|
|
|
+ pmw_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
* keycodes. This makes things simpler, and allows usage of
|
|
|
* the keycodes in a consistent manner. But only do this if
|
|
@@ -174,10 +195,11 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
|
|
currentReport.buttons &= ~MOUSE_BTN5;
|
|
|
}
|
|
|
pointing_device_set_report(currentReport);
|
|
|
+ pointing_device_send();
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
- return process_record_user(keycode, record);
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -190,10 +212,6 @@ void keyboard_pre_init_kb(void) {
|
|
|
setPinInput(OPT_ENC1);
|
|
|
setPinInput(OPT_ENC2);
|
|
|
|
|
|
-
|
|
|
- setPinOutput(F7);
|
|
|
- writePin(F7, debug_enable);
|
|
|
-
|
|
|
|
|
|
* pathways to ground. If you're messing with this, know this: driving ANY
|
|
|
* of these pins high will cause a short. On the MCU. Ka-blooey.
|
|
@@ -206,6 +224,13 @@ void keyboard_pre_init_kb(void) {
|
|
|
writePinLow(unused_pins[i]);
|
|
|
}
|
|
|
#endif
|
|
|
+
|
|
|
+
|
|
|
+#if defined(DEBUG_LED_PIN)
|
|
|
+ setPinOutput(DEBUG_LED_PIN);
|
|
|
+ writePin(DEBUG_LED_PIN, debug_enable);
|
|
|
+#endif
|
|
|
+
|
|
|
keyboard_pre_init_user();
|
|
|
}
|
|
|
|
|
@@ -235,3 +260,24 @@ void pointing_device_task(void) {
|
|
|
pointing_device_send();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+void eeconfig_init_kb(void) {
|
|
|
+ keyboard_config.dpi_config = PLOOPY_DPI_DEFAULT;
|
|
|
+ eeconfig_update_kb(keyboard_config.raw);
|
|
|
+}
|
|
|
+
|
|
|
+void matrix_init_kb(void) {
|
|
|
+
|
|
|
+
|
|
|
+ keyboard_config.raw = eeconfig_read_kb();
|
|
|
+ if (keyboard_config.dpi_config > DPI_OPTION_SIZE) {
|
|
|
+ eeconfig_init_kb();
|
|
|
+ }
|
|
|
+ matrix_init_user();
|
|
|
+}
|
|
|
+
|
|
|
+void keyboard_post_init_kb(void) {
|
|
|
+ pmw_set_cpi(dpi_array[keyboard_config.dpi_config]);
|
|
|
+
|
|
|
+ keyboard_post_init_user();
|
|
|
+}
|