aaa

Dependencies:   MCP4822 mbed-STM32F103C8T6 mbed

Fork of STM32F103C8T6_USBSerial by Zoltan Hudak

Committer:
hudakz
Date:
Wed Apr 26 17:57:55 2017 +0000
Revision:
5:0be85f1bdb35
Parent:
4:00ccc80cbeb8
Child:
6:d3175b589df4
Connection is not blocked when USB is not plugged in.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hudakz 0:0279e8c1f111 1 #include "stm32f103c8t6.h"
hudakz 0:0279e8c1f111 2 #include "mbed.h"
hudakz 0:0279e8c1f111 3 #include "USBSerial.h"
hudakz 0:0279e8c1f111 4
hudakz 0:0279e8c1f111 5 DigitalOut myled(LED1);
hudakz 0:0279e8c1f111 6
hudakz 0:0279e8c1f111 7 int main() {
hudakz 3:dd01afd4f893 8 confSysClock(); //Configure system clock (72MHz HSE clock, 48MHz USB clock)
hudakz 4:00ccc80cbeb8 9
hudakz 4:00ccc80cbeb8 10 Serial pc(PA_2, PA_3);
hudakz 5:0be85f1bdb35 11 //USBSerial usbSerial; // connection must be blocked when USB is not plugged in
hudakz 5:0be85f1bdb35 12 USBSerial usbSerial(0x1f00, 0x2012, 0x0001, false); // connection is not blocked when USB is not plugged in
hudakz 0:0279e8c1f111 13
hudakz 0:0279e8c1f111 14 while(1) {
hudakz 0:0279e8c1f111 15 myled = !myled;
hudakz 2:2c819b99d216 16 pc.printf("I am a serial port\r\n"); // 9600 bit/s
hudakz 3:dd01afd4f893 17 usbSerial.printf("I am a USB serial port\r\n"); // 12 Mbit/s (USB full-speed)
hudakz 0:0279e8c1f111 18 wait_ms(1000);
hudakz 0:0279e8c1f111 19 }
hudakz 0:0279e8c1f111 20 }
hudakz 0:0279e8c1f111 21