Closed jerryneedell closed 5 years ago
The shared library was in place from @tannewt and @kattni's previous work. The library isn't very big and iI don't know if it's set up this way for more for backwards compatibility or convenience. Maybe they can chime in on this one.
There may well be better ways to do this -- I just wanted to capture the issue.
Why don't we just pass the I2C device into the alphanum_featherwing (and others) library like we do for the sensor libraries or have a n optional argument for it - if it is omitted or None then the lib can create it.
I'd like to keep it simple to initialize, however giving the user the option to pass it in but initializing inside the class like it does now if it's not passed in may be a good compromise.
I think that is better than the user having to import shared.py from adafruit_featherwing and use shared.I2C_BUS. That works, but seems awfully kludgey to me
As Kattni said, it was intended to reduce duplicate code, but if it is broken we can change it.
NP -- your call -- as long there is a documented way to use multiple sensors with the wings, I'll be happy.
Yeah, I was eventually planning on adding some more examples that used multiple wings, so I may attempt that sooner than I originally planned.
I think the shared bit was added before board.I2C(). I'd suggest using board.I2C() from now on and replacing the shared stuff. By using board.I2C() it's easier to use for external stuff.
Fixed by #36.
This is just FYI regardsing some experimentation I have been doing
I was trying to use the an alphanumeric display vi the featherwing library along with some other I2C sesnors. I wanted to get the sensor data and display it on the alphanumeric featherwing. A common use case, I think.
When I tried to create the sensor objects, i got errors indicating that the I2C pins were "in use".
I experimented a bit using the board.I2C() function instead of the busio.I2C() with the sensors and got it working, but then found that if I make the following change, I think shared.py becomes unnecessary.
here is the test code I am running
One issue I an into was that in the current master, board.I2C() is not implemented for the particle boards and I was testing on a particle_argon. I implmented it in a local build and it now is working. It was already implemented in the feather_nrf52840.