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
401401 // Assert CS
402402 s. cs_low ( ) ?;
403403 // Enter SPI mode.
404- let mut delay = Delay :: new_command ( ) ;
404+ let mut delay = Delay :: new ( s . options . acquire_retries ) ;
405405 for attempts in 1 .. {
406406 trace ! ( "Enter SPI mode, attempt: {}.." , attempts) ;
407407 match s. card_command ( CMD0 , 0 ) {
@@ -586,11 +586,18 @@ pub struct AcquireOpts {
586586 /// On by default because without it you might get silent data corruption on
587587 /// your card.
588588 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 ,
589593}
590594
591595impl Default for AcquireOpts {
592596 fn default ( ) -> Self {
593- AcquireOpts { use_crc : true }
597+ AcquireOpts {
598+ use_crc : true ,
599+ acquire_retries : 50 ,
600+ }
594601 }
595602}
596603
You can’t perform that action at this time.
0 commit comments