for Airio-Base. SD card power on/off test program.

Dependencies:   mbed

Code URL

https://os.mbed.com/users/mbed_crane_elec/code/Airio-Base_SD_power_test/

Airio-Baseで SDカード電源のON/OFF制御をするサンプルコードです。

準備

  • FlashAirをSDカードソケットへ接続

SWスイッチ動作

LED2が点灯し、カードへの電源供給を開始(ON)します。

ISPスイッチ動作

LED2が消灯し、カードへの電源供給を停止(OFF)します。

コードについて

Airio-Baseのポート番号P1_16は、SDカードソケットの電源制御用のIC(AP2281)に接続されています。 これは、サンプルコード

DigitalOut sd_en(P1_16, 0);//SD card power on/off control port. and OFF default.

で定義されており、出力デジタルポートでHigh/LowがON/OFFに相当しSDカードへの電源供給を制御します。

FlashAirの電源確認

LED2点灯時に、スマートフォンなどからFlashAirにアクセスできることを確認して下さい。 また、LED2消灯時は、FlashAirにアクセスできないことを確認して下さい。

このカード電源の制御機能は、バッテリー駆動用途などの消費電力を抑える必要がある場合に有効です。

Files at this revision

API Documentation at this revision

Comitter:
mbed_crane_elec
Date:
Thu Aug 09 04:21:09 2018 +0000
Commit message:
1st release.

Changed in this revision

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Aug 09 04:21:09 2018 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+//-------------------------------------------------------------------------------
+//Port Settings
+DigitalOut led1(P0_7,1);
+DigitalOut led2(P1_13,1);
+
+DigitalOut sd_en(P1_16, 0);//SD card power on/off control port. and OFF 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
+
+DigitalIn sw(P1_20);
+DigitalIn isp(P0_1);
+
+//-------------------------------------------------------------------------------
+//Program
+int main()
+{
+    while(1)
+    {
+        // Button "SW" function
+        if(sw == 0)
+        {
+            sd_en = 1;//SD card power turn ON
+            led2 = 0;//LED2 turn ON
+        }    
+        
+        // Button "ISP" function
+        if(isp == 0)
+        {
+            sd_en = 0;//SD card power turn OFF
+            led2 = 1;//LED2 turn OFF
+        }    
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Aug 09 04:21:09 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a7c7b631e539
\ No newline at end of file