File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ pub mod transfer {
45
45
46
46
fn try_transfer < ' w > ( & mut self , words : & ' w mut [ W ] ) -> Result < & ' w [ W ] , S :: Error > {
47
47
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 ( ) ) ?;
50
50
}
51
51
52
52
Ok ( words)
@@ -68,8 +68,8 @@ pub mod write {
68
68
69
69
fn try_write ( & mut self , words : & [ W ] ) -> Result < ( ) , S :: Error > {
70
70
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 ( ) ) ?;
73
73
}
74
74
75
75
Ok ( ( ) )
@@ -96,8 +96,8 @@ pub mod write_iter {
96
96
WI : IntoIterator < Item = W > ,
97
97
{
98
98
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 ( ) ) ?;
101
101
}
102
102
103
103
Ok ( ( ) )
Original file line number Diff line number Diff line change 581
581
//! move || {
582
582
//! let n = buffer.len();
583
583
//! 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 ())?;
586
586
//! }
587
587
//!
588
588
//! Ok((spi, buffer))
Original file line number Diff line number Diff line change @@ -20,10 +20,10 @@ pub trait FullDuplex<Word> {
20
20
///
21
21
/// **NOTE** A word must be sent to the slave before attempting to call this
22
22
/// method.
23
- fn read ( & mut self ) -> nb:: Result < Word , Self :: Error > ;
23
+ fn try_read ( & mut self ) -> nb:: Result < Word , Self :: Error > ;
24
24
25
25
/// 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 > ;
27
27
}
28
28
29
29
/// Clock polarity
You can’t perform that action at this time.
0 commit comments