USBMSD and CDC composite device testing code mixed up from several existing programs/libraries
Dependencies: USBCDCMSC USBDevice USBFileSystem USBSDFileSystem USBSPIFileSystem mbed
Diff: main.cpp
- Revision:
- 2:c70070f88944
- Parent:
- 1:30c83d964f38
- Child:
- 4:bbe1bc2eb8fb
--- a/main.cpp Tue Apr 21 16:43:52 2015 +0000 +++ b/main.cpp Tue Apr 21 17:05:18 2015 +0000 @@ -120,50 +120,42 @@ int main() { -/* ALL pc.printf() does not work. CDC packet goes to blackhole :( */ - + /* pc.printf() and/or pc. getc() is not working. CDC packet dissappears*/ // sd.connect (false); sd.usbMode (1); // allow fopen/fprintf when connected with USB-drive. pc.printf("Hello World!\n\n"); pc.printf("now a USB drive should appear on your PC\n"); - for(int i=0;i<5;i++){ - myled = 0; - sd.usbMode (0); // allow fopen/fprintf when connected with USB-drive. - sd.disconnect(); - wait_ms (1000); + for(int i=0;i<60;i++){ myled = 1; - sd.usbMode (1); // allow fopen/fprintf when connected with USB-drive. - sd.connect(false); - wait_ms (1000); + wait_ms (500); + myled = 0; + wait_ms (500); } - myled = 1; - sd.usbMode (0); // allow fopen/fprintf when connected with USB-drive. - sd.connect(false); pc.printf("create directory and append to log file\n"); // mkdir("/sd/mydir", 0777); -// mylog (0); + mylog (0); for(int i=0;i<60;i++){ myled = 1; - wait_ms (250); + wait_ms (500); myled = 0; - wait_ms (250); + wait_ms (500); mylog (i); } // sd.usbMode (0); // allow fopen/fprintf when connected with USB-drive. // sd.disconnect (); pc.printf("Entering loop of 1 min cycle time\n"); - + sd.connect(true); int i = 1; int recieve=0 ; while(true) { myled = 0; recieve=pc.getc(); if(recieve != NULL){ - pc._putc('+'); + pc.putc('+'); } myled = 1; wait_ms(20);