AP_HAL_ChibiOS: cope with different IMU drivers in hwdef conversion

This commit is contained in:
Andy Piper 2023-08-31 16:46:34 +01:00 committed by Randy Mackay
parent 7ef9f7e581
commit 1e9ff09a57
1 changed files with 19 additions and 2 deletions

View File

@ -106,8 +106,25 @@ def write_imu_config(f, n):
f.write('''
# IMU setup
SPIDEV imu%s SPI%s DEVID1 GYRO%s_CS MODE3 1*MHZ 8*MHZ
IMU Invensense SPI:imu%s %s
''' % (n, bus, n, n, alignment[align]))
''' % (n, bus, n))
c = 0
for define in defines:
for imudefine in ['USE_GYRO_SPI_', 'USE_ACCGYRO_']:
if define.startswith(imudefine):
imu = define[len(imudefine):]
c = c + 1
if c == int(n):
if imu == 'ICM42688P':
imudriver = 'Invensensev3'
elif imu == 'BMI270':
imudriver = 'BMI270'
else:
imudriver = 'Invensense'
f.write('''
IMU %s SPI:imu%s %s
''' % (imudriver, n, alignment[align]))
dma = "SPI" + bus + "*"
dma_noshare[dma] = dma