1
0
Fork 0

Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
QMK Bot 2021-06-21 20:00:32 +00:00
commit e28d7ab58c
10 changed files with 111 additions and 33 deletions

View file

@ -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();
}