embassy-stm32

Crates

git

Versions

stm32l452ce

Flavors

Struct OnePulse

Source
pub struct OnePulse<'d, T: GeneralInstance4Channel> { /* private fields */ }
Expand description

One pulse driver.

Generates a pulse after a trigger and some configurable delay.

Implementations§

Source§

impl<'d, T: GeneralInstance4Channel> OnePulse<'d, T>

Source

pub fn new_ch1_edge_detect( tim: Peri<'d, T>, _pin: TriggerPin<'d, T, Ch1>, _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, freq: Hertz, pulse_end: u32, counting_mode: CountingMode, ) -> Self

Create a new one pulse driver.

The pulse is triggered by a channel 1 input pin on both rising and falling edges. Channel 1 will unusable as an output.

Source

pub fn new_ch1( tim: Peri<'d, T>, _pin: TriggerPin<'d, T, Ch1>, _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, freq: Hertz, pulse_end: u32, counting_mode: CountingMode, capture_mode: InputCaptureMode, ) -> Self

Create a new one pulse driver.

The pulse is triggered by a channel 1 input pin. Channel 1 will unusable as an output.

Source

pub fn new_ch2( tim: Peri<'d, T>, _pin: TriggerPin<'d, T, Ch1>, _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, freq: Hertz, pulse_end: u32, counting_mode: CountingMode, capture_mode: InputCaptureMode, ) -> Self

Create a new one pulse driver.

The pulse is triggered by a channel 2 input pin. Channel 2 will unusable as an output.

Source

pub fn new_ext( tim: Peri<'d, T>, _pin: TriggerPin<'d, T, Ext>, _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, freq: Hertz, pulse_end: u32, counting_mode: CountingMode, polarity: ExternalTriggerPolarity, ) -> Self

Create a new one pulse driver.

The pulse is triggered by a external trigger input pin.

Source

pub fn pulse_end(&self) -> u32

Get the end of the pulse in ticks from the trigger.

Source

pub fn set_pulse_end(&mut self, ticks: u32)

Set the end of the pulse in ticks from the trigger.

Source

pub fn set_reset_on_trigger(&mut self, reset: bool)

Reset the timer on each trigger

Source

pub fn channel(&mut self, channel: Channel) -> OnePulseChannel<'_, T>

Get a single channel

If you need to use multiple channels, use Self::split.

Source

pub fn ch1(&mut self) -> OnePulseChannel<'_, T>

Channel 1

This is just a convenience wrapper around Self::channel.

If you need to use multiple channels, use Self::split.

Source

pub fn ch2(&mut self) -> OnePulseChannel<'_, T>

Channel 2

This is just a convenience wrapper around Self::channel.

If you need to use multiple channels, use Self::split.

Source

pub fn ch3(&mut self) -> OnePulseChannel<'_, T>

Channel 3

This is just a convenience wrapper around Self::channel.

If you need to use multiple channels, use Self::split.

Source

pub fn ch4(&mut self) -> OnePulseChannel<'_, T>

Channel 4

This is just a convenience wrapper around Self::channel.

If you need to use multiple channels, use Self::split.

Source

pub fn split(self) -> OnePulseChannels<'static, T>
where 'd: 'static,

Splits a OnePulse into four output channels.

Auto Trait Implementations§

§

impl<'d, T> Freeze for OnePulse<'d, T>
where T: Freeze,

§

impl<'d, T> RefUnwindSafe for OnePulse<'d, T>
where T: RefUnwindSafe,

§

impl<'d, T> Send for OnePulse<'d, T>
where T: Send,

§

impl<'d, T> Sync for OnePulse<'d, T>
where T: Sync,

§

impl<'d, T> Unpin for OnePulse<'d, T>
where T: Unpin,

§

impl<'d, T> !UnwindSafe for OnePulse<'d, T>

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<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.