Skip to content
Snippets Groups Projects
Commit 71f386d7 authored by Mattias Fält's avatar Mattias Fält
Browse files

out/in

parent d4000ffe
No related branches found
No related tags found
No related merge requests found
name = "MobergIO"
uuid = "9bdc2bb6-e40d-4944-bd5f-2bf890d3f651"
authors = ["Anders Blomdell <anders.blomdell@control.lth.se>"]
version = "0.9.20"
version = "0.9.21"
mutable struct AnalogIn <: AbstractMobergIn
moberg::Ptr{Nothing}
index::UInt32
channel::MobergChannel
channel::MobergInChannel
function AnalogIn(moberg::Moberg, index::Unsigned)
channel = MobergChannel(0,0)
channel = MobergInChannel(0,0)
moberg_handle = moberg.handle
checkOK(ccall((:moberg_analog_in_open, "libmoberg"),
Status,
(Ptr{Nothing}, Cint, Ref{MobergChannel}),
(Ptr{Nothing}, Cint, Ref{MobergInChannel}),
moberg_handle, index, channel))
self = new(moberg_handle, index, channel)
finalizer(close, self)
......@@ -19,7 +19,7 @@ function close(ain::AnalogIn)
DEBUG && println("closing $(ain)")
checkOK(ccall((:moberg_analog_in_close, "libmoberg"),
Status,
(Ptr{Nothing}, Cint, MobergChannel),
(Ptr{Nothing}, Cint, MobergInChannel),
ain.moberg, ain.index, ain.channel))
end
......
mutable struct AnalogOut <: AbstractMobergOut
moberg::Ptr{Nothing}
index::UInt32
channel::MobergChannel
channel::MobergOutChannel
function AnalogOut(moberg::Moberg, index::Unsigned)
channel = MobergChannel(0,0)
channel = MobergOutChannel(0,0)
moberg_handle = moberg.handle
checkOK(ccall((:moberg_analog_out_open, "libmoberg"),
Status,
(Ptr{Nothing}, Cint, Ref{MobergChannel}),
(Ptr{Nothing}, Cint, Ref{MobergOutChannel}),
moberg_handle, index, channel));
self = new(moberg_handle, index, channel)
finalizer(close, self)
......@@ -19,7 +19,7 @@ function close(aout::AnalogOut)
DEBUG && println("closing $(aout)")
checkOK(ccall((:moberg_analog_out_close, "libmoberg"),
Status,
(Ptr{Nothing}, Cint, MobergChannel),
(Ptr{Nothing}, Cint, MobergOutChannel),
aout.moberg, aout.index, aout.channel))
end
......
mutable struct DigitalIn <: AbstractMobergIn
moberg::Ptr{Nothing}
index::UInt32
channel::MobergChannel
channel::MobergInChannel
function DigitalIn(moberg::Moberg, index::Unsigned)
channel = MobergChannel(0,0)
channel = MobergInChannel(0,0)
moberg_handle = moberg.handle
checkOK(ccall((:moberg_digital_in_open, "libmoberg"),
Status,
(Ptr{Nothing}, Cint, Ref{MobergChannel}),
(Ptr{Nothing}, Cint, Ref{MobergInChannel}),
moberg_handle, index, channel));
self = new(moberg_handle, index, channel)
finalizer(close, self)
......@@ -19,7 +19,7 @@ function close(din::DigitalIn)
DEBUG && println("closing $(din)")
checkOK(ccall((:moberg_digital_in_close, "libmoberg"),
Status,
(Ptr{Nothing}, Cint, MobergChannel),
(Ptr{Nothing}, Cint, MobergInChannel),
din.moberg, din.index, din.channel))
end
......
mutable struct DigitalOut <: AbstractMobergOut
moberg::Ptr{Nothing}
index::UInt32
channel::MobergChannel
channel::MobergOutChannel
function DigitalOut(moberg::Moberg, index::Unsigned)
channel = MobergChannel(0,0)
channel = MobergOutChannel(0,0)
moberg_handle = moberg.handle
checkOK(ccall((:moberg_digital_out_open, "libmoberg"),
Status,
(Ptr{Nothing}, Cint, Ref{MobergChannel}),
(Ptr{Nothing}, Cint, Ref{MobergOutChannel}),
moberg_handle, index, channel))
self = new(moberg_handle, index, channel)
finalizer(close, self)
......@@ -19,7 +19,7 @@ function close(dout::DigitalOut)
DEBUG && println("closing $(dout)")
checkOK(ccall((:moberg_digital_out_close, "libmoberg"),
Status,
(Ptr{Nothing}, Cint, MobergChannel),
(Ptr{Nothing}, Cint, MobergOutChannel),
dout.moberg, dout.index, dout.channel))
end
......
......@@ -9,13 +9,13 @@ Example usage:
mutable struct EncoderIn <: AbstractMobergIn
moberg::Ptr{Nothing}
index::UInt32
channel::MobergChannel
channel::MobergInChannel
function EncoderIn(moberg::Moberg, index::Unsigned)
channel = MobergChannel(0,0)
channel = MobergInChannel(0,0)
moberg_handle = moberg.handle
checkOK(ccall((:moberg_encoder_in_open, "libmoberg"),
Status,
(Ptr{Nothing}, Cint, Ref{MobergChannel}),
(Ptr{Nothing}, Cint, Ref{MobergInChannel}),
moberg_handle, index, channel))
self = new(moberg_handle, index, channel)
finalizer(close, self)
......@@ -27,7 +27,7 @@ function close(ein::EncoderIn)
DEBUG && println("closing $(ein)")
checkOK(ccall((:moberg_encoder_in_close, "libmoberg"),
Status,
(Ptr{Nothing}, Cint, MobergChannel),
(Ptr{Nothing}, Cint, MobergInChannel),
ein.moberg, ein.index, ein.channel))
end
......
......@@ -32,7 +32,12 @@ function checkOK(status::Status)
end
end
mutable struct MobergChannel
mutable struct MobergOutChannel
context::Ptr{Nothing}
write::Ptr{Nothing}
end
mutable struct MobergInChannel
context::Ptr{Nothing}
read::Ptr{Nothing}
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment