[][src]Struct stm32_eth::Eth

pub struct Eth<'rx, 'tx> { /* fields omitted */ }

Ethernet driver for STM32 chips with a LAN8742 Phy like they're found on STM Nucleo-144 boards.

Methods

impl<'rx, 'tx> Eth<'rx, 'tx>[src]

pub fn new(
    eth_mac: ETHERNET_MAC,
    eth_dma: ETHERNET_DMA,
    rx_buffer: &'rx mut [RingEntry<RxDescriptor>],
    tx_buffer: &'tx mut [RingEntry<TxDescriptor>]
) -> Self
[src]

Initialize and start tx and rx DMA engines.

You must call setup() before to initialize the hardware!

Make sure that the buffers reside in a memory region that is accessible by the peripheral. Core-Coupled Memory (CCM) is usually not.

Other than that, initializes and starts the Ethernet hardware so that you can send() and recv_next().

pub fn enable_interrupt(&self, nvic: &mut NVIC)[src]

Enable RX and TX interrupts

In your handler you must call eth_interrupt_handler() to clear interrupt pending bits. Otherwise the interrupt will reoccur immediately.

pub fn interrupt_handler(&self)[src]

pub fn get_phy<'a>(&'a self) -> Phy<'a>[src]

Construct a PHY driver

pub fn status(&self) -> PhyStatus[src]

Obtain PHY status

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

Is Rx DMA currently running?

It stops if the ring is full. Call recv_next() to free an entry and to demand poll from the hardware.

pub fn recv_next(&mut self) -> Result<RxPacket, RxError>[src]

Receive the next packet (if any is ready), or return None immediately.

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

Is Tx DMA currently running?

pub fn send<F: FnOnce(&mut [u8]) -> R, R>(
    &mut self,
    length: usize,
    f: F
) -> Result<R, TxError>
[src]

Send a packet

Trait Implementations

impl<'a, 'rx, 'tx, 'b> Device<'a> for &'b mut Eth<'rx, 'tx>[src]

Use this Ethernet driver with smoltcp

type RxToken = EthRxToken<'a>

type TxToken = EthTxToken<'a>

Auto Trait Implementations

impl<'rx, 'tx> Send for Eth<'rx, 'tx>

impl<'rx, 'tx> !Sync for Eth<'rx, 'tx>

Blanket Implementations

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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

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

impl<T> Same for T

type Output = T

Should always be Self