Skip to content

Commit

Permalink
AP_HAL_ChibiOS: cope with different IMU drivers in hwdef conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per authored and tridge committed Sep 6, 2023
1 parent 2e0eef2 commit ee8631e
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ee8631e

Please sign in to comment.