Just a simple library for VLSI's mp3/midi codec chip

Dependents:   IsuProject_LPC1768

Files at this revision

API Documentation at this revision

Comitter:
kayekss
Date:
Wed Dec 04 16:58:44 2013 +0000
Parent:
2:47ba7e2259cd
Child:
4:6e0fb5342efa
Commit message:
Unified terms in API documentation.

Changed in this revision

VS1053.cpp Show annotated file Show diff for this revision Revisions of this file
VS1053.h Show annotated file Show diff for this revision Revisions of this file
--- 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);
--- a/VS1053.h	Sat Nov 09 10:23:04 2013 +0000
+++ b/VS1053.h	Wed Dec 04 16:58:44 2013 +0000
@@ -1,4 +1,4 @@
-// ==================================================== Nov 09 2013, kayeks ==
+// ==================================================== Dec 05 2013, kayeks ==
 // VS1053.h
 // ===========================================================================
 // Just a simple library for VLSI's mp3/midi codec chip
@@ -34,37 +34,15 @@
     static const uint8_t SCI_AICTRL2     = 0x0e;
     static const uint8_t SCI_AICTRL3     = 0x0f;
     
-    /** Constructor of class VS1053. */
     VS1053(PinName mosiPin, PinName misoPin, PinName sckPin,
            PinName cs, PinName bsync, PinName dreq, PinName rstPin,
            uint32_t spiFrequency=1000000);
-    
-    /** Destructor of class VS1053. */
     ~VS1053();
-    
-    /** Make a hardware reset by hitting VS1053's RESET pin. */
     void hardwareReset();
-    
-    /** Send a data byte to VS1053. */
     void sendDataByte(uint8_t data);
-    
-    /** Send a data block specified as a pointer to VS1053.
-     *  @return Data length successfully sent.
-     */
     size_t sendDataBlock(uint8_t* pData, size_t length);
-    
-    /** Change VS1053's PLL setting for speedup. */
     void clockUp();
-    
-    /** Send cancel request to VS1053.
-     *  @return 0 at failure, 1 at success.
-     */
     bool sendCancel();
-    
-    /** Attempts "stop playing".
-     *  Call this repeatedly during data stream tramsission until it successes.
-     *  @return 0 at failure, 1 at success.
-     */
     bool stop();
     
 private: