From 044d08d5991262d61116ca9261b5e1219e099748 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Wed, 22 Jul 2020 09:13:52 +0200 Subject: [PATCH 1/2] cpu/stm32: GPIO ports definition fix The available GPIO ports may also differ within a family. Therefore, the vendor definitions GPIO* are used instad of CPU_FAM_STM definitions to determine which ports are available for a certain MCU. --- cpu/stm32/include/periph_cpu.h | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/cpu/stm32/include/periph_cpu.h b/cpu/stm32/include/periph_cpu.h index b3fad57d19..efca5830c6 100644 --- a/cpu/stm32/include/periph_cpu.h +++ b/cpu/stm32/include/periph_cpu.h @@ -217,32 +217,37 @@ typedef uint32_t gpio_t; * @brief Available GPIO ports */ enum { +#ifdef GPIOA PORT_A = 0, /**< port A */ +#endif +#ifdef GPIOB PORT_B = 1, /**< port B */ +#endif +#ifdef GPIOC PORT_C = 2, /**< port C */ +#endif +#ifdef GPIOD PORT_D = 3, /**< port D */ +#endif +#ifdef GPIOE PORT_E = 4, /**< port E */ +#endif +#ifdef GPIOF PORT_F = 5, /**< port F */ -#if defined(CPU_FAM_STM32F1) || defined(CPU_FAM_STM32F2) || \ - defined(CPU_FAM_STM32F3) || defined(CPU_FAM_STM32F4) || \ - defined(CPU_FAM_STM32F7) || defined(CPU_FAM_STM32L1) || \ - defined(CPU_FAM_STM32L4) || defined(CPU_FAM_STM32G4) +#endif +#ifdef GPIOG PORT_G = 6, /**< port G */ #endif -#if defined(CPU_FAM_STM32F2) || defined(CPU_FAM_STM32F3) || \ - defined(CPU_FAM_STM32F4) || defined(CPU_FAM_STM32F7) || \ - defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1) || \ - defined(CPU_FAM_STM32L4) || defined(CPU_FAM_STM32WB) || \ - defined(CPU_FAM_STM32G4) +#ifdef GPIOH PORT_H = 7, /**< port H */ #endif -#if defined(CPU_FAM_STM32F2) || defined(CPU_FAM_STM32F4) || \ - defined(CPU_FAM_STM32F7) || defined(CPU_FAM_STM32L4) || \ - defined(CPU_FAM_STM32G4) +#ifdef GPIOI PORT_I = 8, /**< port I */ #endif -#if defined(CPU_FAM_STM32F7) +#ifdef GPIOJ PORT_J = 9, /**< port J */ +#endif +#ifdef GPIOK PORT_K = 10, /**< port K */ #endif }; From b082fd19413caf83b2f992fdf067ae23dcdc87a2 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Thu, 23 Jul 2020 00:16:48 +0200 Subject: [PATCH 2/2] board/nucleo32: fix Arduino pin mapping On Nucleo-32 boards with STM32 MCUs that do not have the GPIO port F, the Arduino pins D7 and D8 are not connected to PF0 and PF1 but to PC14 and PC15. This is also the case for the Nucleo-L412KB. --- boards/common/nucleo32/include/arduino_pinmap.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/common/nucleo32/include/arduino_pinmap.h b/boards/common/nucleo32/include/arduino_pinmap.h index c8720dcad7..5ef875aef7 100644 --- a/boards/common/nucleo32/include/arduino_pinmap.h +++ b/boards/common/nucleo32/include/arduino_pinmap.h @@ -39,7 +39,8 @@ extern "C" { #define ARDUINO_PIN_4 GPIO_PIN(PORT_B, 7) #define ARDUINO_PIN_5 GPIO_PIN(PORT_B, 6) #define ARDUINO_PIN_6 GPIO_PIN(PORT_B, 1) -#if defined(CPU_MODEL_STM32L031K6) || defined(CPU_MODEL_STM32L432KC) +#if defined(CPU_MODEL_STM32L031K6) || defined(CPU_MODEL_STM32L432KC) || \ + defined(CPU_MODEL_STM32L412KB) #define ARDUINO_PIN_7 GPIO_PIN(PORT_C, 14) #define ARDUINO_PIN_8 GPIO_PIN(PORT_C, 15) #else