Skip to content

Commit d8a7033

Browse files
committed
Update to uses slices.
1 parent a519739 commit d8a7033

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

adafruit_bus_device/i2c_device.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,20 @@ def write_then_readinto(self, out_buffer, in_buffer, *,
153153
out_start=out_start, out_end=out_end,
154154
in_start=in_start, in_end=in_end, stop=stop)
155155
if self._debug:
156-
print("i2c_device.writeto_then_readfrom.out_buffer:", [hex(i) for i in out_buffer])
157-
print("i2c_device.writeto_then_readfrom.in_buffer:", [hex(i) for i in in_buffer])
156+
print("i2c_device.writeto_then_readfrom.out_buffer:",
157+
[hex(i) for i in out_buffer[out_start:out_end]])
158+
print("i2c_device.writeto_then_readfrom.in_buffer:",
159+
[hex(i) for i in in_buffer[in_start:in_end]])
158160
else:
159161
# If we don't have a special implementation, we can fake it with two calls
160162
self.write(out_buffer, start=out_start, end=out_end, stop=stop)
161163
if self._debug:
162164
print("i2c_device.write_then_readinto.write.out_buffer:",
163-
[hex(i) for i in out_buffer])
165+
[hex(i) for i in out_buffer[out_start:out_end]])
164166
self.readinto(in_buffer, start=in_start, end=in_end)
165167
if self._debug:
166168
print("i2c_device.write_then_readinto.readinto.in_buffer:",
167-
[hex(i) for i in in_buffer])
169+
[hex(i) for i in in_buffer[in_start:in_end]])
168170

169171
#pylint: enable-msg=too-many-arguments
170172

0 commit comments

Comments
 (0)