bluerobotics / ping-rs

https://docs.bluerobotics.com/ping-rs/bluerobotics_ping/
MIT License
5 stars 5 forks source link

No-std support #68

Open thunderstorm010 opened 4 days ago

thunderstorm010 commented 4 days ago

I'd like to use this library on some STM32 chips.

patrickelectric commented 4 days ago

Hi @thunderstorm010, that would be nice to have in the message generation, to generate messages that can be used in embedded applications.

thunderstorm010 commented 4 days ago

I've created a very, very small subset of this library at https://github.com/thunderstorm010/ping-protocol-core.git. It only includes decoding and serializing functions. Open for everything.

RaulTrombin commented 3 days ago

Hey @thunderstorm010, to make it broadly available as no-std, we need to think about how to replace the tokio ecosystem features. I did a quick attempt by splitting out decoder.rs and message.rs into an inner core project (https://github.com/RaulTromber/ping-rs/tree/split_no_std_method). Then in /ping-protocol-core: cross build --target thumbv7em-none-eabihf --example stm32 --features stm32 With this approach, the examples still run on the main crate, but we need to put more effort into checking everything. It would be nice to forward the message generation from builder to this inner crate.

thunderstorm010 commented 3 days ago

Your code looks quite cool tbh, but as with upstream the code in decoder.rs involves a lot of unnecessary cloning (which I mostly removed in my version). I think I can contribute some of this code (without smallvec stuff) to upstream.

And, we should probably feature gate alloc.

patrickelectric commented 3 days ago

Hi @thunderstorm010, that would be cool, be free to send a PR