From cd39bfa8b1cb81de1670bf498518fdf16893312d Mon Sep 17 00:00:00 2001 From: Steve Kelly Date: Tue, 10 Jan 2017 15:40:45 -0500 Subject: [PATCH] add alternative constructor for initialized SerialPort --- src/SerialPorts.jl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/SerialPorts.jl b/src/SerialPorts.jl index 4b3fa1f..a416e49 100644 --- a/src/SerialPorts.jl +++ b/src/SerialPorts.jl @@ -145,10 +145,9 @@ function in_dialout() end @doc """ -Initialize a REPL. Calling conventions are identical to `SerialPort` +Initialize a REPL. Calling conventions are identical to `SerialPort`. """ -> -function REPL(args...) - s = SerialPort(args...) +function REPL(s::SerialPort) @async begin while true print(String(readavailable(s))) @@ -157,10 +156,14 @@ function REPL(args...) while true print_with_color(:magenta, "\nserial> ") c = readline() - !isspace(c) && write(s, c) + !isspace(c) && write(s, c) # Don't send newlines end end +function REPL(args...) + REPL(SerialPort(args...)) +end + # Submodules include("Arduino.jl")