diff options
author | QMK Bot <hello@qmk.fm> | 2022-02-12 10:29:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 18:29:31 +0000 |
commit | 63646e8906e062d1c1de3925cba70c4e3426a855 (patch) | |
tree | 4e91648b77b838e1125cf86331d7e84bde6d07a9 /drivers/sensors/pmw3360.c | |
parent | afcdd7079c774dec2aa4b7f2d08adf8b7310919b (diff) | |
download | qmk_firmware-63646e8906e062d1c1de3925cba70c4e3426a855.tar.gz qmk_firmware-63646e8906e062d1c1de3925cba70c4e3426a855.zip |
Format code according to conventions (#16322)
Diffstat (limited to 'drivers/sensors/pmw3360.c')
-rw-r--r-- | drivers/sensors/pmw3360.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/sensors/pmw3360.c b/drivers/sensors/pmw3360.c index 8d1b08e22b..8c977be1c8 100644 --- a/drivers/sensors/pmw3360.c +++ b/drivers/sensors/pmw3360.c @@ -86,7 +86,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))) @@ -144,7 +146,7 @@ bool pmw3360_init(void) { pmw3360_spi_start(); spi_stop(); - pmw3360_write(REG_Shutdown, 0xb6); // Shutdown first + pmw3360_write(REG_Shutdown, 0xb6); // Shutdown first wait_ms(300); pmw3360_spi_start(); @@ -222,7 +224,7 @@ bool pmw3360_check_signature(void) { uint8_t pid = pmw3360_read(REG_Product_ID); uint8_t iv_pid = pmw3360_read(REG_Inverse_Product_ID); uint8_t SROM_ver = pmw3360_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 pmw3360_get_cpi(void) { @@ -248,17 +250,17 @@ report_pmw3360_t pmw3360_read_burst(void) { pmw3360_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; } |