MP3 PLAYER

Dependencies:   DebouncedInterrupt SDFileSystem SPI_TFT_ILI9341 ST_401_84MHZ TFT_fonts VS1053 mbed

Fork of MP3333 by FRA221_B18

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "player.h"
00003 #include "DebouncedInterrupt.h"
00004 
00005 
00006 extern char list[20][50];            //song list
00007 extern unsigned char vlume;     //vlume
00008 extern unsigned char vlumeflag; //set vlume flag
00009 extern char index;              //song play index
00010 extern char index_MAX;          //how many song in all
00011 extern playerStatetype  playerState;
00012 
00013 Serial pc(SERIAL_TX, SERIAL_RX);
00014 
00015 Player player;
00016 
00017 DebouncedInterrupt KEY_PS(D3);
00018 InterruptIn KEY_Next(D4);
00019 
00020 
00021 void riseFlip()
00022 {
00023     if(player.mode()) {
00024         if(playerState == PS_PAUSE) playerState = PS_PLAY;
00025         else playerState = PS_PAUSE;
00026     }
00027 }
00028 
00029 void Next()
00030 {
00031     if(player.mode())playerState = PS_STOP;
00032     //player.select_list();
00033 }
00034 
00035 
00036 int main()
00037 {
00038 
00039     player.setup();
00040     KEY_PS.attach(&riseFlip ,IRQ_RISE ,100);
00041     KEY_Next.fall(&Next);
00042     player.begin();
00043     if(player.mode())player.print_list();
00044     else player.letplay();
00045     while(1) {
00046         player.playFile(list[index]);
00047     }
00048     //int i = player.getGX();
00049     //printf("%d\n",i);
00050 }
00051 
00052