Struct Pwm

Source
pub struct Pwm<TIM, REMAP, P, PINS, const FREQ: u32>
where TIM: Instance + WithPwm, REMAP: Remap<Periph = TIM>, PINS: Pins<REMAP, P>,
{ /* private fields */ }

Implementations§

Source§

impl<TIM, REMAP, P, PINS, const FREQ: u32> Pwm<TIM, REMAP, P, PINS, FREQ>
where TIM: Instance + WithPwm, REMAP: Remap<Periph = TIM>, PINS: Pins<REMAP, P>,

Source

pub fn split(self) -> PINS::Channels

Source

pub fn release(self) -> FTimer<TIM, FREQ>

Source§

impl<TIM, REMAP, P, PINS, const FREQ: u32> Pwm<TIM, REMAP, P, PINS, FREQ>
where TIM: Instance + WithPwm, REMAP: Remap<Periph = TIM>, PINS: Pins<REMAP, P>,

Source

pub fn enable(&mut self, channel: Channel)

Source

pub fn disable(&mut self, channel: Channel)

Source

pub fn get_duty(&self, channel: Channel) -> u16

Source

pub fn set_duty(&mut self, channel: Channel, duty: u16)

Source

pub fn get_max_duty(&self) -> u16

If 0 returned means max_duty is 2^16

Source

pub fn get_period(&self) -> TimerDurationU32<FREQ>

Source

pub fn set_period(&mut self, period: TimerDurationU32<FREQ>)

Methods from Deref<Target = FTimer<TIM, FREQ>>§

Source

pub fn configure(&mut self, clocks: &Clocks)

Calculate prescaler depending on Clocks state

Source

pub fn listen(&mut self, event: Event)

Starts listening for an event

Note, you will also have to enable the TIM2 interrupt in the NVIC to start receiving events.

Source

pub fn clear_interrupt(&mut self, event: Event)

Clears interrupt associated with event.

If the interrupt is not cleared, it will immediately retrigger after the ISR has finished.

Source

pub fn get_interrupt(&mut self) -> Event

Source

pub fn unlisten(&mut self, event: Event)

Stops listening for an event

Source

pub fn stop_in_debug(&mut self, dbg: &mut DBG, state: bool)

Stopping timer in debug mode can cause troubles when sampling the signal

Source

pub fn set_master_mode(&mut self, mode: TIM::Mms)

Trait Implementations§

Source§

impl<TIM, REMAP, P, PINS, const FREQ: u32> Deref for Pwm<TIM, REMAP, P, PINS, FREQ>
where TIM: Instance + WithPwm, REMAP: Remap<Periph = TIM>, PINS: Pins<REMAP, P>,

Source§

type Target = FTimer<TIM, FREQ>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<TIM, REMAP, P, PINS, const FREQ: u32> DerefMut for Pwm<TIM, REMAP, P, PINS, FREQ>
where TIM: Instance + WithPwm, REMAP: Remap<Periph = TIM>, PINS: Pins<REMAP, P>,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<TIM, REMAP, P, PINS, const FREQ: u32> Pwm for Pwm<TIM, REMAP, P, PINS, FREQ>
where TIM: Instance + WithPwm, REMAP: Remap<Periph = TIM>, PINS: Pins<REMAP, P>,

Source§

fn get_max_duty(&self) -> Self::Duty

If 0 returned means max_duty is 2^16

Source§

type Channel = Channel

Enumeration of channels that can be used with this Pwm interface Read more
Source§

type Duty = u16

Type for the duty methods Read more
Source§

type Time = Duration<u32, 1, FREQ>

A time unit that can be converted into a human time unit (e.g. seconds)
Source§

fn enable(&mut self, channel: Self::Channel)

Enables a PWM channel
Source§

fn disable(&mut self, channel: Self::Channel)

Disables a PWM channel
Source§

fn get_duty(&self, channel: Self::Channel) -> Self::Duty

Returns the current duty cycle
Source§

fn set_duty(&mut self, channel: Self::Channel, duty: Self::Duty)

Sets a new duty cycle
Source§

fn get_period(&self) -> Self::Time

Returns the current PWM period
Source§

fn set_period<T>(&mut self, period: T)
where T: Into<Self::Time>,

Sets a new PWM period

Auto Trait Implementations§

§

impl<TIM, REMAP, P, PINS, const FREQ: u32> Freeze for Pwm<TIM, REMAP, P, PINS, FREQ>
where TIM: Freeze,

§

impl<TIM, REMAP, P, PINS, const FREQ: u32> RefUnwindSafe for Pwm<TIM, REMAP, P, PINS, FREQ>

§

impl<TIM, REMAP, P, PINS, const FREQ: u32> Send for Pwm<TIM, REMAP, P, PINS, FREQ>
where TIM: Send, REMAP: Send, P: Send, PINS: Send,

§

impl<TIM, REMAP, P, PINS, const FREQ: u32> Sync for Pwm<TIM, REMAP, P, PINS, FREQ>
where TIM: Sync, REMAP: Sync, P: Sync, PINS: Sync,

§

impl<TIM, REMAP, P, PINS, const FREQ: u32> Unpin for Pwm<TIM, REMAP, P, PINS, FREQ>
where TIM: Unpin, REMAP: Unpin, P: Unpin, PINS: Unpin,

§

impl<TIM, REMAP, P, PINS, const FREQ: u32> UnwindSafe for Pwm<TIM, REMAP, P, PINS, FREQ>
where TIM: UnwindSafe, REMAP: UnwindSafe, P: UnwindSafe, PINS: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.