Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to enable multiple PWM slices at the same time #668

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions rp2040-hal/src/pwm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,17 +501,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
Loading