![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
based on hudakz USBSerial example - blinks with capslock and onboard LED.
Dependencies: USBDevice_STM32F103 mbed-STM32F103C8T6 mbed
Fork of STM32F103C8T6_USBSerial by
main.cpp@3:dd01afd4f893, 2016-08-02 (annotated)
- Committer:
- hudakz
- Date:
- Tue Aug 02 19:39:53 2016 +0000
- Revision:
- 3:dd01afd4f893
- Parent:
- 2:2c819b99d216
- Child:
- 4:00ccc80cbeb8
Updated
Who changed what in which revision?
User | Revision | Line number | New 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 | Serial pc(PA_2, PA_3); |
hudakz | 0:0279e8c1f111 | 6 | DigitalOut myled(LED1); |
hudakz | 0:0279e8c1f111 | 7 | |
hudakz | 0:0279e8c1f111 | 8 | int main() { |
hudakz | 3:dd01afd4f893 | 9 | confSysClock(); //Configure system clock (72MHz HSE clock, 48MHz USB clock) |
hudakz | 0:0279e8c1f111 | 10 | USBSerial usbSerial; |
hudakz | 0:0279e8c1f111 | 11 | |
hudakz | 0:0279e8c1f111 | 12 | while(1) { |
hudakz | 0:0279e8c1f111 | 13 | myled = !myled; |
hudakz | 2:2c819b99d216 | 14 | pc.printf("I am a serial port\r\n"); // 9600 bit/s |
hudakz | 3:dd01afd4f893 | 15 | usbSerial.printf("I am a USB serial port\r\n"); // 12 Mbit/s (USB full-speed) |
hudakz | 0:0279e8c1f111 | 16 | wait_ms(1000); |
hudakz | 0:0279e8c1f111 | 17 | } |
hudakz | 0:0279e8c1f111 | 18 | } |
hudakz | 0:0279e8c1f111 | 19 |