194#define DFPLAYER_WAIT_MS (100U)
196#ifdef MODULE_AUTO_INIT_MULTIMEDIA
208static inline dfplayer_t * dfplayer_get(
unsigned num)
211 return &dfplayer_devs[num];
Header-only functions of the DFPlayer Mini Device driver.
Default configuration for the DFPlayer Mini driver.
#define DFPLAYER_NUMOF
Number of DFPlayer descriptors present.
Types used in the DFPlayer Mini Device Driver.
dfplayer_mode_t
Enumeration of the playback modes supported by the DFPlayer.
dfplayer_source_t
Enumeration of the different sources for playback supported.
uint8_t dfplayer_source_set_t
Set of DFPlayer playback sources.
dfplayer_eq_t
Enumeration of the equalizer settings supported by the DFPlayer.
void(* dfplayer_cb_src_t)(dfplayer_t *dev, dfplayer_source_set_t srcs)
Signature of the function called when a medium was inserted/ejected.
void(* dfplayer_cb_done_t)(dfplayer_t *dev, dfplayer_source_t src, uint16_t track)
Signature of the function called when a playback of track completed.
dfplayer_state_t
Enumeration of the detectable states of the DFPlayer.
static int dfplayer_shuffle_all(dfplayer_t *dev)
Launch shuffle playback of all files.
static int dfplayer_enter_standby(dfplayer_t *dev)
Enter standby mode.
static int dfplayer_files_flash(dfplayer_t *dev, uint16_t *files)
Query the number of files on the NOR flash.
static int dfplayer_files_usb(dfplayer_t *dev, uint16_t *files)
Query the number of files on the USB storage device.
static int dfplayer_get_equalizer(dfplayer_t *dev, dfplayer_eq_t *equalizer)
Query the current equalizer setting of the DFPlayer Mini.
static int dfplayer_stop_advert(dfplayer_t *dev)
Stop playing a file from the ADVERT folder and resume previous playback.
int dfplayer_step(dfplayer_t *dev, int step)
Step forward/backward following the currently used naming scheme.
static int dfplayer_get_mode(dfplayer_t *dev, dfplayer_mode_t *mode)
Query the current playback mode of the DFPlayer Mini.
static void dfplayer_source_set_rm(dfplayer_source_set_t *set, dfplayer_source_t src)
Remove the given source to the given source set.
static int dfplayer_get_fileno_sdcard(dfplayer_t *dev, uint16_t *fileno)
Query the selected file on the SD card.
static int dfplayer_repeat_folder(dfplayer_t *dev, uint8_t folder)
Start playing and repeating the specified folder.
int dfplayer_get_state(dfplayer_t *dev, dfplayer_state_t *state)
Query the state of the DFPlayer Mini.
int dfplayer_play_from_advert(dfplayer_t *dev, uint16_t number)
Start playing the specified number in the ADVERT folder.
static int dfplayer_get_volume(dfplayer_t *dev, uint8_t *volume)
Query the current volume of the DFPlayer Mini.
dfplayer_source_set_t dfplayer_get_sources(dfplayer_t *dev)
Get the set of available playback sources of the given DFPlayer.
static int dfplayer_next(dfplayer_t *dev)
Start playing the next song in the currently used naming scheme.
static int dfplayer_set_equalizer(dfplayer_t *dev, dfplayer_eq_t equalizer)
Apply the given equalizer setting.
static int dfplayer_pause(dfplayer_t *dev)
Pause the playback.
int dfplayer_init(dfplayer_t *dev, const dfplayer_params_t *params)
Initialize a DFPlayer Mini device descriptor.
static int dfplayer_get_version(dfplayer_t *dev, uint16_t *version)
Query the software version running on the DFPlayer Mini.
int dfplayer_play_from_mp3(dfplayer_t *dev, uint16_t number)
Start playing the specified number in the MP3 folder.
static int dfplayer_get_fileno_usb(dfplayer_t *dev, uint16_t *fileno)
Query the selected file on the USB storage device.
static int dfplayer_set_source(dfplayer_t *dev, dfplayer_source_t src)
Apply the given source.
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.
static int dfplayer_get_fileno_flash(dfplayer_t *dev, uint16_t *fileno)
Query the selected file on the NOR flash.
static dfplayer_file_t dfplayer_get_played_file(dfplayer_t *dev)
Get the currently played file and the used naming scheme.
static int dfplayer_play(dfplayer_t *dev)
Start/resume playing.
static int dfplayer_repeat(dfplayer_t *dev, bool repeat)
Enable or disable repeat playback.
static int dfplayer_exit_standby(dfplayer_t *dev)
Exit standby mode.
int dfplayer_play_file(dfplayer_t *dev, uint8_t folder, uint8_t file)
Start playing the specified file in the specified folder.
static int dfplayer_prev(dfplayer_t *dev)
Start playing the previous song in the currently used naming scheme.
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.
static int dfplayer_files_sdcard(dfplayer_t *dev, uint16_t *files)
Query the number of files on the SD card.
static int dfplayer_set_volume(dfplayer_t *dev, uint8_t volume)
Sets the volume to the given value.
static void dfplayer_source_set_add(dfplayer_source_set_t *set, dfplayer_source_t src)
Add the given source to the given source set.
Data structure representing a file on the DFPlayer.
Initialization parameters of a DFPlayer Mini device descriptor.
A DFPlayer Mini device descriptor.