diff options
Diffstat (limited to 'drivers/sensors/pmw3389.c')
-rw-r--r-- | drivers/sensors/pmw3389.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/sensors/pmw3389.c b/drivers/sensors/pmw3389.c index 963925bd38..828dafa134 100644 --- a/drivers/sensors/pmw3389.c +++ b/drivers/sensors/pmw3389.c @@ -90,7 +90,9 @@ bool _inBurst = false; #ifdef CONSOLE_ENABLE -void print_byte(uint8_t byte) { dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); } +void print_byte(uint8_t byte) { + dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); +} #endif #define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt))) @@ -148,7 +150,7 @@ bool pmw3389_init(void) { pmw3389_spi_start(); spi_stop(); - pmw3389_write(REG_Shutdown, 0xb6); // Shutdown first + pmw3389_write(REG_Shutdown, 0xb6); // Shutdown first wait_ms(300); pmw3389_spi_start(); @@ -226,7 +228,7 @@ bool pmw3389_check_signature(void) { uint8_t pid = pmw3389_read(REG_Product_ID); uint8_t iv_pid = pmw3389_read(REG_Inverse_Product_ID); uint8_t SROM_ver = pmw3389_read(REG_SROM_ID); - return (pid == firmware_signature[0] && iv_pid == firmware_signature[1] && SROM_ver == firmware_signature[2]); // signature for SROM 0x04 + return (pid == firmware_signature[0] && iv_pid == firmware_signature[1] && SROM_ver == firmware_signature[2]); // signature for SROM 0x04 } uint16_t pmw3389_get_cpi(void) { @@ -254,17 +256,17 @@ report_pmw3389_t pmw3389_read_burst(void) { pmw3389_spi_start(); spi_write(REG_Motion_Burst); - wait_us(35); // waits for tSRAD_MOTBR + wait_us(35); // waits for tSRAD_MOTBR report.motion = spi_read(); - spi_read(); // skip Observation + spi_read(); // skip Observation // delta registers report.dx = spi_read(); report.mdx = spi_read(); report.dy = spi_read(); report.mdy = spi_read(); - if (report.motion & 0b111) { // panic recovery, sometimes burst mode works weird. + if (report.motion & 0b111) { // panic recovery, sometimes burst mode works weird. _inBurst = false; } |