From 860eddc0b85ef4be3c87448b77ac7529f2185386 Mon Sep 17 00:00:00 2001 From: nino-porcino Date: Mon, 21 Mar 2022 14:15:53 +0100 Subject: [PATCH] pausable dir, improve matching in LOAD --- demos/sdcard/apple1_sdcard/apple1_sdcard.ino | 401 +++++++++---------- demos/sdcard/cmd_dir.h | 50 ++- demos/sdcard/console.h | 2 +- demos/sdcard/sdcard.c | 29 ++ 4 files changed, 269 insertions(+), 213 deletions(-) diff --git a/demos/sdcard/apple1_sdcard/apple1_sdcard.ino b/demos/sdcard/apple1_sdcard/apple1_sdcard.ino index 08f3ffa..06f0ff4 100644 --- a/demos/sdcard/apple1_sdcard/apple1_sdcard.ino +++ b/demos/sdcard/apple1_sdcard/apple1_sdcard.ino @@ -245,6 +245,10 @@ const char *DIR_CREATED = " (DIR) CREATED"; const char *CANT_CD_DIR = "?CAN'T CHANGE DIR"; const char *NOT_A_DIRECTORY = "?NOT A DIRECTORY"; +// file structures used to operate with the SD card +File myFile; +File myDir; + void setup() { // debug on serial Serial.begin(9600); @@ -285,76 +289,7 @@ void setup() { // ************************************************************************************** // ************************************************************************************** -/* -// recursive print directory -void printDirectory(File dir, int numTabs) { - - while (true) { - if(TIMEOUT) break; - - File entry = dir.openNextFile(); - if (! entry) { - // no more files - break; - } - - // indentazione delle sottodirectory - for (uint8_t i = 0; i < numTabs; i++) { - Serial.print('\t'); - send_byte_to_cpu(32); - send_byte_to_cpu(32); - send_byte_to_cpu(32); - } - - // nome del file - char *msg; - entry.getName(filename, 64); - msg = filename; - - Serial.print(msg); - for(int t=0; t