Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

Adafruit_I2C.reverseByteOrder() in Adafruit_I2C.py is broken #48

Closed
pdp7 opened this issue Aug 21, 2016 · 3 comments
Closed

Adafruit_I2C.reverseByteOrder() in Adafruit_I2C.py is broken #48

pdp7 opened this issue Aug 21, 2016 · 3 comments

Comments

@pdp7
Copy link

pdp7 commented Aug 21, 2016

@tdicola: this issue for Adafruit_I2C.reverseByteOrder() in adafruit-beaglebone-io-python was raised by @phrogger:
adafruit/adafruit-beaglebone-io-python#82

The method Adafruit_I2C.reverseByteOrder() in Adafruit_I2C.py does not work.

It tries to automatically detect the presence of a 16 bit or 32 bit value by detecting the first byte containing non-zero bits. This fails whenever there are valid leading bytes containing zeros.

@jwcooper commented in adafruit-beaglebone-io-python/Adafruit_I2C.py:

Adafruit_I2C.py is essentially a fork of the Adafruit Raspberry Pi I2C module. Any pull requests for this module should be directed to the following, and I can pull them. I'd rather not deviate from the original: https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/tree/master/Adafruit_I2C

However, Adafruit_I2C now resides in this repo. reverseByteOrder() is located in Adafruit_GPIO/I2C.py

@ahogen
Copy link

ahogen commented Aug 7, 2017

crickets

@tdicola
Copy link
Contributor

tdicola commented Aug 23, 2017

I'm going to close this one as won't fix as the reverseByteOrder function is now effectively dead code that isn't used by the updated Adafruit_Python_* libraries (the libraries from this README: https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/). The original bug adafruit/adafruit-beaglebone-io-python#82 against the older Adafruit_I2C.py source for this function gets at the core issue that it's not really possible to make this function work for all 16-bit and 32-bit input. During the refactoring that created the updated libraries they switched from using this reverseByteOrder function to doing explicit byte order changes with the Python struct module. With no more dependencies let's plan to delete this function entirely. For now I'll change the function to throw a warning/error to catch if any dependency was missed and warn of the deprecation.

@tdicola tdicola closed this as completed Aug 23, 2017
tdicola added a commit that referenced this issue Aug 23, 2017
Throwing an error now based on deprecation from: #48
@pdp7
Copy link
Author

pdp7 commented Aug 24, 2017

@tdicola thanks for handling this issue

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

No branches or pull requests

3 participants