![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
News_Reader
Dependencies: FatFileSystem HTTPClient NetServices RPG SDFileSystem TextLCD mbed spxml
Fork of Arduino_MP3_Shield_MP3Player_UI by
VS1002.h@2:447591cbba27, 2013-03-06 (annotated)
- Committer:
- cwang365
- Date:
- Wed Mar 06 00:37:29 2013 +0000
- Revision:
- 2:447591cbba27
- Parent:
- 0:9cb0b3d1b9e6
lab3_news_reader
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mpetersen3 | 0:9cb0b3d1b9e6 | 1 | #ifndef VS1002_H |
mpetersen3 | 0:9cb0b3d1b9e6 | 2 | #define VS1002_H |
mpetersen3 | 0:9cb0b3d1b9e6 | 3 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 4 | //#define FS_ONLY |
mpetersen3 | 0:9cb0b3d1b9e6 | 5 | #define FIXED_VOL |
mpetersen3 | 0:9cb0b3d1b9e6 | 6 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 7 | #include "mbed.h" |
mpetersen3 | 0:9cb0b3d1b9e6 | 8 | #include "SDFileSystem.h" |
mpetersen3 | 0:9cb0b3d1b9e6 | 9 | #include "string" |
mpetersen3 | 0:9cb0b3d1b9e6 | 10 | #include "string.h" |
mpetersen3 | 0:9cb0b3d1b9e6 | 11 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 12 | //SCI_MODE register bits as of p.26 of the datasheet |
mpetersen3 | 0:9cb0b3d1b9e6 | 13 | #define SM_DIFF 0x0001 |
mpetersen3 | 0:9cb0b3d1b9e6 | 14 | #define SM_SETTOZERO 0x0002 |
mpetersen3 | 0:9cb0b3d1b9e6 | 15 | #define SM_RESET 0x0004 |
mpetersen3 | 0:9cb0b3d1b9e6 | 16 | #define SM_OUTOFWAV 0x0008 |
mpetersen3 | 0:9cb0b3d1b9e6 | 17 | #define SM_PDOWN 0x0010 |
mpetersen3 | 0:9cb0b3d1b9e6 | 18 | #define SM_TESTS 0x0020 |
mpetersen3 | 0:9cb0b3d1b9e6 | 19 | #define SM_STREAM 0x0040 |
mpetersen3 | 0:9cb0b3d1b9e6 | 20 | #define SM_PLUSV 0x0080 |
mpetersen3 | 0:9cb0b3d1b9e6 | 21 | #define SM_DACT 0x0100 |
mpetersen3 | 0:9cb0b3d1b9e6 | 22 | #define SM_SDIORD 0x0200 |
mpetersen3 | 0:9cb0b3d1b9e6 | 23 | #define SM_SDISHARE 0x0400 |
mpetersen3 | 0:9cb0b3d1b9e6 | 24 | #define SM_SDINEW 0x0800 |
mpetersen3 | 0:9cb0b3d1b9e6 | 25 | #define SM_ADPCM 0x1000 |
mpetersen3 | 0:9cb0b3d1b9e6 | 26 | #define SM_ADPCM_HP 0x2000 |
mpetersen3 | 0:9cb0b3d1b9e6 | 27 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 28 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 29 | class VS1002 { |
mpetersen3 | 0:9cb0b3d1b9e6 | 30 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 31 | public: |
mpetersen3 | 0:9cb0b3d1b9e6 | 32 | // VS1002(int _mmosi, int _mmiso, int _ssck, int _ccs, const char* _name, |
mpetersen3 | 0:9cb0b3d1b9e6 | 33 | // int _mosi, int _miso, int _sck, int _cs, int _rst, int _dreq, int _dcs, int _vol); |
mpetersen3 | 0:9cb0b3d1b9e6 | 34 | VS1002(PinName _mmosi, PinName _mmiso, PinName _ssck, PinName _ccs, const char* _name, |
mpetersen3 | 0:9cb0b3d1b9e6 | 35 | PinName _mosi, PinName _miso, PinName _sck, PinName _cs, PinName _rst, PinName _dreq, |
mpetersen3 | 0:9cb0b3d1b9e6 | 36 | PinName _dcs, PinName _vol); |
mpetersen3 | 0:9cb0b3d1b9e6 | 37 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 38 | void cs_low(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 39 | void cs_high(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 40 | void dcs_low(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 41 | void dcs_high(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 42 | void sci_en(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 43 | void sci_dis(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 44 | void sdi_en(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 45 | void sdi_dis(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 46 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 47 | void sci_initialise(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 48 | void sdi_initialise(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 49 | void reset(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 50 | void power_down(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 51 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 52 | void sci_write(unsigned char, unsigned short int); |
mpetersen3 | 0:9cb0b3d1b9e6 | 53 | void sdi_write(unsigned char); |
mpetersen3 | 0:9cb0b3d1b9e6 | 54 | unsigned short int read(unsigned short int); |
mpetersen3 | 0:9cb0b3d1b9e6 | 55 | void sine_test_activate(unsigned char); |
mpetersen3 | 0:9cb0b3d1b9e6 | 56 | void volume(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 57 | void sine_test_deactivate(void); |
mpetersen3 | 0:9cb0b3d1b9e6 | 58 | void play_song(int); |
mpetersen3 | 0:9cb0b3d1b9e6 | 59 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 60 | int num_of_files; |
mpetersen3 | 0:9cb0b3d1b9e6 | 61 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 62 | DigitalIn _DREQ; |
mpetersen3 | 0:9cb0b3d1b9e6 | 63 | DigitalOut _RST; |
mpetersen3 | 0:9cb0b3d1b9e6 | 64 | AnalogIn _VOL; |
mpetersen3 | 0:9cb0b3d1b9e6 | 65 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 66 | protected: |
mpetersen3 | 0:9cb0b3d1b9e6 | 67 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 68 | SPI _spi; |
mpetersen3 | 0:9cb0b3d1b9e6 | 69 | DigitalOut _CS; |
mpetersen3 | 0:9cb0b3d1b9e6 | 70 | DigitalOut _DCS; |
mpetersen3 | 0:9cb0b3d1b9e6 | 71 | SDFileSystem _sd; |
mpetersen3 | 0:9cb0b3d1b9e6 | 72 | |
mpetersen3 | 0:9cb0b3d1b9e6 | 73 | }; |
mpetersen3 | 0:9cb0b3d1b9e6 | 74 | #endif |