File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -379,9 +379,9 @@ where
379
379
}
380
380
}
381
381
// Wait for final TXE
382
- while self . spi . sr . read ( ) . txe ( ) . bit_is_clear ( ) { }
382
+ while ! self . is_tx_empty ( ) { }
383
383
// Wait for final !BSY
384
- while self . spi . sr . read ( ) . bsy ( ) . bit_is_set ( ) { }
384
+ while self . is_busy ( ) { }
385
385
// Clear OVR set due to dropped received values
386
386
let _ = self . read_data_reg ( ) ;
387
387
let _ = self . spi . sr . read ( ) ;
@@ -429,16 +429,25 @@ where
429
429
}
430
430
431
431
/// Returns true if the tx register is empty (and can accept data)
432
+ #[ inline]
432
433
pub fn is_tx_empty ( & self ) -> bool {
433
434
self . spi . sr . read ( ) . txe ( ) . bit_is_set ( )
434
435
}
435
436
436
437
/// Returns true if the rx register is not empty (and can be read)
438
+ #[ inline]
437
439
pub fn is_rx_not_empty ( & self ) -> bool {
438
440
self . spi . sr . read ( ) . rxne ( ) . bit_is_set ( )
439
441
}
440
442
443
+ /// Returns true if the transfer is in progress
444
+ #[ inline]
445
+ pub fn is_busy ( & self ) -> bool {
446
+ self . spi . sr . read ( ) . bsy ( ) . bit_is_set ( )
447
+ }
448
+
441
449
/// Returns true if data are received and the previous data have not yet been read from SPI_DR.
450
+ #[ inline]
442
451
pub fn is_overrun ( & self ) -> bool {
443
452
self . spi . sr . read ( ) . ovr ( ) . bit_is_set ( )
444
453
}
You can’t perform that action at this time.
0 commit comments