8000 [genpinmap] Manage ADC channel bank · stm32duino/Arduino_Tools@05945e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 05945e6

Browse files
committed
[genpinmap] Manage ADC channel bank
For STM32L1xx, in Cat.3, Cat.4, Cat.5 and Cat.6 devices there are up to 42 multiplexed channels organized in 2 banks. Channels ADC_IN0 to ADC_IN31 are available in Bank A and channels ADC_IN0b to ADC_IN31b are available in Bank B. Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 36da7f7 commit 05945e6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/genpinmap/genpinmap_arduino.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,9 @@ def adc_pinmap():
319319
# For STM32L47xxx/48xxx, it is necessary to configure
320320
# the GPIOx_ASCR 8000 register
321321
if re.match("STM32L4[78]+", mcu_file.stem):
322-
mode = "STM_MODE_ANALOG_ADC_CONTROL"
322+
default_mode = "STM_MODE_ANALOG_ADC_CONTROL"
323323
else:
324-
mode = "STM_MODE_ANALOG"
324+
default_mode = "STM_MODE_ANALOG"
325325
for p in adclist:
326326
# inst
327327
a = p[2].split("_")
@@ -331,7 +331,11 @@ def adc_pinmap():
331331
winst.append(len(inst))
332332
wpin.append(len(p[0]))
333333
# chan
334-
chan = re.sub("IN[N|P]?", "", a[1])
334+
chan = re.sub("^IN[N|P]?|\D*$", "", a[1])
335+
if a[1].endswith('b'):
336+
mode = "STM_MODE_ANALOG_ADC_CHANNEL_BANK_B"
337+
else:
338+
mode = default_mode
335339
adc_pins_list.append(
336340
{
337341
"pin": p[0],

0 commit comments

Comments
 (0)
0