mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/gpio_api.c
- Revision:
- 135:067cc8ba23da
- Parent:
- 125:23cc3068a9e4
- Child:
- 227:7bd0639b8911
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/gpio_api.c Tue Mar 25 09:30:07 2014 +0000 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/gpio_api.c Tue Mar 25 10:15:07 2014 +0000 @@ -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)); } }