Closed zuckschwerdt closed 2 years ago
seems reasonable to me! though it may be a breaking change for folks selecting gpio
implementations at the moment, maybe both spi
and i2c
so we're consistent?
True, adding an i2c
feature would break default-features = false
(for gpio
selection) setups.
Alternative could be conditional compilation on target_os
, it would just-work and not expose settings. But there might be users wondering where i2c
is (on host != target).
I would be fine with adding spi
and i2c
features. We can do so in the upcoming 0.4.0 release, since it is breaking anyway and this does not seem time-critical to me.
Have you tested SPI to work on non-linux platforms? also, which platform are you working with?
Not time-critical at all, just ergonomics to me. I use modular hardware, missing components are expected. Building with inaccessible or missing hardware interfaces is fine for me. In my application it turns out to be less involved to just recognize a missing /dev/spidev, GPIO or serial at runtime then to stub out all the code.
For anyone wanting to test this, there are branches for 0.3 and 0.4 to show the changes:
Nice, would you create a PR with your feat-i2cspi04 branch?
The dependency on
i2cdev
fori2c
is currently the only thing tying this to linux. I confirmed this crate to compile and work on unix withi2c
removed. Would it be an option to offeri2c
as a (default enabled) feature?