Struct w5500_ll::SocketInterrupt
source · pub struct SocketInterrupt(/* private fields */);
Expand description
Socket Interrupt Register (Sn_IR).
Indicated the socket status, such as connection, termination, receiving data, and timeout.
This is used by the Registers::sn_ir
and
Registers::set_sn_ir
methods.
Implementations§
source§impl SocketInterrupt
impl SocketInterrupt
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::SocketInterrupt;
assert_eq!(SocketInterrupt::DEFAULT, SocketInterrupt::default());
sourcepub const CON_OFFSET: u8 = 0u8
pub const CON_OFFSET: u8 = 0u8
Bit offset for the CON
field.
sourcepub const DISCON_OFFSET: u8 = 1u8
pub const DISCON_OFFSET: u8 = 1u8
Bit offset for the DISCON
field.
sourcepub const RECV_OFFSET: u8 = 2u8
pub const RECV_OFFSET: u8 = 2u8
Bit offset for the RECV
field.
sourcepub const TIMEOUT_OFFSET: u8 = 3u8
pub const TIMEOUT_OFFSET: u8 = 3u8
Bit offset for the TIMEOUT
field.
sourcepub const SENDOK_OFFSET: u8 = 4u8
pub const SENDOK_OFFSET: u8 = 4u8
Bit offset for the SENDOK
field.
sourcepub const DISCON_MASK: u8 = 2u8
pub const DISCON_MASK: u8 = 2u8
Bit mask for the DISCON
field.
sourcepub const TIMEOUT_MASK: u8 = 8u8
pub const TIMEOUT_MASK: u8 = 8u8
Bit mask for the TIMEOUT
field.
sourcepub const SENDOK_MASK: u8 = 16u8
pub const SENDOK_MASK: u8 = 16u8
Bit mask for the SENDOK
field.
sourcepub const fn con_raised(&self) -> bool
pub const fn con_raised(&self) -> bool
Get the value of the CON
interrupt.
This is issued once when the connection with the peer is successful.
Example
use w5500_ll::SocketInterrupt;
let sir: SocketInterrupt = SocketInterrupt::DEFAULT;
assert!(!sir.con_raised());
sourcepub const fn discon_raised(&self) -> bool
pub const fn discon_raised(&self) -> bool
Get the value of the DISCON
interrupt.
This is issued when FIN or FIN/ACK packet is received from a peer.
Example
use w5500_ll::SocketInterrupt;
let sir: SocketInterrupt = SocketInterrupt::DEFAULT;
assert!(!sir.discon_raised());
sourcepub const fn clear_discon(self) -> Self
pub const fn clear_discon(self) -> Self
Clear the DISCON
interrupt by writing 1
.
sourcepub const fn recv_raised(&self) -> bool
pub const fn recv_raised(&self) -> bool
Get the value of the RECV
interrupt.
This is issued whenever data is received from a peer.
Example
use w5500_ll::SocketInterrupt;
let sir: SocketInterrupt = SocketInterrupt::DEFAULT;
assert!(!sir.recv_raised());
sourcepub const fn clear_recv(self) -> Self
pub const fn clear_recv(self) -> Self
Clear the RECV
interrupt by writing 1
.
sourcepub const fn timeout_raised(&self) -> bool
pub const fn timeout_raised(&self) -> bool
Get the value of the TIMEOUT
interrupt.
This is issued when ARPTO or TCPTO occurs.
Example
use w5500_ll::SocketInterrupt;
let sir: SocketInterrupt = SocketInterrupt::DEFAULT;
assert!(!sir.timeout_raised());
sourcepub const fn clear_timeout(self) -> Self
pub const fn clear_timeout(self) -> Self
Clear the TIMEOUT
interrupt by writing 1
.
sourcepub const fn sendok_raised(&self) -> bool
pub const fn sendok_raised(&self) -> bool
sourcepub const fn clear_sendok(self) -> Self
pub const fn clear_sendok(self) -> Self
Clear the SENDOK
interrupt by writing 1
.
sourcepub const fn any_raised(&self) -> bool
pub const fn any_raised(&self) -> bool
Returns true
if any interrupt is raised.
Example
use w5500_ll::SocketInterrupt;
assert!(!SocketInterrupt::DEFAULT.any_raised());
Trait Implementations§
source§impl Clone for SocketInterrupt
impl Clone for SocketInterrupt
source§fn clone(&self) -> SocketInterrupt
fn clone(&self) -> SocketInterrupt
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SocketInterrupt
impl Debug for SocketInterrupt
source§impl Default for SocketInterrupt
impl Default for SocketInterrupt
source§impl Display for SocketInterrupt
impl Display for SocketInterrupt
source§impl Format for SocketInterrupt
Available on crate feature defmt
only.
impl Format for SocketInterrupt
defmt
only.source§impl From<SocketInterrupt> for u8
impl From<SocketInterrupt> for u8
source§fn from(val: SocketInterrupt) -> u8
fn from(val: SocketInterrupt) -> u8
source§impl From<u8> for SocketInterrupt
impl From<u8> for SocketInterrupt
source§impl PartialEq for SocketInterrupt
impl PartialEq for SocketInterrupt
source§fn eq(&self, other: &SocketInterrupt) -> bool
fn eq(&self, other: &SocketInterrupt) -> bool
self
and other
values to be equal, and is used
by ==
.