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

Dependents:   IsuProject_LPC1768

Committer:
kayekss
Date:
Fri Dec 20 21:34:03 2013 +0000
Revision:
6:1f57fbd3aeb5
Parent:
4:6e0fb5342efa
Unified parameter names on constructor

Who changed what in which revision?

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