embassy-stm32

Crates

git

Versions

stm32u073hb

Flavors

embassy_stm32::timer::input_capture

Struct InputCapture

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

Input capture driver.

Implementations§

Source§

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

Source

pub fn new( tim: impl Peripheral<P = T> + 'd, _ch1: Option<CapturePin<'d, T, Ch1>>, _ch2: Option<CapturePin<'d, T, Ch2>>, _ch3: Option<CapturePin<'d, T, Ch3>>, _ch4: Option<CapturePin<'d, T, Ch4>>, _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, freq: Hertz, counting_mode: CountingMode, ) -> Self

Create a new input capture driver.

Source

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

Enable the given channel.

Source

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

Disable the given channel.

Source

pub fn is_enabled(&self, channel: Channel) -> bool

Check whether given channel is enabled

Source

pub fn set_input_capture_mode( &mut self, channel: Channel, mode: InputCaptureMode, )

Set the input capture mode for a given channel.

Source

pub fn set_input_ti_selection( &mut self, channel: Channel, tisel: InputTISelection, )

Set input TI selection.

Source

pub fn get_capture_value(&self, channel: Channel) -> u32

Get capture value for a channel.

Source

pub fn get_input_interrupt(&self, channel: Channel) -> bool

Get input interrupt.

Source

pub async fn wait_for_rising_edge(&mut self, channel: Channel) -> u32

Asynchronously wait until the pin sees a rising edge.

Source

pub async fn wait_for_falling_edge(&mut self, channel: Channel) -> u32

Asynchronously wait until the pin sees a falling edge.

Source

pub async fn wait_for_any_edge(&mut self, channel: Channel) -> u32

Asynchronously wait until the pin sees any edge.

Source

pub async fn wait_for_rising_edge_alternate(&mut self, channel: Channel) -> u32

Asynchronously wait until the (alternate) pin sees a rising edge.

Source

pub async fn wait_for_falling_edge_alternate(&mut self, channel: Channel) -> u32

Asynchronously wait until the (alternate) pin sees a falling edge.

Source

pub async fn wait_for_any_edge_alternate(&mut self, channel: Channel) -> u32

Asynchronously wait until the (alternate) pin sees any edge.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<'d, T> !UnwindSafe for InputCapture<'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.