File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -401,7 +401,7 @@ where
401
401
// Assert CS
402
402
s. cs_low ( ) ?;
403
403
// Enter SPI mode.
404
- let mut delay = Delay :: new_command ( ) ;
404
+ let mut delay = Delay :: new ( s . options . acquire_retries ) ;
405
405
for attempts in 1 .. {
406
406
trace ! ( "Enter SPI mode, attempt: {}.." , attempts) ;
407
407
match s. card_command ( CMD0 , 0 ) {
@@ -586,11 +586,18 @@ pub struct AcquireOpts {
586
586
/// On by default because without it you might get silent data corruption on
587
587
/// your card.
588
588
pub use_crc : bool ,
589
+
590
+ /// Sets the number of times we will retry to acquire the card before giving up and returning
591
+ /// `Err(Error::CardNotFound)`. By default, card acquisition will be retried 50 times.
592
+ pub acquire_retries : u32 ,
589
593
}
590
594
591
595
impl Default for AcquireOpts {
592
596
fn default ( ) -> Self {
593
- AcquireOpts { use_crc : true }
597
+ AcquireOpts {
598
+ use_crc : true ,
599
+ acquire_retries : 50 ,
600
+ }
594
601
}
595
602
}
596
603
You can’t perform that action at this time.
0 commit comments