DFPlayer Mini Device Driver. More...

Detailed Description

DFPlayer Mini Device Driver.

Author
Marian Buschsieweke maria.nosp@m.n.bu.nosp@m.schsi.nosp@m.ewek.nosp@m.e@ovg.nosp@m.u.de

Definition in file dfplayer.h.

#include <stdbool.h>
#include <stdint.h>
#include "dfplayer_params.h"
#include "dfplayer_types.h"
#include "dfplayer_implementation.h"
+ Include dependency graph for dfplayer.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DFPLAYER_WAIT_MS   (100U)
 The number of milliseconds to wait after receiving playback of file has completed before starting playback of the next file.
 

Functions

int dfplayer_init (dfplayer_t *dev, const dfplayer_params_t *params)
 Initialize a DFPlayer Mini device descriptor. More...
 
dfplayer_source_set_t dfplayer_get_sources (dfplayer_t *dev)
 Get the set of available playback sources of the given DFPlayer. More...
 
int dfplayer_set_callbacks (dfplayer_t *dev, dfplayer_cb_done_t cb_done, dfplayer_cb_src_t cb_src)
 Set/clear the event callbacks of the DFPlayer Mini. More...
 
static int dfplayer_next (dfplayer_t *dev)
 Start playing the next song in the currently used naming scheme. More...
 
static int dfplayer_prev (dfplayer_t *dev)
 Start playing the previous song in the currently used naming scheme. More...
 
int dfplayer_step (dfplayer_t *dev, int step)
 Step forward/backward following the currently used naming scheme. More...
 
static int dfplayer_set_volume (dfplayer_t *dev, uint8_t volume)
 Sets the volume to the given value. More...
 
static int dfplayer_set_equalizer (dfplayer_t *dev, dfplayer_eq_t equalizer)
 Apply the given equalizer setting. More...
 
static int dfplayer_set_source (dfplayer_t *dev, dfplayer_source_t src)
 Apply the given source. More...
 
static int dfplayer_enter_standby (dfplayer_t *dev)
 Enter standby mode. More...
 
static int dfplayer_exit_standby (dfplayer_t *dev)
 Exit standby mode. More...
 
static int dfplayer_play (dfplayer_t *dev)
 Start/resume playing. More...
 
static int dfplayer_pause (dfplayer_t *dev)
 Pause the playback. More...
 
int dfplayer_play_file (dfplayer_t *dev, uint8_t folder, uint8_t file)
 Start playing the specified file in the specified folder. More...
 
int dfplayer_play_from_mp3 (dfplayer_t *dev, uint16_t number)
 Start playing the specified number in the MP3 folder. More...
 
int dfplayer_play_from_advert (dfplayer_t *dev, uint16_t number)
 Start playing the specified number in the ADVERT folder. More...
 
static int dfplayer_stop_advert (dfplayer_t *dev)
 Stop playing a file from the ADVERT folder and resume previous playback. More...
 
static int dfplayer_repeat_folder (dfplayer_t *dev, uint8_t folder)
 Start playing and repeating the specified folder. More...
 
static int dfplayer_shuffle_all (dfplayer_t *dev)
 Launch shuffle playback of all files. More...
 
static int dfplayer_repeat (dfplayer_t *dev, bool repeat)
 Enable or disable repeat playback. More...
 
int dfplayer_get_state (dfplayer_t *dev, dfplayer_state_t *state)
 Query the state of the DFPlayer Mini. More...
 
static int dfplayer_get_volume (dfplayer_t *dev, uint8_t *volume)
 Query the current volume of the DFPlayer Mini. More...
 
static int dfplayer_get_equalizer (dfplayer_t *dev, dfplayer_eq_t *equalizer)
 Query the current equalizer setting of the DFPlayer Mini. More...
 
static int dfplayer_get_mode (dfplayer_t *dev, dfplayer_mode_t *mode)
 Query the current playback mode of the DFPlayer Mini. More...
 
static int dfplayer_get_version (dfplayer_t *dev, uint16_t *version)
 Query the software version running on the DFPlayer Mini. More...
 
static int dfplayer_files_usb (dfplayer_t *dev, uint16_t *files)
 Query the number of files on the USB storage device. More...
 
static int dfplayer_files_sdcard (dfplayer_t *dev, uint16_t *files)
 Query the number of files on the SD card. More...
 
static int dfplayer_files_flash (dfplayer_t *dev, uint16_t *files)
 Query the number of files on the NOR flash. More...
 
static int dfplayer_get_fileno_usb (dfplayer_t *dev, uint16_t *fileno)
 Query the selected file on the USB storage device. More...
 
static int dfplayer_get_fileno_sdcard (dfplayer_t *dev, uint16_t *fileno)
 Query the selected file on the SD card. More...
 
static int dfplayer_get_fileno_flash (dfplayer_t *dev, uint16_t *fileno)
 Query the selected file on the NOR flash. More...
 
static dfplayer_file_t dfplayer_get_played_file (dfplayer_t *dev)
 Get the currently played file and the used naming scheme. More...
 
static int dfplayer_source_set_contains (dfplayer_source_set_t set, dfplayer_source_t src)
 Check if the given source set contains the given source. More...
 
static void dfplayer_source_set_add (dfplayer_source_set_t set, dfplayer_source_t src)
 Add the given source to the given source set. More...
 
static void dfplayer_source_set_rm (dfplayer_source_set_t set, dfplayer_source_t src)
 Remove the given source to the given source set. More...