Skip to main content

ExtiLine

Struct ExtiLine 

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

Source

pub fn source<const P: char, MODE>( self, syscfg: &mut Syscfg, pin: Pin<P, N, MODE>, ) -> ExtiLine<N, Pin<P, N, MODE>>
where Pin<P, N, MODE>: ExtiPin,

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,

Source

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.

Source

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.

Source

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.

Source

pub fn is_listening(&self) -> bool

Whether the line reaches the NVIC.

Source

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.

Source

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.

Source

pub fn is_listening_event(&self) -> bool

Whether the line raises events.

Source

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.

Source

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.

Source

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

Source

pub fn pin(&self) -> &Pin<P, N, MODE>

The pin the line listens to, for reading it.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<const N: u8, SRC> Freeze for ExtiLine<N, SRC>
where SRC: Freeze,

§

impl<const N: u8, SRC> RefUnwindSafe for ExtiLine<N, SRC>
where SRC: RefUnwindSafe,

§

impl<const N: u8, SRC> Send for ExtiLine<N, SRC>
where SRC: Send,

§

impl<const N: u8, SRC> Sync for ExtiLine<N, SRC>
where SRC: Sync,

§

impl<const N: u8, SRC> Unpin for ExtiLine<N, SRC>
where SRC: Unpin,

§

impl<const N: u8, SRC> UnsafeUnpin for ExtiLine<N, SRC>
where SRC: UnsafeUnpin,

§

impl<const N: u8, SRC> UnwindSafe for ExtiLine<N, SRC>
where SRC: UnwindSafe,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.