DFPlayerMini Library porting from Arduino Library (www.github.com/dfrobot/DFPlayer_Mini_Mp3)
Dependents: pinball pinball-sensZero
DFPlayerMini.h
00001 /******************************************************************************* 00002 * Copyright (C) 2014 DFRobot * 00003 * * 00004 * DFPlayer_Mini_Mp3, This library provides a quite complete function for * 00005 * DFPlayer mini mp3 module. * 00006 * www.github.com/dfrobot/DFPlayer_Mini_Mp3 (github as default source provider)* 00007 * DFRobot-A great source for opensource hardware and robot. * 00008 * * 00009 * This file is part of the DFplayer_Mini_Mp3 library. * 00010 * * 00011 * DFPlayer_Mini_Mp3 is free software: you can redistribute it and/or * 00012 * modify it under the terms of the GNU Lesser General Public License as * 00013 * published by the Free Software Foundation, either version 3 of * 00014 * the License, or any later version. * 00015 * * 00016 * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00019 * GNU Lesser General Public License for more details. * 00020 * * 00021 * DFPlayer_Mini_Mp3 is distributed in the hope that it will be useful, * 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00024 * GNU Lesser General Public License for more details. * 00025 * * 00026 * You should have received a copy of the GNU Lesser General Public * 00027 * License along with DFPlayer_Mini_Mp3. If not, see * 00028 * <http://www.gnu.org/licenses/>. * 00029 ******************************************************************************/ 00030 00031 // =========================================================================== 00032 // DFPlayerMini.cpp 00033 // Nov 23 2016, kysiki 00034 // =========================================================================== 00035 // Just a simple library for DFPlayer Mini porting from DFPlayer library V2.0. 00036 // (https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299) 00037 #ifndef MBED_SHIFTREG_H 00038 #define MBED_DFPLAYERMINI_H 00039 #include "mbed.h" 00040 class DFPlayerMini { 00041 public: 00042 DFPlayerMini(PinName txPin, PinName rxPin); 00043 void mp3_set_reply (uint8_t state); 00044 void mp3_play_physical (uint16_t num); 00045 void mp3_play_physical (); 00046 void mp3_next (); 00047 void mp3_prev (); 00048 void mp3_set_volume (uint16_t volume); 00049 void mp3_set_EQ (uint16_t eq); 00050 void mp3_set_device (uint16_t device); 00051 void mp3_sleep (); 00052 void mp3_reset (); 00053 void mp3_play (); 00054 void mp3_pause (); 00055 void mp3_stop (); 00056 void mp3_play (uint16_t num); 00057 void mp3_get_state (); 00058 void mp3_get_volume (); 00059 void mp3_get_u_sum (); 00060 void mp3_get_tf_sum (); 00061 void mp3_get_flash_sum (); 00062 void mp3_get_tf_current (); 00063 void mp3_get_u_current (); 00064 void mp3_get_flash_current (); 00065 void mp3_single_loop (uint8_t state); 00066 void mp3_single_play (uint16_t num); 00067 void mp3_DAC (uint8_t state); 00068 void mp3_random_play (); 00069 00070 private: 00071 Serial mp3; 00072 uint8_t send_buf[10]; 00073 uint8_t recv_buf[10]; 00074 uint8_t is_reply; 00075 static void fill_uint16_bigend (uint8_t *thebuf, uint16_t data); 00076 uint16_t mp3_get_checksum (uint8_t *thebuf); 00077 void mp3_fill_checksum (); 00078 void send_func (); 00079 void mp3_send_cmd (uint8_t cmd, uint16_t arg); 00080 void mp3_send_cmd (uint8_t cmd); 00081 }; 00082 00083 #endif
Generated on Wed Jul 13 2022 08:10:31 by
1.7.2