Struct w5500_ll::Mode

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

source

pub const RESET: u8 = 0u8

Mode register reset value.

source

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());
source

pub const RST_OFFSET: u8 = 7u8

Bit offset for the RST field.

source

pub const WOL_OFFSET: u8 = 5u8

Bit offset for the WOL field.

source

pub const PB_OFFSET: u8 = 4u8

Bit offset for the PB field.

source

pub const PPPOE_OFFSET: u8 = 3u8

Bit offset for the PPPoE field.

source

pub const FARP_OFFSET: u8 = 1u8

Bit offset for the FARP field.

source

pub const RST_MASK: u8 = 128u8

Bit mask for the RST field.

source

pub const WOL_MASK: u8 = 32u8

Bit mask for the WOL field.

source

pub const PB_MASK: u8 = 16u8

Bit mask for the PB field.

source

pub const PPPOE_MASK: u8 = 8u8

Bit mask for the PPPoE field.

source

pub const FARP_MASK: u8 = 2u8

Bit mask for the FARP field.

source

pub const fn rst(self) -> Self

Set the software reset bit to 1.

When reset all internal registers will be initialized.

source

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());
source

pub const fn enable_wol(self) -> Self

Enable wake on LAN.

source

pub const fn disable_wol(self) -> Self

Disable wake on LAN.

source

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());
source

pub const fn enable_pb(self) -> Self

Enable ping block.

source

pub const fn disable_pb(self) -> Self

Disable ping block.

source

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());
source

pub const fn enable_pppoe(self) -> Self

Enable PPPoE mode.

source

pub const fn disable_pppoe(self) -> Self

Disable PPPoE mode.

source

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());
source

pub const fn enable_farp(self) -> Self

Enable force ARP.

source

pub const fn disable_farp(self) -> Self

Disable force ARP.

Trait Implementations§

source§

impl Clone for Mode

source§

fn clone(&self) -> Mode

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 Mode

source§

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

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

impl Default for Mode

source§

fn default() -> Self

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

impl Display for Mode

source§

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

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

impl Format for Mode

Available on crate feature defmt only.
source§

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

Writes the defmt representation of self to fmt.
source§

impl From<Mode> for u8

source§

fn from(val: Mode) -> u8

Converts to this type from the input type.
source§

impl From<u8> for Mode

source§

fn from(val: u8) -> Self

Converts to this type from the input type.
source§

impl Hash for Mode

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Mode

source§

fn eq(&self, other: &Mode) -> 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 Mode

source§

impl Eq for Mode

source§

impl StructuralEq for Mode

source§

impl StructuralPartialEq for Mode

Auto Trait Implementations§

§

impl RefUnwindSafe for Mode

§

impl Send for Mode

§

impl Sync for Mode

§

impl Unpin for Mode

§

impl UnwindSafe for Mode

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.