LCC Fusion Project 1.0
LCC Automation
Loading...
Searching...
No Matches
DFPlayerMini_Fast Class Reference

Class for interacting with DFPlayerMini MP3 player. More...

#include <DFPlayerMini_Fast.h>

Collaboration diagram for DFPlayerMini_Fast:

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 playLargeFolder (uint8_t folderNum, uint16_t trackNum)
 Play a specific track from a specific folder, where the track names are numbered 4 digit (e.g. 1234-mysong.mp3) and can be up to 3000. Only 15 folders ("01" to "15") are supported in this mode. 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.
 

Detailed Description

Class for interacting with DFPlayerMini MP3 player.

Definition at line 128 of file DFPlayerMini_Fast.h.

Member Function Documentation

◆ begin()

bool DFPlayerMini_Fast::begin ( Stream &  stream,
bool  debug = false,
unsigned long  threshold = 100 
)

Configure the class.

Parameters
streamA reference to the Serial instance (hardware or software) used to communicate with the MP3 player.
debugBoolean used to specify if debug prints should be automatically printed to the serial monitor.
thresholdNumber of ms allowed for the MP3 player to respond (timeout) to a query.
Returns
True.

Definition at line 55 of file DFPlayerMini_Fast.cpp.

Here is the caller graph for this function:

◆ currentEQ()

int16_t DFPlayerMini_Fast::currentEQ ( )

Determine the current EQ setting.

Returns
EQ setting, -1 if error.

Definition at line 733 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ currentFlashTrack()

int16_t DFPlayerMini_Fast::currentFlashTrack ( )

Determine the current track played via flash.

Returns
Current track played via flash, -1 if error.

Definition at line 845 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ currentMode()

int16_t DFPlayerMini_Fast::currentMode ( )

Determine the current mode.

Returns
Mode, -1 if error.

Definition at line 747 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ currentSdTrack()

int16_t DFPlayerMini_Fast::currentSdTrack ( )

Determine the current track played via SD card.

Returns
Current track played via SD card, -1 if error.

Definition at line 831 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ currentUsbTrack()

int16_t DFPlayerMini_Fast::currentUsbTrack ( )

Determine the current track played via USB.

Returns
Current track played via USB, -1 if error.

Definition at line 817 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ currentVersion()

int16_t DFPlayerMini_Fast::currentVersion ( )

Determine the current firmware version.

Returns
Firmware version, -1 if error.

Definition at line 761 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ currentVolume()

int16_t DFPlayerMini_Fast::currentVolume ( )

Determine the current volume setting.

Returns
Volume level (0-30), -1 if error.

Definition at line 719 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ EQSelect()

void DFPlayerMini_Fast::EQSelect ( uint8_t  setting)

Set the EQ mode.

Parameters
settingThe desired EQ ID.

Definition at line 288 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findChecksum()

void DFPlayerMini_Fast::findChecksum ( stack _stack)

Determine and insert the checksum of a given config/command packet into that same packet struct.

Parameters
_stackReference to a struct containing the config/command packet to calculate the checksum over.

Definition at line 908 of file DFPlayerMini_Fast.cpp.

Here is the caller graph for this function:

◆ isPlaying()

bool DFPlayerMini_Fast::isPlaying ( )

Determine if a track is currently playing.

Returns
True if a track is currently playing, false if not, -1 if error.

Definition at line 700 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loop()

void DFPlayerMini_Fast::loop ( uint16_t  trackNum)

Loop a specific track.

Parameters
trackNumThe track number to play.

Definition at line 312 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ numFlashTracks()

int16_t DFPlayerMini_Fast::numFlashTracks ( )

Determine the number of tracks accessible via flash.

Returns
Number of tracks accessible via flash, -1 if error.

Definition at line 803 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ numFolders()

int16_t DFPlayerMini_Fast::numFolders ( )

Determine the number of folders available.

Returns
Number of folders available, -1 if error.

Definition at line 875 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ numSdTracks()

int16_t DFPlayerMini_Fast::numSdTracks ( )

