summaryrefslogtreecommitdiff
path: root/keyboards/ploopyco/trackball_mini
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2021-06-21 20:00:32 +0000
committerQMK Bot <hello@qmk.fm>2021-06-21 20:00:32 +0000
commite28d7ab58cbf5b9912a33fbe1b5a3a95d3449bea (patch)
treebdc3d935693faf7c886668db78da4b19b314d0cc /keyboards/ploopyco/trackball_mini
parent6901411bca0760ceb8acbe1f0c95feaed9d2aaeb (diff)
parenteba3d68394ba7bdd15836c0f4f4bb3c44b4e1f91 (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'keyboards/ploopyco/trackball_mini')
-rw-r--r--keyboards/ploopyco/trackball_mini/readme.md10
-rw-r--r--keyboards/ploopyco/trackball_mini/rev1_001/config.h2
-rw-r--r--keyboards/ploopyco/trackball_mini/rev1_002/config.h40
-rw-r--r--keyboards/ploopyco/trackball_mini/rev1_002/readme.md1
-rw-r--r--keyboards/ploopyco/trackball_mini/rev1_002/rev1_002.h22
-rw-r--r--keyboards/ploopyco/trackball_mini/rev1_002/rules.mk0
-rw-r--r--keyboards/ploopyco/trackball_mini/trackball_mini.c38
7 files changed, 90 insertions, 23 deletions
diff --git a/keyboards/ploopyco/trackball_mini/readme.md b/keyboards/ploopyco/trackball_mini/readme.md
index 8b8482a387..1858efb6e2 100644
--- a/keyboards/ploopyco/trackball_mini/readme.md
+++ b/keyboards/ploopyco/trackball_mini/readme.md
@@ -12,8 +12,8 @@ It's a DIY, QMK Powered Trackball...Mini!
Make example for this trackball (after setting up your build environment):
- make ploopyco/trackball_mini/rev1_001:default:flash
- make ploopyco/trackball_mini/rev1_001:via:flash
+ make ploopyco/trackball_mini/rev1_002:default:flash
+ make ploopyco/trackball_mini/rev1_002:via:flash
To jump to the bootloader, hold down "Button 4" (immediate right of the ball)
@@ -51,13 +51,13 @@ This should allow you to more heavily customize the behavior.
Alternatively, the `process_wheel` and `process_mouse` functions can both be replaced too, to allow for even more functionality.
-Additionally, you can change the DPI/CPI or speed of the trackball by calling `adns_set_cpi` at any time. Additionally, there is a `DPI_CONFIG` macro that will cycle through an array of options for the DPI. This is set to 375, 750, and 1375, but can be changed. 750 is the default.
+Additionally, you can change the DPI/CPI or speed of the trackball by calling `adns_set_cpi` at any time. Additionally, there is a `DPI_CONFIG` macro that will cycle through an array of options for the DPI. This is set to 375, 750, and 1375, but can be changed. 1375 is the default.
To configure/set your own array, there are two defines to use, `PLOOPY_DPI_OPTIONS` to set the array, and `PLOOPY_DPI_DEFAULT`.
```c
#define PLOOPY_DPI_OPTIONS { CPI375, CPI750, CPI1375}
-#define PLOOPY_DPI_DEFAULT 1
+#define PLOOPY_DPI_DEFAULT 2
```
The `PLOOPY_DPI_OPTIONS` array sets the values that you want to be able to cycle through, and the order they are in. The "default" define lets the firmware know which of these options is the default and should be loaded by default.
@@ -72,4 +72,4 @@ When flashing the bootloader, use the following fuse settings:
|----------|-------------|
| Low | `0x5E` |
| High | `0x99` |
-| Extended | `0xC3` | \ No newline at end of file
+| Extended | `0xC3` |
diff --git a/keyboards/ploopyco/trackball_mini/rev1_001/config.h b/keyboards/ploopyco/trackball_mini/rev1_001/config.h
index 3f5941decc..06720b8fdf 100644
--- a/keyboards/ploopyco/trackball_mini/rev1_001/config.h
+++ b/keyboards/ploopyco/trackball_mini/rev1_001/config.h
@@ -31,7 +31,7 @@
*/
#define DIRECT_PINS \
{ \
- { D4, D2, E6, D7, B6 } \
+ { D4, D2, E6, B6, D7 } \
}
// These pins are not broken out, and cannot be used normally.
diff --git a/keyboards/ploopyco/trackball_mini/rev1_002/config.h b/keyboards/ploopyco/trackball_mini/rev1_002/config.h
new file mode 100644
index 0000000000..06720b8fdf
--- /dev/null
+++ b/keyboards/ploopyco/trackball_mini/rev1_002/config.h
@@ -0,0 +1,40 @@
+/* Copyright 2021 Colin Lam (Ploopy Corporation)
+ * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ * Copyright 2019 Sunjun Kim
+ * Copyright 2019 Hiroyuki Okada
+ *
+ * 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
+
+/*
+ * Keyboard Matrix Assignments
+ *
+ * Change this to how you wired your keyboard
+ * COLS: AVR pins used for columns, left to right
+ * ROWS: AVR pins used for rows, top to bottom
+ * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
+ * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
+ *
+ */
+#define DIRECT_PINS \
+ { \
+ { D4, D2, E6, B6, D7 } \
+ }
+
+// These pins are not broken out, and cannot be used normally.
+// They are set as output and pulled high, by default
+#define UNUSED_PINS \
+ { B5, C7, D0, D1, D3, D5, D6, F1, F3, F5, F6, F7 }
diff --git a/keyboards/ploopyco/trackball_mini/rev1_002/readme.md b/keyboards/ploopyco/trackball_mini/rev1_002/readme.md
new file mode 100644
index 0000000000..e8a5a918e4
--- /dev/null
+++ b/keyboards/ploopyco/trackball_mini/rev1_002/readme.md
@@ -0,0 +1 @@
+See the main readme for more details. This is just here for when future revisions are released.
diff --git a/keyboards/ploopyco/trackball_mini/rev1_002/rev1_002.h b/keyboards/ploopyco/trackball_mini/rev1_002/rev1_002.h
new file mode 100644
index 0000000000..4f34e17dd4
--- /dev/null
+++ b/keyboards/ploopyco/trackball_mini/rev1_002/rev1_002.h
@@ -0,0 +1,22 @@
+/* Copyright 2021 Colin Lam (Ploopy Corporation)
+ * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ * Copyright 2019 Sunjun Kim
+ * Copyright 2019 Hiroyuki Okada
+ *
+ * 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 "trackball_mini.h"
diff --git a/keyboards/ploopyco/trackball_mini/rev1_002/rules.mk b/keyboards/ploopyco/trackball_mini/rev1_002/rules.mk
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/keyboards/ploopyco/trackball_mini/rev1_002/rules.mk
diff --git a/keyboards/ploopyco/trackball_mini/trackball_mini.c b/keyboards/ploopyco/trackball_mini/trackball_mini.c
index d6eb61a2b2..996c00b22a 100644
--- a/keyboards/ploopyco/trackball_mini/trackball_mini.c
+++ b/keyboards/ploopyco/trackball_mini/trackball_mini.c
@@ -18,6 +18,8 @@
*/
#include "trackball_mini.h"
+#include "wait.h"
+#include "debug.h"
#ifndef OPT_DEBOUNCE
# define OPT_DEBOUNCE 5 // (ms) Time between scroll events
@@ -35,16 +37,8 @@
# define OPT_SCALE 1 // Multiplier for wheel
#endif
-#ifndef PLOOPY_DPI_OPTIONS
-# define PLOOPY_DPI_OPTIONS { CPI375, CPI750, CPI1375 }
-# ifndef PLOOPY_DPI_DEFAULT
-# define PLOOPY_DPI_DEFAULT 2
-# endif
-#endif
-
-#ifndef PLOOPY_DPI_DEFAULT
-# define PLOOPY_DPI_DEFAULT 1
-#endif
+#define PLOOPY_DPI_OPTIONS { CPI375, CPI750, CPI1375 }
+#define PLOOPY_DPI_DEFAULT 2
// Transformation constants for delta-X and delta-Y
const static float ADNS_X_TRANSFORM = -1.0;
@@ -173,7 +167,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
void keyboard_pre_init_kb(void) {
// debug_enable = true;
// debug_matrix = true;
- debug_mouse = true;
+ // debug_mouse = true;
// debug_encoder = true;
setPinInput(OPT_ENC1);
@@ -198,6 +192,22 @@ void keyboard_pre_init_kb(void) {
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) {
@@ -223,9 +233,3 @@ void matrix_init_kb(void) {
}
matrix_init_user();
}
-
-void keyboard_post_init_kb(void) {
- adns_set_cpi(dpi_array[keyboard_config.dpi_config]);
-
- keyboard_post_init_user();
-}