Internal_Datalogger but with USB support removed (for MAX40108 Demo board), proof of concept that MAX32625 can be used successfully with VDDB(USB) left unpowered, as long as the USB library is not used.

Dependencies:   max32625pico CmdLine

Committer:
whismanoid
Date:
Fri Nov 06 05:56:19 2020 +0000
Revision:
1:747f1602abfc
Parent:
0:cb44e2e9ec4c
Child:
2:3caa9b974176
MAX32625PICO supported, Platform_Voltage

Who changed what in which revision?

UserRevisionLine numberNew contents of line
whismanoid 0:cb44e2e9ec4c 1 // /*******************************************************************************
whismanoid 0:cb44e2e9ec4c 2 // * Copyright (C) 2020 Maxim Integrated Products, Inc., All Rights Reserved.
whismanoid 0:cb44e2e9ec4c 3 // *
whismanoid 0:cb44e2e9ec4c 4 // * Permission is hereby granted, free of charge, to any person obtaining a
whismanoid 0:cb44e2e9ec4c 5 // * copy of this software and associated documentation files (the "Software"),
whismanoid 0:cb44e2e9ec4c 6 // * to deal in the Software without restriction, including without limitation
whismanoid 0:cb44e2e9ec4c 7 // * the rights to use, copy, modify, merge, publish, distribute, sublicense,
whismanoid 0:cb44e2e9ec4c 8 // * and/or sell copies of the Software, and to permit persons to whom the
whismanoid 0:cb44e2e9ec4c 9 // * Software is furnished to do so, subject to the following conditions:
whismanoid 0:cb44e2e9ec4c 10 // *
whismanoid 0:cb44e2e9ec4c 11 // * The above copyright notice and this permission notice shall be included
whismanoid 0:cb44e2e9ec4c 12 // * in all copies or substantial portions of the Software.
whismanoid 0:cb44e2e9ec4c 13 // *
whismanoid 0:cb44e2e9ec4c 14 // * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
whismanoid 0:cb44e2e9ec4c 15 // * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
whismanoid 0:cb44e2e9ec4c 16 // * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
whismanoid 0:cb44e2e9ec4c 17 // * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
whismanoid 0:cb44e2e9ec4c 18 // * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
whismanoid 0:cb44e2e9ec4c 19 // * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
whismanoid 0:cb44e2e9ec4c 20 // * OTHER DEALINGS IN THE SOFTWARE.
whismanoid 0:cb44e2e9ec4c 21 // *
whismanoid 0:cb44e2e9ec4c 22 // * Except as contained in this notice, the name of Maxim Integrated
whismanoid 0:cb44e2e9ec4c 23 // * Products, Inc. shall not be used except as stated in the Maxim Integrated
whismanoid 0:cb44e2e9ec4c 24 // * Products, Inc. Branding Policy.
whismanoid 0:cb44e2e9ec4c 25 // *
whismanoid 0:cb44e2e9ec4c 26 // * The mere transfer of this software does not imply any licenses
whismanoid 0:cb44e2e9ec4c 27 // * of trade secrets, proprietary technology, copyrights, patents,
whismanoid 0:cb44e2e9ec4c 28 // * trademarks, maskwork rights, or any other form of intellectual
whismanoid 0:cb44e2e9ec4c 29 // * property whatsoever. Maxim Integrated Products, Inc. retains all
whismanoid 0:cb44e2e9ec4c 30 // * ownership rights.
whismanoid 0:cb44e2e9ec4c 31 // *******************************************************************************
whismanoid 0:cb44e2e9ec4c 32 // */
whismanoid 0:cb44e2e9ec4c 33 // *******************************************************************************
whismanoid 0:cb44e2e9ec4c 34 // COM port settings are 9600 baud 8N1
whismanoid 0:cb44e2e9ec4c 35 // *******************************************************************************
whismanoid 0:cb44e2e9ec4c 36 //---------- CODE GENERATOR: DataLogHelloCppCodeList
whismanoid 0:cb44e2e9ec4c 37 // CODE GENERATOR: example code includes
whismanoid 0:cb44e2e9ec4c 38
whismanoid 0:cb44e2e9ec4c 39 // example code includes
whismanoid 0:cb44e2e9ec4c 40 // standard include for target platform -- Platform_Include_Boilerplate
whismanoid 0:cb44e2e9ec4c 41 #include "mbed.h"
whismanoid 0:cb44e2e9ec4c 42 // Platforms:
whismanoid 0:cb44e2e9ec4c 43 // - MAX32625MBED
whismanoid 0:cb44e2e9ec4c 44 // - supports mbed-os-5.11, requires USBDevice library
whismanoid 0:cb44e2e9ec4c 45 // - add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/
whismanoid 0:cb44e2e9ec4c 46 // - remove max32630fthr library (if present)
whismanoid 0:cb44e2e9ec4c 47 // - remove MAX32620FTHR library (if present)
whismanoid 0:cb44e2e9ec4c 48 // - MAX32600MBED
whismanoid 0:cb44e2e9ec4c 49 // - remove max32630fthr library (if present)
whismanoid 0:cb44e2e9ec4c 50 // - remove MAX32620FTHR library (if present)
whismanoid 0:cb44e2e9ec4c 51 // - Windows 10 note: Don't connect HDK until you are ready to load new firmware into the board.
whismanoid 0:cb44e2e9ec4c 52 // - NUCLEO_F446RE
whismanoid 0:cb44e2e9ec4c 53 // - remove USBDevice library
whismanoid 0:cb44e2e9ec4c 54 // - remove max32630fthr library (if present)
whismanoid 0:cb44e2e9ec4c 55 // - remove MAX32620FTHR library (if present)
whismanoid 0:cb44e2e9ec4c 56 // - NUCLEO_F401RE
whismanoid 0:cb44e2e9ec4c 57 // - remove USBDevice library
whismanoid 0:cb44e2e9ec4c 58 // - remove max32630fthr library (if present)
whismanoid 0:cb44e2e9ec4c 59 // - remove MAX32620FTHR library (if present)
whismanoid 0:cb44e2e9ec4c 60 // - MAX32630FTHR
whismanoid 0:cb44e2e9ec4c 61 // - #include "max32630fthr.h"
whismanoid 0:cb44e2e9ec4c 62 // - add http://os.mbed.org/teams/MaximIntegrated/code/max32630fthr/
whismanoid 0:cb44e2e9ec4c 63 // - remove MAX32620FTHR library (if present)
whismanoid 0:cb44e2e9ec4c 64 // - MAX32620FTHR
whismanoid 0:cb44e2e9ec4c 65 // - #include "MAX32620FTHR.h"
whismanoid 0:cb44e2e9ec4c 66 // - remove max32630fthr library (if present)
whismanoid 0:cb44e2e9ec4c 67 // - add https://os.mbed.com/teams/MaximIntegrated/code/MAX32620FTHR/
whismanoid 0:cb44e2e9ec4c 68 // - not tested yet
whismanoid 0:cb44e2e9ec4c 69 // - MAX32625PICO
whismanoid 0:cb44e2e9ec4c 70 // - #include "max32625pico.h"
whismanoid 0:cb44e2e9ec4c 71 // - add https://os.mbed.com/users/switches/code/max32625pico/
whismanoid 0:cb44e2e9ec4c 72 // - remove max32630fthr library (if present)
whismanoid 0:cb44e2e9ec4c 73 // - remove MAX32620FTHR library (if present)
whismanoid 0:cb44e2e9ec4c 74 // - not tested yet
whismanoid 0:cb44e2e9ec4c 75 // - see https://os.mbed.com/users/switches/code/max32625pico/
whismanoid 0:cb44e2e9ec4c 76 // - see https://os.mbed.com/users/switches/code/PICO_board_demo/
whismanoid 0:cb44e2e9ec4c 77 // - see https://os.mbed.com/users/switches/code/PICO_USB_I2C_SPI/
whismanoid 0:cb44e2e9ec4c 78 // - see https://os.mbed.com/users/switches/code/SerialInterface/
whismanoid 0:cb44e2e9ec4c 79 // - Note: To load the MAX32625PICO firmware, hold the button while
whismanoid 0:cb44e2e9ec4c 80 // connecting the USB cable, then copy firmware bin file
whismanoid 0:cb44e2e9ec4c 81 // to the MAINTENANCE drive.
whismanoid 0:cb44e2e9ec4c 82 // - see https://os.mbed.com/platforms/MAX32625PICO/
whismanoid 0:cb44e2e9ec4c 83 // - see https://os.mbed.com/teams/MaximIntegrated/wiki/MAX32625PICO-Firmware-Updates
whismanoid 0:cb44e2e9ec4c 84 //
whismanoid 0:cb44e2e9ec4c 85 // end Platform_Include_Boilerplate
whismanoid 0:cb44e2e9ec4c 86 //~ #include "MAX11410.h"
whismanoid 0:cb44e2e9ec4c 87
whismanoid 0:cb44e2e9ec4c 88 // optional: serial port
whismanoid 0:cb44e2e9ec4c 89 // note: some platforms such as Nucleo-F446RE do not support the USBSerial library.
whismanoid 0:cb44e2e9ec4c 90 // In those cases, remove the USBDevice lib from the project and rebuild.
whismanoid 0:cb44e2e9ec4c 91 #if defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 92 #include "USBSerial.h"
whismanoid 0:cb44e2e9ec4c 93 USBSerial serial; // virtual serial port over USB (DEV connector)
whismanoid 0:cb44e2e9ec4c 94 #elif defined(TARGET_MAX32625PICO)
whismanoid 0:cb44e2e9ec4c 95 #include "USBSerial.h"
whismanoid 0:cb44e2e9ec4c 96 USBSerial serial; // virtual serial port over USB (DEV connector)
whismanoid 0:cb44e2e9ec4c 97 #elif defined(TARGET_MAX32600MBED)
whismanoid 0:cb44e2e9ec4c 98 #include "USBSerial.h"
whismanoid 0:cb44e2e9ec4c 99 USBSerial serial; // virtual serial port over USB (DEV connector)
whismanoid 0:cb44e2e9ec4c 100 #elif defined(TARGET_MAX32630MBED)
whismanoid 0:cb44e2e9ec4c 101 #include "USBSerial.h"
whismanoid 0:cb44e2e9ec4c 102 USBSerial serial; // virtual serial port over USB (DEV connector)
whismanoid 0:cb44e2e9ec4c 103 #else
whismanoid 0:cb44e2e9ec4c 104 //#include "USBSerial.h"
whismanoid 0:cb44e2e9ec4c 105 Serial serial(USBTX, USBRX); // tx, rx
whismanoid 0:cb44e2e9ec4c 106 #endif
whismanoid 0:cb44e2e9ec4c 107
whismanoid 0:cb44e2e9ec4c 108
whismanoid 0:cb44e2e9ec4c 109
whismanoid 0:cb44e2e9ec4c 110 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 111
whismanoid 0:cb44e2e9ec4c 112
whismanoid 0:cb44e2e9ec4c 113 #if defined(TARGET)
whismanoid 0:cb44e2e9ec4c 114 // TARGET_NAME macros from targets/TARGET_Maxim/TARGET_MAX32625/device/mxc_device.h
whismanoid 0:cb44e2e9ec4c 115 // Create a string definition for the TARGET
whismanoid 0:cb44e2e9ec4c 116 #define STRING_ARG(arg) #arg
whismanoid 0:cb44e2e9ec4c 117 #define STRING_NAME(name) STRING_ARG(name)
whismanoid 0:cb44e2e9ec4c 118 #define TARGET_NAME STRING_NAME(TARGET)
whismanoid 0:cb44e2e9ec4c 119 #elif defined(TARGET_MAX32600)
whismanoid 0:cb44e2e9ec4c 120 #define TARGET_NAME "MAX32600"
whismanoid 0:cb44e2e9ec4c 121 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 122 #define TARGET_NAME "LPC1768"
whismanoid 0:cb44e2e9ec4c 123 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:cb44e2e9ec4c 124 #define TARGET_NAME "NUCLEO_F446RE"
whismanoid 0:cb44e2e9ec4c 125 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 126 #define TARGET_NAME "NUCLEO_F401RE"
whismanoid 0:cb44e2e9ec4c 127 #else
whismanoid 0:cb44e2e9ec4c 128 #error TARGET NOT DEFINED
whismanoid 0:cb44e2e9ec4c 129 #endif
whismanoid 0:cb44e2e9ec4c 130 #if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 131 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 132 // TARGET=MAX32630FTHR ARM Cortex-M4F 96MHz 2048kB Flash 512kB SRAM
whismanoid 0:cb44e2e9ec4c 133 // +-------------[microUSB]-------------+
whismanoid 0:cb44e2e9ec4c 134 // | J1 MAX32630FTHR J2 |
whismanoid 0:cb44e2e9ec4c 135 // ______ | [ ] RST GND [ ] |
whismanoid 0:cb44e2e9ec4c 136 // ______ | [ ] 3V3 BAT+[ ] |
whismanoid 0:cb44e2e9ec4c 137 // ______ | [ ] 1V8 reset SW1 |
whismanoid 0:cb44e2e9ec4c 138 // ______ | [ ] GND J4 J3 |
whismanoid 0:cb44e2e9ec4c 139 // analogIn0/4 | [a] AIN_0 1.2Vfs (bat) SYS [ ] | switched BAT+
whismanoid 0:cb44e2e9ec4c 140 // analogIn1/5 | [a] AIN_1 1.2Vfs PWR [ ] | external pwr btn
whismanoid 0:cb44e2e9ec4c 141 // analogIn2 | [a] AIN_2 1.2Vfs +5V VBUS [ ] | USB +5V power
whismanoid 0:cb44e2e9ec4c 142 // analogIn3 | [a] AIN_3 1.2Vfs 1-WIRE P4_0 [d] | D0 dig9
whismanoid 0:cb44e2e9ec4c 143 // (I2C2.SDA) | [d] P5_7 SDA2 SRN P5_6 [d] | D1 dig8
whismanoid 0:cb44e2e9ec4c 144 // (I2C2.SCL) | [d] P6_0 SCL2 SDIO3 P5_5 [d] | D2 dig7
whismanoid 0:cb44e2e9ec4c 145 // D13/SCLK | [s] P5_0 SCLK SDIO2 P5_4 [d] | D3 dig6
whismanoid 0:cb44e2e9ec4c 146 // D11/MOSI | [s] P5_1 MOSI SSEL P5_3 [d] | D4 dig5
whismanoid 0:cb44e2e9ec4c 147 // D12/MISO | [s] P5_2 MISO RTS P3_3 [d] | D5 dig4
whismanoid 0:cb44e2e9ec4c 148 // D10/CS | [s] P3_0 RX CTS P3_2 [d] | D6 dig3
whismanoid 0:cb44e2e9ec4c 149 // D9 dig0 | [d] P3_1 TX SCL P3_5 [d] | D7 dig2
whismanoid 0:cb44e2e9ec4c 150 // ______ | [ ] GND SDA P3_4 [d] | D8 dig1
whismanoid 0:cb44e2e9ec4c 151 // | |
whismanoid 0:cb44e2e9ec4c 152 // | XIP Flash MAX14690N |
whismanoid 0:cb44e2e9ec4c 153 // | XIP_SCLK P1_0 SDA2 P5_7 |
whismanoid 0:cb44e2e9ec4c 154 // | XIP_MOSI P1_1 SCL2 P6_0 |
whismanoid 0:cb44e2e9ec4c 155 // | XIP_MISO P1_2 PMIC_INIT P3_7 |
whismanoid 0:cb44e2e9ec4c 156 // | XIP_SSEL P1_3 MPC P2_7 |
whismanoid 0:cb44e2e9ec4c 157 // | XIP_DIO2 P1_4 MON AIN_0 |
whismanoid 0:cb44e2e9ec4c 158 // | XIP_DIO3 P1_5 |
whismanoid 0:cb44e2e9ec4c 159 // | |
whismanoid 0:cb44e2e9ec4c 160 // | PAN1326B MicroSD LED |
whismanoid 0:cb44e2e9ec4c 161 // | BT_RX P0_0 SD_SCLK P0_4 r P2_4 |
whismanoid 0:cb44e2e9ec4c 162 // | BT_TX P0_1 SD_MOSI P0_5 g P2_5 |
whismanoid 0:cb44e2e9ec4c 163 // | BT_CTS P0_2 SD_MISO P0_6 b P2_6 |
whismanoid 0:cb44e2e9ec4c 164 // | BT_RTS P0_3 SD_SSEL P0_7 |
whismanoid 0:cb44e2e9ec4c 165 // | BT_RST P1_6 DETECT P2_2 |
whismanoid 0:cb44e2e9ec4c 166 // | BT_CLK P1_7 SW2 P2_3 |
whismanoid 0:cb44e2e9ec4c 167 // +------------------------------------+
whismanoid 0:cb44e2e9ec4c 168 // MAX32630FTHR board has MAX14690 PMIC on I2C bus (P5_7 SDA, P6_0 SCL) at slave address 0101_000r 0x50 (or 0x28 for 7 MSbit address).
whismanoid 0:cb44e2e9ec4c 169 // MAX32630FTHR board has BMI160 accelerometer on I2C bus (P5_7 SDA, P6_0 SCL) at slave address 1101_000r 0xD0 (or 0x68 for 7 MSbit address).
whismanoid 0:cb44e2e9ec4c 170 // AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 171 // AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 172 // AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 173 // AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 174 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 175 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 176 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 177 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 178 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 179 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 180 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 181 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 182 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 183 //
whismanoid 0:cb44e2e9ec4c 184 #include "max32630fthr.h"
whismanoid 0:cb44e2e9ec4c 185 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
whismanoid 0:cb44e2e9ec4c 186 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 187 // MAX32630FTHR board supports only internal VREF = 1.200V at bypass capacitor C15
whismanoid 0:cb44e2e9ec4c 188 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 0:cb44e2e9ec4c 189 // Arduino connector
whismanoid 0:cb44e2e9ec4c 190 #ifndef A0
whismanoid 0:cb44e2e9ec4c 191 #define A0 AIN_0
whismanoid 0:cb44e2e9ec4c 192 #endif
whismanoid 0:cb44e2e9ec4c 193 #ifndef A1
whismanoid 0:cb44e2e9ec4c 194 #define A1 AIN_1
whismanoid 0:cb44e2e9ec4c 195 #endif
whismanoid 0:cb44e2e9ec4c 196 #ifndef A2
whismanoid 0:cb44e2e9ec4c 197 #define A2 AIN_2
whismanoid 0:cb44e2e9ec4c 198 #endif
whismanoid 0:cb44e2e9ec4c 199 #ifndef A3
whismanoid 0:cb44e2e9ec4c 200 #define A3 AIN_3
whismanoid 0:cb44e2e9ec4c 201 #endif
whismanoid 0:cb44e2e9ec4c 202 #ifndef D0
whismanoid 0:cb44e2e9ec4c 203 #define D0 P4_0
whismanoid 0:cb44e2e9ec4c 204 #endif
whismanoid 0:cb44e2e9ec4c 205 #ifndef D1
whismanoid 0:cb44e2e9ec4c 206 #define D1 P5_6
whismanoid 0:cb44e2e9ec4c 207 #endif
whismanoid 0:cb44e2e9ec4c 208 #ifndef D2
whismanoid 0:cb44e2e9ec4c 209 #define D2 P5_5
whismanoid 0:cb44e2e9ec4c 210 #endif
whismanoid 0:cb44e2e9ec4c 211 #ifndef D3
whismanoid 0:cb44e2e9ec4c 212 #define D3 P5_4
whismanoid 0:cb44e2e9ec4c 213 #endif
whismanoid 0:cb44e2e9ec4c 214 #ifndef D4
whismanoid 0:cb44e2e9ec4c 215 #define D4 P5_3
whismanoid 0:cb44e2e9ec4c 216 #endif
whismanoid 0:cb44e2e9ec4c 217 #ifndef D5
whismanoid 0:cb44e2e9ec4c 218 #define D5 P3_3
whismanoid 0:cb44e2e9ec4c 219 #endif
whismanoid 0:cb44e2e9ec4c 220 #ifndef D6
whismanoid 0:cb44e2e9ec4c 221 #define D6 P3_2
whismanoid 0:cb44e2e9ec4c 222 #endif
whismanoid 0:cb44e2e9ec4c 223 #ifndef D7
whismanoid 0:cb44e2e9ec4c 224 #define D7 P3_5
whismanoid 0:cb44e2e9ec4c 225 #endif
whismanoid 0:cb44e2e9ec4c 226 #ifndef D8
whismanoid 0:cb44e2e9ec4c 227 #define D8 P3_4
whismanoid 0:cb44e2e9ec4c 228 #endif
whismanoid 0:cb44e2e9ec4c 229 #ifndef D9
whismanoid 0:cb44e2e9ec4c 230 #define D9 P3_1
whismanoid 0:cb44e2e9ec4c 231 #endif
whismanoid 0:cb44e2e9ec4c 232 #ifndef D10
whismanoid 0:cb44e2e9ec4c 233 #define D10 P3_0
whismanoid 0:cb44e2e9ec4c 234 #endif
whismanoid 0:cb44e2e9ec4c 235 #ifndef D11
whismanoid 0:cb44e2e9ec4c 236 #define D11 P5_1
whismanoid 0:cb44e2e9ec4c 237 #endif
whismanoid 0:cb44e2e9ec4c 238 #ifndef D12
whismanoid 0:cb44e2e9ec4c 239 #define D12 P5_2
whismanoid 0:cb44e2e9ec4c 240 #endif
whismanoid 0:cb44e2e9ec4c 241 #ifndef D13
whismanoid 0:cb44e2e9ec4c 242 #define D13 P5_0
whismanoid 0:cb44e2e9ec4c 243 #endif
whismanoid 0:cb44e2e9ec4c 244 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 245 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 246 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 247 // TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:cb44e2e9ec4c 248 // +-------------------------------------+
whismanoid 0:cb44e2e9ec4c 249 // | MAX32625MBED Arduino UNO header |
whismanoid 0:cb44e2e9ec4c 250 // | |
whismanoid 0:cb44e2e9ec4c 251 // | A5/SCL[ ] | P1_7 dig15
whismanoid 0:cb44e2e9ec4c 252 // | A4/SDA[ ] | P1_6 dig14
whismanoid 0:cb44e2e9ec4c 253 // | AREF=N/C[ ] |
whismanoid 0:cb44e2e9ec4c 254 // | GND[ ] |
whismanoid 0:cb44e2e9ec4c 255 // | [ ]N/C SCK/13[ ] | P1_0 dig13
whismanoid 0:cb44e2e9ec4c 256 // | [ ]IOREF=3V3 MISO/12[ ] | P1_2 dig12
whismanoid 0:cb44e2e9ec4c 257 // | [ ]RST MOSI/11[ ]~| P1_1 dig11
whismanoid 0:cb44e2e9ec4c 258 // | [ ]3V3 CS/10[ ]~| P1_3 dig10
whismanoid 0:cb44e2e9ec4c 259 // | [ ]5V0 9[ ]~| P1_5 dig9
whismanoid 0:cb44e2e9ec4c 260 // | [ ]GND 8[ ] | P1_4 dig8
whismanoid 0:cb44e2e9ec4c 261 // | [ ]GND |
whismanoid 0:cb44e2e9ec4c 262 // | [ ]Vin 7[ ] | P0_7 dig7
whismanoid 0:cb44e2e9ec4c 263 // | 6[ ]~| P0_6 dig6
whismanoid 0:cb44e2e9ec4c 264 // AIN_0 | [ ]A0 5[ ]~| P0_5 dig5
whismanoid 0:cb44e2e9ec4c 265 // AIN_1 | [ ]A1 4[ ] | P0_4 dig4
whismanoid 0:cb44e2e9ec4c 266 // AIN_2 | [ ]A2 INT1/3[ ]~| P0_3 dig3
whismanoid 0:cb44e2e9ec4c 267 // AIN_3 | [ ]A3 INT0/2[ ] | P0_2 dig2
whismanoid 0:cb44e2e9ec4c 268 // dig16 P3_4 | [ ]A4/SDA RST SCK MISO TX>1[ ] | P0_1 dig1
whismanoid 0:cb44e2e9ec4c 269 // dig17 P3_5 | [ ]A5/SCL [ ] [ ] [ ] RX<0[ ] | P0_0 dig0
whismanoid 0:cb44e2e9ec4c 270 // | [ ] [ ] [ ] |
whismanoid 0:cb44e2e9ec4c 271 // | UNO_R3 GND MOSI 5V ____________/
whismanoid 0:cb44e2e9ec4c 272 // \_______________________/
whismanoid 0:cb44e2e9ec4c 273 //
whismanoid 0:cb44e2e9ec4c 274 // +------------------------+
whismanoid 0:cb44e2e9ec4c 275 // | |
whismanoid 0:cb44e2e9ec4c 276 // | MicroSD LED |
whismanoid 0:cb44e2e9ec4c 277 // | SD_SCLK P2_4 r P3_0 |
whismanoid 0:cb44e2e9ec4c 278 // | SD_MOSI P2_5 g P3_1 |
whismanoid 0:cb44e2e9ec4c 279 // | SD_MISO P2_6 b P3_2 |
whismanoid 0:cb44e2e9ec4c 280 // | SD_SSEL P2_7 y P3_3 |
whismanoid 0:cb44e2e9ec4c 281 // | |
whismanoid 0:cb44e2e9ec4c 282 // | DAPLINK BUTTONS |
whismanoid 0:cb44e2e9ec4c 283 // | TX P2_1 SW3 P2_3 |
whismanoid 0:cb44e2e9ec4c 284 // | RX P2_0 SW2 P2_2 |
whismanoid 0:cb44e2e9ec4c 285 // +------------------------+
whismanoid 0:cb44e2e9ec4c 286 //
whismanoid 0:cb44e2e9ec4c 287 // AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 288 // AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 289 // AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 290 // AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 291 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 292 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 293 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 294 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 295 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 296 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 297 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 298 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 299 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 300 //
whismanoid 0:cb44e2e9ec4c 301 //#include "max32625mbed.h" // ?
whismanoid 0:cb44e2e9ec4c 302 //MAX32625MBED mbed(MAX32625MBED::VIO_3V3); // ?
whismanoid 0:cb44e2e9ec4c 303 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 304 // MAX32630FTHR board supports only internal VREF = 1.200V at bypass capacitor C15
whismanoid 0:cb44e2e9ec4c 305 const float ADC_FULL_SCALE_VOLTAGE = 1.200; // TODO: ADC_FULL_SCALE_VOLTAGE Pico?
whismanoid 0:cb44e2e9ec4c 306 // Arduino connector
whismanoid 0:cb44e2e9ec4c 307 #ifndef A0
whismanoid 0:cb44e2e9ec4c 308 #define A0 AIN_0
whismanoid 0:cb44e2e9ec4c 309 #endif
whismanoid 0:cb44e2e9ec4c 310 #ifndef A1
whismanoid 0:cb44e2e9ec4c 311 #define A1 AIN_1
whismanoid 0:cb44e2e9ec4c 312 #endif
whismanoid 0:cb44e2e9ec4c 313 #ifndef A2
whismanoid 0:cb44e2e9ec4c 314 #define A2 AIN_2
whismanoid 0:cb44e2e9ec4c 315 #endif
whismanoid 0:cb44e2e9ec4c 316 #ifndef A3
whismanoid 0:cb44e2e9ec4c 317 #define A3 AIN_3
whismanoid 0:cb44e2e9ec4c 318 #endif
whismanoid 0:cb44e2e9ec4c 319 #ifndef D0
whismanoid 0:cb44e2e9ec4c 320 #define D0 P0_0
whismanoid 0:cb44e2e9ec4c 321 #endif
whismanoid 0:cb44e2e9ec4c 322 #ifndef D1
whismanoid 0:cb44e2e9ec4c 323 #define D1 P0_1
whismanoid 0:cb44e2e9ec4c 324 #endif
whismanoid 0:cb44e2e9ec4c 325 #ifndef D2
whismanoid 0:cb44e2e9ec4c 326 #define D2 P0_2
whismanoid 0:cb44e2e9ec4c 327 #endif
whismanoid 0:cb44e2e9ec4c 328 #ifndef D3
whismanoid 0:cb44e2e9ec4c 329 #define D3 P0_3
whismanoid 0:cb44e2e9ec4c 330 #endif
whismanoid 0:cb44e2e9ec4c 331 #ifndef D4
whismanoid 0:cb44e2e9ec4c 332 #define D4 P0_4
whismanoid 0:cb44e2e9ec4c 333 #endif
whismanoid 0:cb44e2e9ec4c 334 #ifndef D5
whismanoid 0:cb44e2e9ec4c 335 #define D5 P0_5
whismanoid 0:cb44e2e9ec4c 336 #endif
whismanoid 0:cb44e2e9ec4c 337 #ifndef D6
whismanoid 0:cb44e2e9ec4c 338 #define D6 P0_6
whismanoid 0:cb44e2e9ec4c 339 #endif
whismanoid 0:cb44e2e9ec4c 340 #ifndef D7
whismanoid 0:cb44e2e9ec4c 341 #define D7 P0_7
whismanoid 0:cb44e2e9ec4c 342 #endif
whismanoid 0:cb44e2e9ec4c 343 #ifndef D8
whismanoid 0:cb44e2e9ec4c 344 #define D8 P1_4
whismanoid 0:cb44e2e9ec4c 345 #endif
whismanoid 0:cb44e2e9ec4c 346 #ifndef D9
whismanoid 0:cb44e2e9ec4c 347 #define D9 P1_5
whismanoid 0:cb44e2e9ec4c 348 #endif
whismanoid 0:cb44e2e9ec4c 349 #ifndef D10
whismanoid 0:cb44e2e9ec4c 350 #define D10 P1_3
whismanoid 0:cb44e2e9ec4c 351 #endif
whismanoid 0:cb44e2e9ec4c 352 #ifndef D11
whismanoid 0:cb44e2e9ec4c 353 #define D11 P1_1
whismanoid 0:cb44e2e9ec4c 354 #endif
whismanoid 0:cb44e2e9ec4c 355 #ifndef D12
whismanoid 0:cb44e2e9ec4c 356 #define D12 P1_2
whismanoid 0:cb44e2e9ec4c 357 #endif
whismanoid 0:cb44e2e9ec4c 358 #ifndef D13
whismanoid 0:cb44e2e9ec4c 359 #define D13 P1_0
whismanoid 0:cb44e2e9ec4c 360 #endif
whismanoid 0:cb44e2e9ec4c 361 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 362 #elif defined(TARGET_MAX32600)
whismanoid 0:cb44e2e9ec4c 363 // target MAX32600
whismanoid 0:cb44e2e9ec4c 364 //
whismanoid 0:cb44e2e9ec4c 365 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:cb44e2e9ec4c 366 const float ADC_FULL_SCALE_VOLTAGE = 1.500;
whismanoid 0:cb44e2e9ec4c 367 //
whismanoid 0:cb44e2e9ec4c 368 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 369 #elif defined(TARGET_MAX32620FTHR)
whismanoid 0:cb44e2e9ec4c 370 #warning "TARGET_MAX32620FTHR not previously tested; need to define pins..."
whismanoid 0:cb44e2e9ec4c 371 #include "MAX32620FTHR.h"
whismanoid 0:cb44e2e9ec4c 372 // Initialize I/O voltages on MAX32620FTHR board
whismanoid 0:cb44e2e9ec4c 373 MAX32620FTHR fthr(MAX32620FTHR::VIO_3V3);
whismanoid 0:cb44e2e9ec4c 374 //#define USE_LEDS 0 ?
whismanoid 0:cb44e2e9ec4c 375 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 376 #warning "TARGET_MAX32620FTHR not previously tested; need to verify ADC_FULL_SCALE_VOLTAGE..."
whismanoid 0:cb44e2e9ec4c 377 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 0:cb44e2e9ec4c 378 //
whismanoid 0:cb44e2e9ec4c 379 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 380 #elif defined(TARGET_MAX32625PICO)
whismanoid 0:cb44e2e9ec4c 381 #warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
whismanoid 0:cb44e2e9ec4c 382 #include "max32625pico.h"
whismanoid 0:cb44e2e9ec4c 383 // configure MAX32625PICO VDDIOH mode, and I/O voltages for DIP pins and SWD pins
whismanoid 0:cb44e2e9ec4c 384 MAX32625PICO pico(
whismanoid 0:cb44e2e9ec4c 385 // vddioh_mode_t iohMode
whismanoid 0:cb44e2e9ec4c 386 //~ MAX32625PICO::IOH_OFF, // No connections to VDDIOH
whismanoid 0:cb44e2e9ec4c 387 //~ MAX32625PICO::IOH_DIP_IN, // VDDIOH input from DIP pin 1 (AIN0)
whismanoid 0:cb44e2e9ec4c 388 //~ MAX32625PICO::IOH_SWD_IN, // VDDIOH input from SWD pin 1
whismanoid 0:cb44e2e9ec4c 389 MAX32625PICO::IOH_3V3, // VDDIOH = 3.3V from local supply
whismanoid 0:cb44e2e9ec4c 390 //~ MAX32625PICO::IOH_DIP_OUT, // VDDIOH = 3.3V output to DIP pin 1
whismanoid 0:cb44e2e9ec4c 391 //~ MAX32625PICO::IOH_SWD_OUT, // VDDIOH = 3.3V output to SWD pin 1
whismanoid 0:cb44e2e9ec4c 392 //
whismanoid 0:cb44e2e9ec4c 393 // vio_t dipVio = MAX32625PICO::VIO_1V8 or MAX32625PICO::VIO_IOH
whismanoid 0:cb44e2e9ec4c 394 //~ MAX32625PICO::VIO_1V8, // 1.8V IO (local)
whismanoid 0:cb44e2e9ec4c 395 MAX32625PICO::VIO_IOH, // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V)
whismanoid 0:cb44e2e9ec4c 396 //
whismanoid 0:cb44e2e9ec4c 397 // vio_t swdVio
whismanoid 0:cb44e2e9ec4c 398 //~ MAX32625PICO::VIO_1V8 // 1.8V IO (local)
whismanoid 0:cb44e2e9ec4c 399 MAX32625PICO::VIO_IOH // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V)
whismanoid 0:cb44e2e9ec4c 400 );
whismanoid 0:cb44e2e9ec4c 401 //#define USE_LEDS 0 ?
whismanoid 0:cb44e2e9ec4c 402 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 403 #warning "TARGET_MAX32625PICO not previously tested; need to verify ADC_FULL_SCALE_VOLTAGE..."
whismanoid 0:cb44e2e9ec4c 404 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 0:cb44e2e9ec4c 405 //
whismanoid 0:cb44e2e9ec4c 406 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 407 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 408 // TODO1: target NUCLEO_F446RE
whismanoid 0:cb44e2e9ec4c 409 //
whismanoid 0:cb44e2e9ec4c 410 // USER_BUTTON PC13
whismanoid 0:cb44e2e9ec4c 411 // LED1 is shared with SPI_SCK on NUCLEO_F446RE PA_5, so don't use LED1.
whismanoid 0:cb44e2e9ec4c 412 #define USE_LEDS 0
whismanoid 0:cb44e2e9ec4c 413 // SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK);
whismanoid 0:cb44e2e9ec4c 414 // Serial serial(SERIAL_TX, SERIAL_RX);
whismanoid 0:cb44e2e9ec4c 415 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:cb44e2e9ec4c 416 const float ADC_FULL_SCALE_VOLTAGE = 3.300; // TODO: ADC_FULL_SCALE_VOLTAGE Pico?
whismanoid 0:cb44e2e9ec4c 417 //
whismanoid 0:cb44e2e9ec4c 418 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 419 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 420 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 421 // TARGET=LPC1768 ARM Cortex-M3 100 MHz 512kB flash 64kB SRAM
whismanoid 0:cb44e2e9ec4c 422 // +-------------[microUSB]-------------+
whismanoid 0:cb44e2e9ec4c 423 // ______ | [ ] GND +3.3V VOUT [ ] | ______
whismanoid 0:cb44e2e9ec4c 424 // ______ | [ ] 4.5V<VIN<9.0V +5.0V VU [ ] | ______
whismanoid 0:cb44e2e9ec4c 425 // ______ | [ ] VB USB.IF- [ ] | ______
whismanoid 0:cb44e2e9ec4c 426 // ______ | [ ] nR USB.IF+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 427 // digitalInOut0 | [ ] p5 MOSI ETHERNET.RD- [ ] | ______
whismanoid 0:cb44e2e9ec4c 428 // digitalInOut1 | [ ] p6 MISO ETHERNET.RD+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 429 // digitalInOut2 | [ ] p7 SCLK ETHERNET.TD- [ ] | ______
whismanoid 0:cb44e2e9ec4c 430 // digitalInOut3 | [ ] p8 ETHERNET.TD+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 431 // digitalInOut4 | [ ] p9 TX SDA USB.D- [ ] | ______
whismanoid 0:cb44e2e9ec4c 432 // digitalInOut5 | [ ] p10 RX SCL USB.D+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 433 // digitalInOut6 | [ ] p11 MOSI CAN-RD p30 [ ] | digitalInOut13
whismanoid 0:cb44e2e9ec4c 434 // digitalInOut7 | [ ] p12 MISO CAN-TD p29 [ ] | digitalInOut12
whismanoid 0:cb44e2e9ec4c 435 // digitalInOut8 | [ ] p13 TX SCLK SDA TX p28 [ ] | digitalInOut11
whismanoid 0:cb44e2e9ec4c 436 // digitalInOut9 | [ ] p14 RX SCL RX p27 [ ] | digitalInOut10
whismanoid 0:cb44e2e9ec4c 437 // analogIn0 | [ ] p15 AIN0 3.3Vfs PWM1 p26 [ ] | pwmDriver1
whismanoid 0:cb44e2e9ec4c 438 // analogIn1 | [ ] p16 AIN1 3.3Vfs PWM2 p25 [ ] | pwmDriver2
whismanoid 0:cb44e2e9ec4c 439 // analogIn2 | [ ] p17 AIN2 3.3Vfs PWM3 p24 [ ] | pwmDriver3
whismanoid 0:cb44e2e9ec4c 440 // analogIn3 | [ ] p18 AIN3 AOUT PWM4 p23 [ ] | pwmDriver4
whismanoid 0:cb44e2e9ec4c 441 // analogIn4 | [ ] p19 AIN4 3.3Vfs PWM5 p22 [ ] | pwmDriver5
whismanoid 0:cb44e2e9ec4c 442 // analogIn5 | [ ] p20 AIN5 3.3Vfs PWM6 p21 [ ] | pwmDriver6
whismanoid 0:cb44e2e9ec4c 443 // +------------------------------------+
whismanoid 0:cb44e2e9ec4c 444 // AIN6 = P0.3 = TGT_SBL_RXD?
whismanoid 0:cb44e2e9ec4c 445 // AIN7 = P0.2 = TGT_SBL_TXD?
whismanoid 0:cb44e2e9ec4c 446 //
whismanoid 0:cb44e2e9ec4c 447 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 448 // LPC1768 board uses VREF = 3.300V +A3,3V thru L1 to bypass capacitor C14
whismanoid 0:cb44e2e9ec4c 449 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:cb44e2e9ec4c 450 const float ADC_FULL_SCALE_VOLTAGE = 3.300;
whismanoid 0:cb44e2e9ec4c 451 #else // not defined(TARGET_LPC1768 etc.)
whismanoid 0:cb44e2e9ec4c 452 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 453 // unknown target
whismanoid 0:cb44e2e9ec4c 454 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 455 #endif // target definition
whismanoid 0:cb44e2e9ec4c 456
whismanoid 0:cb44e2e9ec4c 457
whismanoid 0:cb44e2e9ec4c 458
whismanoid 0:cb44e2e9ec4c 459
whismanoid 0:cb44e2e9ec4c 460 // uncrustify-0.66.1 *INDENT-OFF*
whismanoid 0:cb44e2e9ec4c 461 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 462 // Declare the DigitalInOut GPIO pins
whismanoid 0:cb44e2e9ec4c 463 // Optional digitalInOut support. If there is only one it should be digitalInOut1.
whismanoid 0:cb44e2e9ec4c 464 // D) Digital High/Low/Input Pin
whismanoid 0:cb44e2e9ec4c 465 #if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 466 // +-------------[microUSB]-------------+
whismanoid 0:cb44e2e9ec4c 467 // | J1 MAX32630FTHR J2 |
whismanoid 0:cb44e2e9ec4c 468 // | [ ] RST GND [ ] |
whismanoid 0:cb44e2e9ec4c 469 // | [ ] 3V3 BAT+[ ] |
whismanoid 0:cb44e2e9ec4c 470 // | [ ] 1V8 reset SW1 |
whismanoid 0:cb44e2e9ec4c 471 // | [ ] GND J4 J3 |
whismanoid 0:cb44e2e9ec4c 472 // | [ ] AIN_0 1.2Vfs (bat) SYS [ ] |
whismanoid 0:cb44e2e9ec4c 473 // | [ ] AIN_1 1.2Vfs PWR [ ] |
whismanoid 0:cb44e2e9ec4c 474 // | [ ] AIN_2 1.2Vfs +5V VBUS [ ] |
whismanoid 0:cb44e2e9ec4c 475 // | [ ] AIN_3 1.2Vfs 1-WIRE P4_0 [ ] | dig9
whismanoid 0:cb44e2e9ec4c 476 // dig10 | [x] P5_7 SDA2 SRN P5_6 [ ] | dig8
whismanoid 0:cb44e2e9ec4c 477 // dig11 | [x] P6_0 SCL2 SDIO3 P5_5 [ ] | dig7
whismanoid 0:cb44e2e9ec4c 478 // dig12 | [x] P5_0 SCLK SDIO2 P5_4 [ ] | dig6
whismanoid 0:cb44e2e9ec4c 479 // dig13 | [x] P5_1 MOSI SSEL P5_3 [x] | dig5
whismanoid 0:cb44e2e9ec4c 480 // dig14 | [ ] P5_2 MISO RTS P3_3 [ ] | dig4
whismanoid 0:cb44e2e9ec4c 481 // dig15 | [ ] P3_0 RX CTS P3_2 [ ] | dig3
whismanoid 0:cb44e2e9ec4c 482 // dig0 | [ ] P3_1 TX SCL P3_5 [x] | dig2
whismanoid 0:cb44e2e9ec4c 483 // | [ ] GND SDA P3_4 [x] | dig1
whismanoid 0:cb44e2e9ec4c 484 // +------------------------------------+
whismanoid 0:cb44e2e9ec4c 485 #define HAS_digitalInOut0 1 // P3_1 TARGET_MAX32630 J1.15
whismanoid 0:cb44e2e9ec4c 486 #define HAS_digitalInOut1 1 // P3_4 TARGET_MAX32630 J3.12
whismanoid 0:cb44e2e9ec4c 487 #define HAS_digitalInOut2 1 // P3_5 TARGET_MAX32630 J3.11
whismanoid 0:cb44e2e9ec4c 488 #define HAS_digitalInOut3 1 // P3_2 TARGET_MAX32630 J3.10
whismanoid 0:cb44e2e9ec4c 489 #define HAS_digitalInOut4 1 // P3_3 TARGET_MAX32630 J3.9
whismanoid 0:cb44e2e9ec4c 490 #define HAS_digitalInOut5 1 // P5_3 TARGET_MAX32630 J3.8
whismanoid 0:cb44e2e9ec4c 491 #define HAS_digitalInOut6 1 // P5_4 TARGET_MAX32630 J3.7
whismanoid 0:cb44e2e9ec4c 492 #define HAS_digitalInOut7 1 // P5_5 TARGET_MAX32630 J3.6
whismanoid 0:cb44e2e9ec4c 493 #define HAS_digitalInOut8 1 // P5_6 TARGET_MAX32630 J3.5
whismanoid 0:cb44e2e9ec4c 494 #define HAS_digitalInOut9 1 // P4_0 TARGET_MAX32630 J3.4
whismanoid 0:cb44e2e9ec4c 495 #if HAS_I2C
whismanoid 0:cb44e2e9ec4c 496 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:cb44e2e9ec4c 497 #define HAS_digitalInOut10 0 // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:cb44e2e9ec4c 498 #define HAS_digitalInOut11 0 // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:cb44e2e9ec4c 499 #else // HAS_I2C
whismanoid 0:cb44e2e9ec4c 500 #define HAS_digitalInOut10 1 // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:cb44e2e9ec4c 501 #define HAS_digitalInOut11 1 // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:cb44e2e9ec4c 502 #endif // HAS_I2C
whismanoid 0:cb44e2e9ec4c 503 #if HAS_SPI
whismanoid 0:cb44e2e9ec4c 504 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 505 #define HAS_digitalInOut12 0 // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:cb44e2e9ec4c 506 #define HAS_digitalInOut13 0 // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:cb44e2e9ec4c 507 #define HAS_digitalInOut14 0 // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:cb44e2e9ec4c 508 #define HAS_digitalInOut15 0 // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:cb44e2e9ec4c 509 #else // HAS_SPI
whismanoid 0:cb44e2e9ec4c 510 #define HAS_digitalInOut12 1 // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:cb44e2e9ec4c 511 #define HAS_digitalInOut13 1 // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:cb44e2e9ec4c 512 #define HAS_digitalInOut14 1 // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:cb44e2e9ec4c 513 #define HAS_digitalInOut15 1 // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:cb44e2e9ec4c 514 #endif // HAS_SPI
whismanoid 0:cb44e2e9ec4c 515 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 516 DigitalInOut digitalInOut0(P3_1, PIN_INPUT, PullUp, 1); // P3_1 TARGET_MAX32630 J1.15
whismanoid 0:cb44e2e9ec4c 517 #endif
whismanoid 0:cb44e2e9ec4c 518 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 519 DigitalInOut digitalInOut1(P3_4, PIN_INPUT, PullUp, 1); // P3_4 TARGET_MAX32630 J3.12
whismanoid 0:cb44e2e9ec4c 520 #endif
whismanoid 0:cb44e2e9ec4c 521 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 522 DigitalInOut digitalInOut2(P3_5, PIN_INPUT, PullUp, 1); // P3_5 TARGET_MAX32630 J3.11
whismanoid 0:cb44e2e9ec4c 523 #endif
whismanoid 0:cb44e2e9ec4c 524 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 525 DigitalInOut digitalInOut3(P3_2, PIN_INPUT, PullUp, 1); // P3_2 TARGET_MAX32630 J3.10
whismanoid 0:cb44e2e9ec4c 526 #endif
whismanoid 0:cb44e2e9ec4c 527 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 528 DigitalInOut digitalInOut4(P3_3, PIN_INPUT, PullUp, 1); // P3_3 TARGET_MAX32630 J3.9
whismanoid 0:cb44e2e9ec4c 529 #endif
whismanoid 0:cb44e2e9ec4c 530 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 531 DigitalInOut digitalInOut5(P5_3, PIN_INPUT, PullUp, 1); // P5_3 TARGET_MAX32630 J3.8
whismanoid 0:cb44e2e9ec4c 532 #endif
whismanoid 0:cb44e2e9ec4c 533 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 534 DigitalInOut digitalInOut6(P5_4, PIN_INPUT, PullUp, 1); // P5_4 TARGET_MAX32630 J3.7
whismanoid 0:cb44e2e9ec4c 535 #endif
whismanoid 0:cb44e2e9ec4c 536 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 537 DigitalInOut digitalInOut7(P5_5, PIN_INPUT, PullUp, 1); // P5_5 TARGET_MAX32630 J3.6
whismanoid 0:cb44e2e9ec4c 538 #endif
whismanoid 0:cb44e2e9ec4c 539 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 540 DigitalInOut digitalInOut8(P5_6, PIN_INPUT, PullUp, 1); // P5_6 TARGET_MAX32630 J3.5
whismanoid 0:cb44e2e9ec4c 541 #endif
whismanoid 0:cb44e2e9ec4c 542 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 543 DigitalInOut digitalInOut9(P4_0, PIN_INPUT, PullUp, 1); // P4_0 TARGET_MAX32630 J3.4
whismanoid 0:cb44e2e9ec4c 544 #endif
whismanoid 0:cb44e2e9ec4c 545 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 546 DigitalInOut digitalInOut10(P5_7, PIN_INPUT, PullUp, 1); // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:cb44e2e9ec4c 547 #endif
whismanoid 0:cb44e2e9ec4c 548 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 549 DigitalInOut digitalInOut11(P6_0, PIN_INPUT, PullUp, 1); // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:cb44e2e9ec4c 550 #endif
whismanoid 0:cb44e2e9ec4c 551 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 552 DigitalInOut digitalInOut12(P5_0, PIN_INPUT, PullUp, 1); // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:cb44e2e9ec4c 553 #endif
whismanoid 0:cb44e2e9ec4c 554 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 555 DigitalInOut digitalInOut13(P5_1, PIN_INPUT, PullUp, 1); // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:cb44e2e9ec4c 556 #endif
whismanoid 0:cb44e2e9ec4c 557 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 558 DigitalInOut digitalInOut14(P5_2, PIN_INPUT, PullUp, 1); // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:cb44e2e9ec4c 559 #endif
whismanoid 0:cb44e2e9ec4c 560 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 561 DigitalInOut digitalInOut15(P3_0, PIN_INPUT, PullUp, 1); // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:cb44e2e9ec4c 562 #endif
whismanoid 0:cb44e2e9ec4c 563 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 564 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 565 // TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:cb44e2e9ec4c 566 // +-------------------------------------+
whismanoid 0:cb44e2e9ec4c 567 // | MAX32625MBED Arduino UNO header |
whismanoid 0:cb44e2e9ec4c 568 // | |
whismanoid 0:cb44e2e9ec4c 569 // | A5/SCL[ ] | P1_7 dig15
whismanoid 0:cb44e2e9ec4c 570 // | A4/SDA[ ] | P1_6 dig14
whismanoid 0:cb44e2e9ec4c 571 // | AREF=N/C[ ] |
whismanoid 0:cb44e2e9ec4c 572 // | GND[ ] |
whismanoid 0:cb44e2e9ec4c 573 // | [ ]N/C SCK/13[ ] | P1_0 dig13
whismanoid 0:cb44e2e9ec4c 574 // | [ ]IOREF=3V3 MISO/12[ ] | P1_2 dig12
whismanoid 0:cb44e2e9ec4c 575 // | [ ]RST MOSI/11[ ]~| P1_1 dig11
whismanoid 0:cb44e2e9ec4c 576 // | [ ]3V3 CS/10[ ]~| P1_3 dig10
whismanoid 0:cb44e2e9ec4c 577 // | [ ]5V0 9[ ]~| P1_5 dig9
whismanoid 0:cb44e2e9ec4c 578 // | [ ]GND 8[ ] | P1_4 dig8
whismanoid 0:cb44e2e9ec4c 579 // | [ ]GND |
whismanoid 0:cb44e2e9ec4c 580 // | [ ]Vin 7[ ] | P0_7 dig7
whismanoid 0:cb44e2e9ec4c 581 // | 6[ ]~| P0_6 dig6
whismanoid 0:cb44e2e9ec4c 582 // AIN_0 | [ ]A0 5[ ]~| P0_5 dig5
whismanoid 0:cb44e2e9ec4c 583 // AIN_1 | [ ]A1 4[ ] | P0_4 dig4
whismanoid 0:cb44e2e9ec4c 584 // AIN_2 | [ ]A2 INT1/3[ ]~| P0_3 dig3
whismanoid 0:cb44e2e9ec4c 585 // AIN_3 | [ ]A3 INT0/2[ ] | P0_2 dig2
whismanoid 0:cb44e2e9ec4c 586 // dig16 P3_4 | [ ]A4/SDA RST SCK MISO TX>1[ ] | P0_1 dig1
whismanoid 0:cb44e2e9ec4c 587 // dig17 P3_5 | [ ]A5/SCL [ ] [ ] [ ] RX<0[ ] | P0_0 dig0
whismanoid 0:cb44e2e9ec4c 588 // | [ ] [ ] [ ] |
whismanoid 0:cb44e2e9ec4c 589 // | UNO_R3 GND MOSI 5V ____________/
whismanoid 0:cb44e2e9ec4c 590 // \_______________________/
whismanoid 0:cb44e2e9ec4c 591 //
whismanoid 0:cb44e2e9ec4c 592 #define HAS_digitalInOut0 1 // P0_0 TARGET_MAX32625MBED D0
whismanoid 0:cb44e2e9ec4c 593 #define HAS_digitalInOut1 1 // P0_1 TARGET_MAX32625MBED D1
whismanoid 0:cb44e2e9ec4c 594 #if APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 595 #define HAS_digitalInOut2 0 // P0_2 TARGET_MAX32625MBED D2 -- MAX11131 EOC DigitalIn
whismanoid 0:cb44e2e9ec4c 596 #else
whismanoid 0:cb44e2e9ec4c 597 #define HAS_digitalInOut2 1 // P0_2 TARGET_MAX32625MBED D2
whismanoid 0:cb44e2e9ec4c 598 #endif
whismanoid 0:cb44e2e9ec4c 599 #define HAS_digitalInOut3 1 // P0_3 TARGET_MAX32625MBED D3
whismanoid 0:cb44e2e9ec4c 600 #define HAS_digitalInOut4 1 // P0_4 TARGET_MAX32625MBED D4
whismanoid 0:cb44e2e9ec4c 601 #define HAS_digitalInOut5 1 // P0_5 TARGET_MAX32625MBED D5
whismanoid 0:cb44e2e9ec4c 602 #define HAS_digitalInOut6 1 // P0_6 TARGET_MAX32625MBED D6
whismanoid 0:cb44e2e9ec4c 603 #define HAS_digitalInOut7 1 // P0_7 TARGET_MAX32625MBED D7
whismanoid 0:cb44e2e9ec4c 604 #define HAS_digitalInOut8 1 // P1_4 TARGET_MAX32625MBED D8
whismanoid 0:cb44e2e9ec4c 605 #if APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 606 #define HAS_digitalInOut9 0 // P1_5 TARGET_MAX32625MBED D9 -- MAX11131 CNVST DigitalOut
whismanoid 0:cb44e2e9ec4c 607 #else
whismanoid 0:cb44e2e9ec4c 608 #define HAS_digitalInOut9 1 // P1_5 TARGET_MAX32625MBED D9
whismanoid 0:cb44e2e9ec4c 609 #endif
whismanoid 0:cb44e2e9ec4c 610 #if HAS_SPI
whismanoid 0:cb44e2e9ec4c 611 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 612 #define HAS_digitalInOut10 0 // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:cb44e2e9ec4c 613 #define HAS_digitalInOut11 0 // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:cb44e2e9ec4c 614 #define HAS_digitalInOut12 0 // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:cb44e2e9ec4c 615 #define HAS_digitalInOut13 0 // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:cb44e2e9ec4c 616 #else // HAS_SPI
whismanoid 0:cb44e2e9ec4c 617 #define HAS_digitalInOut10 1 // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:cb44e2e9ec4c 618 #define HAS_digitalInOut11 1 // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:cb44e2e9ec4c 619 #define HAS_digitalInOut12 1 // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:cb44e2e9ec4c 620 #define HAS_digitalInOut13 1 // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:cb44e2e9ec4c 621 #endif // HAS_SPI
whismanoid 0:cb44e2e9ec4c 622 #if HAS_I2C
whismanoid 0:cb44e2e9ec4c 623 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:cb44e2e9ec4c 624 #define HAS_digitalInOut14 0 // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 625 #define HAS_digitalInOut15 0 // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 626 #define HAS_digitalInOut16 0 // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 627 #define HAS_digitalInOut17 0 // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 628 #else // HAS_I2C
whismanoid 0:cb44e2e9ec4c 629 #define HAS_digitalInOut14 1 // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 630 #define HAS_digitalInOut15 1 // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 631 #define HAS_digitalInOut16 1 // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 632 #define HAS_digitalInOut17 1 // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 633 #endif // HAS_I2C
whismanoid 0:cb44e2e9ec4c 634 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 635 DigitalInOut digitalInOut0(P0_0, PIN_INPUT, PullUp, 1); // P0_0 TARGET_MAX32625MBED D0
whismanoid 0:cb44e2e9ec4c 636 #endif
whismanoid 0:cb44e2e9ec4c 637 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 638 DigitalInOut digitalInOut1(P0_1, PIN_INPUT, PullUp, 1); // P0_1 TARGET_MAX32625MBED D1
whismanoid 0:cb44e2e9ec4c 639 #endif
whismanoid 0:cb44e2e9ec4c 640 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 641 DigitalInOut digitalInOut2(P0_2, PIN_INPUT, PullUp, 1); // P0_2 TARGET_MAX32625MBED D2
whismanoid 0:cb44e2e9ec4c 642 #endif
whismanoid 0:cb44e2e9ec4c 643 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 644 DigitalInOut digitalInOut3(P0_3, PIN_INPUT, PullUp, 1); // P0_3 TARGET_MAX32625MBED D3
whismanoid 0:cb44e2e9ec4c 645 #endif
whismanoid 0:cb44e2e9ec4c 646 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 647 DigitalInOut digitalInOut4(P0_4, PIN_INPUT, PullUp, 1); // P0_4 TARGET_MAX32625MBED D4
whismanoid 0:cb44e2e9ec4c 648 #endif
whismanoid 0:cb44e2e9ec4c 649 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 650 DigitalInOut digitalInOut5(P0_5, PIN_INPUT, PullUp, 1); // P0_5 TARGET_MAX32625MBED D5
whismanoid 0:cb44e2e9ec4c 651 #endif
whismanoid 0:cb44e2e9ec4c 652 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 653 DigitalInOut digitalInOut6(P0_6, PIN_INPUT, PullUp, 1); // P0_6 TARGET_MAX32625MBED D6
whismanoid 0:cb44e2e9ec4c 654 #endif
whismanoid 0:cb44e2e9ec4c 655 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 656 DigitalInOut digitalInOut7(P0_7, PIN_INPUT, PullUp, 1); // P0_7 TARGET_MAX32625MBED D7
whismanoid 0:cb44e2e9ec4c 657 #endif
whismanoid 0:cb44e2e9ec4c 658 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 659 DigitalInOut digitalInOut8(P1_4, PIN_INPUT, PullUp, 1); // P1_4 TARGET_MAX32625MBED D8
whismanoid 0:cb44e2e9ec4c 660 #endif
whismanoid 0:cb44e2e9ec4c 661 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 662 DigitalInOut digitalInOut9(P1_5, PIN_INPUT, PullUp, 1); // P1_5 TARGET_MAX32625MBED D9
whismanoid 0:cb44e2e9ec4c 663 #endif
whismanoid 0:cb44e2e9ec4c 664 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 665 DigitalInOut digitalInOut10(P1_3, PIN_INPUT, PullUp, 1); // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:cb44e2e9ec4c 666 #endif
whismanoid 0:cb44e2e9ec4c 667 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 668 DigitalInOut digitalInOut11(P1_1, PIN_INPUT, PullUp, 1); // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:cb44e2e9ec4c 669 #endif
whismanoid 0:cb44e2e9ec4c 670 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 671 DigitalInOut digitalInOut12(P1_2, PIN_INPUT, PullUp, 1); // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:cb44e2e9ec4c 672 #endif
whismanoid 0:cb44e2e9ec4c 673 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 674 DigitalInOut digitalInOut13(P1_0, PIN_INPUT, PullUp, 1); // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:cb44e2e9ec4c 675 #endif
whismanoid 0:cb44e2e9ec4c 676 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 677 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 678 // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain
whismanoid 0:cb44e2e9ec4c 679 DigitalInOut digitalInOut14(P1_6, PIN_INPUT, OpenDrain, 1); // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 680 #endif
whismanoid 0:cb44e2e9ec4c 681 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 682 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 683 DigitalInOut digitalInOut15(P1_7, PIN_INPUT, OpenDrain, 1); // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 684 #endif
whismanoid 0:cb44e2e9ec4c 685 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 686 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 687 // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain
whismanoid 0:cb44e2e9ec4c 688 // PullUp-->3.4V, PullDown-->1.7V, PullNone-->3.5V, OpenDrain-->0.00V
whismanoid 0:cb44e2e9ec4c 689 DigitalInOut digitalInOut16(P3_4, PIN_INPUT, OpenDrain, 0); // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 690 #endif
whismanoid 0:cb44e2e9ec4c 691 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 692 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 693 DigitalInOut digitalInOut17(P3_5, PIN_INPUT, OpenDrain, 0); // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 694 #endif
whismanoid 0:cb44e2e9ec4c 695 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 696 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 697 #define HAS_digitalInOut0 0
whismanoid 0:cb44e2e9ec4c 698 #define HAS_digitalInOut1 0
whismanoid 0:cb44e2e9ec4c 699 #if APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 700 // D2 -- MAX11131 EOC DigitalIn
whismanoid 0:cb44e2e9ec4c 701 #define HAS_digitalInOut2 0
whismanoid 0:cb44e2e9ec4c 702 #else
whismanoid 0:cb44e2e9ec4c 703 #define HAS_digitalInOut2 1
whismanoid 0:cb44e2e9ec4c 704 #endif
whismanoid 0:cb44e2e9ec4c 705 #define HAS_digitalInOut3 1
whismanoid 0:cb44e2e9ec4c 706 #define HAS_digitalInOut4 1
whismanoid 0:cb44e2e9ec4c 707 #define HAS_digitalInOut5 1
whismanoid 0:cb44e2e9ec4c 708 #define HAS_digitalInOut6 1
whismanoid 0:cb44e2e9ec4c 709 #define HAS_digitalInOut7 1
whismanoid 0:cb44e2e9ec4c 710 #if APPLICATION_MAX5715
whismanoid 0:cb44e2e9ec4c 711 // D8 -- MAX5715 CLRb DigitalOut
whismanoid 0:cb44e2e9ec4c 712 #define HAS_digitalInOut8 0
whismanoid 0:cb44e2e9ec4c 713 #else
whismanoid 0:cb44e2e9ec4c 714 #define HAS_digitalInOut8 1
whismanoid 0:cb44e2e9ec4c 715 #endif
whismanoid 0:cb44e2e9ec4c 716 #if APPLICATION_MAX5715
whismanoid 0:cb44e2e9ec4c 717 // D9 -- MAX5715 LDACb DigitalOut
whismanoid 0:cb44e2e9ec4c 718 #define HAS_digitalInOut9 0
whismanoid 0:cb44e2e9ec4c 719 #elif APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 720 // D9 -- MAX11131 CNVST DigitalOut
whismanoid 0:cb44e2e9ec4c 721 #define HAS_digitalInOut9 0
whismanoid 0:cb44e2e9ec4c 722 #else
whismanoid 0:cb44e2e9ec4c 723 #define HAS_digitalInOut9 1
whismanoid 0:cb44e2e9ec4c 724 #endif
whismanoid 0:cb44e2e9ec4c 725 #if HAS_SPI
whismanoid 0:cb44e2e9ec4c 726 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 727 // Arduino digital pin D10 SPI function is CS/10
whismanoid 0:cb44e2e9ec4c 728 // Arduino digital pin D11 SPI function is MOSI/11
whismanoid 0:cb44e2e9ec4c 729 // Arduino digital pin D12 SPI function is MISO/12
whismanoid 0:cb44e2e9ec4c 730 // Arduino digital pin D13 SPI function is SCK/13
whismanoid 0:cb44e2e9ec4c 731 #define HAS_digitalInOut10 0
whismanoid 0:cb44e2e9ec4c 732 #define HAS_digitalInOut11 0
whismanoid 0:cb44e2e9ec4c 733 #define HAS_digitalInOut12 0
whismanoid 0:cb44e2e9ec4c 734 #define HAS_digitalInOut13 0
whismanoid 0:cb44e2e9ec4c 735 #else // HAS_SPI
whismanoid 0:cb44e2e9ec4c 736 #define HAS_digitalInOut10 1
whismanoid 0:cb44e2e9ec4c 737 #define HAS_digitalInOut11 1
whismanoid 0:cb44e2e9ec4c 738 #define HAS_digitalInOut12 1
whismanoid 0:cb44e2e9ec4c 739 #define HAS_digitalInOut13 1
whismanoid 0:cb44e2e9ec4c 740 #endif // HAS_SPI
whismanoid 0:cb44e2e9ec4c 741 #if HAS_I2C
whismanoid 0:cb44e2e9ec4c 742 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:cb44e2e9ec4c 743 // Arduino digital pin D14 I2C function is A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 744 // Arduino digital pin D15 I2C function is A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 745 // Arduino digital pin D16 I2C function is A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 746 // Arduino digital pin D17 I2C function is A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 747 #define HAS_digitalInOut14 0
whismanoid 0:cb44e2e9ec4c 748 #define HAS_digitalInOut15 0
whismanoid 0:cb44e2e9ec4c 749 #define HAS_digitalInOut16 0
whismanoid 0:cb44e2e9ec4c 750 #define HAS_digitalInOut17 0
whismanoid 0:cb44e2e9ec4c 751 #else // HAS_I2C
whismanoid 0:cb44e2e9ec4c 752 #define HAS_digitalInOut14 1
whismanoid 0:cb44e2e9ec4c 753 #define HAS_digitalInOut15 1
whismanoid 0:cb44e2e9ec4c 754 #define HAS_digitalInOut16 0
whismanoid 0:cb44e2e9ec4c 755 #define HAS_digitalInOut17 0
whismanoid 0:cb44e2e9ec4c 756 #endif // HAS_I2C
whismanoid 0:cb44e2e9ec4c 757 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 758 DigitalInOut digitalInOut0(D0, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 759 #endif
whismanoid 0:cb44e2e9ec4c 760 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 761 DigitalInOut digitalInOut1(D1, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 762 #endif
whismanoid 0:cb44e2e9ec4c 763 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 764 DigitalInOut digitalInOut2(D2, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 765 #endif
whismanoid 0:cb44e2e9ec4c 766 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 767 DigitalInOut digitalInOut3(D3, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 768 #endif
whismanoid 0:cb44e2e9ec4c 769 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 770 DigitalInOut digitalInOut4(D4, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 771 #endif
whismanoid 0:cb44e2e9ec4c 772 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 773 DigitalInOut digitalInOut5(D5, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 774 #endif
whismanoid 0:cb44e2e9ec4c 775 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 776 DigitalInOut digitalInOut6(D6, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 777 #endif
whismanoid 0:cb44e2e9ec4c 778 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 779 DigitalInOut digitalInOut7(D7, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 780 #endif
whismanoid 0:cb44e2e9ec4c 781 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 782 DigitalInOut digitalInOut8(D8, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 783 #endif
whismanoid 0:cb44e2e9ec4c 784 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 785 DigitalInOut digitalInOut9(D9, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 786 #endif
whismanoid 0:cb44e2e9ec4c 787 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 788 // Arduino digital pin D10 SPI function is CS/10
whismanoid 0:cb44e2e9ec4c 789 DigitalInOut digitalInOut10(D10, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 790 #endif
whismanoid 0:cb44e2e9ec4c 791 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 792 // Arduino digital pin D11 SPI function is MOSI/11
whismanoid 0:cb44e2e9ec4c 793 DigitalInOut digitalInOut11(D11, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 794 #endif
whismanoid 0:cb44e2e9ec4c 795 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 796 // Arduino digital pin D12 SPI function is MISO/12
whismanoid 0:cb44e2e9ec4c 797 DigitalInOut digitalInOut12(D12, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 798 #endif
whismanoid 0:cb44e2e9ec4c 799 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 800 // Arduino digital pin D13 SPI function is SCK/13
whismanoid 0:cb44e2e9ec4c 801 DigitalInOut digitalInOut13(D13, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 802 #endif
whismanoid 0:cb44e2e9ec4c 803 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 804 // Arduino digital pin D14 I2C function is A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 805 DigitalInOut digitalInOut14(D14, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 806 #endif
whismanoid 0:cb44e2e9ec4c 807 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 808 // Arduino digital pin D15 I2C function is A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 809 DigitalInOut digitalInOut15(D15, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 810 #endif
whismanoid 0:cb44e2e9ec4c 811 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 812 // Arduino digital pin D16 I2C function is A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 813 DigitalInOut digitalInOut16(D16, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 814 #endif
whismanoid 0:cb44e2e9ec4c 815 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 816 // Arduino digital pin D17 I2C function is A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 817 DigitalInOut digitalInOut17(D17, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 818 #endif
whismanoid 0:cb44e2e9ec4c 819 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 820 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 821 #define HAS_digitalInOut0 1
whismanoid 0:cb44e2e9ec4c 822 #define HAS_digitalInOut1 1
whismanoid 0:cb44e2e9ec4c 823 #define HAS_digitalInOut2 1
whismanoid 0:cb44e2e9ec4c 824 #define HAS_digitalInOut3 1
whismanoid 0:cb44e2e9ec4c 825 #define HAS_digitalInOut4 1
whismanoid 0:cb44e2e9ec4c 826 #define HAS_digitalInOut5 1
whismanoid 0:cb44e2e9ec4c 827 #define HAS_digitalInOut6 1
whismanoid 0:cb44e2e9ec4c 828 #define HAS_digitalInOut7 1
whismanoid 0:cb44e2e9ec4c 829 #define HAS_digitalInOut8 1
whismanoid 0:cb44e2e9ec4c 830 #define HAS_digitalInOut9 1
whismanoid 0:cb44e2e9ec4c 831 // #define HAS_digitalInOut10 1
whismanoid 0:cb44e2e9ec4c 832 // #define HAS_digitalInOut11 1
whismanoid 0:cb44e2e9ec4c 833 // #define HAS_digitalInOut12 1
whismanoid 0:cb44e2e9ec4c 834 // #define HAS_digitalInOut13 1
whismanoid 0:cb44e2e9ec4c 835 // #define HAS_digitalInOut14 1
whismanoid 0:cb44e2e9ec4c 836 // #define HAS_digitalInOut15 1
whismanoid 0:cb44e2e9ec4c 837 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 838 DigitalInOut digitalInOut0(p5, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.9/I2STX_SDA/MOSI1/MAT2.3
whismanoid 0:cb44e2e9ec4c 839 #endif
whismanoid 0:cb44e2e9ec4c 840 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 841 DigitalInOut digitalInOut1(p6, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.8/I2STX_WS/MISO1/MAT2.2
whismanoid 0:cb44e2e9ec4c 842 #endif
whismanoid 0:cb44e2e9ec4c 843 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 844 DigitalInOut digitalInOut2(p7, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.7/I2STX_CLK/SCK1/MAT2.1
whismanoid 0:cb44e2e9ec4c 845 #endif
whismanoid 0:cb44e2e9ec4c 846 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 847 DigitalInOut digitalInOut3(p8, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.6/I2SRX_SDA/SSEL1/MAT2.0
whismanoid 0:cb44e2e9ec4c 848 #endif
whismanoid 0:cb44e2e9ec4c 849 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 850 DigitalInOut digitalInOut4(p9, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.0/CAN_RX1/TXD3/SDA1
whismanoid 0:cb44e2e9ec4c 851 #endif
whismanoid 0:cb44e2e9ec4c 852 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 853 DigitalInOut digitalInOut5(p10, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.1/CAN_TX1/RXD3/SCL1
whismanoid 0:cb44e2e9ec4c 854 #endif
whismanoid 0:cb44e2e9ec4c 855 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 856 DigitalInOut digitalInOut6(p11, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.18/DCD1/MOSI0/MOSI1
whismanoid 0:cb44e2e9ec4c 857 #endif
whismanoid 0:cb44e2e9ec4c 858 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 859 DigitalInOut digitalInOut7(p12, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.17/CTS1/MISO0/MISO
whismanoid 0:cb44e2e9ec4c 860 #endif
whismanoid 0:cb44e2e9ec4c 861 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 862 DigitalInOut digitalInOut8(p13, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.15/TXD1/SCK0/SCK
whismanoid 0:cb44e2e9ec4c 863 #endif
whismanoid 0:cb44e2e9ec4c 864 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 865 DigitalInOut digitalInOut9(p14, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.16/RXD1/SSEL0/SSEL
whismanoid 0:cb44e2e9ec4c 866 #endif
whismanoid 0:cb44e2e9ec4c 867 //
whismanoid 0:cb44e2e9ec4c 868 // these pins support analog input analogIn0 .. analogIn5
whismanoid 0:cb44e2e9ec4c 869 //DigitalInOut digitalInOut_(p15, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.23/AD0.0/I2SRX_CLK/CAP3.0
whismanoid 0:cb44e2e9ec4c 870 //DigitalInOut digitalInOut_(p16, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.24/AD0.1/I2SRX_WS/CAP3.1
whismanoid 0:cb44e2e9ec4c 871 //DigitalInOut digitalInOut_(p17, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.25/AD0.2/I2SRX_SDA/TXD3
whismanoid 0:cb44e2e9ec4c 872 //DigitalInOut digitalInOut_(p18, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.26/AD0.3/AOUT/RXD3
whismanoid 0:cb44e2e9ec4c 873 //DigitalInOut digitalInOut_(p19, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P1.30/VBUS/AD0.4
whismanoid 0:cb44e2e9ec4c 874 //DigitalInOut digitalInOut_(p20, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P1.31/SCK1/AD0.5
whismanoid 0:cb44e2e9ec4c 875 //
whismanoid 0:cb44e2e9ec4c 876 // these pins support PWM pwmDriver1 .. pwmDriver6
whismanoid 0:cb44e2e9ec4c 877 //DigitalInOut digitalInOut_(p21, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.5/PWM1.6/DTR1/TRACEDATA0
whismanoid 0:cb44e2e9ec4c 878 //DigitalInOut digitalInOut_(p22, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.4/PWM1.5/DSR1/TRACEDATA1
whismanoid 0:cb44e2e9ec4c 879 //DigitalInOut digitalInOut_(p23, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.3/PWM1.4/DCD1/TRACEDATA2
whismanoid 0:cb44e2e9ec4c 880 //DigitalInOut digitalInOut_(p24, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.2/PWM1.3/CTS1/TRACEDATA3
whismanoid 0:cb44e2e9ec4c 881 //DigitalInOut digitalInOut_(p25, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.1/PWM1.2/RXD1
whismanoid 0:cb44e2e9ec4c 882 //DigitalInOut digitalInOut_(p26, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.0/PWM1.1/TXD1/TRACECLK
whismanoid 0:cb44e2e9ec4c 883 //
whismanoid 0:cb44e2e9ec4c 884 // these could be additional digitalInOut pins
whismanoid 0:cb44e2e9ec4c 885 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 886 DigitalInOut digitalInOut10(p27, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.11/RXD2/SCL2/MAT3.1
whismanoid 0:cb44e2e9ec4c 887 #endif
whismanoid 0:cb44e2e9ec4c 888 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 889 DigitalInOut digitalInOut11(p28, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.10/TXD2/SDA2/MAT3.0
whismanoid 0:cb44e2e9ec4c 890 #endif
whismanoid 0:cb44e2e9ec4c 891 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 892 DigitalInOut digitalInOut12(p29, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.5/I2SRX_WS/CAN_TX2/CAP2.1
whismanoid 0:cb44e2e9ec4c 893 #endif
whismanoid 0:cb44e2e9ec4c 894 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 895 DigitalInOut digitalInOut13(p30, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.4/I2SRX_CLK/CAN_RX2/CAP2.0
whismanoid 0:cb44e2e9ec4c 896 #endif
whismanoid 0:cb44e2e9ec4c 897 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 898 DigitalInOut digitalInOut14(___, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 899 #endif
whismanoid 0:cb44e2e9ec4c 900 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 901 DigitalInOut digitalInOut15(___, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 902 #endif
whismanoid 0:cb44e2e9ec4c 903 #else
whismanoid 0:cb44e2e9ec4c 904 // unknown target
whismanoid 0:cb44e2e9ec4c 905 #endif
whismanoid 0:cb44e2e9ec4c 906 // uncrustify-0.66.1 *INDENT-ON*
whismanoid 0:cb44e2e9ec4c 907 #if HAS_digitalInOut0 || HAS_digitalInOut1 \
whismanoid 0:cb44e2e9ec4c 908 || HAS_digitalInOut2 || HAS_digitalInOut3 \
whismanoid 0:cb44e2e9ec4c 909 || HAS_digitalInOut4 || HAS_digitalInOut5 \
whismanoid 0:cb44e2e9ec4c 910 || HAS_digitalInOut6 || HAS_digitalInOut7 \
whismanoid 0:cb44e2e9ec4c 911 || HAS_digitalInOut8 || HAS_digitalInOut9 \
whismanoid 0:cb44e2e9ec4c 912 || HAS_digitalInOut10 || HAS_digitalInOut11 \
whismanoid 0:cb44e2e9ec4c 913 || HAS_digitalInOut12 || HAS_digitalInOut13 \
whismanoid 0:cb44e2e9ec4c 914 || HAS_digitalInOut14 || HAS_digitalInOut15 \
whismanoid 0:cb44e2e9ec4c 915 || HAS_digitalInOut16 || HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 916 #define HAS_digitalInOuts 1
whismanoid 0:cb44e2e9ec4c 917 #else
whismanoid 0:cb44e2e9ec4c 918 #warning "Note: There are no digitalInOut resources defined"
whismanoid 0:cb44e2e9ec4c 919 #endif
whismanoid 0:cb44e2e9ec4c 920
whismanoid 0:cb44e2e9ec4c 921 // uncrustify-0.66.1 *INDENT-OFF*
whismanoid 0:cb44e2e9ec4c 922 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 923 // Declare the AnalogIn driver
whismanoid 0:cb44e2e9ec4c 924 // Optional analogIn support. If there is only one it should be analogIn1.
whismanoid 0:cb44e2e9ec4c 925 // A) analog input
whismanoid 0:cb44e2e9ec4c 926 #if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 927 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 928 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 929 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 930 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 931 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 932 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 933 #define HAS_analogIn6 1
whismanoid 0:cb44e2e9ec4c 934 #define HAS_analogIn7 1
whismanoid 0:cb44e2e9ec4c 935 #define HAS_analogIn8 1
whismanoid 0:cb44e2e9ec4c 936 #define HAS_analogIn9 1
whismanoid 0:cb44e2e9ec4c 937 // #define HAS_analogIn10 0
whismanoid 0:cb44e2e9ec4c 938 // #define HAS_analogIn11 0
whismanoid 0:cb44e2e9ec4c 939 // #define HAS_analogIn12 0
whismanoid 0:cb44e2e9ec4c 940 // #define HAS_analogIn13 0
whismanoid 0:cb44e2e9ec4c 941 // #define HAS_analogIn14 0
whismanoid 0:cb44e2e9ec4c 942 // #define HAS_analogIn15 0
whismanoid 0:cb44e2e9ec4c 943 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 944 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 945 #endif
whismanoid 0:cb44e2e9ec4c 946 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 947 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 948 #endif
whismanoid 0:cb44e2e9ec4c 949 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 950 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 951 #endif
whismanoid 0:cb44e2e9ec4c 952 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 953 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 954 #endif
whismanoid 0:cb44e2e9ec4c 955 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 956 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 957 #endif
whismanoid 0:cb44e2e9ec4c 958 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 959 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 960 #endif
whismanoid 0:cb44e2e9ec4c 961 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 962 AnalogIn analogIn6(AIN_6); // TARGET_MAX32630 AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 963 #endif
whismanoid 0:cb44e2e9ec4c 964 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 965 AnalogIn analogIn7(AIN_7); // TARGET_MAX32630 AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 966 #endif
whismanoid 0:cb44e2e9ec4c 967 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 968 AnalogIn analogIn8(AIN_8); // TARGET_MAX32630 AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 969 #endif
whismanoid 0:cb44e2e9ec4c 970 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 971 AnalogIn analogIn9(AIN_9); // TARGET_MAX32630 AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 972 #endif
whismanoid 0:cb44e2e9ec4c 973 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 974 AnalogIn analogIn10(____); // TARGET_MAX32630 AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 975 #endif
whismanoid 0:cb44e2e9ec4c 976 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 977 AnalogIn analogIn11(____); // TARGET_MAX32630 AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 978 #endif
whismanoid 0:cb44e2e9ec4c 979 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 980 AnalogIn analogIn12(____); // TARGET_MAX32630 AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 981 #endif
whismanoid 0:cb44e2e9ec4c 982 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 983 AnalogIn analogIn13(____);
whismanoid 0:cb44e2e9ec4c 984 #endif
whismanoid 0:cb44e2e9ec4c 985 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 986 AnalogIn analogIn14(____);
whismanoid 0:cb44e2e9ec4c 987 #endif
whismanoid 0:cb44e2e9ec4c 988 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 989 AnalogIn analogIn15(____);
whismanoid 0:cb44e2e9ec4c 990 #endif
whismanoid 0:cb44e2e9ec4c 991 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 992 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 993 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 994 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 995 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 996 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 997 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 998 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 999 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1000 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1001 #endif
whismanoid 0:cb44e2e9ec4c 1002 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1003 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1004 #endif
whismanoid 0:cb44e2e9ec4c 1005 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1006 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1007 #endif
whismanoid 0:cb44e2e9ec4c 1008 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1009 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1010 #endif
whismanoid 0:cb44e2e9ec4c 1011 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1012 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1013 #endif
whismanoid 0:cb44e2e9ec4c 1014 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1015 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1016 #endif
whismanoid 0:cb44e2e9ec4c 1017 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1018 #elif defined(TARGET_MAX32620FTHR)
whismanoid 0:cb44e2e9ec4c 1019 #warning "TARGET_MAX32620FTHR not previously tested; need to verify analogIn0..."
whismanoid 0:cb44e2e9ec4c 1020 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1021 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 1022 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 1023 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 1024 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 1025 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 1026 #define HAS_analogIn6 1
whismanoid 0:cb44e2e9ec4c 1027 #define HAS_analogIn7 1
whismanoid 0:cb44e2e9ec4c 1028 #define HAS_analogIn8 1
whismanoid 0:cb44e2e9ec4c 1029 #define HAS_analogIn9 1
whismanoid 0:cb44e2e9ec4c 1030 // #define HAS_analogIn10 0
whismanoid 0:cb44e2e9ec4c 1031 // #define HAS_analogIn11 0
whismanoid 0:cb44e2e9ec4c 1032 // #define HAS_analogIn12 0
whismanoid 0:cb44e2e9ec4c 1033 // #define HAS_analogIn13 0
whismanoid 0:cb44e2e9ec4c 1034 // #define HAS_analogIn14 0
whismanoid 0:cb44e2e9ec4c 1035 // #define HAS_analogIn15 0
whismanoid 0:cb44e2e9ec4c 1036 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1037 AnalogIn analogIn0(AIN_0); // TARGET_MAX32620FTHR J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1038 #endif
whismanoid 0:cb44e2e9ec4c 1039 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1040 AnalogIn analogIn1(AIN_1); // TARGET_MAX32620FTHR J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1041 #endif
whismanoid 0:cb44e2e9ec4c 1042 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1043 AnalogIn analogIn2(AIN_2); // TARGET_MAX32620FTHR J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1044 #endif
whismanoid 0:cb44e2e9ec4c 1045 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1046 AnalogIn analogIn3(AIN_3); // TARGET_MAX32620FTHR J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1047 #endif
whismanoid 0:cb44e2e9ec4c 1048 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1049 AnalogIn analogIn4(AIN_4); // TARGET_MAX32620FTHR J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1050 #endif
whismanoid 0:cb44e2e9ec4c 1051 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1052 AnalogIn analogIn5(AIN_5); // TARGET_MAX32620FTHR J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1053 #endif
whismanoid 0:cb44e2e9ec4c 1054 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 1055 AnalogIn analogIn6(AIN_6); // TARGET_MAX32620FTHR AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1056 #endif
whismanoid 0:cb44e2e9ec4c 1057 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 1058 AnalogIn analogIn7(AIN_7); // TARGET_MAX32620FTHR AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1059 #endif
whismanoid 0:cb44e2e9ec4c 1060 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 1061 AnalogIn analogIn8(AIN_8); // TARGET_MAX32620FTHR AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1062 #endif
whismanoid 0:cb44e2e9ec4c 1063 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 1064 AnalogIn analogIn9(AIN_9); // TARGET_MAX32620FTHR AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 1065 #endif
whismanoid 0:cb44e2e9ec4c 1066 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 1067 AnalogIn analogIn10(____); // TARGET_MAX32620FTHR AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 1068 #endif
whismanoid 0:cb44e2e9ec4c 1069 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 1070 AnalogIn analogIn11(____); // TARGET_MAX32620FTHR AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1071 #endif
whismanoid 0:cb44e2e9ec4c 1072 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 1073 AnalogIn analogIn12(____); // TARGET_MAX32620FTHR AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1074 #endif
whismanoid 0:cb44e2e9ec4c 1075 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 1076 AnalogIn analogIn13(____);
whismanoid 0:cb44e2e9ec4c 1077 #endif
whismanoid 0:cb44e2e9ec4c 1078 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 1079 AnalogIn analogIn14(____);
whismanoid 0:cb44e2e9ec4c 1080 #endif
whismanoid 0:cb44e2e9ec4c 1081 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 1082 AnalogIn analogIn15(____);
whismanoid 0:cb44e2e9ec4c 1083 #endif
whismanoid 0:cb44e2e9ec4c 1084 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1085 #elif defined(TARGET_MAX32625PICO)
whismanoid 0:cb44e2e9ec4c 1086 #warning "TARGET_MAX32625PICO not previously tested; need to verify analogIn0..."
whismanoid 0:cb44e2e9ec4c 1087 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1088 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 1089 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 1090 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 1091 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 1092 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 1093 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1094 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1095 #endif
whismanoid 0:cb44e2e9ec4c 1096 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1097 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1098 #endif
whismanoid 0:cb44e2e9ec4c 1099 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1100 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1101 #endif
whismanoid 0:cb44e2e9ec4c 1102 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1103 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1104 #endif
whismanoid 0:cb44e2e9ec4c 1105 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1106 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1107 #endif
whismanoid 0:cb44e2e9ec4c 1108 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1109 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1110 #endif
whismanoid 0:cb44e2e9ec4c 1111 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1112 #elif defined(TARGET_MAX32600)
whismanoid 0:cb44e2e9ec4c 1113 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1114 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 1115 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 1116 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 1117 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 1118 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 1119 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1120 AnalogIn analogIn0(A0);
whismanoid 0:cb44e2e9ec4c 1121 #endif
whismanoid 0:cb44e2e9ec4c 1122 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1123 AnalogIn analogIn1(A1);
whismanoid 0:cb44e2e9ec4c 1124 #endif
whismanoid 0:cb44e2e9ec4c 1125 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1126 AnalogIn analogIn2(A2);
whismanoid 0:cb44e2e9ec4c 1127 #endif
whismanoid 0:cb44e2e9ec4c 1128 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1129 AnalogIn analogIn3(A3);
whismanoid 0:cb44e2e9ec4c 1130 #endif
whismanoid 0:cb44e2e9ec4c 1131 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1132 AnalogIn analogIn4(A4);
whismanoid 0:cb44e2e9ec4c 1133 #endif
whismanoid 0:cb44e2e9ec4c 1134 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1135 AnalogIn analogIn5(A5);
whismanoid 0:cb44e2e9ec4c 1136 #endif
whismanoid 0:cb44e2e9ec4c 1137 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1138 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:cb44e2e9ec4c 1139 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1140 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 1141 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 1142 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 1143 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 1144 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 1145 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1146 AnalogIn analogIn0(A0);
whismanoid 0:cb44e2e9ec4c 1147 #endif
whismanoid 0:cb44e2e9ec4c 1148 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1149 AnalogIn analogIn1(A1);
whismanoid 0:cb44e2e9ec4c 1150 #endif
whismanoid 0:cb44e2e9ec4c 1151 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1152 AnalogIn analogIn2(A2);
whismanoid 0:cb44e2e9ec4c 1153 #endif
whismanoid 0:cb44e2e9ec4c 1154 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1155 AnalogIn analogIn3(A3);
whismanoid 0:cb44e2e9ec4c 1156 #endif
whismanoid 0:cb44e2e9ec4c 1157 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1158 AnalogIn analogIn4(A4);
whismanoid 0:cb44e2e9ec4c 1159 #endif
whismanoid 0:cb44e2e9ec4c 1160 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1161 AnalogIn analogIn5(A5);
whismanoid 0:cb44e2e9ec4c 1162 #endif
whismanoid 0:cb44e2e9ec4c 1163 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1164 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 1165 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1166 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 1167 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 1168 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 1169 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 1170 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 1171 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1172 AnalogIn analogIn0(A0);
whismanoid 0:cb44e2e9ec4c 1173 #endif
whismanoid 0:cb44e2e9ec4c 1174 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1175 AnalogIn analogIn1(A1);
whismanoid 0:cb44e2e9ec4c 1176 #endif
whismanoid 0:cb44e2e9ec4c 1177 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1178 AnalogIn analogIn2(A2);
whismanoid 0:cb44e2e9ec4c 1179 #endif
whismanoid 0:cb44e2e9ec4c 1180 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1181 AnalogIn analogIn3(A3);
whismanoid 0:cb44e2e9ec4c 1182 #endif
whismanoid 0:cb44e2e9ec4c 1183 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1184 AnalogIn analogIn4(A4);
whismanoid 0:cb44e2e9ec4c 1185 #endif
whismanoid 0:cb44e2e9ec4c 1186 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1187 AnalogIn analogIn5(A5);
whismanoid 0:cb44e2e9ec4c 1188 #endif
whismanoid 0:cb44e2e9ec4c 1189 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1190 // TODO1: TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:cb44e2e9ec4c 1191 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 1192 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1193 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 1194 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 1195 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 1196 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 1197 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 1198 // #define HAS_analogIn6 1
whismanoid 0:cb44e2e9ec4c 1199 // #define HAS_analogIn7 1
whismanoid 0:cb44e2e9ec4c 1200 // #define HAS_analogIn8 1
whismanoid 0:cb44e2e9ec4c 1201 // #define HAS_analogIn9 1
whismanoid 0:cb44e2e9ec4c 1202 // #define HAS_analogIn10 1
whismanoid 0:cb44e2e9ec4c 1203 // #define HAS_analogIn11 1
whismanoid 0:cb44e2e9ec4c 1204 // #define HAS_analogIn12 1
whismanoid 0:cb44e2e9ec4c 1205 // #define HAS_analogIn13 1
whismanoid 0:cb44e2e9ec4c 1206 // #define HAS_analogIn14 1
whismanoid 0:cb44e2e9ec4c 1207 // #define HAS_analogIn15 1
whismanoid 0:cb44e2e9ec4c 1208 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1209 AnalogIn analogIn0(p15); // TARGET_LPC1768 P0.23/AD0.0/I2SRX_CLK/CAP3.0
whismanoid 0:cb44e2e9ec4c 1210 #endif
whismanoid 0:cb44e2e9ec4c 1211 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1212 AnalogIn analogIn1(p16); // TARGET_LPC1768 P0.24/AD0.1/I2SRX_WS/CAP3.1
whismanoid 0:cb44e2e9ec4c 1213 #endif
whismanoid 0:cb44e2e9ec4c 1214 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1215 AnalogIn analogIn2(p17); // TARGET_LPC1768 P0.25/AD0.2/I2SRX_SDA/TXD3
whismanoid 0:cb44e2e9ec4c 1216 #endif
whismanoid 0:cb44e2e9ec4c 1217 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1218 AnalogIn analogIn3(p18); // TARGET_LPC1768 P0.26/AD0.3/AOUT/RXD3
whismanoid 0:cb44e2e9ec4c 1219 #endif
whismanoid 0:cb44e2e9ec4c 1220 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1221 AnalogIn analogIn4(p19); // TARGET_LPC1768 P1.30/VBUS/AD0.4
whismanoid 0:cb44e2e9ec4c 1222 #endif
whismanoid 0:cb44e2e9ec4c 1223 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1224 AnalogIn analogIn5(p20); // TARGET_LPC1768 P1.31/SCK1/AD0.5
whismanoid 0:cb44e2e9ec4c 1225 #endif
whismanoid 0:cb44e2e9ec4c 1226 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 1227 AnalogIn analogIn6(____);
whismanoid 0:cb44e2e9ec4c 1228 #endif
whismanoid 0:cb44e2e9ec4c 1229 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 1230 AnalogIn analogIn7(____);
whismanoid 0:cb44e2e9ec4c 1231 #endif
whismanoid 0:cb44e2e9ec4c 1232 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 1233 AnalogIn analogIn8(____);
whismanoid 0:cb44e2e9ec4c 1234 #endif
whismanoid 0:cb44e2e9ec4c 1235 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 1236 AnalogIn analogIn9(____);
whismanoid 0:cb44e2e9ec4c 1237 #endif
whismanoid 0:cb44e2e9ec4c 1238 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 1239 AnalogIn analogIn10(____);
whismanoid 0:cb44e2e9ec4c 1240 #endif
whismanoid 0:cb44e2e9ec4c 1241 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 1242 AnalogIn analogIn11(____);
whismanoid 0:cb44e2e9ec4c 1243 #endif
whismanoid 0:cb44e2e9ec4c 1244 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 1245 AnalogIn analogIn12(____);
whismanoid 0:cb44e2e9ec4c 1246 #endif
whismanoid 0:cb44e2e9ec4c 1247 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 1248 AnalogIn analogIn13(____);
whismanoid 0:cb44e2e9ec4c 1249 #endif
whismanoid 0:cb44e2e9ec4c 1250 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 1251 AnalogIn analogIn14(____);
whismanoid 0:cb44e2e9ec4c 1252 #endif
whismanoid 0:cb44e2e9ec4c 1253 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 1254 AnalogIn analogIn15(____);
whismanoid 0:cb44e2e9ec4c 1255 #endif
whismanoid 0:cb44e2e9ec4c 1256 #else
whismanoid 0:cb44e2e9ec4c 1257 // unknown target
whismanoid 0:cb44e2e9ec4c 1258 #endif
whismanoid 0:cb44e2e9ec4c 1259 // uncrustify-0.66.1 *INDENT-ON*
whismanoid 0:cb44e2e9ec4c 1260 #if HAS_analogIn0 || HAS_analogIn1 \
whismanoid 0:cb44e2e9ec4c 1261 || HAS_analogIn2 || HAS_analogIn3 \
whismanoid 0:cb44e2e9ec4c 1262 || HAS_analogIn4 || HAS_analogIn5 \
whismanoid 0:cb44e2e9ec4c 1263 || HAS_analogIn6 || HAS_analogIn7 \
whismanoid 0:cb44e2e9ec4c 1264 || HAS_analogIn8 || HAS_analogIn9 \
whismanoid 0:cb44e2e9ec4c 1265 || HAS_analogIn10 || HAS_analogIn11 \
whismanoid 0:cb44e2e9ec4c 1266 || HAS_analogIn12 || HAS_analogIn13 \
whismanoid 0:cb44e2e9ec4c 1267 || HAS_analogIn14 || HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 1268 #define HAS_analogIns 1
whismanoid 0:cb44e2e9ec4c 1269 #else
whismanoid 0:cb44e2e9ec4c 1270 #warning "Note: There are no analogIn resources defined"
whismanoid 0:cb44e2e9ec4c 1271 #endif
whismanoid 0:cb44e2e9ec4c 1272
whismanoid 0:cb44e2e9ec4c 1273 // DigitalInOut pin resource: print the pin index names to serial
whismanoid 0:cb44e2e9ec4c 1274 #if HAS_digitalInOuts
whismanoid 0:cb44e2e9ec4c 1275 void list_digitalInOutPins(Stream& serialStream)
whismanoid 0:cb44e2e9ec4c 1276 {
whismanoid 0:cb44e2e9ec4c 1277 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 1278 serialStream.printf(" 0");
whismanoid 0:cb44e2e9ec4c 1279 #endif
whismanoid 0:cb44e2e9ec4c 1280 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 1281 serialStream.printf(" 1");
whismanoid 0:cb44e2e9ec4c 1282 #endif
whismanoid 0:cb44e2e9ec4c 1283 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 1284 serialStream.printf(" 2");
whismanoid 0:cb44e2e9ec4c 1285 #endif
whismanoid 0:cb44e2e9ec4c 1286 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 1287 serialStream.printf(" 3");
whismanoid 0:cb44e2e9ec4c 1288 #endif
whismanoid 0:cb44e2e9ec4c 1289 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 1290 serialStream.printf(" 4");
whismanoid 0:cb44e2e9ec4c 1291 #endif
whismanoid 0:cb44e2e9ec4c 1292 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 1293 serialStream.printf(" 5");
whismanoid 0:cb44e2e9ec4c 1294 #endif
whismanoid 0:cb44e2e9ec4c 1295 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 1296 serialStream.printf(" 6");
whismanoid 0:cb44e2e9ec4c 1297 #endif
whismanoid 0:cb44e2e9ec4c 1298 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 1299 serialStream.printf(" 7");
whismanoid 0:cb44e2e9ec4c 1300 #endif
whismanoid 0:cb44e2e9ec4c 1301 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 1302 serialStream.printf(" 8");
whismanoid 0:cb44e2e9ec4c 1303 #endif
whismanoid 0:cb44e2e9ec4c 1304 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 1305 serialStream.printf(" 9");
whismanoid 0:cb44e2e9ec4c 1306 #endif
whismanoid 0:cb44e2e9ec4c 1307 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 1308 serialStream.printf(" 10");
whismanoid 0:cb44e2e9ec4c 1309 #endif
whismanoid 0:cb44e2e9ec4c 1310 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 1311 serialStream.printf(" 11");
whismanoid 0:cb44e2e9ec4c 1312 #endif
whismanoid 0:cb44e2e9ec4c 1313 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 1314 serialStream.printf(" 12");
whismanoid 0:cb44e2e9ec4c 1315 #endif
whismanoid 0:cb44e2e9ec4c 1316 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 1317 serialStream.printf(" 13");
whismanoid 0:cb44e2e9ec4c 1318 #endif
whismanoid 0:cb44e2e9ec4c 1319 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 1320 serialStream.printf(" 14");
whismanoid 0:cb44e2e9ec4c 1321 #endif
whismanoid 0:cb44e2e9ec4c 1322 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 1323 serialStream.printf(" 15");
whismanoid 0:cb44e2e9ec4c 1324 #endif
whismanoid 0:cb44e2e9ec4c 1325 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 1326 serialStream.printf(" 16");
whismanoid 0:cb44e2e9ec4c 1327 #endif
whismanoid 0:cb44e2e9ec4c 1328 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 1329 serialStream.printf(" 17");
whismanoid 0:cb44e2e9ec4c 1330 #endif
whismanoid 0:cb44e2e9ec4c 1331 }
whismanoid 0:cb44e2e9ec4c 1332 #endif
whismanoid 0:cb44e2e9ec4c 1333
whismanoid 0:cb44e2e9ec4c 1334
whismanoid 0:cb44e2e9ec4c 1335 // DigitalInOut pin resource: search index
whismanoid 0:cb44e2e9ec4c 1336 #if HAS_digitalInOuts
whismanoid 0:cb44e2e9ec4c 1337 DigitalInOut& find_digitalInOutPin(int cPinIndex)
whismanoid 0:cb44e2e9ec4c 1338 {
whismanoid 0:cb44e2e9ec4c 1339 switch (cPinIndex)
whismanoid 0:cb44e2e9ec4c 1340 {
whismanoid 0:cb44e2e9ec4c 1341 default: // default to the first defined digitalInOut pin
whismanoid 0:cb44e2e9ec4c 1342 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 1343 case '0': case 0x00: return digitalInOut0;
whismanoid 0:cb44e2e9ec4c 1344 #endif
whismanoid 0:cb44e2e9ec4c 1345 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 1346 case '1': case 0x01: return digitalInOut1;
whismanoid 0:cb44e2e9ec4c 1347 #endif
whismanoid 0:cb44e2e9ec4c 1348 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 1349 case '2': case 0x02: return digitalInOut2;
whismanoid 0:cb44e2e9ec4c 1350 #endif
whismanoid 0:cb44e2e9ec4c 1351 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 1352 case '3': case 0x03: return digitalInOut3;
whismanoid 0:cb44e2e9ec4c 1353 #endif
whismanoid 0:cb44e2e9ec4c 1354 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 1355 case '4': case 0x04: return digitalInOut4;
whismanoid 0:cb44e2e9ec4c 1356 #endif
whismanoid 0:cb44e2e9ec4c 1357 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 1358 case '5': case 0x05: return digitalInOut5;
whismanoid 0:cb44e2e9ec4c 1359 #endif
whismanoid 0:cb44e2e9ec4c 1360 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 1361 case '6': case 0x06: return digitalInOut6;
whismanoid 0:cb44e2e9ec4c 1362 #endif
whismanoid 0:cb44e2e9ec4c 1363 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 1364 case '7': case 0x07: return digitalInOut7;
whismanoid 0:cb44e2e9ec4c 1365 #endif
whismanoid 0:cb44e2e9ec4c 1366 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 1367 case '8': case 0x08: return digitalInOut8;
whismanoid 0:cb44e2e9ec4c 1368 #endif
whismanoid 0:cb44e2e9ec4c 1369 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 1370 case '9': case 0x09: return digitalInOut9;
whismanoid 0:cb44e2e9ec4c 1371 #endif
whismanoid 0:cb44e2e9ec4c 1372 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 1373 case 'a': case 0x0a: return digitalInOut10;
whismanoid 0:cb44e2e9ec4c 1374 #endif
whismanoid 0:cb44e2e9ec4c 1375 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 1376 case 'b': case 0x0b: return digitalInOut11;
whismanoid 0:cb44e2e9ec4c 1377 #endif
whismanoid 0:cb44e2e9ec4c 1378 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 1379 case 'c': case 0x0c: return digitalInOut12;
whismanoid 0:cb44e2e9ec4c 1380 #endif
whismanoid 0:cb44e2e9ec4c 1381 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 1382 case 'd': case 0x0d: return digitalInOut13;
whismanoid 0:cb44e2e9ec4c 1383 #endif
whismanoid 0:cb44e2e9ec4c 1384 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 1385 case 'e': case 0x0e: return digitalInOut14;
whismanoid 0:cb44e2e9ec4c 1386 #endif
whismanoid 0:cb44e2e9ec4c 1387 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 1388 case 'f': case 0x0f: return digitalInOut15;
whismanoid 0:cb44e2e9ec4c 1389 #endif
whismanoid 0:cb44e2e9ec4c 1390 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 1391 case 'g': case 0x10: return digitalInOut16;
whismanoid 0:cb44e2e9ec4c 1392 #endif
whismanoid 0:cb44e2e9ec4c 1393 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 1394 case 'h': case 0x11: return digitalInOut17;
whismanoid 0:cb44e2e9ec4c 1395 #endif
whismanoid 0:cb44e2e9ec4c 1396 }
whismanoid 0:cb44e2e9ec4c 1397 }
whismanoid 0:cb44e2e9ec4c 1398 #endif
whismanoid 0:cb44e2e9ec4c 1399
whismanoid 0:cb44e2e9ec4c 1400
whismanoid 0:cb44e2e9ec4c 1401 // AnalogIn pin resource: search index
whismanoid 0:cb44e2e9ec4c 1402 #if HAS_analogIns
whismanoid 0:cb44e2e9ec4c 1403 AnalogIn& find_analogInPin(int cPinIndex)
whismanoid 0:cb44e2e9ec4c 1404 {
whismanoid 0:cb44e2e9ec4c 1405 switch (cPinIndex)
whismanoid 0:cb44e2e9ec4c 1406 {
whismanoid 0:cb44e2e9ec4c 1407 default: // default to the first defined analogIn pin
whismanoid 0:cb44e2e9ec4c 1408 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1409 case '0': case 0x00: return analogIn0;
whismanoid 0:cb44e2e9ec4c 1410 #endif
whismanoid 0:cb44e2e9ec4c 1411 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1412 case '1': case 0x01: return analogIn1;
whismanoid 0:cb44e2e9ec4c 1413 #endif
whismanoid 0:cb44e2e9ec4c 1414 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1415 case '2': case 0x02: return analogIn2;
whismanoid 0:cb44e2e9ec4c 1416 #endif
whismanoid 0:cb44e2e9ec4c 1417 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1418 case '3': case 0x03: return analogIn3;
whismanoid 0:cb44e2e9ec4c 1419 #endif
whismanoid 0:cb44e2e9ec4c 1420 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1421 case '4': case 0x04: return analogIn4;
whismanoid 0:cb44e2e9ec4c 1422 #endif
whismanoid 0:cb44e2e9ec4c 1423 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1424 case '5': case 0x05: return analogIn5;
whismanoid 0:cb44e2e9ec4c 1425 #endif
whismanoid 0:cb44e2e9ec4c 1426 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 1427 case '6': case 0x06: return analogIn6;
whismanoid 0:cb44e2e9ec4c 1428 #endif
whismanoid 0:cb44e2e9ec4c 1429 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 1430 case '7': case 0x07: return analogIn7;
whismanoid 0:cb44e2e9ec4c 1431 #endif
whismanoid 0:cb44e2e9ec4c 1432 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 1433 case '8': case 0x08: return analogIn8;
whismanoid 0:cb44e2e9ec4c 1434 #endif
whismanoid 0:cb44e2e9ec4c 1435 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 1436 case '9': case 0x09: return analogIn9;
whismanoid 0:cb44e2e9ec4c 1437 #endif
whismanoid 0:cb44e2e9ec4c 1438 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 1439 case 'a': case 0x0a: return analogIn10;
whismanoid 0:cb44e2e9ec4c 1440 #endif
whismanoid 0:cb44e2e9ec4c 1441 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 1442 case 'b': case 0x0b: return analogIn11;
whismanoid 0:cb44e2e9ec4c 1443 #endif
whismanoid 0:cb44e2e9ec4c 1444 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 1445 case 'c': case 0x0c: return analogIn12;
whismanoid 0:cb44e2e9ec4c 1446 #endif
whismanoid 0:cb44e2e9ec4c 1447 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 1448 case 'd': case 0x0d: return analogIn13;
whismanoid 0:cb44e2e9ec4c 1449 #endif
whismanoid 0:cb44e2e9ec4c 1450 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 1451 case 'e': case 0x0e: return analogIn14;
whismanoid 0:cb44e2e9ec4c 1452 #endif
whismanoid 0:cb44e2e9ec4c 1453 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 1454 case 'f': case 0x0f: return analogIn15;
whismanoid 0:cb44e2e9ec4c 1455 #endif
whismanoid 0:cb44e2e9ec4c 1456 }
whismanoid 0:cb44e2e9ec4c 1457 }
whismanoid 0:cb44e2e9ec4c 1458 #endif
whismanoid 0:cb44e2e9ec4c 1459
whismanoid 0:cb44e2e9ec4c 1460 #if HAS_analogIns
whismanoid 0:cb44e2e9ec4c 1461 const float analogInPin_fullScaleVoltage[] = {
whismanoid 0:cb44e2e9ec4c 1462 # if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 1463 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 1464 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 1465 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 1466 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 1467 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1468 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1469 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn6 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1470 ADC_FULL_SCALE_VOLTAGE, // analogIn7 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1471 ADC_FULL_SCALE_VOLTAGE, // analogIn8 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1472 ADC_FULL_SCALE_VOLTAGE * 2.0f, // analogIn9 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 1473 ADC_FULL_SCALE_VOLTAGE, // analogIn10 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 1474 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn11 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1475 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn12 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1476 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 1477 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 1478 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 1479 # elif defined(TARGET_MAX32620FTHR)
whismanoid 0:cb44e2e9ec4c 1480 #warning "TARGET_MAX32620FTHR not previously tested; need to verify analogIn0..."
whismanoid 0:cb44e2e9ec4c 1481 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 1482 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 1483 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 1484 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 1485 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1486 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1487 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn6 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1488 ADC_FULL_SCALE_VOLTAGE, // analogIn7 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1489 ADC_FULL_SCALE_VOLTAGE, // analogIn8 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1490 ADC_FULL_SCALE_VOLTAGE * 2.0f, // analogIn9 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 1491 ADC_FULL_SCALE_VOLTAGE, // analogIn10 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 1492 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn11 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1493 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn12 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1494 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 1495 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 1496 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 1497 #elif defined(TARGET_MAX32625MBED) || defined(TARGET_MAX32625PICO)
whismanoid 0:cb44e2e9ec4c 1498 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn0 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1499 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn1 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1500 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn2 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1501 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn3 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1502 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1503 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1504 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn6 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1505 ADC_FULL_SCALE_VOLTAGE, // analogIn7 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1506 ADC_FULL_SCALE_VOLTAGE, // analogIn8 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1507 ADC_FULL_SCALE_VOLTAGE * 2.0f, // analogIn9 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 1508 ADC_FULL_SCALE_VOLTAGE, // analogIn10 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 1509 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn11 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1510 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn12 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1511 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 1512 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 1513 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 1514 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:cb44e2e9ec4c 1515 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 1516 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 1517 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 1518 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 1519 ADC_FULL_SCALE_VOLTAGE, // analogIn4
whismanoid 0:cb44e2e9ec4c 1520 ADC_FULL_SCALE_VOLTAGE, // analogIn5
whismanoid 0:cb44e2e9ec4c 1521 ADC_FULL_SCALE_VOLTAGE, // analogIn6
whismanoid 0:cb44e2e9ec4c 1522 ADC_FULL_SCALE_VOLTAGE, // analogIn7
whismanoid 0:cb44e2e9ec4c 1523 ADC_FULL_SCALE_VOLTAGE, // analogIn8
whismanoid 0:cb44e2e9ec4c 1524 ADC_FULL_SCALE_VOLTAGE, // analogIn9
whismanoid 0:cb44e2e9ec4c 1525 ADC_FULL_SCALE_VOLTAGE, // analogIn10
whismanoid 0:cb44e2e9ec4c 1526 ADC_FULL_SCALE_VOLTAGE, // analogIn11
whismanoid 0:cb44e2e9ec4c 1527 ADC_FULL_SCALE_VOLTAGE, // analogIn12
whismanoid 0:cb44e2e9ec4c 1528 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 1529 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 1530 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 1531 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 1532 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 1533 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 1534 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 1535 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 1536 ADC_FULL_SCALE_VOLTAGE, // analogIn4
whismanoid 0:cb44e2e9ec4c 1537 ADC_FULL_SCALE_VOLTAGE, // analogIn5
whismanoid 0:cb44e2e9ec4c 1538 ADC_FULL_SCALE_VOLTAGE, // analogIn6
whismanoid 0:cb44e2e9ec4c 1539 ADC_FULL_SCALE_VOLTAGE, // analogIn7
whismanoid 0:cb44e2e9ec4c 1540 ADC_FULL_SCALE_VOLTAGE, // analogIn8
whismanoid 0:cb44e2e9ec4c 1541 ADC_FULL_SCALE_VOLTAGE, // analogIn9
whismanoid 0:cb44e2e9ec4c 1542 ADC_FULL_SCALE_VOLTAGE, // analogIn10
whismanoid 0:cb44e2e9ec4c 1543 ADC_FULL_SCALE_VOLTAGE, // analogIn11
whismanoid 0:cb44e2e9ec4c 1544 ADC_FULL_SCALE_VOLTAGE, // analogIn12
whismanoid 0:cb44e2e9ec4c 1545 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 1546 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 1547 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 1548 //#elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 1549 #else
whismanoid 0:cb44e2e9ec4c 1550 // unknown target
whismanoid 0:cb44e2e9ec4c 1551 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 1552 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 1553 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 1554 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 1555 ADC_FULL_SCALE_VOLTAGE, // analogIn4
whismanoid 0:cb44e2e9ec4c 1556 ADC_FULL_SCALE_VOLTAGE, // analogIn5
whismanoid 0:cb44e2e9ec4c 1557 ADC_FULL_SCALE_VOLTAGE, // analogIn6
whismanoid 0:cb44e2e9ec4c 1558 ADC_FULL_SCALE_VOLTAGE, // analogIn7
whismanoid 0:cb44e2e9ec4c 1559 ADC_FULL_SCALE_VOLTAGE, // analogIn8
whismanoid 0:cb44e2e9ec4c 1560 ADC_FULL_SCALE_VOLTAGE, // analogIn9
whismanoid 0:cb44e2e9ec4c 1561 ADC_FULL_SCALE_VOLTAGE, // analogIn10
whismanoid 0:cb44e2e9ec4c 1562 ADC_FULL_SCALE_VOLTAGE, // analogIn11
whismanoid 0:cb44e2e9ec4c 1563 ADC_FULL_SCALE_VOLTAGE, // analogIn12
whismanoid 0:cb44e2e9ec4c 1564 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 1565 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 1566 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 1567 # endif
whismanoid 0:cb44e2e9ec4c 1568 };
whismanoid 0:cb44e2e9ec4c 1569 #endif
whismanoid 0:cb44e2e9ec4c 1570
whismanoid 0:cb44e2e9ec4c 1571
whismanoid 0:cb44e2e9ec4c 1572
whismanoid 0:cb44e2e9ec4c 1573
whismanoid 0:cb44e2e9ec4c 1574 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1575 // Option to validate SPI link by reading PART_ID register
whismanoid 0:cb44e2e9ec4c 1576 #ifndef VERIFY_PART_ID_IN_LOOP
whismanoid 0:cb44e2e9ec4c 1577 #define VERIFY_PART_ID_IN_LOOP 0
whismanoid 0:cb44e2e9ec4c 1578 #endif
whismanoid 0:cb44e2e9ec4c 1579
whismanoid 0:cb44e2e9ec4c 1580 // ---------- Measure_Voltage_custom_props in Measure_Voltage @pre and in class properties ----------
whismanoid 0:cb44e2e9ec4c 1581 // const uint8_t custom_v_filter = 0x34;
whismanoid 0:cb44e2e9ec4c 1582 // const uint8_t custom_v_ctrl = 0x34;
whismanoid 0:cb44e2e9ec4c 1583 // const uint8_t custom_v_pga = 0x34;
whismanoid 0:cb44e2e9ec4c 1584 // ---------- Measure_Voltage_custom_props ----------
whismanoid 0:cb44e2e9ec4c 1585 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 1586 // filter register configuration in Measure_Voltage and Read_All_Voltages CONV_TYPE_01_Continuous
whismanoid 0:cb44e2e9ec4c 1587 //~ const uint8_t custom_v_filter = 0x34; // @ v_filter=0x34 --*LINEF_11_SINC4 RATE_0100 | 60SPS
whismanoid 0:cb44e2e9ec4c 1588 //~ const uint8_t custom_v_filter = 0x00; // @ v_filter=0x00 -- LINEF_00_50Hz_60Hz_FIR RATE_0000 | 1.1SPS
whismanoid 0:cb44e2e9ec4c 1589 //~ const uint8_t custom_v_filter = 0x01; // @ v_filter=0x01 -- LINEF_00_50Hz_60Hz_FIR RATE_0001 | 2.1SPS
whismanoid 0:cb44e2e9ec4c 1590 //~ const uint8_t custom_v_filter = 0x02; // @ v_filter=0x02 -- LINEF_00_50Hz_60Hz_FIR RATE_0010 | 4.2SPS
whismanoid 0:cb44e2e9ec4c 1591 //~ const uint8_t custom_v_filter = 0x03; // @ v_filter=0x03 -- LINEF_00_50Hz_60Hz_FIR RATE_0011 | 8.4SPS
whismanoid 0:cb44e2e9ec4c 1592 //~ const uint8_t custom_v_filter = 0x04; // @ v_filter=0x04 -- LINEF_00_50Hz_60Hz_FIR RATE_0100 | 16.8SPS
whismanoid 0:cb44e2e9ec4c 1593 //~ const uint8_t custom_v_filter = 0x10; // @ v_filter=0x10 -- LINEF_01_50Hz_FIR RATE_0000 | 1.3SPS
whismanoid 0:cb44e2e9ec4c 1594 //~ const uint8_t custom_v_filter = 0x11; // @ v_filter=0x11 -- LINEF_01_50Hz_FIR RATE_0001 | 2.7SPS
whismanoid 0:cb44e2e9ec4c 1595 //~ const uint8_t custom_v_filter = 0x12; // @ v_filter=0x12 -- LINEF_01_50Hz_FIR RATE_0010 | 5.3SPS
whismanoid 0:cb44e2e9ec4c 1596 //~ const uint8_t custom_v_filter = 0x13; // @ v_filter=0x13 -- LINEF_01_50Hz_FIR RATE_0011 | 10.7SPS
whismanoid 0:cb44e2e9ec4c 1597 //~ const uint8_t custom_v_filter = 0x14; // @ v_filter=0x14 -- LINEF_01_50Hz_FIR RATE_0100 | 21.3SPS
whismanoid 0:cb44e2e9ec4c 1598 //~ const uint8_t custom_v_filter = 0x15; // @ v_filter=0x15 -- LINEF_01_50Hz_FIR RATE_0101 | 40.0SPS
whismanoid 0:cb44e2e9ec4c 1599 //~ const uint8_t custom_v_filter = 0x20; // @ v_filter=0x20 -- LINEF_10_60Hz_FIR RATE_0000 | 1.3SPS
whismanoid 0:cb44e2e9ec4c 1600 //~ const uint8_t custom_v_filter = 0x21; // @ v_filter=0x21 -- LINEF_10_60Hz_FIR RATE_0001 | 2.7SPS
whismanoid 0:cb44e2e9ec4c 1601 //~ const uint8_t custom_v_filter = 0x22; // @ v_filter=0x22 -- LINEF_10_60Hz_FIR RATE_0010 | 5.3SPS
whismanoid 0:cb44e2e9ec4c 1602 //~ const uint8_t custom_v_filter = 0x23; // @ v_filter=0x23 -- LINEF_10_60Hz_FIR RATE_0011 | 10.7SPS
whismanoid 0:cb44e2e9ec4c 1603 //~ const uint8_t custom_v_filter = 0x24; // @ v_filter=0x24 -- LINEF_10_60Hz_FIR RATE_0100 | 21.3SPS
whismanoid 0:cb44e2e9ec4c 1604 //~ const uint8_t custom_v_filter = 0x25; // @ v_filter=0x25 -- LINEF_10_60Hz_FIR RATE_0101 | 40.0SPS
whismanoid 0:cb44e2e9ec4c 1605 //~ const uint8_t custom_v_filter = 0x30; // @ v_filter=0x30 -- LINEF_11_SINC4 RATE_0000 | 4SPS
whismanoid 0:cb44e2e9ec4c 1606 //~ const uint8_t custom_v_filter = 0x31; // @ v_filter=0x31 -- LINEF_11_SINC4 RATE_0001 | 10SPS
whismanoid 0:cb44e2e9ec4c 1607 //~ const uint8_t custom_v_filter = 0x32; // @ v_filter=0x32 -- LINEF_11_SINC4 RATE_0010 | 20SPS
whismanoid 0:cb44e2e9ec4c 1608 //~ const uint8_t custom_v_filter = 0x33; // @ v_filter=0x33 -- LINEF_11_SINC4 RATE_0011 | 40SPS
whismanoid 0:cb44e2e9ec4c 1609 //~ const uint8_t custom_v_filter = 0x34; // @ v_filter=0x34 --*LINEF_11_SINC4 RATE_0100 | 60SPS
whismanoid 0:cb44e2e9ec4c 1610 //~ const uint8_t custom_v_filter = 0x35; // @ v_filter=0x35 -- LINEF_11_SINC4 RATE_0101 | 120SPS
whismanoid 0:cb44e2e9ec4c 1611 //~ const uint8_t custom_v_filter = 0x36; // @ v_filter=0x36 -- LINEF_11_SINC4 RATE_0110 | 240SPS
whismanoid 0:cb44e2e9ec4c 1612 //~ const uint8_t custom_v_filter = 0x37; // @ v_filter=0x37 -- LINEF_11_SINC4 RATE_0111 | 480SPS
whismanoid 0:cb44e2e9ec4c 1613 //~ const uint8_t custom_v_filter = 0x38; // @ v_filter=0x38 -- LINEF_11_SINC4 RATE_1000 | 960SPS
whismanoid 0:cb44e2e9ec4c 1614 //~ const uint8_t custom_v_filter = 0x39; // @ v_filter=0x39 -- LINEF_11_SINC4 RATE_1001 | 1920SPS
whismanoid 0:cb44e2e9ec4c 1615 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 1616 //
whismanoid 0:cb44e2e9ec4c 1617 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 1618 // pga register configuration in Measure_Voltage and Read_All_Voltages
whismanoid 0:cb44e2e9ec4c 1619 //~ const uint8_t custom_v_pga = 0x00; // @ v_pga=0x00 -- 0x00 SIG_PATH_00_BUFFERED
whismanoid 0:cb44e2e9ec4c 1620 //~ const uint8_t custom_v_pga = 0x00; // @ v_pga=0x00 -- 0x00 SIG_PATH_00_BUFFERED
whismanoid 0:cb44e2e9ec4c 1621 //~ const uint8_t custom_v_pga = 0x10; // @ v_pga=0x10 -- 0x10 SIG_PATH_01_BYPASS
whismanoid 0:cb44e2e9ec4c 1622 //~ const uint8_t custom_v_pga = 0x20; // @ v_pga=0x20 -- 0x20 SIG_PATH_10_PGA GAIN_000_1
whismanoid 0:cb44e2e9ec4c 1623 //~ const uint8_t custom_v_pga = 0x21; // @ v_pga=0x21 --*0x21 SIG_PATH_10_PGA GAIN_001_2
whismanoid 0:cb44e2e9ec4c 1624 //~ const uint8_t custom_v_pga = 0x22; // @ v_pga=0x22 -- 0x22 SIG_PATH_10_PGA GAIN_010_4
whismanoid 0:cb44e2e9ec4c 1625 //~ const uint8_t custom_v_pga = 0x23; // @ v_pga=0x23 -- 0x23 SIG_PATH_10_PGA GAIN_011_8
whismanoid 0:cb44e2e9ec4c 1626 //~ const uint8_t custom_v_pga = 0x24; // @ v_pga=0x24 -- 0x24 SIG_PATH_10_PGA GAIN_100_16
whismanoid 0:cb44e2e9ec4c 1627 //~ const uint8_t custom_v_pga = 0x25; // @ v_pga=0x25 -- 0x25 SIG_PATH_10_PGA GAIN_101_32
whismanoid 0:cb44e2e9ec4c 1628 //~ const uint8_t custom_v_pga = 0x26; // @ v_pga=0x26 -- 0x26 SIG_PATH_10_PGA GAIN_110_64
whismanoid 0:cb44e2e9ec4c 1629 //~ const uint8_t custom_v_pga = 0x27; // @ v_pga=0x27 -- 0x27 SIG_PATH_10_PGA GAIN_111_128
whismanoid 0:cb44e2e9ec4c 1630 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 1631 //
whismanoid 0:cb44e2e9ec4c 1632 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 1633 // ctrl register configuration in Measure_Voltage and Read_All_Voltages
whismanoid 0:cb44e2e9ec4c 1634 //~ const uint8_t custom_v_ctrl = 0x02; // @ v_ctrl=0x02 -- 0x00 bipolar 2's complement, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 1635 //~ const uint8_t custom_v_ctrl = 0x40; // @ v_ctrl=0x40 -- 0x40 unipolar, 0x00 REF_SEL_000_AIN0_AIN1
whismanoid 0:cb44e2e9ec4c 1636 //~ const uint8_t custom_v_ctrl = 0x44; // @ v_ctrl=0x44 -- 0x40 unipolar, 0x04 REF_SEL_100_AIN0_AGND
whismanoid 0:cb44e2e9ec4c 1637 //~ const uint8_t custom_v_ctrl = 0x58; // @ v_ctrl=0x58 -- 0x40 unipolar, 0x00 REF_SEL_000_AIN0_AIN1, 0x18 refbuf
whismanoid 0:cb44e2e9ec4c 1638 //
whismanoid 0:cb44e2e9ec4c 1639 //~ const uint8_t custom_v_ctrl = 0x41; // @ v_ctrl=0x41 -- 0x40 unipolar, 0x01 REF_SEL_001_REF1P_REF1N
whismanoid 0:cb44e2e9ec4c 1640 //~ const uint8_t custom_v_ctrl = 0x45; // @ v_ctrl=0x45 -- 0x40 unipolar, 0x05 REF_SEL_101_REF1P_AGND
whismanoid 0:cb44e2e9ec4c 1641 //~ const uint8_t custom_v_ctrl = 0x59; // @ v_ctrl=0x59 -- 0x40 unipolar, 0x01 REF_SEL_001_REF1P_REF1N, 0x18 refbuf
whismanoid 0:cb44e2e9ec4c 1642 //
whismanoid 0:cb44e2e9ec4c 1643 //~ const uint8_t custom_v_ctrl = 0x42; // @ v_ctrl=0x42 -- 0x40 unipolar, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 1644 //~ const uint8_t custom_v_ctrl = 0x46; // @ v_ctrl=0x46 -- 0x40 unipolar, 0x06 REF_SEL_110_REF2P_AGND
whismanoid 0:cb44e2e9ec4c 1645 //~ const uint8_t custom_v_ctrl = 0x22; // @ v_ctrl=0x22 -- 0x20 bipolar offset binary, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 1646 //~ const uint8_t custom_v_ctrl = 0x02; // @ v_ctrl=0x02 -- 0x00 bipolar 2's complement, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 1647 //
whismanoid 0:cb44e2e9ec4c 1648 //~ const uint8_t custom_v_ctrl = 0x44; // @ v_ctrl=0x44 -- 0x40 unipolar, 0x04 REF_SEL_100_AIN0_AGND
whismanoid 0:cb44e2e9ec4c 1649 //~ const uint8_t custom_v_ctrl = 0x47; // @ v_ctrl=0x47 -- 0x40 unipolar, 0x07 REF_SEL_111_AVDD_AGND
whismanoid 0:cb44e2e9ec4c 1650 //~ const uint8_t custom_v_ctrl = 0x27; // @ v_ctrl=0x27 -- 0x20 bipolar offset binary, 0x07 REF_SEL_111_AVDD_AGND
whismanoid 0:cb44e2e9ec4c 1651 //~ const uint8_t custom_v_ctrl = 0x07; // @ v_ctrl=0x07 -- 0x00 bipolar 2's complement, 0x07 REF_SEL_111_AVDD_AGND
whismanoid 0:cb44e2e9ec4c 1652 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 1653
whismanoid 0:cb44e2e9ec4c 1654 // example code declare SPI interface (GPIO controlled CS)
whismanoid 0:cb44e2e9ec4c 1655 #if defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 1656 SPI spi(SPI1_MOSI, SPI1_MISO, SPI1_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625MBED: P1_1 P1_2 P1_0 Arduino 10-pin header D11 D12 D13
whismanoid 0:cb44e2e9ec4c 1657 DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32625MBED: P1_3 Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 1658 #elif defined(TARGET_MAX32625PICO)
whismanoid 0:cb44e2e9ec4c 1659 #warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
whismanoid 0:cb44e2e9ec4c 1660 SPI spi(SPI0_MOSI, SPI0_MISO, SPI0_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625PICO: pin P0_5 P0_6 P0_4
whismanoid 0:cb44e2e9ec4c 1661 DigitalOut spi_cs(SPI0_SS); // TARGET_MAX32625PICO: pin P0_7
whismanoid 0:cb44e2e9ec4c 1662 #elif defined(TARGET_MAX32600MBED)
whismanoid 0:cb44e2e9ec4c 1663 SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
whismanoid 0:cb44e2e9ec4c 1664 DigitalOut spi_cs(SPI2_SS); // Generic: Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 1665 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 1666 // TODO1: avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 1667 // void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
whismanoid 0:cb44e2e9ec4c 1668 //
whismanoid 0:cb44e2e9ec4c 1669 // TODO1: NUCLEO_F446RE SPI not working; CS and MOSI data looks OK but no SCLK clock pulses.
whismanoid 0:cb44e2e9ec4c 1670 SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK); // mosi, miso, sclk spi1 TARGET_NUCLEO_F446RE: Arduino 10-pin header D11 D12 D13
whismanoid 0:cb44e2e9ec4c 1671 DigitalOut spi_cs(SPI_CS); // TARGET_NUCLEO_F446RE: PB_6 Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 1672 //
whismanoid 0:cb44e2e9ec4c 1673 #else
whismanoid 0:cb44e2e9ec4c 1674 //~ SPI spi(D11, D12, D13); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
whismanoid 0:cb44e2e9ec4c 1675 //~ DigitalOut spi_cs(D10); // Generic: Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 1676 #endif
whismanoid 0:cb44e2e9ec4c 1677
whismanoid 0:cb44e2e9ec4c 1678 // example code declare GPIO interface pins
whismanoid 0:cb44e2e9ec4c 1679 // example code declare device instance
whismanoid 0:cb44e2e9ec4c 1680 //~ MAX11410 g_MAX11410_device(spi, spi_cs, MAX11410::MAX11410_IC);
whismanoid 0:cb44e2e9ec4c 1681
whismanoid 1:747f1602abfc 1682 //--------------------------------------------------
whismanoid 1:747f1602abfc 1683 // Option to use platform analog inputs
whismanoid 1:747f1602abfc 1684 //#ifndef NUM_PLATFORM_ANALOG_IN_CHANNELS
whismanoid 1:747f1602abfc 1685 //#define NUM_PLATFORM_ANALOG_IN_CHANNELS 6
whismanoid 1:747f1602abfc 1686 //#endif
whismanoid 1:747f1602abfc 1687 const int NUM_PLATFORM_ANALOG_IN_CHANNELS = 6;
whismanoid 1:747f1602abfc 1688 const double adc_full_scale_voltage[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 0:cb44e2e9ec4c 1689 1.2,
whismanoid 0:cb44e2e9ec4c 1690 1.2,
whismanoid 0:cb44e2e9ec4c 1691 1.2,
whismanoid 0:cb44e2e9ec4c 1692 1.2,
whismanoid 0:cb44e2e9ec4c 1693 1.2,
whismanoid 0:cb44e2e9ec4c 1694 1.2
whismanoid 0:cb44e2e9ec4c 1695 };
whismanoid 1:747f1602abfc 1696 //--------------------------------------------------
whismanoid 1:747f1602abfc 1697 // Option to log platform analog inputs as raw LSB code
whismanoid 1:747f1602abfc 1698 #ifndef LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 1:747f1602abfc 1699 #define LOG_PLATFORM_ANALOG_IN_LSB 0
whismanoid 1:747f1602abfc 1700 #endif
whismanoid 1:747f1602abfc 1701 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 1:747f1602abfc 1702 int Platform_LSB[NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 1:747f1602abfc 1703 #endif
whismanoid 1:747f1602abfc 1704
whismanoid 1:747f1602abfc 1705 //--------------------------------------------------
whismanoid 1:747f1602abfc 1706 // Option to use platform analog inputs as Voltage
whismanoid 1:747f1602abfc 1707 #ifndef LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 1:747f1602abfc 1708 #define LOG_PLATFORM_ANALOG_IN_VOLTS 1
whismanoid 1:747f1602abfc 1709 #endif
whismanoid 1:747f1602abfc 1710 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 1:747f1602abfc 1711 double Platform_Voltage[NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 1:747f1602abfc 1712 #endif
whismanoid 0:cb44e2e9ec4c 1713
whismanoid 0:cb44e2e9ec4c 1714 // CODE GENERATOR: example code for ADC: serial port declaration
whismanoid 1:747f1602abfc 1715 //--------------------------------------------------
whismanoid 1:747f1602abfc 1716 // Declare the Serial driver
whismanoid 1:747f1602abfc 1717 // default baud rate settings are 9600 8N1
whismanoid 1:747f1602abfc 1718 // install device driver from http://developer.mbed.org/media/downloads/drivers/mbedWinSerial_16466.exe
whismanoid 1:747f1602abfc 1719 // see docs https://docs.mbed.com/docs/mbed-os-handbook/en/5.5/getting_started/what_need/
whismanoid 1:747f1602abfc 1720 #if defined(TARGET_MAX32630)
whismanoid 1:747f1602abfc 1721 #include "USBSerial.h"
whismanoid 1:747f1602abfc 1722 // Hardware serial port over DAPLink
whismanoid 1:747f1602abfc 1723 // The default baud rate for the DapLink UART is 9600
whismanoid 1:747f1602abfc 1724 //Serial DAPLINKserial(P2_1, P2_0); // tx, rx
whismanoid 1:747f1602abfc 1725 // #define HAS_DAPLINK_SERIAL 1
whismanoid 1:747f1602abfc 1726 // Virtual serial port over USB
whismanoid 1:747f1602abfc 1727 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 1:747f1602abfc 1728 USBSerial serial;
whismanoid 1:747f1602abfc 1729 //--------------------------------------------------
whismanoid 1:747f1602abfc 1730 #elif defined(TARGET_MAX32625MBED)
whismanoid 1:747f1602abfc 1731 #include "USBSerial.h"
whismanoid 1:747f1602abfc 1732 // Hardware serial port over DAPLink
whismanoid 1:747f1602abfc 1733 // The default baud rate for the DapLink UART is 9600
whismanoid 1:747f1602abfc 1734 //Serial DAPLINKserial(P2_1, P2_0); // tx, rx
whismanoid 1:747f1602abfc 1735 // #define HAS_DAPLINK_SERIAL 1
whismanoid 1:747f1602abfc 1736 // Virtual serial port over USB
whismanoid 1:747f1602abfc 1737 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 1:747f1602abfc 1738 USBSerial serial;
whismanoid 1:747f1602abfc 1739 //--------------------------------------------------
whismanoid 1:747f1602abfc 1740 #elif defined(TARGET_MAX32600)
whismanoid 1:747f1602abfc 1741 #include "USBSerial.h"
whismanoid 1:747f1602abfc 1742 // Hardware serial port over DAPLink
whismanoid 1:747f1602abfc 1743 // The default baud rate for the DapLink UART is 9600
whismanoid 1:747f1602abfc 1744 Serial DAPLINKserial(P1_1, P1_0); // tx, rx
whismanoid 1:747f1602abfc 1745 #define HAS_DAPLINK_SERIAL 1
whismanoid 1:747f1602abfc 1746 // Virtual serial port over USB
whismanoid 1:747f1602abfc 1747 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 1:747f1602abfc 1748 USBSerial serial;
whismanoid 1:747f1602abfc 1749 //--------------------------------------------------
whismanoid 1:747f1602abfc 1750 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 1:747f1602abfc 1751 Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx
whismanoid 1:747f1602abfc 1752 //--------------------------------------------------
whismanoid 1:747f1602abfc 1753 #else
whismanoid 1:747f1602abfc 1754 #if defined(SERIAL_TX)
whismanoid 1:747f1602abfc 1755 #warning "target not previously tested; guess serial pins are SERIAL_TX, SERIAL_RX..."
whismanoid 1:747f1602abfc 1756 Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx
whismanoid 1:747f1602abfc 1757 #elif defined(USBTX)
whismanoid 1:747f1602abfc 1758 #warning "target not previously tested; guess serial pins are USBTX, USBRX..."
whismanoid 1:747f1602abfc 1759 Serial serial(USBTX, USBRX); // tx, rx
whismanoid 1:747f1602abfc 1760 #elif defined(UART_TX)
whismanoid 1:747f1602abfc 1761 #warning "target not previously tested; guess serial pins are UART_TX, UART_RX..."
whismanoid 1:747f1602abfc 1762 Serial serial(UART_TX, UART_RX); // tx, rx
whismanoid 1:747f1602abfc 1763 #else
whismanoid 1:747f1602abfc 1764 #warning "target not previously tested; need to define serial pins..."
whismanoid 1:747f1602abfc 1765 #endif
whismanoid 1:747f1602abfc 1766 #endif
whismanoid 1:747f1602abfc 1767 //
whismanoid 1:747f1602abfc 1768 #include "CmdLine.h"
whismanoid 1:747f1602abfc 1769
whismanoid 1:747f1602abfc 1770 # if HAS_DAPLINK_SERIAL
whismanoid 1:747f1602abfc 1771 CmdLine cmdLine_DAPLINKserial(DAPLINKserial, "DAPLINK");
whismanoid 1:747f1602abfc 1772 # endif // HAS_DAPLINK_SERIAL
whismanoid 1:747f1602abfc 1773 CmdLine cmdLine(serial, "serial");
whismanoid 1:747f1602abfc 1774
whismanoid 0:cb44e2e9ec4c 1775 // example code main function
whismanoid 0:cb44e2e9ec4c 1776 int main()
whismanoid 0:cb44e2e9ec4c 1777 {
whismanoid 0:cb44e2e9ec4c 1778 // setup: put your setup code here, to run once
whismanoid 0:cb44e2e9ec4c 1779
whismanoid 0:cb44e2e9ec4c 1780 // example code: serial port banner message
whismanoid 0:cb44e2e9ec4c 1781 wait(3); // 3000ms timing delay function, platform-specific
whismanoid 0:cb44e2e9ec4c 1782 cmdLine.serial().printf("\r\nInternal_DataLogger\r\n"); // instead of Hello_MAX11410
whismanoid 0:cb44e2e9ec4c 1783
whismanoid 1:747f1602abfc 1784 // CODE GENERATOR: get spi properties from device
whismanoid 0:cb44e2e9ec4c 1785 // if (g_SPI_SCLK_Hz > g_MAX11410_device.get_spi_frequency())
whismanoid 0:cb44e2e9ec4c 1786 // { // Device limits SPI SCLK frequency
whismanoid 0:cb44e2e9ec4c 1787 // g_SPI_SCLK_Hz = g_MAX11410_device.get_spi_frequency();
whismanoid 0:cb44e2e9ec4c 1788 // cmdLine.serial().printf("\r\nMAX11410 limits SPI SCLK frequency to %ld Hz\r\n", g_SPI_SCLK_Hz);
whismanoid 0:cb44e2e9ec4c 1789 //
whismanoid 0:cb44e2e9ec4c 1790 // g_MAX11410_device.Init();
whismanoid 0:cb44e2e9ec4c 1791 // }
whismanoid 0:cb44e2e9ec4c 1792 // if (g_MAX11410_device.get_spi_frequency() > g_SPI_SCLK_Hz)
whismanoid 0:cb44e2e9ec4c 1793 // { // Platform limits SPI SCLK frequency
whismanoid 0:cb44e2e9ec4c 1794 // g_MAX11410_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 0:cb44e2e9ec4c 1795 // cmdLine.serial().printf("\r\nPlatform limits MAX11410 SPI SCLK frequency to %ld Hz\r\n", g_SPI_SCLK_Hz);
whismanoid 0:cb44e2e9ec4c 1796 //
whismanoid 0:cb44e2e9ec4c 1797 // g_MAX11410_device.Init();
whismanoid 0:cb44e2e9ec4c 1798 // }
whismanoid 0:cb44e2e9ec4c 1799 // g_SPI_dataMode = g_MAX11410_device.get_spi_dataMode();
whismanoid 0:cb44e2e9ec4c 1800 // while (g_MAX11410_device.Init() == 0)
whismanoid 0:cb44e2e9ec4c 1801 // {
whismanoid 0:cb44e2e9ec4c 1802 // wait(3); // 3000ms timing delay function, platform-specific
whismanoid 0:cb44e2e9ec4c 1803 // cmdLine.serial().printf("\r\nMAX11410 Init failed; retry...\r\n");
whismanoid 0:cb44e2e9ec4c 1804 //
whismanoid 0:cb44e2e9ec4c 1805 // }
whismanoid 0:cb44e2e9ec4c 1806
whismanoid 0:cb44e2e9ec4c 1807 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 1808 //~ g_MAX11410_device.v_filter = custom_v_filter;
whismanoid 0:cb44e2e9ec4c 1809 //~ g_MAX11410_device.v_pga = custom_v_pga;
whismanoid 0:cb44e2e9ec4c 1810 //~ g_MAX11410_device.v_ctrl = custom_v_ctrl;
whismanoid 0:cb44e2e9ec4c 1811 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 1812 // CODE GENERATOR: example code: has no member function REF
whismanoid 0:cb44e2e9ec4c 1813 // CODE GENERATOR: example code for ADC: repeat-forever convert and print conversion result, one record per line
whismanoid 0:cb44e2e9ec4c 1814 // CODE GENERATOR: ResolutionBits = 24
whismanoid 0:cb44e2e9ec4c 1815 // CODE GENERATOR: FScode = 0xffffff
whismanoid 0:cb44e2e9ec4c 1816 // CODE GENERATOR: NumChannels = 10
whismanoid 0:cb44e2e9ec4c 1817 // CODE GENERATOR: banner before DataLogHelloCppCodeList while(1)
whismanoid 0:cb44e2e9ec4c 1818 //~ cmdLine.serial().printf("v_filter = 0x%2.2x\r\n", g_MAX11410_device.v_filter);
whismanoid 0:cb44e2e9ec4c 1819
whismanoid 0:cb44e2e9ec4c 1820 //~ cmdLine.serial().printf("v_pga = 0x%2.2x\r\n", g_MAX11410_device.v_pga);
whismanoid 0:cb44e2e9ec4c 1821
whismanoid 0:cb44e2e9ec4c 1822 //~ cmdLine.serial().printf("v_ctrl = 0x%2.2x\r\n", g_MAX11410_device.v_ctrl);
whismanoid 0:cb44e2e9ec4c 1823
whismanoid 0:cb44e2e9ec4c 1824 // banner for csv data columns
whismanoid 0:cb44e2e9ec4c 1825 //~ cmdLine.serial().printf("\"AIN0_V\",\"AIN1_V\",\"AIN2_V\",\"AIN3_V\",\"AIN4_V\",\"AIN5_V\",\"AIN6_V\",\"AIN7_V\",\"AIN8_V\",\"AIN9_V\"");
whismanoid 1:747f1602abfc 1826 // cmdLine.serial().printf("\"AIN%d_V\"", 0);
whismanoid 1:747f1602abfc 1827 for (int index = 0; index < NUM_PLATFORM_ANALOG_IN_CHANNELS; index++) {
whismanoid 1:747f1602abfc 1828 if (index > 0) { cmdLine.serial().printf(","); }
whismanoid 1:747f1602abfc 1829 cmdLine.serial().printf("\"AIN%d", index);
whismanoid 1:747f1602abfc 1830 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 1:747f1602abfc 1831 cmdLine.serial().printf("_LSB\"");
whismanoid 1:747f1602abfc 1832 #elif LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 1:747f1602abfc 1833 cmdLine.serial().printf("_V\"");
whismanoid 1:747f1602abfc 1834 #endif
whismanoid 0:cb44e2e9ec4c 1835 }
whismanoid 0:cb44e2e9ec4c 1836
whismanoid 0:cb44e2e9ec4c 1837 #if VERIFY_PART_ID_IN_LOOP
whismanoid 1:747f1602abfc 1838 cmdLine.serial().printf(",\"PART_ID\"");
whismanoid 0:cb44e2e9ec4c 1839 #endif // VERIFY_PART_ID_IN_LOOP
whismanoid 1:747f1602abfc 1840 cmdLine.serial().printf("\r\n");
whismanoid 0:cb44e2e9ec4c 1841
whismanoid 0:cb44e2e9ec4c 1842 while(1) { // this code repeats forever
whismanoid 0:cb44e2e9ec4c 1843 // this code repeats forever
whismanoid 0:cb44e2e9ec4c 1844 // CODE GENERATOR: example code: has no member function ScanStandardExternalClock
whismanoid 0:cb44e2e9ec4c 1845 // CODE GENERATOR: example code: has no member function ReadAINcode
whismanoid 0:cb44e2e9ec4c 1846 // CODE GENERATOR: example code: member function Read_All_Voltages
whismanoid 0:cb44e2e9ec4c 1847 // Measure ADC channels in sequence from AIN0 to channelNumber_0_9.
whismanoid 0:cb44e2e9ec4c 1848 // @param[in] g_MAX11410_device.channelNumber_0_15: AIN Channel Number
whismanoid 0:cb44e2e9ec4c 1849 // @param[in] g_MAX11410_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
whismanoid 0:cb44e2e9ec4c 1850 // @param[in] g_MAX11410_device.chan_id_0_1: ADC_MODE_CONTROL.CHAN_ID
whismanoid 0:cb44e2e9ec4c 1851 //~ int channelId_0_9 = 9;
whismanoid 0:cb44e2e9ec4c 1852 //g_MAX11410_device.channelNumber_0_15 = channelId_0_9;
whismanoid 0:cb44e2e9ec4c 1853 //g_MAX11410_device.PowerManagement_0_2 = 0;
whismanoid 0:cb44e2e9ec4c 1854 //g_MAX11410_device.chan_id_0_1 = 1;
whismanoid 0:cb44e2e9ec4c 1855 //~ g_MAX11410_device.Read_All_Voltages();
whismanoid 0:cb44e2e9ec4c 1856 // mbed
whismanoid 0:cb44e2e9ec4c 1857 // Platform board uses simple analog inputs
whismanoid 1:747f1602abfc 1858 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 1:747f1602abfc 1859 Platform_LSB[0] = analogIn0.read();
whismanoid 1:747f1602abfc 1860 Platform_LSB[1] = analogIn1.read();
whismanoid 1:747f1602abfc 1861 Platform_LSB[2] = analogIn2.read();
whismanoid 1:747f1602abfc 1862 Platform_LSB[3] = analogIn3.read();
whismanoid 1:747f1602abfc 1863 Platform_LSB[4] = analogIn4.read();
whismanoid 1:747f1602abfc 1864 Platform_LSB[5] = analogIn5.read();
whismanoid 1:747f1602abfc 1865 #elif LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 1:747f1602abfc 1866 Platform_Voltage[0] = analogIn0.read() * adc_full_scale_voltage[0];
whismanoid 1:747f1602abfc 1867 Platform_Voltage[1] = analogIn1.read() * adc_full_scale_voltage[1];
whismanoid 1:747f1602abfc 1868 Platform_Voltage[2] = analogIn2.read() * adc_full_scale_voltage[2];
whismanoid 1:747f1602abfc 1869 Platform_Voltage[3] = analogIn3.read() * adc_full_scale_voltage[3];
whismanoid 1:747f1602abfc 1870 Platform_Voltage[4] = analogIn4.read() * adc_full_scale_voltage[4];
whismanoid 1:747f1602abfc 1871 Platform_Voltage[5] = analogIn5.read() * adc_full_scale_voltage[5];
whismanoid 1:747f1602abfc 1872 #endif
whismanoid 0:cb44e2e9ec4c 1873
whismanoid 0:cb44e2e9ec4c 1874 #if VERIFY_PART_ID_IN_LOOP
whismanoid 0:cb44e2e9ec4c 1875 // Device ID Validation
whismanoid 0:cb44e2e9ec4c 1876 const uint32_t part_id_expect = 0x000F02;
whismanoid 0:cb44e2e9ec4c 1877 uint32_t part_id_readback;
whismanoid 0:cb44e2e9ec4c 1878 g_MAX11410_device.RegRead(MAX11410::CMD_r001_0001_xxxx_xxxx_xxxx_xxxx_xxxx_xddd_PART_ID, &part_id_readback);
whismanoid 0:cb44e2e9ec4c 1879 #endif // VERIFY_PART_ID_IN_LOOP
whismanoid 0:cb44e2e9ec4c 1880
whismanoid 0:cb44e2e9ec4c 1881 // wait(3.0);
whismanoid 0:cb44e2e9ec4c 1882 // CODE GENERATOR: print conversion result
whismanoid 0:cb44e2e9ec4c 1883 // Use Arduino Serial Plotter to view output: Tools | Serial Plotter
whismanoid 1:747f1602abfc 1884 for (int index = 0; index < NUM_PLATFORM_ANALOG_IN_CHANNELS; index++) {
whismanoid 1:747f1602abfc 1885 if (index > 0) { cmdLine.serial().printf(","); }
whismanoid 1:747f1602abfc 1886 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 1:747f1602abfc 1887 cmdLine.serial().printf("%u", Platform_LSB[index]);
whismanoid 1:747f1602abfc 1888 #elif LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 1:747f1602abfc 1889 cmdLine.serial().printf("%6.6fV", Platform_Voltage[index]);
whismanoid 1:747f1602abfc 1890 #endif
whismanoid 0:cb44e2e9ec4c 1891 }
whismanoid 0:cb44e2e9ec4c 1892 #if VERIFY_PART_ID_IN_LOOP
whismanoid 0:cb44e2e9ec4c 1893 if (part_id_readback != part_id_expect) {
whismanoid 0:cb44e2e9ec4c 1894 cmdLine.serial().printf(",\"FAIL\"");
whismanoid 0:cb44e2e9ec4c 1895
whismanoid 0:cb44e2e9ec4c 1896 //~ g_MAX11410_device.Init();
whismanoid 0:cb44e2e9ec4c 1897 //~ g_MAX11410_device.v_filter = custom_v_filter;
whismanoid 0:cb44e2e9ec4c 1898 //~ g_MAX11410_device.v_pga = custom_v_pga;
whismanoid 0:cb44e2e9ec4c 1899 //~ g_MAX11410_device.v_ctrl = custom_v_ctrl;
whismanoid 0:cb44e2e9ec4c 1900 }
whismanoid 0:cb44e2e9ec4c 1901 else {
whismanoid 0:cb44e2e9ec4c 1902 cmdLine.serial().printf(",\"OK\"");
whismanoid 0:cb44e2e9ec4c 1903
whismanoid 0:cb44e2e9ec4c 1904 }
whismanoid 0:cb44e2e9ec4c 1905 #endif // VERIFY_PART_ID_IN_LOOP
whismanoid 0:cb44e2e9ec4c 1906 cmdLine.serial().printf("\r\n");
whismanoid 0:cb44e2e9ec4c 1907
whismanoid 0:cb44e2e9ec4c 1908 } // this code repeats forever
whismanoid 0:cb44e2e9ec4c 1909 }
whismanoid 0:cb44e2e9ec4c 1910 //---------- CODE GENERATOR: end DataLogHelloCppCodeList