FTHR USB Serial

Dependencies:   BMI160 max32630fthr USBDevice

Committer:
walterluu
Date:
Wed Dec 29 06:49:48 2021 +0000
Revision:
11:253a12195b67
Parent:
10:c411a5219054
FTHR USB Serial

Who changed what in which revision?

UserRevisionLine numberNew contents of line
phonemacro 9:02c5adb483c8 1 /*******************************************************************************
phonemacro 9:02c5adb483c8 2 * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved.
phonemacro 9:02c5adb483c8 3 *
phonemacro 9:02c5adb483c8 4 * Permission is hereby granted, free of charge, to any person obtaining a
phonemacro 9:02c5adb483c8 5 * copy of this software and associated documentation files (the "Software"),
phonemacro 9:02c5adb483c8 6 * to deal in the Software without restriction, including without limitation
phonemacro 9:02c5adb483c8 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
phonemacro 9:02c5adb483c8 8 * and/or sell copies of the Software, and to permit persons to whom the
phonemacro 9:02c5adb483c8 9 * Software is furnished to do so, subject to the following conditions:
phonemacro 9:02c5adb483c8 10 *
phonemacro 9:02c5adb483c8 11 * The above copyright notice and this permission notice shall be included
phonemacro 9:02c5adb483c8 12 * in all copies or substantial portions of the Software.
phonemacro 9:02c5adb483c8 13 *
phonemacro 9:02c5adb483c8 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
phonemacro 9:02c5adb483c8 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
phonemacro 9:02c5adb483c8 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
phonemacro 9:02c5adb483c8 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
phonemacro 9:02c5adb483c8 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
phonemacro 9:02c5adb483c8 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
phonemacro 9:02c5adb483c8 20 * OTHER DEALINGS IN THE SOFTWARE.
phonemacro 9:02c5adb483c8 21 *
phonemacro 9:02c5adb483c8 22 * Except as contained in this notice, the name of Maxim Integrated
phonemacro 9:02c5adb483c8 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
phonemacro 9:02c5adb483c8 24 * Products, Inc. Branding Policy.
phonemacro 9:02c5adb483c8 25 *
phonemacro 9:02c5adb483c8 26 * The mere transfer of this software does not imply any licenses
phonemacro 9:02c5adb483c8 27 * of trade secrets, proprietary technology, copyrights, patents,
phonemacro 9:02c5adb483c8 28 * trademarks, maskwork rights, or any other form of intellectual
phonemacro 9:02c5adb483c8 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
phonemacro 9:02c5adb483c8 30 * ownership rights.
phonemacro 9:02c5adb483c8 31 *******************************************************************************
phonemacro 9:02c5adb483c8 32 */
switches 0:60a522ae2e35 33 #include "mbed.h"
switches 2:57500e991166 34 #include "max32630fthr.h"
switches 1:6923b075c8d7 35 #include "USBSerial.h"
bangclever 10:c411a5219054 36 #include "bmi160.h"
switches 0:60a522ae2e35 37
switches 6:684c51f32c1d 38 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
switches 0:60a522ae2e35 39
switches 1:6923b075c8d7 40 // Hardware serial port over DAPLink
phonemacro 9:02c5adb483c8 41 Serial daplink(USBTX, USBRX); // Use USB debug probe for serial link
phonemacro 9:02c5adb483c8 42 Serial uart(P2_1, P2_0);
switches 1:6923b075c8d7 43
switches 3:601c11238ccb 44 // Virtual serial port over USB
h_keyur 8:d2b660bf5f94 45 USBSerial microUSB;
switches 2:57500e991166 46 DigitalOut rLED(LED1);
switches 2:57500e991166 47 DigitalOut gLED(LED2);
switches 2:57500e991166 48 DigitalOut bLED(LED3);
switches 0:60a522ae2e35 49
switches 0:60a522ae2e35 50 // main() runs in its own thread in the OS
switches 0:60a522ae2e35 51 // (note the calls to Thread::wait below for delays)
switches 0:60a522ae2e35 52 int main()
switches 0:60a522ae2e35 53 {
switches 1:6923b075c8d7 54 int c;
switches 2:57500e991166 55
switches 2:57500e991166 56 daplink.printf("daplink serial port\r\n");
switches 3:601c11238ccb 57 microUSB.printf("micro USB serial port\r\n");
switches 2:57500e991166 58 rLED = LED_ON;
switches 2:57500e991166 59 gLED = LED_ON;
switches 2:57500e991166 60 bLED = LED_OFF;
switches 0:60a522ae2e35 61
switches 2:57500e991166 62 rLED = LED_OFF;
switches 1:6923b075c8d7 63
switches 1:6923b075c8d7 64 while(1) {
phonemacro 9:02c5adb483c8 65 // c = microUSB.getc();
phonemacro 9:02c5adb483c8 66 // microUSB.putc(c);
phonemacro 9:02c5adb483c8 67 // daplink.putc(c);
phonemacro 9:02c5adb483c8 68 daplink.printf("daplink serial port\r\n");
phonemacro 9:02c5adb483c8 69 microUSB.printf("micro USB serial port\r\n");
phonemacro 9:02c5adb483c8 70 bLED = !bLED;
phonemacro 9:02c5adb483c8 71 wait(2);
switches 0:60a522ae2e35 72 }
switches 0:60a522ae2e35 73 }
switches 0:60a522ae2e35 74