 #if os(Linux)
-    import Glibc
+import Glibc
 #else
-    import Darwin.C
+import Darwin.C
 #endif
 
 import SwiftyGPIO
+
+typealias Ports [GPIOName]
 
 /// Returns a list of GPIOs configured as output
 ///

///   - ports: The ports to configure as input
///   - board: The board name
/// - Returns: The input ports
public func setupIN(ports: [GPIOName], for board: SupportedBoard) -> [GPIOName: GPIO] {
    let gpios = GPIOs(for: board)
    var result: [GPIOName: GPIO] = [:]
    for key in ports {
        if let gpio = gpios[key] {
            gpio.direction = .IN
            result[key] = gpio
        }
    }

    return result
}


/// Waiting an amount of milliseconds before continue with the process
///
/// - Parameter milliseconds: How many milliseconds wait
public func waiting(for milliseconds: UInt32) {
    usleep(milliseconds * Constant.milliseconds)
}

private struct Constant {
    static let milliseconds: UInt32 = 1000
}

private func GPIOs(for board: SupportedBoard) -> [GPIOName: GPIO] {
    return SwiftyGPIO.GPIOs(for: board)
}

///   - ports: The ports to configure as output
///   - board: The board name
/// - Returns: The output ports
public func setupOUT(ports: Ports, for board: SupportedBoard) -> [GPIOName: GPIO] {
  let gpios = GPIOs(for: board)
  var result: [GPIOName: GPIO] = [:]
  for key in ports {
    if let gpio = gpios[key] {
      gpio.direction = .OUT
      gpio.value = 0
      result[key] = gpio
    }
  }

  return result
}

/// Returns a list of GPIOs configured as input
