@@ -38,17 +38,17 @@ pub trait WriteIter<W> {
38
38
WI : IntoIterator < Item = W > ;
39
39
}
40
40
41
- /// ManagedCS marker trait indicates the CS pin is managed by the underlying driver.
41
+ /// `ManagedCs` marker trait indicates the chip-select (CS) pin is managed by the underlying driver.
42
42
///
43
- /// This specifies that all `spi` operations will be preceded by asserting the CS pin,
43
+ /// This specifies that all SPI operations will be preceded by asserting the CS pin,
44
44
/// and followed by de-asserting the CS pin, prior to returning from the method.
45
45
///
46
46
/// This is important for shared bus access to ensure that only one CS can be asserted
47
47
/// at a given time. Drivers should require this (and not manage their own CS pins)
48
48
/// in order to support shared use.
49
49
///
50
50
/// To chain operations within one transaction see [Transactional].
51
- /// For or a convenience wrapper defining this type for non-shared / exclusive use
51
+ /// For a convenience wrapper defining this type for non-shared / exclusive use
52
52
/// see [`SpiWithCs`](spi_with_cs::SpiWithCs).
53
53
pub trait ManagedCs { }
54
54
@@ -66,7 +66,7 @@ pub enum Operation<'a, W: 'static> {
66
66
/// Transactional trait allows multiple actions to be executed
67
67
/// as part of a single SPI transaction.
68
68
///
69
- /// This API guarantees ordering , ensuring operations from
69
+ /// This API guarantees grouping , ensuring operations from
70
70
/// different sources will not be interleaved on a shared bus.
71
71
/// [ManagedCs]
72
72
pub trait Transactional < W : ' static > {
@@ -106,7 +106,7 @@ pub mod spi_with_cs {
106
106
Pin ( PinError ) ,
107
107
}
108
108
109
- /// ManagedCS marker trait indicates Chip Select management is automatic
109
+ /// `ManagedCs` marker trait indicates chip-select management is automatic
110
110
impl < Spi , SpiError , Pin , PinError > ManagedCs for SpiWithCs < Spi , SpiError , Pin , PinError > { }
111
111
112
112
impl < Spi , SpiError , Pin , PinError > SpiWithCs < Spi , SpiError , Pin , PinError >
@@ -115,7 +115,7 @@ pub mod spi_with_cs {
115
115
SpiError : Debug ,
116
116
PinError : Debug ,
117
117
{
118
- /// Create a new SpiWithCS wrapper with the provided Spi and Pin
118
+ /// Create a new `SpiWithCs` wrapper with the provided SPI bus and Pin
119
119
pub fn new ( spi : Spi , cs : Pin ) -> Self {
120
120
Self {
121
121
spi,
@@ -125,13 +125,14 @@ pub mod spi_with_cs {
125
125
}
126
126
}
127
127
128
- /// Fetch references to the inner Spi and Pin types.
128
+ /// Fetch references to the inner SPI bus and Pin types
129
+ ///
129
130
/// Note that using these directly will violate the `ManagedCs` constraint.
130
131
pub fn inner ( & mut self ) -> ( & mut Spi , & mut Pin ) {
131
132
( & mut self . spi , & mut self . cs )
132
133
}
133
134
134
- /// Destroy the SpiWithCs wrapper, returning the bus and pin objects
135
+ /// Destroy the ` SpiWithCs` wrapper, returning the SPI bus and Pin objects
135
136
pub fn destroy ( self ) -> ( Spi , Pin ) {
136
137
( self . spi , self . cs )
137
138
}
@@ -157,7 +158,7 @@ pub mod spi_with_cs {
157
158
// Deassert CS
158
159
self . cs . set_high ( ) . map_err ( SpiWithCsError :: Pin ) ?;
159
160
160
- // Return failures
161
+ // Return transfer result or failure
161
162
spi_result
162
163
}
163
164
}
@@ -182,7 +183,7 @@ pub mod spi_with_cs {
182
183
// Deassert CS
183
184
self . cs . set_high ( ) . map_err ( SpiWithCsError :: Pin ) ?;
184
185
185
- // Return failures
186
+ // Return transfer result or failure
186
187
spi_result
187
188
}
188
189
}
@@ -210,7 +211,7 @@ pub mod spi_with_cs {
210
211
// Deassert CS
211
212
self . cs . set_high ( ) . map_err ( SpiWithCsError :: Pin ) ?;
212
213
213
- // Return failures
214
+ // Return transfer result or failure
214
215
spi_result
215
216
}
216
217
}
0 commit comments