|
楼主 |
发表于 2007-11-9 13:41:39
|
显示全部楼层
2007-11-09:最新更新
/*******************************************************************/
/* Mega8 MP3 Player (mega8 + VS1003 + SD) V2.0 */
/* */
/* Discription: Can play mp3/wma/wav/mid SF0 files in the root */
/* directery on the SD card which file system is FAT16*/
/* or FAT32. */
/* It has six keys to control this player */
/* MODE: switch between repeat all (default),repeat 1 */
/* and shuffle */
/* PLAY/PAUSE: */
/* PREV: previous songs */
/* NEXT: next songs */
/* UP : volume up */
/* DOWN: volume down */
/* Platform : AVRStudio4.13 SP1 + WinAVR20070525 */
/* optimize -0s */
/* Author : bozai(Zhang Qibo) */
/* E-mail : sudazqb@163.com */
/* MSN : zhangqibo_1985@hotmail.com */
/* Date : 2007-10-18 */
/*******************************************************************/
/* V2.0 */
/* 2007-11-09 */
/* now the songs may placed in any directory, but the */
/* total number of folder the card has should less than */
/* 127 for we use 512Bytes EEPROM to stored the info */
/* You may set the macro FIX_DIRECTORY in FAT.h to choose whether */
/* to enable this function */
/* */
/* V1.9 */
/* 2007-10-08 */
/* fix a bug (but it never works), so stupid I am,take & as && */
/* */
/* V1.8 */
/* 2007-06-16 */
/* Still the bug of FAT, it's not resolved totally */
/* */
/* V1.7 */
/* 2007-05-21 */
/* Fix a serious bug of FAT */
/* Set the default mode to "Shuffle" */
/* Because the mode button is inside the box */
/* So I don't want to open the box when I turn on it */
/* If the button is easy to press of your mp3 player */
/* just change the macro below to: */
/* 0 = repet all 1 = repet one 2 = shuffle */
#define DEFAULT_MODE 0
/* */
/* V1.6 */
/* 2007-05-09 */
/* And a track function to make the shuffle a real shuffle */
/* Due to the limted RAM space of mega8. Maximum no repetition */
/* songs is 1024. And songs more than that will use randomly play */
/* Special thanks to Ronald Ausloos (Belgium)'s advice */
/* */
/* V1.5 */
/* 2007-05-03 */
/* Change the behavior of the LEDs: */
/* VS1003 faild: LED1 blink */
/* SD faild : LED2 blink */
/* FAT faild : LED1 & LED2 blink alternatly */
/* File not found: Both LED blink */
/* Add read capacity function, fix the bug of FAT init */
/* Add slow start up code of VS1003 */
/* */
/* V1.4 */
/* 2007-05-02 */
/* Add enough delay when operate VS1003 */
/* */
/* V1.3 */
/* 2007-04-21 */
/* Modify the retry time of sd reset */
/* Enable some code incase that when FAT initialize */
/* faild program can't jump out the loop */
/* so the error LED can't light up */
/* And light up both leds when FAT_Ini fails */
/* */
/* V1.2: */
/* 2007-04-04: */
/* Add a macro of path */
/* */
/* V1.1: */
/* 2007-02-25 */
/* Change the directory to C:\music\ */
/* A bug fixed */
/* Modify some code to adjust new GCC compiler */
/* */
/* V1.0: */
/* 2006-12-03: */
/* Original Version */
/*******************************************************************/
版本V2.0:
可以不再使用指定目录存放音乐文件了,文件可以存放在任意目录下(基本不限深度)。但是卡中的总文件夹应不超过127个。
以前没有支持这个功能是应为涉及到函数nest,文件藏的过深会引起堆栈溢出。现在换了一种思路,就是把文件夹的起始簇存到mega8的
内部EEPROM内。但是这样总的文件夹数量会受到限制。不过仅作mp3用途的话,文件夹数量应该不会太多。如果超过127个文件夹,则多于的文件夹将不会被扫描到。因此里面的歌曲也不会被播放到。
这种方法的一个缺点是,文件搜索时间长了很多,如果卡内有很多文件夹的话,文件搜索起来会很慢。
如果你不想使用任意目录这个功能,在fat.h文件内有一个宏定义 #define FIX_DIRECTORY 0 把这个宏定义修改为 1 重新编译即可。
这是压缩包:(阿莫老大如果看到请帮忙整理到楼主位,谢谢!)
点击此处下载ourdev_180345.zip(文件大小:48K)
发现任何bug请发email给我,谢谢! |
|