Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: InvertedPendulum2017 Lib_DFPlayerMini
Lib_DFPlayerMini.h
00001 #ifndef __LIBRARY_DFPLAYER_MINI_H__ 00002 #define __LIBRARY_DFPLAYER_MINI_H__ 00003 00004 #include "mbed.h" 00005 #include "AsyncSerial.hpp" 00006 00007 #define DFPLAYER_STX (0x7E) 00008 #define DFPLAYER_ETX (0xEF) 00009 #define DFPLAYER_VER (0xFF) 00010 00011 // typedef definition 00012 typedef enum _DFPLAYERMINICOM{ 00013 DFPLAYER_NEXT = 0x01, 00014 DFPLAYER_PREV = 0x02, 00015 DFPLAYER_NUM = 0x03, 00016 DFPLAYER_VOL_PLUS = 0x04, 00017 DFPLAYER_VOL_MINUS = 0x05, 00018 DFPLAYER_VOL_SET = 0x06, 00019 DFPLAYER_EQ = 0x07, 00020 DFPLAYER_PLAYBACKMODE = 0x08, 00021 DFPLAYER_PLAYBACKSOURCE = 0x09, 00022 DFPLAYER_STANDBY = 0x0A, 00023 DFPLAYER_NORMAL = 0x0B, 00024 DFPLAYER_RESET = 0x0C, 00025 DFPLAYER_PLAYBACK = 0x0D, 00026 DFPLAYER_PAUSE = 0x0E, 00027 DFPLAYER_PLAYBACKFOLDER = 0x0F, 00028 DFPLAYER_VOLADJUSTSET = 0x10, 00029 DFPLAYER_REPEATPLAY = 0x11, 00030 DFPLAYER_STAY1 = 0x3C, 00031 DFPLAYER_STAY2 = 0x3D, 00032 DFPLAYER_STAY3 = 0x3E, 00033 DFPLAYER_INITIALIZE = 0x3F, 00034 DFPLAYER_ERROR = 0x40, 00035 DFPLAYER_REPLY = 0x41, 00036 DFPLAYER_CSTATUS = 0x42, 00037 DFPLAYER_CVOLUME = 0x43, 00038 DFPLAYER_CEQ = 0x44, 00039 DFPLAYER_CPLAYBACKMODE = 0x45, 00040 DFPLAYER_VERSION = 0x46, 00041 DFPLAYER_TFFILES = 0x47, 00042 DFPLAYER_UDISKFILES = 0x48, 00043 DFPLAYER_FLASHFILES = 0x49, 00044 DFPLAYER_KEEPON = 0x4A, 00045 DFPLAYER_CTFTRACK = 0x4B, 00046 DFPLAYER_CUDISKTRACK = 0x4C, 00047 DFPLAYER_CFLASHTRACK = 0x4D 00048 } DFPLAYERMINICOM; 00049 00050 typedef void (*BUSYFUNCPTR)(void); 00051 00052 class DFPlayerMini{ 00053 public: 00054 DFPlayerMini( PinName busy, PinName tx, PinName rx ); // constructor 00055 ~DFPlayerMini(); // destructor 00056 00057 void begin(); 00058 void attachBusyInterrupt( BUSYFUNCPTR func ); 00059 void playNext(); 00060 void playPrev(); 00061 void playNumber( uint16_t num ); 00062 void playFolder( uint8_t folder, uint8_t num ); 00063 void volumePlus(); 00064 void volumeMinus(); 00065 void volumeSet( uint8_t vol ); 00066 00067 private: 00068 InterruptIn _busy; 00069 AsyncSerial _serial; 00070 BUSYFUNCPTR _func; 00071 00072 void _send_command( DFPLAYERMINICOM com, uint8_t param1, uint8_t param2 ); 00073 }; 00074 00075 #endif
Generated on Sat Jul 16 2022 00:18:36 by
1.7.2