summaryrefslogtreecommitdiffstatshomepage
path: root/ports/stm32/boards/make-pins.py
diff options
context:
space:
mode:
Diffstat (limited to 'ports/stm32/boards/make-pins.py')
-rwxr-xr-xports/stm32/boards/make-pins.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ports/stm32/boards/make-pins.py b/ports/stm32/boards/make-pins.py
index 9f9950ff17..bfa22d7974 100755
--- a/ports/stm32/boards/make-pins.py
+++ b/ports/stm32/boards/make-pins.py
@@ -49,6 +49,11 @@ PinAf = namedtuple(
],
)
+# Only support ADC1, ADC2, ADC3 for now (e.g. cannot support ADC4 & ADC5 on
+# STM32G4).
+MIN_ADC_UNIT = 1
+MAX_ADC_UNIT = 3
+
class Stm32Pin(boardgen.Pin):
def __init__(self, cpu_pin_name):
@@ -134,7 +139,7 @@ class Stm32Pin(boardgen.Pin):
raise boardgen.PinGeneratorError(
"Invalid adc '{:s}' for pin '{:s}'".format(adc_name, self.name())
)
- adc_units = [int(x) for x in m.group(1)]
+ adc_units = [int(x) for x in m.group(1) if MIN_ADC_UNIT <= int(x) <= MAX_ADC_UNIT]
adc_mode = m.group(2)
if adc_mode == "INN":
# On H7 we have INN/INP, all other parts use IN only. Only use