Struct w5500_ll::PhyCfg[][src]

pub struct PhyCfg(_);

PHY configuration register (PHYCFGR).

Used for:

  • PHY reset.
  • PHY operation modes.
  • PHY status.

This is used by the Registers::phycfgr and Registers::set_phycfgr methods.

Implementations

impl PhyCfg[src]

pub const RESET: u8[src]

PHY configuration register reset value.

pub const RST_OFFSET: u8[src]

Bit offset for the RST field.

pub const OPMD_OFFSET: u8[src]

Bit offset for the OPMD field.

pub const OPMDC_OFFSET: u8[src]

Bit offset for the OPMDC field.

pub const DPX_OFFSET: u8[src]

Bit offset for the DPX field.

pub const SPD_OFFSET: u8[src]

Bit offset for the SPD field.

pub const LNK_OFFSET: u8[src]

Bit offset for the LNK field.

pub const RST_MASK: u8[src]

Bit mask for the RST field.

pub const OPMD_MASK: u8[src]

Bit mask for the OPMD field.

pub const OPMDC_MASK: u8[src]

Bit mask for the OPMDC field.

pub const DPX_MASK: u8[src]

Bit mask for the DPX field.

pub const SPD_MASK: u8[src]

Bit mask for the SPD field.

pub const LNK_MASK: u8[src]

Bit mask for the LNK field.

pub fn rst(&mut self)[src]

Set the PHY reset bit to 0, resetting the PHY.

pub const fn opmd(&self) -> bool[src]

Get the PHY operation mode.

  • true configure PHY with software.
  • false (reset value) configure PHY with hardware.

pub fn hardware_op(&mut self)[src]

Enable hardware configuration of the PHY operation mode.

This uses the PMODE pins to select the PHY operation mode.

PMODE[2]PMODE[1]PMODE[0]Description
00010BT Half-duplex, Auto-negotiation disabled
00110BT Full-duplex, Auto-negotiation disabled
010100BT Half-duplex, Auto-negotiation disabled
011100BT Full-duplex, Auto-negotiation disabled
100100BT Half-duplex, Auto-negotiation enabled
101Not used
110Not used
111All capable, Auto-negotiation enabled

Example

use w5500_ll::{OperationMode, PhyCfg};

let mut phy_cfg = PhyCfg::default();
assert!(!phy_cfg.opmd());
phy_cfg.software_op();
assert!(phy_cfg.opmd());
phy_cfg.hardware_op();
assert!(!phy_cfg.opmd());

pub fn software_op(&mut self)[src]

Enable software configuration of the PHY operation mode.

Example

use w5500_ll::{OperationMode, PhyCfg};

let mut phy_cfg = PhyCfg::default();
assert!(!phy_cfg.opmd());
phy_cfg.software_op();
assert!(phy_cfg.opmd());

pub fn opmdc(&self) -> Result<OperationMode, u8>[src]

Get the operation mode.

This returns an Err(u8) with the opmdc bits if the opmdc bits do not match a valid operation mode.

Example

use w5500_ll::{OperationMode, PhyCfg};

let phy_cfg = PhyCfg::default();
assert_eq!(phy_cfg.opmdc(), Ok(OperationMode::Auto));

pub fn set_opmdc(&mut self, mode: OperationMode)[src]

Set the PHY operation mode.

Setting this will also call PhyCfg::software_op to enable the PHY configuration with the value stored in this register.

Example

use w5500_ll::{OperationMode, PhyCfg};

let mut phy_cfg = PhyCfg::default();
assert!(!phy_cfg.opmd());
phy_cfg.set_opmdc(OperationMode::PowerDown);
assert!(phy_cfg.opmd());
assert_eq!(phy_cfg.opmdc(), Ok(OperationMode::PowerDown));
phy_cfg.set_opmdc(OperationMode::Auto);
assert_eq!(phy_cfg.opmdc(), Ok(OperationMode::Auto));

pub fn dpx(&self) -> DuplexStatus[src]

Get the duplex status.

Example

use w5500_ll::{DuplexStatus, PhyCfg};

let phy_cfg = PhyCfg::default();
assert_eq!(phy_cfg.dpx(), DuplexStatus::Half);

pub fn spd(&self) -> SpeedStatus[src]

Get the speed status.

Example

use w5500_ll::{PhyCfg, SpeedStatus};

let phy_cfg = PhyCfg::default();
assert_eq!(phy_cfg.spd(), SpeedStatus::Mbps10);

pub fn lnk(&self) -> LinkStatus[src]

Get the link status.

Example

use w5500_ll::{LinkStatus, PhyCfg};

let phy_cfg = PhyCfg::default();
assert_eq!(phy_cfg.lnk(), LinkStatus::Down);

Trait Implementations

impl Clone for PhyCfg[src]

fn clone(&self) -> PhyCfg[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for PhyCfg[src]

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

Formats the value using the given formatter. Read more

impl Default for PhyCfg[src]

fn default() -> Self[src]

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

impl Display for PhyCfg[src]

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

Formats the value using the given formatter. Read more

impl From<u8> for PhyCfg[src]

fn from(val: u8) -> PhyCfg[src]

Performs the conversion.

impl PartialEq<PhyCfg> for PhyCfg[src]

fn eq(&self, other: &PhyCfg) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &PhyCfg) -> bool[src]

This method tests for !=.

impl Copy for PhyCfg[src]

impl Eq for PhyCfg[src]

impl StructuralEq for PhyCfg[src]

impl StructuralPartialEq for PhyCfg[src]

Auto Trait Implementations

impl RefUnwindSafe for PhyCfg

impl Send for PhyCfg

impl Sync for PhyCfg

impl Unpin for PhyCfg

impl UnwindSafe for PhyCfg

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.