mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Revision:
216:577900467c9e
Parent:
166:cb4253f91ada
Child:
250:a49055e7a707
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/port_api.c	Tue May 27 08:30:06 2014 +0100
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/port_api.c	Tue May 27 10:00:08 2014 +0100
@@ -40,7 +40,7 @@
 // high nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, ...)
 // low nibble  = pin number
 PinName port_pin(PortName port, int pin_n) {
-  return (PinName)(pin_n + (port << 4));
+    return (PinName)(pin_n + (port << 4));
 }
 
 void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
@@ -53,9 +53,9 @@
     // Fill PORT object structure for future use
     obj->port      = port;
     obj->mask      = mask;
-    obj->direction = dir;  
+    obj->direction = dir;
     obj->reg_in    = &gpio->IDR;
-    obj->reg_out   = &gpio->ODR;  
+    obj->reg_out   = &gpio->ODR;
 
     port_dir(obj, dir);
 }
@@ -67,16 +67,15 @@
         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));
             }
         }
-    }  
+    }
 }
 
 void port_mode(port_t *obj, PinMode mode) {
-    uint32_t i;  
+    uint32_t i;
     for (i = 0; i < 16; i++) { // Process all pins
         if (obj->mask & (1 << i)) { // If the pin is used
             pin_mode(port_pin(obj->port, i), mode);
@@ -91,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);
     }
 }