Remove binary blobs from optical sensors. (#24428)
* remove pmw srom * remove adns9800 srom * Update drivers/sensors/pmw33xx_common.c
This commit is contained in:
parent
3d8cebb1a0
commit
43e82ed5c7
6 changed files with 64 additions and 792 deletions
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
|
||||
#include "spi_master.h"
|
||||
#include "adns9800_srom_A6.h"
|
||||
#include "adns9800.h"
|
||||
#include "wait.h"
|
||||
|
||||
|
@ -78,6 +77,14 @@
|
|||
#define MSB1 0x80
|
||||
// clang-format on
|
||||
|
||||
uint16_t __attribute__((weak)) adns9800_srom_get_length(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t __attribute__((weak)) adns9800_srom_get_byte(uint16_t position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void adns9800_spi_start(void) {
|
||||
spi_start(ADNS9800_CS_PIN, false, ADNS9800_SPI_MODE, ADNS9800_SPI_DIVISOR);
|
||||
}
|
||||
|
@ -117,48 +124,48 @@ void adns9800_init(void) {
|
|||
adns9800_read(REG_Delta_Y_L);
|
||||
adns9800_read(REG_Delta_Y_H);
|
||||
|
||||
#ifdef ADNS9800_UPLOAD_SROM
|
||||
// upload firmware
|
||||
if (adns9800_srom_get_length() != 0) {
|
||||
// upload firmware
|
||||
|
||||
// 3k firmware mode
|
||||
adns9800_write(REG_Configuration_IV, 0x02);
|
||||
// 3k firmware mode
|
||||
adns9800_write(REG_Configuration_IV, 0x02);
|
||||
|
||||
// enable initialisation
|
||||
adns9800_write(REG_SROM_Enable, 0x1d);
|
||||
// enable initialisation
|
||||
adns9800_write(REG_SROM_Enable, 0x1d);
|
||||
|
||||
// wait a frame
|
||||
wait_ms(10);
|
||||
// wait a frame
|
||||
wait_ms(10);
|
||||
|
||||
// start SROM download
|
||||
adns9800_write(REG_SROM_Enable, 0x18);
|
||||
// start SROM download
|
||||
adns9800_write(REG_SROM_Enable, 0x18);
|
||||
|
||||
// write the SROM file
|
||||
// write the SROM file
|
||||
|
||||
adns9800_spi_start();
|
||||
adns9800_spi_start();
|
||||
|
||||
spi_write(REG_SROM_Load_Burst | 0x80);
|
||||
wait_us(15);
|
||||
|
||||
// send all bytes of the firmware
|
||||
for (uint16_t i = 0; i < FIRMWARE_LENGTH; i++) {
|
||||
spi_write(pgm_read_byte(firmware_data + i));
|
||||
spi_write(REG_SROM_Load_Burst | 0x80);
|
||||
wait_us(15);
|
||||
|
||||
// send all bytes of the firmware
|
||||
for (uint16_t i = 0; i < adns9800_srom_get_length(); i++) {
|
||||
spi_write(adns9800_srom_get_byte(i));
|
||||
wait_us(15);
|
||||
}
|
||||
|
||||
spi_stop();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
spi_stop();
|
||||
|
||||
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
|
||||
uint8_t laser_ctrl0 = adns9800_read(REG_LASER_CTRL0);
|
||||
adns9800_write(REG_LASER_CTRL0, laser_ctrl0 & 0xf0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue