step1
Dependencies: mbed ADT7410 FlashAir_iSDIO SDFileSystem USBDevice
Revision 7:034887f17fb2, committed 2019-01-18
- Comitter:
- mbed_crane_elec
- Date:
- Fri Jan 18 12:36:57 2019 +0000
- Parent:
- 6:dc3fa898ae44
- Commit message:
- summit
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r dc3fa898ae44 -r 034887f17fb2 main.cpp --- a/main.cpp Tue Jan 15 14:15:16 2019 +0000 +++ b/main.cpp Fri Jan 18 12:36:57 2019 +0000 @@ -1,9 +1,10 @@ #include "mbed.h" #include "FlashAir_iSDIO.h" +#include "SDFileSystem.h" #include "USBSerial.h" #include "ADT7410.h" -//#define USE_ADT7410 +#define USE_ADT7410 //------------------------------------------------------------------------------- //Port Settings DigitalOut led1(LED1); @@ -30,10 +31,11 @@ DigitalOut sM(P0_2,0); DigitalOut sDP(P1_25,0); DigitalOut SD_VEN(P1_16); -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) +//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) +SDFileSystem sd(P0_21, P0_22, P1_15, P0_17, "sd"); // mosi(CMD), miso(DAT0), sclk(CLK), cs(DAT3) -USBSerial serial; +//USBSerial serial; #ifdef USE_ADT7410 ADT7410 sensor(P0_5, P0_4, 0x90, 100000); #else @@ -54,9 +56,9 @@ // 1. get sequenceID // 2. issue disconnect command // 3. wait response - sequenceId = sd.getNextSequenceId(); - sd.wlan_disconnect(sequenceId); - sd.waitResponse(sequenceId); + //sequenceId = sd.getNextSequenceId(); + //sd.wlan_disconnect(sequenceId); + //sd.waitResponse(sequenceId); wlan_connected =0; led1 = 0; wait(5.0); @@ -65,11 +67,11 @@ // 1. get sequenceID // 2. issue establish command // 3. wait resoonse - sequenceId = sd.getNextSequenceId(); - sd.wlan_establish(sequenceId, "isdiotest", "12345678", FlashAir_iSDIO::ENCMODE_WPA2PSK_AES); - sd.waitResponse(sequenceId); +// sequenceId = sd.getNextSequenceId(); +// sd.wlan_establish(sequenceId, "isdiotest", "12345678", FlashAir_iSDIO::ENCMODE_WPA2PSK_AES); +// sd.waitResponse(sequenceId); led1 = 1; - wlan_connected =1; +// wlan_connected =1; wait(5.0); } @@ -80,7 +82,7 @@ char testdata[] = TESTDATA; uint8_t data[sizeof(testdata)]; memcpy(data, &testdata, sizeof(data)); - sd.write_shared_mem(0x0, data, sizeof(data)); +// sd.write_shared_mem(0x0, data, sizeof(data)); wait(3.0); } @@ -115,27 +117,27 @@ int out_file(int val) { - FILE *fd = fopen("/sd/temp.text", "a"); + FILE *fd = fopen("/sd/test.txt", "a"); fprintf(fd, "%d,", val); fclose(fd); } int main() { - console.printf("Hello FlashAIr_iSDIO_16seg_ADT7410\n"); - SD_VEN = 1; + //console.printf("Hello FlashAIr_iSDIO_16seg_ADT7410\n"); + SD_VEN = 1; // Initialize card - FILE *fp = fopen("/sd/isdio.txt", "w"); - fclose(fp); +// FILE *fp = fopen("/sd/isdio.txt", "w"); +// fclose(fp); #ifdef USE_ADT7410 sensor.reset(); #endif // disconnect anyway - sequenceId = sd.getNextSequenceId(); - sd.wlan_disconnect(sequenceId); - sd.waitResponse(sequenceId); +// sequenceId = sd.getNextSequenceId(); +// sd.wlan_disconnect(sequenceId); +// sd.waitResponse(sequenceId); // register interrupt handler sw.rise(&sw_int); @@ -151,7 +153,7 @@ #endif seg_disp(senseval); out_file(senseval); - serial.printf("%d\n",senseval); + //serial.printf("%d\n",senseval); i++; #ifndef USE_ADT7410 if(i>=DUMMYVALLEN) i=0;