Struct w5500_ll::Interrupt

source ·
pub struct Interrupt(/* private fields */);
Expand description

Interrupt and interrupt mask register (IR and IMR).

When used for interrupt masking:

  • false: Interrupt is disabled.
  • true: Interrupt is enabled.

When used for reading interrupt status:

  • false: Interrupt is not raised.
  • true: Interrupt is raised.

This is used by these methods:

Implementations§

source§

impl Interrupt

source

pub const RESET: u8 = 0u8

Interrupt and interrupt mask reset value.

source

pub const DEFAULT: Self = _

Default value.

This is the same as default, but as a const value.

Example
use w5500_ll::Interrupt;

assert_eq!(Interrupt::DEFAULT, Interrupt::default());
source

pub const CONFLICT_OFFSET: u8 = 7u8

Bit offset for the CONFLICT field.

source

pub const UNREACH_OFFSET: u8 = 6u8

Bit offset for the UNREACH field.

source

pub const PPPOE_OFFSET: u8 = 5u8

Bit offset for the PPPoE field.

source

pub const MP_OFFSET: u8 = 4u8

Bit offset for the MP field.

source

pub const CONFLICT_MASK: u8 = 128u8

Bit mask for the CONFLICT field.

source

pub const UNREACH_MASK: u8 = 64u8

Bit mask for the UNREACH field.

source

pub const PPPOE_MASK: u8 = 32u8

Bit mask for the PPPoE field.

source

pub const MP_MASK: u8 = 16u8

Bit mask for the MP field.

source

pub const fn conflict(&self) -> bool

Get the value of the IP conflict interrupt.

This interrupt is set when our source IP is the same as the sender IP in the received ARP request.

Example
use w5500_ll::Interrupt;

let ir: Interrupt = Interrupt::DEFAULT;
assert!(!ir.conflict());
let ir: Interrupt = ir.set_conflict();
assert!(ir.conflict());
let ir: Interrupt = ir.clear_conflict();
assert!(!ir.conflict());
source

pub const fn set_conflict(self) -> Self

Set the IP conflict bit.

source

pub const fn clear_conflict(self) -> Self

Clear the IP conflict bit.

source

pub const fn unreach(&self) -> bool

Get the destination unreachable interrupt.

This interrupt is set when receiving the ICMP (destination port unreachable) packet.

When this interrupt is set destination information such as the IP address and port number may be checked with the corresponding UIPR and UPORTR registers.

Example
use w5500_ll::Interrupt;

let ir: Interrupt = Interrupt::DEFAULT;
assert!(!ir.unreach());
let ir: Interrupt = ir.set_unreach();
assert!(ir.unreach());
let ir: Interrupt = ir.clear_unreach();
assert!(!ir.unreach());
source

pub const fn set_unreach(self) -> Self

Set the destination unreachable bit.

source

pub const fn clear_unreach(self) -> Self

Clear the destination unreachable bit.

source

pub const fn pppoe(&self) -> bool

Get the PPPoE connection close interrupt.

This interrupt is set when PPPoE is disconnected during PPPoE.

Example
use w5500_ll::Interrupt;

let ir: Interrupt = Interrupt::DEFAULT;
assert!(!ir.pppoe());
let ir: Interrupt = ir.set_pppoe();
assert!(ir.pppoe());
let ir: Interrupt = ir.clear_pppoe();
assert!(!ir.pppoe());
source

pub const fn set_pppoe(self) -> Self

Set the PPPoE connection close bit.

source

pub const fn clear_pppoe(self) -> Self

Clear the PPPoE connection close bit.

source

pub const fn mp(&self) -> bool

Get the magic packet interrupt.

This interrupt is set when wake on LAN is enabled, and the magic packet is received.

Example
use w5500_ll::Interrupt;

let ir: Interrupt = Interrupt::DEFAULT;
assert!(!ir.mp());
let ir: Interrupt = ir.set_mp();
assert!(ir.mp());
let ir: Interrupt = ir.clear_mp();
assert!(!ir.mp());
source

pub const fn set_mp(self) -> Self

Set the magic packet bit.

source

pub const fn clear_mp(self) -> Self

Clear the magic packet bit.

Trait Implementations§

source§

impl Clone for Interrupt

source§

fn clone(&self) -> Interrupt

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Interrupt

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Interrupt

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Display for Interrupt

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Format for Interrupt

Available on crate feature defmt only.
source§

fn format(&self, fmt: Formatter<'_>)

Writes the defmt representation of self to fmt.
source§

impl From<Interrupt> for u8

source§

fn from(val: Interrupt) -> u8

Converts to this type from the input type.
source§

impl From<u8> for Interrupt

source§

fn from(val: u8) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Interrupt

source§

fn eq(&self, other: &Interrupt) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Interrupt

source§

impl Eq for Interrupt

source§

impl StructuralEq for Interrupt

source§

impl StructuralPartialEq for Interrupt

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.