Skip to content

Commit 5af0c59

Browse files
committed
STM32 F1: Only set GPIO pin speed in case of Output mode
There were still side effects, in particular on I2C master slave test, when setting by default the Pin Speed for F1 family. So for F1 family, let's do it only in case of Output which is the only case where this actually applies on this family.
1 parent 2886f0b commit 5af0c59

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

targets/TARGET_STM/pinmap.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,17 @@ void pin_function(PinName pin, int data)
7272
GPIO_TypeDef *gpio = Set_GPIO_Clock(port);
7373

7474
/* Set default speed to high.
75-
* This is done before other settings on purpose:
7675
* For most families there are dedicated registers so it is
7776
* not so important, register can be set at any time.
78-
* But for families like F1, speed only applies to output. so we set
79-
* it here, and then if input is selected, this setting might be
80-
* overriden by the input one.
77+
* But for families like F1, speed only applies to output.
8178
*/
79+
#if defined (TARGET_STM32F1)
80+
if (mode == STM_PIN_OUTPUT) {
81+
#endif
8282
LL_GPIO_SetPinSpeed(gpio, ll_pin, LL_GPIO_SPEED_FREQ_HIGH);
83+
#if defined (TARGET_STM32F1)
84+
}
85+
#endif
8386

8487
switch (mode) {
8588
case STM_PIN_INPUT:

0 commit comments

Comments
 (0)