pub struct Capture<TIMERX> { /* private fields */ }Expand description
A free running timer whose channels timestamp edges on their pins.
The counter is only a time base: it runs to u16::MAX and wraps, while each
channel latches the count when its edge arrives. Intervals are differences
between latched values, so this role carries no period of its own.
Implementations§
Source§impl<TIMERX: Instance> Capture<TIMERX>
impl<TIMERX: Instance> Capture<TIMERX>
Sourcepub fn channel<PIN, const C: u8>(
&mut self,
pin: PIN,
edge: Edge,
) -> CaptureChannel<TIMERX, PIN, C>where
PIN: ChannelPin<TIMERX, C>,
TIMERX: CaptureOps<C>,
pub fn channel<PIN, const C: u8>(
&mut self,
pin: PIN,
edge: Edge,
) -> CaptureChannel<TIMERX, PIN, C>where
PIN: ChannelPin<TIMERX, C>,
TIMERX: CaptureOps<C>,
Points one channel of this timer at the given pin and hands it out.
Which channel it is follows from the pin, as in Pwm::channel. The
channel comes out configured but not enabled, latches nothing until it is,
and holds the pin until release_channel takes
it back. The edge is set here; select_edge
changes it later.
Sourcepub fn release_channel<PIN, const C: u8>(
&mut self,
channel: CaptureChannel<TIMERX, PIN, C>,
) -> PINwhere
PIN: ChannelPin<TIMERX, C>,
TIMERX: CaptureOps<C>,
pub fn release_channel<PIN, const C: u8>(
&mut self,
channel: CaptureChannel<TIMERX, PIN, C>,
) -> PINwhere
PIN: ChannelPin<TIMERX, C>,
TIMERX: CaptureOps<C>,
Takes a channel back, disabled and no longer listening, and returns its pin.
Sourcepub fn listen(&mut self, event: Event)
pub fn listen(&mut self, event: Event)
Lets event raise an interrupt.
The time base’s own event, shared by every channel. Update is what
extends the range here: the counter is only 16 bits wide, so an interval
longer than one cycle needs the rollovers counted alongside the
timestamps — interval sees the latched
values alone and cannot know how many cycles passed between them.
Captures raise their own event, through CaptureChannel::listen.
Unmasking the line in the NVIC is the caller’s.
Sourcepub fn unlisten(&mut self, event: Event)
pub fn unlisten(&mut self, event: Event)
Stops event from raising an interrupt. Leaves the NVIC alone.
Sourcepub fn is_listening(&self, event: Event) -> bool
pub fn is_listening(&self, event: Event) -> bool
Whether event reaches the NVIC.
Sourcepub fn is_pending(&self, event: Event) -> bool
pub fn is_pending(&self, event: Event) -> bool
Whether the flag event raises is standing.
Sourcepub fn clear_interrupt(&mut self, event: Event)
pub fn clear_interrupt(&mut self, event: Event)
Clears the flag event raised, which hardware never does on its own.
Sourcepub fn into_timer(self) -> Timer<TIMERX>
pub fn into_timer(self) -> Timer<TIMERX>
Halts the counter, stops listening and takes the timer back out of capture duty.
§Panics
If a channel is still out — hand each one back through
release_channel first.
Sourcepub fn release(self, rcu: &mut Rcu) -> TIMERX
pub fn release(self, rcu: &mut Rcu) -> TIMERX
Halts the counter and returns the peripheral with its clock stopped, skipping the stopped form.
§Panics
As for into_timer.