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:
-
uart
NumberDefault UART to use (0 or 1)
Returns:
dataAvailable
-
millis
Checks to see if there is data available for reading
Parameters:
-
millis
NumberNumber 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:
-
buffer
StringBuffer to hold the data read
-
len
NumberLength of the buffer
Returns:
Number of bytes read
writeData
-
buffer
-
len
Writes the data in the buffer to the device
Parameters:
-
buffer
StringBuffer to hold the data read
-
len
NumberLength 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:
-
baud
Speed_tDesired baud rate.
Returns:
True if successful
checkResponse
-
opcode
Gets a command response and returns its validity
Parameters:
-
opcode
WT5001_OPCODE_TOpcode to verify
Returns:
True if successful
play
-
psrc
-
index
Plays a file from a source
Parameters:
-
psrc
WT5001_PLAYSOURCE_TPlay source (SD, UDISK, SPI)
-
index
NumberFile 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:
-
vol
Numberundefined
Returns:
True if successful
queue
-
index
Queues a track to play next, when the current song is finished
Parameters:
-
index
NumberFile number to queue
Returns:
True if successful
setPlayMode
-
pm
Sets the playback mode
Parameters:
-
pm
WT5001_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:
-
index
NumberFile number to insert
Returns:
True if successful
setDate
-
year
-
month
-
day
Sets the date of the internal clock
Parameters:
-
year
Number4-digit year
-
month
NumberMonth
-
day
NumberDay
Returns:
True if successful
setTime
-
hour
-
minute
-
second
Sets the time of the internal clock
Parameters:
-
hour
NumberHour
-
minute
NumberMinute
-
second
NumberSecond
Returns:
True if successful
setAlarm
-
hour
-
minute
-
second
Sets the alarm
Parameters:
-
hour
NumberHour
-
minute
NumberMinute
-
second
NumberSecond
Returns:
True if successful
clearAlarm
()
Boolean
Clears any alarm that has been set
Returns:
True if successful
getVolume
-
vol
Gets the current volume
Parameters:
-
vol
Uint8_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:
-
ps
Uint8_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:
-
psrc
WT5001_PLAYSOURCE_TStorage source
-
numf
Uint16_t *Number of files
Returns:
True if successful
getNumFiles
-
psrc
Gets the number of files present on the source device
Parameters:
-
psrc
WT5001_PLAYSOURCE_TStorage source
Returns:
Number of files
getCurrentFile
-
curf
Gets the index of the current file
Parameters:
-
curf
Uint16_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:
-
year
Uint16_t *4-digit year
-
month
Uint8_t *Month
-
day
Uint8_t *Day
Returns:
True if successful
getTime
-
hour
-
minute
-
second
Gets the device time
Parameters:
-
hour
Uint8_t *Hour
-
minute
Uint8_t *Minute
-
second
Uint8_t *Second
Returns:
True if successful