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.
Dependents: USBMSD_CDC_11U35test
Diff: USBCDCMSC.cpp
- Revision:
- 2:8f01347859d0
- Parent:
- 1:0c31d9b30900
- Child:
- 3:178491b4d4f3
diff -r 0c31d9b30900 -r 8f01347859d0 USBCDCMSC.cpp
--- a/USBCDCMSC.cpp Tue Apr 21 16:42:12 2015 +0000
+++ b/USBCDCMSC.cpp Wed Apr 22 04:54:29 2015 +0000
@@ -162,6 +162,33 @@
return true;
}
+void USBCDCMSC::USBCallback_requestCompleted(uint8_t *buf, uint32_t length) {
+ // Request of setting line coding has 7 bytes
+ if (length != 7) {
+ return;
+ }
+
+ CONTROL_TRANSFER * transfer = getTransferPtr();
+
+ /* Process class-specific requests */
+ if (transfer->setup.bmRequestType.Type == CLASS_TYPE) {
+ if (transfer->setup.bRequest == CDC_SET_LINE_CODING) {
+ if (memcmp(cdc_line_coding, buf, 7)) {
+ memcpy(cdc_line_coding, buf, 7);
+
+ int baud = buf[0] + (buf[1] << 8)
+ + (buf[2] << 16) + (buf[3] << 24);
+ int stop = buf[4];
+ int bits = buf[6];
+ int parity = buf[5];
+
+ lineCodingChanged(baud, bits, parity, stop);
+ }
+ }
+ }
+}
+
+
bool USBCDCMSC::send(uint8_t * buffer, uint16_t size) {
return USBDevice::write(EPBULK_IN, buffer, size, MAX_CDC_REPORT_SIZE);
}