-
Notifications
You must be signed in to change notification settings - Fork 60
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
Emhancement: Make I2C devices "shareable" #187
Comments
There is a "workaround" which does pretty much what the above suggests, but I think it would probably be better suited to the device factories themselves. NativeDeviceFactoryInterface factory = DeviceFactoryHelper.getNativeDeviceFactory();
String key = factory.createI2CKey(controller, address);
Device device = factory.getDevice(key);
if (device == null) device = I2CDevice(controller, address); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is an I2c "multiplexer" now available that allows for re-using multiple I2C addresses on the same I2C bus (ref TCA9548A ). An implementation of the multiplexer in Kotlin is at I2CMultiplexer.kt. This implementation works wonderfully when all the devices with the same address are attached to the multiplexer.
However...
If device A with address
0xF0
is attached to the "main" I2C bus and device B with address0xF0
is attached to the multiplexer, one of the devices will fail due toDeviceAlreadyOpenedException
. In practice, this device "re-use" is allowed per the I2C protocol (I think when a multiplexer channel is activated, that becomes the I2C "bus-master" until reset).The enhancement would be to modify the creation of the
InternalI2CDeviceInterface
to check for a pre-registered device and return that in lieu of throwing the duplicate device exception.The text was updated successfully, but these errors were encountered: