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
impl Interrupt
sourcepub const DEFAULT: Self = _
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());
sourcepub const CONFLICT_OFFSET: u8 = 7u8
pub const CONFLICT_OFFSET: u8 = 7u8
Bit offset for the CONFLICT
field.
sourcepub const UNREACH_OFFSET: u8 = 6u8
pub const UNREACH_OFFSET: u8 = 6u8
Bit offset for the UNREACH
field.
sourcepub const PPPOE_OFFSET: u8 = 5u8
pub const PPPOE_OFFSET: u8 = 5u8
Bit offset for the PPPoE
field.
sourcepub const CONFLICT_MASK: u8 = 128u8
pub const CONFLICT_MASK: u8 = 128u8
Bit mask for the CONFLICT
field.
sourcepub const UNREACH_MASK: u8 = 64u8
pub const UNREACH_MASK: u8 = 64u8
Bit mask for the UNREACH
field.
sourcepub const PPPOE_MASK: u8 = 32u8
pub const PPPOE_MASK: u8 = 32u8
Bit mask for the PPPoE
field.
sourcepub const fn conflict(&self) -> bool
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());
sourcepub const fn set_conflict(self) -> Self
pub const fn set_conflict(self) -> Self
Set the IP conflict bit.
sourcepub const fn clear_conflict(self) -> Self
pub const fn clear_conflict(self) -> Self
Clear the IP conflict bit.
sourcepub const fn unreach(&self) -> bool
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());
sourcepub const fn set_unreach(self) -> Self
pub const fn set_unreach(self) -> Self
Set the destination unreachable bit.
sourcepub const fn clear_unreach(self) -> Self
pub const fn clear_unreach(self) -> Self
Clear the destination unreachable bit.
sourcepub const fn pppoe(&self) -> bool
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());
sourcepub const fn clear_pppoe(self) -> Self
pub const fn clear_pppoe(self) -> Self
Clear the PPPoE connection close bit.
sourcepub const fn mp(&self) -> bool
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());