summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/sensors/adns5050.c2
-rw-r--r--keyboards/ploopyco/trackball/readme.md2
-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
-rw-r--r--keyboards/ploopyco/trackball_nano/trackball_nano.c27
10 files changed, 111 insertions, 33 deletions
diff --git a/drivers/sensors/adns5050.c b/drivers/sensors/adns5050.c
index 3c4f5e258a..e7273977d5 100644
--- a/drivers/sensors/adns5050.c
+++ b/drivers/sensors/adns5050.c
@@ -138,7 +138,7 @@ uint8_t adns_read_reg(uint8_t reg_addr) {
void adns_write_reg(uint8_t reg_addr, uint8_t data) {
adns_cs_select();
- adns_serial_write(reg_addr);
+ adns_serial_write( 0b10000000 | reg_addr );
adns_serial_write(data);
adns_cs_deselect();
}
diff --git a/keyboards/ploopyco/trackball/readme.md b/keyboards/ploopyco/trackball/readme.md
index f34bbac307..7792c0cc59 100644
--- a/keyboards/ploopyco/trackball/readme.md
+++ b/keyboards/ploopyco/trackball/readme.md
@@ -19,7 +19,7 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to
## Revisions
-There are two main revisions for the PloopyCo Tracball, everything up to 1.004, and 1.005.
+There are two main revisions for the PloopyCo Tracball, everything up to 1.004, and 1.005-1.006.
In the 1.005 revision, button for was changed from pin B5 to B6, and the debug LED pin was changed from F7 to B5.
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();
-}
diff --git a/keyboards/ploopyco/trackball_nano/trackball_nano.c b/keyboards/ploopyco/trackball_nano/trackball_nano.c
index 17cdedac7a..9bcfa59ef8 100644
--- a/keyboards/ploopyco/trackball_nano/trackball_nano.c
+++ b/keyboards/ploopyco/trackball_nano/trackball_nano.c
@@ -18,6 +18,7 @@
*/
#include "trackball_nano.h"
+#include "wait.h"
#ifndef OPT_DEBOUNCE
# define OPT_DEBOUNCE 5 // (ms) Time between scroll events
@@ -43,7 +44,7 @@
#endif
#ifndef PLOOPY_DPI_DEFAULT
-# define PLOOPY_DPI_DEFAULT 1
+# define PLOOPY_DPI_DEFAULT 2
#endif
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { };
@@ -139,7 +140,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);
@@ -164,6 +165,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) {
@@ -188,9 +205,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();
-}