Minor Edits to permit packet reading from EVB

Dependencies:   FATFileSystem mbed-rtos

Fork of USBHost by mbed official

Files at this revision

API Documentation at this revision

Comitter:
cward13
Date:
Fri Aug 07 17:34:55 2015 +0000
Parent:
9:7671b6a8c363
Commit message:
Saving All contents

Changed in this revision

USBHostSerial/USBHostSerial.cpp Show annotated file Show diff for this revision Revisions of this file
USBHostSerial/USBHostSerial.h Show annotated file Show diff for this revision Revisions of this file
diff -r 7671b6a8c363 -r bc04ef5958af USBHostSerial/USBHostSerial.cpp
--- a/USBHostSerial/USBHostSerial.cpp	Thu Mar 14 14:20:03 2013 +0000
+++ b/USBHostSerial/USBHostSerial.cpp	Fri Aug 07 17:34:55 2015 +0000
@@ -149,6 +149,36 @@
 }
 
 
+int USBHostSerial::_gets(uint8_t* buffer,int buffer_size) 
+{
+    uint8_t c = 0;
+    if (bulk_in == NULL) 
+    {
+        init();
+        return -1;
+    }
+    while (!circ_buf.isEmpty())
+        circ_buf.dequeue(&c);
+    while (c != 'm')
+    {
+        while (circ_buf.isEmpty());
+        circ_buf.dequeue(&c);
+    }
+    for(int i=0; i<buffer_size;i++)
+    {
+        if (bulk_in == NULL) 
+        {
+            init();
+            return -1;
+        }
+        while (circ_buf.isEmpty());
+        circ_buf.dequeue(&c);
+        buffer[i]=c;
+    }
+    return 1;
+}
+
+
 uint8_t USBHostSerial::available() {
     return circ_buf.available();
 }
diff -r 7671b6a8c363 -r bc04ef5958af USBHostSerial/USBHostSerial.h
--- a/USBHostSerial/USBHostSerial.h	Thu Mar 14 14:20:03 2013 +0000
+++ b/USBHostSerial/USBHostSerial.h	Fri Aug 07 17:34:55 2015 +0000
@@ -106,8 +106,8 @@
      *
      *  @param baudrate The baudrate of the serial port (default = 9600).
      */
-    void baud(int baudrate = 9600);
-    
+    //void baud(int baudrate = 9600);
+    void baud(int baudrate = 1843200);
     /** Set the transmission format used by the Serial port
      *
      *  @param bits The number of bits in a word (default = 8)
@@ -122,7 +122,7 @@
     virtual void setVidPid(uint16_t vid, uint16_t pid);
     virtual bool parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol); //Must return true if the interface should be parsed
     virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used
-
+    virtual int _gets(uint8_t* buffer,int buffer_size); 
     virtual int _getc();
     virtual int _putc(int c);