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:
- 3:178491b4d4f3
- Parent:
- 2:8f01347859d0
--- a/USBCDCMSC.cpp Wed Apr 22 04:54:29 2015 +0000
+++ b/USBCDCMSC.cpp Wed Apr 22 16:41:59 2015 +0000
@@ -21,9 +21,9 @@
#include "USBEndpoints.h"
/* Bulk endpoint */
-#define MSDBULK_OUT (EP3OUT)
-#define MSDBULK_IN (EP3IN)
-#define MAX_PACKET_SIZE_MSDBULK (MAX_PACKET_SIZE_EP3)
+#define MSDBULK_OUT (EP4OUT)
+#define MSDBULK_IN (EP4IN)
+#define MAX_PACKET_SIZE_MSDBULK (MAX_PACKET_SIZE_EP4)
static uint8_t cdc_line_coding[7]= {0x80, 0x25, 0x00, 0x00, 0x00, 0x00, 0x08};
@@ -381,7 +381,7 @@
}
int USBCDCMSC::_getc() {
- uint8_t c;
+ uint8_t c='\n';
while (cdcbuf.isEmpty());
cdcbuf.dequeue(&c);
return c;
@@ -454,6 +454,13 @@
return true;
}
+void USBCDCMSC::disconnect() {
+ //De-allocate MSD page size:
+ free(page);
+ page = NULL;
+ USBDevice::disconnect();
+}
+
void USBCDCMSC::reset() {
stage = READ_CBW;
@@ -461,7 +468,7 @@
// Called in ISR context called when a data is received
-bool USBCDCMSC::EP3_OUT_callback() {
+bool USBCDCMSC::EP4_OUT_callback() {
uint32_t size = 0;
uint8_t buf[MAX_PACKET_SIZE_EPBULK];
USBDevice::readEP(MSDBULK_OUT, buf, &size, MAX_PACKET_SIZE_EPBULK);
@@ -498,7 +505,7 @@
}
// Called in ISR context when a data has been transferred
-bool USBCDCMSC::EP3_IN_callback() {
+bool USBCDCMSC::EP4_IN_callback() {
switch (stage) {
// the device has to send data to the host