NuMaker audio playback

Files at this revision

API Documentation at this revision

Comitter:
SHLIU1@OANBE02333.nuvoton.com
Date:
Thu Feb 25 16:19:36 2021 +0800
Parent:
19:53f41f3ebd56
Commit message:
Support the both V5.X and V6.X for mbed-os

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 53f41f3ebd56 -r df54b4c86862 main.cpp
--- a/main.cpp	Thu Feb 25 14:18:23 2021 +0800
+++ b/main.cpp	Thu Feb 25 16:19:36 2021 +0800
@@ -201,7 +201,12 @@
     }
 #elif defined(TARGET_NUMAKER_PFM_M453)
     while (1) {
+#if MBED_MAJOR_VERSION >= 6
+	ThisThread::sleep_for(500);
+#else
         Thread::wait(500);
+#endif
+
         printf("fill\r\n");
     }
 #elif defined(TARGET_NUMAKER_PFM_M487)
@@ -218,7 +223,11 @@
     }
 #elif defined(TARGET_NUMAKER_PFM_NANO130)
     while (1) {
+#if MBED_MAJOR_VERSION >= 6
+	ThisThread::sleep_for(500);
+#else
         Thread::wait(500);
+#endif
         printf("fill\r\n");
     }
 #elif defined(TARGET_NUMAKER_IOT_M487)
@@ -258,7 +267,11 @@
     }
 #elif defined(TARGET_NUMAKER_PFM_M453)
     while (flag == 0) {
+#if MBED_MAJOR_VERSION >= 6
+	ThisThread::sleep_for(500);
+#else
         Thread::wait(500);
+#endif
     }
 #elif defined(TARGET_NUMAKER_PFM_M487)
     int i = 0;
@@ -281,7 +294,11 @@
     }
 #elif defined(TARGET_NUMAKER_PFM_NANO130)
     while (flag == 0) {
+#if MBED_MAJOR_VERSION >= 6
+	ThisThread::sleep_for(500);
+#else
         Thread::wait(500);
+#endif
     }
 #elif defined(TARGET_NUMAKER_IOT_M487)
     int i = 0;
@@ -409,7 +426,11 @@
     audio.loopback();
     
     while (1) {
+#if MBED_MAJOR_VERSION >= 6
+	ThisThread::sleep_for(500);
+#else
         Thread::wait(500);
+#endif
         printf("loopback\r\n");
     }
     
@@ -422,7 +443,9 @@
 
 int main(void) {
     led = 1;
-    
+#ifdef MBED_MAJOR_VERSION
+    printf("Mbed OS version %d.%d.%d\r\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
+#endif    
     button.rise(&flip);
     
 #if defined(TARGET_NUMAKER_PFM_NUC472) || defined(TARGET_NUMAKER_PFM_M487) || defined(TARGET_NUMAKER_IOT_M487)