Jump to content

Component: DFPlayer (MP3 / WAV) (Audio Output)

From Flowcode Help
Revision as of 14:39, 16 January 2023 by Wiki bot (talk | contribs)
Author Matrix TSL
Version 1.0
Category Audio Output


DFPlayer (MP3 / WAV) component

A small module capable of streaming MP3 and WAV audio files from a micro SD card. Controlled via a serial UART connection to the microcontroller.

Component Source Code

Please click here for the component source code: FC_Comp_Source_DFPlayer.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No Examples here yet

Downloadable macro reference

PausePlayResetStop
Allows the current playing track to be paused, restarted or reset 
- UINT Mode
0=Pause, 1=Play, 2=Reset, 3=Stop 
- VOID Return


SendCommand
Sends a command to the DFPlayer module 
- BYTE Command
Command code byte 
- BOOL Feedback
Collect feedback byte: Range 0-1 
- UINT Parameter
16-bit Parameter 
- VOID Return


IsReplyAvailable
Checks to see if new data has been received from the module. Returns true when new data is available. Collect the data using the GetReplyByte macro. 
- BOOL Return


SetVolume
Sets the volume level for the module 
- BYTE Volume
Range: 0 (min) - 30 (max) 
- VOID Return


SetEQ
Sets the equaliser mode for the module 
- BYTE EQMode
Range: 0-5 0=Normal, 1=Pop, 2=Rock, 3=Jazz, 4=Classic, 5=Bass 
- VOID Return


GetError
Checks for any errors and returns the error code. 1=ModuleBusy, 2=SleepMode, 3=SerialError, 4=ChecksumError, 5=TrackOutOfScope, 6=TrackNotFound, 7=InsertionError, 8=SDFail, 10=Sleep 
- BYTE Return


WhilePlaying
Blocking function that waits for module to stop being busy. Returns true if the module is still busy and the timeout period has passed. 
- UINT Timeout
Number of milliseconds to wait, 0=WaitForever 
- BOOL Return


IsPlaying
Checks to see if the last played track is still playing 
- BOOL Return


GetReplyByte
Reads a single byte from the last reply. Each reply contains 4 bytes starting with the command code. 
- BYTE Index
Range: 0-3 / 0=Command, 1=Feedback, 2=Data MSB, 3=Data LSB 
- BYTE Return


SkipTrack
Jump to the next or previous track 
- BOOL Direction
0=Next, 1=Previous 
- VOID Return


PlayTrack
Plays track from the selected folder. MP3 & Advert folder track numbers should be 4 characters long e.g. 0001 any name.mp3, Other folder track numbers should be 3 characters long e.g. 001 Any name.mp3, Root the Track played in placement order. 
- BYTE Directory
0=Root, 1=Folder "01" - 99=Folder "99", 100=MP3, 101=Advert 
- UINT Track
Track number 1="001*.MP3" / "0001*.MP3", 100="100*.MP3" / "0100*.MP3" 
- VOID Return


Initialise
Sets up the UART and does some housekeeping. Must be called before calling any of the other component macros. 
- VOID Return



Property reference

Properties
Connections
Channel
UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller. 
Baud Options
Baud rate option selector 
Baud Rate
 
TX
Pin to be used for Transmit data 
RX
Pin to be used for Receive data 
Use Busy Pin
Controls if we are monitoring the busy pin or not. Used by the IfBusy component macro. 
Simulation
Scope Traces
Selects if the scope traces are automatically added to the data recorder window or not. Simulation - draws an approximation of the UART data onto the scope trace. ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD. 
Console Data
Selects if the console data is automatically generated or not 
Console Format
Controls if the data is shown as a log with time and date stamps or just as raw data 
Console Columns
Number of characters that can be displayed on a single line of the console. 
Data Source
Simulation data source used to allow the component to connect to various remote devices Nothing - Simulation data is ignored COM port - Routes the communication data to and from a physical or virtual COM port API - Routes the communication data via a data API component on the Panel. 
API
Selects which API component to route the communication data via. Add API components to the panel before they will be available in this list. API components are available from the Comms component category.