int PlayListCreating FILINFO Fno char fn This function is assuming non

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
int PlayListCreating()
{
FILINFO Fno;
char *fn; /* This function is assuming non-Unicode cfg. */
u16 s=0;
unsigned int fsize=0;
unsigned int i=0;
#if _USE_LFN
static char lfn[_MAX_LFN * (0 ? 2 : 1) + 1];
Fno.lfname = lfn;
Fno.lfsize = sizeof(lfn);
#endif
res = f_opendir(&Dir, "/");
for (;;)
{
res = f_readdir(&Dir, &Fno); /* cчитаем директорию*/
if (res != FR_OK) break; /* конец директории*/
if (Fno.fname[0] == 0) break; // нет файлов
if (Fno.fname[0] == '.') continue; /* Ignore dot entry */
#if _USE_LFN
fn = *Fno.lfname ? Fno.lfname : Fno.fname;
fsize=Fno.fsize;
#else fn = Fno.fname;
#endif
if ((Fno.fattrib != AM_DIR)&& /* это файл? */
((strstr(Fno.fname, ".WAV") != NULL) ||
(strstr(Fno.fname, ".wav") != NULL) ||
(strstr(Fno.fname, ".MP3") != NULL) ||
(strstr(Fno.fname, ".mp3") != NULL)))
{
s++;
if ((strstr(Fno.fname, ".WAV") != NULL) ||(strstr(Fno.fname, ".wav") != NULL))
PLAYLIST[s].PCM_mode=1; else PLAYLIST[s].PCM_mode=0;
PLAYLIST[s].FSIZE=fsize;
i=0;
while (fn[i]!=0)
{
PLAYLIST[s].NAME[i] = fn[i];
i++;
}
int j;
for(j=i;j<70;j++)
{
PLAYLIST[s].NAME[j] = 0x00;
}
}
}
return s;
}