pub struct Mode(/* private fields */);
Expand description
Mode register (MR).
Used for software reset, and controlling modes of operation.
This is used by the Registers::mr
and Registers::set_mr
methods.
Implementations§
source§impl Mode
impl Mode
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::Mode;
assert_eq!(Mode::DEFAULT, Mode::default());
sourcepub const RST_OFFSET: u8 = 7u8
pub const RST_OFFSET: u8 = 7u8
Bit offset for the RST
field.
sourcepub const WOL_OFFSET: u8 = 5u8
pub const WOL_OFFSET: u8 = 5u8
Bit offset for the WOL
field.
sourcepub const PPPOE_OFFSET: u8 = 3u8
pub const PPPOE_OFFSET: u8 = 3u8
Bit offset for the PPPoE
field.
sourcepub const FARP_OFFSET: u8 = 1u8
pub const FARP_OFFSET: u8 = 1u8
Bit offset for the FARP
field.
sourcepub const PPPOE_MASK: u8 = 8u8
pub const PPPOE_MASK: u8 = 8u8
Bit mask for the PPPoE
field.
sourcepub const fn rst(self) -> Self
pub const fn rst(self) -> Self
Set the software reset bit to 1
.
When reset all internal registers will be initialized.
sourcepub const fn wol_enabled(&self) -> bool
pub const fn wol_enabled(&self) -> bool
Wake on LAN.
If WOL mode is enabled and the received magic packet over UDP has been normally processed, the interrupt pin (INTn) asserts to low.
Example
use w5500_ll::Mode;
let mr: Mode = Mode::DEFAULT;
assert!(!mr.wol_enabled());
let mr: Mode = mr.enable_wol();
assert!(mr.wol_enabled());
let mr: Mode = mr.disable_wol();
assert!(!mr.wol_enabled());
sourcepub const fn enable_wol(self) -> Self
pub const fn enable_wol(self) -> Self
Enable wake on LAN.
sourcepub const fn disable_wol(self) -> Self
pub const fn disable_wol(self) -> Self
Disable wake on LAN.
sourcepub const fn pb_enabled(&self) -> bool
pub const fn pb_enabled(&self) -> bool
Ping block mode.
If enabled it blocks responses to ping requests.
Example
use w5500_ll::Mode;
let mr: Mode = Mode::DEFAULT;
assert!(!mr.pb_enabled());
let mr: Mode = mr.enable_pb();
assert!(mr.pb_enabled());
let mr: Mode = mr.disable_pb();
assert!(!mr.pb_enabled());
sourcepub const fn disable_pb(self) -> Self
pub const fn disable_pb(self) -> Self
Disable ping block.
sourcepub const fn pppoe_enabled(&self) -> bool
pub const fn pppoe_enabled(&self) -> bool
PPPoE mode.
If you use ADSL this should be enabled.
Example
use w5500_ll::Mode;
let mr: Mode = Mode::DEFAULT;
assert!(!mr.pppoe_enabled());
let mr: Mode = mr.enable_pppoe();
assert!(mr.pppoe_enabled());
let mr: Mode = mr.disable_pppoe();
assert!(!mr.pppoe_enabled());
sourcepub const fn enable_pppoe(self) -> Self
pub const fn enable_pppoe(self) -> Self
Enable PPPoE mode.
sourcepub const fn disable_pppoe(self) -> Self
pub const fn disable_pppoe(self) -> Self
Disable PPPoE mode.
sourcepub const fn farp_enabled(&self) -> bool
pub const fn farp_enabled(&self) -> bool
Force ARP.
When enabled it forces sending ARP request whenever data is sent.
Example
use w5500_ll::Mode;
let mr: Mode = Mode::DEFAULT;
assert!(!mr.farp_enabled());
let mr: Mode = mr.enable_farp();
assert!(mr.farp_enabled());
let mr: Mode = mr.disable_farp();
assert!(!mr.farp_enabled());
sourcepub const fn enable_farp(self) -> Self
pub const fn enable_farp(self) -> Self
Enable force ARP.
sourcepub const fn disable_farp(self) -> Self
pub const fn disable_farp(self) -> Self
Disable force ARP.