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]
impl PhyCfg
[src]pub const RST_OFFSET: u8
[src]
pub const RST_OFFSET: u8
[src]Bit offset for the RST
field.
pub const OPMD_OFFSET: u8
[src]
pub const OPMD_OFFSET: u8
[src]Bit offset for the OPMD
field.
pub const OPMDC_OFFSET: u8
[src]
pub const OPMDC_OFFSET: u8
[src]Bit offset for the OPMDC
field.
pub const DPX_OFFSET: u8
[src]
pub const DPX_OFFSET: u8
[src]Bit offset for the DPX
field.
pub const SPD_OFFSET: u8
[src]
pub const SPD_OFFSET: u8
[src]Bit offset for the SPD
field.
pub const LNK_OFFSET: u8
[src]
pub const LNK_OFFSET: u8
[src]Bit offset for the LNK
field.
pub const OPMDC_MASK: u8
[src]
pub const OPMDC_MASK: u8
[src]Bit mask for the OPMDC
field.
pub const fn opmd(&self) -> bool
[src]
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]
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 |
---|---|---|---|
0 | 0 | 0 | 10BT Half-duplex, Auto-negotiation disabled |
0 | 0 | 1 | 10BT Full-duplex, Auto-negotiation disabled |
0 | 1 | 0 | 100BT Half-duplex, Auto-negotiation disabled |
0 | 1 | 1 | 100BT Full-duplex, Auto-negotiation disabled |
1 | 0 | 0 | 100BT Half-duplex, Auto-negotiation enabled |
1 | 0 | 1 | Not used |
1 | 1 | 0 | Not used |
1 | 1 | 1 | All 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]
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]
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]
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]
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]
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]
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 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> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
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]
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