Struct rp2040_hal::pwm::Slice
source · [−]pub struct Slice<I, M> where
I: SliceId,
M: SliceMode + ValidSliceMode<I>, {
pub channel_a: Channel<I, M, A>,
pub channel_b: Channel<I, M, B>,
/* private fields */
}
Expand description
Pwm slice
Fields
channel_a: Channel<I, M, A>
Channel A (always output)
channel_b: Channel<I, M, B>
Channel B (input or output)
Implementations
sourceimpl<I, M> Slice<I, M> where
I: SliceId,
M: SliceMode + ValidSliceMode<I>,
impl<I, M> Slice<I, M> where
I: SliceId,
M: SliceMode + ValidSliceMode<I>,
sourcepub fn into_mode<N: SliceMode + ValidSliceMode<I>>(self) -> Slice<I, N>
pub fn into_mode<N: SliceMode + ValidSliceMode<I>>(self) -> Slice<I, N>
Convert the slice to the requested SliceMode
sourcepub fn default_config(&mut self)
pub fn default_config(&mut self)
Set a default config for the slice
sourcepub fn advance_phase(&mut self)
pub fn advance_phase(&mut self)
Advance the phase with one count
Counter must be running at less than full speed (div_int + div_frac / 16 > 1)
sourcepub fn retard_phase(&mut self)
pub fn retard_phase(&mut self)
Retard the phase with one count
Counter must be running at less than full speed (div_int + div_frac / 16 > 1)
sourcepub fn set_ph_correct(&mut self)
pub fn set_ph_correct(&mut self)
Enable phase correct mode
sourcepub fn clr_ph_correct(&mut self)
pub fn clr_ph_correct(&mut self)
Disables phase correct mode
sourcepub fn set_div_int(&mut self, value: u8)
pub fn set_div_int(&mut self, value: u8)
Sets the integer part of the clock divider
sourcepub fn set_div_frac(&mut self, value: u8)
pub fn set_div_frac(&mut self, value: u8)
Sets the fractional part of the clock divider
sourcepub fn get_counter(&self) -> u16
pub fn get_counter(&self) -> u16
Get the counter register value
sourcepub fn set_counter(&mut self, value: u16)
pub fn set_counter(&mut self, value: u16)
Set the counter register value
sourcepub fn enable_interrupt(&mut self)
pub fn enable_interrupt(&mut self)
Enable the PWM_IRQ_WRAP interrupt when this slice overflows.
sourcepub fn disable_interrupt(&mut self)
pub fn disable_interrupt(&mut self)
Disable the PWM_IRQ_WRAP interrupt for this slice.
sourcepub fn has_overflown(&self) -> bool
pub fn has_overflown(&self) -> bool
Did this slice trigger an overflow interrupt?
sourcepub fn clear_interrupt(&mut self)
pub fn clear_interrupt(&mut self)
Mark the interrupt handled for this slice.
sourcepub fn force_interrupt(&mut self)
pub fn force_interrupt(&mut self)
Force the interrupt. This bit is not cleared by hardware and must be manually cleared to stop the interrupt from continuing to be asserted.
sourcepub fn clear_force_interrupt(&mut self)
pub fn clear_force_interrupt(&mut self)
Clear force interrupt. This bit is not cleared by hardware and must be manually cleared to stop the interrupt from continuing to be asserted.
sourceimpl<S: SliceId, M: SliceMode + ValidSliceMode<S>> Slice<S, M>
impl<S: SliceId, M: SliceMode + ValidSliceMode<S>> Slice<S, M>
sourcepub fn output_to<G: PinId + BankPinId + ValidPwmOutputPin<S, C>, PM: PinMode + ValidPinMode<G>, C: ChannelId>(
&mut self,
pin: Pin<G, PM>
) -> PwmPinToken<G>
pub fn output_to<G: PinId + BankPinId + ValidPwmOutputPin<S, C>, PM: PinMode + ValidPinMode<G>, C: ChannelId>(
&mut self,
pin: Pin<G, PM>
) -> PwmPinToken<G>
Capture a gpio pin and use it as pwm output
sourceimpl<S: SliceId, M: SliceMode + ValidSliceInputMode<S>> Slice<S, M>
impl<S: SliceId, M: SliceMode + ValidSliceInputMode<S>> Slice<S, M>
sourcepub fn input_from<G: PinId + BankPinId + ValidPwmInputPin<S>, PM: PinMode + ValidPinMode<G>>(
&mut self,
pin: Pin<G, PM>
) -> PwmPinToken<G>
pub fn input_from<G: PinId + BankPinId + ValidPwmInputPin<S>, PM: PinMode + ValidPinMode<G>>(
&mut self,
pin: Pin<G, PM>
) -> PwmPinToken<G>
Capture a gpio pin and use it as pwm input for channel B
Auto Trait Implementations
impl<I, M> RefUnwindSafe for Slice<I, M> where
I: RefUnwindSafe,
M: RefUnwindSafe,
impl<I, M> Send for Slice<I, M> where
I: Send,
M: Send,
impl<I, M> Sync for Slice<I, M> where
I: Sync,
M: Sync,
impl<I, M> Unpin for Slice<I, M> where
I: Unpin,
M: Unpin,
impl<I, M> UnwindSafe for Slice<I, M> where
I: UnwindSafe,
M: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more