Skip to content

NotImplementedError: Currently can only write a single byte in writeto_then_readfrom #7

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

Closed
tampe125 opened this issue Aug 29, 2019 · 7 comments

Comments

@tampe125
Copy link

I'm trying to read the distance using the VL6180X sensor on my Raspberry Pi.
Everything worked fine, but then I installed again the library and I'm getting the following error:

Traceback (most recent call last):
  File "distance.py", line 11, in <module>
    sensor = adafruit_vl6180x.VL6180X(i2c)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_vl6180x.py", line 109, in __init__
    if self._read_8(_VL6180X_REG_IDENTIFICATION_MODEL_ID) != 0xB4:
  File "/usr/local/lib/python3.7/dist-packages/adafruit_vl6180x.py", line 284, in _read_8
    i2c.write_then_readinto(bytes([(address >> 8) & 0xFF, address & 0xFF]), result)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 150, in write_then_readinto
    in_start=in_start, in_end=in_end)
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 70, in writeto_then_readfrom
    in_start=in_start, in_end=in_end, stop=stop)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 62, in writeto_then_readfrom
    raise NotImplementedError("Currently can only write a single byte in writeto_then_readfrom")
NotImplementedError: Currently can only write a single byte in writeto_then_readfrom

After further inspection, it seems that the culprit is the commit 74a7a7f . If I revert it everything works fine.
I can't grasp the whole picture since it's way over my head, but those changes are definitively related to the issue.

@caternuson
Copy link
Contributor

Looks like repeated starts aren't needed for this sensor:
image
so could probably switch to a write + readinto combo.

@ladyada
Copy link
Member

ladyada commented Aug 29, 2019

yah please try it!

@tampe125
Copy link
Author

tampe125 commented Sep 2, 2019

Hello @caternuson @ladyada , any news on this?

@ladyada
Copy link
Member

ladyada commented Sep 2, 2019

did you try the PR?
#8

@caternuson
Copy link
Contributor

@tampe125 Please try the 1.1.4 version of the library when it becomes available.

@caternuson
Copy link
Contributor

closing. version 1.1.4 should fix this. can reopen if needed.

@tampe125
Copy link
Author

Sorry for the late reply. I can confirm that the latest version of the library works correctly.
Thank you for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants