SD-Card Control Program / Using Micro-SD / based on SDCardTest Program (http://mbed.org/users/simon/programs/SDCardTest/gpdz4x/)

Dependencies:   mbed SDFileSystem

Please refer following my Notebook page.
/users/kenjiArai/notebook/sd-card-control-new/#

Revision:
3:2134d3cb4e8e
Parent:
2:1397a54382ec
Child:
4:fc36c8ec2966
--- a/main.cpp	Sat Apr 07 01:29:41 2018 +0000
+++ b/main.cpp	Tue Jun 04 11:28:09 2019 +0000
@@ -1,12 +1,19 @@
 /*
  * Mbed Application program
- *  SD Card file control function with FatFs on Mbed-os5 or os2
+ *  SD Card file control function with FatFs on Mbed-os5 and/or os2
  *
- * Copyright (c) 2018 Kenji Arai / JH1PJL
+ * Copyright (c) 2018,19 Kenji Arai / JH1PJL
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      4th, 2018
- *      Revised:    April      7th, 2018
+ *      Revised:    June       6th, 2019
+ *
+ *  os2 release version 165 / Feb. 20, 2019
+ *  os5.12.4  / Jun. 2, 2019
+ *  
+ *  Tested board
+ *      Nucleo-F446RE, Nucleo-F411RE, Nucleo-F401RE
+ *      Nucleo-L476RG, Nucleo-L152RE
  */
 
 //  Include --------------------------------------------------------------------
@@ -30,7 +37,7 @@
 #if (MBED_MAJOR_VERSION == 2)
 SDFileSystem    sd(D11, D12, D13, D10, "fs");  // do,di,clk,cs
 #elif (MBED_MAJOR_VERSION == 5)
-SDBlockDevice   sd(D11, D12, D13, D10, 8000000);
+SDBlockDevice   sd(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, 8000000);
 FATFileSystem   fs("fs");
 #endif
 
@@ -59,9 +66,8 @@
     uint32_t data4 = 50000U;
     uint32_t data5 = 60000U;
 
-    if (user_sw == USER_SW_ON) {
-        mon();
-    }
+
+    pc.printf("Start SD Card control program\r\n");
     //pc.printf("line:%d\r\n", __LINE__);
 #if (MBED_MAJOR_VERSION == 5)
     /* Init SD CARD reader */
@@ -92,7 +98,7 @@
             pc.printf("%08d;%08d;%08d;%08d;%08d;%08d\r\n",
                       ++data0, ++data1, ++data2, ++data3, ++data4, ++data5);
             fprintf(fp, "%08d;%08d;%08d;%08d;%08d;%08d\r\n",
-                        data0,   data1,   data2,   data3,   data4,   data5);
+                    data0,   data1,   data2,   data3,   data4,   data5);
         } else {
             pc.printf("ERROR\r\n");
         }
@@ -100,7 +106,7 @@
 #if (MBED_MAJOR_VERSION == 2)
         wait(0.1f);
 #elif (MBED_MAJOR_VERSION == 5)
-        Thread::wait(100);
+        ThisThread::sleep_for(100);
 #endif
         if (user_sw == USER_SW_ON) {
             break;