USBMSD_SD HelloWorld for FRDM-KL25Z

Dependencies:   SDFileSystem USBDevice USBMSD_SD mbed wave_player wavfile

Fork of USBMSD_SD_HelloWorld_FRDM-KL25Z by Samuel Mokrani

Files at this revision

API Documentation at this revision

Comitter:
cstevens
Date:
Wed May 01 10:40:52 2013 +0000
Parent:
0:44b579c983e0
Commit message:
sd reader

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
wave_player.lib Show annotated file Show diff for this revision Revisions of this file
wavfile.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 44b579c983e0 -r 82ab86e5f918 SDFileSystem.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Wed May 01 10:40:52 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/SDFileSystem/#c8f66dc765d4
diff -r 44b579c983e0 -r 82ab86e5f918 main.cpp
--- a/main.cpp	Fri Mar 01 13:29:13 2013 +0000
+++ b/main.cpp	Wed May 01 10:40:52 2013 +0000
@@ -1,8 +1,51 @@
 #include "mbed.h"
 #include "USBMSD_SD.h"
+#include "SDFileSystem.h"
+#include "wave_player.h"
  
-USBMSD_SD sd(PTD2, PTD3, PTD1, PTD0);
+AnalogOut DACout(PTE30);
+wave_player waver(&DACout);
+DigitalOut BLUE(LED1);
+ 
+//USBMSD_SD sd(PTD2, PTD3, PTD1, PTD0);
+ SDFileSystem sd(PTD2,PTD3, PTD1, PTD0 ,"sd"); 
  
 int main() {
-    while(1);
+BLUE=1;
+wait(1);
+printf("Hello World!\n");   
+ 
+    mkdir("/sd/mydir", 0777);
+    
+    FILE *fp = fopen("/sd/mydir/sdtest2.txt", "a");
+    if(fp == NULL) {
+        error("Could not open file for write\n");
+    }
+    fprintf(fp, "Hello fun SD Card World!");
+    fclose(fp); 
+ 
+    printf("Goodbye World!\n\r");
+    int i,j;
+    for(j=0;j<6400;j++){
+    for(i=1;i<64768;i=i+12000){
+    DACout.write_u16(i);
+    wait_us(100);
+    }
+    }
+    
+     FILE *wave_file;
+ 
+ printf("\n\n\nHello, wave world!\n\r");
+ BLUE=0;
+ wave_file=fopen("/sd/st.wav","r");
+ BLUE=1;
+ if(wave_file == NULL)
+ {printf("\n\r couldn't open st.wav\n\r");}
+ waver.set_verbosity(0);
+ waver.play(wave_file);
+ printf("\n\n\r Finished.....\n\r");
+ fclose(wave_file);
+    
+    
+while(1);
 }
\ No newline at end of file
diff -r 44b579c983e0 -r 82ab86e5f918 wave_player.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wave_player.lib	Wed May 01 10:40:52 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/cstevens/code/wave_player/#8bc1cfb9ea78
diff -r 44b579c983e0 -r 82ab86e5f918 wavfile.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wavfile.lib	Wed May 01 10:40:52 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/shintamainjp/code/wavfile/#c853ba46d0b9