mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-21 19:09:25 +00:00
Fix ADNS-9800 read (#24406)
This commit is contained in:
parent
42f1763db9
commit
1c03574424
@ -73,6 +73,7 @@
|
|||||||
#define CLAMP_CPI(value) value<MIN_CPI ? MIN_CPI : value> MAX_CPI ? MAX_CPI : value
|
#define CLAMP_CPI(value) value<MIN_CPI ? MIN_CPI : value> MAX_CPI ? MAX_CPI : value
|
||||||
#define US_BETWEEN_WRITES 120
|
#define US_BETWEEN_WRITES 120
|
||||||
#define US_BETWEEN_READS 20
|
#define US_BETWEEN_READS 20
|
||||||
|
#define US_DELAY_AFTER_ADDR 100
|
||||||
#define US_BEFORE_MOTION 100
|
#define US_BEFORE_MOTION 100
|
||||||
#define MSB1 0x80
|
#define MSB1 0x80
|
||||||
// clang-format on
|
// clang-format on
|
||||||
@ -92,6 +93,7 @@ void adns9800_write(uint8_t reg_addr, uint8_t data) {
|
|||||||
uint8_t adns9800_read(uint8_t reg_addr) {
|
uint8_t adns9800_read(uint8_t reg_addr) {
|
||||||
adns9800_spi_start();
|
adns9800_spi_start();
|
||||||
spi_write(reg_addr & 0x7f);
|
spi_write(reg_addr & 0x7f);
|
||||||
|
wait_us(US_DELAY_AFTER_ADDR);
|
||||||
uint8_t data = spi_read();
|
uint8_t data = spi_read();
|
||||||
spi_stop();
|
spi_stop();
|
||||||
wait_us(US_BETWEEN_READS);
|
wait_us(US_BETWEEN_READS);
|
||||||
|
Loading…
Reference in New Issue
Block a user