From 8c7b1d7a80f27709432b873fc0a51dfb44906eeb Mon Sep 17 00:00:00 2001 From: Charly Delay <0xcharly@users.noreply.github.com> Date: Fri, 28 Jan 2022 16:42:39 +0900 Subject: [PATCH] Merge 2 PR to improve blackpill boot time - #15805: [Core] ChibiOS: shorten USB disconnect state on boot to 50ms - #15821: Optimize initialization of PMW3360 Sensor --- drivers/sensors/pmw3360.c | 7 +------ tmk_core/protocol/chibios/usb_main.c | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/sensors/pmw3360.c b/drivers/sensors/pmw3360.c index 50d1c3580185..35e7b2f69a7e 100644 --- a/drivers/sensors/pmw3360.c +++ b/drivers/sensors/pmw3360.c @@ -206,12 +206,7 @@ void pmw3360_upload_firmware(void) { spi_write(REG_SROM_Load_Burst | 0x80); wait_us(15); - unsigned char c; - for (int i = 0; i < FIRMWARE_LENGTH; i++) { - c = (unsigned char)pgm_read_byte(firmware_data + i); - spi_write(c); - wait_us(15); - } + spi_transmit(firmware_data, sizeof(firmware_data)); wait_us(200); spi_read_adv(REG_SROM_ID); diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index ac46a9312b49..541c44b574e2 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -734,7 +734,7 @@ void init_usb_driver(USBDriver *usbp) { * after a reset. */ usbDisconnectBus(usbp); - wait_ms(1500); + wait_ms(50); usbStart(usbp, &usbcfg); usbConnectBus(usbp);