mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
rename pwm channels to pwm slices, including in documentation
This commit is contained in:
parent
7b9546c9c8
commit
d35572c11f
@ -82,13 +82,13 @@ impl From<InputMode> for Divmode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// PWM driver.
|
/// PWM driver.
|
||||||
pub struct Pwm<'d, T: Channel> {
|
pub struct Pwm<'d, T: Slice> {
|
||||||
inner: PeripheralRef<'d, T>,
|
inner: PeripheralRef<'d, T>,
|
||||||
pin_a: Option<PeripheralRef<'d, AnyPin>>,
|
pin_a: Option<PeripheralRef<'d, AnyPin>>,
|
||||||
pin_b: Option<PeripheralRef<'d, AnyPin>>,
|
pin_b: Option<PeripheralRef<'d, AnyPin>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Channel> Pwm<'d, T> {
|
impl<'d, T: Slice> Pwm<'d, T> {
|
||||||
fn new_inner(
|
fn new_inner(
|
||||||
inner: impl Peripheral<P = T> + 'd,
|
inner: impl Peripheral<P = T> + 'd,
|
||||||
a: Option<PeripheralRef<'d, AnyPin>>,
|
a: Option<PeripheralRef<'d, AnyPin>>,
|
||||||
@ -265,18 +265,18 @@ impl<'d, T: Channel> Pwm<'d, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Batch representation of PWM channels.
|
/// Batch representation of PWM slices.
|
||||||
pub struct PwmBatch(u32);
|
pub struct PwmBatch(u32);
|
||||||
|
|
||||||
impl PwmBatch {
|
impl PwmBatch {
|
||||||
#[inline]
|
#[inline]
|
||||||
/// Enable a PWM channel in this batch.
|
/// Enable a PWM slice in this batch.
|
||||||
pub fn enable(&mut self, pwm: &Pwm<'_, impl Channel>) {
|
pub fn enable(&mut self, pwm: &Pwm<'_, impl Slice>) {
|
||||||
self.0 |= pwm.bit();
|
self.0 |= pwm.bit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
/// Enable channels in this batch in a PWM.
|
/// Enable slices in this batch in a PWM.
|
||||||
pub fn set_enabled(enabled: bool, batch: impl FnOnce(&mut PwmBatch)) {
|
pub fn set_enabled(enabled: bool, batch: impl FnOnce(&mut PwmBatch)) {
|
||||||
let mut en = PwmBatch(0);
|
let mut en = PwmBatch(0);
|
||||||
batch(&mut en);
|
batch(&mut en);
|
||||||
@ -288,7 +288,7 @@ impl PwmBatch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Channel> Drop for Pwm<'d, T> {
|
impl<'d, T: Slice> Drop for Pwm<'d, T> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
self.inner.regs().csr().write_clear(|w| w.set_en(false));
|
self.inner.regs().csr().write_clear(|w| w.set_en(false));
|
||||||
if let Some(pin) = &self.pin_a {
|
if let Some(pin) = &self.pin_a {
|
||||||
@ -305,7 +305,7 @@ mod sealed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// PWM Slice.
|
/// PWM Slice.
|
||||||
pub trait Slice: Peripheral<P = Self> + sealed::Channel + Sized + 'static {
|
pub trait Slice: Peripheral<P = Self> + sealed::Slice + Sized + 'static {
|
||||||
/// Slice number.
|
/// Slice number.
|
||||||
fn number(&self) -> u8;
|
fn number(&self) -> u8;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user