FUNCTIONAL Update from mbed v49: Add APIs for setName/getName so device is name addressible. Also APIs for getting link stats. Also, minor derivative to reduce compiler warnings and tag read-only parameters as const.
Dependencies: Socket lwip-eth lwip-sys lwip
Dependents: WattEye X10Svr SSDP_Server
Fork of EthernetInterface by
Diff: EthernetInterface_Mods.h
- Revision:
- 53:bbcf2853e575
- Parent:
- 50:957161ecdd16
--- a/EthernetInterface_Mods.h Thu Apr 06 23:20:38 2017 +0000 +++ b/EthernetInterface_Mods.h Sun Apr 09 20:58:42 2017 +0000 @@ -14,8 +14,8 @@ // public: // ... normal EthernetInterface APIs // - // add this in the public section, at the bottom -// #include "EthernetInterface_Mods.h" +// add this in the public section, at the bottom +// #include "EthernetInterface_Mods.h" // }; // // STEP 2: edit EthernetInterface.cpp as follows: @@ -35,67 +35,79 @@ #define DP8_VALID_LINK (1 << 0) /**< 1=Link active */ - /** setName - * - * Set the network name for this device. Apply this before - * calling 'connect'. - * - * \example - * EthernetInterface eth; - * ... - * if (0 == eth.init()) { - * eth.setName("Sensor 3"); - * if (0 == eth.connect()) { - * ... - * - * \param myname is the name to assign for this node. - * Only the first 32 characters will be used if the - * name is longer. - * Only '0'-'9', 'A'-'Z', 'a'-'z' are accepted, - * any others are converted to '-'. - * \return 0 on success, a negative number on failure. - */ - static int setName(const char * myname); +/** setName +* +* Set the network name for this device. Apply this before +* calling 'connect'. +* +* \example +* EthernetInterface eth; +* ... +* if (0 == eth.init()) { +* eth.setName("Sensor 3"); +* if (0 == eth.connect()) { +* ... +* +* \param myname is the name to assign for this node. +* Only the first 32 characters will be used if the +* name is longer. +* Only '0'-'9', 'A'-'Z', 'a'-'z' are accepted, +* any others are converted to '-'. +* \return 0 on success, a negative number on failure. +*/ +static int setName(const char * myname); - /** getName - * - * Get the network name for this device. - * - * \return pointer to the name (or null) - */ - static const char * getName(void); +/** getName +* +* Get the network name for this device. +* +* \return pointer to the name (or null) +*/ +static const char * getName(void); - /** is_connected - * - * Determine if the interface is up and connected. - * - * \example - * if (eth.is_connected()) - * ethLED = 1; - * else - * ethLED = 0; - * - * \return true if connected, false if not connected. - */ - static bool is_connected(void); +/** is_connected +* +* Determine if the interface is up and connected. +* +* \example +* if (eth.is_connected()) +* ethLED = 1; +* else +* ethLED = 0; +* +* \return true if connected, false if not connected. +*/ +static bool is_connected(void); + +/** get_transmission_status - full or half duplex. +* +* \return 1 = 1/2 (half) duplex, 2 = 2/2 (full) duplex +*/ +int get_transmission_status(void); // 1 = 1/2 duplex, 2 = full duplex - /** get_transmission_status - full or half duplex. - * - * \return 1 = 1/2 (half) duplex, 2 = 2/2 (full) duplex - */ - int get_transmission_status(void); // 1 = 1/2 duplex, 2 = full duplex - - /** get the speed of the connection. - * - * \return 10 or 100 Mb - */ - int get_connection_speed(void); // 10 or 100 Mb - - /** get the current value in the MII data register. - * - * \return mii register value - */ - uint32_t mii_read_data(void); - +/** get the speed of the connection. +* +* \return 10 or 100 Mb +*/ +int get_connection_speed(void); // 10 or 100 Mb + +/** get the current value in the MII data register. +* +* \return mii register value +*/ +uint32_t mii_read_data(void); + +/** set whether the link signal blinks on traffic, or is steady. +* +* \param BlinkIt when non-zero sets the PHY register accordingly. +* +* \code +* EthernetInterface eth; +* eth.init(); +* eth.connect(); +* eth.LinkBlinkOnTraffic(1); +* \endcode +*/ +void LinkBlinkOnTraffic(int BlinkIt); #endif // ETHERNETINTERFACE_MODS_H \ No newline at end of file