Skip to content

Commit dad7532

Browse files
committed
add enable sync to remaining places
1 parent 8fac96b commit dad7532

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

hal/src/peripherals/pwm/d11.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,13 @@ impl $crate::ehal_02::PwmPin for $TYPE {
113113
fn disable(&mut self) {
114114
let count = self.tc.count16();
115115
count.ctrla().modify(|_, w| w.enable().clear_bit());
116+
while count.syncbusy().read().enable().bit_is_set() {}
116117
}
117118

118119
fn enable(&mut self) {
119120
let count = self.tc.count16();
120121
count.ctrla().modify(|_, w| w.enable().set_bit());
122+
while count.syncbusy().read().enable().bit_is_set() {}
121123
}
122124

123125
fn get_duty(&self) -> Self::Duty {
@@ -228,10 +230,12 @@ impl $crate::ehal_02::Pwm for $TYPE {
228230

229231
fn disable(&mut self, _channel: Self::Channel) {
230232
self.tcc.ctrla().modify(|_, w| w.enable().clear_bit());
233+
while self.tcc.syncbusy().read().enable().bit_is_set() {}
231234
}
232235

233236
fn enable(&mut self, _channel: Self::Channel) {
234237
self.tcc.ctrla().modify(|_, w| w.enable().set_bit());
238+
while self.tcc.syncbusy().read().enable().bit_is_set() {}
235239
}
236240

237241
fn get_period(&self) -> Self::Time {

hal/src/peripherals/pwm/d5x.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,13 @@ impl<I: PinId> $crate::ehal_02::PwmPin for $TYPE<I> {
243243
fn disable(&mut self) {
244244
let count = self.tc.count16();
245245
count.ctrla().modify(|_, w| w.enable().clear_bit());
246+
while count.syncbusy().read().enable().bit_is_set() {}
246247
}
247248

248249
fn enable(&mut self) {
249250
let count = self.tc.count16();
250251
count.ctrla().modify(|_, w| w.enable().set_bit());
252+
while count.syncbusy().read().enable().bit_is_set() {}
251253
}
252254

253255

0 commit comments

Comments
 (0)