-
Notifications
You must be signed in to change notification settings - Fork 77
Added debug to i2c_device. #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Tested on Feather M4 with VCNL4040.
|
adafruit_bus_device/i2c_device.py
Outdated
@@ -147,10 +152,19 @@ def write_then_readinto(self, out_buffer, in_buffer, *, | |||
self.i2c.writeto_then_readfrom(self.device_address, out_buffer, in_buffer, | |||
out_start=out_start, out_end=out_end, | |||
in_start=in_start, in_end=in_end, stop=stop) | |||
if self._debug: | |||
print("i2c_device.writeto_then_readfrom.out_buffer:", [hex(i) for i in out_buffer]) | |||
print("i2c_device.writeto_then_readfrom.in_buffer:", [hex(i) for i in in_buffer]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to slice in_start and in_end here, ditto above for out_buffer
adafruit_bus_device/i2c_device.py
Outdated
else: | ||
# If we don't have a special implementation, we can fake it with two calls | ||
self.write(out_buffer, start=out_start, end=out_end, stop=stop) | ||
if self._debug: | ||
print("i2c_device.write_then_readinto.write.out_buffer:", | ||
[hex(i) for i in out_buffer]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slice here too
adafruit_bus_device/i2c_device.py
Outdated
self.readinto(in_buffer, start=in_start, end=in_end) | ||
if self._debug: | ||
print("i2c_device.write_then_readinto.readinto.in_buffer:", | ||
[hex(i) for i in in_buffer]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
n here!
print("i2c_device.writeto_then_readfrom.in_buffer:", [hex(i) for i in in_buffer]) | ||
print("i2c_device.writeto_then_readfrom.out_buffer:", | ||
[hex(i) for i in out_buffer[out_start:out_end]]) | ||
print("i2c_device.writeto_then_readfrom.in_buffer:", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think print the writebuffer slice before the command, then the readbuffer after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks!
Updating https://github.com/adafruit/Adafruit_CircuitPython_CharLCD to 3.1.2 from 3.1.1: > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#31 from khavik/patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_FocalTouch to 1.1.3 from 1.1.2: > Merge pull request adafruit/Adafruit_CircuitPython_FocalTouch#6 from TG-Techie/patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_BusDevice to 2.2.9 from 2.2.8: > Merge pull request adafruit/Adafruit_CircuitPython_BusDevice#24 from kattni/add-debug-to-i2cdevice Updating https://github.com/adafruit/Adafruit_CircuitPython_Register to 1.5.0 from 1.4.0: > Merge pull request adafruit/Adafruit_CircuitPython_Register#20 from kattni/bit-bits-16
No description provided.