testing
Dependencies: BMI160 max32630fthr USBDevice
main.cpp@9:02c5adb483c8, 2019-09-27 (annotated)
- Committer:
- phonemacro
- Date:
- Fri Sep 27 21:02:41 2019 +0000
- Revision:
- 9:02c5adb483c8
- Parent:
- 8:d2b660bf5f94
- Child:
- 10:c411a5219054
Updated to Mbed 5.14
Who changed what in which revision?
User | Revision | Line number | New 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" |
switches | 0:60a522ae2e35 | 36 | |
switches | 6:684c51f32c1d | 37 | MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); |
switches | 0:60a522ae2e35 | 38 | |
switches | 1:6923b075c8d7 | 39 | // Hardware serial port over DAPLink |
phonemacro | 9:02c5adb483c8 | 40 | Serial daplink(USBTX, USBRX); // Use USB debug probe for serial link |
phonemacro | 9:02c5adb483c8 | 41 | Serial uart(P2_1, P2_0); |
switches | 1:6923b075c8d7 | 42 | |
switches | 3:601c11238ccb | 43 | // Virtual serial port over USB |
h_keyur | 8:d2b660bf5f94 | 44 | USBSerial microUSB; |
switches | 2:57500e991166 | 45 | DigitalOut rLED(LED1); |
switches | 2:57500e991166 | 46 | DigitalOut gLED(LED2); |
switches | 2:57500e991166 | 47 | DigitalOut bLED(LED3); |
switches | 0:60a522ae2e35 | 48 | |
switches | 0:60a522ae2e35 | 49 | // main() runs in its own thread in the OS |
switches | 0:60a522ae2e35 | 50 | // (note the calls to Thread::wait below for delays) |
switches | 0:60a522ae2e35 | 51 | int main() |
switches | 0:60a522ae2e35 | 52 | { |
switches | 1:6923b075c8d7 | 53 | int c; |
switches | 2:57500e991166 | 54 | |
switches | 2:57500e991166 | 55 | daplink.printf("daplink serial port\r\n"); |
switches | 3:601c11238ccb | 56 | microUSB.printf("micro USB serial port\r\n"); |
switches | 2:57500e991166 | 57 | rLED = LED_ON; |
switches | 2:57500e991166 | 58 | gLED = LED_ON; |
switches | 2:57500e991166 | 59 | bLED = LED_OFF; |
switches | 0:60a522ae2e35 | 60 | |
switches | 2:57500e991166 | 61 | rLED = LED_OFF; |
switches | 1:6923b075c8d7 | 62 | |
switches | 1:6923b075c8d7 | 63 | while(1) { |
phonemacro | 9:02c5adb483c8 | 64 | // c = microUSB.getc(); |
phonemacro | 9:02c5adb483c8 | 65 | // microUSB.putc(c); |
phonemacro | 9:02c5adb483c8 | 66 | // daplink.putc(c); |
phonemacro | 9:02c5adb483c8 | 67 | daplink.printf("daplink serial port\r\n"); |
phonemacro | 9:02c5adb483c8 | 68 | microUSB.printf("micro USB serial port\r\n"); |
phonemacro | 9:02c5adb483c8 | 69 | bLED = !bLED; |
phonemacro | 9:02c5adb483c8 | 70 | wait(2); |
switches | 0:60a522ae2e35 | 71 | } |
switches | 0:60a522ae2e35 | 72 | } |
switches | 0:60a522ae2e35 | 73 |