Author | Matthew Schinkel, copyright © 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4m |
example usage of the sta015 mp3 decoder. plays .mp3 files from a fat32 formatted sd card or hard disk
http://www.st.com/stonline/books/pdf/docs/7042.pdf http://www.pjrc.com/mp3/sta013.html
No dependency found
const byte STA015_RIGHT_UP = 112
const byte STA015_MUTE = 103
const byte STA015_NO_MUTE = 104
const byte STA015_DUAL_CHANNEL = 2
const byte _STA015_RESET = 0x16
var byte sta015_left = 0
const byte STA015_STEREO = 0
var byte sta015_mode
const byte STA015_STOP_PLAY = 102
const byte STA015_BASE_UP = 108
const byte STA015_OSC_10 = 0
var byte _sta015_head_mid
const byte _STA015_MUTE = 0x14
const byte STA015_OSC_14_31818 = 2
const byte _STA015_TREBLE_ENHANCE = 0x7B
const byte STA015_TREBLE_DOWN = 109
const byte _STA015_DRB = 0x49
var byte _sta015_head_high
const byte STA015_READ_INFO = 115
const byte STA015_LEFT_UP = 114
const byte STA015_START_PLAY = 101
const byte _STA015_BASS_ENHANCE = 0x7C
const byte STA015_VOLUME_UP = 106
var sbyte sta015_base = 0
const byte STA015_OSC_14_7456 = 3
const byte STA015_RESET = 100
const byte _STA015_RUN = 0x72
var byte sta015_right = 0
const byte STA015_TREBLE_UP = 110
const byte STA015_BASE_DOWN = 107
const byte _STA015_DRA = 0x48
const byte STA015_RIGHT_DOWN = 111
const byte STA015_SINGLE_CHANNEL = 3
const byte _STA015_PLAY = 0x19
const byte STA015_OSC_20 = 1
var byte sta015_crystal
const byte STA015_LEFT_DOWN = 113
const byte _STA015_TONE_ATTEN = 0x7D
var word sta015_bitrate
var byte _sta015_head_low
var sbyte sta015_treble = 0
const byte STA015_VOLUME_DOWN = 105
const byte STA015_JOINT_STEREO = 1
var byte sta015_attenuation = STA015_DEFAULT_ATTENUATION
sta015_read_mp3_info()
sta015_read_register(byte in reg_address, byte out data)
sta015_init(byte in crystal_speed)
sta015_send_volume()
sta015_send(byte in data)
sta015_write_command(byte in command)
sta015_write_register(byte in reg_address, byte in data)
const byte STA015_RIGHT_UP = 112
Turn up the right speaker volume
const byte STA015_MUTE = 103
Mute (turn off volume but continue playing)
const byte STA015_NO_MUTE = 104
Turn off Mute (restore volume)
const byte STA015_DUAL_CHANNEL = 2
dual_channel
const byte _STA015_RESET = 0x16
register addresses
var byte sta015_left = 0
current left speaker volume
const byte STA015_STEREO = 0
stereo
var byte sta015_mode
sta015_mode will equal current playing mp3's mode after sta015_write_command(STA015_READ_INFO) as seen below. example: if sta015_mode == STA015_STEREO then
const byte STA015_STOP_PLAY = 102
Tell device to stop playing. Or just stop sending data
const byte STA015_BASE_UP = 108
Turn up base (low frequency sounds)
const byte STA015_OSC_10 = 0
oscillators for the init procedure
var byte _sta015_head_mid
holds some mp3 info
const byte _STA015_MUTE = 0x14
mute command register
const byte STA015_OSC_14_31818 = 2
14.31818 mhz crystal
const byte _STA015_TREBLE_ENHANCE = 0x7B
treble enhance register
const byte STA015_TREBLE_DOWN = 109
Turn down treble (high frequency sounds)
const byte _STA015_DRB = 0x49
right volume register
var byte _sta015_head_high
holds some mp3 info
const byte STA015_READ_INFO = 115
Get mp3 bitrate and mode(mono/stereo) with sta015_read_mp3_info() command
const byte STA015_LEFT_UP = 114
Turn up the left speaker volume
const byte STA015_START_PLAY = 101
Tell the device to start playing. You need to send data after
const byte _STA015_BASS_ENHANCE = 0x7C
base enhance register
const byte STA015_VOLUME_UP = 106
Turn up the volume (less attenuation)
var sbyte sta015_base = 0
current base volume
const byte STA015_OSC_14_7456 = 3
14.7456 mhz crystal
const byte STA015_RESET = 100
send one of the following constants to the sta015_write_command procedure
const byte _STA015_RUN = 0x72
run command register
var byte sta015_right = 0
current right speaker volume
const byte STA015_TREBLE_UP = 110
Turn up the treble (high frequency sounds)
const byte STA015_BASE_DOWN = 107
Turn down base (low frequency sounds)
const byte _STA015_DRA = 0x48
left volume register
const byte STA015_RIGHT_DOWN = 111
Turn down the right speaker volume
const byte STA015_SINGLE_CHANNEL = 3
single_channel (mono)
const byte _STA015_PLAY = 0x19
play command register
const byte STA015_OSC_20 = 1
20 mhz crystal
var byte sta015_crystal
holds the crystal value chosen after init
const byte STA015_LEFT_DOWN = 113
Turn down the left speaker volume
const byte _STA015_TONE_ATTEN = 0x7D
tone attenuation register
var word sta015_bitrate
holds current playing mp3's bitrate or quality in kbps after sta015_write_command(STA015_READ_INFO)
var byte _sta015_head_low
holds some mp3 info
var sbyte sta015_treble = 0
current treble volume
const byte STA015_VOLUME_DOWN = 105
Turn down the volume (more attenuation)
const byte STA015_JOINT_STEREO = 1
joint stereo (intensity_stereo and/or ms_stereo)
var byte sta015_attenuation = STA015_DEFAULT_ATTENUATION
volume control vars, read only. use sta015_write_command() procedure to change volume
sta015_read_mp3_info()
read bitrate, song quality, mono/stereo into vars sta015_mode and sta015_bitrate
sta015_read_register(byte in reg_address, byte out data)
read to any sta015 register
sta015_init(byte in crystal_speed)
initialize the device with input crystal speed
sta015_send_volume()
send volume info, bitrate info and stereo/mono info to serial port
sta015_send(byte in data)
send mp3 data for playing
sta015_write_command(byte in command)
send a command from the list of command constants
sta015_write_register(byte in reg_address, byte in data)
write to any sta015 register