Skip to content
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

[WIP] i2csensors: Become no_std #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrysn
Copy link

@chrysn chrysn commented Aug 27, 2018

  • Numeric traits are replaced with their core counterparts.
  • Errors don't need to implement std:error::Error any more.
  • Altitude-from-pressure was commented out until there is a libm
    implementation of powf (1, probably)

This is early work to allow using the I2C sensor traits also on no_std platforms, like in klemens/si7021-rs#1. Before I proceed here, I'd like to solicit the maintainer's opinions:

  • Are the type constraints on T::Error to be std::Error actually justified and depended on? (My impression is that as long as one uses base devices whose errors are std, they're usable in the end anyway; only "sensor middleware" like Altimeter for Barometer can't access the error types as std if they're not required, and they can still restrict their implementations to where T::Error: std::error::Error if they do need that.)
  • If they need to stay, would you be OK with a configure feature that waives that limitation?

* Numeric traits are replaced with their core counterparts.
* Errors don't need to implement std:error::Error any more.
* Altitude-from-pressure was commented out until there is a libm
  implementation of powf ([1], probably)

[1]: rust-num/num-traits#75
@martindeegan
Copy link
Owner

Looks good to me. Don't the math operations for Vec3 also need to be removed?

@chrysn
Copy link
Author

chrysn commented Sep 4, 2018 via email

@martindeegan
Copy link
Owner

Cool, tell me when this is ready to merge.

Additionally, since I have not had time to maintain this repo, I could add you as a maintainer if you'd like. It would be nice to switch to convert to embedded-hal and be added to their support list.

@chrysn
Copy link
Author

chrysn commented Sep 4, 2018 via email

@ryan-summers
Copy link

@chrysn I recognize that this has been quite a while, but it looks like the referenced issue for num-traits has been closed - is there a powf implementation available now? I'd be happy to take over this PR if you're too busy (I'm also interested in updating the Si7021 device crate to work no-std).

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 this pull request may close these issues.

3 participants