diff options
author | Drashna Jaelre <drashna@live.com> | 2022-01-20 09:23:16 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-20 09:23:16 -0800 |
commit | 6ebb44f17e7bb3df8492c6498289a44c01c59277 (patch) | |
tree | 2eb8843cf5bfee953b4aa714b8dc6847a679cc27 /drivers/sensors | |
parent | 24324378a8ab070775d4e5361d6ce3f9f903c395 (diff) | |
download | qmk_firmware-6ebb44f17e7bb3df8492c6498289a44c01c59277.tar.gz qmk_firmware-6ebb44f17e7bb3df8492c6498289a44c01c59277.zip |
[Bug][Core] Fix optical sensor firmware upload (#15919)
Diffstat (limited to 'drivers/sensors')
-rw-r--r-- | drivers/sensors/adns9800.c | 6 | ||||
-rw-r--r-- | drivers/sensors/adns9800_srom_A6.h | 2 | ||||
-rw-r--r-- | drivers/sensors/pmw3360.c | 12 | ||||
-rw-r--r-- | drivers/sensors/pmw3389.c | 10 |
4 files changed, 11 insertions, 19 deletions
diff --git a/drivers/sensors/adns9800.c b/drivers/sensors/adns9800.c index 425cf9912f..d167841968 100644 --- a/drivers/sensors/adns9800.c +++ b/drivers/sensors/adns9800.c @@ -135,10 +135,8 @@ void adns9800_init() { wait_us(15); // send all bytes of the firmware - unsigned char c; - for (int i = 0; i < FIRMWARE_LENGTH; i++) { - c = (unsigned char)pgm_read_byte(adns9800_firmware_data + i); - spi_write(c); + for (uint16_t i = 0; i < FIRMWARE_LENGTH; i++) { + spi_write(pgm_read_byte(firmware_data + i)); wait_us(15); } diff --git a/drivers/sensors/adns9800_srom_A6.h b/drivers/sensors/adns9800_srom_A6.h index d86ecbbd9e..e698a401b9 100644 --- a/drivers/sensors/adns9800_srom_A6.h +++ b/drivers/sensors/adns9800_srom_A6.h @@ -6,7 +6,7 @@ // clang-format off -const uint8_t adns9800_firmware_data[FIRMWARE_LENGTH] PROGMEM = { +const uint8_t firmware_data[FIRMWARE_LENGTH] PROGMEM = { 0x03, 0xA6, 0x68, 0x1E, 0x7D, 0x10, 0x7E, 0x7E, 0x5F, 0x1C, 0xB8, 0xF2, 0x47, 0x0C, 0x7B, 0x74, 0x4B, 0x14, 0x8B, 0x75, 0x66, 0x51, 0x0B, 0x8C, 0x76, 0x74, 0x4B, 0x14, 0xAA, 0xD6, 0x0F, 0x9C, 0xBA, 0xF6, 0x6E, 0x3F, 0xDD, 0x38, 0xD5, 0x02, 0x80, 0x9B, 0x82, 0x6D, 0x58, 0x13, 0xA4, 0xAB, diff --git a/drivers/sensors/pmw3360.c b/drivers/sensors/pmw3360.c index 0dac600cc2..8d1b08e22b 100644 --- a/drivers/sensors/pmw3360.c +++ b/drivers/sensors/pmw3360.c @@ -206,16 +206,12 @@ void pmw3360_upload_firmware(void) { spi_write(REG_SROM_Load_Burst | 0x80); wait_us(15); -#ifdef PMW3360_LEGACY_FIRMWARE_UPLOAD - 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 PMW3360_FIRMWARE_UPLOAD_FAST wait_us(15); - } -#else - spi_transmit(firmware_data, sizeof(firmware_data)); #endif + } wait_us(200); pmw3360_read(REG_SROM_ID); 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); |