Skip to content

Commit

Permalink
Remove terminate/2 from UART server
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorRigby authored and fhunleth committed Dec 20, 2019
1 parent 4832c87 commit c5f4646
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/circuits_uart.ex
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ defmodule Circuits.UART do
def set_rts(pid, value) when is_boolean(value) do
GenServer.call(pid, {:set_rts, value})
end

@doc """
Change the controlling process that
receives events from an active uart.
Expand Down Expand Up @@ -500,17 +500,12 @@ defmodule Circuits.UART do
response = call_port(state, :set_break, value)
{:reply, response, state}
end

def handle_call({:controlling_process, pid}, _from, state) do
new_state = %{state | controlling_process: pid}
{:reply, :ok, new_state}
end

def terminate(_reason, state) do
# IO.puts("Going to terminate: #{inspect(reason)}")
Port.close(state.port)
end

def handle_info({_, {:data, <<?n, message::binary>>}}, state) do
msg = :erlang.binary_to_term(message)
handle_port(msg, state)
Expand Down

0 comments on commit c5f4646

Please sign in to comment.