Skip to content

Commit b5ad852

Browse files
committed
Rename SPI trait methods try_*
1 parent 114534b commit b5ad852

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/blocking/spi.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ pub mod transfer {
4545

4646
fn try_transfer<'w>(&mut self, words: &'w mut [W]) -> Result<&'w [W], S::Error> {
4747
for word in words.iter_mut() {
48-
block!(self.send(word.clone()))?;
49-
*word = block!(self.read())?;
48+
block!(self.try_send(word.clone()))?;
49+
*word = block!(self.try_read())?;
5050
}
5151

5252
Ok(words)
@@ -68,8 +68,8 @@ pub mod write {
6868

6969
fn try_write(&mut self, words: &[W]) -> Result<(), S::Error> {
7070
for word in words {
71-
block!(self.send(word.clone()))?;
72-
block!(self.read())?;
71+
block!(self.try_send(word.clone()))?;
72+
block!(self.try_read())?;
7373
}
7474

7575
Ok(())
@@ -96,8 +96,8 @@ pub mod write_iter {
9696
WI: IntoIterator<Item = W>,
9797
{
9898
for word in words.into_iter() {
99-
block!(self.send(word.clone()))?;
100-
block!(self.read())?;
99+
block!(self.try_send(word.clone()))?;
100+
block!(self.try_read())?;
101101
}
102102

103103
Ok(())

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,8 @@
581581
//! move || {
582582
//! let n = buffer.len();
583583
//! for i in 0..n {
584-
//! nb::r#await!(spi.send(buffer[i]))?;
585-
//! buffer[i] = nb::r#await!(spi.read())?;
584+
//! nb::r#await!(spi.try_send(buffer[i]))?;
585+
//! buffer[i] = nb::r#await!(spi.try_read())?;
586586
//! }
587587
//!
588588
//! Ok((spi, buffer))

src/spi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ pub trait FullDuplex<Word> {
2020
///
2121
/// **NOTE** A word must be sent to the slave before attempting to call this
2222
/// method.
23-
fn read(&mut self) -> nb::Result<Word, Self::Error>;
23+
fn try_read(&mut self) -> nb::Result<Word, Self::Error>;
2424

2525
/// Sends a word to the slave
26-
fn send(&mut self, word: Word) -> nb::Result<(), Self::Error>;
26+
fn try_send(&mut self, word: Word) -> nb::Result<(), Self::Error>;
2727
}
2828

2929
/// Clock polarity

0 commit comments

Comments
 (0)