DFPlayerMini_Fast
|
Class for interacting with DFPlayerMini MP3 player. More...
#include <DFPlayerMini_Fast.h>
Classes | |
struct | stack |
Public Member Functions | |
bool | begin (Stream &stream, bool debug=false, unsigned long threshold=100) |
Configure the class. More... | |
void | playNext () |
Play the next song in chronological order. | |
void | playPrevious () |
Play the previous song in chronological order. | |
void | play (uint16_t trackNum) |
Play a specific track. More... | |
void | stop () |
Stop the current playback. | |
void | playFromMP3Folder (uint16_t trackNum) |
Play a specific track in the folder named "MP3". More... | |
void | playAdvertisement (uint16_t trackNum) |
Interrupt the current track with a new track. More... | |
void | stopAdvertisement () |
Stop the interrupting track. | |
void | incVolume () |
Increment the volume by 1 out of 30. | |
void | decVolume () |
Decrement the volume by 1 out of 30. | |
void | volume (uint8_t volume) |
Set the volume to a specific value out of 30. More... | |
void | EQSelect (uint8_t setting) |
Set the EQ mode. More... | |
void | loop (uint16_t trackNum) |
Loop a specific track. More... | |
void | playbackSource (uint8_t source) |
Specify the playback source. More... | |
void | standbyMode () |
Put the MP3 player in standby mode (this is NOT sleep mode). | |
void | normalMode () |
Pull the MP3 player out of standby mode. | |
void | reset () |
Reset all settings to factory default. | |
void | resume () |
Resume playing current track. | |
void | pause () |
Pause playing current track. | |
void | playFolder (uint8_t folderNum, uint8_t trackNum) |
Play a specific track from a specific folder. More... | |
void | volumeAdjustSet (uint8_t gain) |
Specify volume gain. More... | |
void | startRepeatPlay () |
Play all tracks. | |
void | stopRepeatPlay () |
Stop repeat play. | |
void | repeatFolder (uint16_t folder) |
Play all tracks in a given folder. More... | |
void | randomAll () |
Play all tracks in a random order. | |
void | startRepeat () |
Repeat the current track. | |
void | stopRepeat () |
Stop repeat play of the current track. | |
void | startDAC () |
Turn on DAC. | |
void | stopDAC () |
Turn off DAC. | |
void | sleep () |
Put the MP3 player into sleep mode. | |
void | wakeUp () |
Pull the MP3 player out of sleep mode. | |
bool | isPlaying () |
Determine if a track is currently playing. More... | |
int16_t | currentVolume () |
Determine the current volume setting. More... | |
int16_t | currentEQ () |
Determine the current EQ setting. More... | |
int16_t | currentMode () |
Determine the current mode. More... | |
int16_t | currentVersion () |
Determine the current firmware version. More... | |
int16_t | numUsbTracks () |
Determine the number of tracks accessible via USB. More... | |
int16_t | numSdTracks () |
Determine the number of tracks accessible via SD card. More... | |
int16_t | numFlashTracks () |
Determine the number of tracks accessible via flash. More... | |
int16_t | currentUsbTrack () |
Determine the current track played via USB. More... | |
int16_t | currentSdTrack () |
Determine the current track played via SD card. More... | |
int16_t | currentFlashTrack () |
Determine the current track played via flash. More... | |
int16_t | numTracksInFolder (uint8_t folder) |
Determine the number of tracks in the specified folder. More... | |
int16_t | numFolders () |
Determine the number of folders available. More... | |
void | setTimeout (unsigned long threshold) |
Set the timout value for MP3 player query responses. More... | |
void | findChecksum (stack &_stack) |
Determine and insert the checksum of a given config/command packet into that same packet struct. More... | |
void | sendData () |
Send a config/command packet to the MP3 player. | |
void | flush () |
Clear out the serial input buffer connected to the MP3 player. | |
int16_t | query (uint8_t cmd, uint8_t msb=0, uint8_t lsb=0) |
Query the MP3 player for specific information. More... | |
bool | parseFeedback () |
Parse MP3 player query responses. More... | |
void | printStack (stack _stack) |
Print the entire contents of the specified config/command packet for debugging purposes. More... | |
void | printError () |
Print the error description if an error has been received. | |
Public Attributes | |
Stream * | _serial |
struct DFPlayerMini_Fast::stack | sendStack |
struct DFPlayerMini_Fast::stack | recStack |
bool | _debug |
Class for interacting with DFPlayerMini MP3 player.
bool DFPlayerMini_Fast::begin | ( | Stream & | stream, |
bool | debug = false , |
||
unsigned long | threshold = 100 |
||
) |
Configure the class.
stream | A reference to the Serial instance (hardware or software) used to communicate with the MP3 player. |
debug | Boolean used to specify if debug prints should be automatically printed to the serial monitor. |
threshold | Number of ms allowed for the MP3 player to respond (timeout) to a query. |
void DFPlayerMini_Fast::play | ( | uint16_t | trackNum | ) |
Play a specific track.
trackNum | The track number to play. |
void DFPlayerMini_Fast::playFromMP3Folder | ( | uint16_t | trackNum | ) |
Play a specific track in the folder named "MP3".
trackNum | The track number to play. |
void DFPlayerMini_Fast::playAdvertisement | ( | uint16_t | trackNum | ) |
Interrupt the current track with a new track.
trackNum | The track number to play. |
void DFPlayerMini_Fast::volume | ( | uint8_t | volume | ) |
Set the volume to a specific value out of 30.
volume | The volume level (0 - 30). |
void DFPlayerMini_Fast::EQSelect | ( | uint8_t | setting | ) |
Set the EQ mode.
setting | The desired EQ ID. |
void DFPlayerMini_Fast::loop | ( | uint16_t | trackNum | ) |
Loop a specific track.
trackNum | The track number to play. |
void DFPlayerMini_Fast::playbackSource | ( | uint8_t | source | ) |
Specify the playback source.
source | The playback source ID. |
void DFPlayerMini_Fast::playFolder | ( | uint8_t | folderNum, |
uint8_t | trackNum | ||
) |
Play a specific track from a specific folder.
folderNum | The folder number. |
trackNum | The track number to play. |
void DFPlayerMini_Fast::volumeAdjustSet | ( | uint8_t | gain | ) |
Specify volume gain.
gain | The specified volume gain. |
void DFPlayerMini_Fast::repeatFolder | ( | uint16_t | folder | ) |
Play all tracks in a given folder.
folderNum | The folder number. |
bool DFPlayerMini_Fast::isPlaying | ( | ) |
Determine if a track is currently playing.
int16_t DFPlayerMini_Fast::currentVolume | ( | ) |
Determine the current volume setting.
int16_t DFPlayerMini_Fast::currentEQ | ( | ) |
Determine the current EQ setting.
int16_t DFPlayerMini_Fast::currentMode | ( | ) |
Determine the current mode.
int16_t DFPlayerMini_Fast::currentVersion | ( | ) |
Determine the current firmware version.
int16_t DFPlayerMini_Fast::numUsbTracks | ( | ) |
Determine the number of tracks accessible via USB.
int16_t DFPlayerMini_Fast::numSdTracks | ( | ) |
Determine the number of tracks accessible via SD card.
int16_t DFPlayerMini_Fast::numFlashTracks | ( | ) |
Determine the number of tracks accessible via flash.
int16_t DFPlayerMini_Fast::currentUsbTrack | ( | ) |
Determine the current track played via USB.
int16_t DFPlayerMini_Fast::currentSdTrack | ( | ) |
Determine the current track played via SD card.
int16_t DFPlayerMini_Fast::currentFlashTrack | ( | ) |
Determine the current track played via flash.
int16_t DFPlayerMini_Fast::numTracksInFolder | ( | uint8_t | folder | ) |
Determine the number of tracks in the specified folder.
folder | The folder number. |
int16_t DFPlayerMini_Fast::numFolders | ( | ) |
Determine the number of folders available.
void DFPlayerMini_Fast::setTimeout | ( | unsigned long | threshold | ) |
Set the timout value for MP3 player query responses.
threshold | Number of ms allowed for the MP3 player to respond (timeout) to a query. |
void DFPlayerMini_Fast::findChecksum | ( | stack & | _stack | ) |
Determine and insert the checksum of a given config/command packet into that same packet struct.
_stack | Reference to a struct containing the config/command packet to calculate the checksum over. |
int16_t DFPlayerMini_Fast::query | ( | uint8_t | cmd, |
uint8_t | msb = 0 , |
||
uint8_t | lsb = 0 |
||
) |
Query the MP3 player for specific information.
cmd | The command/query ID. |
msb | The payload/parameter MSB. |
lsb | The payload/parameter LSB. |
bool DFPlayerMini_Fast::parseFeedback | ( | ) |
Parse MP3 player query responses.
void DFPlayerMini_Fast::printStack | ( | stack | _stack | ) |
Print the entire contents of the specified config/command packet for debugging purposes.
_stack | Struct containing the config/command packet to print. |