V1.1 For EVIC
Dependencies: SDFileSystem max32630fthr USBDevice
main.cpp@0:5a9619496af2, 2020-05-06 (annotated)
- Committer:
- china_sn0w
- Date:
- Wed May 06 05:56:23 2020 +0000
- Revision:
- 0:5a9619496af2
- Child:
- 1:7530b7eb757a
new
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
china_sn0w | 0:5a9619496af2 | 1 | /******************************************************************************* |
china_sn0w | 0:5a9619496af2 | 2 | * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved. |
china_sn0w | 0:5a9619496af2 | 3 | * |
china_sn0w | 0:5a9619496af2 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
china_sn0w | 0:5a9619496af2 | 5 | * copy of this software and associated documentation files (the "Software"), |
china_sn0w | 0:5a9619496af2 | 6 | * to deal in the Software without restriction, including without limitation |
china_sn0w | 0:5a9619496af2 | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
china_sn0w | 0:5a9619496af2 | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
china_sn0w | 0:5a9619496af2 | 9 | * Software is furnished to do so, subject to the following conditions: |
china_sn0w | 0:5a9619496af2 | 10 | * |
china_sn0w | 0:5a9619496af2 | 11 | * The above copyright notice and this permission notice shall be included |
china_sn0w | 0:5a9619496af2 | 12 | * in all copies or substantial portions of the Software. |
china_sn0w | 0:5a9619496af2 | 13 | * |
china_sn0w | 0:5a9619496af2 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
china_sn0w | 0:5a9619496af2 | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
china_sn0w | 0:5a9619496af2 | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
china_sn0w | 0:5a9619496af2 | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
china_sn0w | 0:5a9619496af2 | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
china_sn0w | 0:5a9619496af2 | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
china_sn0w | 0:5a9619496af2 | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
china_sn0w | 0:5a9619496af2 | 21 | * |
china_sn0w | 0:5a9619496af2 | 22 | * Except as contained in this notice, the name of Maxim Integrated |
china_sn0w | 0:5a9619496af2 | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
china_sn0w | 0:5a9619496af2 | 24 | * Products, Inc. Branding Policy. |
china_sn0w | 0:5a9619496af2 | 25 | * |
china_sn0w | 0:5a9619496af2 | 26 | * The mere transfer of this software does not imply any licenses |
china_sn0w | 0:5a9619496af2 | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
china_sn0w | 0:5a9619496af2 | 28 | * trademarks, maskwork rights, or any other form of intellectual |
china_sn0w | 0:5a9619496af2 | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
china_sn0w | 0:5a9619496af2 | 30 | * ownership rights. |
china_sn0w | 0:5a9619496af2 | 31 | ******************************************************************************* |
china_sn0w | 0:5a9619496af2 | 32 | */ |
china_sn0w | 0:5a9619496af2 | 33 | #include "mbed.h" |
china_sn0w | 0:5a9619496af2 | 34 | #include "max32630fthr.h" |
china_sn0w | 0:5a9619496af2 | 35 | #include "USBSerial.h" |
china_sn0w | 0:5a9619496af2 | 36 | #include "I2CSlave.h" |
china_sn0w | 0:5a9619496af2 | 37 | |
china_sn0w | 0:5a9619496af2 | 38 | MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); |
china_sn0w | 0:5a9619496af2 | 39 | |
china_sn0w | 0:5a9619496af2 | 40 | // Hardware serial port over DAPLink |
china_sn0w | 0:5a9619496af2 | 41 | Serial uart(P2_1, P2_0); |
china_sn0w | 0:5a9619496af2 | 42 | |
china_sn0w | 0:5a9619496af2 | 43 | I2C slave(P3_4, P3_5); |
china_sn0w | 0:5a9619496af2 | 44 | |
china_sn0w | 0:5a9619496af2 | 45 | // Virtual serial port over USB |
china_sn0w | 0:5a9619496af2 | 46 | USBSerial microUSB; |
china_sn0w | 0:5a9619496af2 | 47 | DigitalOut rLED(LED1); |
china_sn0w | 0:5a9619496af2 | 48 | DigitalOut gLED(LED2); |
china_sn0w | 0:5a9619496af2 | 49 | DigitalOut bLED(LED3); |
china_sn0w | 0:5a9619496af2 | 50 | |
china_sn0w | 0:5a9619496af2 | 51 | // main() runs in its own thread in the OS |
china_sn0w | 0:5a9619496af2 | 52 | // (note the calls to Thread::wait below for delays) |
china_sn0w | 0:5a9619496af2 | 53 | int main() |
china_sn0w | 0:5a9619496af2 | 54 | { |
china_sn0w | 0:5a9619496af2 | 55 | microUSB.printf("micro USB serial port\r\n"); |
china_sn0w | 0:5a9619496af2 | 56 | |
china_sn0w | 0:5a9619496af2 | 57 | rLED = LED_ON; |
china_sn0w | 0:5a9619496af2 | 58 | gLED = LED_ON; |
china_sn0w | 0:5a9619496af2 | 59 | bLED = LED_OFF; |
china_sn0w | 0:5a9619496af2 | 60 | |
china_sn0w | 0:5a9619496af2 | 61 | rLED = LED_OFF; |
china_sn0w | 0:5a9619496af2 | 62 | |
china_sn0w | 0:5a9619496af2 | 63 | slave.frequency(400000); |
china_sn0w | 0:5a9619496af2 | 64 | |
china_sn0w | 0:5a9619496af2 | 65 | |
china_sn0w | 0:5a9619496af2 | 66 | while(1) |
china_sn0w | 0:5a9619496af2 | 67 | { |
china_sn0w | 0:5a9619496af2 | 68 | microUSB.printf("micro USB serial port\r\n"); |
china_sn0w | 0:5a9619496af2 | 69 | bLED = !bLED; |
china_sn0w | 0:5a9619496af2 | 70 | wait(2); |
china_sn0w | 0:5a9619496af2 | 71 | } |
china_sn0w | 0:5a9619496af2 | 72 | } |
china_sn0w | 0:5a9619496af2 | 73 |