Just a simple library for VLSI's mp3/midi codec chip
Dependents: IsuProject_LPC1768
VS1053.h@6:1f57fbd3aeb5, 2013-12-20 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
kayekss | 6:1f57fbd3aeb5 | 1 | // ==================================================== Dec 21 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 | 6:1f57fbd3aeb5 | 38 | PinName csPin, PinName bsyncPin, PinName dreqPin, 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 |