Skip to content

Commit baf5637

Browse files
author
Cruz Monrreal
authored
Merge pull request #7090 from jorisa/usbserial-write-nonblocking
Add non-blocking write function for USBCDC
2 parents ac107e9 + 1fb57a3 commit baf5637

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

features/unsupported/USBDevice/USBSerial/USBCDC.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ bool USBCDC::send(uint8_t * buffer, uint32_t size) {
127127
return USBDevice::write(EPBULK_IN, buffer, size, MAX_CDC_REPORT_SIZE);
128128
}
129129

130+
bool USBCDC::send_NB(uint8_t * buffer, uint32_t size) {
131+
return USBDevice::writeNB(EPBULK_IN, buffer, size, MAX_CDC_REPORT_SIZE);
132+
}
133+
130134
bool USBCDC::readEP(uint8_t * buffer, uint32_t * size) {
131135
if (!USBDevice::readEP(EPBULK_OUT, buffer, size, MAX_CDC_REPORT_SIZE))
132136
return false;

features/unsupported/USBDevice/USBSerial/USBCDC.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class USBCDC: public USBDevice {
7070
virtual const uint8_t * configurationDesc();
7171

7272
/*
73-
* Send a buffer
73+
* Send a buffer. Warning: blocking
7474
*
7575
* @param endpoint endpoint which will be sent the buffer
7676
* @param buffer buffer to be sent
@@ -79,6 +79,16 @@ class USBCDC: public USBDevice {
7979
*/
8080
bool send(uint8_t * buffer, uint32_t size);
8181

82+
/*
83+
* Send a buffer. Warning: non blocking
84+
*
85+
* @param endpoint endpoint which will be sent the buffer
86+
* @param buffer buffer to be sent
87+
* @param size length of the buffer
88+
* @returns true if successful
89+
*/
90+
bool send_NB(uint8_t * buffer, uint32_t size);
91+
8292
/*
8393
* Read a buffer from a certain endpoint. Warning: blocking
8494
*

0 commit comments

Comments
 (0)