-
-
Notifications
You must be signed in to change notification settings - Fork 726
Improved SerialUSB.read() reliability #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cea1d20
e4f7bf5
9f678cb
19ae0eb
07263f8
40d9554
34bf542
b2ddb22
9f24bbe
7d37753
3ba1a35
87bf6e1
a912722
2e44a4d
5265e12
3127d1d
4691ef4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,7 @@ class USBDeviceClass { | |
uint32_t send(uint32_t ep, const void *data, uint32_t len); | ||
void sendZlp(uint32_t ep); | ||
uint32_t recv(uint32_t ep, void *data, uint32_t len); | ||
uint32_t recv(uint32_t ep); | ||
int recv(uint32_t ep); | ||
uint32_t available(uint32_t ep); | ||
void flush(uint32_t ep); | ||
void stall(uint32_t ep); | ||
|
@@ -112,14 +112,13 @@ extern USBDeviceClass USBDevice; | |
class Serial_ : public Stream | ||
{ | ||
public: | ||
Serial_(USBDeviceClass &_usb) : usb(_usb) { } | ||
Serial_(USBDeviceClass &_usb) : usb(_usb), stalled(false) { } | ||
void begin(uint32_t baud_count); | ||
void begin(unsigned long, uint8_t); | ||
void end(void); | ||
|
||
virtual int available(void); | ||
virtual int availableForWrite(void); | ||
virtual void accept(void); | ||
virtual int peek(void); | ||
virtual int read(void); | ||
virtual void flush(void); | ||
|
@@ -128,6 +127,8 @@ class Serial_ : public Stream | |
using Print::write; // pull in write(str) from Print | ||
operator bool(); | ||
|
||
size_t readBytes(char *buffer, size_t length); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this new API just for testing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's not a new a API is an overloaded method of Stream! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it is not |
||
|
||
// This method allows processing "SEND_BREAK" requests sent by | ||
// the USB host. Those requests indicate that the host wants to | ||
// send a BREAK signal and are accompanied by a single uint16_t | ||
|
@@ -168,8 +169,11 @@ class Serial_ : public Stream | |
}; | ||
|
||
private: | ||
int availableForStore(void); | ||
|
||
USBDeviceClass &usb; | ||
RingBuffer *_cdc_rx_buffer; | ||
bool stalled; | ||
}; | ||
extern Serial_ SerialUSB; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this out now before we forget?