Skip to content

Commit

Permalink
do not convert elements of extents to string
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Nov 12, 2024
1 parent 849f3aa commit c80dd92
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/pi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,10 @@ Runs an extended pigpio socket command.
* `extents`: additional data blocks
"""
function _pigpio_command_ext(sl, cmd, p1, p2, p3, extents, rl=true)
ext = IOBuffer()
Base.write(ext, Array(reinterpret(UInt8, [cmd, p1, p2, p3])))
for x in extents
write(ext, string(x))
end
io = IOBuffer()
write(io,Cuint.((cmd, p1, p2, p3))...)
ext = vcat(take!(io),extents)

lock(sl.l)
write(sl.s, ext)
msg = reinterpret(Cuint, sl.s)[4]
Expand All @@ -137,6 +136,10 @@ function _pigpio_command_ext(sl, cmd, p1, p2, p3, extents, rl=true)
return res
end

function _pigpio_command_ext(sl, cmd, p1, p2, p3, extents::IO, rl=true)
_pigpio_command_ext(sl, cmd, p1, p2, p3, take!(extents), rl)
end

"""An ADT class to hold callback information
* `gpio`: Broadcom GPIO number.
Expand Down

0 comments on commit c80dd92

Please sign in to comment.