From 61b2c93dded6fb8c6dddd47991d2042affc9af05 Mon Sep 17 00:00:00 2001 From: "Frederic.Pillon" Date: Fri, 16 Nov 2018 16:29:26 +0100 Subject: [PATCH] [genpinmap] Fix STM32L47xxx/48xxx ADC pinmap For the ADC, it is necessary to configure the GPIOx_ASCR register, only for STM32L47xxx/48xxx Signed-off-by: Frederic.Pillon --- src/genpinmap/genpinmap_arduino.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/genpinmap/genpinmap_arduino.py b/src/genpinmap/genpinmap_arduino.py index 2da5bd2a..3ba47118 100644 --- a/src/genpinmap/genpinmap_arduino.py +++ b/src/genpinmap/genpinmap_arduino.py @@ -373,7 +373,13 @@ const PinMap PinMap_%s[] = { def print_adc(): # Check GPIO version (alternate or not) - s_pin_data = "STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, " + s_pin_data = "STM_PIN_DATA_EXT(STM_MODE_ANALOG" + # For STM32L47xxx/48xxx, it is necessary to configure + # the GPIOx_ASCR register + if re.match("STM32L4[78]+", mcu_file): + s_pin_data += "_ADC_CONTROL" + s_pin_data += ", GPIO_NOPULL, 0, " + for p in adclist: if "IN" in p[2]: s1 = "%-12s" % (" {" + p[0] + ",")