Skip to content

Enable i2c as a feature? #80

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

Closed
zuckschwerdt opened this issue Apr 1, 2022 · 6 comments · Fixed by #81
Closed

Enable i2c as a feature? #80

zuckschwerdt opened this issue Apr 1, 2022 · 6 comments · Fixed by #81

Comments

@zuckschwerdt
Copy link
Contributor

The dependency on i2cdev for i2c is currently the only thing tying this to linux. I confirmed this crate to compile and work on unix with i2c removed.
Would it be an option to offer i2c as a (default enabled) feature?

@ryankurte
Copy link
Contributor

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?

@zuckschwerdt
Copy link
Contributor Author

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).

@eldruin
Copy link
Member

eldruin commented Apr 2, 2022

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?

@zuckschwerdt
Copy link
Contributor Author

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.

@zuckschwerdt
Copy link
Contributor Author

For anyone wanting to test this, there are branches for 0.3 and 0.4 to show the changes:

@eldruin
Copy link
Member

eldruin commented Apr 5, 2022

Nice, would you create a PR with your feat-i2cspi04 branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants