embassy-net-enc28j60

Crates

git

Versions

default

Flavors

embassy_net_enc28j60

Struct Enc28j60

source
pub struct Enc28j60<S, O> { /* private fields */ }
Expand description

ENC28J60 embassy-net driver

Implementations§

source§

impl<S, O> Enc28j60<S, O>
where S: SpiDevice, O: OutputPin,

source

pub fn new(spi: S, rst: Option<O>, mac_addr: [u8; 6]) -> Self

Create a new ENC28J60 driver instance.

The RST pin is optional. If None, reset will be done with a SPI soft reset command, instead of via the RST pin.

source

pub fn address(&self) -> [u8; 6]

Returns the device’s MAC address

source

pub fn receive(&mut self, buf: &mut [u8]) -> Option<usize>

Flushes the transmit buffer, ensuring all pending transmissions have completed NOTE: The returned packet must be read or ignore-d, otherwise this method will always return None on subsequent invocations

source

pub fn transmit(&mut self, bytes: &[u8])

Starts the transmission of bytes

It’s up to the caller to ensure that bytes is a valid Ethernet frame. The interface will take care of appending a (4 byte) CRC to the frame and of padding the frame to the minimum size allowed by the Ethernet specification (64 bytes, or 46 bytes of payload).

NOTE This method will flush any previous transmission that’s in progress

§Panics

If bytes length is greater than 1514, the maximum frame length allowed by the interface, or greater than the transmit buffer

Get whether the link is up

source

pub fn mtu(&self) -> u16

Returns the interface Maximum Transmission Unit (MTU)

The value returned by this function will never exceed 1514 bytes. The actual value depends on the memory assigned to the transmission buffer when initializing the device

source

pub fn pending_packets(&mut self) -> u8

Returns the number of packets that have been received but have not been processed yet

source

pub fn accept(&mut self, packets: &[Packet])

Adjusts the receive filter to accept these packet types

source

pub fn ignore(&mut self, packets: &[Packet])

Adjusts the receive filter to ignore these packet types

Trait Implementations§

source§

impl<S, O> Driver for Enc28j60<S, O>
where S: SpiDevice, O: OutputPin,

source§

type RxToken<'a> = RxToken<'a> where Self: 'a

A token to receive a single network packet.
source§

type TxToken<'a> = TxToken<'a, S, O> where Self: 'a

A token to transmit a single network packet.
source§

fn receive( &mut self, cx: &mut Context<'_>, ) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)>

Construct a token pair consisting of one receive token and one transmit token. Read more
source§

fn transmit(&mut self, _cx: &mut Context<'_>) -> Option<Self::TxToken<'_>>

Construct a transmit token. Read more
Get the link state. Read more
source§

fn capabilities(&self) -> Capabilities

Get a description of device capabilities.
source§

fn hardware_address(&self) -> HardwareAddress

Get the device’s hardware address. Read more

Auto Trait Implementations§

§

impl<S, O> Freeze for Enc28j60<S, O>
where S: Freeze, O: Freeze,

§

impl<S, O> RefUnwindSafe for Enc28j60<S, O>

§

impl<S, O> Send for Enc28j60<S, O>
where S: Send, O: Send,

§

impl<S, O> Sync for Enc28j60<S, O>
where S: Sync, O: Sync,

§

impl<S, O> Unpin for Enc28j60<S, O>
where S: Unpin, O: Unpin,

§

impl<S, O> UnwindSafe for Enc28j60<S, O>
where S: UnwindSafe, O: 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<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.