pub struct InputCapture<'d, T: GeneralInstance4Channel> { /* private fields */ }Expand description
Input capture driver.
Implementations§
Source§impl<'d, T: GeneralInstance4Channel> InputCapture<'d, T>
impl<'d, T: GeneralInstance4Channel> InputCapture<'d, T>
Sourcepub fn new(
tim: Peri<'d, T>,
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
pub fn new( tim: Peri<'d, T>, 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.
Sourcepub fn is_enabled(&self, channel: Channel) -> bool
pub fn is_enabled(&self, channel: Channel) -> bool
Check whether given channel is enabled
Sourcepub fn set_input_capture_mode(
&mut self,
channel: Channel,
mode: InputCaptureMode,
)
pub fn set_input_capture_mode( &mut self, channel: Channel, mode: InputCaptureMode, )
Set the input capture mode for a given channel.
Sourcepub fn set_input_ti_selection(
&mut self,
channel: Channel,
tisel: InputTISelection,
)
pub fn set_input_ti_selection( &mut self, channel: Channel, tisel: InputTISelection, )
Set input TI selection.
Sourcepub fn set_input_capture_filter(
&mut self,
channel: Channel,
filter: FilterValue,
)
pub fn set_input_capture_filter( &mut self, channel: Channel, filter: FilterValue, )
Set the input capture filter for a given channel.
Sourcepub fn set_input_capture_prescaler(&mut self, channel: Channel, factor: u8)
pub fn set_input_capture_prescaler(&mut self, channel: Channel, factor: u8)
Set the input capture prescaler for a given channel.
Sourcepub fn get_capture_value(&self, channel: Channel) -> T::Word
pub fn get_capture_value(&self, channel: Channel) -> T::Word
Get capture value for a channel.
Sourcepub fn get_input_interrupt(&self, channel: Channel) -> bool
pub fn get_input_interrupt(&self, channel: Channel) -> bool
Get input interrupt.
Sourcepub async fn wait_for_rising_edge(&mut self, channel: Channel) -> T::Word
pub async fn wait_for_rising_edge(&mut self, channel: Channel) -> T::Word
Asynchronously wait until the pin sees a rising edge.
Sourcepub async fn wait_for_falling_edge(&mut self, channel: Channel) -> T::Word
pub async fn wait_for_falling_edge(&mut self, channel: Channel) -> T::Word
Asynchronously wait until the pin sees a falling edge.
Sourcepub async fn wait_for_any_edge(&mut self, channel: Channel) -> T::Word
pub async fn wait_for_any_edge(&mut self, channel: Channel) -> T::Word
Asynchronously wait until the pin sees any edge.
Sourcepub async fn wait_for_rising_edge_alternate(
&mut self,
channel: Channel,
) -> T::Word
pub async fn wait_for_rising_edge_alternate( &mut self, channel: Channel, ) -> T::Word
Asynchronously wait until the (alternate) pin sees a rising edge.
Sourcepub async fn wait_for_falling_edge_alternate(
&mut self,
channel: Channel,
) -> T::Word
pub async fn wait_for_falling_edge_alternate( &mut self, channel: Channel, ) -> T::Word
Asynchronously wait until the (alternate) pin sees a falling edge.
Sourcepub async fn wait_for_any_edge_alternate(&mut self, channel: Channel) -> T::Word
pub async fn wait_for_any_edge_alternate(&mut self, channel: Channel) -> T::Word
Asynchronously wait until the (alternate) pin sees any edge.
Sourcepub fn channel(&mut self, channel: Channel) -> InputCaptureChannel<'_, T>
pub fn channel(&mut self, channel: Channel) -> InputCaptureChannel<'_, T>
Get a single channel.
If you need to use multiple channels, use Self::split.
Sourcepub fn ch1(&mut self) -> InputCaptureChannel<'_, T>
pub fn ch1(&mut self) -> InputCaptureChannel<'_, T>
Channel 1
This is just a convenience wrapper around Self::channel.
If you need to use multiple channels, use Self::split.
Sourcepub fn ch2(&mut self) -> InputCaptureChannel<'_, T>
pub fn ch2(&mut self) -> InputCaptureChannel<'_, T>
Channel 2
This is just a convenience wrapper around Self::channel.
If you need to use multiple channels, use Self::split.
Sourcepub fn ch3(&mut self) -> InputCaptureChannel<'_, T>
pub fn ch3(&mut self) -> InputCaptureChannel<'_, T>
Channel 3
This is just a convenience wrapper around Self::channel.
If you need to use multiple channels, use Self::split.
Sourcepub fn ch4(&mut self) -> InputCaptureChannel<'_, T>
pub fn ch4(&mut self) -> InputCaptureChannel<'_, T>
Channel 4
This is just a convenience wrapper around Self::channel.
If you need to use multiple channels, use Self::split.
Sourcepub fn split(self) -> InputCaptureChannels<'static, T>where
'd: 'static,
pub fn split(self) -> InputCaptureChannels<'static, T>where
'd: 'static,
Splits an InputCapture into four capture channels.
Sourcepub async fn receive_waveform<M, D: Dma<T, M>>(
&mut self,
dma: Peri<'_, D>,
irq: impl Binding<D::Interrupt, InterruptHandler<D>>,
buf: &mut [u16],
)where
M: TimerChannel,
pub async fn receive_waveform<M, D: Dma<T, M>>(
&mut self,
dma: Peri<'_, D>,
irq: impl Binding<D::Interrupt, InterruptHandler<D>>,
buf: &mut [u16],
)where
M: TimerChannel,
Capture a sequence of timer input edges into a buffer using DMA.
Note: DMA capture is only available on InputCapture, not on the per-channel
InputCaptureChannel handles returned by Self::split.