tkeksa / lis2dh12

Platform-agnostic Rust driver for the LIS2DH12 accelerometer
Apache License 2.0
5 stars 8 forks source link

Fix the no_std problem #3

Closed nebelgrau77 closed 3 years ago

nebelgrau77 commented 3 years ago

I'm testing the crate with nRF52840 MCU, no_std. It wouldn't compile with the out_f32, and the reason is the num-traits, with has std as a dependency, unless default-features are set to false: https://docs.rs/crate/num-traits/0.2.14

Long term goal: modify the sample_rate function, which seems to be the only one requiring FromPrimitive trait, and therefore remove the need for a separate out_f32 feature: what do you think?

tkeksa commented 3 years ago

I will look how to simply remove num-traits dependency as it is really used at just one place.

nebelgrau77 commented 3 years ago

Great! I tried to figure it out myself but I think it might require some modification of how Scale etc. are implemented. I was thinking about this approach here:

https://github.com/lonesometraveler/lsm9ds1/blob/master/src/accel.rs