@@ -531,9 +531,6 @@ where
531
531
B0 : ReadBuffer < Word = u16 > + ' static ,
532
532
B1 : ReadBuffer < Word = u16 > + ' static ,
533
533
{
534
- self . pwm . seq0 . cnt . write ( |w| unsafe { w. bits ( 0 ) } ) ;
535
- self . pwm . seq1 . cnt . write ( |w| unsafe { w. bits ( 0 ) } ) ;
536
-
537
534
if let Some ( buf) = & seq0_buffer {
538
535
let ( ptr, len) = unsafe { buf. read_buffer ( ) } ;
539
536
if ( ptr as usize ) < SRAM_LOWER || ( ptr as usize ) > SRAM_UPPER {
@@ -548,13 +545,15 @@ where
548
545
return Err ( ( Error :: BufferTooLong , self , seq0_buffer, seq1_buffer) ) ;
549
546
}
550
547
compiler_fence ( Ordering :: SeqCst ) ;
551
-
552
548
self . pwm . seq0 . ptr . write ( |w| unsafe { w. bits ( ptr as u32 ) } ) ;
553
549
self . pwm . seq0 . cnt . write ( |w| unsafe { w. bits ( len as u32 ) } ) ;
554
550
if start {
555
551
self . start_seq ( Seq :: Seq0 ) ;
556
552
}
553
+ } else {
554
+ self . pwm . seq0 . cnt . write ( |w| unsafe { w. bits ( 0 ) } ) ;
557
555
}
556
+
558
557
if let Some ( buf) = & seq1_buffer {
559
558
let ( ptr, len) = unsafe { buf. read_buffer ( ) } ;
560
559
if ( ptr as usize ) < SRAM_LOWER || ( ptr as usize ) > SRAM_UPPER {
@@ -569,12 +568,13 @@ where
569
568
return Err ( ( Error :: BufferTooLong , self , seq0_buffer, seq1_buffer) ) ;
570
569
}
571
570
compiler_fence ( Ordering :: SeqCst ) ;
572
-
573
571
self . pwm . seq1 . ptr . write ( |w| unsafe { w. bits ( ptr as u32 ) } ) ;
574
572
self . pwm . seq1 . cnt . write ( |w| unsafe { w. bits ( len as u32 ) } ) ;
575
573
if start {
576
574
self . start_seq ( Seq :: Seq1 ) ;
577
575
}
576
+ } else {
577
+ self . pwm . seq1 . cnt . write ( |w| unsafe { w. bits ( 0 ) } ) ;
578
578
}
579
579
580
580
Ok ( PwmSeq {
0 commit comments