Skip to content

Commit 3f81f5d

Browse files
author
Laurent MEUNIER
committed
[STM32F4] Use previously introduced pin_function_gpiomode
This way the pull-up / pull-down modes would not be overwritten as first reported in issue #2638
1 parent e516bdd commit 3f81f5d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

targets/TARGET_STM/TARGET_STM32F4/gpio_irq_api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ static void gpio_irq6(void)
163163
}
164164

165165
extern uint32_t Set_GPIO_Clock(uint32_t port_idx);
166+
extern void pin_function_gpiomode(PinName pin, uint32_t gpiomode);
166167

167168
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id)
168169
{
@@ -267,15 +268,14 @@ void gpio_irq_free(gpio_irq_t *obj)
267268
gpio_channel->channel_gpio[gpio_idx] = 0;
268269
gpio_channel->channel_pin[gpio_idx] = 0;
269270

270-
// Disable EXTI line
271-
pin_function(obj->pin, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
271+
// Disable EXTI line, but don't change pull-up config
272+
pin_function_gpiomode(obj->pin, STM_MODE_INPUT);
272273
obj->event = EDGE_NONE;
273274
}
274275

275276
void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
276277
{
277278
uint32_t mode = STM_MODE_IT_EVT_RESET;
278-
uint32_t pull = GPIO_NOPULL;
279279

280280
if (enable) {
281281
if (event == IRQ_RISE) {
@@ -317,7 +317,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
317317
}
318318
}
319319

320-
pin_function(obj->pin, STM_PIN_DATA(mode, pull, 0));
320+
pin_function_gpiomode(obj->pin, mode);
321321
}
322322

323323
void gpio_irq_enable(gpio_irq_t *obj)

0 commit comments

Comments
 (0)