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.
pull/4365/head
Laurent MEUNIER 2017-05-11 16:55:55 +02:00
parent 2886f0b407
commit 5af0c59588
1 changed files with 7 additions and 4 deletions

View File

@ -72,14 +72,17 @@ void pin_function(PinName pin, int data)
GPIO_TypeDef *gpio = Set_GPIO_Clock(port);
/* Set default speed to high.
* This is done before other settings on purpose:
* For most families there are dedicated registers so it is
* not so important, register can be set at any time.
* But for families like F1, speed only applies to output. so we set
* it here, and then if input is selected, this setting might be
* overriden by the input one.
* But for families like F1, speed only applies to output.
*/
#if defined (TARGET_STM32F1)
if (mode == STM_PIN_OUTPUT) {
#endif
LL_GPIO_SetPinSpeed(gpio, ll_pin, LL_GPIO_SPEED_FREQ_HIGH);
#if defined (TARGET_STM32F1)
}
#endif
switch (mode) {
case STM_PIN_INPUT: