music player, led, motor
Dependencies: LSM9DS1_Library_cal RPCInterface final mbed
Fork of final_mbed by
VS1002.h@2:55495227fcca, 2017-05-01 (annotated)
- Committer:
- mikebenq
- Date:
- Mon May 01 11:05:37 2017 +0000
- Revision:
- 2:55495227fcca
- Parent:
- 1:f54bee9d59de
Final_mbed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mikebenq | 1:f54bee9d59de | 1 | #ifndef VS1002_H |
mikebenq | 1:f54bee9d59de | 2 | #define VS1002_H |
mikebenq | 1:f54bee9d59de | 3 | |
mikebenq | 1:f54bee9d59de | 4 | #include "mbed.h" |
mikebenq | 1:f54bee9d59de | 5 | #include "SDFileSystem.h" |
mikebenq | 1:f54bee9d59de | 6 | #include "string" |
mikebenq | 1:f54bee9d59de | 7 | #include "string.h" |
mikebenq | 1:f54bee9d59de | 8 | //#include "TextLCD.h" |
mikebenq | 1:f54bee9d59de | 9 | |
mikebenq | 1:f54bee9d59de | 10 | |
mikebenq | 1:f54bee9d59de | 11 | //SCI_MODE register bits as of p.26 of the datasheet |
mikebenq | 1:f54bee9d59de | 12 | #define SM_DIFF 0x0001 |
mikebenq | 1:f54bee9d59de | 13 | #define SM_SETTOZERO 0x0002 |
mikebenq | 1:f54bee9d59de | 14 | #define SM_RESET 0x0004 |
mikebenq | 1:f54bee9d59de | 15 | #define SM_OUTOFWAV 0x0008 |
mikebenq | 1:f54bee9d59de | 16 | #define SM_PDOWN 0x0010 |
mikebenq | 1:f54bee9d59de | 17 | #define SM_TESTS 0x0020 |
mikebenq | 1:f54bee9d59de | 18 | #define SM_STREAM 0x0040 |
mikebenq | 1:f54bee9d59de | 19 | #define SM_PLUSV 0x0080 |
mikebenq | 1:f54bee9d59de | 20 | #define SM_DACT 0x0100 |
mikebenq | 1:f54bee9d59de | 21 | #define SM_SDIORD 0x0200 |
mikebenq | 1:f54bee9d59de | 22 | #define SM_SDISHARE 0x0400 |
mikebenq | 1:f54bee9d59de | 23 | #define SM_SDINEW 0x0800 |
mikebenq | 1:f54bee9d59de | 24 | #define SM_ADPCM 0x1000 |
mikebenq | 1:f54bee9d59de | 25 | #define SM_ADPCM_HP 0x2000 |
mikebenq | 1:f54bee9d59de | 26 | |
mikebenq | 1:f54bee9d59de | 27 | extern int new_song_number; |
mikebenq | 1:f54bee9d59de | 28 | extern int volume_set; |
mikebenq | 1:f54bee9d59de | 29 | extern bool pause; |
mikebenq | 1:f54bee9d59de | 30 | extern bool mute; |
mikebenq | 1:f54bee9d59de | 31 | extern char * song_name[6]; |
mikebenq | 1:f54bee9d59de | 32 | |
mikebenq | 1:f54bee9d59de | 33 | |
mikebenq | 1:f54bee9d59de | 34 | class VS1002 { |
mikebenq | 1:f54bee9d59de | 35 | |
mikebenq | 1:f54bee9d59de | 36 | public: |
mikebenq | 1:f54bee9d59de | 37 | |
mikebenq | 1:f54bee9d59de | 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); |
mikebenq | 1:f54bee9d59de | 39 | |
mikebenq | 1:f54bee9d59de | 40 | void cs_low(void); |
mikebenq | 1:f54bee9d59de | 41 | void cs_high(void); |
mikebenq | 1:f54bee9d59de | 42 | void dcs_low(void); |
mikebenq | 1:f54bee9d59de | 43 | void dcs_high(void); |
mikebenq | 1:f54bee9d59de | 44 | void sci_en(void); |
mikebenq | 1:f54bee9d59de | 45 | void sci_dis(void); |
mikebenq | 1:f54bee9d59de | 46 | void sdi_en(void); |
mikebenq | 1:f54bee9d59de | 47 | void sdi_dis(void); |
mikebenq | 1:f54bee9d59de | 48 | |
mikebenq | 1:f54bee9d59de | 49 | void sci_initialise(void); |
mikebenq | 1:f54bee9d59de | 50 | void sdi_initialise(void); |
mikebenq | 1:f54bee9d59de | 51 | void reset(void); |
mikebenq | 1:f54bee9d59de | 52 | void power_down(void); |
mikebenq | 1:f54bee9d59de | 53 | |
mikebenq | 1:f54bee9d59de | 54 | void sci_write(unsigned char, unsigned short int); |
mikebenq | 1:f54bee9d59de | 55 | void sdi_write(unsigned char); |
mikebenq | 1:f54bee9d59de | 56 | unsigned short int read(unsigned short int); |
mikebenq | 1:f54bee9d59de | 57 | void sine_test_activate(unsigned char); |
mikebenq | 1:f54bee9d59de | 58 | void volume(signed int,signed int); |
mikebenq | 1:f54bee9d59de | 59 | void sine_test_deactivate(void); |
mikebenq | 1:f54bee9d59de | 60 | void play_song(int); |
mikebenq | 1:f54bee9d59de | 61 | |
mikebenq | 1:f54bee9d59de | 62 | int num_of_files; |
mikebenq | 1:f54bee9d59de | 63 | |
mikebenq | 1:f54bee9d59de | 64 | DigitalIn _DREQ; |
mikebenq | 1:f54bee9d59de | 65 | DigitalOut _RST; |
mikebenq | 1:f54bee9d59de | 66 | AnalogIn _VOL; |
mikebenq | 1:f54bee9d59de | 67 | |
mikebenq | 1:f54bee9d59de | 68 | protected: |
mikebenq | 1:f54bee9d59de | 69 | |
mikebenq | 1:f54bee9d59de | 70 | SPI _spi; |
mikebenq | 1:f54bee9d59de | 71 | DigitalOut _CS; |
mikebenq | 1:f54bee9d59de | 72 | DigitalOut _DCS; |
mikebenq | 1:f54bee9d59de | 73 | SDFileSystem _sd; |
mikebenq | 1:f54bee9d59de | 74 | |
mikebenq | 1:f54bee9d59de | 75 | }; |
mikebenq | 1:f54bee9d59de | 76 | #endif |