@@ -78,6 +78,7 @@ pub struct spi_ioc_transfer<'a, 'b> {
7878}
7979
8080impl < ' a , ' b > spi_ioc_transfer < ' a , ' b > {
81+ /// Create a read transfer
8182 pub fn read ( buff : & ' b mut [ u8 ] ) -> Self {
8283 spi_ioc_transfer {
8384 rx_buf : buff. as_ptr ( ) as * const ( ) as usize as u64 ,
@@ -86,6 +87,7 @@ impl<'a, 'b> spi_ioc_transfer<'a, 'b> {
8687 }
8788 }
8889
90+ /// Create a write transfer
8991 pub fn write ( buff : & ' a [ u8 ] ) -> Self {
9092 spi_ioc_transfer {
9193 tx_buf : buff. as_ptr ( ) as * const ( ) as usize as u64 ,
@@ -94,7 +96,8 @@ impl<'a, 'b> spi_ioc_transfer<'a, 'b> {
9496 }
9597 }
9698
97- /// The `tx_buf` and `rx_buf` must be the same length.
99+ /// Create a read/write transfer.
100+ /// Note that the `tx_buf` and `rx_buf` must be the same length.
98101 pub fn read_write ( tx_buf : & ' a [ u8 ] , rx_buf : & ' b mut [ u8 ] ) -> Self {
99102 assert_eq ! ( tx_buf. len( ) , rx_buf. len( ) ) ;
100103 spi_ioc_transfer {
@@ -104,6 +107,15 @@ impl<'a, 'b> spi_ioc_transfer<'a, 'b> {
104107 ..Default :: default ( )
105108 }
106109 }
110+
111+ /// Create a delay transfer of a number of microseconds
112+ pub fn delay ( microseconds : u16 ) -> Self {
113+ spi_ioc_transfer {
114+ delay_usecs : microseconds,
115+ len : 0 ,
116+ ..Default :: default ( )
117+ }
118+ }
107119}
108120
109121mod ioctl {
0 commit comments