Struct EthernetMACWithMii

Source
pub struct EthernetMACWithMii<MDIO, MDC>
where MDIO: MdioPin, MDC: MdcPin,
{ /* private fields */ }
Expand description

Ethernet media access control (MAC) with owned MII

This version of the struct owns it’s MII pins, allowing it to be used directly, instead of requiring that a Miim is created.

Implementations§

Source§

impl<MDIO, MDC> EthernetMACWithMii<MDIO, MDC>
where MDIO: MdioPin, MDC: MdcPin,

Source

pub fn new(eth_mac: EthernetMAC, mdio: MDIO, mdc: MDC) -> Self

Create a new EthernetMAC with owned MDIO and MDC pins.

To interact with a connected Phy, use the read and write functions.

Functionality for interacting with PHYs from the ieee802_3_miim crate is available.

Source

pub fn release_pins(self) -> (EthernetMAC, MDIO, MDC)

Release the owned MDIO and MDC pins, and return an EthernetMAC that has to borrow the MDIO and MDC pins.

Source§

impl<MDIO, MDC> EthernetMACWithMii<MDIO, MDC>
where MDIO: MdioPin, MDC: MdcPin,

Source

pub fn read(&mut self, phy: u8, reg: u8) -> u16

Read MII register reg from the PHY at address phy

Source

pub fn write(&mut self, phy: u8, reg: u8, data: u16)

Write the value data to MII register reg to the PHY at address phy

Methods from Deref<Target = EthernetMAC>§

Source

pub fn mii<'eth, 'pins, Mdio, Mdc>( &'eth mut self, mdio: &'pins mut Mdio, mdc: &'pins mut Mdc, ) -> Stm32Mii<'eth, 'pins, Mdio, Mdc>
where Mdio: MdioPin, Mdc: MdcPin,

Borrow access to the MAC’s SMI.

Allows for controlling and monitoring any PHYs that may be accessible via the MDIO/MDC pins.

Exclusive access to the MDIO and MDC is required to ensure that are not used elsewhere for the duration of Mii communication.

Source

pub fn set_speed(&mut self, speed: Speed)

Set the Ethernet Speed at which the MAC communicates

Note that this does not affect the PHY in any way. To configure the PHY, use EthernetMACWithMii (see: Self::with_mii) or Stm32Mii (see: Self::mii)

Source

pub fn get_speed(&self) -> Speed

Get the Ethernet Speed at which the MAC communicates

Trait Implementations§

Source§

impl<MDIO, MDC> Deref for EthernetMACWithMii<MDIO, MDC>
where MDIO: MdioPin, MDC: MdcPin,

Source§

type Target = EthernetMAC

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<MDIO, MDC> DerefMut for EthernetMACWithMii<MDIO, MDC>
where MDIO: MdioPin, MDC: MdcPin,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<MDIO, MDC> Miim for EthernetMACWithMii<MDIO, MDC>
where MDIO: MdioPin, MDC: MdcPin,

Source§

fn read(&mut self, phy: u8, reg: u8) -> u16

Read an MII register Read more
Source§

fn write(&mut self, phy: u8, reg: u8, data: u16)

Write to an MII register

Auto Trait Implementations§

§

impl<MDIO, MDC> Freeze for EthernetMACWithMii<MDIO, MDC>
where MDIO: Freeze, MDC: Freeze,

§

impl<MDIO, MDC> RefUnwindSafe for EthernetMACWithMii<MDIO, MDC>
where MDIO: RefUnwindSafe, MDC: RefUnwindSafe,

§

impl<MDIO, MDC> Send for EthernetMACWithMii<MDIO, MDC>
where MDIO: Send, MDC: Send,

§

impl<MDIO, MDC> !Sync for EthernetMACWithMii<MDIO, MDC>

§

impl<MDIO, MDC> Unpin for EthernetMACWithMii<MDIO, MDC>
where MDIO: Unpin, MDC: Unpin,

§

impl<MDIO, MDC> UnwindSafe for EthernetMACWithMii<MDIO, MDC>
where MDIO: UnwindSafe, MDC: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.