File tree 2 files changed +17
-1
lines changed
libraries/SrcWrapper/src/stm32
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 90
90
#define PinMap_USB PinMap_USB_DRD_FS
91
91
#endif
92
92
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
+
93
107
/**
94
108
* Libc porting layers
95
109
*/
Original file line number Diff line number Diff line change @@ -242,7 +242,9 @@ void pin_function(PinName pin, int function)
242
242
case STM_PIN_ALTERNATE :
243
243
ll_mode = LL_GPIO_MODE_ALTERNATE ;
244
244
/* 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
+ }
246
248
break ;
247
249
case STM_PIN_ANALOG :
248
250
ll_mode = LL_GPIO_MODE_ANALOG ;
You can’t perform that action at this time.
0 commit comments