Skip to content

Commit

Permalink
stm32/boards/make-pins.py: Fix H7 ADC generation.
Browse files Browse the repository at this point in the history
Fixes are:
- Only emit ADC table entries for pins that aren't cpu-hidden
  (i.e. ignore `X,-Y` rows).
- Only use the P channels on H7.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
  • Loading branch information
jimmo authored and dpgeorge committed Nov 3, 2023
1 parent 8c432ea commit 8414228
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ports/stm32/boards/make-pins.py
Expand Up @@ -135,7 +135,11 @@ def add_adc(self, adc):
"Invalid adc '{:s}' for pin '{:s}'".format(adc_name, self.name())
)
adc_units = [int(x) for x in m.group(1)]
_adc_mode = m.group(2)
adc_mode = m.group(2)
if adc_mode == "INN":
# On H7 we have INN/INP, all other parts use IN only. Only use
# IN or INP channels.
continue
adc_channel = int(m.group(3))

# Pick the entry with the most ADC units, e.g. "ADC1_INP16/ADC12_INN1/ADC12_INP0" --> "ADC12_INN1".
Expand Down Expand Up @@ -247,6 +251,8 @@ def print_adcs(self, out_source):
)
# Don't include pins that weren't in pins.csv.
for pin in self.available_pins():
if pin._hidden:
continue
if adc_unit in pin._adc_units:
print(
" [{:d}] = {:s},".format(pin._adc_channel, self._cpu_pin_pointer(pin)),
Expand Down

0 comments on commit 8414228

Please sign in to comment.