pub struct Enc28j60<S, O> { /* private fields */ }
Expand description
ENC28J60 embassy-net driver
Implementations§
source§impl<S, O> Enc28j60<S, O>
impl<S, O> Enc28j60<S, O>
sourcepub fn new(spi: S, rst: Option<O>, mac_addr: [u8; 6]) -> Self
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.
sourcepub fn receive(&mut self, buf: &mut [u8]) -> Option<usize>
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
sourcepub fn transmit(&mut self, bytes: &[u8])
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
sourcepub fn is_link_up(&mut self) -> bool
pub fn is_link_up(&mut self) -> bool
Get whether the link is up
sourcepub fn mtu(&self) -> u16
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
sourcepub fn pending_packets(&mut self) -> u8
pub fn pending_packets(&mut self) -> u8
Returns the number of packets that have been received but have not been processed yet