AP_HAL_ChibiOS: provide complete ADC2/ADC3 maps for STM32H750 and STM32H743

Fix dummy pin generation
This commit is contained in:
Andy Piper 2023-04-26 15:17:41 +01:00 committed by Andrew Tridgell
parent d04f8fe655
commit e6c1897dd3
3 changed files with 80 additions and 12 deletions

View File

@ -1297,3 +1297,39 @@ ADC1_map = {
"PA4" : 18,
"PA5" : 19,
}
ADC2_map = {
"PF13" : 2,
"PA6" : 3,
"PC4" : 4,
"PB1" : 5,
"PF14" : 6,
"PA7" : 7,
"PC5" : 8,
"PB0" : 9,
"PC0" : 10,
"PC1" : 11,
"PC2" : 12,
"PC3" : 13,
"PA2" : 14,
"PA3" : 15,
"N/A" : 16,
"N/A" : 17,
"PA4" : 18,
"PA5" : 19,
}
ADC3_map = {
"PF9" : 2,
"PF7" : 3,
"PF5" : 4,
"PF3" : 5,
"PF10" : 6,
"PF8" : 7,
"PF6" : 8,
"PF4" : 9,
"PH2" : 13,
"PH3" : 14,
"PH4" : 15,
"PH5" : 16,
}

View File

@ -1148,3 +1148,39 @@ ADC1_map = {
"PA4" : 18,
"PA5" : 19,
}
ADC2_map = {
"PF13" : 2,
"PA6" : 3,
"PC4" : 4,
"PB1" : 5,
"PF14" : 6,
"PA7" : 7,
"PC5" : 8,
"PB0" : 9,
"PC0" : 10,
"PC1" : 11,
"PC2" : 12,
"PC3" : 13,
"PA2" : 14,
"PA3" : 15,
"N/A" : 16,
"N/A" : 17,
"PA4" : 18,
"PA5" : 19,
}
ADC3_map = {
"PF9" : 2,
"PF7" : 3,
"PF5" : 4,
"PF3" : 5,
"PF10" : 6,
"PF8" : 7,
"PF6" : 8,
"PF4" : 9,
"PH2" : 13,
"PH3" : 14,
"PH4" : 15,
"PH5" : 16,
}

View File

@ -2267,18 +2267,14 @@ def write_ADC_config(f):
if len(adc_chans[1]) > 0:
# ensure ADC1 and ADC2 are of same size
if len(adc_chans[0]) > len(adc_chans[1]):
# add dummy channel that's not already in adc_chans[1]
for chan in range(1,19):
if chan not in [c[0] for c in adc_chans[1]]:
adc_chans[1].append((chan, 255, None, 'dummy', 'dummy'))
break
elif len(adc_chans[0]) < len(adc_chans[1]):
# add dummy channel that's not already in adc_chans[0]
for chan in range(1,19):
if chan not in [c[0] for c in adc_chans[0]]:
adc_chans[0].append((chan, 255, None, 'dummy', 'dummy'))
break
# add dummy channels that are not already in adc_chans[1]
for chan in [c[0] for c in adc_chans[0]]:
if chan not in [c[0] for c in adc_chans[1]]:
adc_chans[1].append((chan, 255, None, 'dummy', 'dummy'))
# add dummy channels that are not already in adc_chans[0]
for chan in [c[0] for c in adc_chans[1]]:
if chan not in [c[0] for c in adc_chans[0]]:
adc_chans[0].append((chan, 255, None, 'dummy', 'dummy'))
# check if ADC1 and ADC2 list if they have the same channel for same index
# if not then jumble the channels around to have no matching channels
for i in range(len(adc_chans[0])):