Upadted VS1003_STM lib with latest files from Vasillis Serasidis

This commit is contained in:
Roger Clark 2015-06-03 10:44:10 +10:00
parent f337329c89
commit 146dad4512
3 changed files with 32 additions and 14 deletions

View File

@ -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 <avr/pgmspace.h>
// Framework headers
// Library headers
#include <avr/pgmspace.h>
#include <limits.h>
#include <libmaple/dma.h>
#include "pins_arduino.h"
#include "wiring_private.h"
#include <SPI.h>
// Project headers
// This component's header
#include <VS1003_STM.h>
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<<SM_SDINEW) | (1<<SM_RESET));
delay(100);
}
/****************************************************************************/
void VS1003_STM::loadUserCode(const uint16_t* buf, size_t len) const

View File

@ -9,8 +9,10 @@
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 MIDI.
*/
//This is an additional test line
#ifndef __VS1003_STM_H__
#define __VS1003_STM_H__
@ -125,6 +127,12 @@ public:
* (see fdevopen() in avr/io.h).
*/
void printDetails(void) const;
/**
*
*
*/
void modeSwitch(void);
/**
* Set the player volume

View File

@ -8,11 +8,15 @@
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).
*/
#include <VS1003_STM.h>
#include <SPI.h>
/*
* 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);
}