WT5001 Class
- ID: wt5001
 - Name: Serial MP3 Module
 - Other Names: Grove Serial MP3 Player
 - Category: sound
 - Manufacturer: seeed
 - Link: http://www.seeedstudio.com/wiki/Grove_%E2%80%93_Serial_MP3_Player
 - Connection: uart
 
UPM support for the WT5001 Serial MP3 module. This was tested specifically with the Grove Serial MP3 module.
                      
Item Index
Methods
Properties
- NONE
 - PLAY_SD
 - PLAY_SPI
 - PLAY_UDISK
 - PAUSE
 - STOP
 - NEXT
 - PREVIOUS
 - SET_VOLUME
 - QUEUE
 - PLAY_MODE
 - COPY_SD2FLASH
 - COPY_UDISK2FLASH
 - INSERT_SONG
 - SET_DATE
 - SET_TIME
 - SET_ALARM
 - SET_ALARM_DUR
 - CLEAR_ALARM
 - CLEAR_ALARM_DUR
 - READ_VOLUME
 - READ_PLAY_STATE
 - READ_SPI_NUMF
 - READ_SD_NUMF
 - READ_UDISK_NUMF
 - READ_CUR_FNAME
 - READ_CF_CHAR
 - READ_DATE
 - READ_TIME
 - NORMAL
 - SINGLE_REPEAT
 - ALL_REPEAT
 - RANDOM
 - SD
 - SPI
 - UDISK
 
Methods
WT5001
                      
                              - 
                                              
uart 
WT5001 constructor
Parameters:
- 
                                              
uartNumberDefault UART to use (0 or 1)
 
Returns:
dataAvailable
                      
                              - 
                                              
millis 
Checks to see if there is data available for reading
Parameters:
- 
                                              
millisNumberNumber of milliseconds to wait; 0 means no waiting
 
Returns:
True if there is data available for reading
readData
                      
                              - 
                                              
buffer - 
                                              
len 
Reads any available data in a user-supplied buffer. Note: the call blocks until data is available to be read. Use dataAvailable() to determine whether there is data available beforehand, to avoid blocking.
Parameters:
- 
                                              
bufferStringBuffer to hold the data read
 - 
                                              
lenNumberLength of the buffer
 
Returns:
Number of bytes read
writeData
                      
                              - 
                                              
buffer - 
                                              
len 
Writes the data in the buffer to the device
Parameters:
- 
                                              
bufferStringBuffer to hold the data read
 - 
                                              
lenNumberLength of the buffer
 
Returns:
Number of bytes written
setupTty
                      
                              - 
                                              
baud 
Sets up proper tty I/O modes and the baud rate. The default baud rate is 9,600 (B9600).
Parameters:
- 
                                              
baudSpeed_tDesired baud rate.
 
Returns:
True if successful
checkResponse
                      
                              - 
                                              
opcode 
Gets a command response and returns its validity
Parameters:
- 
                                              
opcodeWT5001_OPCODE_TOpcode to verify
 
Returns:
True if successful
play
                      
                              - 
                                              
psrc - 
                                              
index 
Plays a file from a source
Parameters:
- 
                                              
psrcWT5001_PLAYSOURCE_TPlay source (SD, UDISK, SPI)
 - 
                                              
indexNumberFile number to play
 
Returns:
True if successful
stop
                      
                              ()
                      
                              
                                  Boolean
                              
                      
                      
                      
                      
                      
                      
                      
                          
                      
                          Stops playing
Returns:
True if successful
pause
                      
                              ()
                      
                              
                                  Boolean
                              
                      
                      
                      
                      
                      
                      
                      
                          
                      
                          Pauses the playback or resumes it if already paused
Returns:
True if successful
next
                      
                              ()
                      
                              
                                  Boolean
                              
                      
                      
                      
                      
                      
                      
                      
                          
                      
                          Moves to the next track
Returns:
True if successful
previous
                      
                              ()
                      
                              
                                  Boolean
                              
                      
                      
                      
                      
                      
                      
                      
                          
                      
                          Moves to the previous track
Returns:
True if successful
setVolume
                      
                              - 
                                              
