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

Dependents:   IsuProject_LPC1768

Committer:
kayekss
Date:
Fri Nov 08 10:41:54 2013 +0000
Revision:
0:708868399033
Child:
1:00c19f771676
Just a simple library for VLSI's mp3/midi codec chip

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kayekss 0:708868399033 1 // ==================================================== Nov 04 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 0:708868399033 10 class VS1053 {
kayekss 0:708868399033 11 private:
kayekss 0:708868399033 12 SPI spi;
kayekss 0:708868399033 13 DigitalOut cs;
kayekss 0:708868399033 14 DigitalOut bsync;
kayekss 0:708868399033 15 DigitalIn dreq;
kayekss 0:708868399033 16 DigitalOut rst;
kayekss 0:708868399033 17
kayekss 0:708868399033 18 public:
kayekss 0:708868399033 19 static const uint8_t SCI_MODE = 0x00;
kayekss 0:708868399033 20 static const uint8_t SCI_STATUS = 0x01;
kayekss 0:708868399033 21 static const uint8_t SCI_BASS = 0x02;
kayekss 0:708868399033 22 static const uint8_t SCI_CLOCKF = 0x03;
kayekss 0:708868399033 23 static const uint8_t SCI_DECODE_TIME = 0x04;
kayekss 0:708868399033 24 static const uint8_t SCI_AUDATA = 0x05;
kayekss 0:708868399033 25 static const uint8_t SCI_WRAM = 0x06;
kayekss 0:708868399033 26 static const uint8_t SCI_WRAMADDR = 0x07;
kayekss 0:708868399033 27 static const uint8_t SCI_HDAT0 = 0x08;
kayekss 0:708868399033 28 static const uint8_t SCI_HDAT1 = 0x09;
kayekss 0:708868399033 29 static const uint8_t SCI_AIADDR = 0x0a;
kayekss 0:708868399033 30 static const uint8_t SCI_VOL = 0x0b;
kayekss 0:708868399033 31 static const uint8_t SCI_AICTRL0 = 0x0c;
kayekss 0:708868399033 32 static const uint8_t SCI_AICTRL1 = 0x0d;
kayekss 0:708868399033 33 static const uint8_t SCI_AICTRL2 = 0x0e;
kayekss 0:708868399033 34 static const uint8_t SCI_AICTRL3 = 0x0f;
kayekss 0:708868399033 35
kayekss 0:708868399033 36 VS1053(PinName mosiPin, PinName misoPin, PinName sckPin,
kayekss 0:708868399033 37 PinName cs, PinName bsync, PinName dreq, PinName rstPin,
kayekss 0:708868399033 38 uint32_t spiFrequency=1000000);
kayekss 0:708868399033 39 ~VS1053();
kayekss 0:708868399033 40 void hardwareReset();
kayekss 0:708868399033 41 void sendDataByte(uint8_t);
kayekss 0:708868399033 42 size_t sendDataBlock(uint8_t*, size_t);
kayekss 0:708868399033 43 void clockUp();
kayekss 0:708868399033 44 bool sendCancel();
kayekss 0:708868399033 45 bool stop();
kayekss 0:708868399033 46
kayekss 0:708868399033 47 private:
kayekss 0:708868399033 48 void writeReg(uint8_t, uint16_t);
kayekss 0:708868399033 49 uint16_t readReg(uint8_t);
kayekss 0:708868399033 50 };
kayekss 0:708868399033 51
kayekss 0:708868399033 52 #endif