Skip to content

Commit c80dd92

Browse files
do not convert elements of extents to string
1 parent 849f3aa commit c80dd92

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/pi.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,10 @@ Runs an extended pigpio socket command.
123123
* `extents`: additional data blocks
124124
"""
125125
function _pigpio_command_ext(sl, cmd, p1, p2, p3, extents, rl=true)
126-
ext = IOBuffer()
127-
Base.write(ext, Array(reinterpret(UInt8, [cmd, p1, p2, p3])))
128-
for x in extents
129-
write(ext, string(x))
130-
end
126+
io = IOBuffer()
127+
write(io,Cuint.((cmd, p1, p2, p3))...)
128+
ext = vcat(take!(io),extents)
129+
131130
lock(sl.l)
132131
write(sl.s, ext)
133132
msg = reinterpret(Cuint, sl.s)[4]
@@ -137,6 +136,10 @@ function _pigpio_command_ext(sl, cmd, p1, p2, p3, extents, rl=true)
137136
return res
138137
end
139138

139+
function _pigpio_command_ext(sl, cmd, p1, p2, p3, extents::IO, rl=true)
140+
_pigpio_command_ext(sl, cmd, p1, p2, p3, take!(extents), rl)
141+
end
142+
140143
"""An ADT class to hold callback information
141144
142145
* `gpio`: Broadcom GPIO number.

0 commit comments

Comments
 (0)