@@ -461,9 +461,7 @@ where
461
461
self
462
462
}
463
463
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 >
467
465
where
468
466
B : ReadBuffer < Word = u16 > + ' static ,
469
467
{
@@ -1094,19 +1092,28 @@ pub enum Error {
1094
1092
1095
1093
pub trait Instance : private:: Sealed + Deref < Target = crate :: pac:: pwm0:: RegisterBlock > {
1096
1094
const INTERRUPT : Interrupt ;
1095
+
1096
+ /// Provides access to the associated internal duty buffer for the instance.
1097
1097
fn buffer ( ) -> & ' static mut Cell < [ u16 ; 4 ] > ;
1098
1098
}
1099
1099
1100
+ // Internal static duty buffers. One per instance.
1100
1101
static 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
+
1101
1109
impl Instance for PWM0 {
1102
1110
const INTERRUPT : Interrupt = Interrupt :: PWM0 ;
1111
+ #[ inline( always) ]
1103
1112
fn buffer ( ) -> & ' static mut Cell < [ u16 ; 4 ] > {
1104
1113
unsafe { & mut BUF0 }
1105
1114
}
1106
1115
}
1107
1116
1108
- #[ cfg( not( any( feature = "52810" , feature = "52811" ) ) ) ]
1109
- static mut BUF1 : Cell < [ u16 ; 4 ] > = Cell :: new ( [ 0 ; 4 ] ) ;
1110
1117
#[ cfg( not( any( feature = "52810" , feature = "52811" ) ) ) ]
1111
1118
impl Instance for PWM1 {
1112
1119
const INTERRUPT : Interrupt = Interrupt :: PWM1 ;
@@ -1115,8 +1122,6 @@ impl Instance for PWM1 {
1115
1122
}
1116
1123
}
1117
1124
1118
- #[ cfg( not( any( feature = "52810" , feature = "52811" ) ) ) ]
1119
- static mut BUF2 : Cell < [ u16 ; 4 ] > = Cell :: new ( [ 0 ; 4 ] ) ;
1120
1125
#[ cfg( not( any( feature = "52810" , feature = "52811" ) ) ) ]
1121
1126
impl Instance for PWM2 {
1122
1127
const INTERRUPT : Interrupt = Interrupt :: PWM2 ;
@@ -1125,8 +1130,6 @@ impl Instance for PWM2 {
1125
1130
}
1126
1131
}
1127
1132
1128
- #[ cfg( not( any( feature = "52810" , feature = "52811" , feature = "52832" ) ) ) ]
1129
- static mut BUF3 : Cell < [ u16 ; 4 ] > = Cell :: new ( [ 0 ; 4 ] ) ;
1130
1133
#[ cfg( not( any( feature = "52810" , feature = "52811" , feature = "52832" ) ) ) ]
1131
1134
impl Instance for PWM3 {
1132
1135
const INTERRUPT : Interrupt = Interrupt :: PWM3 ;
0 commit comments