From 2f1d68d31fbb080c719fded08f999ab9f90cd385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Sat, 15 Dec 2012 12:43:55 +0000 Subject: [PATCH] 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 --- BaS_gcc/include/ffconf.h | 2 +- BaS_gcc/sources/BaS.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/BaS_gcc/include/ffconf.h b/BaS_gcc/include/ffconf.h index 0727881..aa9d085 100644 --- a/BaS_gcc/include/ffconf.h +++ b/BaS_gcc/include/ffconf.h @@ -36,7 +36,7 @@ / 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. */ diff --git a/BaS_gcc/sources/BaS.c b/BaS_gcc/sources/BaS.c index f2fbf8d..230481c 100644 --- a/BaS_gcc/sources/BaS.c +++ b/BaS_gcc/sources/BaS.c @@ -193,6 +193,7 @@ void BaS(void) if (fres == FR_OK) { DIR directory; + FIL file; fres = f_opendir(&directory, "\\"); 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); } + + 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: ");