Format code according to conventions (#16322)
This commit is contained in:
parent
afcdd7079c
commit
63646e8906
345 changed files with 4916 additions and 3229 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue