AUDIO LIB
Fork of VS1053 by
Diff: VS1053.h
- Revision:
- 2:47ba7e2259cd
- Parent:
- 1:00c19f771676
- Child:
- 3:696c8e6744b2
--- a/VS1053.h Fri Nov 08 11:01:00 2013 +0000 +++ b/VS1053.h Sat Nov 09 10:23:04 2013 +0000 @@ -1,4 +1,4 @@ -// ==================================================== Nov 08 2013, kayeks == +// ==================================================== Nov 09 2013, kayeks == // VS1053.h // =========================================================================== // Just a simple library for VLSI's mp3/midi codec chip @@ -7,6 +7,7 @@ #ifndef KAYX_VS1053_H_ #define KAYX_VS1053_H_ +/** Class VS1053. Drives VLSI's mp3/midi codec chip. */ class VS1053 { private: SPI spi; @@ -33,15 +34,37 @@ 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(); - void sendDataByte(uint8_t); - size_t sendDataBlock(uint8_t*, size_t); + + /** 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: