diff --git a/STM32F1/libraries/Serasidis_VS1003B_STM/VS1003_STM.cpp b/STM32F1/libraries/Serasidis_VS1003B_STM/VS1003_STM.cpp index a59f030..1063049 100644 --- a/STM32F1/libraries/Serasidis_VS1003B_STM/VS1003_STM.cpp +++ b/STM32F1/libraries/Serasidis_VS1003B_STM/VS1003_STM.cpp @@ -8,22 +8,11 @@ Ported to STM32F103 by Vassilis Serasidis on 21 May 2015 Home: http://www.serasidis.gr email: avrsite@yahoo.gr - + 29 May 2015 - Added a fix for booting the VS1053B boards into + mp3 decoding instead of booting into MID (modeSwitch function). */ -// STL headers -// C headers -#include -// Framework headers -// Library headers -#include -#include -#include -#include "pins_arduino.h" -#include "wiring_private.h" #include -// Project headers -// This component's header #include const uint8_t vs1003_chunk_size = 32; @@ -318,6 +307,20 @@ void VS1003_STM::printDetails(void) const print_byte_register(i++); } +/****************************************************************************/ +void VS1003_STM::modeSwitch(void) +{ + //GPIO_DDR + write_register(SCI_WRAMADDR, 0xc017); + write_register(SCI_WRAM, 0x0003); + //GPIO_ODATA + write_register(SCI_WRAMADDR, 0xc019); + write_register(SCI_WRAM, 0x0000); + + delay(100); + write_register(SCI_MODE, (1< #include + /* * VS1003 development board connected by it's header pins the following way: * @@ -27,9 +31,10 @@ * GND - GND - * 5V - 5V - */ + VS1003_STM player(PC14, PB10, PA8, PA9); // cs_pin, dcs_pin, dreq_pin, reset_pin -unsigned char HelloMP3[] = { +static const unsigned char HelloMP3[] = { 0xFF,0xF2,0x40,0xC0,0x19,0xB7,0x00,0x14,0x02,0xE6,0x5C, /* ..@.......\ */ 0x01,0x92,0x68,0x01,0xF1,0x5E,0x03,0x08,0xF0,0x24,0x80, /* ..h..^...$. */ 0x05,0x9E,0x20,0xC6,0xFC,0x12,0x32,0x5C,0xBF,0xF9,0xB9, /* .. ...2\... */ @@ -196,6 +201,8 @@ void setup () { // initiate a player player.begin(); + player.modeSwitch(); //Change mode from MIDI to MP3 decoding (Vassilis Serasidis). + // set maximum output volume player.setVolume(0x00); }