Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
moberg
Commits
b7076b2a
Commit
b7076b2a
authored
Mar 29, 2019
by
Anders Blomdell
Browse files
Julia debugging cleanup
parent
3613f613
Changes
7
Hide whitespace changes
Inline
Side-by-side
adaptors/julia/AnalogIn.jl
View file @
b7076b2a
...
@@ -20,7 +20,7 @@ mutable struct AnalogIn
...
@@ -20,7 +20,7 @@ mutable struct AnalogIn
end
end
function
close
(
ain
::
AnalogIn
)
function
close
(
ain
::
AnalogIn
)
#
println("closing $(ain)")
DEBUG
&&
println
(
"closing
$(ain)
"
)
checkOK
(
ccall
((
:
moberg_analog_in_close
,
"libmoberg"
),
checkOK
(
ccall
((
:
moberg_analog_in_close
,
"libmoberg"
),
Status
,
Status
,
(
Moberg
,
Cint
,
AnalogInChannel
),
(
Moberg
,
Cint
,
AnalogInChannel
),
...
...
adaptors/julia/AnalogOut.jl
View file @
b7076b2a
...
@@ -20,7 +20,7 @@ mutable struct AnalogOut
...
@@ -20,7 +20,7 @@ mutable struct AnalogOut
end
end
function
close
(
aout
::
AnalogOut
)
function
close
(
aout
::
AnalogOut
)
#
println("closing $(aout)")
DEBUG
&&
println
(
"closing
$(aout)
"
)
checkOK
(
ccall
((
:
moberg_analog_out_close
,
"libmoberg"
),
checkOK
(
ccall
((
:
moberg_analog_out_close
,
"libmoberg"
),
Status
,
Status
,
(
Moberg
,
Cint
,
AnalogOutChannel
),
(
Moberg
,
Cint
,
AnalogOutChannel
),
...
...
adaptors/julia/DigitalIn.jl
View file @
b7076b2a
...
@@ -20,7 +20,7 @@ mutable struct DigitalIn
...
@@ -20,7 +20,7 @@ mutable struct DigitalIn
end
end
function
close
(
din
::
DigitalIn
)
function
close
(
din
::
DigitalIn
)
#
println("closing $(din)")
DEBUG
&&
println
(
"closing
$(din)
"
)
checkOK
(
ccall
((
:
moberg_digital_in_close
,
"libmoberg"
),
checkOK
(
ccall
((
:
moberg_digital_in_close
,
"libmoberg"
),
Status
,
Status
,
(
Moberg
,
Cint
,
DigitalInChannel
),
(
Moberg
,
Cint
,
DigitalInChannel
),
...
...
adaptors/julia/DigitalOut.jl
View file @
b7076b2a
...
@@ -20,7 +20,7 @@ mutable struct DigitalOut
...
@@ -20,7 +20,7 @@ mutable struct DigitalOut
end
end
function
close
(
dout
::
DigitalOut
)
function
close
(
dout
::
DigitalOut
)
#
println("closing $(dout)")
DEBUG
&&
println
(
"closing
$(dout)
"
)
checkOK
(
ccall
((
:
moberg_digital_out_close
,
"libmoberg"
),
checkOK
(
ccall
((
:
moberg_digital_out_close
,
"libmoberg"
),
Status
,
Status
,
(
Moberg
,
Cint
,
DigitalOutChannel
),
(
Moberg
,
Cint
,
DigitalOutChannel
),
...
...
adaptors/julia/EncoderIn.jl
View file @
b7076b2a
...
@@ -20,7 +20,7 @@ mutable struct EncoderIn
...
@@ -20,7 +20,7 @@ mutable struct EncoderIn
end
end
function
close
(
ein
::
EncoderIn
)
function
close
(
ein
::
EncoderIn
)
#
println("closing $(ein)")
DEBUG
&&
println
(
"closing
$(ein)
"
)
checkOK
(
ccall
((
:
moberg_encoder_in_close
,
"libmoberg"
),
checkOK
(
ccall
((
:
moberg_encoder_in_close
,
"libmoberg"
),
Status
,
Status
,
(
Moberg
,
Cint
,
EncoderInChannel
),
(
Moberg
,
Cint
,
EncoderInChannel
),
...
...
adaptors/julia/MobergIO.jl
View file @
b7076b2a
module
MobergIO
module
MobergIO
const
DEBUG
=
false
struct
Status
struct
Status
result
::
Clong
result
::
Clong
...
@@ -23,6 +24,7 @@ function Moberg()
...
@@ -23,6 +24,7 @@ function Moberg()
end
end
function
close
(
h
::
Moberg
)
function
close
(
h
::
Moberg
)
DEBUG
&&
println
(
"Destroy
$(h)
"
)
ccall
((
:
moberg_free
,
"libmoberg"
),
Nothing
,
(
Moberg
,),
h
)
ccall
((
:
moberg_free
,
"libmoberg"
),
Nothing
,
(
Moberg
,),
h
)
end
end
...
...
test/test_jl.jl
View file @
b7076b2a
...
@@ -7,7 +7,7 @@ import MobergIO: read, write
...
@@ -7,7 +7,7 @@ import MobergIO: read, write
function
test
()
function
test
()
m
=
MobergIO
.
Moberg
()
m
=
MobergIO
.
Moberg
()
println
(
m
)
println
(
stderr
,
m
)
for
v
in
-
10.0
:
2.0
:
10
for
v
in
-
10.0
:
2.0
:
10
for
i
in
0
:
1
for
i
in
0
:
1
...
@@ -17,21 +17,23 @@ function test()
...
@@ -17,21 +17,23 @@ function test()
write
(
aout
,
value
)
write
(
aout
,
value
)
print
(
"
$
value "
)
print
(
"
$
value "
)
catch
ex
catch
ex
println
(
"analog_out
$
i does not exist
$(ex)
"
)
println
(
stderr
,
"analog_out
$
i does not exist
$(ex)
"
)
end
end
end
end
println
()
println
(
stderr
)
flush
(
stderr
)
sleep
(
0.01
)
sleep
(
0.01
)
for
j
in
0
:
3
for
j
in
0
:
3
try
try
ain
=
MobergIO
.
AnalogIn
(
m
,
Unsigned
(
j
))
ain
=
MobergIO
.
AnalogIn
(
m
,
Unsigned
(
j
))
println
(
read
(
ain
))
println
(
stderr
,
read
(
ain
))
catch
ex
catch
ex
println
(
"analog_in
$
j does not exist
$(ex)
"
)
println
(
stderr
,
"analog_in
$
j does not exist
$(ex)
"
)
end
end
flush
(
stderr
)
end
end
println
()
println
(
stderr
)
#
GC.gc(
)
flush
(
stderr
)
end
end
for
v
in
false
:
true
for
v
in
false
:
true
for
i
in
0
:
6
for
i
in
0
:
6
...
@@ -41,27 +43,34 @@ function test()
...
@@ -41,27 +43,34 @@ function test()
write
(
dout
,
value
)
write
(
dout
,
value
)
print
(
"
$
value "
)
print
(
"
$
value "
)
catch
ex
catch
ex
println
(
"digital_out
$
i does not exist
$(ex)
"
)
println
(
stderr
,
"digital_out
$
i does not exist
$(ex)
"
)
end
end
flush
(
stderr
)
end
end
println
()
println
(
stderr
)
flush
(
stderr
)
for
i
in
0
:
6
for
i
in
0
:
6
try
try
din
=
MobergIO
.
DigitalIn
(
m
,
Unsigned
(
i
))
din
=
MobergIO
.
DigitalIn
(
m
,
Unsigned
(
i
))
print
(
"
$
(read(din)) "
)
print
(
"
$
(read(din)) "
)
catch
ex
catch
ex
println
(
"digital_
out
$
i does not exist
$(ex)
"
)
println
(
stderr
,
"digital_
in
$
i does not exist
$(ex)
"
)
end
end
flush
(
stderr
)
end
end
println
()
println
(
stderr
)
println
()
println
(
stderr
)
sleep
(
0.01
)
sleep
(
0.01
)
end
end
end
end
test
()
test
()
println
(
"DONE"
)
println
(
stderr
,
"DONE"
)
flush
(
stderr
)
GC
.
gc
()
GC
.
gc
()
println
(
stderr
,
"...."
)
flush
(
stderr
)
GC
.
gc
()
# See https://github.com/JuliaCI/BenchmarkTools.jl/blob/af35d0513fe1e336ad0d8b9a35f924e8461aefa2/src/execution.jl#L1
GC
.
gc
()
# See https://github.com/JuliaCI/BenchmarkTools.jl/blob/af35d0513fe1e336ad0d8b9a35f924e8461aefa2/src/execution.jl#L1
println
(
"Really DONE"
)
println
(
stderr
,
"Really DONE"
)
flush
(
stderr
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment