Skip to content

Commit

Permalink
rxbuf requires two arguments (issue #19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Dec 23, 2024
1 parent 4048e29 commit ea8de28
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/i2c.jl
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ function i2c_read_block_data(self::Pi, handle, reg)
# Don't raise exception. Must release lock.
bytes = u2i(_pigpio_command(self.sl, _PI_CMD_I2CRK, handle, reg, false))
if bytes > 0
data = rxbuf(bytes)
data = rxbuf(self,bytes)
else
data = ""
end
Expand Down Expand Up @@ -614,7 +614,7 @@ function i2c_zip(self::Pi, handle, data)
bytes = u2i(_pigpio_command_ext(
self.sl, _PI_CMD_I2CZ, handle, 0, length(data), data, false))
if bytes > 0
data = self._rxbuf(bytes)
data = rxbuf(self,bytes)
else
data = ""
end
Expand Down Expand Up @@ -756,7 +756,7 @@ function bb_i2c_zip(self::Pi, SDA, data)
bytes = u2i(_pigpio_command_ext(
self.sl, _PI_CMD_BI2CZ, SDA, 0, length(data), [data], false))
if bytes > 0
data = self._rxbuf(bytes)
data = rxbuf(self,bytes)
else
data = ""
end
Expand Down
2 changes: 1 addition & 1 deletion src/pi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ function custom_2(self, arg1=0, argx=[], retMax=8192)
bytes = u2i(_pigpio_command_ext(
self.sl, _PI_CMD_CF2, arg1, retMax, length(argx), [argx], false))
if bytes > 0
data = rxbuf(bytes)
data = rxbuf(self,bytes)
else
data = ""
end
Expand Down
11 changes: 7 additions & 4 deletions src/spiSerial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function spi_read(self::Pi, handle, count)
bytes = u2i(_pigpio_command(
self.sl, _PI_CMD_SPIR, handle, count, false))
if bytes > 0
data = rxbuf(bytes)
data = rxbuf(self,bytes)
else
data = ""
end
Expand Down Expand Up @@ -195,11 +195,14 @@ function spi_xfer(self::Pi, handle, data)
## extension ##
# s len data bytes

# python code
# https://github.com/joan2937/pigpio/blob/c33738a320a3e28824af7807edafda440952c05d/pigpio.py#L4045

# Don't raise exception. Must release lock.
bytes = u2i(_pigpio_command_ext(
self.sl, _PI_CMD_SPIX, handle, 0, length(data), data, false))
if bytes > 0
data = rxbuf(bytes)
data = rxbuf(self,bytes)
else
data = ""
end
Expand Down Expand Up @@ -306,7 +309,7 @@ function serial_read(self::Pi, handle, count)
bytes = u2i(
_pigpio_command(self.sl, _PI_CMD_SERR, handle, count, false))
if bytes > 0
data = rxbuf(bytes)
data = rxbuf(self,bytes)
else
data = ""
end
Expand Down Expand Up @@ -418,7 +421,7 @@ function bb_serial_read(self, user_gpio)
bytes = u2i(
_pigpio_command(self.sl, _PI_CMD_SLR, user_gpio, 10000, false))
if bytes > 0
data = self._rxbuf(bytes)
data = rxbuf(self,bytes)
else
data = ""
end
Expand Down

0 comments on commit ea8de28

Please sign in to comment.