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.
Dependencies: FATFileSystem mbed-rtos
Fork of USBHost by
Revision 32:bc04ef5958af, committed 2015-08-07
- Comitter:
- cward13
- Date:
- Fri Aug 07 17:34:55 2015 +0000
- Parent:
- 9:7671b6a8c363
- Commit message:
- Saving All contents
Changed in this revision
--- 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();
}
--- 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);
