modified for VS1033
Dependents: 11U68_MP3Player with TFTLCD 11U68_MP3Player-with-TFTLCD Mp3_1
Fork of VS1033 by
VS1053.h
- Committer:
- kayekss
- Date:
- 2013-11-09
- Revision:
- 2:47ba7e2259cd
- Parent:
- 1:00c19f771676
- Child:
- 3:696c8e6744b2
File content as of revision 2:47ba7e2259cd:
// ==================================================== Nov 09 2013, kayeks == // VS1053.h // =========================================================================== // Just a simple library for VLSI's mp3/midi codec chip // - Minimal and simple implementation (and dirty too) #ifndef KAYX_VS1053_H_ #define KAYX_VS1053_H_ /** Class VS1053. Drives VLSI's mp3/midi codec chip. */ class VS1053 { private: SPI spi; DigitalOut cs; DigitalOut bsync; DigitalIn dreq; DigitalOut rst; public: static const uint8_t SCI_MODE = 0x00; static const uint8_t SCI_STATUS = 0x01; static const uint8_t SCI_BASS = 0x02; static const uint8_t SCI_CLOCKF = 0x03; static const uint8_t SCI_DECODE_TIME = 0x04; static const uint8_t SCI_AUDATA = 0x05; static const uint8_t SCI_WRAM = 0x06; static const uint8_t SCI_WRAMADDR = 0x07; static const uint8_t SCI_HDAT0 = 0x08; static const uint8_t SCI_HDAT1 = 0x09; static const uint8_t SCI_AIADDR = 0x0a; static const uint8_t SCI_VOL = 0x0b; static const uint8_t SCI_AICTRL0 = 0x0c; static const uint8_t SCI_AICTRL1 = 0x0d; 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: void writeReg(uint8_t, uint16_t); uint16_t readReg(uint8_t); }; #endif