Firmware for MAXREFDES1213

Dependencies:   max32630fthr USBDevice

Committer:
switches
Date:
Tue Dec 13 21:37:41 2016 +0000
Revision:
3:601c11238ccb
Parent:
2:57500e991166
Child:
6:684c51f32c1d
Updated pegagus_dev and max32630fthr libraries

Who changed what in which revision?

UserRevisionLine numberNew 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 3:601c11238ccb 5 MAX32630FTHR pegasus;
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 3:601c11238ccb 29 pegasus.init(MAX32630FTHR::VIO_3V3);
switches 2:57500e991166 30 rLED = LED_OFF;
switches 1:6923b075c8d7 31
switches 1:6923b075c8d7 32 while(1) {
switches 2:57500e991166 33 c = microUSB.getc();
switches 2:57500e991166 34 microUSB.putc(c);
switches 2:57500e991166 35 daplink.putc(c);
switches 2:57500e991166 36 bLED = c & 1;
switches 0:60a522ae2e35 37 }
switches 0:60a522ae2e35 38 }
switches 0:60a522ae2e35 39