vol 
Sets the volume. Valid range is 0-31. 0 means mute.
Parameters:
- 
                                              
volNumberundefined
 
Returns:
True if successful
queue
                      
                              - 
                                              
index 
Queues a track to play next, when the current song is finished
Parameters:
- 
                                              
indexNumberFile number to queue
 
Returns:
True if successful
setPlayMode
                      
                              - 
                                              
pm 
Sets the playback mode
Parameters:
- 
                                              
pmWT5001_PLAYMODE_TPlay mode to enable
 
Returns:
True if successful
insert
                      
                              - 
                                              
index 
Inserts a track to play immediately, interrupting the current track. When the inserted track is finished, the interrupted track resumes where it was interrupted.
Parameters:
- 
                                              
indexNumberFile number to insert
 
Returns:
True if successful
setDate
                      
                              - 
                                              
year - 
                                              
month - 
                                              
day 
Sets the date of the internal clock
Parameters:
- 
                                              
yearNumber4-digit year
 - 
                                              
monthNumberMonth
 - 
                                              
dayNumberDay
 
Returns:
True if successful
setTime
                      
                              - 
                                              
hour - 
                                              
minute - 
                                              
second 
Sets the time of the internal clock
Parameters:
- 
                                              
hourNumberHour
 - 
                                              
minuteNumberMinute
 - 
                                              
secondNumberSecond
 
Returns:
True if successful
setAlarm
                      
                              - 
                                              
hour - 
                                              
minute - 
                                              
second 
Sets the alarm
Parameters:
- 
                                              
hourNumberHour
 - 
                                              
minuteNumberMinute
 - 
                                              
secondNumberSecond
 
Returns:
True if successful
clearAlarm
                      
                              ()
                      
                              
                                  Boolean
                              
                      
                      
                      
                      
                      
                      
                      
                          
                      
                          Clears any alarm that has been set
Returns:
True if successful
getVolume
                      
                              - 
                                              
vol 
Gets the current volume
Parameters:
- 
                                              
volUint8_t *Volume
 
Returns:
True if successful
getVolume
                      
                              ()
                      
                              
                                  Number
                              
                      
                      
                      
                      
                      
                      
                      
                          
                      
                          Gets the current volume
Returns:
Volume
getPlayState
                      
                              - 
                                              
ps 
Gets the current play state: 1 = playing, 2 = stopped, 3 = paused
Parameters:
- 
                                              
psUint8_t *Play state
 
Returns:
True if successful
getPlayState
                      
                              ()
                      
                              
                                  Number
                              
                      
                      
                      
                      
                      
                      
                      
                          
                      
                          Gets the current play state: 1 = playing, 2 = stopped, 3 = paused
Returns:
Play state
getNumFiles
                      
                              - 
                                              
psrc - 
                                              
numf 
Gets the number of files present on the source device
Parameters:
- 
                                              
psrcWT5001_PLAYSOURCE_TStorage source
 - 
                                              
numfUint16_t *Number of files
 
Returns:
True if successful
getNumFiles
                      
                              - 
                                              
psrc 
Gets the number of files present on the source device
Parameters:
- 
                                              
psrcWT5001_PLAYSOURCE_TStorage source
 
Returns:
Number of files
getCurrentFile
                      
                              - 
                                              
curf 
Gets the index of the current file
Parameters:
- 
                                              
curfUint16_t *Index of the current file
 
Returns:
True if successful
getCurrentFile
                      
                              ()
                      
                              
                                  Number
                              
                      
                      
                      
                      
                      
                      
                      
                          
                      
                          Gets the index of the current file
Returns:
Index of the curretn file
getDate
                      
                              - 
                                              
year - 
                                              
month - 
                                              
day 
Gets the device date
Parameters:
- 
                                              
yearUint16_t *4-digit year
 - 
                                              
monthUint8_t *Month
 - 
                                              
dayUint8_t *Day
 
Returns:
True if successful
getTime
                      
                              - 
                                              
hour - 
                                              
minute - 
                                              
second 
Gets the device time
Parameters:
- 
                                              
hourUint8_t *Hour
 - 
                                              
minuteUint8_t *Minute
 - 
                                              
secondUint8_t *Second
 
Returns:
True if successful