summaryrefslogtreecommitdiff
path: root/keyboards/ploopyco/trackball_nano
diff options
context:
space:
mode:
authorploopyco <54917504+ploopyco@users.noreply.github.com>2021-06-21 15:59:56 -0400
committerGitHub <noreply@github.com>2021-06-21 20:59:56 +0100
commiteba3d68394ba7bdd15836c0f4f4bb3c44b4e1f91 (patch)
tree739bd84bbd19837a08dc59bfc88e98f87ecadafc /keyboards/ploopyco/trackball_nano
parent224dcac08fe65cd4b4ab275cac4aea1379c3528c (diff)
downloadqmk_firmware-eba3d68394ba7bdd15836c0f4f4bb3c44b4e1f91.tar.gz
qmk_firmware-eba3d68394ba7bdd15836c0f4f4bb3c44b4e1f91.zip
Fixes for Ploopy devices (#13144)
Co-authored-by: Drashna Jael're <drashna@live.com>
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();
-}