mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/gpio_api.c
- Revision:
- 216:577900467c9e
- Parent:
- 113:65a335a675de
- Child:
- 227:7bd0639b8911
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/gpio_api.c Tue May 27 08:30:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/gpio_api.c Tue May 27 10:00:08 2014 +0100 @@ -33,7 +33,7 @@ extern uint32_t Set_GPIO_Clock(uint32_t port_idx); -uint32_t gpio_set(PinName pin) { +uint32_t gpio_set(PinName pin) { if (pin == NC) return 0; pin_function(pin, STM_PIN_DATA(GPIO_Mode_IN, 0, GPIO_PuPd_NOPULL, 0xFF)); @@ -45,11 +45,11 @@ if (pin == NC) return; uint32_t port_index = STM_PORT(pin); - + // Enable GPIO clock uint32_t gpio_add = Set_GPIO_Clock(port_index); GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add; - + // Fill GPIO object structure for future use obj->pin = pin; obj->mask = gpio_set(pin); @@ -65,8 +65,7 @@ void gpio_dir(gpio_t *obj, PinDirection direction) { if (direction == PIN_OUTPUT) { pin_function(obj->pin, STM_PIN_DATA(GPIO_Mode_OUT, GPIO_OType_PP, GPIO_PuPd_NOPULL, 0xFF)); - } - else { // PIN_INPUT + } else { // PIN_INPUT pin_function(obj->pin, STM_PIN_DATA(GPIO_Mode_IN, 0, GPIO_PuPd_NOPULL, 0xFF)); } }