Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Lab3_1 RTOS-VS1053b-mp3_semaphore RTOS-VS1053b-mp3_v01
Diff: VS1053.cpp
- Revision:
- 8:5e4a21202223
- Parent:
- 6:eed008905159
--- a/VS1053.cpp Sat Jan 08 16:36:00 2011 +0000
+++ b/VS1053.cpp Wed Jan 12 18:30:28 2011 +0000
@@ -48,7 +48,7 @@
* =================================================================*/
VS1053::VS1053(
PinName mosi, PinName miso, PinName sck, PinName cs, PinName rst,
- PinName dreq, PinName dcs)
+ PinName dreq, PinName dcs, char* buffer, int buffer_size)
:
_spi(mosi, miso, sck),
_CS(cs),
@@ -63,11 +63,14 @@
_sb_freqlimit = DEFAULT_BASS_FREQUENCY;
_st_amplitude = DEFAULT_TREBLE_AMPLITUDE;
_st_freqlimit = DEFAULT_TREBLE_FREQUENCY;
+ _buffer = buffer;
+ BUFFER_SIZE = buffer_size;
_DREQ_INTERUPT_IN.mode(PullDown);
INTERRUPT_HANDLER_DISABLE;
bufferReset();
}
+
/*===================================================================
* Functions
*==================================================================*/
@@ -492,6 +495,11 @@
/*===================================================================
* Buffer handling
*==================================================================*/
+
+unsigned int VS1053::bufferLength(void)
+{
+ return BUFFER_SIZE;
+}
unsigned char VS1053::bufferGetByte(void)
{
@@ -507,7 +515,7 @@
return retVal;
}
-bool VS1053::bufferSetByte(unsigned char c)
+bool VS1053::bufferSetByte(char c)
{
if (bufferFree() > 0x00)
{
@@ -521,7 +529,7 @@
return false;
}
-bool VS1053::bufferPutStream(const unsigned char *s, unsigned int length)
+bool VS1053::bufferPutStream(const char *s, unsigned int length)
{
if (bufferFree() >= length)
{
@@ -745,4 +753,4 @@
retVal->decodeTime = sci_read(SCI_DECODE_TIME);
DEBUGOUT("VS1053b: Decodetime: %i s\r\n", retVal->decodeTime);
-}
\ No newline at end of file
+}