- fix F411 F334 systeminit when HSI used - portinout always read IDR regardless of port direction
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_DISCO_F051R8/port_api.c
- Revision:
- 240:9a7c54113eaf
- Parent:
- 130:1dec54e4aec3
- Child:
- 250:a49055e7a707
--- a/targets/hal/TARGET_STM/TARGET_DISCO_F051R8/port_api.c Thu Jun 26 09:15:07 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_DISCO_F051R8/port_api.c Thu Jun 26 09:45:08 2014 +0100 @@ -28,12 +28,13 @@ ******************************************************************************* */ #include "port_api.h" + +#if DEVICE_PORTIN || DEVICE_PORTOUT + #include "pinmap.h" #include "gpio_api.h" #include "error.h" -#if DEVICE_PORTIN || DEVICE_PORTOUT - extern uint32_t Set_GPIO_Clock(uint32_t port_idx); // high nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, ...) @@ -66,8 +67,7 @@ if (obj->mask & (1 << i)) { // If the pin is used if (dir == PIN_OUTPUT) { pin_function(port_pin(obj->port, i), STM_PIN_DATA(GPIO_Mode_OUT, GPIO_OType_PP, GPIO_PuPd_NOPULL, 0xFF)); - } - else { // PIN_INPUT + } else { // PIN_INPUT pin_function(port_pin(obj->port, i), STM_PIN_DATA(GPIO_Mode_IN, 0, GPIO_PuPd_NOPULL, 0xFF)); } } @@ -90,8 +90,7 @@ int port_read(port_t *obj) { if (obj->direction == PIN_OUTPUT) { return (*obj->reg_out & obj->mask); - } - else { // PIN_INPUT + } else { // PIN_INPUT return (*obj->reg_in & obj->mask); } }