Struct w5500_ll::PhyCfg[][src]

pub struct PhyCfg(_);
Expand description

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

PHY configuration register reset value.

Default value.

This is the same as default, but as a const value.

Example
use w5500_ll::PhyCfg;

assert_eq!(PhyCfg::DEFAULT, PhyCfg::default());

Bit offset for the RST field.

Bit offset for the OPMD field.

Bit offset for the OPMDC field.

Bit offset for the DPX field.

Bit offset for the SPD field.

Bit offset for the LNK field.

Bit mask for the RST field.

Bit mask for the OPMD field.

Bit mask for the OPMDC field.

Bit mask for the DPX field.

Bit mask for the SPD field.

Bit mask for the LNK field.

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

Get the PHY operation mode.

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

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::PhyCfg;

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

Enable software configuration of the PHY operation mode.

Example
use w5500_ll::PhyCfg;

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

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};

assert_eq!(PhyCfg::DEFAULT.opmdc(), OperationMode::Auto);

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 phy_cfg: PhyCfg = PhyCfg::DEFAULT;
assert!(!phy_cfg.opmd());
let phy_cfg: PhyCfg = phy_cfg.set_opmdc(OperationMode::PowerDown);
assert!(phy_cfg.opmd());
assert_eq!(phy_cfg.opmdc(), OperationMode::PowerDown);
let phy_cfg: PhyCfg = phy_cfg.set_opmdc(OperationMode::Auto);
assert_eq!(phy_cfg.opmdc(), OperationMode::Auto);

Get the duplex status.

Example
use w5500_ll::{DuplexStatus, PhyCfg};

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

Get the speed status.

Example
use w5500_ll::{PhyCfg, SpeedStatus};

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

Get the link status.

Example
use w5500_ll::{LinkStatus, PhyCfg};

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

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

recently added

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.