mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #7090 from jorisa/usbserial-write-nonblocking
Add non-blocking write function for USBCDCpull/7224/head
commit
baf563709a
|
@ -127,6 +127,10 @@ bool USBCDC::send(uint8_t * buffer, uint32_t size) {
|
||||||
return USBDevice::write(EPBULK_IN, buffer, size, MAX_CDC_REPORT_SIZE);
|
return USBDevice::write(EPBULK_IN, buffer, size, MAX_CDC_REPORT_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool USBCDC::send_NB(uint8_t * buffer, uint32_t size) {
|
||||||
|
return USBDevice::writeNB(EPBULK_IN, buffer, size, MAX_CDC_REPORT_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
bool USBCDC::readEP(uint8_t * buffer, uint32_t * size) {
|
bool USBCDC::readEP(uint8_t * buffer, uint32_t * size) {
|
||||||
if (!USBDevice::readEP(EPBULK_OUT, buffer, size, MAX_CDC_REPORT_SIZE))
|
if (!USBDevice::readEP(EPBULK_OUT, buffer, size, MAX_CDC_REPORT_SIZE))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -70,7 +70,7 @@ protected:
|
||||||
virtual const uint8_t * configurationDesc();
|
virtual const uint8_t * configurationDesc();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send a buffer
|
* Send a buffer. Warning: blocking
|
||||||
*
|
*
|
||||||
* @param endpoint endpoint which will be sent the buffer
|
* @param endpoint endpoint which will be sent the buffer
|
||||||
* @param buffer buffer to be sent
|
* @param buffer buffer to be sent
|
||||||
|
@ -79,6 +79,16 @@ protected:
|
||||||
*/
|
*/
|
||||||
bool send(uint8_t * buffer, uint32_t size);
|
bool send(uint8_t * buffer, uint32_t size);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Send a buffer. Warning: non blocking
|
||||||
|
*
|
||||||
|
* @param endpoint endpoint which will be sent the buffer
|
||||||
|
* @param buffer buffer to be sent
|
||||||
|
* @param size length of the buffer
|
||||||
|
* @returns true if successful
|
||||||
|
*/
|
||||||
|
bool send_NB(uint8_t * buffer, uint32_t size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read a buffer from a certain endpoint. Warning: blocking
|
* Read a buffer from a certain endpoint. Warning: blocking
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue