MP3 Player with touch panel interface and LCD display.
Dependencies: TextLCD mbed SDFileSystem
VS1002.h@0:a265079d50a2, 2011-10-06 (annotated)
- Committer:
- pramodnataraja
- Date:
- Thu Oct 06 06:49:38 2011 +0000
- Revision:
- 0:a265079d50a2
Version 1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pramodnataraja | 0:a265079d50a2 | 1 | #ifndef VS1002_H |
pramodnataraja | 0:a265079d50a2 | 2 | #define VS1002_H |
pramodnataraja | 0:a265079d50a2 | 3 | |
pramodnataraja | 0:a265079d50a2 | 4 | #include "mbed.h" |
pramodnataraja | 0:a265079d50a2 | 5 | #include "SDFileSystem.h" |
pramodnataraja | 0:a265079d50a2 | 6 | #include "string" |
pramodnataraja | 0:a265079d50a2 | 7 | #include "string.h" |
pramodnataraja | 0:a265079d50a2 | 8 | #include "TextLCD.h" |
pramodnataraja | 0:a265079d50a2 | 9 | |
pramodnataraja | 0:a265079d50a2 | 10 | |
pramodnataraja | 0:a265079d50a2 | 11 | //SCI_MODE register bits as of p.26 of the datasheet |
pramodnataraja | 0:a265079d50a2 | 12 | #define SM_DIFF 0x0001 |
pramodnataraja | 0:a265079d50a2 | 13 | #define SM_SETTOZERO 0x0002 |
pramodnataraja | 0:a265079d50a2 | 14 | #define SM_RESET 0x0004 |
pramodnataraja | 0:a265079d50a2 | 15 | #define SM_OUTOFWAV 0x0008 |
pramodnataraja | 0:a265079d50a2 | 16 | #define SM_PDOWN 0x0010 |
pramodnataraja | 0:a265079d50a2 | 17 | #define SM_TESTS 0x0020 |
pramodnataraja | 0:a265079d50a2 | 18 | #define SM_STREAM 0x0040 |
pramodnataraja | 0:a265079d50a2 | 19 | #define SM_PLUSV 0x0080 |
pramodnataraja | 0:a265079d50a2 | 20 | #define SM_DACT 0x0100 |
pramodnataraja | 0:a265079d50a2 | 21 | #define SM_SDIORD 0x0200 |
pramodnataraja | 0:a265079d50a2 | 22 | #define SM_SDISHARE 0x0400 |
pramodnataraja | 0:a265079d50a2 | 23 | #define SM_SDINEW 0x0800 |
pramodnataraja | 0:a265079d50a2 | 24 | #define SM_ADPCM 0x1000 |
pramodnataraja | 0:a265079d50a2 | 25 | #define SM_ADPCM_HP 0x2000 |
pramodnataraja | 0:a265079d50a2 | 26 | |
pramodnataraja | 0:a265079d50a2 | 27 | extern int new_song_number; |
pramodnataraja | 0:a265079d50a2 | 28 | extern int volume_set; |
pramodnataraja | 0:a265079d50a2 | 29 | extern bool pause; |
pramodnataraja | 0:a265079d50a2 | 30 | extern bool mute; |
pramodnataraja | 0:a265079d50a2 | 31 | extern char * song_name[6]; |
pramodnataraja | 0:a265079d50a2 | 32 | |
pramodnataraja | 0:a265079d50a2 | 33 | |
pramodnataraja | 0:a265079d50a2 | 34 | class VS1002 { |
pramodnataraja | 0:a265079d50a2 | 35 | |
pramodnataraja | 0:a265079d50a2 | 36 | public: |
pramodnataraja | 0:a265079d50a2 | 37 | |
pramodnataraja | 0:a265079d50a2 | 38 | VS1002(PinName mmosi, PinName mmiso, PinName ssck, PinName ccs, const char *name, PinName mosi, PinName miso, PinName sck, PinName cs, PinName rst, PinName dreq, PinName dcs, PinName vol); |
pramodnataraja | 0:a265079d50a2 | 39 | |
pramodnataraja | 0:a265079d50a2 | 40 | void cs_low(void); |
pramodnataraja | 0:a265079d50a2 | 41 | void cs_high(void); |
pramodnataraja | 0:a265079d50a2 | 42 | void dcs_low(void); |
pramodnataraja | 0:a265079d50a2 | 43 | void dcs_high(void); |
pramodnataraja | 0:a265079d50a2 | 44 | void sci_en(void); |
pramodnataraja | 0:a265079d50a2 | 45 | void sci_dis(void); |
pramodnataraja | 0:a265079d50a2 | 46 | void sdi_en(void); |
pramodnataraja | 0:a265079d50a2 | 47 | void sdi_dis(void); |
pramodnataraja | 0:a265079d50a2 | 48 | |
pramodnataraja | 0:a265079d50a2 | 49 | void sci_initialise(void); |
pramodnataraja | 0:a265079d50a2 | 50 | void sdi_initialise(void); |
pramodnataraja | 0:a265079d50a2 | 51 | void reset(void); |
pramodnataraja | 0:a265079d50a2 | 52 | void power_down(void); |
pramodnataraja | 0:a265079d50a2 | 53 | |
pramodnataraja | 0:a265079d50a2 | 54 | void sci_write(unsigned char, unsigned short int); |
pramodnataraja | 0:a265079d50a2 | 55 | void sdi_write(unsigned char); |
pramodnataraja | 0:a265079d50a2 | 56 | unsigned short int read(unsigned short int); |
pramodnataraja | 0:a265079d50a2 | 57 | void sine_test_activate(unsigned char); |
pramodnataraja | 0:a265079d50a2 | 58 | void volume(signed int,signed int); |
pramodnataraja | 0:a265079d50a2 | 59 | void sine_test_deactivate(void); |
pramodnataraja | 0:a265079d50a2 | 60 | void play_song(int); |
pramodnataraja | 0:a265079d50a2 | 61 | |
pramodnataraja | 0:a265079d50a2 | 62 | int num_of_files; |
pramodnataraja | 0:a265079d50a2 | 63 | |
pramodnataraja | 0:a265079d50a2 | 64 | DigitalIn _DREQ; |
pramodnataraja | 0:a265079d50a2 | 65 | DigitalOut _RST; |
pramodnataraja | 0:a265079d50a2 | 66 | AnalogIn _VOL; |
pramodnataraja | 0:a265079d50a2 | 67 | |
pramodnataraja | 0:a265079d50a2 | 68 | protected: |
pramodnataraja | 0:a265079d50a2 | 69 | |
pramodnataraja | 0:a265079d50a2 | 70 | SPI _spi; |
pramodnataraja | 0:a265079d50a2 | 71 | DigitalOut _CS; |
pramodnataraja | 0:a265079d50a2 | 72 | DigitalOut _DCS; |
pramodnataraja | 0:a265079d50a2 | 73 | SDFileSystem _sd; |
pramodnataraja | 0:a265079d50a2 | 74 | |
pramodnataraja | 0:a265079d50a2 | 75 | }; |
pramodnataraja | 0:a265079d50a2 | 76 | #endif |