Chris Arndt / Mbed OS mbed-os-usbserial-test

Dependencies:   USBDevice_STM32F103

Committer:
SpotlightKid
Date:
Mon Jan 15 16:57:02 2018 +0000
Revision:
0:038a9831a9b4
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
SpotlightKid 0:038a9831a9b4 1 #include "mbed.h"
SpotlightKid 0:038a9831a9b4 2 #include "USBSerial.h"
SpotlightKid 0:038a9831a9b4 3
SpotlightKid 0:038a9831a9b4 4 DigitalOut myled(LED1);
SpotlightKid 0:038a9831a9b4 5 Serial pc(PA_2, PA_3);
SpotlightKid 0:038a9831a9b4 6 //USBSerial usbSerial; // connection blocks when USB is not plugged in
SpotlightKid 0:038a9831a9b4 7 USBSerial usbSerial(0x1f00, 0x2012, 0x0001, false); // connection is not blocked when USB is not plugged in
SpotlightKid 0:038a9831a9b4 8
SpotlightKid 0:038a9831a9b4 9 int main() {
SpotlightKid 0:038a9831a9b4 10 while(1) {
SpotlightKid 0:038a9831a9b4 11 myled = !myled;
SpotlightKid 0:038a9831a9b4 12 pc.printf("I am a serial port\r\n"); // 9600 bit/s
SpotlightKid 0:038a9831a9b4 13 usbSerial.printf("I am a USB serial port\r\n"); // 12 Mbit/s (USB full-speed)
SpotlightKid 0:038a9831a9b4 14 wait_ms(1000);
SpotlightKid 0:038a9831a9b4 15 }
SpotlightKid 0:038a9831a9b4 16 }