Skip to content

Commit 99b6de3

Browse files
committed
improve cdc core
1 parent a122cef commit 99b6de3

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

cores/nRF5/Adafruit_TinyUSB_Core/Adafruit_USBD_CDC.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,8 @@ size_t Adafruit_USBD_CDC::write(const uint8_t *buffer, size_t size)
101101
remain -= wrcount;
102102
buffer += wrcount;
103103

104-
// Write FIFO is full, flush and re-try
105-
if ( remain )
106-
{
107-
tud_cdc_write_flush();
108-
}
104+
// Write FIFO is full, run usb background to flush
105+
if ( remain ) yield();
109106
}
110107

111108
return size - remain;

libraries/Adafruit_LittleFS/examples/Internal_ListFiles/Internal_ListFiles.ino

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
any redistribution
1313
*********************************************************************/
1414

15-
#include <bluefruit.h>
15+
//#include <bluefruit.h>
1616
#include <Adafruit_LittleFS.h>
1717

1818
using namespace LittleFilesystem;
@@ -40,7 +40,7 @@ void setup()
4040

4141
// Print prompt
4242
Serial.println();
43-
Serial.println("Enter anything to print directory tree (again):");
43+
Serial.println("Enter anything to print directory tree:");
4444
}
4545

4646
// the loop function runs over and over again forever
@@ -55,7 +55,7 @@ void loop()
5555

5656
// Print prompt
5757
Serial.println();
58-
Serial.println("Enter anything to print directory tree (again):");
58+
Serial.println("Enter anything to print directory tree:");
5959
}
6060
}
6161

@@ -78,7 +78,7 @@ void printTreeDir(const char* cwd, uint8_t level)
7878
// File within folder
7979
File item(InternalFS);
8080

81-
// Loop through the directory
81+
// Loop through the directory
8282
while( (item = dir.openNextFile(FILE_READ)) )
8383
{
8484
// Indentation according to dir level
@@ -95,7 +95,12 @@ void printTreeDir(const char* cwd, uint8_t level)
9595
// High number of MAX_LEVEL can cause memory overflow
9696
if ( level < MAX_LEVEL )
9797
{
98-
printTreeDir( item.path(), level+1 );
98+
char dpath[strlen(cwd) + strlen(item.name()) + 2 ];
99+
strcpy(dpath, cwd);
100+
strcat(dpath, "/");
101+
strcat(dpath, item.name());
102+
103+
printTreeDir( dpath, level+1 );
99104
}
100105
}else
101106
{

0 commit comments

Comments
 (0)