Struct enc28j60::Enc28j60 [] [src]

pub struct Enc28j60<SPI, NCS, INT, RESET> { /* fields omitted */ }

ENC28J60 driver

Methods

impl<E, SPI, NCS, INT, RESET> Enc28j60<SPI, NCS, INT, RESET> where
    SPI: Transfer<u8, Error = E> + Write<u8, Error = E>,
    NCS: OutputPin,
    INT: IntPin,
    RESET: ResetPin
[src]

[src]

Creates a new driver from a SPI peripheral, a NCS pin, a RESET pin and an INT (interrupt) pin

If you haven't physically connected the RESET and / or the INT pin(s) pass the Unconnected value as the reset and / or int argument(s), respectively.

rx_buf_sz is the size of the ENC28J60 RX buffer in bytes. Note that if rx_buf_sz is odd it will be rounded to an even number.

src is the MAC address to associate to this interface. Note that this MAC address is only used to decide which frames will be ignored; frames that don't have their destination address set to broadcast (ff:ff:ff:ff:ff:ff) or to src will be ignored by the interface.

Panics

If rx_buf_sz is greater than 8192 (8 Kibibytes); that's the size of the ENC28J60 internal memory.

[src]

Flushes the transmit buffer, ensuring all pending transmissions have completed

[src]

Copies a received frame into the specified buffer

Returns the size of the frame

NOTE If there's no pending packet this method will block until a new packet arrives

[src]

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.

[src]

Destroys the driver and returns all the hardware resources that were owned by it

[src]

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

impl<E, SPI, NCS, INT, RESET> Enc28j60<SPI, NCS, INT, RESET> where
    SPI: Transfer<u8, Error = E> + Write<u8, Error = E>,
    NCS: OutputPin,
    INT: IntPin + InputPin,
    RESET: ResetPin
[src]

[src]

Starts listening for the specified event

[src]

Checks if there's any interrupt pending to be processed by polling the INT pin

[src]

Stops listening for the specified event

Trait Implementations

Auto Trait Implementations

impl<SPI, NCS, INT, RESET> Send for Enc28j60<SPI, NCS, INT, RESET> where
    INT: Send,
    NCS: Send,
    RESET: Send,
    SPI: Send

impl<SPI, NCS, INT, RESET> Sync for Enc28j60<SPI, NCS, INT, RESET> where
    INT: Sync,
    NCS: Sync,
    RESET: Sync,
    SPI: Sync