Determine the number of tracks accessible via SD card.

Returns
Number of tracks accessible via SD card, -1 if error.

Definition at line 789 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ numTracksInFolder()

int16_t DFPlayerMini_Fast::numTracksInFolder ( uint8_t  folder)

Determine the number of tracks in the specified folder.

Parameters
folderThe folder number.
Returns
Number of tracks in the specified folder, -1 if error.

Definition at line 861 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ numUsbTracks()

int16_t DFPlayerMini_Fast::numUsbTracks ( )

Determine the number of tracks accessible via USB.

Returns
Number of tracks accessible via USB, -1 if error.

Definition at line 775 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ parseFeedback()

bool DFPlayerMini_Fast::parseFeedback ( )

Parse MP3 player query responses.

Returns
True if success, false if error.

Definition at line 1003 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ play()

void DFPlayerMini_Fast::play ( uint16_t  trackNum)

Play a specific track.

Parameters
trackNumThe track number to play.

Definition at line 125 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ playAdvertisement()

void DFPlayerMini_Fast::playAdvertisement ( uint16_t  trackNum)

Interrupt the current track with a new track.

Parameters
trackNumThe track number to play.

Definition at line 186 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ playbackSource()

void DFPlayerMini_Fast::playbackSource ( uint8_t  source)

Specify the playback source.

Parameters
sourceThe playback source ID.

Definition at line 333 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ playFolder()

void DFPlayerMini_Fast::playFolder ( uint8_t  folderNum,
uint8_t  trackNum 
)

Play a specific track from a specific folder.

Parameters
folderNumThe folder number.
trackNumThe track number to play.

Definition at line 454 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ playFromMP3Folder()

void DFPlayerMini_Fast::playFromMP3Folder ( uint16_t  trackNum)

Play a specific track in the folder named "MP3".

Parameters
trackNumThe track number to play.

Definition at line 165 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ playLargeFolder()

void DFPlayerMini_Fast::playLargeFolder ( uint8_t  folderNum,
uint16_t  trackNum 
)

Play a specific track from a specific folder, where the track names are numbered 4 digit (e.g. 1234-mysong.mp3) and can be up to 3000. Only 15 folders ("01" to "15") are supported in this mode.

Parameters
folderNumThe folder number.
trackNumThe track number to play.

Definition at line 477 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ printStack()

void DFPlayerMini_Fast::printStack ( stack  _stack)

Print the entire contents of the specified config/command packet for debugging purposes.

Parameters
_stackStruct containing the config/command packet to print.

Definition at line 1190 of file DFPlayerMini_Fast.cpp.

Here is the caller graph for this function:

◆ query()

int16_t DFPlayerMini_Fast::query ( uint8_t  cmd,
uint8_t  msb = 0,
uint8_t  lsb = 0 
)

Query the MP3 player for specific information.

Parameters
cmdThe command/query ID.
msbThe payload/parameter MSB.
lsbThe payload/parameter LSB.
Returns
Query response, -1 if error.

Definition at line 974 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ repeatFolder()

void DFPlayerMini_Fast::repeatFolder ( uint16_t  folder)

Play all tracks in a given folder.

Parameters
folderNumThe folder number.

Definition at line 559 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

◆ setTimeout()

void DFPlayerMini_Fast::setTimeout ( unsigned long  threshold)

Set the timout value for MP3 player query responses.

Parameters
thresholdNumber of ms allowed for the MP3 player to respond (timeout) to a query.

Definition at line 891 of file DFPlayerMini_Fast.cpp.

◆ volume()

void DFPlayerMini_Fast::volume ( uint8_t  volume)

Set the volume to a specific value out of 30.

Parameters
volumeThe volume level (0 - 30).

Definition at line 264 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ volumeAdjustSet()

void DFPlayerMini_Fast::volumeAdjustSet ( uint8_t  gain)

Specify volume gain.

Parameters
gainThe specified volume gain.

Definition at line 497 of file DFPlayerMini_Fast.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: