Kenji Arai
/
STM32_USBDevice_Serial
check program for USB Serial
Revision 1:637d33b55dfe, committed 2018-04-16
- Comitter:
- kenjiArai
- Date:
- Mon Apr 16 10:48:20 2018 +0000
- Parent:
- 0:941291e23892
- Commit message:
- check program for USB Serial
Changed in this revision
diff -r 941291e23892 -r 637d33b55dfe main.cpp --- a/main.cpp Thu Aug 03 13:27:41 2017 +0000 +++ b/main.cpp Mon Apr 16 10:48:20 2018 +0000 @@ -1,24 +1,31 @@ #include "mbed.h" #include "USBSerial.h" +Serial pc(USBTX, USBRX, 921600); // Virtual USB Serial port USBSerial usb_serial; - DigitalOut led(LED1); +Timer t; int main(void) { - int i = 0; + uint32_t i = 0; + uint32_t dt; // Print on STDIO printf("USBDevice Serial started\r\n"); while(1) { - + t.reset(); + t.start(); +#if 1 // Print on Virtual USB Serial port - usb_serial.printf("I am a virtual serial port: %d\r\n", i++); - + usb_serial.printf("I am a virtual serial port: %d, %d\r\n", i++, dt); +#else + // Print on V-COM + pc.printf("I am a virtual serial port: %d, %d\r\n", i++, dt); +#endif led = !led; - wait(0.1); + dt = t.read_us(); } }
diff -r 941291e23892 -r 637d33b55dfe mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Mon Apr 16 10:48:20 2018 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#f9ee4e849f8cbd64f1ec5fdd4ad256585a208360
diff -r 941291e23892 -r 637d33b55dfe mbed.bld --- a/mbed.bld Thu Aug 03 13:27:41 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/a97add6d7e64 \ No newline at end of file