1
Dependents: internet_radio_leo
Fork of VS1053 by
Diff: VS1053.cpp
- Revision:
- 3:696c8e6744b2
- Parent:
- 2:47ba7e2259cd
- Child:
- 4:6e0fb5342efa
diff -r 47ba7e2259cd -r 696c8e6744b2 VS1053.cpp --- a/VS1053.cpp Sat Nov 09 10:23:04 2013 +0000 +++ b/VS1053.cpp Wed Dec 04 16:58:44 2013 +0000 @@ -1,4 +1,4 @@ -// ==================================================== Nov 09 2013, kayeks == +// ==================================================== Dec 05 2013, kayeks == // VS1053.cpp // =========================================================================== // Just a simple library for VLSI's mp3/midi codec chip @@ -73,7 +73,7 @@ } /** Send cancel request to VS1053. - * @return 0 at failure, 1 at success. + * @return Zero at failure, non-zero at success. */ bool VS1053::sendCancel() { uint16_t reg; @@ -82,15 +82,15 @@ reg = readReg(SCI_MODE); if (reg & 0x0008) { // Abort if SM_CANCEL is still set - return 0; + return false; } writeReg(SCI_MODE, reg | 0x0008); - return 1; + return true; } -/** Attempts a termination of play. +/** Attempts a termination of playing. * Call this repeatedly during data stream tramsission until it successes. - * @return 0 at failure, 1 at success. + * @return Zero at failure, non-zero at success. */ bool VS1053::stop() { uint16_t reg; @@ -100,7 +100,7 @@ // If SM_CANCEL is still set, do nothing reg = readReg(SCI_MODE); if (reg & 0x0008) { - return 0; + return false; } // Read endFillByte from XRAM <1E06h> @@ -140,13 +140,15 @@ cs = 1; } -/** Read an SCI (Serial Control Interface) register entry. */ +/** Read an SCI (Serial Control Interface) register entry. + * @return Register value or 0000h when invalid address was specified. + */ uint16_t VS1053::readReg(uint8_t addr) { uint16_t word; - // If addr is out-of-range, return a beef + // If addr is out-of-range, return 0000h if (addr > 0x0f) { - return 0xbeef; + return 0x0000; } while (!dreq);