Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed ADT7410 FlashAir_iSDIO SDFileSystem USBDevice
Diff: main.cpp
- Revision:
- 0:35b67da566e1
- Child:
- 1:8aaee4f08dbc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Aug 29 06:41:34 2018 +0000
@@ -0,0 +1,102 @@
+/* FlashAir iSDIO sample
+ * Copyright (C) 2018 by Junichi SHIBA, PIAX Inc.
+ *
+ * This file is a FlashAir iSDIO sample program code
+ * Released under the BSD 2-Clause license.
+ * http://flashair-developers.com/documents/license.html
+ */
+#include "mbed.h"
+#include "FlashAir_iSDIO.h"
+
+//#define SD_iSDIO FlashAir_iSDIO
+
+#if defined(TARGET_LPC11U24)
+FlashAir_iSDIO sd(p11, p12, p13, p14, "sd"); // MOSI, MISO, SCLK, SSEL
+#elif defined(TARGET_LPC1114)
+FlashAir_iSDIO sd(p11, p12, p13, p14, "sd"); // MOSI, MISO, SCLK, SSEL
+#elif defined(TARGET_LPC1549)
+FlashAir_iSDIO sd(D11, D12, D13, D10, "sd"); // MOSI, MISO, SCLK, SSEL
+#elif defined(TARGET_NUCLEO_L073RZ)
+Serial console(PA_9, PA_10); // TX, RX
+FlashAir_iSDIO sd(PB_15, PB_14, PB_13, PB_12, "sd", &console); // mosi(CMD), miso(DAT0), sclk(CLK), cs(DAT3)
+DigitalOut ledB(PB_11, 1); // B
+DigitalOut ledG(PB_10, 1); // G
+DigitalOut ledR(PA_15, 1); // R
+DigitalOut SD_VEN(PC_4, 0); // SD initialy off
+DigitalIn SD_CD(PC_1); // SD_CD
+#elif defined(TARGET_LPC11U35_401)
+//#elif defined(TARGET_MCU_LPC11U35_501)
+Serial console(P0_19, P0_18); // TX, RX
+FlashAir_iSDIO sd(P0_21, P0_22, P1_15, P0_17, "sd", &console); // mosi(CMD), miso(DAT0), sclk(CLK), cs(DAT3)
+DigitalOut ledB(P0_7, 1);
+DigitalOut ledG(P0_7, 1);
+DigitalOut ledR(P0_7, 1);
+DigitalOut SD_VEN(P1_16);
+DigitalIn SD_CD(P1_19);
+#else
+#error
+#endif
+
+//Serial pc(USBTX, USBRX);
+
+//**************************************************
+
+int main()
+{
+ uint32_t sequenceId ;
+
+ ledG = 0;
+
+ console.printf("start.\n");
+
+ SD_VEN = 1; // SD ON
+ wait(5.0);
+
+ if (SD_CD) {
+ console.printf("SD: Not dected\n");
+ } else {
+ console.printf("SD: Detected\n");
+ }
+
+ //Initialise card
+ FILE *fp = fopen("/sd/isdio.txt", "w");
+ fclose(fp);
+
+ ledG = 0 ;
+ wait(1.0);
+ ledB = 0;
+ wait(15.0);
+ ledG=1; ledB = 1;
+ ledR = 0;
+// for(;;);
+
+ sequenceId = sd.getNextSequenceId();
+ sd.wlan_disconnect(sequenceId);
+ console.printf("bbbb\n");
+ sd.waitResponse(sequenceId);
+ wait(5.0);
+// iSDIO_status();
+
+ ledB = 0;
+// for(;;);
+
+ sequenceId = sd.getNextSequenceId();
+ sd.wlan_establish(sequenceId, "sdiotest", "12345678", FlashAir_iSDIO::ENCMODE_WPA2PSK_AES);
+// wlan_establish(sequenceId);
+ wait(5.0);
+// iSDIO_status();
+ ledG = 0;
+
+// shared mem test
+#define TESTDATA 0xdeadbeaf
+
+ uint32_t testdata = TESTDATA;
+ uint8_t data[sizeof(testdata)];
+ memcpy(data, &testdata, sizeof(data));
+ sd.write_shared_mem(0x0, data, sizeof(data));
+ memset(data, 0x0, sizeof(data));
+ sd.read_shared_mem(0x0, data, sizeof(data));
+
+ for(;;);
+
+}