From 71f386d7076f73da72c84adbe61ffe2c33bbbad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20F=C3=A4lt?= <mattiasf@control.lth.se> Date: Thu, 20 May 2021 18:00:33 +0200 Subject: [PATCH] out/in --- Project.toml | 2 +- src/AnalogIn.jl | 8 ++++---- src/AnalogOut.jl | 8 ++++---- src/DigitalIn.jl | 8 ++++---- src/DigitalOut.jl | 8 ++++---- src/EncoderIn.jl | 8 ++++---- src/MobergIO.jl | 7 ++++++- 7 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Project.toml b/Project.toml index 9ed03ad..9448e65 100644 --- a/Project.toml +++ b/Project.toml @@ -1,4 +1,4 @@ name = "MobergIO" uuid = "9bdc2bb6-e40d-4944-bd5f-2bf890d3f651" authors = ["Anders Blomdell <anders.blomdell@control.lth.se>"] -version = "0.9.20" +version = "0.9.21" diff --git a/src/AnalogIn.jl b/src/AnalogIn.jl index fd688d3..a17030b 100644 --- a/src/AnalogIn.jl +++ b/src/AnalogIn.jl @@ -1,13 +1,13 @@ 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 diff --git a/src/AnalogOut.jl b/src/AnalogOut.jl index 63655a9..9e2e853 100644 --- a/src/AnalogOut.jl +++ b/src/AnalogOut.jl @@ -1,13 +1,13 @@ 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 diff --git a/src/DigitalIn.jl b/src/DigitalIn.jl index e28920b..c396b6e 100644 --- a/src/DigitalIn.jl +++ b/src/DigitalIn.jl @@ -1,13 +1,13 @@ 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 diff --git a/src/DigitalOut.jl b/src/DigitalOut.jl index 0ee73fc..4e2c4d2 100644 --- a/src/DigitalOut.jl +++ b/src/DigitalOut.jl @@ -1,13 +1,13 @@ 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 diff --git a/src/EncoderIn.jl b/src/EncoderIn.jl index 592151b..624ee1b 100644 --- a/src/EncoderIn.jl +++ b/src/EncoderIn.jl @@ -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 diff --git a/src/MobergIO.jl b/src/MobergIO.jl index b7adab3..82282a5 100644 --- a/src/MobergIO.jl +++ b/src/MobergIO.jl @@ -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 -- GitLab