summaryrefslogtreecommitdiff
path: root/keyboards/ploopyco/trackball_nano
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_nano
parent6901411bca0760ceb8acbe1f0c95feaed9d2aaeb (diff)
parenteba3d68394ba7bdd15836c0f4f4bb3c44b4e1f91 (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'keyboards/ploopyco/trackball_nano')
-rw-r--r--keyboards/ploopyco/trackball_nano/trackball_nano.c27
1 files changed, 19 insertions, 8 deletions
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();
-}