mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-22 08:27:56 +06:00
Change ADNS9800 and PMW33XX SROM uploads to opt in. (#24001)
Make SROM upload optional
This commit is contained in:
parent
276ecd4693
commit
a7aa58cc81
|
@ -115,6 +115,7 @@ void adns9800_init(void) {
|
||||||
adns9800_read(REG_Delta_Y_L);
|
adns9800_read(REG_Delta_Y_L);
|
||||||
adns9800_read(REG_Delta_Y_H);
|
adns9800_read(REG_Delta_Y_H);
|
||||||
|
|
||||||
|
#ifdef ADNS9800_UPLOAD_SROM
|
||||||
// upload firmware
|
// upload firmware
|
||||||
|
|
||||||
// 3k firmware mode
|
// 3k firmware mode
|
||||||
|
@ -145,6 +146,16 @@ void adns9800_init(void) {
|
||||||
spi_stop();
|
spi_stop();
|
||||||
|
|
||||||
wait_ms(10);
|
wait_ms(10);
|
||||||
|
#else
|
||||||
|
// write reset value to REG_Configuration_IV
|
||||||
|
adns9800_write(REG_Configuration_IV, 0x0);
|
||||||
|
|
||||||
|
// write reset value to REG_SROM_Enable
|
||||||
|
adns9800_write(REG_SROM_Enable, 0x0);
|
||||||
|
|
||||||
|
// wait a frame
|
||||||
|
wait_ms(10);
|
||||||
|
#endif
|
||||||
|
|
||||||
// enable laser
|
// enable laser
|
||||||
uint8_t laser_ctrl0 = adns9800_read(REG_LASER_CTRL0);
|
uint8_t laser_ctrl0 = adns9800_read(REG_LASER_CTRL0);
|
||||||
|
|
|
@ -154,10 +154,12 @@ bool pmw33xx_init(uint8_t sensor) {
|
||||||
pmw33xx_read(sensor, REG_Delta_Y_L);
|
pmw33xx_read(sensor, REG_Delta_Y_L);
|
||||||
pmw33xx_read(sensor, REG_Delta_Y_H);
|
pmw33xx_read(sensor, REG_Delta_Y_H);
|
||||||
|
|
||||||
|
#ifdef PMW33XX_UPLOAD_SROM
|
||||||
if (!pmw33xx_upload_firmware(sensor)) {
|
if (!pmw33xx_upload_firmware(sensor)) {
|
||||||
pd_dprintf("PMW33XX (%d): firmware upload failed!\n", sensor);
|
pd_dprintf("PMW33XX (%d): firmware upload failed!\n", sensor);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
spi_stop();
|
spi_stop();
|
||||||
|
|
||||||
|
@ -200,7 +202,7 @@ pmw33xx_report_t pmw33xx_read_burst(uint8_t sensor) {
|
||||||
spi_write(REG_Motion_Burst);
|
spi_write(REG_Motion_Burst);
|
||||||
wait_us(35); // waits for tSRAD_MOTBR
|
wait_us(35); // waits for tSRAD_MOTBR
|
||||||
|
|
||||||
spi_receive((uint8_t*)&report, sizeof(report));
|
spi_receive((uint8_t *)&report, sizeof(report));
|
||||||
|
|
||||||
// panic recovery, sometimes burst mode works weird.
|
// panic recovery, sometimes burst mode works weird.
|
||||||
if (report.motion.w & 0b111) {
|
if (report.motion.w & 0b111) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user