USB Serial application
Fork of USBSerial_HelloWorld by
Diff: main.cpp
- Revision:
- 11:b3f2a8bdac4d
- Parent:
- 10:41552d038a69
--- a/main.cpp Tue Jan 10 20:42:26 2017 +0000 +++ b/main.cpp Sat Dec 16 10:26:48 2017 +0000 @@ -1,26 +1,28 @@ #include "mbed.h" - #include "USBSerial.h" DigitalOut myled(LED1); -void confSysClock(); int main() { //confSysClock(); //Configure system clock (72MHz HSE clock, 48MHz USB clock) //SYSTEM CLOCK changed in stm32f4xx_hal.c - Serial pc(PA_2, PA_3); // you may substitute any buffered serial driver here USBSerial usbSerial; + Serial serial(PTE20, PTE21); + while(1) { - + if(serial.readable()) + { + //usbSerial.putc(serial.getc()); + } myled = !myled; - if(pc.readable()) //if there is any character to read from pc - { - usbSerial.putc(pc.getc()); //send it over to usbSerial - } if(usbSerial.readable()) //if there is any character to read from usbSerial { - pc.putc(usbSerial.getc()); //send it over to pc + usbSerial.putc('c'); + usbSerial.putc('h'); + usbSerial.putc('u'); + usbSerial.putc('j'); + usbSerial.getc(); } } } \ No newline at end of file