AP_HAL_ChibiOS: fix mode setting for ICM45686 on CubeOrangePlus

This commit is contained in:
bugobliterator 2023-10-13 15:26:56 +11:00 committed by Randy Mackay
parent 39ee1e0af9
commit 77e6572592
2 changed files with 12 additions and 10 deletions

View File

@ -48,9 +48,9 @@ SPIDEV icm42688_ext SPI4 DEVID4 ACCEL_EXT_CS MODE3 2*MHZ 8*MHZ
SPIDEV icm42688_ext2 SPI4 DEVID5 GYRO_EXT_CS MODE3 2*MHZ 8*MHZ
#IMU 2
SPIDEV icm45686 SPI1 DEVID4 ICM45686_CS MODE1 2*MHZ 8*MHZ
SPIDEV icm45686 SPI1 DEVID4 ICM45686_CS MODE0 2*MHZ 8*MHZ
SPIDEV icm20649 SPI1 DEVID4 MPU_CS MODE3 4*MHZ 8*MHZ
SPIDEV icm45686_aux SPI1 DEVID4 ICM45686_CS MODE1 2*MHZ 8*MHZ
SPIDEV icm45686_aux SPI1 DEVID4 ICM45686_CS MODE0 2*MHZ 8*MHZ
SPIDEV icm20948_aux SPI4 DEVID1 MPU_EXT_CS MODE3 4*MHZ 8*MHZ
# INSTANCE:<num> keyword is used to denote the instance number of the sensor

View File

@ -1403,26 +1403,28 @@ def write_SPI_table(f):
f.write("\n")
def write_SPI_config(self, f):
def write_SPI_config(f):
'''write SPI config defines'''
for t in list(self.bytype.keys()) + list(self.alttype.keys()):
global spi_list
for t in list(bytype.keys()) + list(alttype.keys()):
if t.startswith('SPI'):
self.spi_list.append(t)
self.spi_list = sorted(self.spi_list)
if len(self.spi_list) == 0:
spi_list.append(t)
spi_list = sorted(spi_list)
if len(spi_list) == 0:
f.write('#define HAL_USE_SPI FALSE\n')
return
devlist = []
for dev in self.spi_list:
for dev in spi_list:
n = int(dev[3:])
devlist.append('HAL_SPI%u_CONFIG' % n)
sck_pin = self.bylabel['SPI%s_SCK' % n]
sck_pin = bylabel['SPI%s_SCK' % n]
sck_line = 'PAL_LINE(GPIO%s,%uU)' % (sck_pin.port, sck_pin.pin)
f.write(
'#define HAL_SPI%u_CONFIG { &SPID%u, %u, STM32_SPI_SPI%u_DMA_STREAMS, %s }\n'
% (n, n, n, n, sck_line))
f.write('#define HAL_SPI_BUS_LIST %s\n\n' % ','.join(devlist))
self.write_SPI_table(f)
write_SPI_table(f)
def write_QSPI_table(f):
'''write SPI device table'''