From 18abfdb604423ae10681f0614c8c0c59dd24c35b Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER <laurent.meunier@st.com> Date: Mon, 6 Feb 2017 11:49:34 +0100 Subject: [PATCH] STM32: gpio: style consistency --- targets/TARGET_STM/gpio_api.c | 8 ++------ targets/TARGET_STM/gpio_irq_api.c | 33 ++++++++++--------------------- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/targets/TARGET_STM/gpio_api.c b/targets/TARGET_STM/gpio_api.c index 2633e0b780..bbcf53fc4c 100644 --- a/targets/TARGET_STM/gpio_api.c +++ b/targets/TARGET_STM/gpio_api.c @@ -146,13 +146,9 @@ void gpio_mode(gpio_t *obj, PinMode mode) { } inline void gpio_dir(gpio_t *obj, PinDirection direction) { - - if (direction == PIN_INPUT) - { + if (direction == PIN_INPUT) { LL_GPIO_SetPinMode(obj->gpio, obj->ll_pin, LL_GPIO_MODE_INPUT); - } - else - { + } else { LL_GPIO_SetPinMode(obj->gpio, obj->ll_pin, LL_GPIO_MODE_OUTPUT); } } diff --git a/targets/TARGET_STM/gpio_irq_api.c b/targets/TARGET_STM/gpio_irq_api.c index 9af8f901e0..a507a00164 100644 --- a/targets/TARGET_STM/gpio_irq_api.c +++ b/targets/TARGET_STM/gpio_irq_api.c @@ -87,20 +87,16 @@ static void handle_interrupt_in(uint32_t irq_index, uint32_t max_num_pin_line) uint32_t pin = (uint32_t)(1 << (gpio_channel->channel_pin[gpio_idx])); // Clear interrupt flag - if (__HAL_GPIO_EXTI_GET_FLAG(pin) != RESET) - { + if (__HAL_GPIO_EXTI_GET_FLAG(pin) != RESET) { __HAL_GPIO_EXTI_CLEAR_FLAG(pin); if (gpio_channel->channel_ids[gpio_idx] == 0) continue; // Check which edge has generated the irq - if ((gpio->IDR & pin) == 0) - { + if ((gpio->IDR & pin) == 0) { irq_handler(gpio_channel->channel_ids[gpio_idx], IRQ_FALL); - } - else - { + } else { irq_handler(gpio_channel->channel_ids[gpio_idx], IRQ_RISE); } } @@ -178,8 +174,7 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32 uint32_t pin_index = STM_PIN(pin); irq_index = pin_lines_desc[pin_index].irq_index; - switch (irq_index) - { + switch (irq_index) { #ifdef EXTI_IRQ0_NUM_LINES case 0: vector = (uint32_t)&gpio_irq0; @@ -259,25 +254,17 @@ void gpio_irq_free(gpio_irq_t *obj) void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) { - if (event == IRQ_RISE) - { - if (enable) - { + if (event == IRQ_RISE) { + if (enable) { LL_EXTI_EnableRisingTrig_0_31(1 << STM_PIN(obj->pin)); - } - else - { + } else { LL_EXTI_DisableRisingTrig_0_31(1 << STM_PIN(obj->pin)); } } - if (event == IRQ_FALL) - { - if (enable) - { + if (event == IRQ_FALL) { + if (enable) { LL_EXTI_EnableFallingTrig_0_31(1 << STM_PIN(obj->pin)); - } - else - { + } else { LL_EXTI_DisableFallingTrig_0_31(1 << STM_PIN(obj->pin)); } }