diff --git a/src/Computer/10V.jl b/src/Computer/10V.jl index facf505a721cd0c709a6f884afd233b362c0c680..4c84a4914a7a46a053e4e4057da6bd0ea333171a 100644 --- a/src/Computer/10V.jl +++ b/src/Computer/10V.jl @@ -17,13 +17,13 @@ initialize(::AnalogInput10V) = nothing initialize(::AnalogOutput10V) = nothing close(::AnalogInput10V) = nothing -close(input::AnalogOutput10V) = ccall(:comedi_write_zero, comedipath, Void, (Int32, Int32, Int32), 0, 1, input.i) +close(input::AnalogOutput10V) = ccall((:comedi_write_zero, comedipath), Void, (Int32, Int32, Int32), Int32(0), Int32(1), input.i) -getwritecommand(stream::LabStream, input::AnalogIntput10V, val) = error("Can't write to device $input") +getwritecommand(stream::LabStream, input::AnalogInput10V, val) = error("Can't write to device $input") getreadcommand(stream::LabStream, output::AnalogOutput10V, val) = error("Can't read from device $output") function getwritecommand(stream::BeagleBoneStream, input::AnalogOutput10V, val::Float64) - abs(val) < 10 || error("Volatage $val not in range [-10,10]") + abs(val) <= 10 || error("Volatage $val not in range [-10,10]") return ("analogin10", input.i, val) end function getreadcommand(stream::BeagleBoneStream, input::AnalogInput10V) @@ -31,9 +31,9 @@ function getreadcommand(stream::BeagleBoneStream, input::AnalogInput10V) end function getwritecommand(stream::ComediStream, input::AnalogOutput10V, val::Float64) - abs(val) < 10 || error("Volatage $val not in range [-10,10]") - return (0,1,input.i,val) + abs(val) <= 10 || error("Volatage $val not in range [-10,10]") + return (Int32(0),Int32(1),input.i,val) end function getreadcommand(stream::ComediStream, input::AnalogInput10V) - return (0,0,input.i) + return (Int32(0),Int32(0),input.i) end diff --git a/src/Computer/ComediStream.jl b/src/Computer/ComediStream.jl index a89fab3fdeb4822ddc8feba568977c39909bc8ab..59a570d9750f52d9fc026bb0607e3ee5e04c84dc 100644 --- a/src/Computer/ComediStream.jl +++ b/src/Computer/ComediStream.jl @@ -16,7 +16,7 @@ function ComediStream() ComediStream(AbstractDevice[], SendTuple[], ReadTuple[]) end -function init_devices!(stream::ComediStream, devs::AbstractDevice...) +function init_devices!(comedistream::ComediStream, devs::AbstractDevice...) for dev in devs if dev ∉ comedistream.devices setstream!(dev, comedistream) @@ -30,12 +30,11 @@ function init_devices!(stream::ComediStream, devs::AbstractDevice...) end function send(comedistream::ComediStream, cmd::SendTuple) - ccall((:comedi_write, comedipath),Int32,(Int32,Int32,Int32,Float64), cmd[1], cmd[2], cmd[3], cmd[4]) + ccall((:comedi_write, comedipath), Int32, (Int32,Int32,Int32,Float64), cmd[1], cmd[2], cmd[3], cmd[4]) return end function read(comedistream::ComediStream, cmd::ReadTuple) - ccall((:comedi_read, comedipath),Int32,(Int32,Int32,Int32), cmd[1], cmd[2], cmd[3]) - return + return ccall((:comedi_read, comedipath), Float64, (Int32,Int32,Int32), cmd[1], cmd[2], cmd[3]) end function send(comedistream::ComediStream) @@ -51,6 +50,6 @@ end function close(stream::ComediStream) foreach(close, stream.devices) - ccall((:comedi_stop, comedipath),Int32,(Int32,), 0) + ccall((:comedi_stop, comedipath), Int32, (Int32,), 0) return end