CDC/ECM driver for mbed, based on USBDevice by mbed-official. Uses PicoTCP to access Ethernet USB device. License: GPLv2

Dependents:   USBEthernet_TEST

Fork of USB_Ethernet by Daniele Lacamera

Revision:
1:759afa79ebe8
Parent:
0:34c829fbc7a8
Child:
2:540f6e142d59
--- a/USBCDC_ECM.cpp	Fri Aug 02 08:04:58 2013 +0000
+++ b/USBCDC_ECM.cpp	Sat Aug 03 08:51:00 2013 +0000
@@ -78,14 +78,19 @@
     // We activate the endpoint to be able to recceive data
     readStart(EPBULK_OUT, MAX_PACKET_SIZE_EPBULK);
     printf("Set config: OK!\n");
+    
     return true;
 }
 
 bool USBCDC_ECM::send(uint8_t * buffer, uint32_t size) {
+    if (!configured())
+        return false;
     return USBDevice::write(EPBULK_IN, buffer, size, MAX_CDC_REPORT_SIZE);
 }
 
 bool USBCDC_ECM::readEP(uint8_t * buffer, uint32_t * size) {
+    if (!configured())
+        return false;
     if (!USBDevice::readEP(EPBULK_OUT, buffer, size, MAX_CDC_REPORT_SIZE))
         return false;
     if (!readStart(EPBULK_OUT, MAX_CDC_REPORT_SIZE))
@@ -94,6 +99,8 @@
 }
 
 bool USBCDC_ECM::readEP_NB(uint8_t * buffer, uint32_t * size) {
+    if (!configured())
+        return false;
     if (!USBDevice::readEP_NB(EPBULK_OUT, buffer, size, MAX_CDC_REPORT_SIZE))
         return false;
     if (!readStart(EPBULK_OUT, MAX_CDC_REPORT_SIZE))