1

Dependents:   internet_radio_leo

Fork of VS1053 by Vassilis Serasidis

Committer:
silis
Date:
Sat Sep 05 12:16:06 2015 +0000
Revision:
7:97a8edd44fe9
Parent:
6:1f57fbd3aeb5
Child:
8:e23900b0f1ca
Library for using the VS1053 MP3 decoder board with the WIZwiki-W7500 ARM Cortex-M0 SoC

Who changed what in which revision?

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