 defmodule UpsideDownLeds.BlinkingLights do
   use GenServer
 
+  ##
   ## client API
+  ##
 
   @doc """
   Starts the server.

    {
      :ok,
      %{
        "A" => 4,
        "B" => 2,
        "C" => 27,
        "D" => 22,
        "E" => 26,
        "F" => 19,
        "G" => 13,
        "H" => 6,
        "I" => 5,
        "J" => 11,
        "K" => 9,
        "L" => 10,
        "M" => 3,
        "N" => 14,
        "O" => 15,
        "P" => 8,
        "Q" => 18,
        "R" => 23,
        "S" => 21,
        "T" => 17,
        "U" => 24,
        "V" => 25,
        "W" => 7,
        "X" => 12,
        "Y" => 16,
        "Z" => 20,
      } |> Enum.map(fn pair -> {letter, pin_no} = pair; {:ok, pid} = ElixirALE.GPIO.start_link(pin_no, :output); {letter, pid} end)
        |> Enum.into(%{})
    }

  end

  defp blink(pid, delay_during \\ @delay_during, delay_after \\ @delay_after) do
    ElixirALE.GPIO.write(pid, 0)
    :timer.sleep(delay_during)
    ElixirALE.GPIO.write(pid, 1)
    :timer.sleep(delay_after)
  end
end
