Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: EthernetXpresso.h
- Revision:
- 1:95a4c234aaf6
- Parent:
- 0:b4bf563e9741
- Child:
- 4:7c859e671f9c
--- a/EthernetXpresso.h Sun May 06 10:11:53 2012 +0000 +++ b/EthernetXpresso.h Sun May 06 10:52:06 2012 +0000 @@ -3,12 +3,16 @@ #include <stdint.h> #include "LPC1769Emac.h" +/** + * mbed-like wrapper class for LPCXpresso LPC1769. + * @author @moccos + */ class EthernetXpresso { public: EthernetXpresso(); virtual ~EthernetXpresso(); - // same as mbed's + // same as mbed enum Mode { AutoNegotiate , HalfDuplex10 @@ -16,89 +20,79 @@ , HalfDuplex100 , FullDuplex100 }; - /* Function: write + /** * Writes into an outgoing ethernet packet. - * * It will append size bytes of data to the previously written bytes. * - * Variables: - * data - An array to write. - * size - The size of data. - * - * Returns: - * The number of written bytes. + * @param data An array to write. + * @param size The size of data. + * @return The number of written bytes. */ int write(const char *data, int size) { return emac_.Write((void*)data, size); } - /* Function: 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. * - * Returns: - * 0 - If the sending was failed. - * 1 - If the package is successfully sent. + * @retval 0 If the sending was failed. + * @retval 1 If the package is successfully sent. */ int send() { return emac_.Send() ? 1 : 0; } - /* Function: receive + /** * Recevies 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. * - * Returns: - * 0 - If no ethernet packet is arrived. - * The size of the arrived packet. + * @return The size of the arrived packet. */ int receive() { return emac_.ReadyToReceive(); } - /* Function: read + /** * Read from an recevied ethernet packet. * - * After receive returnd a number bigger than 0it is + * After receive returnd a number bigger than 0, it is * possible to read bytes from this packet. * Read will write up to size bytes into data. * * It is possible to use read multible times. * Each time read will start reading after the last read byte before. * - * Returns: - * The number of byte read. + * @return The number of byte read. */ - int read(char *data, int size) { return emac_.Recv((void*)data, size); } + int read(char *data, int size) { return emac_.Read((void*)data, size); } - /* Function: address - * Gives the ethernet address of the mbed. + /** + * Gives the ethernet address. * - * Variables: - * mac - Must be a pointer to a 6 byte char array to copy the ethernet address in. + * @param mac Must be a pointer to a 6 byte char array to copy the ethernet address in. */ void address(char *mac) { - emac_.SetAddress(mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); - ResetEmac_(); + emac_.UpdateAddress(mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } - /* Function: link + /** * Returns if an ethernet link is pressent or not. It takes a wile after Ethernet initializion to show up. * - * Returns: - * 0 - If no ethernet link is pressent. - * 1 - If an ethernet link is pressent. + * @retval 0 If no ethernet link is pressent. + * @retval 1 If an ethernet link is pressent. */ int link() { return emac_.Link() ? 1 : 0; } - /* Function: set_link + /** * Sets the speed and duplex parameters of an ethernet link * - * Variables: - * mode - the speed and duplex mode to set the link to: + * note: currently auto-neg only + * @param mode the speed and duplex mode to set the link to: */ - // currently auto-neg only void set_link(Mode mode); + /** + * Gets the ethernet address. + */ const char* getHwAddr() { return emac_.getHwAddr(); } private: