File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
libraries/SrcWrapper/src/stm32 Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 9090 #define PinMap_USB PinMap_USB_DRD_FS
9191#endif
9292
93+ /**
94+ * Some mcu have single AF and thus only AF mode should be configured.
95+ * No AFRL/AFRG registers exists so they should not be configured.
96+ * In that case the AF does not exists so defining the linked AF
97+ * to 0x7F (max value of the AFNUM i.e. STM_PIN_AFNUM_MASK)
98+ * See GitHub issue #1798.
99+ */
100+ #if defined(STM32F0xx ) && !defined(GPIO_AF0_TIM3 )
101+ #define GPIO_AF0_TIM3 STM_PIN_AFNUM_MASK
102+ #endif
103+ #if defined(STM32L0xx ) && !defined(GPIO_AF1_SPI1 )
104+ #define GPIO_AF1_SPI1 STM_PIN_AFNUM_MASK
105+ #endif
106+
93107/**
94108 * Libc porting layers
95109 */
Original file line number Diff line number Diff line change @@ -242,7 +242,9 @@ void pin_function(PinName pin, int function)
242242 case STM_PIN_ALTERNATE :
243243 ll_mode = LL_GPIO_MODE_ALTERNATE ;
244244 /* In case of ALT function, also set the afnum */
245- pin_SetAFPin (gpio , pin , afnum );
245+ if (afnum != STM_PIN_AFNUM_MASK ) {
246+ pin_SetAFPin (gpio , pin , afnum );
247+ }
246248 break ;
247249 case STM_PIN_ANALOG :
248250 ll_mode = LL_GPIO_MODE_ANALOG ;
You can’t perform that action at this time.
0 commit comments