@@ -461,9 +461,7 @@ where
461461 self
462462 }
463463
464- /// Loads a sequence buffer.
465- /// NOTE: `buf` must live until the sequence is done playing, or it might play a corrupted sequence.
466- pub fn load_seq < B > ( & self , seq : Seq , buf : B ) -> Result < ( ) , Error >
464+ fn load_seq < B > ( & self , seq : Seq , buf : B ) -> Result < ( ) , Error >
467465 where
468466 B : ReadBuffer < Word = u16 > + ' static ,
469467 {
@@ -1094,19 +1092,28 @@ pub enum Error {
10941092
10951093pub trait Instance : private:: Sealed + Deref < Target = crate :: pac:: pwm0:: RegisterBlock > {
10961094 const INTERRUPT : Interrupt ;
1095+
1096+ /// Provides access to the associated internal duty buffer for the instance.
10971097 fn buffer ( ) -> & ' static mut Cell < [ u16 ; 4 ] > ;
10981098}
10991099
1100+ // Internal static duty buffers. One per instance.
11001101static mut BUF0 : Cell < [ u16 ; 4 ] > = Cell :: new ( [ 0 ; 4 ] ) ;
1102+ #[ cfg( not( any( feature = "52810" , feature = "52811" ) ) ) ]
1103+ static mut BUF1 : Cell < [ u16 ; 4 ] > = Cell :: new ( [ 0 ; 4 ] ) ;
1104+ #[ cfg( not( any( feature = "52810" , feature = "52811" ) ) ) ]
1105+ static mut BUF2 : Cell < [ u16 ; 4 ] > = Cell :: new ( [ 0 ; 4 ] ) ;
1106+ #[ cfg( not( any( feature = "52810" , feature = "52811" , feature = "52832" ) ) ) ]
1107+ static mut BUF3 : Cell < [ u16 ; 4 ] > = Cell :: new ( [ 0 ; 4 ] ) ;
1108+
11011109impl Instance for PWM0 {
11021110 const INTERRUPT : Interrupt = Interrupt :: PWM0 ;
1111+ #[ inline( always) ]
11031112 fn buffer ( ) -> & ' static mut Cell < [ u16 ; 4 ] > {
11041113 unsafe { & mut BUF0 }
11051114 }
11061115}
11071116
1108- #[ cfg( not( any( feature = "52810" , feature = "52811" ) ) ) ]
1109- static mut BUF1 : Cell < [ u16 ; 4 ] > = Cell :: new ( [ 0 ; 4 ] ) ;
11101117#[ cfg( not( any( feature = "52810" , feature = "52811" ) ) ) ]
11111118impl Instance for PWM1 {
11121119 const INTERRUPT : Interrupt = Interrupt :: PWM1 ;
@@ -1115,8 +1122,6 @@ impl Instance for PWM1 {
11151122 }
11161123}
11171124
1118- #[ cfg( not( any( feature = "52810" , feature = "52811" ) ) ) ]
1119- static mut BUF2 : Cell < [ u16 ; 4 ] > = Cell :: new ( [ 0 ; 4 ] ) ;
11201125#[ cfg( not( any( feature = "52810" , feature = "52811" ) ) ) ]
11211126impl Instance for PWM2 {
11221127 const INTERRUPT : Interrupt = Interrupt :: PWM2 ;
@@ -1125,8 +1130,6 @@ impl Instance for PWM2 {
11251130 }
11261131}
11271132
1128- #[ cfg( not( any( feature = "52810" , feature = "52811" , feature = "52832" ) ) ) ]
1129- static mut BUF3 : Cell < [ u16 ; 4 ] > = Cell :: new ( [ 0 ; 4 ] ) ;
11301133#[ cfg( not( any( feature = "52810" , feature = "52811" , feature = "52832" ) ) ) ]
11311134impl Instance for PWM3 {
11321135 const INTERRUPT : Interrupt = Interrupt :: PWM3 ;
0 commit comments