├── README.md └── DFPlayer_Mini_Mp3 ├── keywords.txt ├── examples ├── DFPlayer_sample │ └── DFPlayer_sample.ino ├── DFPlayer_SoftwareSerial │ └── DFPlayer_SoftwareSerial.ino ├── DFPlayer_receive │ └── DFPlayer_receive.ino └── DFPlayer_Mini_Test │ └── DFPlayer_Mini_Test.ino ├── DFPlayer_Mini_Mp3.h ├── license.txt └── DFPlayer_Mini_Mp3.cpp /README.md: -------------------------------------------------------------------------------- 1 | # This Library is deprecated. Please check here for the new library: 2 | https://github.com/DFRobot/DFRobotDFPlayerMini 3 | 4 | DFPlayer-Mini-mp3 5 | ================= 6 | 7 | Install instructions: 8 | 9 | * Download file 10 | * decompress 11 | * copy inside folder to your Arduino library folder 12 | * restart your Arduino IDE 13 | 14 | 15 | Check the wiki for more information: 16 | http://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299 17 | -------------------------------------------------------------------------------- /DFPlayer_Mini_Mp3/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map for DFPlayer_Mini_Mp3 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | 13 | mp3_set_reply KEYWORD2 14 | fill_uint16_bigend KEYWORD2 15 | mp3_set_serial KEYWORD2 16 | get_mp3_checksum KEYWORD2 17 | mp3_fill_checksum KEYWORD2 18 | mp3_play KEYWORD2 19 | mp3_next KEYWORD2 20 | mp3_prev KEYWORD2 21 | mp3_set_volume KEYWORD2 22 | mp3_set_EQ KEYWORD2 23 | mp3_set_device KEYWORD2 24 | mp3_sleep KEYWORD2 25 | mp3_reset KEYWORD2 26 | mp3_pause KEYWORD2 27 | mp3_stop KEYWORD2 28 | mp3_play_mp3 KEYWORD2 29 | mp3_get_state KEYWORD2 30 | mp3_get_volume KEYWORD2 31 | mp3_get_u_sum KEYWORD2 32 | mp3_get_tf_sum KEYWORD2 33 | mp3_get_flash_sum KEYWORD2 34 | mp3_get_tf_current KEYWORD2 35 | mp3_get_u_current KEYWORD2 36 | mp3_get_flash_current KEYWORD2 37 | mp3_single_loop KEYWORD2 38 | mp3_DAC KEYWORD2 39 | mp3_random_play KEYWORD2 40 | 41 | ####################################### 42 | # Constants (LITERAL1) 43 | ####################################### 44 | 45 | -------------------------------------------------------------------------------- /DFPlayer_Mini_Mp3/examples/DFPlayer_sample/DFPlayer_sample.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * DFPlayer_Mini_Mp3, This library provides a quite complete function for * 3 | * DFPlayer mini mp3 module. * 4 | * www.github.com/dfrobot/DFPlayer_Mini_Mp3 (github as default source provider)* 5 | * DFRobot-A great source for opensource hardware and robot. * 6 | * * 7 | * This file is part of the DFplayer_Mini_Mp3 library. * 8 | * * 9 | * DFPlayer_Mini_Mp3 is free software: you can redistribute it and/or * 10 | * modify it under the terms of the GNU Lesser General Public License as * 11 | * published by the Free Software Foundation, either version 3 of * 12 | * the License, or any later version. * 13 | * * 14 | * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 17 | * GNU Lesser General Public License for more details. * 18 | * * 19 | * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 22 | * GNU Lesser General Public License for more details. * 23 | * * 24 | * You should have received a copy of the GNU Lesser General Public * 25 | * License along with DFPlayer_Mini_Mp3. If not, see * 26 | * . * 27 | * * 28 | ******************************************************************************/ 29 | 30 | /* 31 | * Copyright: DFRobot 32 | * name: DFPlayer_Mini_Mp3 sample code 33 | * Author: lisper 34 | * Date: 2014-05-30 35 | * Description: sample code for DFPlayer Mini, this code is test on Uno 36 | * note: mp3 file must put into mp3 folder in your tf card 37 | */ 38 | 39 | #include 40 | #include 41 | 42 | // 43 | void setup () { 44 | Serial.begin (9600); 45 | mp3_set_serial (Serial); //set Serial for DFPlayer-mini mp3 module 46 | mp3_set_volume (15); 47 | } 48 | 49 | 50 | // 51 | void loop () { 52 | mp3_play (1); 53 | delay (6000); 54 | mp3_next (); 55 | delay (6000); 56 | mp3_prev (); 57 | delay (6000); 58 | mp3_play (4); 59 | delay (6000); 60 | } 61 | 62 | /* 63 | mp3_play (); //start play 64 | mp3_play (5); //play "mp3/0005.mp3" 65 | mp3_next (); //play next 66 | mp3_prev (); //play previous 67 | mp3_set_volume (uint16_t volume); //0~30 68 | mp3_set_EQ (); //0~5 69 | mp3_pause (); 70 | mp3_stop (); 71 | void mp3_get_state (); //send get state command 72 | void mp3_get_volume (); 73 | void mp3_get_u_sum (); 74 | void mp3_get_tf_sum (); 75 | void mp3_get_flash_sum (); 76 | void mp3_get_tf_current (); 77 | void mp3_get_u_current (); 78 | void mp3_get_flash_current (); 79 | void mp3_single_loop (boolean state); //set single loop 80 | void mp3_DAC (boolean state); 81 | void mp3_random_play (); 82 | */ 83 | -------------------------------------------------------------------------------- /DFPlayer_Mini_Mp3/examples/DFPlayer_SoftwareSerial/DFPlayer_SoftwareSerial.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * DFPlayer_Mini_Mp3, This library provides a quite complete function for * 3 | * DFPlayer mini mp3 module. * 4 | * www.github.com/dfrobot/DFPlayer_Mini_Mp3 (github as default source provider)* 5 | * DFRobot-A great source for opensource hardware and robot. * 6 | * * 7 | * This file is part of the DFplayer_Mini_Mp3 library. * 8 | * * 9 | * DFPlayer_Mini_Mp3 is free software: you can redistribute it and/or * 10 | * modify it under the terms of the GNU Lesser General Public License as * 11 | * published by the Free Software Foundation, either version 3 of * 12 | * the License, or any later version. * 13 | * * 14 | * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 17 | * GNU Lesser General Public License for more details. * 18 | * * 19 | * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 22 | * GNU Lesser General Public License for more details. * 23 | * * 24 | * You should have received a copy of the GNU Lesser General Public * 25 | * License along with DFPlayer_Mini_Mp3. If not, see * 26 | * . * 27 | * * 28 | ******************************************************************************/ 29 | 30 | /* 31 | * Copyright: DFRobot 32 | * name: DFPlayer_Mini_Mp3 sample code 33 | * Author: lisper 34 | * Date: 2014-05-30 35 | * Description: connect DFPlayer Mini by SoftwareSerial, this code is test on Uno 36 | * Note: the mp3 files must put into mp3 folder in your tf card 37 | */ 38 | #include 39 | #include 40 | 41 | SoftwareSerial mySerial(10, 11); // RX, TX 42 | 43 | // 44 | void setup () { 45 | Serial.begin (9600); 46 | mySerial.begin (9600); 47 | mp3_set_serial (mySerial); //set softwareSerial for DFPlayer-mini mp3 module 48 | mp3_set_volume (15); 49 | } 50 | 51 | 52 | // 53 | void loop () { 54 | mp3_play (1); 55 | delay (6000); 56 | mp3_next (); 57 | delay (6000); 58 | mp3_prev (); 59 | delay (6000); 60 | mp3_play (4); 61 | delay (6000); 62 | } 63 | 64 | /* 65 | mp3_play (); //start play 66 | mp3_play (5); //play "mp3/0005.mp3" 67 | mp3_next (); //play next 68 | mp3_prev (); //play previous 69 | mp3_set_volume (uint16_t volume); //0~30 70 | mp3_set_EQ (); //0~5 71 | mp3_pause (); 72 | mp3_stop (); 73 | void mp3_get_state (); //send get state command 74 | void mp3_get_volume (); 75 | void mp3_get_u_sum (); 76 | void mp3_get_tf_sum (); 77 | void mp3_get_flash_sum (); 78 | void mp3_get_tf_current (); 79 | void mp3_get_u_current (); 80 | void mp3_get_flash_current (); 81 | void mp3_single_loop (boolean state); //set single loop 82 | void mp3_DAC (boolean state); 83 | void mp3_random_play (); 84 | */ 85 | 86 | -------------------------------------------------------------------------------- /DFPlayer_Mini_Mp3/examples/DFPlayer_receive/DFPlayer_receive.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * DFPlayer_Mini_Mp3, This library provides a quite complete function for * 3 | * DFPlayer mini mp3 module. * 4 | * www.github.com/dfrobot/DFPlayer_Mini_Mp3 (github as default source provider)* 5 | * DFRobot-A great source for opensource hardware and robot. * 6 | * * 7 | * This file is part of the DFplayer_Mini_Mp3 library. * 8 | * * 9 | * DFPlayer_Mini_Mp3 is free software: you can redistribute it and/or * 10 | * modify it under the terms of the GNU Lesser General Public License as * 11 | * published by the Free Software Foundation, either version 3 of * 12 | * the License, or any later version. * 13 | * * 14 | * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 17 | * GNU Lesser General Public License for more details. * 18 | * * 19 | * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 22 | * GNU Lesser General Public License for more details. * 23 | * * 24 | * You should have received a copy of the GNU Lesser General Public * 25 | * License along with DFPlayer_Mini_Mp3. If not, see * 26 | * . * 27 | * * 28 | ******************************************************************************/ 29 | 30 | /* 31 | * Copyright: DFRobot 32 | * name: DFPlayer_receive test code 33 | * Author: ciotto 34 | * Date: 2016-06-29 35 | * Description: Example of use of mp3 library for DFPlayer mini board 36 | * 37 | * this code read number of tracks in the SD card folders 01 - 02 and 38 | * random play one track 39 | * 40 | * The circuit: 41 | * * DFR0299 mp3 player attached to pins 19, 18 (serial), 6 (buzy) and power 42 | * * speaker attached to DFR0299 pin 6 and 8 43 | * 44 | * This code is based on CaprerAVR project 45 | */ 46 | 47 | #include 48 | #include 49 | 50 | // costants 51 | const int busyPin = 6; // Arduino pin wired to DFR0299 16 pin 52 | const int volume = 20; // the volume level 53 | const int foldersCount = 2; // the volume level 54 | 55 | // variables 56 | int tracks[foldersCount] = {0, 0}; // tracks in microSD 57 | 58 | void setup() { 59 | // Init serial 60 | Serial1.begin (9600); 61 | Serial.begin (9600); 62 | while (!Serial); 63 | 64 | // Set Serial for DFPlayer-mini mp3 module 65 | mp3_set_serial(Serial1); 66 | // Set logging Serial 67 | mp3_set_debug_serial(Serial); 68 | // Set volume (value 0~30) 69 | mp3_set_volume(volume); 70 | // Set device to microSD 71 | mp3_set_device(2); 72 | 73 | for (int i=0; i < foldersCount; i++) { 74 | // Query the total number of microSD card files 75 | mp3_get_folder_sum(i + 1); 76 | tracks[i] = mp3_wait_folder_sum(); 77 | 78 | Serial.print("Find "); 79 | Serial.print(tracks[i]); 80 | Serial.print(" tracks in folder 0"); 81 | Serial.print(i); 82 | Serial.println("."); 83 | } 84 | } 85 | 86 | void loop() { 87 | // Read buzy state 88 | int busyState = digitalRead(busyPin); 89 | 90 | // check if the DFR0299 is not buzy. 91 | if (busyState == 1) { 92 | // Play random file in random folder 93 | int folder = random(1, foldersCount + 1); 94 | int track = random(1, tracks[folder - 1] + 1); 95 | 96 | mp3_play_file_in_folder(folder, track); 97 | 98 | Serial.print("Play track "); 99 | Serial.print(track); 100 | Serial.print(" in folder "); 101 | Serial.println(folder); 102 | } 103 | 104 | delay(500); 105 | } 106 | 107 | -------------------------------------------------------------------------------- /DFPlayer_Mini_Mp3/DFPlayer_Mini_Mp3.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2014 DFRobot * 3 | * * 4 | * DFPlayer_Mini_Mp3, This library provides a quite complete function for * 5 | * DFPlayer mini mp3 module. * 6 | * www.github.com/dfrobot/DFPlayer_Mini_Mp3 (github as default source provider)* 7 | * DFRobot-A great source for opensource hardware and robot. * 8 | * * 9 | * This file is part of the DFplayer_Mini_Mp3 library. * 10 | * * 11 | * DFPlayer_Mini_Mp3 is free software: you can redistribute it and/or * 12 | * modify it under the terms of the GNU Lesser General Public License as * 13 | * published by the Free Software Foundation, either version 3 of * 14 | * the License, or any later version. * 15 | * * 16 | * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU Lesser General Public License for more details. * 20 | * * 21 | * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 24 | * GNU Lesser General Public License for more details. * 25 | * * 26 | * You should have received a copy of the GNU Lesser General Public * 27 | * License along with DFPlayer_Mini_Mp3. If not, see * 28 | * . * 29 | * * 30 | ******************************************************************************/ 31 | 32 | /* 33 | * name: DFPlayer_Mini_Mp3 34 | * version: 1.0 35 | * Author: lisper 36 | * Date: 2014-05-22 37 | * official website: http://www.dfrobot.com 38 | * Products page: http://www.dfrobot.com/index.php?route=product/product&product_id=1121#.U5Z_RYbUN8E 39 | * Description: mp3 library for DFPlayer mini board 40 | * note: mp3 file must put into mp3 folder in your tf card 41 | */ 42 | #include "Arduino.h" 43 | #include "SoftwareSerial.h" 44 | 45 | uint8_t send_buf[10] = { 46 | 0x7E, 0xFF, 06, 00, 00, 00, 00, 00, 00, 0xEF}; 47 | uint8_t recv_buf[10]; 48 | 49 | //* void(*send_func)() = NULL; 50 | //* HardwareSerial *hserial = NULL; 51 | //* SoftwareSerial *sserial = NULL; 52 | //* boolean is_reply = false; 53 | 54 | // 7E FF 06 0F 00 01 01 xx xx EF 55 | // 0 -> 7E is start code 56 | // 1 -> FF is version 57 | // 2 -> 06 is length 58 | // 3 -> 0F is command 59 | // 4 -> 00 is no receive 60 | // 5~6 -> 01 01 is argument 61 | // 7~8 -> checksum = 0 - ( FF+06+0F+00+01+01 ) 62 | // 9 -> EF is end code 63 | 64 | void mp3_set_reply (boolean state); 65 | 66 | void mp3_fill_cmd (uint8_t cmd, uint16_t arg); 67 | void mp3_fill_cmd (uint8_t cmd); 68 | 69 | // 70 | //void fill_uint16_bigend (uint8_t *thebuf, uint16_t data); 71 | 72 | //error because it is biggend mode in mp3 module 73 | //void fill_uint16 (uint8_t *thebuf, uint16_t data) { 74 | // *(uint16_t*)(thebuf) = data; 75 | //} 76 | 77 | // 78 | void mp3_set_serial (HardwareSerial &theSerial); 79 | 80 | // 81 | void mp3_set_serial (SoftwareSerial &theSerial); 82 | 83 | // Set the serial port used for logging 84 | void mp3_set_debug_serial (HardwareSerial &theSerial); 85 | 86 | // 87 | //void h_send_func (); 88 | 89 | // 90 | //void s_send_func (); 91 | 92 | // 93 | //void mp3_send_cmd (uint8_t cmd, uint16_t high_arg, uint16_t low_arg); 94 | 95 | // 96 | //void mp3_send_cmd (uint8_t cmd, uint16_t low_arg); 97 | 98 | // 99 | //void mp3_send_cmd (uint8_t cmd); 100 | 101 | // Send byte1 (0-15) as first byte of high and byte234 (0 - 4095) splitted in high byte 2 and low 102 | //void mp3_send_cmd (uint8_t cmd, uint8_t byte1, uint32_t byte234) 103 | 104 | // Reset buffer 105 | //void reset_recv_buf (); 106 | 107 | // Read data from hardware serial 108 | //boolean h_recv_func (); 109 | 110 | // Read data from software serial 111 | //boolean s_recv_func (); 112 | 113 | // Wait and receive replay for specific command 114 | //uint8_t* mp3_recv_cmd (uint8_t wait); 115 | 116 | // Receive replay 117 | //uint8_t* mp3_recv_cmd (); 118 | 119 | // Wait and receive replay as int for specific command 120 | //int mp3_recv_int_cmd (int wait); 121 | 122 | // Receive replay as int 123 | //int mp3_recv_int_cmd (); 124 | 125 | // 126 | uint16_t mp3_get_checksum (uint8_t *thebuf); 127 | 128 | // 129 | void mp3_fill_checksum (); 130 | 131 | // 132 | void mp3_play_physical (uint16_t num); 133 | void mp3_play_physical (); 134 | 135 | // 136 | void mp3_next (); 137 | 138 | // 139 | void mp3_prev (); 140 | 141 | //0x06 set volume 0-30 142 | void mp3_set_volume (uint16_t volume); 143 | 144 | //0x07 set EQ0/1/2/3/4/5 Normal/Pop/Rock/Jazz/Classic/Bass 145 | void mp3_set_EQ (uint16_t eq); 146 | 147 | //0x09 set device 1/2/3/4/5 U/SD/AUX/SLEEP/FLASH 148 | void mp3_set_device (uint16_t device); 149 | 150 | // 151 | void mp3_sleep (); 152 | 153 | // 154 | void mp3_reset (); 155 | 156 | // 157 | void mp3_pause (); 158 | 159 | // 160 | void mp3_stop (); 161 | 162 | // 163 | void mp3_play (); 164 | 165 | //specify a mp3 file in mp3 folder in your tf card, "mp3_play (1);" mean play "mp3/0001.mp3" 166 | void mp3_play (uint16_t num); 167 | 168 | // 169 | void mp3_get_state (); 170 | // Wait for mp3_get_state reply 171 | int mp3_wait_state (); 172 | 173 | // 174 | void mp3_get_volume (); 175 | // Wait for mp3_get_volume reply 176 | int mp3_wait_volume (); 177 | 178 | // 179 | void mp3_get_u_sum (); 180 | // Wait for mp3_get_u_sum reply 181 | int mp3_wait_u_sum (); 182 | 183 | // 184 | void mp3_get_tf_sum (); 185 | // Wait for mp3_get_tf_sum reply 186 | int mp3_wait_tf_sum (); 187 | 188 | // 189 | void mp3_get_flash_sum (); 190 | // Wait for mp3_get_flash_sum reply 191 | int mp3_wait_flash_sum (); 192 | 193 | // 194 | void mp3_get_tf_current (); 195 | // Wait for mp3_get_tf_current reply 196 | int mp3_wait_tf_current(); 197 | 198 | // 199 | void mp3_get_u_current (); 200 | // Wait for mp3_get_u_current reply 201 | int mp3_wait_u_current (); 202 | 203 | // 204 | void mp3_get_flash_current (); 205 | // Wait for mp3_get_flash_current reply 206 | int mp3_wait_flash_current (); 207 | 208 | //set single loop 209 | void mp3_single_loop (boolean state); 210 | 211 | void mp3_single_play (uint16_t num); 212 | 213 | // 214 | void mp3_DAC (boolean state); 215 | 216 | // 217 | void mp3_random_play (); 218 | 219 | // Query total file numbers of a folder 220 | void mp3_get_folder_sum (uint16_t folder); 221 | // Wait for mp3_get_folder_sum reply 222 | int mp3_wait_folder_sum (); 223 | 224 | // Play mp3 file in selected folder 225 | void mp3_play_file_in_folder (uint8_t folder, uint32_t num); 226 | -------------------------------------------------------------------------------- /DFPlayer_Mini_Mp3/examples/DFPlayer_Mini_Test/DFPlayer_Mini_Test.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * DFPlayer_Mini_Mp3, This library provides a quite complete function for * 3 | * DFPlayer mini mp3 module. * 4 | * www.github.com/dfrobot/DFPlayer_Mini_Mp3 (github as default source provider)* 5 | * DFRobot-A great source for opensource hardware and robot. * 6 | * * 7 | * This file is part of the DFplayer_Mini_Mp3 library. * 8 | * * 9 | * DFPlayer_Mini_Mp3 is free software: you can redistribute it and/or * 10 | * modify it under the terms of the GNU Lesser General Public License as * 11 | * published by the Free Software Foundation, either version 3 of * 12 | * the License, or any later version. * 13 | * * 14 | * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 17 | * GNU Lesser General Public License for more details. * 18 | * * 19 | * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 22 | * GNU Lesser General Public License for more details. * 23 | * * 24 | * You should have received a copy of the GNU Lesser General Public * 25 | * License along with DFPlayer_Mini_Mp3. If not, see * 26 | * . * 27 | * * 28 | ******************************************************************************/ 29 | 30 | /* 31 | * Copyright: DFRobot 32 | * name: DFPlayer_Mini_Mp3 test code 33 | * Author: lisper 34 | * Date: 2014-05-22 35 | * Description: mp3 library for DFPlayer mini board 36 | * 37 | * this code is test on leonardo 38 | * you can try input: 39 | * play //play current music 40 | * play 3 //play mp3/0003.mp3 41 | * next //play next 42 | * prev //paly previous 43 | * pause //pause current play 44 | * stop //stop current play 45 | * state //get current state of module 46 | * current //get current track of tf card 47 | * volume //get current volume 48 | * volume 20 //set volume to 20 (0~30) 49 | * single open/close //set single loop open or close 50 | * reply open/close //set if need reply 51 | */ 52 | 53 | #include 54 | #include 55 | 56 | #include "DFPlayer_Mini_Mp3.h" 57 | 58 | #define BUFSIZE 20 //buf size 59 | #define CMDNUM 8 //cmdbuf size 60 | 61 | uint8_t buf[BUFSIZE]; //data buffer for read from Serial 62 | char *cmdbuf[CMDNUM]; //for split string from buf 63 | 64 | // 65 | void setup () { 66 | Serial1.begin (9600); 67 | Serial.begin (9600); 68 | while (!Serial); 69 | 70 | mp3_set_serial (Serial1); //set Serial1 for DFPlayer-mini mp3 module 71 | mp3_set_volume (15); 72 | mp3_get_tf_sum (); 73 | print_info (); 74 | } 75 | 76 | void print_info () { 77 | Serial.println ("you send:"); 78 | printHex (send_buf, 10); 79 | delay (100); 80 | int recv_leng = serialRead (Serial1, recv_buf, 10, 3); 81 | if (recv_leng) { 82 | Serial.println ("you get:"); 83 | printHex (recv_buf, recv_leng); 84 | } 85 | } 86 | 87 | // 88 | void loop () { 89 | int leng; 90 | leng = serialRead (Serial1, buf, BUFSIZE, 3); //first read data from Serial1 91 | if (leng) { 92 | Serial.print ("=>"); 93 | printHex (buf, leng); 94 | } 95 | leng = serialRead (Serial, buf, BUFSIZE, 3); //read command to buf from Serial (PC) 96 | if (leng) { 97 | buf[leng] = '\0'; 98 | Serial.println ((char*)buf); 99 | int cmdleng = split(cmdbuf, (char*)buf, 8); //split command string to cmdbuf 100 | if (cmdleng >= 1) { 101 | if (strcmp (cmdbuf[0], "next") == 0) { 102 | mp3_next (); 103 | print_info (); 104 | } 105 | else if (strcmp (cmdbuf[0], "physical") == 0) { 106 | if (cmdleng == 2) { 107 | mp3_play_physical (atoi (cmdbuf[1])); //get arguments 108 | } else { 109 | mp3_play_physical (); 110 | } 111 | print_info (); 112 | } 113 | else if (strcmp (cmdbuf[0], "prev") == 0) { 114 | mp3_prev (); 115 | print_info (); 116 | } 117 | else if (strcmp (cmdbuf[0], "stop") == 0) { 118 | mp3_stop (); 119 | print_info (); 120 | } 121 | else if (strcmp (cmdbuf[0], "pause") == 0) { 122 | mp3_pause (); 123 | print_info (); 124 | } 125 | else if (strcmp (cmdbuf[0], "state") == 0) { 126 | mp3_get_state (); 127 | print_info (); 128 | } 129 | else if (strcmp (cmdbuf[0], "sum") == 0) { 130 | mp3_get_tf_sum (); 131 | print_info (); 132 | } 133 | else if (strcmp (cmdbuf[0], "current") == 0) { 134 | mp3_get_tf_current (); 135 | print_info (); 136 | } 137 | else if (strcmp (cmdbuf[0], "volume") == 0) { 138 | if (cmdleng == 2) { 139 | mp3_set_volume (atoi (cmdbuf[1])); 140 | } else { 141 | mp3_get_volume (); 142 | } 143 | print_info (); 144 | } 145 | else if (strcmp (cmdbuf[0], "reply") == 0 && cmdleng == 2) { 146 | if (strcmp (cmdbuf[1], "open") == 0) 147 | mp3_set_reply (true); 148 | else if (strcmp (cmdbuf[1], "close") == 0) 149 | mp3_set_reply (false); 150 | print_info (); 151 | } 152 | else if (strcmp (cmdbuf[0], "play") == 0 && cmdleng == 2) { 153 | if (cmdleng == 2) { 154 | mp3_play (atoi (cmdbuf[1])); 155 | } else { 156 | mp3_play (); 157 | } 158 | print_info (); 159 | } 160 | else if (strcmp (cmdbuf[0], "eq") == 0 && cmdleng == 2) { 161 | mp3_set_EQ (atoi (cmdbuf[1])); 162 | print_info (); 163 | } 164 | else if (strcmp (cmdbuf[0], "single") == 0 && cmdleng == 2) { 165 | if (strcmp (cmdbuf[1], "open") == 0) 166 | mp3_single_loop (true); 167 | else if (strcmp (cmdbuf[1], "close") == 0) 168 | mp3_single_loop (false); 169 | print_info (); 170 | } else { 171 | Serial.println ("error! no this command"); 172 | } 173 | } 174 | } 175 | } 176 | 177 | 178 | -------------------------------------------------------------------------------- /DFPlayer_Mini_Mp3/license.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /DFPlayer_Mini_Mp3/DFPlayer_Mini_Mp3.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2014 DFRobot * 3 | * * 4 | * DFPlayer_Mini_Mp3, This library provides a quite complete function for * 5 | * DFPlayer mini mp3 module. * 6 | * www.github.com/dfrobot/DFPlayer_Mini_Mp3 (github as default source provider)* 7 | * DFRobot-A great source for opensource hardware and robot. * 8 | * * 9 | * This file is part of the DFplayer_Mini_Mp3 library. * 10 | * * 11 | * DFPlayer_Mini_Mp3 is free software: you can redistribute it and/or * 12 | * modify it under the terms of the GNU Lesser General Public License as * 13 | * published by the Free Software Foundation, either version 3 of * 14 | * the License, or any later version. * 15 | * * 16 | * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU Lesser General Public License for more details. * 20 | * * 21 | * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 24 | * GNU Lesser General Public License for more details. * 25 | * * 26 | * You should have received a copy of the GNU Lesser General Public * 27 | * License along with DFPlayer_Mini_Mp3. If not, see * 28 | * . * 29 | ******************************************************************************/ 30 | 31 | /* 32 | * name: DFPlayer_Mini_Mp3 33 | * version: 1.0 34 | * Author: lisper 35 | * Date: 2014-05-22 36 | * Description: mp3 library for DFPlayer mini board 37 | * note: mp3 file must put into mp3 folder in your tf card 38 | */ 39 | 40 | 41 | #include 42 | #include 43 | //#include "DFPlayer_Mini_Mp3.h" 44 | 45 | extern uint8_t send_buf[10]; 46 | extern uint8_t recv_buf[10]; 47 | 48 | unsigned long _last_call = 0; 49 | 50 | static void(*send_func)() = NULL; 51 | static boolean(*recv_func)() = NULL; 52 | static HardwareSerial * _hardware_serial = NULL; 53 | static SoftwareSerial * _software_serial = NULL; 54 | static HardwareSerial * _debug_serial = NULL; 55 | static boolean is_reply = false; 56 | 57 | // 58 | void mp3_set_reply (boolean state) { 59 | is_reply = state; 60 | send_buf[4] = is_reply; 61 | } 62 | 63 | // 64 | static void fill_uint16_bigend (uint8_t *thebuf, uint16_t data) { 65 | *thebuf = (uint8_t)(data>>8); 66 | *(thebuf+1) = (uint8_t)data; 67 | } 68 | 69 | 70 | //calc checksum (1~6 byte) 71 | uint16_t mp3_get_checksum (uint8_t *thebuf) { 72 | uint16_t sum = 0; 73 | for (int i=1; i<7; i++) { 74 | sum += thebuf[i]; 75 | } 76 | return -sum; 77 | } 78 | 79 | //fill checksum to send_buf (7~8 byte) 80 | void mp3_fill_checksum () { 81 | uint16_t checksum = mp3_get_checksum (send_buf); 82 | fill_uint16_bigend (send_buf+7, checksum); 83 | } 84 | 85 | // 86 | void h_send_func () { 87 | for (int i=0; i<10; i++) { 88 | _hardware_serial->write (send_buf[i]); 89 | } 90 | } 91 | 92 | // 93 | void s_send_func () { 94 | for (int i=0; i<10; i++) { 95 | _software_serial->write (send_buf[i]); 96 | } 97 | } 98 | 99 | // Reset buffer 100 | void reset_recv_buf () { 101 | for (int i=0; i<10; i++) { 102 | recv_buf[i] = 0; 103 | } 104 | } 105 | 106 | // Read data from hardware serial 107 | boolean h_recv_func () { 108 | reset_recv_buf(); 109 | 110 | for (int i=0; i<10; i++) { 111 | int b = _hardware_serial->read (); 112 | if (b == -1) { 113 | return false; 114 | } 115 | recv_buf[i] = b; 116 | } 117 | 118 | return true; 119 | } 120 | 121 | // Read data from software serial 122 | boolean s_recv_func () { 123 | delay(5); 124 | 125 | reset_recv_buf(); 126 | 127 | if (_software_serial->available () < 10) { 128 | return false; 129 | } 130 | for (int i=0; i<10; i++) { 131 | int b = _software_serial->read (); 132 | if (b == -1) { 133 | return false; 134 | } 135 | recv_buf[i] = b; 136 | } 137 | 138 | return true; 139 | } 140 | 141 | // 142 | //void mp3_set_serial (HardwareSerial *theSerial) { 143 | void mp3_set_serial (HardwareSerial &theSerial) { 144 | _hardware_serial = &theSerial; 145 | send_func = h_send_func; 146 | recv_func = h_recv_func; 147 | } 148 | 149 | // 150 | void mp3_set_serial (SoftwareSerial &theSerial) { 151 | _software_serial = &theSerial; 152 | send_func = s_send_func; 153 | recv_func = s_recv_func; 154 | } 155 | 156 | // Set the serial port used for logging 157 | void mp3_set_debug_serial (HardwareSerial &theSerial) { 158 | _debug_serial = &theSerial; 159 | } 160 | 161 | // 162 | void mp3_send_cmd (uint8_t cmd, uint16_t high_arg, uint16_t low_arg) { 163 | unsigned long d = abs(millis() - _last_call); 164 | if (d < 50) { 165 | delay(50 - d); 166 | } 167 | 168 | send_buf[3] = cmd; 169 | 170 | send_buf[5] = high_arg; 171 | send_buf[6] = low_arg; 172 | 173 | mp3_fill_checksum (); 174 | send_func (); 175 | 176 | _last_call = millis(); 177 | } 178 | 179 | // 180 | void mp3_send_cmd (uint8_t cmd, uint16_t low_arg) { 181 | mp3_send_cmd(cmd, 0, low_arg); 182 | } 183 | 184 | // 185 | void mp3_send_cmd (uint8_t cmd) { 186 | mp3_send_cmd(cmd, 0, 0); 187 | } 188 | 189 | // Send byte1 (0-15) as first byte of high and byte234 (0 - 4095) splitted in high byte 2 and low 190 | void mp3_send_cmd (uint8_t cmd, uint8_t byte1, uint32_t byte234) { 191 | uint16_t low = byte234 & 0x00FF; 192 | uint16_t high = (byte1 << 4) | (byte234 >> 8); 193 | 194 | mp3_send_cmd (cmd, high, low); 195 | } 196 | 197 | // Wait and receive replay for specific command 198 | uint8_t* mp3_recv_cmd (uint8_t wait) { 199 | uint8_t static result[2] = {0, 0}; 200 | uint8_t received = 0; 201 | 202 | do { 203 | boolean read = recv_func(); 204 | 205 | if (read) { 206 | received = recv_buf[3]; 207 | 208 | if (received == 0x40) { 209 | // Error responce 210 | (* _debug_serial).print("Error responce with code "); 211 | (* _debug_serial).println(recv_buf[6]); 212 | }else if (wait != 0 && wait == received) { 213 | result[0] = recv_buf[5]; 214 | result[1] = recv_buf[6]; 215 | } 216 | } else { 217 | delay(50); 218 | } 219 | } while (wait != 0 && wait != received); 220 | 221 | return result; 222 | } 223 | 224 | // Receive replay 225 | uint8_t* mp3_recv_cmd () { 226 | return mp3_recv_cmd(0); 227 | } 228 | 229 | // Wait and receive replay as int for specific command 230 | int mp3_recv_int_cmd (int wait) { 231 | int res = 0; 232 | uint8_t* result = mp3_recv_cmd(wait); 233 | 234 | res = (unsigned char)result[0]; 235 | res = res * 0xFF + (unsigned char)result[1]; 236 | 237 | return res; 238 | } 239 | 240 | // Receive replay as int 241 | int mp3_recv_int_cmd () { 242 | return mp3_recv_int_cmd(0); 243 | } 244 | 245 | 246 | // 247 | void mp3_play_physical (uint16_t num) { 248 | mp3_send_cmd (0x03, num); 249 | } 250 | 251 | // 252 | void mp3_play_physical () { 253 | mp3_send_cmd (0x03); 254 | } 255 | 256 | // 257 | void mp3_next () { 258 | mp3_send_cmd (0x01); 259 | } 260 | 261 | // 262 | void mp3_prev () { 263 | mp3_send_cmd (0x02); 264 | } 265 | 266 | //0x06 set volume 0-30 267 | void mp3_set_volume (uint16_t volume) { 268 | mp3_send_cmd (0x06, volume); 269 | } 270 | 271 | //0x07 set EQ0/1/2/3/4/5 Normal/Pop/Rock/Jazz/Classic/Bass 272 | void mp3_set_EQ (uint16_t eq) { 273 | mp3_send_cmd (0x07, eq); 274 | } 275 | 276 | //0x09 set device 1/2/3/4/5 U/SD/AUX/SLEEP/FLASH 277 | void mp3_set_device (uint16_t device) { 278 | mp3_send_cmd (0x09, device); 279 | } 280 | 281 | // 282 | void mp3_sleep () { 283 | mp3_send_cmd (0x0a); 284 | } 285 | 286 | // 287 | void mp3_reset () { 288 | mp3_send_cmd (0x0c); 289 | } 290 | 291 | // 292 | void mp3_play () { 293 | mp3_send_cmd (0x0d); 294 | } 295 | 296 | // 297 | void mp3_pause () { 298 | mp3_send_cmd (0x0e); 299 | } 300 | 301 | // 302 | void mp3_stop () { 303 | mp3_send_cmd (0x16); 304 | } 305 | 306 | //play mp3 file in mp3 folder in your tf card 307 | void mp3_play (uint16_t num) { 308 | mp3_send_cmd (0x12, num); 309 | } 310 | 311 | // 312 | void mp3_get_state () { 313 | mp3_send_cmd (0x42); 314 | } 315 | // Wait for mp3_get_state reply 316 | int mp3_wait_state () { 317 | return mp3_recv_int_cmd(0x42); 318 | } 319 | 320 | // 321 | void mp3_get_volume () { 322 | mp3_send_cmd (0x43); 323 | } 324 | // Wait for mp3_get_volume reply 325 | int mp3_wait_volume () { 326 | return mp3_recv_int_cmd(0x43); 327 | } 328 | 329 | // 330 | void mp3_get_u_sum () { 331 | mp3_send_cmd (0x47); 332 | } 333 | // Wait for mp3_get_u_sum reply 334 | int mp3_wait_u_sum () { 335 | return mp3_recv_int_cmd(0x47); 336 | } 337 | 338 | // 339 | void mp3_get_tf_sum () { 340 | mp3_send_cmd (0x48); 341 | } 342 | // Wait for mp3_get_tf_sum reply 343 | int mp3_wait_tf_sum () { 344 | return mp3_recv_int_cmd(0x48); 345 | } 346 | 347 | // 348 | void mp3_get_flash_sum () { 349 | mp3_send_cmd (0x49); 350 | } 351 | // Wait for mp3_get_flash_sum reply 352 | int mp3_wait_flash_sum () { 353 | return mp3_recv_int_cmd(0x49); 354 | } 355 | 356 | // 357 | void mp3_get_tf_current () { 358 | mp3_send_cmd (0x4c); 359 | } 360 | // Wait for mp3_get_tf_current reply 361 | int mp3_wait_tf_current () { 362 | return mp3_recv_int_cmd(0x4c); 363 | } 364 | 365 | // 366 | void mp3_get_u_current () { 367 | mp3_send_cmd (0x4b); 368 | } 369 | // Wait for mp3_get_u_current reply 370 | int mp3_wait_u_current() { 371 | return mp3_recv_int_cmd(0x4b); 372 | } 373 | 374 | // 375 | void mp3_get_flash_current () { 376 | mp3_send_cmd (0x4d); 377 | } 378 | // Wait for mp3_get_flash_current reply 379 | int mp3_wait_flash_current () { 380 | return mp3_recv_int_cmd(0x4d); 381 | } 382 | 383 | // 384 | void mp3_single_loop (boolean state) { 385 | mp3_send_cmd (0x19, !state); 386 | } 387 | 388 | //add 389 | void mp3_single_play (uint16_t num) { 390 | mp3_play (num); 391 | delay (10); 392 | mp3_single_loop (true); 393 | //mp3_send_cmd (0x19, !state); 394 | } 395 | 396 | // 397 | void mp3_DAC (boolean state) { 398 | mp3_send_cmd (0x1a, !state); 399 | } 400 | 401 | // 402 | void mp3_random_play () { 403 | mp3_send_cmd (0x18); 404 | } 405 | 406 | // Query total file numbers of a folder 407 | void mp3_get_folder_sum (uint16_t folder) { 408 | mp3_send_cmd (0x4E, folder); 409 | } 410 | // Wait for mp3_get_folder_sum reply 411 | int mp3_wait_folder_sum () { 412 | return mp3_recv_int_cmd(0x4E); 413 | } 414 | 415 | // Play mp3 file in selected folder 416 | void mp3_play_file_in_folder (uint8_t folder, uint32_t num) { 417 | mp3_send_cmd (0x14, folder, num); 418 | } 419 | 420 | --------------------------------------------------------------------------------