[][src]Struct w5500_ll::PhyCfg

pub struct PhyCfg(_);

PHY configuration register (PHYCFGR).

Used for:

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

This is used by the crate::Registers::phycfgr and crate::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.

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.

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]

impl Copy for PhyCfg[src]

impl Debug for PhyCfg[src]

impl Default for PhyCfg[src]

impl Display for PhyCfg[src]

impl Eq for PhyCfg[src]

impl From<PhyCfg> for u8[src]

impl From<u8> for PhyCfg[src]

impl PartialEq<PhyCfg> for PhyCfg[src]

impl StructuralEq for PhyCfg[src]

impl StructuralPartialEq for PhyCfg[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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.

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.