A simple library for decoding MP3 files with the VS1053 CoDec chip. The initial library was written by Kaoru Onoe. The library is patched to work with some "LC Technology" VS1053 board that have some IC pins disconnected. Because of that problem, there was no sound out of that boards. Now, these board work ok !

Dependents:   W7500_and_VS1053_MP3_decoder VS1053_MP3_decoder_WIZwiki-W7500 VS1053Player Scat

Fork of VS1053 by Kaoru Onoe

Committer:
kayekss
Date:
Wed Dec 18 17:00:22 2013 +0000
Revision:
4:6e0fb5342efa
Parent:
3:696c8e6744b2
Child:
6:1f57fbd3aeb5
Fixed a bug where sendDataBlock hangs up

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kayekss 4:6e0fb5342efa 1 // ==================================================== Dec 18 2013, kayeks ==
kayekss 0:708868399033 2 // VS1053.h
kayekss 0:708868399033 3 // ===========================================================================
kayekss 0:708868399033 4 // Just a simple library for VLSI's mp3/midi codec chip
kayekss 0:708868399033 5 // - Minimal and simple implementation (and dirty too)
kayekss 0:708868399033 6
kayekss 0:708868399033 7 #ifndef KAYX_VS1053_H_
kayekss 0:708868399033 8 #define KAYX_VS1053_H_
kayekss 0:708868399033 9
kayekss 2:47ba7e2259cd 10 /** Class VS1053. Drives VLSI's mp3/midi codec chip. */
kayekss 0:708868399033 11 class VS1053 {
kayekss 0:708868399033 12 private:
kayekss 4:6e0fb5342efa 13 SPI spi;
kayekss 0:708868399033 14 DigitalOut cs;
kayekss 0:708868399033 15 DigitalOut bsync;
kayekss 4:6e0fb5342efa 16 DigitalIn dreq;
kayekss 0:708868399033 17 DigitalOut rst;
kayekss 0:708868399033 18
kayekss 0:708868399033 19 public:
kayekss 0:708868399033 20 static const uint8_t SCI_MODE = 0x00;
kayekss 0:708868399033 21 static const uint8_t SCI_STATUS = 0x01;
kayekss 0:708868399033 22 static const uint8_t SCI_BASS = 0x02;
kayekss 0:708868399033 23 static const uint8_t SCI_CLOCKF = 0x03;
kayekss 0:708868399033 24 static const uint8_t SCI_DECODE_TIME = 0x04;
kayekss 0:708868399033 25 static const uint8_t SCI_AUDATA = 0x05;
kayekss 0:708868399033 26 static const uint8_t SCI_WRAM = 0x06;
kayekss 0:708868399033 27 static const uint8_t SCI_WRAMADDR = 0x07;
kayekss 0:708868399033 28 static const uint8_t SCI_HDAT0 = 0x08;
kayekss 0:708868399033 29 static const uint8_t SCI_HDAT1 = 0x09;
kayekss 0:708868399033 30 static const uint8_t SCI_AIADDR = 0x0a;
kayekss 0:708868399033 31 static const uint8_t SCI_VOL = 0x0b;
kayekss 0:708868399033 32 static const uint8_t SCI_AICTRL0 = 0x0c;
kayekss 0:708868399033 33 static const uint8_t SCI_AICTRL1 = 0x0d;
kayekss 0:708868399033 34 static const uint8_t SCI_AICTRL2 = 0x0e;
kayekss 0:708868399033 35 static const uint8_t SCI_AICTRL3 = 0x0f;
kayekss 0:708868399033 36
kayekss 0:708868399033 37 VS1053(PinName mosiPin, PinName misoPin, PinName sckPin,
kayekss 0:708868399033 38 PinName cs, PinName bsync, PinName dreq, PinName rstPin,
kayekss 0:708868399033 39 uint32_t spiFrequency=1000000);
kayekss 0:708868399033 40 ~VS1053();
kayekss 0:708868399033 41 void hardwareReset();
kayekss 2:47ba7e2259cd 42 void sendDataByte(uint8_t data);
kayekss 4:6e0fb5342efa 43 size_t sendDataBlock(uint8_t* data, size_t length);
kayekss 0:708868399033 44 void clockUp();
kayekss 0:708868399033 45 bool sendCancel();
kayekss 0:708868399033 46 bool stop();
kayekss 0:708868399033 47
kayekss 0:708868399033 48 private:
kayekss 0:708868399033 49 void writeReg(uint8_t, uint16_t);
kayekss 0:708868399033 50 uint16_t readReg(uint8_t);
kayekss 0:708868399033 51 };
kayekss 0:708868399033 52
kayekss 0:708868399033 53 #endif