for Airio-Base. Mass Storage class program for editting FlashAir.

Dependencies:   mbed USBMSD_SD USBDevice

Airio-Baseをマスストレージクラスにし、簡易的なSDカードリーダにすることでFlashAir(等SDカード)内のファイルをPCから読み書きするためのサンプルコードです。

準備

  • SDカードコネクタにFlashAirを装着しておく

SWスイッチ動作

SWを押しながらPCへ接続、もしくはSWを押しながらRESET押下するとPC側からはSDカードリーダーライタとして認識します。 リーダーライタモードにならなかった場合は、Airio-BaseのLED1点滅が点滅動作します。

ISPスイッチ動作

特にありません。

Files at this revision

API Documentation at this revision

Comitter:
mbed_crane_elec
Date:
Wed Jan 16 10:59:04 2019 +0000
Commit message:
1st release.

Changed in this revision

USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
USBMSD_SD.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
diff -r 000000000000 -r bd47776a2506 USBDevice.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Wed Jan 16 10:59:04 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/USBDevice/#53949e6131f6
diff -r 000000000000 -r bd47776a2506 USBMSD_SD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBMSD_SD.lib	Wed Jan 16 10:59:04 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/switches/code/USBMSD_SD/#cce1e689c548
diff -r 000000000000 -r bd47776a2506 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jan 16 10:59:04 2019 +0000
@@ -0,0 +1,63 @@
+#include "mbed.h"
+#include "USBMSD_SD.h"
+  
+//-------------------------------------------------------------------------------
+//Port Settings
+DigitalOut led1(LED1,1);
+DigitalOut led2(P1_13,1);
+//DigitalOut USB_CONNECT(P0_6,0);
+DigitalIn sw(P1_20);
+DigitalIn isp(P0_1);
+DigitalOut sd_en(P1_16, 1);//SD card power on/off control port. and ON default.
+//DigitalIn sd_dat3(P0_17); // 0x10
+//DigitalIn sd_dat2(P1_22); // 0x08
+//DigitalIn sd_dat1(P1_14); // 0x04
+//DigitalIn sd_dat0(P0_22); // 0x02
+//DigitalIn sd_cmd(P0_21);  // 0x01
+ 
+//-------------------------------------------------------------------------------
+//
+//USBMSD_SD sd(P0_21, P0_22, P1_15, P0_17);
+
+ 
+//-------------------------------------------------------------------------------
+//
+int main()
+{
+    led1 = 1;//OFF
+    led2 = 1;//OFF
+    wait(0.1);
+    
+    //Mass storage mode
+    if(sw == 0)
+    {
+        USBMSD_SD *sd = new USBMSD_SD(P0_21, P0_22, P1_15, P0_17);
+        //loop
+        while(1)
+        {
+            led2 = 0;
+            wait(0.5);
+            led2 = 1;
+            wait(0.5);
+        }
+    }
+
+    //Main program
+    while(1)
+    {
+        led1 = 0;
+        wait(0.2);
+        led1 = 1;
+        wait(0.2);
+        
+        if(sw == 0)
+        {
+            //
+        }
+        
+        if(isp == 0)
+        {
+            //
+        }
+    }
+}
diff -r 000000000000 -r bd47776a2506 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jan 16 10:59:04 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file