rust-embedded / embedded-hal

A Hardware Abstraction Layer (HAL) for embedded systems
Apache License 2.0
1.95k stars 197 forks source link

Should CS still be deasserted when flush fails? #533

Closed Dominaezzz closed 10 months ago

Dominaezzz commented 10 months ago

https://github.com/rust-embedded/embedded-hal/blob/84dfc74b59279eb433fde0c2b928570c4da59136/embedded-hal-bus/src/spi/shared.rs#L29

If that flush fails, shouldn't the error fall through to the de-assertion at the end of the function instead of returning immediately?

Sh3Rm4n commented 10 months ago

Isn't the result saved in op_res, which is bubbled up later, after the deassertion? The comment hints that this is exactly the intention.

So CS will be deasserted also in case of an error.

Dominaezzz commented 10 months ago

Apologies, I can't read :sweat_smile:, I missed the fact that that bit is in a closure, so the ? does the right thing.