Adafruit FeatherOLED example for the MAX32630FTHR board
Dependencies: Adafruit_FeatherOLED USBDevice max32630fthr
Dependents: Bracciale_master Bracciale_slave
Fork of FTHR_USB_serial by
main.cpp@2:57500e991166, 2016-12-08 (annotated)
- Committer:
- switches
- Date:
- Thu Dec 08 00:06:59 2016 +0000
- Revision:
- 2:57500e991166
- Parent:
- 1:6923b075c8d7
- Child:
- 3:601c11238ccb
Added max32630fthr library to replace PMIC initialization code.; Renamed serial ports to be more clear.
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 | 2:57500e991166 | 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 | 2:57500e991166 | 10 | DigitalOut rLED(LED1); |
switches | 2:57500e991166 | 11 | DigitalOut gLED(LED2); |
switches | 2:57500e991166 | 12 | DigitalOut bLED(LED3); |
switches | 0:60a522ae2e35 | 13 | |
switches | 0:60a522ae2e35 | 14 | // main() runs in its own thread in the OS |
switches | 0:60a522ae2e35 | 15 | // (note the calls to Thread::wait below for delays) |
switches | 0:60a522ae2e35 | 16 | int main() |
switches | 0:60a522ae2e35 | 17 | { |
switches | 1:6923b075c8d7 | 18 | int c; |
switches | 2:57500e991166 | 19 | |
switches | 2:57500e991166 | 20 | daplink.printf("daplink serial port\r\n"); |
switches | 2:57500e991166 | 21 | rLED = LED_ON; |
switches | 2:57500e991166 | 22 | gLED = LED_ON; |
switches | 2:57500e991166 | 23 | bLED = LED_OFF; |
switches | 2:57500e991166 | 24 | pegasus.init(); |
switches | 0:60a522ae2e35 | 25 | |
switches | 1:6923b075c8d7 | 26 | // Virtual serial port over USB |
switches | 2:57500e991166 | 27 | USBSerial microUSB; |
switches | 2:57500e991166 | 28 | microUSB.printf("micro USB serial port\r\n"); |
switches | 2:57500e991166 | 29 | |
switches | 2:57500e991166 | 30 | |
switches | 2:57500e991166 | 31 | rLED = LED_OFF; |
switches | 1:6923b075c8d7 | 32 | |
switches | 1:6923b075c8d7 | 33 | while(1) { |
switches | 2:57500e991166 | 34 | c = microUSB.getc(); |
switches | 2:57500e991166 | 35 | microUSB.putc(c); |
switches | 2:57500e991166 | 36 | daplink.putc(c); |
switches | 2:57500e991166 | 37 | bLED = c & 1; |
switches | 0:60a522ae2e35 | 38 | } |
switches | 0:60a522ae2e35 | 39 | } |
switches | 0:60a522ae2e35 | 40 |