File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,16 @@ void pin_function(PinName pin, int data)
71
71
// Enable GPIO clock
72
72
GPIO_TypeDef * gpio = Set_GPIO_Clock (port );
73
73
74
+ /* Set default speed to high.
75
+ * This is done before other settings on purpose:
76
+ * For most families there are dedicated registers so it is
77
+ * 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.
81
+ */
82
+ LL_GPIO_SetPinSpeed (gpio , ll_pin , LL_GPIO_SPEED_FREQ_HIGH );
83
+
74
84
switch (mode ) {
75
85
case STM_PIN_INPUT :
76
86
ll_mode = LL_GPIO_MODE_INPUT ;
@@ -103,7 +113,6 @@ void pin_function(PinName pin, int data)
103
113
104
114
/* For now by default use Speed HIGH for output or alt modes */
105
115
if ((mode == STM_PIN_OUTPUT ) || (mode == STM_PIN_ALTERNATE )) {
106
- LL_GPIO_SetPinSpeed (gpio , ll_pin , LL_GPIO_SPEED_FREQ_HIGH );
107
116
if (STM_PIN_OD (data )) {
108
117
LL_GPIO_SetPinOutputType (gpio , ll_pin , LL_GPIO_OUTPUT_OPENDRAIN );
109
118
} else {
You can’t perform that action at this time.
0 commit comments