A very basic WAV player for FRDM boards. Does not work with MBED RTOS however.

Dependencies:   SDFileSystem mbed wave_player

Files at this revision

API Documentation at this revision

Comitter:
uhclem
Date:
Mon Apr 30 12:42:55 2018 +0000
Commit message:
A working SD card WAV player for the FRDM-K64F

Changed in this revision

SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
wave_player.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Mon Apr 30 12:42:55 2018 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/neilt6/code/SDFileSystem/#923df4ee70c4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Apr 30 12:42:55 2018 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+#include "SDFileSystem.h"
+#include <wave_player.h>
+
+#define PC_BAUD   9600
+
+SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd", PTE6, SDFileSystem::SWITCH_POS_NO, 25000000);
+Serial pc(USBTX,USBRX);
+
+AnalogOut DACout(DAC0_OUT);
+wave_player waver(&DACout);
+
+
+int main() 
+{
+    //Configure CRC, small frames, and write validation
+    sd.crc(true);
+    sd.large_frames(false);     // SPI 16 bits not supported ???  
+    sd.write_validation(true);
+    
+    //waver.set_verbosity(1);
+    FILE *wave_file;
+    pc.baud(PC_BAUD);
+    printf("\n\r\n\rGoing to open a file...\n\r");
+    wave_file=fopen("/sd/sp.wav","r");
+    printf("Opened a file. Will now play.\n\r");
+    waver.play(wave_file);
+    printf("Did it play?\n\r");
+    fclose(wave_file); 
+}
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Apr 30 12:42:55 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/aae6fcc7d9bb
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wave_player.lib	Mon Apr 30 12:42:55 2018 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/sravet/code/wave_player/#acc3e18e77ad