script: STM32: STM32_gen_PeripheralPins.py updated

Removed INN channel ADC
pull/14895/head
anish-k 2021-07-08 13:19:36 +05:30
parent d83494f54b
commit f14ce30ba6
1 changed files with 36 additions and 35 deletions

View File

@ -27,7 +27,7 @@ from xml.dom.minidom import parse, Node
from argparse import RawTextHelpFormatter from argparse import RawTextHelpFormatter
import subprocess import subprocess
GENPINMAP_VERSION = "1.20.1" GENPINMAP_VERSION = "1.20.2"
ADD_DEVICE_IF = 0 ADD_DEVICE_IF = 0
ADD_GPIO_PINMAP = 0 ADD_GPIO_PINMAP = 0
@ -267,7 +267,9 @@ def store_pin(pin, name, functionality):
# function to store ADC list # function to store ADC list
def store_adc(pin, name, signal): def store_adc(pin, name, signal):
adclist.append([pin, name, signal]) #INN channels not supported in mbed
if("IN" in signal and "INN" not in signal):
adclist.append([pin, name, signal])
# function to store DAC list # function to store DAC list
@ -680,41 +682,40 @@ def print_adc():
prev_p = '' prev_p = ''
alt_index = 0 alt_index = 0
for parsed_pin in adclist: for parsed_pin in adclist:
if "IN" in parsed_pin[2]: commented_line = " "
commented_line = " " if parsed_pin[1] in PinLabel:
if parsed_pin[1] in PinLabel: if "STDIO_UART" in PinLabel[parsed_pin[1]]:
if "STDIO_UART" in PinLabel[parsed_pin[1]]: commented_line = "//"
commented_line = "//" if "RCC_OSC" in PinLabel[parsed_pin[1]]:
if "RCC_OSC" in PinLabel[parsed_pin[1]]: commented_line = "//"
commented_line = "//" if commented_line != "//":
if commented_line != "//": if parsed_pin[0] == prev_p:
if parsed_pin[0] == prev_p: if "STM32F1" in mcu_file:
if "STM32F1" in mcu_file: continue
continue
else:
prev_p = parsed_pin[0]
parsed_pin[0] += '_ALT%d' % alt_index
store_pin(parsed_pin[0], parsed_pin[0], "")
alt_index += 1
if alt_index > ALTERNATE_DEFINITION:
ALTERNATE_DEFINITION += 1
else: else:
prev_p = parsed_pin[0] prev_p = parsed_pin[0]
alt_index = 0 parsed_pin[0] += '_ALT%d' % alt_index
line_to_write = "%-17s" % (commented_line + " {" + parsed_pin[0] + ',') store_pin(parsed_pin[0], parsed_pin[0], "")
a = parsed_pin[2].split('_') alt_index += 1
inst = a[0].replace("ADC", "") if alt_index > ALTERNATE_DEFINITION:
if len(inst) == 0: ALTERNATE_DEFINITION += 1
inst = '1' #single ADC for this product else:
line_to_write += "%-7s" % ('ADC_' + inst + ',') prev_p = parsed_pin[0]
chan = re.sub(r"^IN[N|P]?|\D*$", "", a[1]) alt_index = 0
bank = "_ADC_CHANNEL_BANK_B" if a[1].endswith("b") else "" line_to_write = "%-17s" % (commented_line + " {" + parsed_pin[0] + ',')
line_to_write += s_pin_data + bank + ", GPIO_NOPULL, 0, " + chan a = parsed_pin[2].split('_')
line_to_write += ', 0)}, // ' + parsed_pin[2] inst = a[0].replace("ADC", "")
if parsed_pin[1] in PinLabel: if len(inst) == 0:
line_to_write += ' // Connected to ' + PinLabel[parsed_pin[1]] inst = '1' #single ADC for this product
line_to_write += '\n' line_to_write += "%-7s" % ('ADC_' + inst + ',')
out_c_file.write(line_to_write) chan = re.sub(r"^IN[N|P]?|\D*$", "", a[1])
bank = "_ADC_CHANNEL_BANK_B" if a[1].endswith("b") else ""
line_to_write += s_pin_data + bank + ", GPIO_NOPULL, 0, " + chan
line_to_write += ', 0)}, // ' + parsed_pin[2]
if parsed_pin[1] in PinLabel:
line_to_write += ' // Connected to ' + PinLabel[parsed_pin[1]]
line_to_write += '\n'
out_c_file.write(line_to_write)
out_c_file.write( """ {NC, NC, 0} out_c_file.write( """ {NC, NC, 0}
}; };