Building a USB serial device with STM32F103C8T6 board
Dependencies: mbed mbed-STM32F103C8T6 USBDevice_STM32F103
main.cpp
00001 #include "stm32f103c8t6.h" 00002 #include "mbed.h" 00003 #include "USBSerial.h" 00004 00005 DigitalOut myled(LED1); 00006 00007 int main() { 00008 confSysClock(); //Configure system clock (72MHz HSE clock, 48MHz USB clock) 00009 00010 Serial pc(PA_2, PA_3); 00011 // USBSerial usbSerial; // connection is blocked when USB is not plugged in 00012 USBSerial usbSerial(0x1f00, 0x2012, 0x0001, false); // connection is not blocked when USB is not plugged in 00013 00014 while(1) { 00015 myled = !myled; 00016 pc.printf("I am a serial port\r\n"); // 9600 bit/s 00017 usbSerial.printf("I am a USB serial port\r\n"); // 12 Mbit/s (USB full-speed) 00018 wait_ms(1000); 00019 } 00020 } 00021 00022
Generated on Tue Jul 12 2022 18:17:16 by 1.7.2