based on hudakz USBSerial example - blinks with capslock and onboard LED.
Dependencies: USBDevice_STM32F103 mbed-STM32F103C8T6 mbed
Fork of STM32F103C8T6_USBSerial by
Revision 6:bfd336d52fb4, committed 2018-03-05
- Comitter:
- danman
- Date:
- Mon Mar 05 16:36:20 2018 +0000
- Parent:
- 5:0be85f1bdb35
- Commit message:
- blink with capslock key and led
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0be85f1bdb35 -r bfd336d52fb4 main.cpp --- a/main.cpp Wed Apr 26 17:57:55 2017 +0000 +++ b/main.cpp Mon Mar 05 16:36:20 2018 +0000 @@ -1,21 +1,17 @@ #include "stm32f103c8t6.h" #include "mbed.h" -#include "USBSerial.h" +#include "USBKeyboard.h" -DigitalOut myled(LED1); +DigitalOut myled(PA_9); + +int main(void) { + confSysClock(); -int main() { - confSysClock(); //Configure system clock (72MHz HSE clock, 48MHz USB clock) - - Serial pc(PA_2, PA_3); - //USBSerial usbSerial; // connection must be blocked when USB is not plugged in - USBSerial usbSerial(0x1f00, 0x2012, 0x0001, false); // connection is not blocked when USB is not plugged in - - while(1) { + USBKeyboard keyboard; + + while (1) { myled = !myled; - pc.printf("I am a serial port\r\n"); // 9600 bit/s - usbSerial.printf("I am a USB serial port\r\n"); // 12 Mbit/s (USB full-speed) - wait_ms(1000); + keyboard.keyCode(KEY_CAPS_LOCK); + wait_ms(100); } } -