@@ -301,6 +301,9 @@ pub struct TransferConfig {
301
301
/// the BMSTOP bit is set on a dataword. A frame is defined as CSn being active for the
302
302
/// duration of multiple data words
303
303
pub blockmode : bool ,
304
+ /// Only used when blockmode is used. The SCK will be stalled until an explicit stop bit
305
+ /// is set on a written word.
306
+ pub bmstall : bool ,
304
307
pub hw_cs : HwChipSelectId ,
305
308
}
306
309
@@ -309,6 +312,7 @@ impl TransferConfigWithHwcs<NoneT> {
309
312
clk_cfg : Option < SpiClkConfig > ,
310
313
mode : Option < Mode > ,
311
314
blockmode : bool ,
315
+ bmstall : bool ,
312
316
sod : bool ,
313
317
) -> Self {
314
318
TransferConfigWithHwcs {
@@ -318,6 +322,7 @@ impl TransferConfigWithHwcs<NoneT> {
318
322
mode,
319
323
sod,
320
324
blockmode,
325
+ bmstall,
321
326
hw_cs : HwChipSelectId :: Invalid ,
322
327
} ,
323
328
}
@@ -330,6 +335,7 @@ impl<HwCs: HwCsProvider> TransferConfigWithHwcs<HwCs> {
330
335
mode : Option < Mode > ,
331
336
hw_cs : Option < HwCs > ,
332
337
blockmode : bool ,
338
+ bmstall : bool ,
333
339
sod : bool ,
334
340
) -> Self {
335
341
TransferConfigWithHwcs {
@@ -339,6 +345,7 @@ impl<HwCs: HwCsProvider> TransferConfigWithHwcs<HwCs> {
339
345
mode,
340
346
sod,
341
347
blockmode,
348
+ bmstall,
342
349
hw_cs : HwCs :: CS_ID ,
343
350
} ,
344
351
}
@@ -421,6 +428,11 @@ impl SpiConfig {
421
428
self
422
429
}
423
430
431
+ pub fn bmstall ( mut self , enable : bool ) -> Self {
432
+ self . bmstall = enable;
433
+ self
434
+ }
435
+
424
436
pub fn mode ( mut self , mode : Mode ) -> Self {
425
437
self . init_mode = mode;
426
438
self
@@ -744,12 +756,8 @@ where
744
756
} else {
745
757
w. sod ( ) . clear_bit ( ) ;
746
758
}
747
- if transfer_cfg. cfg . blockmode {
748
- w. blockmode ( ) . set_bit ( ) ;
749
- } else {
750
- w. blockmode ( ) . clear_bit ( ) ;
751
- }
752
- w
759
+ w. blockmode ( ) . bit ( transfer_cfg. cfg . blockmode ) ;
760
+ w. bmstall ( ) . bit ( transfer_cfg. cfg . bmstall )
753
761
} ) ;
754
762
}
755
763
0 commit comments