File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -445,6 +445,30 @@ mod tests {
445
445
446
446
state. serial1 = Some ( serial) ;
447
447
}
448
+
449
+ #[ test]
450
+ fn test_busy_does_not_prevent_reading_data_register ( state : & mut super :: State ) {
451
+ let mut serial = state. serial1 . take ( ) . unwrap ( ) ;
452
+
453
+ while serial. is_busy ( ) { }
454
+
455
+ let b1 = TEST_MSG [ 0 ] ;
456
+ let b2 = TEST_MSG [ 1 ] ;
457
+
458
+ unwrap ! ( nb:: block!( serial. write( b1) ) ) ;
459
+ while !serial. is_busy ( ) { } // Wait until reception b1 started
460
+ while serial. is_busy ( ) { } // Wait until reception b1 complete
461
+ unwrap ! ( nb:: block!( serial. write( b2) ) ) ;
462
+ while !serial. is_busy ( ) { } // Wait until reception b2 started
463
+
464
+ let c1 = unwrap ! ( nb:: block!( serial. read( ) ) ) ; // b1 in data register, b2 in shift register
465
+ let c2 = unwrap ! ( nb:: block!( serial. read( ) ) ) ; // wait for b2 in data register
466
+
467
+ assert_eq ! ( b1, c1) ;
468
+ assert_eq ! ( b2, c2) ;
469
+
470
+ state. serial1 = Some ( serial) ;
471
+ }
448
472
}
449
473
450
474
// TODO: This maybe can be moved into a function inside the
You can’t perform that action at this time.
0 commit comments