Experimental multiple i2c bus support #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an experimental fix for #33 (I have no hardware to test locally, so I've only tested that this compiles).
It fixes the issue of the i2c read/write and multi functions being global, so that if you attempted to initialise several sensors on different i2c busses then you'd only actually be talking to the last initialised bus, since the read/write/multi function pointers were being overwritten.
This is achieved by moving the i2c IO functions into VL53L1_DEV and passing them in through
_TOF_LIBRARY.initialise
instead of_TOF_LIBRARY.VL53L1_set_i2c
.This should have no impact on existing setups.
It might be worth also moving the i2c mutex into VL53L1_DEV, since it only needs to be per i2c bus.