initial commit
Dependencies: USBDevice max32630fthr
Fork of FTHR_USB_serial by
main.cpp@6:684c51f32c1d, 2017-02-06 (annotated)
- Committer:
- switches
- Date:
- Mon Feb 06 23:16:26 2017 +0000
- Revision:
- 6:684c51f32c1d
- Parent:
- 3:601c11238ccb
- Child:
- 8:d2b660bf5f94
Updated max32630fthr library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
switches | 0:60a522ae2e35 | 1 | #include "mbed.h" |
switches | 2:57500e991166 | 2 | #include "max32630fthr.h" |
switches | 1:6923b075c8d7 | 3 | #include "USBSerial.h" |
switches | 0:60a522ae2e35 | 4 | |
switches | 6:684c51f32c1d | 5 | MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); |
switches | 0:60a522ae2e35 | 6 | |
switches | 1:6923b075c8d7 | 7 | // Hardware serial port over DAPLink |
switches | 2:57500e991166 | 8 | Serial daplink(P2_1, P2_0); |
switches | 1:6923b075c8d7 | 9 | |
switches | 3:601c11238ccb | 10 | // Virtual serial port over USB |
switches | 3:601c11238ccb | 11 | USBSerial microUSB; |
switches | 3:601c11238ccb | 12 | |
switches | 2:57500e991166 | 13 | DigitalOut rLED(LED1); |
switches | 2:57500e991166 | 14 | DigitalOut gLED(LED2); |
switches | 2:57500e991166 | 15 | DigitalOut bLED(LED3); |
switches | 0:60a522ae2e35 | 16 | |
switches | 0:60a522ae2e35 | 17 | // main() runs in its own thread in the OS |
switches | 0:60a522ae2e35 | 18 | // (note the calls to Thread::wait below for delays) |
switches | 0:60a522ae2e35 | 19 | int main() |
switches | 0:60a522ae2e35 | 20 | { |
switches | 1:6923b075c8d7 | 21 | int c; |
switches | 2:57500e991166 | 22 | |
switches | 2:57500e991166 | 23 | daplink.printf("daplink serial port\r\n"); |
switches | 3:601c11238ccb | 24 | microUSB.printf("micro USB serial port\r\n"); |
switches | 2:57500e991166 | 25 | rLED = LED_ON; |
switches | 2:57500e991166 | 26 | gLED = LED_ON; |
switches | 2:57500e991166 | 27 | bLED = LED_OFF; |
switches | 0:60a522ae2e35 | 28 | |
switches | 2:57500e991166 | 29 | rLED = LED_OFF; |
switches | 1:6923b075c8d7 | 30 | |
switches | 1:6923b075c8d7 | 31 | while(1) { |
switches | 2:57500e991166 | 32 | c = microUSB.getc(); |
switches | 2:57500e991166 | 33 | microUSB.putc(c); |
switches | 2:57500e991166 | 34 | daplink.putc(c); |
switches | 2:57500e991166 | 35 | bLED = c & 1; |
switches | 0:60a522ae2e35 | 36 | } |
switches | 0:60a522ae2e35 | 37 | } |
switches | 0:60a522ae2e35 | 38 |