This fork re-enables FRDM boards and adds WebUSB CDC functionality
Fork of USBDevice_STM32F103 by
Diff: USBSerial/USBSerial.cpp
- Revision:
- 65:48fe9050cb4a
- Parent:
- 47:a0cd9646ecd1
diff -r c3d0530b6d82 -r 48fe9050cb4a USBSerial/USBSerial.cpp --- a/USBSerial/USBSerial.cpp Thu Jun 25 09:33:51 2015 +0900 +++ b/USBSerial/USBSerial.cpp Fri Jul 08 21:16:25 2016 +0000 @@ -27,7 +27,7 @@ } int USBSerial::_getc() { - uint8_t c = 0; + uint8_t c; while (buf.isEmpty()); buf.dequeue(&c); return c; @@ -46,19 +46,21 @@ -bool USBSerial::EPBULK_OUT_callback() { +bool USBSerial::EP2_OUT_callback() { uint8_t c[65]; uint32_t size = 0; //we read the packet received and put it on the circular buffer readEP(c, &size); - for (uint32_t i = 0; i < size; i++) { + for (int i = 0; i < size; i++) { buf.queue(c[i]); } //call a potential handler rx.call(); + // We reactivate the endpoint to receive next characters + readStart(EPBULK_OUT, MAX_PACKET_SIZE_EPBULK); return true; }