MP3 PLAYER

Dependencies:   DebouncedInterrupt SDFileSystem SPI_TFT_ILI9341 ST_401_84MHZ TFT_fonts VS1053 mbed

Fork of B18_MP3_PLAYER by Pakorn Vongseela

Committer:
PKnevermind
Date:
Wed Dec 09 08:34:40 2015 +0000
Revision:
3:c58fe0902900
Parent:
2:c4b198e96ded
B18_MP3_PLAYER

Who changed what in which revision?

UserRevisionLine numberNew contents of line
PKnevermind 0:f7d37719bcfc 1 #include "mbed.h"
PKnevermind 0:f7d37719bcfc 2 #include "player.h"
PKnevermind 2:c4b198e96ded 3 #include "DebouncedInterrupt.h"
PKnevermind 0:f7d37719bcfc 4
PKnevermind 0:f7d37719bcfc 5
PKnevermind 0:f7d37719bcfc 6 extern char list[20][50]; //song list
PKnevermind 0:f7d37719bcfc 7 extern unsigned char vlume; //vlume
PKnevermind 0:f7d37719bcfc 8 extern unsigned char vlumeflag; //set vlume flag
PKnevermind 0:f7d37719bcfc 9 extern char index; //song play index
PKnevermind 0:f7d37719bcfc 10 extern char index_MAX; //how many song in all
PKnevermind 0:f7d37719bcfc 11 extern playerStatetype playerState;
PKnevermind 0:f7d37719bcfc 12
PKnevermind 2:c4b198e96ded 13 Serial pc(SERIAL_TX, SERIAL_RX);
PKnevermind 3:c58fe0902900 14
PKnevermind 2:c4b198e96ded 15 Player player;
PKnevermind 2:c4b198e96ded 16
PKnevermind 2:c4b198e96ded 17 DebouncedInterrupt KEY_PS(D3);
PKnevermind 2:c4b198e96ded 18 InterruptIn KEY_Next(D4);
PKnevermind 0:f7d37719bcfc 19
PKnevermind 3:c58fe0902900 20
PKnevermind 2:c4b198e96ded 21 void riseFlip()
PKnevermind 2:c4b198e96ded 22 {
PKnevermind 3:c58fe0902900 23 if(player.mode()) {
PKnevermind 3:c58fe0902900 24 if(playerState == PS_PAUSE) playerState = PS_PLAY;
PKnevermind 3:c58fe0902900 25 else playerState = PS_PAUSE;
PKnevermind 3:c58fe0902900 26 }
PKnevermind 0:f7d37719bcfc 27 }
PKnevermind 0:f7d37719bcfc 28
PKnevermind 2:c4b198e96ded 29 void Next()
PKnevermind 2:c4b198e96ded 30 {
PKnevermind 3:c58fe0902900 31 if(player.mode())playerState = PS_STOP;
PKnevermind 3:c58fe0902900 32 //player.select_list();
PKnevermind 2:c4b198e96ded 33 }
PKnevermind 2:c4b198e96ded 34
PKnevermind 3:c58fe0902900 35
PKnevermind 2:c4b198e96ded 36 int main()
PKnevermind 2:c4b198e96ded 37 {
PKnevermind 2:c4b198e96ded 38
PKnevermind 3:c58fe0902900 39 player.setup();
PKnevermind 2:c4b198e96ded 40 KEY_PS.attach(&riseFlip ,IRQ_RISE ,100);
PKnevermind 2:c4b198e96ded 41 KEY_Next.fall(&Next);
PKnevermind 3:c58fe0902900 42 player.begin();
PKnevermind 3:c58fe0902900 43 if(player.mode())player.print_list();
PKnevermind 3:c58fe0902900 44 else player.letplay();
PKnevermind 3:c58fe0902900 45 while(1) {
PKnevermind 3:c58fe0902900 46 player.playFile(list[index]);
PKnevermind 2:c4b198e96ded 47 }
PKnevermind 3:c58fe0902900 48 //int i = player.getGX();
PKnevermind 3:c58fe0902900 49 //printf("%d\n",i);
PKnevermind 2:c4b198e96ded 50 }
PKnevermind 2:c4b198e96ded 51
PKnevermind 2:c4b198e96ded 52