Skip to content

Commit 59777ec

Browse files
committed
bb::write
1 parent 1b56343 commit 59777ec

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
@@ -467,11 +467,7 @@ macro_rules! with_pwm {
467467
fn enable_channel(c: u8, b: bool) {
468468
let tim = unsafe { &*<$TIM>::ptr() };
469469
if c < Self::CH_NUMBER {
470-
if b {
471-
unsafe { bb::set(&tim.ccer, c*4) }
472-
} else {
473-
unsafe { bb::clear(&tim.ccer, c*4) }
474-
}
470+
unsafe { bb::write(&tim.ccer, c*4, b); }
475471
}
476472
}
477473
}
@@ -523,11 +519,7 @@ macro_rules! with_pwm {
523519
fn enable_channel(c: u8, b: bool) {
524520
let tim = unsafe { &*<$TIM>::ptr() };
525521
if c < Self::CH_NUMBER {
526-
if b {
527-
unsafe { bb::set(&tim.ccer, c*4) }
528-
} else {
529-
unsafe { bb::clear(&tim.ccer, c*4) }
530-
}
522+
unsafe { bb::write(&tim.ccer, c*4, b); }
531523
}
532524
}
533525
}
@@ -580,11 +572,7 @@ macro_rules! with_pwm {
580572
fn enable_channel(c: u8, b: bool) {
581573
let tim = unsafe { &*<$TIM>::ptr() };
582574
if c < Self::CH_NUMBER {
583-
if b {
584-
unsafe { bb::set(&tim.ccer, c*4) }
585-
} else {
586-
unsafe { bb::clear(&tim.ccer, c*4) }
587-
}
575+
unsafe { bb::write(&tim.ccer, c*4, b); }
588576
}
589577
}
590578
}

0 commit comments

Comments
 (0)