If you have a "WELCOME.MSG" file on your sd-card during boot (must be DOS format), the contents of the file is read and send to the serial port

This commit is contained in:
Markus Fröschle
2012-12-15 12:43:55 +00:00
parent 753505a392
commit c3266a2b7b
2 changed files with 14 additions and 1 deletions

View File

@@ -36,7 +36,7 @@
/ 3: f_lseek is removed in addition to 2. */ / 3: f_lseek is removed in addition to 2. */
#define _USE_STRFUNC 0 /* 0:Disable or 1-2:Enable */ #define _USE_STRFUNC 1 /* 0:Disable or 1-2:Enable */
/* To enable string functions, set _USE_STRFUNC to 1 or 2. */ /* To enable string functions, set _USE_STRFUNC to 1 or 2. */

View File

@@ -193,6 +193,7 @@ void BaS(void)
if (fres == FR_OK) if (fres == FR_OK)
{ {
DIR directory; DIR directory;
FIL file;
fres = f_opendir(&directory, "\\"); fres = f_opendir(&directory, "\\");
if (fres == FR_OK) if (fres == FR_OK)
@@ -208,6 +209,18 @@ void BaS(void)
{ {
xprintf("could not open directory \"\\\" on SD-card! Error code: %d\r\n", fres); xprintf("could not open directory \"\\\" on SD-card! Error code: %d\r\n", fres);
} }
fres = f_open(&file, "WELCOME.MSG", FA_READ);
if (fres == FR_OK)
{
char line[128];
while (f_gets(line, sizeof(line), &file))
{
xprintf("%s", line);
}
}
f_close(&file);
} }
} }
xprintf("copy EmuTOS: "); xprintf("copy EmuTOS: ");