MobergIO.jl 602 Bytes
Newer Older
Anders Blomdell's avatar
Anders Blomdell committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module MobergIO


struct Status
    result::Clong
end

function checkOK(status::Status)
    if status.result != 0
        error("Moberg call failed with errno $(status.result)")
    end
end

mutable struct Moberg
    handle::Ptr{Nothing}
end

function Moberg() 
    handle = ccall((:moberg_new, "libmoberg"), Ptr{Moberg}, ())
    m = Moberg(handle)
    finalizer(close, m)
    m
end

function close(h::Moberg)
    ccall((:moberg_free, "libmoberg"), Nothing, (Moberg,), h)
end

include("AnalogIn.jl")
include("AnalogOut.jl")
include("DigitalIn.jl")
include("DigitalOut.jl")
include("EncoderIn.jl")

end