summaryrefslogtreecommitdiffstats
path: root/drivers/sensors/pmw3389.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2022-01-20 09:23:16 -0800
committerGitHub <noreply@github.com>2022-01-20 09:23:16 -0800
commit6ebb44f17e7bb3df8492c6498289a44c01c59277 (patch)
tree2eb8843cf5bfee953b4aa714b8dc6847a679cc27 /drivers/sensors/pmw3389.c
parent24324378a8ab070775d4e5361d6ce3f9f903c395 (diff)
[Bug][Core] Fix optical sensor firmware upload (#15919)
Diffstat (limited to 'drivers/sensors/pmw3389.c')
-rw-r--r--drivers/sensors/pmw3389.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/sensors/pmw3389.c b/drivers/sensors/pmw3389.c
index d6f02b6a59..963925bd38 100644
--- a/drivers/sensors/pmw3389.c
+++ b/drivers/sensors/pmw3389.c
@@ -210,14 +210,12 @@ void pmw3389_upload_firmware(void) {
spi_write(REG_SROM_Load_Burst | 0x80);
wait_us(15);
- // legacy only for PMW3389 spi_transmit failed to load firmware
- unsigned char c;
- for (int i = 0; i < FIRMWARE_LENGTH; i++) {
- c = (unsigned char)pgm_read_byte(firmware_data + i);
- spi_write(c);
+ for (uint16_t i = 0; i < FIRMWARE_LENGTH; i++) {
+ spi_write(pgm_read_byte(firmware_data + i));
+#ifndef PMW3389_FIRMWARE_UPLOAD_FAST
wait_us(15);
+#endif
}
-
wait_us(200);
pmw3389_read(REG_SROM_ID);