-
Notifications
You must be signed in to change notification settings - Fork 41
Provide proxies for I2C and SPI #62
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
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.
This is looking pretty good to me. Looked over the code, but don't have a sensor to use for testing.
Is 'protocol.py' the right name for the file containing the different bus-specific implementations?
I think protocol.py is a good name for it. It could perhaps be implementations.py
but I'm not really sure that is any more clear so not sure if it's better really. I can't think of anything that seems definitely better than protocol.py
Is there a better name than *_Impl?
I can't think of anything better than Impl, I think implementation conveys the idea of what it's doing well. Open to input from others though.
Based on feedback from @FoamyGuy.
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 had another look over this, and does look good to me.
I'll wait and see if we can get someone to test it with hardware. I can try to get a sensor after a bit if no one tries it out first.
I tested this successfully with
Using the simpletest script in the examples directory of this repo to connect via I2C and get readings from the sensor. Thanks again for working on this Dexter. |
Updating https://github.com/adafruit/Adafruit_CircuitPython_BME280 to 2.6.17 from 2.6.16: > Merge pull request adafruit/Adafruit_CircuitPython_BME280#62 from rsbohn/dexter0819 Updating https://github.com/adafruit/Adafruit_CircuitPython_HX8357 to 1.3.8 from 1.3.7: > Merge pull request adafruit/Adafruit_CircuitPython_HX8357#17 from tcfranks/main Updating https://github.com/adafruit/Adafruit_CircuitPython_LTR390 to 1.1.11 from 1.1.10: > Merge pull request adafruit/Adafruit_CircuitPython_LTR390#14 from tcfranks/main
basic.Adafruit_BME280 provides a simplified interface to the device.
advanced.Adafruit_BME280 provides additional functionality.
Each of the above classes has subclasses for _I2C and _SPI busses.
The user will instantiate the appropriate subclass based on their connection.
basic.Adafruit_BME280_I2C or basic.Adafruit_BME280_SPI for example.
pylint complains that there is duplicate code between the basic and advanced implementations. The code to instantiate, read, and write to the device
is duplicated in both implementations.
This pull request provides a single implementation for I2C and for SPI.
To use *_Impl I added a parameter to the init method
to set the selected implementation class.
Questions:
This work was part of the CircuitPythonDay2022 Sprint.