Skip to content

Commit

Permalink
Merge pull request #668 from jlpettersson/enable_multiple_pwm_slices_…
Browse files Browse the repository at this point in the history
…atomically

Add function to enable multiple PWM slices at the same time
  • Loading branch information
jannic authored Nov 10, 2023
2 parents 8a68410 + a7f51b7 commit 357f4d6
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions rp2040-hal/src/pwm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,17 +554,16 @@ impl Slices {
self._pwm
}

// /// Enable multiple slices at the same time to make their counters sync up.
// ///
// /// You still need to call `slice` to get an actual slice
// pub fn enable_simultaneous<S: SliceId>(&mut self, bits: u8) {
// // Enable all slices at the same time
// unsafe {
// &(*pac::PWM::ptr())
// .en
// .modify(|r, w| w.bits(((r.bits() as u8) | bits) as u32));
// }
// }
/// Enable multiple slices at the same time to make their counters sync up.
///
/// You still need to call `slice` to get an actual slice
pub fn enable_simultaneous(&mut self, bits: u8) {
// Enable multiple slices at the same time
unsafe {
let reg = self._pwm.en.as_ptr();
write_bitmask_set(reg, bits as u32);
}
}

// /// Get pwm slice based on gpio pin
// pub fn borrow_mut_from_pin<
Expand Down

0 comments on commit 357f4d6

Please sign in to comment.