use VS1033(MP3 decoder) and UL024TF(TFTLCD)
Dependencies: FastIO SDFileSystem TFTLCDwithFastIO TouchPanel VS1033 mbed
Fork of 11U68_MP3Player with TFTLCD by
Diff: main.cpp
- Revision:
- 4:28900cff8f48
- Parent:
- 3:67e97c846cec
- Child:
- 5:a493361aead2
--- a/main.cpp Thu Jul 16 11:40:58 2015 +0000 +++ b/main.cpp Thu Jul 16 12:43:08 2015 +0000 @@ -251,7 +251,6 @@ ////////////////////////////////////////////////////////////// if(mp3Player_State == MP3_STATE_PLAYREQ) { - printf("state:%d\r\n",mp3Player_State); fp = fopen("/sd/1.mp3", "rb"); SDFileOpenFailCnt = 0; while(!fp) @@ -282,7 +281,6 @@ } if( mp3Player_State == MP3_STATE_PLAYING ) { - printf("state:%d\r\n",mp3Player_State); printf("totalSendSize:%d\r\n",mp3_totalSizeSent); if(mp3_totalSizeSent>=mp3_fileSize) //play song end @@ -298,22 +296,34 @@ } if( mp3Player_State == MP3_STATE_STOPREQ ) { - printf("state:%d\r\n",mp3Player_State); - mp3.stop(); + uint16_t returnCode=0; + uint16_t stopFailCnt = 0; + do + { + returnCode = mp3.stop(); + printf("STOP\r\nSTOP CODE:%d\r\n",returnCode); + + if(returnCode != 0) + { + stopFailCnt++; + } + if(stopFailCnt >= 10) + { + printf("ERROR! impossible of stop\r\nSystem STOP\r\n"); + while(1); + } + }while(returnCode != 0); fclose(fp); fp = NULL; f_mp3Playwe_Playing = 0; - printf("stop\r\n"); mp3Player_State = MP3_STATE_STOPPING; } if( mp3Player_State == MP3_STATE_STOPPING ) { - printf("state:%d\r\n",mp3Player_State); } if( mp3Player_State == MP3_STATE_VOLCHANGEREQ ) { - printf("state:%d\r\n",mp3Player_State); } } }