eldruin / bmi160-rs

Platform-agnostic Rust driver for the BMI160 inertial measurement unit (IMU)
Apache License 2.0
12 stars 11 forks source link

Provide a way to get meaningful data from the sensor #2

Closed TheButlah closed 6 months ago

TheButlah commented 1 year ago

the data returned is in i16 format. Without a way to access the sensor range, I can't convert this to a float.

eldruin commented 1 year ago

The sensor range will depend on the parameters that you have set. You can have a look at the datasheet to see how to perform a conversion. I would welcome code that does the scaling in this crate, though. You can have a look here for an example.

TheButlah commented 1 year ago

Once I implement it and test it in my code, I can implement a PR to add functionality for reading FSR

thedevleon commented 1 year ago

Once I implement it and test it in my code, I can implement a PR to add functionality for reading FSR

Any progress on this?

thedevleon commented 1 year ago

I guess code from here could be integrated? https://github.com/SlimeVR/SlimeVR-Rust/blob/main/firmware/src/imu/drivers/bmi160/mod.rs https://github.com/SlimeVR/SlimeVR-Rust/blob/main/firmware/src/imu/drivers/bmi160/math.rs

TheButlah commented 1 year ago

Yes feel free to use the code - I haven't been working on this recently but yes it did seem to be working.

TheButlah commented 1 year ago

From what I remember, the maintainer didn't want to bump the MSRV and I use plenty of const code in what you linked. So I didn't submit a PR at the time.

eldruin commented 1 year ago

As I said, please feel free to add support for that here. Over in #1 I preferred to remove the const qualifier because it was just one trivial function. Bumping the MSRV is fine.

eldruin commented 6 months ago

Fixed in #9 and published in 1.1.0. Thanks everybody!