NuMaker audio playback

Revision:
4:0b5c342628ff
Parent:
1:c3f10403b3db
Child:
5:492ea7d38e59
--- a/main.cpp	Fri Mar 03 17:33:23 2017 +0800
+++ b/main.cpp	Fri Mar 03 17:54:37 2017 +0800
@@ -12,7 +12,7 @@
 NAU8822L audio(PD_4, PD_5, 0x1A, PA_5, PA_6, PA_7, PD_0, PA_4); // NAU8822L object
 DigitalOut hp_enable(PE_1);
 #endif
-Serial output(USBTX, USBRX);
+
 InterruptIn button(SW2);    // button SW2
 DigitalOut led(LED1);       // flashing LED1(rgbled1)
 
@@ -73,9 +73,6 @@
 int main(void) {
     led = 1;
     
-    // sets the console baud-rate
-    output.baud(115200);
-    
     // disable headphone
     hp_enable = 1;
     
@@ -83,7 +80,7 @@
 #if defined(TARGET_NUMAKER_PFM_NUC472)
     fp = fopen("/sd/test.pcm", "r");
     if (fp == NULL) {
-        output.printf("Error opening file!\n");
+        perror("Error opening file!\n");
         return -1;
     }
     
@@ -93,7 +90,7 @@
 #endif
     audio.attach(&playback);
     
-    output.printf("Start playing...\n");
+    printf("Start playing...\n");
     audio.start();
     
     // enable headphone
@@ -101,7 +98,7 @@
     
     fillAudioBuf();
     
-    output.printf("Stop playing.\n");
+    printf("Stop playing.\n");
     audio.stop();
     
     led = 0;