kvark / mint

Math Interoperability Types
MIT License
256 stars 20 forks source link

derive(defmt::Format) for embedded systems #77

Open elpiel opened 9 months ago

elpiel commented 9 months ago

It would be nice to introduce defmt as dependency (it will bump MSRV to 1.65 I believe) and add the derives behind a feature.

I see there hasn't been much development in the crate but there are some opened PRs and I think this would a good addition as a feature especially since embedded-hal 1.0 crate was recently released and there are a few driver crates that use mint like the bno055 one.

Ralith commented 9 months ago

The intention is generally that you store your data in (and display it with) more feature-rich types, and convert to mint only when passing through interfaces. You can also just call as_ref() and display the underlying array.

elpiel commented 9 months ago

I understand this, however, there's already a serde feature and when working on embedded systems I tend to directly use the structures provided by the driver crate when logging information.

It would also help if you can keep the structure dating instead of obscuring it as an array.

It's also common in the community to include defmt derives, including in embassy and embedded-hal: https://docs.rs/crate/embedded-hal/latest/features