Skip to content

Commit f14ce30

Browse files
committed
script: STM32: STM32_gen_PeripheralPins.py updated
Removed INN channel ADC
1 parent d83494f commit f14ce30

File tree

1 file changed

+36
-35
lines changed

1 file changed

+36
-35
lines changed

targets/TARGET_STM/tools/STM32_gen_PeripheralPins.py

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from argparse import RawTextHelpFormatter
2828
import subprocess
2929

30-
GENPINMAP_VERSION = "1.20.1"
30+
GENPINMAP_VERSION = "1.20.2"
3131

3232
ADD_DEVICE_IF = 0
3333
ADD_GPIO_PINMAP = 0
@@ -267,7 +267,9 @@ def store_pin(pin, name, functionality):
267267

268268
# function to store ADC list
269269
def store_adc(pin, name, signal):
270-
adclist.append([pin, name, signal])
270+
#INN channels not supported in mbed
271+
if("IN" in signal and "INN" not in signal):
272+
adclist.append([pin, name, signal])
271273

272274

273275
# function to store DAC list
@@ -680,41 +682,40 @@ def print_adc():
680682
prev_p = ''
681683
alt_index = 0
682684
for parsed_pin in adclist:
683-
if "IN" in parsed_pin[2]:
684-
commented_line = " "
685-
if parsed_pin[1] in PinLabel:
686-
if "STDIO_UART" in PinLabel[parsed_pin[1]]:
687-
commented_line = "//"
688-
if "RCC_OSC" in PinLabel[parsed_pin[1]]:
689-
commented_line = "//"
690-
if commented_line != "//":
691-
if parsed_pin[0] == prev_p:
692-
if "STM32F1" in mcu_file:
693-
continue
694-
else:
695-
prev_p = parsed_pin[0]
696-
parsed_pin[0] += '_ALT%d' % alt_index
697-
store_pin(parsed_pin[0], parsed_pin[0], "")
698-
alt_index += 1
699-
if alt_index > ALTERNATE_DEFINITION:
700-
ALTERNATE_DEFINITION += 1
685+
commented_line = " "
686+
if parsed_pin[1] in PinLabel:
687+
if "STDIO_UART" in PinLabel[parsed_pin[1]]:
688+
commented_line = "//"
689+
if "RCC_OSC" in PinLabel[parsed_pin[1]]:
690+
commented_line = "//"
691+
if commented_line != "//":
692+
if parsed_pin[0] == prev_p:
693+
if "STM32F1" in mcu_file:
694+
continue
701695
else:
702696
prev_p = parsed_pin[0]
703-
alt_index = 0
704-
line_to_write = "%-17s" % (commented_line + " {" + parsed_pin[0] + ',')
705-
a = parsed_pin[2].split('_')
706-
inst = a[0].replace("ADC", "")
707-
if len(inst) == 0:
708-
inst = '1' #single ADC for this product
709-
line_to_write += "%-7s" % ('ADC_' + inst + ',')
710-
chan = re.sub(r"^IN[N|P]?|\D*$", "", a[1])
711-
bank = "_ADC_CHANNEL_BANK_B" if a[1].endswith("b") else ""
712-
line_to_write += s_pin_data + bank + ", GPIO_NOPULL, 0, " + chan
713-
line_to_write += ', 0)}, // ' + parsed_pin[2]
714-
if parsed_pin[1] in PinLabel:
715-
line_to_write += ' // Connected to ' + PinLabel[parsed_pin[1]]
716-
line_to_write += '\n'
717-
out_c_file.write(line_to_write)
697+
parsed_pin[0] += '_ALT%d' % alt_index
698+
store_pin(parsed_pin[0], parsed_pin[0], "")
699+
alt_index += 1
700+
if alt_index > ALTERNATE_DEFINITION:
701+
ALTERNATE_DEFINITION += 1
702+
else:
703+
prev_p = parsed_pin[0]
704+
alt_index = 0
705+
line_to_write = "%-17s" % (commented_line + " {" + parsed_pin[0] + ',')
706+
a = parsed_pin[2].split('_')
707+
inst = a[0].replace("ADC", "")
708+
if len(inst) == 0:
709+
inst = '1' #single ADC for this product
710+
line_to_write += "%-7s" % ('ADC_' + inst + ',')
711+
chan = re.sub(r"^IN[N|P]?|\D*$", "", a[1])
712+
bank = "_ADC_CHANNEL_BANK_B" if a[1].endswith("b") else ""
713+
line_to_write += s_pin_data + bank + ", GPIO_NOPULL, 0, " + chan
714+
line_to_write += ', 0)}, // ' + parsed_pin[2]
715+
if parsed_pin[1] in PinLabel:
716+
line_to_write += ' // Connected to ' + PinLabel[parsed_pin[1]]
717+
line_to_write += '\n'
718+
out_c_file.write(line_to_write)
718719
out_c_file.write( """ {NC, NC, 0}
719720
};
720721

0 commit comments

Comments
 (0)