embassy-rs / embassy

Modern embedded framework, using Rust and async.
https://embassy.dev
Apache License 2.0
5.15k stars 713 forks source link

Suggest exposing `embassy_stm32::CRC::reconfigure` as public. #1982

Open pmnxis opened 11 months ago

pmnxis commented 11 months ago

While CRC is currently a widely used checksum mechanism, the current design makes it difficult to reuse it across different software modules with different CrcConfig. To address this, I propose making the reconfigure function public.

However, by exposing it, developers using embassy will need to handle mutual exclusion. While this may introduce some complexity, it's often unavoidable when sharing a single hardware module. Providing comments and examples in the documentation can help guide developers on proper usage.

https://github.com/embassy-rs/embassy/blob/4da97433173fcab5196e7c2a69c295edff3588eb/embassy-stm32/src/crc/v2v3.rs#L68:L93

xoviat commented 11 months ago

Okay: new rule for consistency: pub fn set_config and pub fn reconfigure are prohibited. impl SetConfig for X must be used. there's some existing code that needs to be updated to reflect that.