Open vpochapuis opened 5 months ago
Thanks for the PR! This is a welcome addition, just a few notes:
.set_cs_to_clock_delay_ns()
setter instead. This has two advantages: it keeps the new()
signature simple for the simple case when you don't need delays, and is backwards-compatible.Thanks for the PR! This is a welcome addition, just a few notes:
* Some SPI chips also need a delay after the data, between the last clock and deasserting CS. Could you add that too? I think it could be a separate setting so you can set them to different values. * Perhaps the delay could default to 0 and be set with a `.set_cs_to_clock_delay_ns()` setter instead. This has two advantages: it keeps the `new()` signature simple for the simple case when you don't need delays, and is backwards-compatible.
Thank you for the feedback! I will do my best to apply those.
Note: I have some issue testing this on STM32F439ZI, unrelated issue to this, about the SPI communication CLK pin behavior
I will continue by testing on ESP32C3 awaiting I fix my issue on the STM32.
it might be a bug yes. please file an issue or join #embassy, we can discuss there.
it might be a bug yes. please file an issue or join #embassy, we can discuss there.
Issue created and solve at https://github.com/embassy-rs/embassy/issues/3039
What
Add support for cs to clock delay in
embedded-hal-bus
spi's device implementation.Resolves https://github.com/rust-embedded/embedded-hal/issues/539
Why
This feature is defined at https://docs.rs/embedded-hal/latest/embedded_hal/spi/index.html#cs-to-clock-delays and issued at https://github.com/rust-embedded/embedded-hal/issues/539
Some chips that communicates through SPI necessitate this feature in order to correctly communicate.
How
Added a field in the device structs in order to store the
cs_to_clock_delay
, with its adequate constructor parameter. The delay is applied in the shared transaction implementation, just after the CS is toggled.Notes
core::time::Duration
in the code, I would like to know if its a bad practice in embedded system implementation or not and why