Skip to content

Commit 833d2d9

Browse files
committed
bb::write
1 parent 6a29306 commit 833d2d9

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

src/timer.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -452,11 +452,7 @@ macro_rules! with_pwm {
452452
fn enable_channel(c: u8, b: bool) {
453453
let tim = unsafe { &*<$TIM>::ptr() };
454454
if c < Self::CH_NUMBER {
455-
if b {
456-
unsafe { bb::set(&tim.ccer, c*4) }
457-
} else {
458-
unsafe { bb::clear(&tim.ccer, c*4) }
459-
}
455+
unsafe { bb::write(&tim.ccer, c*4, b); }
460456
}
461457
}
462458
}
@@ -502,11 +498,7 @@ macro_rules! with_pwm {
502498
fn enable_channel(c: u8, b: bool) {
503499
let tim = unsafe { &*<$TIM>::ptr() };
504500
if c < Self::CH_NUMBER {
505-
if b {
506-
unsafe { bb::set(&tim.ccer, c*4) }
507-
} else {
508-
unsafe { bb::clear(&tim.ccer, c*4) }
509-
}
501+
unsafe { bb::write(&tim.ccer, c*4, b); }
510502
}
511503
}
512504
}
@@ -560,11 +552,7 @@ macro_rules! with_pwm {
560552
fn enable_channel(c: u8, b: bool) {
561553
let tim = unsafe { &*<$TIM>::ptr() };
562554
if c < Self::CH_NUMBER {
563-
if b {
564-
unsafe { bb::set(&tim.ccer, c*4) }
565-
} else {
566-
unsafe { bb::clear(&tim.ccer, c*4) }
567-
}
555+
unsafe { bb::write(&tim.ccer, c*4, b); }
568556
}
569557
}
570558
}

0 commit comments

Comments
 (0)