Demo of Embedded Artists LPCXpresso baseboard SD card reader and audio facilities. Updated to put wav file player in a separate library and use the high capacity SD card library provided by Klaus Bu.

Dependencies:   mbed

Committer:
tom_coxon
Date:
Sun Jul 25 17:51:19 2010 +0000
Revision:
2:affcc36a50b4
Parent:
1:22c43c468a2f

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tom_coxon 0:1f4b7aa80ab3 1 /*
tom_coxon 1:22c43c468a2f 2 Demo of Embedded Artists LPCXpresso baseboard SD card reader and audio facilities.
tom_coxon 0:1f4b7aa80ab3 3
tom_coxon 2:affcc36a50b4 4 By Tom Coxon
tom_coxon 2:affcc36a50b4 5
tom_coxon 2:affcc36a50b4 6 Based on WAVEplayer by Vlad Cazan/Stephan Rochon modified by Tom Coxon to:
tom_coxon 2:affcc36a50b4 7
tom_coxon 2:affcc36a50b4 8 1. Run correctly on the Embedded Artists LPCXpresso baseboard.
tom_coxon 2:affcc36a50b4 9 2. To play 8 bit sample size in addition to original 16 bit
tom_coxon 2:affcc36a50b4 10 3. To be more fault tolerant when playing wav files.
tom_coxon 2:affcc36a50b4 11
tom_coxon 2:affcc36a50b4 12 Place suitable uncompressed wav files with 8 or 16 bit sample sizes on the SD card and ensure the
tom_coxon 2:affcc36a50b4 13 file names are 8.3 format. Then change the main method below to the relevant file paths.
tom_coxon 2:affcc36a50b4 14
tom_coxon 1:22c43c468a2f 15 Please set all jumpers on board to the default case except for the following:
tom_coxon 2:affcc36a50b4 16
tom_coxon 0:1f4b7aa80ab3 17 Audio setup:
tom_coxon 2:affcc36a50b4 18
tom_coxon 2:affcc36a50b4 19 1. Insert a jumper in J31 to connect signal PIO1_2 to the low
tom_coxon 2:affcc36a50b4 20 pass filer as described in section 4.7.2. of base board users
tom_coxon 0:1f4b7aa80ab3 21 guide.
tom_coxon 2:affcc36a50b4 22
tom_coxon 2:affcc36a50b4 23 2. Insert three jumpers in J33 to connect PIO3_0, PIO3_1 and
tom_coxon 0:1f4b7aa80ab3 24 PIO3_2 to control the amplifier as described in section 4.8
tom_coxon 0:1f4b7aa80ab3 25 of base board users guide.
tom_coxon 0:1f4b7aa80ab3 26
tom_coxon 0:1f4b7aa80ab3 27 3. Insert a jumper in J32 and remove any from J34 to use the
tom_coxon 0:1f4b7aa80ab3 28 internal speaker as described in section 4.8
tom_coxon 0:1f4b7aa80ab3 29 of base board users guide.
tom_coxon 0:1f4b7aa80ab3 30
tom_coxon 0:1f4b7aa80ab3 31 SD Card setup:
tom_coxon 2:affcc36a50b4 32
tom_coxon 0:1f4b7aa80ab3 33 4. Insert all five jumpers in J39 as described in section 4.3.3
tom_coxon 0:1f4b7aa80ab3 34 of base board users guide.
tom_coxon 2:affcc36a50b4 35
tom_coxon 2:affcc36a50b4 36 5. Remove jumper marked "A" in J55 In order to connect PIO1_11
tom_coxon 0:1f4b7aa80ab3 37 to CS signal of J40 (the SPI-SSEL signal) as described in section 4.3.3
tom_coxon 0:1f4b7aa80ab3 38 of base board users guide.
tom_coxon 0:1f4b7aa80ab3 39 */
tom_coxon 0:1f4b7aa80ab3 40
tom_coxon 0:1f4b7aa80ab3 41 #include "mbed.h"
tom_coxon 2:affcc36a50b4 42 #include "wavplayer.h"
tom_coxon 2:affcc36a50b4 43 #include "SDHCFileSystem.h"
tom_coxon 0:1f4b7aa80ab3 44
tom_coxon 0:1f4b7aa80ab3 45 DigitalOut led1(LED1);
tom_coxon 0:1f4b7aa80ab3 46 DigitalOut led4(LED4);
tom_coxon 2:affcc36a50b4 47
tom_coxon 0:1f4b7aa80ab3 48 SDFileSystem sd(p5, p6, p7, p24, "sd");
tom_coxon 0:1f4b7aa80ab3 49
tom_coxon 2:affcc36a50b4 50 int main() {
tom_coxon 0:1f4b7aa80ab3 51
tom_coxon 2:affcc36a50b4 52 WavPlayer myWavPlayer;
tom_coxon 0:1f4b7aa80ab3 53
tom_coxon 2:affcc36a50b4 54 led1 = 1 ;
tom_coxon 2:affcc36a50b4 55 printf("\r\n--------------- Starting -----------------\r\n");
tom_coxon 0:1f4b7aa80ab3 56
tom_coxon 2:affcc36a50b4 57 myWavPlayer.play_wave("/sd/startup.wav"); // 8 bit sample size
tom_coxon 0:1f4b7aa80ab3 58
tom_coxon 2:affcc36a50b4 59 myWavPlayer.play_wave("/sd/baddonut.wav"); // 16 bit sample size
tom_coxon 0:1f4b7aa80ab3 60
tom_coxon 2:affcc36a50b4 61 myWavPlayer.play_wave("/sd/dduck.wav"); // 8 bit sample size
tom_coxon 0:1f4b7aa80ab3 62
tom_coxon 2:affcc36a50b4 63 myWavPlayer.play_wave("/sd/bbunny.wav"); // 8 bit sample size
tom_coxon 0:1f4b7aa80ab3 64
tom_coxon 0:1f4b7aa80ab3 65 printf("<<<<<<<<<<<<<<<< All done >>>>>>>>>>>>>>>>\r\n");
tom_coxon 2:affcc36a50b4 66 led1 = 0;
tom_coxon 2:affcc36a50b4 67 led4 = 1;
tom_coxon 0:1f4b7aa80ab3 68 }