Skip to content

Commit 7662ead

Browse files
committed
SpiDevice: add guidelines for behaviour of CS pin upon bus failures
1 parent d5cdf33 commit 7662ead

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/spi/blocking.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ pub trait SpiDevice: ErrorType {
195195
/// The locking mechanism is implementation-defined. The only requirement is it must prevent two
196196
/// transactions from executing concurrently against the same bus. Examples of implementations are:
197197
/// critical sections, blocking mutexes, returning an error or panicking if the bus is already busy.
198+
///
199+
/// On bus errors the implementation should try to deassert CS.
200+
/// If an error occurs while deasserting CS the bus error should take priority as the return value.
198201
fn transaction<R>(
199202
&mut self,
200203
f: impl FnOnce(&mut Self::Bus) -> Result<R, <Self::Bus as ErrorType>::Error>,

0 commit comments

Comments
 (0)