diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/Adafruit_USBD_CDC.cpp b/cores/nRF5/Adafruit_TinyUSB_Core/Adafruit_USBD_CDC.cpp index c64d46bb..e73fca68 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/Adafruit_USBD_CDC.cpp +++ b/cores/nRF5/Adafruit_TinyUSB_Core/Adafruit_USBD_CDC.cpp @@ -101,11 +101,8 @@ size_t Adafruit_USBD_CDC::write(const uint8_t *buffer, size_t size) remain -= wrcount; buffer += wrcount; - // Write FIFO is full, flush and re-try - if ( remain ) - { - tud_cdc_write_flush(); - } + // Write FIFO is full, run usb background to flush + if ( remain ) yield(); } return size - remain; diff --git a/libraries/Adafruit_LittleFS/examples/Internal_ListFiles/Internal_ListFiles.ino b/libraries/Adafruit_LittleFS/examples/Internal_ListFiles/Internal_ListFiles.ino index 18e05c34..99ea87e9 100644 --- a/libraries/Adafruit_LittleFS/examples/Internal_ListFiles/Internal_ListFiles.ino +++ b/libraries/Adafruit_LittleFS/examples/Internal_ListFiles/Internal_ListFiles.ino @@ -12,7 +12,7 @@ any redistribution *********************************************************************/ -#include +//#include #include using namespace LittleFilesystem; @@ -40,7 +40,7 @@ void setup() // Print prompt Serial.println(); - Serial.println("Enter anything to print directory tree (again):"); + Serial.println("Enter anything to print directory tree:"); } // the loop function runs over and over again forever @@ -55,7 +55,7 @@ void loop() // Print prompt Serial.println(); - Serial.println("Enter anything to print directory tree (again):"); + Serial.println("Enter anything to print directory tree:"); } } @@ -78,7 +78,7 @@ void printTreeDir(const char* cwd, uint8_t level) // File within folder File item(InternalFS); - // Loop through the directory + // Loop through the directory while( (item = dir.openNextFile(FILE_READ)) ) { // Indentation according to dir level @@ -95,7 +95,12 @@ void printTreeDir(const char* cwd, uint8_t level) // High number of MAX_LEVEL can cause memory overflow if ( level < MAX_LEVEL ) { - printTreeDir( item.path(), level+1 ); + char dpath[strlen(cwd) + strlen(item.name()) + 2 ]; + strcpy(dpath, cwd); + strcat(dpath, "/"); + strcat(dpath, item.name()); + + printTreeDir( dpath, level+1 ); } }else {