pub struct ExtiLine<const N: u8, SRC> { /* private fields */ }Expand description
One EXTI line, identified by its number at the type level, holding whatever drives it.
SRC is PinSrc before a port is picked, the pin itself afterwards, and
InternalSrc on the lines that have no pin.
Implementations§
Source§impl<const N: u8> ExtiLine<N, PinSrc>
impl<const N: u8> ExtiLine<N, PinSrc>
Sourcepub fn source<const P: char, MODE>(
self,
syscfg: &mut Syscfg,
pin: Pin<P, N, MODE>,
) -> ExtiLine<N, Pin<P, N, MODE>>
pub fn source<const P: char, MODE>( self, syscfg: &mut Syscfg, pin: Pin<P, N, MODE>, ) -> ExtiLine<N, Pin<P, N, MODE>>
Points the line at pin and takes the pin in.
The pin keeps working as it was — EXTI taps the pad and changes nothing
about the port. What it loses is its mode transitions: into_* take the
pin by value, and while the line holds it only references get out.
Source§impl<const N: u8, SRC> ExtiLine<N, SRC>where
SRC: ExtiConfigured,
impl<const N: u8, SRC> ExtiLine<N, SRC>where
SRC: ExtiConfigured,
Sourcepub fn edge(&mut self, edge: EdgeTrigger)
pub fn edge(&mut self, edge: EdgeTrigger)
Detects rising edges, falling edges, both, or neither.
RTEN and FTEN are independent, so a line with neither set is left
firing only from software.
Read-modify-write on registers shared by every line: when lines are configured from different contexts, put the call in a critical section.
Sourcepub fn listen(&mut self)
pub fn listen(&mut self)
Raises this line’s interrupt in the NVIC.
One vector serves several lines, so a handler still has to ask which of them is pending.
Read-modify-write on a register shared by every line: when lines are configured from different contexts, put the call in a critical section.
Sourcepub fn unlisten(&mut self)
pub fn unlisten(&mut self)
Stops the line reaching the NVIC. The pending flag still latches.
Read-modify-write on a register shared by every line: when lines are configured from different contexts, put the call in a critical section.
Sourcepub fn is_listening(&self) -> bool
pub fn is_listening(&self) -> bool
Whether the line reaches the NVIC.
Sourcepub fn listen_event(&mut self)
pub fn listen_event(&mut self)
Raises this line as an event instead of an interrupt.
An event enters no handler: it sets the core’s event latch, which is
what WFE waits on, and execution carries on from there.
Read-modify-write on a register shared by every line: when lines are configured from different contexts, put the call in a critical section.
Sourcepub fn unlisten_event(&mut self)
pub fn unlisten_event(&mut self)
Stops the line raising events.
Read-modify-write on a register shared by every line: when lines are configured from different contexts, put the call in a critical section.
Sourcepub fn is_listening_event(&self) -> bool
pub fn is_listening_event(&self) -> bool
Whether the line raises events.
Sourcepub fn pend(&mut self)
pub fn pend(&mut self)
Raises the line from software, edge or no edge.
SWIEV goes straight to the pending flag, so a line left on
EdgeTrigger::None still fires this way.
Read-modify-write on a register shared by every line: when lines are configured from different contexts, put the call in a critical section.
Sourcepub fn is_pending(&self) -> bool
pub fn is_pending(&self) -> bool
Whether the line has fired and not been cleared since.
Only the interrupt path latches this: a line raised while it is listening
for events alone leaves the flag clear, so polling it without
listen never sees anything.
Sourcepub fn clear_interrupt(&mut self)
pub fn clear_interrupt(&mut self)
Clears the pending flag.
The request is a level, so a handler that returns without this is entered again at once.
Source§impl<const P: char, const N: u8, MODE> ExtiLine<N, Pin<P, N, MODE>>
impl<const P: char, const N: u8, MODE> ExtiLine<N, Pin<P, N, MODE>>
Sourcepub fn pin_mut(&mut self) -> &mut Pin<P, N, MODE>
pub fn pin_mut(&mut self) -> &mut Pin<P, N, MODE>
The pin the line listens to, for driving it.
A line watching a pin this code drives itself is legal, and this is how that pin is still reached.
Sourcepub fn release(self) -> (ExtiLine<N, PinSrc>, Pin<P, N, MODE>)where
Pin<P, N, MODE>: ExtiConfigured,
pub fn release(self) -> (ExtiLine<N, PinSrc>, Pin<P, N, MODE>)where
Pin<P, N, MODE>: ExtiConfigured,
Gives the pin back and returns the line to its unsourced state.
Disarms the line first — no edges, neither output, no pending flag — so the next owner of the pin does not inherit an interrupt on it.
Read-modify-write on registers shared by every line: when lines are configured from different contexts, put the call in a critical section.