An ethernet interface, to use with the ethernet pins. More...
#include <Ethernet.h>
Public Member Functions | |
Ethernet () | |
Initialize the ethernet interface. More... | |
virtual | ~Ethernet () |
Powers the hardware down. More... | |
int | write (const char *data, int size) |
Writes into an outgoing ethernet packet. More... | |
int | send () |
Send an outgoing ethernet packet. More... | |
int | receive () |
Receives an arrived ethernet packet. More... | |
int | read (char *data, int size) |
Read from an received ethernet packet. More... | |
void | address (char *mac) |
Gives the ethernet address of the mbed. More... | |
int | link () |
Returns if an ethernet link is present or not. More... | |
void | set_link (Mode mode) |
Sets the speed and duplex parameters of an ethernet link. More... | |
An ethernet interface, to use with the ethernet pins.
Example:
Definition at line 59 of file Ethernet.h.
Ethernet | ( | ) |
Initialize the ethernet interface.
|
virtual |
Powers the hardware down.
void address | ( | char * | mac | ) |
Gives the ethernet address of the mbed.
mac | Must be a pointer to a 6 byte char array to copy the ethernet address in. |
int link | ( | ) |
Returns if an ethernet link is present or not.
It takes a while after Ethernet initialization to show up.
Example:
int read | ( | char * | data, |
int | size | ||
) |
Read from an received ethernet packet.
After receive returned a number bigger than 0 it is possible to read bytes from this packet.
data | Pointer to data packet |
size | Size of data to be read. |
int receive | ( | ) |
Receives an arrived ethernet packet.
Receiving an ethernet packet will drop the last received ethernet packet and make a new ethernet packet ready to read. If no ethernet packet is arrived it will return 0.
int send | ( | ) |
Send an outgoing ethernet packet.
After filling in the data in an ethernet packet it must be send. Send will provide a new packet to write to.
void set_link | ( | Mode | mode | ) |
Sets the speed and duplex parameters of an ethernet link.
FullDuplex100 100 Mbit, full duplex
mode | the speed and duplex mode to set the link to: |
int write | ( | const char * | data, |
int | size | ||
) |
Writes into an outgoing ethernet packet.
It will append size bytes of data to the previously written bytes.
data | An array to write. |
size | The size of data. |