Struct gd32f1x0_hal::pwm::Pwm
source · [−]pub struct Pwm<TIMER, PINS> { /* private fields */ }
Implementations
sourceimpl<TIMER: Deref<Target = RB>, RB: TimerIdleRegExt, PINS: Pins<TIMER>> Pwm<TIMER, PINS>
impl<TIMER: Deref<Target = RB>, RB: TimerIdleRegExt, PINS: Pins<TIMER>> Pwm<TIMER, PINS>
sourcepub fn set_idle_state(&self, channel: Channel, idle_state: IdleState)
pub fn set_idle_state(&self, channel: Channel, idle_state: IdleState)
Configure the state which the output of the given channel should have when the channel is idle.
sourceimpl<TIMER: Deref<Target = RB>, RB: TimerIdleRegExt, PINS: Pins<TIMER> + ComplementaryPins> Pwm<TIMER, PINS>
impl<TIMER: Deref<Target = RB>, RB: TimerIdleRegExt, PINS: Pins<TIMER> + ComplementaryPins> Pwm<TIMER, PINS>
sourcepub fn set_complementary_idle_state(
&self,
channel: Channel,
idle_state: IdleState
)
pub fn set_complementary_idle_state(
&self,
channel: Channel,
idle_state: IdleState
)
Configure the state which the complementary output of the given channel should have when the channel is idle.
sourceimpl<TIMER: Deref<Target = RB>, RB: TimerRegExt, PINS: Pins<TIMER>> Pwm<TIMER, PINS>
impl<TIMER: Deref<Target = RB>, RB: TimerRegExt, PINS: Pins<TIMER>> Pwm<TIMER, PINS>
sourcepub fn set_polarity(&self, channel: Channel, polarity: Polarity)
pub fn set_polarity(&self, channel: Channel, polarity: Polarity)
Configure the polarity of the output for the given channel.
sourceimpl<TIMER: Deref<Target = RB>, RB: TimerRegExt, PINS: Pins<TIMER> + ComplementaryPins> Pwm<TIMER, PINS>
impl<TIMER: Deref<Target = RB>, RB: TimerRegExt, PINS: Pins<TIMER> + ComplementaryPins> Pwm<TIMER, PINS>
sourcepub fn set_complementary_polarity(&self, channel: Channel, polarity: Polarity)
pub fn set_complementary_polarity(&self, channel: Channel, polarity: Polarity)
Configure the polarity of the complementary output for the given channel.
sourceimpl<P0, P1, P2, P3> Pwm<TIMER0, (Option<P0>, Option<P1>, Option<P2>, Option<P3>)>
impl<P0, P1, P2, P3> Pwm<TIMER0, (Option<P0>, Option<P1>, Option<P2>, Option<P3>)>
sourcepub fn split(
self
) -> (Option<PwmChannel<TIMER0, P0>>, Option<PwmChannel<TIMER0, P1>>, Option<PwmChannel<TIMER0, P2>>, Option<PwmChannel<TIMER0, P3>>)
pub fn split(
self
) -> (Option<PwmChannel<TIMER0, P0>>, Option<PwmChannel<TIMER0, P1>>, Option<PwmChannel<TIMER0, P2>>, Option<PwmChannel<TIMER0, P3>>)
Split the timer into separate PWM channels.
sourceimpl<P0, P1, P2> Pwm<TIMER0, (Option<P0>, Option<P1>, Option<P2>)>
impl<P0, P1, P2> Pwm<TIMER0, (Option<P0>, Option<P1>, Option<P2>)>
sourcepub fn split(
self
) -> (Option<PwmChannel<TIMER0, P0>>, Option<PwmChannel<TIMER0, P1>>, Option<PwmChannel<TIMER0, P2>>)
pub fn split(
self
) -> (Option<PwmChannel<TIMER0, P0>>, Option<PwmChannel<TIMER0, P1>>, Option<PwmChannel<TIMER0, P2>>)
Split the timer into separate PWM channels.
sourceimpl<PINS> Pwm<TIMER0, PINS> where
PINS: Pins<TIMER0>,
impl<PINS> Pwm<TIMER0, PINS> where
PINS: Pins<TIMER0>,
sourcepub fn stop(self) -> (Timer<TIMER0>, PINS)
pub fn stop(self) -> (Timer<TIMER0>, PINS)
Stop the timer and release it and the pins to be used for something else.
sourcepub fn set_alignment(&self, alignment: Alignment)
pub fn set_alignment(&self, alignment: Alignment)
Configure the given alignment mode, to control how pulses on different channels of this PWM module are aligned with each other.
sourcepub fn is_pending(&self, event: Event) -> bool
pub fn is_pending(&self, event: Event) -> bool
Returns true if the given event
interrupt is pending.
sourcepub fn clear_interrupt_flag(&mut self, event: Event)
pub fn clear_interrupt_flag(&mut self, event: Event)
Clears the given event
interrupt flag.
sourcepub fn output_disable(&mut self)
pub fn output_disable(&mut self)
Disable PWM outputs, and prevent them from being automatically enabled.
sourcepub fn automatic_output_enable(&mut self)
pub fn automatic_output_enable(&mut self)
Automatically enable outputs at the next update event, if the break input is not active.
sourcepub fn break_enable(&self, break_mode: BreakMode)
pub fn break_enable(&self, break_mode: BreakMode)
Configure the given break mode.
sourcepub fn run_mode_off_state(&mut self, enabled: bool)
pub fn run_mode_off_state(&mut self, enabled: bool)
Configure the run mode off-state.
sourcepub fn idle_mode_off_state(&mut self, enabled: bool)
pub fn idle_mode_off_state(&mut self, enabled: bool)
Configure the idle mode off-state.
sourcepub fn set_dead_time(&self, dead_time: u16)
pub fn set_dead_time(&self, dead_time: u16)
Configure the dead time for complementary chanels.
sourceimpl<P0, P1, P2, P3> Pwm<TIMER1, (Option<P0>, Option<P1>, Option<P2>, Option<P3>)>
impl<P0, P1, P2, P3> Pwm<TIMER1, (Option<P0>, Option<P1>, Option<P2>, Option<P3>)>
sourcepub fn split(
self
) -> (Option<PwmChannel<TIMER1, P0>>, Option<PwmChannel<TIMER1, P1>>, Option<PwmChannel<TIMER1, P2>>, Option<PwmChannel<TIMER1, P3>>)
pub fn split(
self
) -> (Option<PwmChannel<TIMER1, P0>>, Option<PwmChannel<TIMER1, P1>>, Option<PwmChannel<TIMER1, P2>>, Option<PwmChannel<TIMER1, P3>>)
Split the timer into separate PWM channels.
sourceimpl<P0, P1, P2> Pwm<TIMER1, (Option<P0>, Option<P1>, Option<P2>)>
impl<P0, P1, P2> Pwm<TIMER1, (Option<P0>, Option<P1>, Option<P2>)>
sourcepub fn split(
self
) -> (Option<PwmChannel<TIMER1, P0>>, Option<PwmChannel<TIMER1, P1>>, Option<PwmChannel<TIMER1, P2>>)
pub fn split(
self
) -> (Option<PwmChannel<TIMER1, P0>>, Option<PwmChannel<TIMER1, P1>>, Option<PwmChannel<TIMER1, P2>>)
Split the timer into separate PWM channels.
sourceimpl<PINS> Pwm<TIMER1, PINS> where
PINS: Pins<TIMER1>,
impl<PINS> Pwm<TIMER1, PINS> where
PINS: Pins<TIMER1>,
sourcepub fn stop(self) -> (Timer<TIMER1>, PINS)
pub fn stop(self) -> (Timer<TIMER1>, PINS)
Stop the timer and release it and the pins to be used for something else.
sourcepub fn set_alignment(&self, alignment: Alignment)
pub fn set_alignment(&self, alignment: Alignment)
Configure the given alignment mode, to control how pulses on different channels of this PWM module are aligned with each other.
sourcepub fn is_pending(&self, event: Event) -> bool
pub fn is_pending(&self, event: Event) -> bool
Returns true if the given event
interrupt is pending.
sourcepub fn clear_interrupt_flag(&mut self, event: Event)
pub fn clear_interrupt_flag(&mut self, event: Event)
Clears the given event
interrupt flag.
sourceimpl<P0, P1, P2, P3> Pwm<TIMER2, (Option<P0>, Option<P1>, Option<P2>, Option<P3>)>
impl<P0, P1, P2, P3> Pwm<TIMER2, (Option<P0>, Option<P1>, Option<P2>, Option<P3>)>
sourcepub fn split(
self
) -> (Option<PwmChannel<TIMER2, P0>>, Option<PwmChannel<TIMER2, P1>>, Option<PwmChannel<TIMER2, P2>>, Option<PwmChannel<TIMER2, P3>>)
pub fn split(
self
) -> (Option<PwmChannel<TIMER2, P0>>, Option<PwmChannel<TIMER2, P1>>, Option<PwmChannel<TIMER2, P2>>, Option<PwmChannel<TIMER2, P3>>)
Split the timer into separate PWM channels.
sourceimpl<P0, P1, P2> Pwm<TIMER2, (Option<P0>, Option<P1>, Option<P2>)>
impl<P0, P1, P2> Pwm<TIMER2, (Option<P0>, Option<P1>, Option<P2>)>
sourcepub fn split(
self
) -> (Option<PwmChannel<TIMER2, P0>>, Option<PwmChannel<TIMER2, P1>>, Option<PwmChannel<TIMER2, P2>>)
pub fn split(
self
) -> (Option<PwmChannel<TIMER2, P0>>, Option<PwmChannel<TIMER2, P1>>, Option<PwmChannel<TIMER2, P2>>)
Split the timer into separate PWM channels.
sourceimpl<PINS> Pwm<TIMER2, PINS> where
PINS: Pins<TIMER2>,
impl<PINS> Pwm<TIMER2, PINS> where
PINS: Pins<TIMER2>,
sourcepub fn stop(self) -> (Timer<TIMER2>, PINS)
pub fn stop(self) -> (Timer<TIMER2>, PINS)
Stop the timer and release it and the pins to be used for something else.
sourcepub fn set_alignment(&self, alignment: Alignment)
pub fn set_alignment(&self, alignment: Alignment)
Configure the given alignment mode, to control how pulses on different channels of this PWM module are aligned with each other.
sourcepub fn is_pending(&self, event: Event) -> bool
pub fn is_pending(&self, event: Event) -> bool
Returns true if the given event
interrupt is pending.
sourcepub fn clear_interrupt_flag(&mut self, event: Event)
pub fn clear_interrupt_flag(&mut self, event: Event)
Clears the given event
interrupt flag.
Trait Implementations
sourceimpl<PINS> Pwm for Pwm<TIMER0, PINS> where
PINS: Pins<TIMER0>,
impl<PINS> Pwm for Pwm<TIMER0, PINS> where
PINS: Pins<TIMER0>,
sourcefn get_max_duty(&self) -> Self::Duty
fn get_max_duty(&self) -> Self::Duty
Returns the maximum duty cycle value
sourcefn get_period(&self) -> Self::Time
fn get_period(&self) -> Self::Time
Returns the current PWM period
sourcefn set_period<T>(&mut self, period: T) where
T: Into<Self::Time>,
fn set_period<T>(&mut self, period: T) where
T: Into<Self::Time>,
Sets a new PWM period
sourceimpl<PINS> Pwm for Pwm<TIMER1, PINS> where
PINS: Pins<TIMER1>,
impl<PINS> Pwm for Pwm<TIMER1, PINS> where
PINS: Pins<TIMER1>,
sourcefn get_max_duty(&self) -> Self::Duty
fn get_max_duty(&self) -> Self::Duty
Returns the maximum duty cycle value
sourcefn get_period(&self) -> Self::Time
fn get_period(&self) -> Self::Time
Returns the current PWM period
sourcefn set_period<T>(&mut self, period: T) where
T: Into<Self::Time>,
fn set_period<T>(&mut self, period: T) where
T: Into<Self::Time>,
Sets a new PWM period
sourceimpl<PINS> Pwm for Pwm<TIMER2, PINS> where
PINS: Pins<TIMER2>,
impl<PINS> Pwm for Pwm<TIMER2, PINS> where
PINS: Pins<TIMER2>,
sourcefn get_max_duty(&self) -> Self::Duty
fn get_max_duty(&self) -> Self::Duty
Returns the maximum duty cycle value
sourcefn get_period(&self) -> Self::Time
fn get_period(&self) -> Self::Time
Returns the current PWM period
sourcefn set_period<T>(&mut self, period: T) where
T: Into<Self::Time>,
fn set_period<T>(&mut self, period: T) where
T: Into<Self::Time>,
Sets a new PWM period
Auto Trait Implementations
impl<TIMER, PINS> RefUnwindSafe for Pwm<TIMER, PINS> where
PINS: RefUnwindSafe,
TIMER: RefUnwindSafe,
impl<TIMER, PINS> Send for Pwm<TIMER, PINS> where
PINS: Send,
TIMER: Send,
impl<TIMER, PINS> Sync for Pwm<TIMER, PINS> where
PINS: Sync,
TIMER: Sync,
impl<TIMER, PINS> Unpin for Pwm<TIMER, PINS> where
PINS: Unpin,
TIMER: Unpin,
impl<TIMER, PINS> UnwindSafe for Pwm<TIMER, PINS> where
PINS: UnwindSafe,
TIMER: 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