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:
Sun Nov 29 02:34:50 2020 +0000
Revision:
4:d9b05924ad4c
Parent:
3:9055e17e181a
Child:
5:aaf8b5f5fda1
Datalog free run until command, LR start free run again

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
whismanoid 0:cb44e2e9ec4c 87 //--------------------------------------------------
whismanoid 3:9055e17e181a 88 // Option to use SPI connected ADC
whismanoid 3:9055e17e181a 89 #ifndef SPI_ADC_DeviceName
whismanoid 3:9055e17e181a 90 //~ #define SPI_ADC_DeviceName MAX11410
whismanoid 3:9055e17e181a 91 #undef SPI_ADC_DeviceName
whismanoid 3:9055e17e181a 92 #endif
whismanoid 3:9055e17e181a 93 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 94 #include "MAX11410.h"
whismanoid 3:9055e17e181a 95 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 96
whismanoid 0:cb44e2e9ec4c 97 #if defined(TARGET)
whismanoid 0:cb44e2e9ec4c 98 // TARGET_NAME macros from targets/TARGET_Maxim/TARGET_MAX32625/device/mxc_device.h
whismanoid 0:cb44e2e9ec4c 99 // Create a string definition for the TARGET
whismanoid 0:cb44e2e9ec4c 100 #define STRING_ARG(arg) #arg
whismanoid 0:cb44e2e9ec4c 101 #define STRING_NAME(name) STRING_ARG(name)
whismanoid 0:cb44e2e9ec4c 102 #define TARGET_NAME STRING_NAME(TARGET)
whismanoid 0:cb44e2e9ec4c 103 #elif defined(TARGET_MAX32600)
whismanoid 0:cb44e2e9ec4c 104 #define TARGET_NAME "MAX32600"
whismanoid 0:cb44e2e9ec4c 105 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 106 #define TARGET_NAME "LPC1768"
whismanoid 0:cb44e2e9ec4c 107 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:cb44e2e9ec4c 108 #define TARGET_NAME "NUCLEO_F446RE"
whismanoid 0:cb44e2e9ec4c 109 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 110 #define TARGET_NAME "NUCLEO_F401RE"
whismanoid 0:cb44e2e9ec4c 111 #else
whismanoid 0:cb44e2e9ec4c 112 #error TARGET NOT DEFINED
whismanoid 0:cb44e2e9ec4c 113 #endif
whismanoid 0:cb44e2e9ec4c 114 #if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 115 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 116 // TARGET=MAX32630FTHR ARM Cortex-M4F 96MHz 2048kB Flash 512kB SRAM
whismanoid 0:cb44e2e9ec4c 117 // +-------------[microUSB]-------------+
whismanoid 0:cb44e2e9ec4c 118 // | J1 MAX32630FTHR J2 |
whismanoid 0:cb44e2e9ec4c 119 // ______ | [ ] RST GND [ ] |
whismanoid 0:cb44e2e9ec4c 120 // ______ | [ ] 3V3 BAT+[ ] |
whismanoid 0:cb44e2e9ec4c 121 // ______ | [ ] 1V8 reset SW1 |
whismanoid 0:cb44e2e9ec4c 122 // ______ | [ ] GND J4 J3 |
whismanoid 0:cb44e2e9ec4c 123 // analogIn0/4 | [a] AIN_0 1.2Vfs (bat) SYS [ ] | switched BAT+
whismanoid 0:cb44e2e9ec4c 124 // analogIn1/5 | [a] AIN_1 1.2Vfs PWR [ ] | external pwr btn
whismanoid 0:cb44e2e9ec4c 125 // analogIn2 | [a] AIN_2 1.2Vfs +5V VBUS [ ] | USB +5V power
whismanoid 0:cb44e2e9ec4c 126 // analogIn3 | [a] AIN_3 1.2Vfs 1-WIRE P4_0 [d] | D0 dig9
whismanoid 0:cb44e2e9ec4c 127 // (I2C2.SDA) | [d] P5_7 SDA2 SRN P5_6 [d] | D1 dig8
whismanoid 0:cb44e2e9ec4c 128 // (I2C2.SCL) | [d] P6_0 SCL2 SDIO3 P5_5 [d] | D2 dig7
whismanoid 0:cb44e2e9ec4c 129 // D13/SCLK | [s] P5_0 SCLK SDIO2 P5_4 [d] | D3 dig6
whismanoid 0:cb44e2e9ec4c 130 // D11/MOSI | [s] P5_1 MOSI SSEL P5_3 [d] | D4 dig5
whismanoid 0:cb44e2e9ec4c 131 // D12/MISO | [s] P5_2 MISO RTS P3_3 [d] | D5 dig4
whismanoid 0:cb44e2e9ec4c 132 // D10/CS | [s] P3_0 RX CTS P3_2 [d] | D6 dig3
whismanoid 0:cb44e2e9ec4c 133 // D9 dig0 | [d] P3_1 TX SCL P3_5 [d] | D7 dig2
whismanoid 0:cb44e2e9ec4c 134 // ______ | [ ] GND SDA P3_4 [d] | D8 dig1
whismanoid 0:cb44e2e9ec4c 135 // | |
whismanoid 0:cb44e2e9ec4c 136 // | XIP Flash MAX14690N |
whismanoid 0:cb44e2e9ec4c 137 // | XIP_SCLK P1_0 SDA2 P5_7 |
whismanoid 0:cb44e2e9ec4c 138 // | XIP_MOSI P1_1 SCL2 P6_0 |
whismanoid 0:cb44e2e9ec4c 139 // | XIP_MISO P1_2 PMIC_INIT P3_7 |
whismanoid 0:cb44e2e9ec4c 140 // | XIP_SSEL P1_3 MPC P2_7 |
whismanoid 0:cb44e2e9ec4c 141 // | XIP_DIO2 P1_4 MON AIN_0 |
whismanoid 0:cb44e2e9ec4c 142 // | XIP_DIO3 P1_5 |
whismanoid 0:cb44e2e9ec4c 143 // | |
whismanoid 0:cb44e2e9ec4c 144 // | PAN1326B MicroSD LED |
whismanoid 0:cb44e2e9ec4c 145 // | BT_RX P0_0 SD_SCLK P0_4 r P2_4 |
whismanoid 0:cb44e2e9ec4c 146 // | BT_TX P0_1 SD_MOSI P0_5 g P2_5 |
whismanoid 0:cb44e2e9ec4c 147 // | BT_CTS P0_2 SD_MISO P0_6 b P2_6 |
whismanoid 0:cb44e2e9ec4c 148 // | BT_RTS P0_3 SD_SSEL P0_7 |
whismanoid 0:cb44e2e9ec4c 149 // | BT_RST P1_6 DETECT P2_2 |
whismanoid 0:cb44e2e9ec4c 150 // | BT_CLK P1_7 SW2 P2_3 |
whismanoid 0:cb44e2e9ec4c 151 // +------------------------------------+
whismanoid 0:cb44e2e9ec4c 152 // 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 153 // 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 154 // AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 155 // AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 156 // AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 157 // AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 158 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 159 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 160 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 161 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 162 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 163 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 164 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 165 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 166 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 167 //
whismanoid 0:cb44e2e9ec4c 168 #include "max32630fthr.h"
whismanoid 0:cb44e2e9ec4c 169 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
whismanoid 0:cb44e2e9ec4c 170 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 171 // MAX32630FTHR board supports only internal VREF = 1.200V at bypass capacitor C15
whismanoid 0:cb44e2e9ec4c 172 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 0:cb44e2e9ec4c 173 // Arduino connector
whismanoid 0:cb44e2e9ec4c 174 #ifndef A0
whismanoid 0:cb44e2e9ec4c 175 #define A0 AIN_0
whismanoid 0:cb44e2e9ec4c 176 #endif
whismanoid 0:cb44e2e9ec4c 177 #ifndef A1
whismanoid 0:cb44e2e9ec4c 178 #define A1 AIN_1
whismanoid 0:cb44e2e9ec4c 179 #endif
whismanoid 0:cb44e2e9ec4c 180 #ifndef A2
whismanoid 0:cb44e2e9ec4c 181 #define A2 AIN_2
whismanoid 0:cb44e2e9ec4c 182 #endif
whismanoid 0:cb44e2e9ec4c 183 #ifndef A3
whismanoid 0:cb44e2e9ec4c 184 #define A3 AIN_3
whismanoid 0:cb44e2e9ec4c 185 #endif
whismanoid 0:cb44e2e9ec4c 186 #ifndef D0
whismanoid 0:cb44e2e9ec4c 187 #define D0 P4_0
whismanoid 0:cb44e2e9ec4c 188 #endif
whismanoid 0:cb44e2e9ec4c 189 #ifndef D1
whismanoid 0:cb44e2e9ec4c 190 #define D1 P5_6
whismanoid 0:cb44e2e9ec4c 191 #endif
whismanoid 0:cb44e2e9ec4c 192 #ifndef D2
whismanoid 0:cb44e2e9ec4c 193 #define D2 P5_5
whismanoid 0:cb44e2e9ec4c 194 #endif
whismanoid 0:cb44e2e9ec4c 195 #ifndef D3
whismanoid 0:cb44e2e9ec4c 196 #define D3 P5_4
whismanoid 0:cb44e2e9ec4c 197 #endif
whismanoid 0:cb44e2e9ec4c 198 #ifndef D4
whismanoid 0:cb44e2e9ec4c 199 #define D4 P5_3
whismanoid 0:cb44e2e9ec4c 200 #endif
whismanoid 0:cb44e2e9ec4c 201 #ifndef D5
whismanoid 0:cb44e2e9ec4c 202 #define D5 P3_3
whismanoid 0:cb44e2e9ec4c 203 #endif
whismanoid 0:cb44e2e9ec4c 204 #ifndef D6
whismanoid 0:cb44e2e9ec4c 205 #define D6 P3_2
whismanoid 0:cb44e2e9ec4c 206 #endif
whismanoid 0:cb44e2e9ec4c 207 #ifndef D7
whismanoid 0:cb44e2e9ec4c 208 #define D7 P3_5
whismanoid 0:cb44e2e9ec4c 209 #endif
whismanoid 0:cb44e2e9ec4c 210 #ifndef D8
whismanoid 0:cb44e2e9ec4c 211 #define D8 P3_4
whismanoid 0:cb44e2e9ec4c 212 #endif
whismanoid 0:cb44e2e9ec4c 213 #ifndef D9
whismanoid 0:cb44e2e9ec4c 214 #define D9 P3_1
whismanoid 0:cb44e2e9ec4c 215 #endif
whismanoid 0:cb44e2e9ec4c 216 #ifndef D10
whismanoid 0:cb44e2e9ec4c 217 #define D10 P3_0
whismanoid 0:cb44e2e9ec4c 218 #endif
whismanoid 0:cb44e2e9ec4c 219 #ifndef D11
whismanoid 0:cb44e2e9ec4c 220 #define D11 P5_1
whismanoid 0:cb44e2e9ec4c 221 #endif
whismanoid 0:cb44e2e9ec4c 222 #ifndef D12
whismanoid 0:cb44e2e9ec4c 223 #define D12 P5_2
whismanoid 0:cb44e2e9ec4c 224 #endif
whismanoid 0:cb44e2e9ec4c 225 #ifndef D13
whismanoid 0:cb44e2e9ec4c 226 #define D13 P5_0
whismanoid 0:cb44e2e9ec4c 227 #endif
whismanoid 0:cb44e2e9ec4c 228 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 229 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 230 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 231 // TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:cb44e2e9ec4c 232 // +-------------------------------------+
whismanoid 0:cb44e2e9ec4c 233 // | MAX32625MBED Arduino UNO header |
whismanoid 0:cb44e2e9ec4c 234 // | |
whismanoid 0:cb44e2e9ec4c 235 // | A5/SCL[ ] | P1_7 dig15
whismanoid 0:cb44e2e9ec4c 236 // | A4/SDA[ ] | P1_6 dig14
whismanoid 0:cb44e2e9ec4c 237 // | AREF=N/C[ ] |
whismanoid 0:cb44e2e9ec4c 238 // | GND[ ] |
whismanoid 0:cb44e2e9ec4c 239 // | [ ]N/C SCK/13[ ] | P1_0 dig13
whismanoid 0:cb44e2e9ec4c 240 // | [ ]IOREF=3V3 MISO/12[ ] | P1_2 dig12
whismanoid 0:cb44e2e9ec4c 241 // | [ ]RST MOSI/11[ ]~| P1_1 dig11
whismanoid 0:cb44e2e9ec4c 242 // | [ ]3V3 CS/10[ ]~| P1_3 dig10
whismanoid 0:cb44e2e9ec4c 243 // | [ ]5V0 9[ ]~| P1_5 dig9
whismanoid 0:cb44e2e9ec4c 244 // | [ ]GND 8[ ] | P1_4 dig8
whismanoid 0:cb44e2e9ec4c 245 // | [ ]GND |
whismanoid 0:cb44e2e9ec4c 246 // | [ ]Vin 7[ ] | P0_7 dig7
whismanoid 0:cb44e2e9ec4c 247 // | 6[ ]~| P0_6 dig6
whismanoid 0:cb44e2e9ec4c 248 // AIN_0 | [ ]A0 5[ ]~| P0_5 dig5
whismanoid 0:cb44e2e9ec4c 249 // AIN_1 | [ ]A1 4[ ] | P0_4 dig4
whismanoid 0:cb44e2e9ec4c 250 // AIN_2 | [ ]A2 INT1/3[ ]~| P0_3 dig3
whismanoid 0:cb44e2e9ec4c 251 // AIN_3 | [ ]A3 INT0/2[ ] | P0_2 dig2
whismanoid 0:cb44e2e9ec4c 252 // dig16 P3_4 | [ ]A4/SDA RST SCK MISO TX>1[ ] | P0_1 dig1
whismanoid 0:cb44e2e9ec4c 253 // dig17 P3_5 | [ ]A5/SCL [ ] [ ] [ ] RX<0[ ] | P0_0 dig0
whismanoid 0:cb44e2e9ec4c 254 // | [ ] [ ] [ ] |
whismanoid 0:cb44e2e9ec4c 255 // | UNO_R3 GND MOSI 5V ____________/
whismanoid 0:cb44e2e9ec4c 256 // \_______________________/
whismanoid 0:cb44e2e9ec4c 257 //
whismanoid 0:cb44e2e9ec4c 258 // +------------------------+
whismanoid 0:cb44e2e9ec4c 259 // | |
whismanoid 0:cb44e2e9ec4c 260 // | MicroSD LED |
whismanoid 0:cb44e2e9ec4c 261 // | SD_SCLK P2_4 r P3_0 |
whismanoid 0:cb44e2e9ec4c 262 // | SD_MOSI P2_5 g P3_1 |
whismanoid 0:cb44e2e9ec4c 263 // | SD_MISO P2_6 b P3_2 |
whismanoid 0:cb44e2e9ec4c 264 // | SD_SSEL P2_7 y P3_3 |
whismanoid 0:cb44e2e9ec4c 265 // | |
whismanoid 0:cb44e2e9ec4c 266 // | DAPLINK BUTTONS |
whismanoid 0:cb44e2e9ec4c 267 // | TX P2_1 SW3 P2_3 |
whismanoid 0:cb44e2e9ec4c 268 // | RX P2_0 SW2 P2_2 |
whismanoid 0:cb44e2e9ec4c 269 // +------------------------+
whismanoid 0:cb44e2e9ec4c 270 //
whismanoid 0:cb44e2e9ec4c 271 // AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 272 // AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 273 // AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 274 // AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 275 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 276 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 277 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 278 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 279 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 280 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 281 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 282 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 283 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 284 //
whismanoid 0:cb44e2e9ec4c 285 //#include "max32625mbed.h" // ?
whismanoid 0:cb44e2e9ec4c 286 //MAX32625MBED mbed(MAX32625MBED::VIO_3V3); // ?
whismanoid 0:cb44e2e9ec4c 287 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 288 // MAX32630FTHR board supports only internal VREF = 1.200V at bypass capacitor C15
whismanoid 0:cb44e2e9ec4c 289 const float ADC_FULL_SCALE_VOLTAGE = 1.200; // TODO: ADC_FULL_SCALE_VOLTAGE Pico?
whismanoid 0:cb44e2e9ec4c 290 // Arduino connector
whismanoid 0:cb44e2e9ec4c 291 #ifndef A0
whismanoid 0:cb44e2e9ec4c 292 #define A0 AIN_0
whismanoid 0:cb44e2e9ec4c 293 #endif
whismanoid 0:cb44e2e9ec4c 294 #ifndef A1
whismanoid 0:cb44e2e9ec4c 295 #define A1 AIN_1
whismanoid 0:cb44e2e9ec4c 296 #endif
whismanoid 0:cb44e2e9ec4c 297 #ifndef A2
whismanoid 0:cb44e2e9ec4c 298 #define A2 AIN_2
whismanoid 0:cb44e2e9ec4c 299 #endif
whismanoid 0:cb44e2e9ec4c 300 #ifndef A3
whismanoid 0:cb44e2e9ec4c 301 #define A3 AIN_3
whismanoid 0:cb44e2e9ec4c 302 #endif
whismanoid 0:cb44e2e9ec4c 303 #ifndef D0
whismanoid 0:cb44e2e9ec4c 304 #define D0 P0_0
whismanoid 0:cb44e2e9ec4c 305 #endif
whismanoid 0:cb44e2e9ec4c 306 #ifndef D1
whismanoid 0:cb44e2e9ec4c 307 #define D1 P0_1
whismanoid 0:cb44e2e9ec4c 308 #endif
whismanoid 0:cb44e2e9ec4c 309 #ifndef D2
whismanoid 0:cb44e2e9ec4c 310 #define D2 P0_2
whismanoid 0:cb44e2e9ec4c 311 #endif
whismanoid 0:cb44e2e9ec4c 312 #ifndef D3
whismanoid 0:cb44e2e9ec4c 313 #define D3 P0_3
whismanoid 0:cb44e2e9ec4c 314 #endif
whismanoid 0:cb44e2e9ec4c 315 #ifndef D4
whismanoid 0:cb44e2e9ec4c 316 #define D4 P0_4
whismanoid 0:cb44e2e9ec4c 317 #endif
whismanoid 0:cb44e2e9ec4c 318 #ifndef D5
whismanoid 0:cb44e2e9ec4c 319 #define D5 P0_5
whismanoid 0:cb44e2e9ec4c 320 #endif
whismanoid 0:cb44e2e9ec4c 321 #ifndef D6
whismanoid 0:cb44e2e9ec4c 322 #define D6 P0_6
whismanoid 0:cb44e2e9ec4c 323 #endif
whismanoid 0:cb44e2e9ec4c 324 #ifndef D7
whismanoid 0:cb44e2e9ec4c 325 #define D7 P0_7
whismanoid 0:cb44e2e9ec4c 326 #endif
whismanoid 0:cb44e2e9ec4c 327 #ifndef D8
whismanoid 0:cb44e2e9ec4c 328 #define D8 P1_4
whismanoid 0:cb44e2e9ec4c 329 #endif
whismanoid 0:cb44e2e9ec4c 330 #ifndef D9
whismanoid 0:cb44e2e9ec4c 331 #define D9 P1_5
whismanoid 0:cb44e2e9ec4c 332 #endif
whismanoid 0:cb44e2e9ec4c 333 #ifndef D10
whismanoid 0:cb44e2e9ec4c 334 #define D10 P1_3
whismanoid 0:cb44e2e9ec4c 335 #endif
whismanoid 0:cb44e2e9ec4c 336 #ifndef D11
whismanoid 0:cb44e2e9ec4c 337 #define D11 P1_1
whismanoid 0:cb44e2e9ec4c 338 #endif
whismanoid 0:cb44e2e9ec4c 339 #ifndef D12
whismanoid 0:cb44e2e9ec4c 340 #define D12 P1_2
whismanoid 0:cb44e2e9ec4c 341 #endif
whismanoid 0:cb44e2e9ec4c 342 #ifndef D13
whismanoid 0:cb44e2e9ec4c 343 #define D13 P1_0
whismanoid 0:cb44e2e9ec4c 344 #endif
whismanoid 0:cb44e2e9ec4c 345 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 346 #elif defined(TARGET_MAX32600)
whismanoid 0:cb44e2e9ec4c 347 // target MAX32600
whismanoid 0:cb44e2e9ec4c 348 //
whismanoid 0:cb44e2e9ec4c 349 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:cb44e2e9ec4c 350 const float ADC_FULL_SCALE_VOLTAGE = 1.500;
whismanoid 0:cb44e2e9ec4c 351 //
whismanoid 0:cb44e2e9ec4c 352 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 353 #elif defined(TARGET_MAX32620FTHR)
whismanoid 0:cb44e2e9ec4c 354 #warning "TARGET_MAX32620FTHR not previously tested; need to define pins..."
whismanoid 0:cb44e2e9ec4c 355 #include "MAX32620FTHR.h"
whismanoid 0:cb44e2e9ec4c 356 // Initialize I/O voltages on MAX32620FTHR board
whismanoid 0:cb44e2e9ec4c 357 MAX32620FTHR fthr(MAX32620FTHR::VIO_3V3);
whismanoid 0:cb44e2e9ec4c 358 //#define USE_LEDS 0 ?
whismanoid 0:cb44e2e9ec4c 359 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 360 #warning "TARGET_MAX32620FTHR not previously tested; need to verify ADC_FULL_SCALE_VOLTAGE..."
whismanoid 0:cb44e2e9ec4c 361 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 0:cb44e2e9ec4c 362 //
whismanoid 0:cb44e2e9ec4c 363 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 364 #elif defined(TARGET_MAX32625PICO)
whismanoid 0:cb44e2e9ec4c 365 #warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
whismanoid 0:cb44e2e9ec4c 366 #include "max32625pico.h"
whismanoid 0:cb44e2e9ec4c 367 // configure MAX32625PICO VDDIOH mode, and I/O voltages for DIP pins and SWD pins
whismanoid 0:cb44e2e9ec4c 368 MAX32625PICO pico(
whismanoid 0:cb44e2e9ec4c 369 // vddioh_mode_t iohMode
whismanoid 0:cb44e2e9ec4c 370 //~ MAX32625PICO::IOH_OFF, // No connections to VDDIOH
whismanoid 0:cb44e2e9ec4c 371 //~ MAX32625PICO::IOH_DIP_IN, // VDDIOH input from DIP pin 1 (AIN0)
whismanoid 0:cb44e2e9ec4c 372 //~ MAX32625PICO::IOH_SWD_IN, // VDDIOH input from SWD pin 1
whismanoid 0:cb44e2e9ec4c 373 MAX32625PICO::IOH_3V3, // VDDIOH = 3.3V from local supply
whismanoid 0:cb44e2e9ec4c 374 //~ MAX32625PICO::IOH_DIP_OUT, // VDDIOH = 3.3V output to DIP pin 1
whismanoid 0:cb44e2e9ec4c 375 //~ MAX32625PICO::IOH_SWD_OUT, // VDDIOH = 3.3V output to SWD pin 1
whismanoid 0:cb44e2e9ec4c 376 //
whismanoid 0:cb44e2e9ec4c 377 // vio_t dipVio = MAX32625PICO::VIO_1V8 or MAX32625PICO::VIO_IOH
whismanoid 0:cb44e2e9ec4c 378 //~ MAX32625PICO::VIO_1V8, // 1.8V IO (local)
whismanoid 0:cb44e2e9ec4c 379 MAX32625PICO::VIO_IOH, // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V)
whismanoid 0:cb44e2e9ec4c 380 //
whismanoid 0:cb44e2e9ec4c 381 // vio_t swdVio
whismanoid 0:cb44e2e9ec4c 382 //~ MAX32625PICO::VIO_1V8 // 1.8V IO (local)
whismanoid 0:cb44e2e9ec4c 383 MAX32625PICO::VIO_IOH // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V)
whismanoid 0:cb44e2e9ec4c 384 );
whismanoid 0:cb44e2e9ec4c 385 //#define USE_LEDS 0 ?
whismanoid 0:cb44e2e9ec4c 386 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 387 #warning "TARGET_MAX32625PICO not previously tested; need to verify ADC_FULL_SCALE_VOLTAGE..."
whismanoid 0:cb44e2e9ec4c 388 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 0:cb44e2e9ec4c 389 //
whismanoid 0:cb44e2e9ec4c 390 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 391 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 392 // TODO1: target NUCLEO_F446RE
whismanoid 0:cb44e2e9ec4c 393 //
whismanoid 0:cb44e2e9ec4c 394 // USER_BUTTON PC13
whismanoid 0:cb44e2e9ec4c 395 // LED1 is shared with SPI_SCK on NUCLEO_F446RE PA_5, so don't use LED1.
whismanoid 0:cb44e2e9ec4c 396 #define USE_LEDS 0
whismanoid 0:cb44e2e9ec4c 397 // SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK);
whismanoid 0:cb44e2e9ec4c 398 // Serial serial(SERIAL_TX, SERIAL_RX);
whismanoid 0:cb44e2e9ec4c 399 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:cb44e2e9ec4c 400 const float ADC_FULL_SCALE_VOLTAGE = 3.300; // TODO: ADC_FULL_SCALE_VOLTAGE Pico?
whismanoid 0:cb44e2e9ec4c 401 //
whismanoid 0:cb44e2e9ec4c 402 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 403 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 404 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 405 // TARGET=LPC1768 ARM Cortex-M3 100 MHz 512kB flash 64kB SRAM
whismanoid 0:cb44e2e9ec4c 406 // +-------------[microUSB]-------------+
whismanoid 0:cb44e2e9ec4c 407 // ______ | [ ] GND +3.3V VOUT [ ] | ______
whismanoid 0:cb44e2e9ec4c 408 // ______ | [ ] 4.5V<VIN<9.0V +5.0V VU [ ] | ______
whismanoid 0:cb44e2e9ec4c 409 // ______ | [ ] VB USB.IF- [ ] | ______
whismanoid 0:cb44e2e9ec4c 410 // ______ | [ ] nR USB.IF+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 411 // digitalInOut0 | [ ] p5 MOSI ETHERNET.RD- [ ] | ______
whismanoid 0:cb44e2e9ec4c 412 // digitalInOut1 | [ ] p6 MISO ETHERNET.RD+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 413 // digitalInOut2 | [ ] p7 SCLK ETHERNET.TD- [ ] | ______
whismanoid 0:cb44e2e9ec4c 414 // digitalInOut3 | [ ] p8 ETHERNET.TD+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 415 // digitalInOut4 | [ ] p9 TX SDA USB.D- [ ] | ______
whismanoid 0:cb44e2e9ec4c 416 // digitalInOut5 | [ ] p10 RX SCL USB.D+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 417 // digitalInOut6 | [ ] p11 MOSI CAN-RD p30 [ ] | digitalInOut13
whismanoid 0:cb44e2e9ec4c 418 // digitalInOut7 | [ ] p12 MISO CAN-TD p29 [ ] | digitalInOut12
whismanoid 0:cb44e2e9ec4c 419 // digitalInOut8 | [ ] p13 TX SCLK SDA TX p28 [ ] | digitalInOut11
whismanoid 0:cb44e2e9ec4c 420 // digitalInOut9 | [ ] p14 RX SCL RX p27 [ ] | digitalInOut10
whismanoid 0:cb44e2e9ec4c 421 // analogIn0 | [ ] p15 AIN0 3.3Vfs PWM1 p26 [ ] | pwmDriver1
whismanoid 0:cb44e2e9ec4c 422 // analogIn1 | [ ] p16 AIN1 3.3Vfs PWM2 p25 [ ] | pwmDriver2
whismanoid 0:cb44e2e9ec4c 423 // analogIn2 | [ ] p17 AIN2 3.3Vfs PWM3 p24 [ ] | pwmDriver3
whismanoid 0:cb44e2e9ec4c 424 // analogIn3 | [ ] p18 AIN3 AOUT PWM4 p23 [ ] | pwmDriver4
whismanoid 0:cb44e2e9ec4c 425 // analogIn4 | [ ] p19 AIN4 3.3Vfs PWM5 p22 [ ] | pwmDriver5
whismanoid 0:cb44e2e9ec4c 426 // analogIn5 | [ ] p20 AIN5 3.3Vfs PWM6 p21 [ ] | pwmDriver6
whismanoid 0:cb44e2e9ec4c 427 // +------------------------------------+
whismanoid 0:cb44e2e9ec4c 428 // AIN6 = P0.3 = TGT_SBL_RXD?
whismanoid 0:cb44e2e9ec4c 429 // AIN7 = P0.2 = TGT_SBL_TXD?
whismanoid 0:cb44e2e9ec4c 430 //
whismanoid 0:cb44e2e9ec4c 431 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 432 // LPC1768 board uses VREF = 3.300V +A3,3V thru L1 to bypass capacitor C14
whismanoid 0:cb44e2e9ec4c 433 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:cb44e2e9ec4c 434 const float ADC_FULL_SCALE_VOLTAGE = 3.300;
whismanoid 0:cb44e2e9ec4c 435 #else // not defined(TARGET_LPC1768 etc.)
whismanoid 0:cb44e2e9ec4c 436 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 437 // unknown target
whismanoid 0:cb44e2e9ec4c 438 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 439 #endif // target definition
whismanoid 0:cb44e2e9ec4c 440
whismanoid 0:cb44e2e9ec4c 441
whismanoid 0:cb44e2e9ec4c 442
whismanoid 0:cb44e2e9ec4c 443
whismanoid 0:cb44e2e9ec4c 444 // uncrustify-0.66.1 *INDENT-OFF*
whismanoid 0:cb44e2e9ec4c 445 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 446 // Declare the DigitalInOut GPIO pins
whismanoid 0:cb44e2e9ec4c 447 // Optional digitalInOut support. If there is only one it should be digitalInOut1.
whismanoid 0:cb44e2e9ec4c 448 // D) Digital High/Low/Input Pin
whismanoid 0:cb44e2e9ec4c 449 #if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 450 // +-------------[microUSB]-------------+
whismanoid 0:cb44e2e9ec4c 451 // | J1 MAX32630FTHR J2 |
whismanoid 0:cb44e2e9ec4c 452 // | [ ] RST GND [ ] |
whismanoid 0:cb44e2e9ec4c 453 // | [ ] 3V3 BAT+[ ] |
whismanoid 0:cb44e2e9ec4c 454 // | [ ] 1V8 reset SW1 |
whismanoid 0:cb44e2e9ec4c 455 // | [ ] GND J4 J3 |
whismanoid 0:cb44e2e9ec4c 456 // | [ ] AIN_0 1.2Vfs (bat) SYS [ ] |
whismanoid 0:cb44e2e9ec4c 457 // | [ ] AIN_1 1.2Vfs PWR [ ] |
whismanoid 0:cb44e2e9ec4c 458 // | [ ] AIN_2 1.2Vfs +5V VBUS [ ] |
whismanoid 0:cb44e2e9ec4c 459 // | [ ] AIN_3 1.2Vfs 1-WIRE P4_0 [ ] | dig9
whismanoid 0:cb44e2e9ec4c 460 // dig10 | [x] P5_7 SDA2 SRN P5_6 [ ] | dig8
whismanoid 0:cb44e2e9ec4c 461 // dig11 | [x] P6_0 SCL2 SDIO3 P5_5 [ ] | dig7
whismanoid 0:cb44e2e9ec4c 462 // dig12 | [x] P5_0 SCLK SDIO2 P5_4 [ ] | dig6
whismanoid 0:cb44e2e9ec4c 463 // dig13 | [x] P5_1 MOSI SSEL P5_3 [x] | dig5
whismanoid 0:cb44e2e9ec4c 464 // dig14 | [ ] P5_2 MISO RTS P3_3 [ ] | dig4
whismanoid 0:cb44e2e9ec4c 465 // dig15 | [ ] P3_0 RX CTS P3_2 [ ] | dig3
whismanoid 0:cb44e2e9ec4c 466 // dig0 | [ ] P3_1 TX SCL P3_5 [x] | dig2
whismanoid 0:cb44e2e9ec4c 467 // | [ ] GND SDA P3_4 [x] | dig1
whismanoid 0:cb44e2e9ec4c 468 // +------------------------------------+
whismanoid 0:cb44e2e9ec4c 469 #define HAS_digitalInOut0 1 // P3_1 TARGET_MAX32630 J1.15
whismanoid 0:cb44e2e9ec4c 470 #define HAS_digitalInOut1 1 // P3_4 TARGET_MAX32630 J3.12
whismanoid 0:cb44e2e9ec4c 471 #define HAS_digitalInOut2 1 // P3_5 TARGET_MAX32630 J3.11
whismanoid 0:cb44e2e9ec4c 472 #define HAS_digitalInOut3 1 // P3_2 TARGET_MAX32630 J3.10
whismanoid 0:cb44e2e9ec4c 473 #define HAS_digitalInOut4 1 // P3_3 TARGET_MAX32630 J3.9
whismanoid 0:cb44e2e9ec4c 474 #define HAS_digitalInOut5 1 // P5_3 TARGET_MAX32630 J3.8
whismanoid 0:cb44e2e9ec4c 475 #define HAS_digitalInOut6 1 // P5_4 TARGET_MAX32630 J3.7
whismanoid 0:cb44e2e9ec4c 476 #define HAS_digitalInOut7 1 // P5_5 TARGET_MAX32630 J3.6
whismanoid 0:cb44e2e9ec4c 477 #define HAS_digitalInOut8 1 // P5_6 TARGET_MAX32630 J3.5
whismanoid 0:cb44e2e9ec4c 478 #define HAS_digitalInOut9 1 // P4_0 TARGET_MAX32630 J3.4
whismanoid 0:cb44e2e9ec4c 479 #if HAS_I2C
whismanoid 0:cb44e2e9ec4c 480 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:cb44e2e9ec4c 481 #define HAS_digitalInOut10 0 // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:cb44e2e9ec4c 482 #define HAS_digitalInOut11 0 // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:cb44e2e9ec4c 483 #else // HAS_I2C
whismanoid 0:cb44e2e9ec4c 484 #define HAS_digitalInOut10 1 // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:cb44e2e9ec4c 485 #define HAS_digitalInOut11 1 // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:cb44e2e9ec4c 486 #endif // HAS_I2C
whismanoid 0:cb44e2e9ec4c 487 #if HAS_SPI
whismanoid 0:cb44e2e9ec4c 488 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 489 #define HAS_digitalInOut12 0 // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:cb44e2e9ec4c 490 #define HAS_digitalInOut13 0 // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:cb44e2e9ec4c 491 #define HAS_digitalInOut14 0 // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:cb44e2e9ec4c 492 #define HAS_digitalInOut15 0 // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:cb44e2e9ec4c 493 #else // HAS_SPI
whismanoid 0:cb44e2e9ec4c 494 #define HAS_digitalInOut12 1 // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:cb44e2e9ec4c 495 #define HAS_digitalInOut13 1 // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:cb44e2e9ec4c 496 #define HAS_digitalInOut14 1 // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:cb44e2e9ec4c 497 #define HAS_digitalInOut15 1 // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:cb44e2e9ec4c 498 #endif // HAS_SPI
whismanoid 0:cb44e2e9ec4c 499 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 500 DigitalInOut digitalInOut0(P3_1, PIN_INPUT, PullUp, 1); // P3_1 TARGET_MAX32630 J1.15
whismanoid 0:cb44e2e9ec4c 501 #endif
whismanoid 0:cb44e2e9ec4c 502 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 503 DigitalInOut digitalInOut1(P3_4, PIN_INPUT, PullUp, 1); // P3_4 TARGET_MAX32630 J3.12
whismanoid 0:cb44e2e9ec4c 504 #endif
whismanoid 0:cb44e2e9ec4c 505 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 506 DigitalInOut digitalInOut2(P3_5, PIN_INPUT, PullUp, 1); // P3_5 TARGET_MAX32630 J3.11
whismanoid 0:cb44e2e9ec4c 507 #endif
whismanoid 0:cb44e2e9ec4c 508 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 509 DigitalInOut digitalInOut3(P3_2, PIN_INPUT, PullUp, 1); // P3_2 TARGET_MAX32630 J3.10
whismanoid 0:cb44e2e9ec4c 510 #endif
whismanoid 0:cb44e2e9ec4c 511 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 512 DigitalInOut digitalInOut4(P3_3, PIN_INPUT, PullUp, 1); // P3_3 TARGET_MAX32630 J3.9
whismanoid 0:cb44e2e9ec4c 513 #endif
whismanoid 0:cb44e2e9ec4c 514 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 515 DigitalInOut digitalInOut5(P5_3, PIN_INPUT, PullUp, 1); // P5_3 TARGET_MAX32630 J3.8
whismanoid 0:cb44e2e9ec4c 516 #endif
whismanoid 0:cb44e2e9ec4c 517 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 518 DigitalInOut digitalInOut6(P5_4, PIN_INPUT, PullUp, 1); // P5_4 TARGET_MAX32630 J3.7
whismanoid 0:cb44e2e9ec4c 519 #endif
whismanoid 0:cb44e2e9ec4c 520 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 521 DigitalInOut digitalInOut7(P5_5, PIN_INPUT, PullUp, 1); // P5_5 TARGET_MAX32630 J3.6
whismanoid 0:cb44e2e9ec4c 522 #endif
whismanoid 0:cb44e2e9ec4c 523 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 524 DigitalInOut digitalInOut8(P5_6, PIN_INPUT, PullUp, 1); // P5_6 TARGET_MAX32630 J3.5
whismanoid 0:cb44e2e9ec4c 525 #endif
whismanoid 0:cb44e2e9ec4c 526 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 527 DigitalInOut digitalInOut9(P4_0, PIN_INPUT, PullUp, 1); // P4_0 TARGET_MAX32630 J3.4
whismanoid 0:cb44e2e9ec4c 528 #endif
whismanoid 0:cb44e2e9ec4c 529 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 530 DigitalInOut digitalInOut10(P5_7, PIN_INPUT, PullUp, 1); // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:cb44e2e9ec4c 531 #endif
whismanoid 0:cb44e2e9ec4c 532 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 533 DigitalInOut digitalInOut11(P6_0, PIN_INPUT, PullUp, 1); // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:cb44e2e9ec4c 534 #endif
whismanoid 0:cb44e2e9ec4c 535 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 536 DigitalInOut digitalInOut12(P5_0, PIN_INPUT, PullUp, 1); // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:cb44e2e9ec4c 537 #endif
whismanoid 0:cb44e2e9ec4c 538 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 539 DigitalInOut digitalInOut13(P5_1, PIN_INPUT, PullUp, 1); // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:cb44e2e9ec4c 540 #endif
whismanoid 0:cb44e2e9ec4c 541 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 542 DigitalInOut digitalInOut14(P5_2, PIN_INPUT, PullUp, 1); // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:cb44e2e9ec4c 543 #endif
whismanoid 0:cb44e2e9ec4c 544 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 545 DigitalInOut digitalInOut15(P3_0, PIN_INPUT, PullUp, 1); // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:cb44e2e9ec4c 546 #endif
whismanoid 0:cb44e2e9ec4c 547 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 548 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 549 // TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:cb44e2e9ec4c 550 // +-------------------------------------+
whismanoid 0:cb44e2e9ec4c 551 // | MAX32625MBED Arduino UNO header |
whismanoid 0:cb44e2e9ec4c 552 // | |
whismanoid 0:cb44e2e9ec4c 553 // | A5/SCL[ ] | P1_7 dig15
whismanoid 0:cb44e2e9ec4c 554 // | A4/SDA[ ] | P1_6 dig14
whismanoid 0:cb44e2e9ec4c 555 // | AREF=N/C[ ] |
whismanoid 0:cb44e2e9ec4c 556 // | GND[ ] |
whismanoid 0:cb44e2e9ec4c 557 // | [ ]N/C SCK/13[ ] | P1_0 dig13
whismanoid 0:cb44e2e9ec4c 558 // | [ ]IOREF=3V3 MISO/12[ ] | P1_2 dig12
whismanoid 0:cb44e2e9ec4c 559 // | [ ]RST MOSI/11[ ]~| P1_1 dig11
whismanoid 0:cb44e2e9ec4c 560 // | [ ]3V3 CS/10[ ]~| P1_3 dig10
whismanoid 0:cb44e2e9ec4c 561 // | [ ]5V0 9[ ]~| P1_5 dig9
whismanoid 0:cb44e2e9ec4c 562 // | [ ]GND 8[ ] | P1_4 dig8
whismanoid 0:cb44e2e9ec4c 563 // | [ ]GND |
whismanoid 0:cb44e2e9ec4c 564 // | [ ]Vin 7[ ] | P0_7 dig7
whismanoid 0:cb44e2e9ec4c 565 // | 6[ ]~| P0_6 dig6
whismanoid 0:cb44e2e9ec4c 566 // AIN_0 | [ ]A0 5[ ]~| P0_5 dig5
whismanoid 0:cb44e2e9ec4c 567 // AIN_1 | [ ]A1 4[ ] | P0_4 dig4
whismanoid 0:cb44e2e9ec4c 568 // AIN_2 | [ ]A2 INT1/3[ ]~| P0_3 dig3
whismanoid 0:cb44e2e9ec4c 569 // AIN_3 | [ ]A3 INT0/2[ ] | P0_2 dig2
whismanoid 0:cb44e2e9ec4c 570 // dig16 P3_4 | [ ]A4/SDA RST SCK MISO TX>1[ ] | P0_1 dig1
whismanoid 0:cb44e2e9ec4c 571 // dig17 P3_5 | [ ]A5/SCL [ ] [ ] [ ] RX<0[ ] | P0_0 dig0
whismanoid 0:cb44e2e9ec4c 572 // | [ ] [ ] [ ] |
whismanoid 0:cb44e2e9ec4c 573 // | UNO_R3 GND MOSI 5V ____________/
whismanoid 0:cb44e2e9ec4c 574 // \_______________________/
whismanoid 0:cb44e2e9ec4c 575 //
whismanoid 0:cb44e2e9ec4c 576 #define HAS_digitalInOut0 1 // P0_0 TARGET_MAX32625MBED D0
whismanoid 0:cb44e2e9ec4c 577 #define HAS_digitalInOut1 1 // P0_1 TARGET_MAX32625MBED D1
whismanoid 0:cb44e2e9ec4c 578 #if APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 579 #define HAS_digitalInOut2 0 // P0_2 TARGET_MAX32625MBED D2 -- MAX11131 EOC DigitalIn
whismanoid 0:cb44e2e9ec4c 580 #else
whismanoid 0:cb44e2e9ec4c 581 #define HAS_digitalInOut2 1 // P0_2 TARGET_MAX32625MBED D2
whismanoid 0:cb44e2e9ec4c 582 #endif
whismanoid 0:cb44e2e9ec4c 583 #define HAS_digitalInOut3 1 // P0_3 TARGET_MAX32625MBED D3
whismanoid 0:cb44e2e9ec4c 584 #define HAS_digitalInOut4 1 // P0_4 TARGET_MAX32625MBED D4
whismanoid 0:cb44e2e9ec4c 585 #define HAS_digitalInOut5 1 // P0_5 TARGET_MAX32625MBED D5
whismanoid 0:cb44e2e9ec4c 586 #define HAS_digitalInOut6 1 // P0_6 TARGET_MAX32625MBED D6
whismanoid 0:cb44e2e9ec4c 587 #define HAS_digitalInOut7 1 // P0_7 TARGET_MAX32625MBED D7
whismanoid 0:cb44e2e9ec4c 588 #define HAS_digitalInOut8 1 // P1_4 TARGET_MAX32625MBED D8
whismanoid 0:cb44e2e9ec4c 589 #if APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 590 #define HAS_digitalInOut9 0 // P1_5 TARGET_MAX32625MBED D9 -- MAX11131 CNVST DigitalOut
whismanoid 0:cb44e2e9ec4c 591 #else
whismanoid 0:cb44e2e9ec4c 592 #define HAS_digitalInOut9 1 // P1_5 TARGET_MAX32625MBED D9
whismanoid 0:cb44e2e9ec4c 593 #endif
whismanoid 0:cb44e2e9ec4c 594 #if HAS_SPI
whismanoid 0:cb44e2e9ec4c 595 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 596 #define HAS_digitalInOut10 0 // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:cb44e2e9ec4c 597 #define HAS_digitalInOut11 0 // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:cb44e2e9ec4c 598 #define HAS_digitalInOut12 0 // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:cb44e2e9ec4c 599 #define HAS_digitalInOut13 0 // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:cb44e2e9ec4c 600 #else // HAS_SPI
whismanoid 0:cb44e2e9ec4c 601 #define HAS_digitalInOut10 1 // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:cb44e2e9ec4c 602 #define HAS_digitalInOut11 1 // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:cb44e2e9ec4c 603 #define HAS_digitalInOut12 1 // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:cb44e2e9ec4c 604 #define HAS_digitalInOut13 1 // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:cb44e2e9ec4c 605 #endif // HAS_SPI
whismanoid 0:cb44e2e9ec4c 606 #if HAS_I2C
whismanoid 0:cb44e2e9ec4c 607 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:cb44e2e9ec4c 608 #define HAS_digitalInOut14 0 // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 609 #define HAS_digitalInOut15 0 // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 610 #define HAS_digitalInOut16 0 // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 611 #define HAS_digitalInOut17 0 // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 612 #else // HAS_I2C
whismanoid 0:cb44e2e9ec4c 613 #define HAS_digitalInOut14 1 // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 614 #define HAS_digitalInOut15 1 // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 615 #define HAS_digitalInOut16 1 // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 616 #define HAS_digitalInOut17 1 // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 617 #endif // HAS_I2C
whismanoid 0:cb44e2e9ec4c 618 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 619 DigitalInOut digitalInOut0(P0_0, PIN_INPUT, PullUp, 1); // P0_0 TARGET_MAX32625MBED D0
whismanoid 0:cb44e2e9ec4c 620 #endif
whismanoid 0:cb44e2e9ec4c 621 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 622 DigitalInOut digitalInOut1(P0_1, PIN_INPUT, PullUp, 1); // P0_1 TARGET_MAX32625MBED D1
whismanoid 0:cb44e2e9ec4c 623 #endif
whismanoid 0:cb44e2e9ec4c 624 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 625 DigitalInOut digitalInOut2(P0_2, PIN_INPUT, PullUp, 1); // P0_2 TARGET_MAX32625MBED D2
whismanoid 0:cb44e2e9ec4c 626 #endif
whismanoid 0:cb44e2e9ec4c 627 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 628 DigitalInOut digitalInOut3(P0_3, PIN_INPUT, PullUp, 1); // P0_3 TARGET_MAX32625MBED D3
whismanoid 0:cb44e2e9ec4c 629 #endif
whismanoid 0:cb44e2e9ec4c 630 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 631 DigitalInOut digitalInOut4(P0_4, PIN_INPUT, PullUp, 1); // P0_4 TARGET_MAX32625MBED D4
whismanoid 0:cb44e2e9ec4c 632 #endif
whismanoid 0:cb44e2e9ec4c 633 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 634 DigitalInOut digitalInOut5(P0_5, PIN_INPUT, PullUp, 1); // P0_5 TARGET_MAX32625MBED D5
whismanoid 0:cb44e2e9ec4c 635 #endif
whismanoid 0:cb44e2e9ec4c 636 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 637 DigitalInOut digitalInOut6(P0_6, PIN_INPUT, PullUp, 1); // P0_6 TARGET_MAX32625MBED D6
whismanoid 0:cb44e2e9ec4c 638 #endif
whismanoid 0:cb44e2e9ec4c 639 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 640 DigitalInOut digitalInOut7(P0_7, PIN_INPUT, PullUp, 1); // P0_7 TARGET_MAX32625MBED D7
whismanoid 0:cb44e2e9ec4c 641 #endif
whismanoid 0:cb44e2e9ec4c 642 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 643 DigitalInOut digitalInOut8(P1_4, PIN_INPUT, PullUp, 1); // P1_4 TARGET_MAX32625MBED D8
whismanoid 0:cb44e2e9ec4c 644 #endif
whismanoid 0:cb44e2e9ec4c 645 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 646 DigitalInOut digitalInOut9(P1_5, PIN_INPUT, PullUp, 1); // P1_5 TARGET_MAX32625MBED D9
whismanoid 0:cb44e2e9ec4c 647 #endif
whismanoid 0:cb44e2e9ec4c 648 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 649 DigitalInOut digitalInOut10(P1_3, PIN_INPUT, PullUp, 1); // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:cb44e2e9ec4c 650 #endif
whismanoid 0:cb44e2e9ec4c 651 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 652 DigitalInOut digitalInOut11(P1_1, PIN_INPUT, PullUp, 1); // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:cb44e2e9ec4c 653 #endif
whismanoid 0:cb44e2e9ec4c 654 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 655 DigitalInOut digitalInOut12(P1_2, PIN_INPUT, PullUp, 1); // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:cb44e2e9ec4c 656 #endif
whismanoid 0:cb44e2e9ec4c 657 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 658 DigitalInOut digitalInOut13(P1_0, PIN_INPUT, PullUp, 1); // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:cb44e2e9ec4c 659 #endif
whismanoid 0:cb44e2e9ec4c 660 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 661 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 662 // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain
whismanoid 0:cb44e2e9ec4c 663 DigitalInOut digitalInOut14(P1_6, PIN_INPUT, OpenDrain, 1); // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 664 #endif
whismanoid 0:cb44e2e9ec4c 665 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 666 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 667 DigitalInOut digitalInOut15(P1_7, PIN_INPUT, OpenDrain, 1); // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 668 #endif
whismanoid 0:cb44e2e9ec4c 669 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 670 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 671 // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain
whismanoid 0:cb44e2e9ec4c 672 // PullUp-->3.4V, PullDown-->1.7V, PullNone-->3.5V, OpenDrain-->0.00V
whismanoid 0:cb44e2e9ec4c 673 DigitalInOut digitalInOut16(P3_4, PIN_INPUT, OpenDrain, 0); // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 674 #endif
whismanoid 0:cb44e2e9ec4c 675 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 676 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 677 DigitalInOut digitalInOut17(P3_5, PIN_INPUT, OpenDrain, 0); // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 678 #endif
whismanoid 0:cb44e2e9ec4c 679 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 680 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 681 #define HAS_digitalInOut0 0
whismanoid 0:cb44e2e9ec4c 682 #define HAS_digitalInOut1 0
whismanoid 0:cb44e2e9ec4c 683 #if APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 684 // D2 -- MAX11131 EOC DigitalIn
whismanoid 0:cb44e2e9ec4c 685 #define HAS_digitalInOut2 0
whismanoid 0:cb44e2e9ec4c 686 #else
whismanoid 0:cb44e2e9ec4c 687 #define HAS_digitalInOut2 1
whismanoid 0:cb44e2e9ec4c 688 #endif
whismanoid 0:cb44e2e9ec4c 689 #define HAS_digitalInOut3 1
whismanoid 0:cb44e2e9ec4c 690 #define HAS_digitalInOut4 1
whismanoid 0:cb44e2e9ec4c 691 #define HAS_digitalInOut5 1
whismanoid 0:cb44e2e9ec4c 692 #define HAS_digitalInOut6 1
whismanoid 0:cb44e2e9ec4c 693 #define HAS_digitalInOut7 1
whismanoid 0:cb44e2e9ec4c 694 #if APPLICATION_MAX5715
whismanoid 0:cb44e2e9ec4c 695 // D8 -- MAX5715 CLRb DigitalOut
whismanoid 0:cb44e2e9ec4c 696 #define HAS_digitalInOut8 0
whismanoid 0:cb44e2e9ec4c 697 #else
whismanoid 0:cb44e2e9ec4c 698 #define HAS_digitalInOut8 1
whismanoid 0:cb44e2e9ec4c 699 #endif
whismanoid 0:cb44e2e9ec4c 700 #if APPLICATION_MAX5715
whismanoid 0:cb44e2e9ec4c 701 // D9 -- MAX5715 LDACb DigitalOut
whismanoid 0:cb44e2e9ec4c 702 #define HAS_digitalInOut9 0
whismanoid 0:cb44e2e9ec4c 703 #elif APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 704 // D9 -- MAX11131 CNVST DigitalOut
whismanoid 0:cb44e2e9ec4c 705 #define HAS_digitalInOut9 0
whismanoid 0:cb44e2e9ec4c 706 #else
whismanoid 0:cb44e2e9ec4c 707 #define HAS_digitalInOut9 1
whismanoid 0:cb44e2e9ec4c 708 #endif
whismanoid 0:cb44e2e9ec4c 709 #if HAS_SPI
whismanoid 0:cb44e2e9ec4c 710 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 711 // Arduino digital pin D10 SPI function is CS/10
whismanoid 0:cb44e2e9ec4c 712 // Arduino digital pin D11 SPI function is MOSI/11
whismanoid 0:cb44e2e9ec4c 713 // Arduino digital pin D12 SPI function is MISO/12
whismanoid 0:cb44e2e9ec4c 714 // Arduino digital pin D13 SPI function is SCK/13
whismanoid 0:cb44e2e9ec4c 715 #define HAS_digitalInOut10 0
whismanoid 0:cb44e2e9ec4c 716 #define HAS_digitalInOut11 0
whismanoid 0:cb44e2e9ec4c 717 #define HAS_digitalInOut12 0
whismanoid 0:cb44e2e9ec4c 718 #define HAS_digitalInOut13 0
whismanoid 0:cb44e2e9ec4c 719 #else // HAS_SPI
whismanoid 0:cb44e2e9ec4c 720 #define HAS_digitalInOut10 1
whismanoid 0:cb44e2e9ec4c 721 #define HAS_digitalInOut11 1
whismanoid 0:cb44e2e9ec4c 722 #define HAS_digitalInOut12 1
whismanoid 0:cb44e2e9ec4c 723 #define HAS_digitalInOut13 1
whismanoid 0:cb44e2e9ec4c 724 #endif // HAS_SPI
whismanoid 0:cb44e2e9ec4c 725 #if HAS_I2C
whismanoid 0:cb44e2e9ec4c 726 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:cb44e2e9ec4c 727 // Arduino digital pin D14 I2C function is A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 728 // Arduino digital pin D15 I2C function is A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 729 // Arduino digital pin D16 I2C function is A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 730 // Arduino digital pin D17 I2C function is A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 731 #define HAS_digitalInOut14 0
whismanoid 0:cb44e2e9ec4c 732 #define HAS_digitalInOut15 0
whismanoid 0:cb44e2e9ec4c 733 #define HAS_digitalInOut16 0
whismanoid 0:cb44e2e9ec4c 734 #define HAS_digitalInOut17 0
whismanoid 0:cb44e2e9ec4c 735 #else // HAS_I2C
whismanoid 0:cb44e2e9ec4c 736 #define HAS_digitalInOut14 1
whismanoid 0:cb44e2e9ec4c 737 #define HAS_digitalInOut15 1
whismanoid 0:cb44e2e9ec4c 738 #define HAS_digitalInOut16 0
whismanoid 0:cb44e2e9ec4c 739 #define HAS_digitalInOut17 0
whismanoid 0:cb44e2e9ec4c 740 #endif // HAS_I2C
whismanoid 0:cb44e2e9ec4c 741 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 742 DigitalInOut digitalInOut0(D0, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 743 #endif
whismanoid 0:cb44e2e9ec4c 744 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 745 DigitalInOut digitalInOut1(D1, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 746 #endif
whismanoid 0:cb44e2e9ec4c 747 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 748 DigitalInOut digitalInOut2(D2, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 749 #endif
whismanoid 0:cb44e2e9ec4c 750 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 751 DigitalInOut digitalInOut3(D3, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 752 #endif
whismanoid 0:cb44e2e9ec4c 753 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 754 DigitalInOut digitalInOut4(D4, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 755 #endif
whismanoid 0:cb44e2e9ec4c 756 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 757 DigitalInOut digitalInOut5(D5, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 758 #endif
whismanoid 0:cb44e2e9ec4c 759 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 760 DigitalInOut digitalInOut6(D6, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 761 #endif
whismanoid 0:cb44e2e9ec4c 762 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 763 DigitalInOut digitalInOut7(D7, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 764 #endif
whismanoid 0:cb44e2e9ec4c 765 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 766 DigitalInOut digitalInOut8(D8, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 767 #endif
whismanoid 0:cb44e2e9ec4c 768 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 769 DigitalInOut digitalInOut9(D9, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 770 #endif
whismanoid 0:cb44e2e9ec4c 771 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 772 // Arduino digital pin D10 SPI function is CS/10
whismanoid 0:cb44e2e9ec4c 773 DigitalInOut digitalInOut10(D10, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 774 #endif
whismanoid 0:cb44e2e9ec4c 775 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 776 // Arduino digital pin D11 SPI function is MOSI/11
whismanoid 0:cb44e2e9ec4c 777 DigitalInOut digitalInOut11(D11, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 778 #endif
whismanoid 0:cb44e2e9ec4c 779 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 780 // Arduino digital pin D12 SPI function is MISO/12
whismanoid 0:cb44e2e9ec4c 781 DigitalInOut digitalInOut12(D12, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 782 #endif
whismanoid 0:cb44e2e9ec4c 783 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 784 // Arduino digital pin D13 SPI function is SCK/13
whismanoid 0:cb44e2e9ec4c 785 DigitalInOut digitalInOut13(D13, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 786 #endif
whismanoid 0:cb44e2e9ec4c 787 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 788 // Arduino digital pin D14 I2C function is A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 789 DigitalInOut digitalInOut14(D14, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 790 #endif
whismanoid 0:cb44e2e9ec4c 791 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 792 // Arduino digital pin D15 I2C function is A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 793 DigitalInOut digitalInOut15(D15, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 794 #endif
whismanoid 0:cb44e2e9ec4c 795 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 796 // Arduino digital pin D16 I2C function is A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 797 DigitalInOut digitalInOut16(D16, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 798 #endif
whismanoid 0:cb44e2e9ec4c 799 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 800 // Arduino digital pin D17 I2C function is A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 801 DigitalInOut digitalInOut17(D17, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 802 #endif
whismanoid 0:cb44e2e9ec4c 803 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 804 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 805 #define HAS_digitalInOut0 1
whismanoid 0:cb44e2e9ec4c 806 #define HAS_digitalInOut1 1
whismanoid 0:cb44e2e9ec4c 807 #define HAS_digitalInOut2 1
whismanoid 0:cb44e2e9ec4c 808 #define HAS_digitalInOut3 1
whismanoid 0:cb44e2e9ec4c 809 #define HAS_digitalInOut4 1
whismanoid 0:cb44e2e9ec4c 810 #define HAS_digitalInOut5 1
whismanoid 0:cb44e2e9ec4c 811 #define HAS_digitalInOut6 1
whismanoid 0:cb44e2e9ec4c 812 #define HAS_digitalInOut7 1
whismanoid 0:cb44e2e9ec4c 813 #define HAS_digitalInOut8 1
whismanoid 0:cb44e2e9ec4c 814 #define HAS_digitalInOut9 1
whismanoid 0:cb44e2e9ec4c 815 // #define HAS_digitalInOut10 1
whismanoid 0:cb44e2e9ec4c 816 // #define HAS_digitalInOut11 1
whismanoid 0:cb44e2e9ec4c 817 // #define HAS_digitalInOut12 1
whismanoid 0:cb44e2e9ec4c 818 // #define HAS_digitalInOut13 1
whismanoid 0:cb44e2e9ec4c 819 // #define HAS_digitalInOut14 1
whismanoid 0:cb44e2e9ec4c 820 // #define HAS_digitalInOut15 1
whismanoid 0:cb44e2e9ec4c 821 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 822 DigitalInOut digitalInOut0(p5, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.9/I2STX_SDA/MOSI1/MAT2.3
whismanoid 0:cb44e2e9ec4c 823 #endif
whismanoid 0:cb44e2e9ec4c 824 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 825 DigitalInOut digitalInOut1(p6, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.8/I2STX_WS/MISO1/MAT2.2
whismanoid 0:cb44e2e9ec4c 826 #endif
whismanoid 0:cb44e2e9ec4c 827 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 828 DigitalInOut digitalInOut2(p7, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.7/I2STX_CLK/SCK1/MAT2.1
whismanoid 0:cb44e2e9ec4c 829 #endif
whismanoid 0:cb44e2e9ec4c 830 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 831 DigitalInOut digitalInOut3(p8, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.6/I2SRX_SDA/SSEL1/MAT2.0
whismanoid 0:cb44e2e9ec4c 832 #endif
whismanoid 0:cb44e2e9ec4c 833 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 834 DigitalInOut digitalInOut4(p9, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.0/CAN_RX1/TXD3/SDA1
whismanoid 0:cb44e2e9ec4c 835 #endif
whismanoid 0:cb44e2e9ec4c 836 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 837 DigitalInOut digitalInOut5(p10, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.1/CAN_TX1/RXD3/SCL1
whismanoid 0:cb44e2e9ec4c 838 #endif
whismanoid 0:cb44e2e9ec4c 839 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 840 DigitalInOut digitalInOut6(p11, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.18/DCD1/MOSI0/MOSI1
whismanoid 0:cb44e2e9ec4c 841 #endif
whismanoid 0:cb44e2e9ec4c 842 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 843 DigitalInOut digitalInOut7(p12, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.17/CTS1/MISO0/MISO
whismanoid 0:cb44e2e9ec4c 844 #endif
whismanoid 0:cb44e2e9ec4c 845 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 846 DigitalInOut digitalInOut8(p13, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.15/TXD1/SCK0/SCK
whismanoid 0:cb44e2e9ec4c 847 #endif
whismanoid 0:cb44e2e9ec4c 848 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 849 DigitalInOut digitalInOut9(p14, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.16/RXD1/SSEL0/SSEL
whismanoid 0:cb44e2e9ec4c 850 #endif
whismanoid 0:cb44e2e9ec4c 851 //
whismanoid 0:cb44e2e9ec4c 852 // these pins support analog input analogIn0 .. analogIn5
whismanoid 0:cb44e2e9ec4c 853 //DigitalInOut digitalInOut_(p15, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.23/AD0.0/I2SRX_CLK/CAP3.0
whismanoid 0:cb44e2e9ec4c 854 //DigitalInOut digitalInOut_(p16, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.24/AD0.1/I2SRX_WS/CAP3.1
whismanoid 0:cb44e2e9ec4c 855 //DigitalInOut digitalInOut_(p17, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.25/AD0.2/I2SRX_SDA/TXD3
whismanoid 0:cb44e2e9ec4c 856 //DigitalInOut digitalInOut_(p18, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.26/AD0.3/AOUT/RXD3
whismanoid 0:cb44e2e9ec4c 857 //DigitalInOut digitalInOut_(p19, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P1.30/VBUS/AD0.4
whismanoid 0:cb44e2e9ec4c 858 //DigitalInOut digitalInOut_(p20, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P1.31/SCK1/AD0.5
whismanoid 0:cb44e2e9ec4c 859 //
whismanoid 0:cb44e2e9ec4c 860 // these pins support PWM pwmDriver1 .. pwmDriver6
whismanoid 0:cb44e2e9ec4c 861 //DigitalInOut digitalInOut_(p21, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.5/PWM1.6/DTR1/TRACEDATA0
whismanoid 0:cb44e2e9ec4c 862 //DigitalInOut digitalInOut_(p22, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.4/PWM1.5/DSR1/TRACEDATA1
whismanoid 0:cb44e2e9ec4c 863 //DigitalInOut digitalInOut_(p23, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.3/PWM1.4/DCD1/TRACEDATA2
whismanoid 0:cb44e2e9ec4c 864 //DigitalInOut digitalInOut_(p24, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.2/PWM1.3/CTS1/TRACEDATA3
whismanoid 0:cb44e2e9ec4c 865 //DigitalInOut digitalInOut_(p25, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.1/PWM1.2/RXD1
whismanoid 0:cb44e2e9ec4c 866 //DigitalInOut digitalInOut_(p26, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.0/PWM1.1/TXD1/TRACECLK
whismanoid 0:cb44e2e9ec4c 867 //
whismanoid 0:cb44e2e9ec4c 868 // these could be additional digitalInOut pins
whismanoid 0:cb44e2e9ec4c 869 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 870 DigitalInOut digitalInOut10(p27, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.11/RXD2/SCL2/MAT3.1
whismanoid 0:cb44e2e9ec4c 871 #endif
whismanoid 0:cb44e2e9ec4c 872 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 873 DigitalInOut digitalInOut11(p28, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.10/TXD2/SDA2/MAT3.0
whismanoid 0:cb44e2e9ec4c 874 #endif
whismanoid 0:cb44e2e9ec4c 875 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 876 DigitalInOut digitalInOut12(p29, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.5/I2SRX_WS/CAN_TX2/CAP2.1
whismanoid 0:cb44e2e9ec4c 877 #endif
whismanoid 0:cb44e2e9ec4c 878 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 879 DigitalInOut digitalInOut13(p30, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.4/I2SRX_CLK/CAN_RX2/CAP2.0
whismanoid 0:cb44e2e9ec4c 880 #endif
whismanoid 0:cb44e2e9ec4c 881 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 882 DigitalInOut digitalInOut14(___, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 883 #endif
whismanoid 0:cb44e2e9ec4c 884 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 885 DigitalInOut digitalInOut15(___, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 886 #endif
whismanoid 0:cb44e2e9ec4c 887 #else
whismanoid 0:cb44e2e9ec4c 888 // unknown target
whismanoid 0:cb44e2e9ec4c 889 #endif
whismanoid 0:cb44e2e9ec4c 890 // uncrustify-0.66.1 *INDENT-ON*
whismanoid 0:cb44e2e9ec4c 891 #if HAS_digitalInOut0 || HAS_digitalInOut1 \
whismanoid 0:cb44e2e9ec4c 892 || HAS_digitalInOut2 || HAS_digitalInOut3 \
whismanoid 0:cb44e2e9ec4c 893 || HAS_digitalInOut4 || HAS_digitalInOut5 \
whismanoid 0:cb44e2e9ec4c 894 || HAS_digitalInOut6 || HAS_digitalInOut7 \
whismanoid 0:cb44e2e9ec4c 895 || HAS_digitalInOut8 || HAS_digitalInOut9 \
whismanoid 0:cb44e2e9ec4c 896 || HAS_digitalInOut10 || HAS_digitalInOut11 \
whismanoid 0:cb44e2e9ec4c 897 || HAS_digitalInOut12 || HAS_digitalInOut13 \
whismanoid 0:cb44e2e9ec4c 898 || HAS_digitalInOut14 || HAS_digitalInOut15 \
whismanoid 0:cb44e2e9ec4c 899 || HAS_digitalInOut16 || HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 900 #define HAS_digitalInOuts 1
whismanoid 0:cb44e2e9ec4c 901 #else
whismanoid 0:cb44e2e9ec4c 902 #warning "Note: There are no digitalInOut resources defined"
whismanoid 0:cb44e2e9ec4c 903 #endif
whismanoid 0:cb44e2e9ec4c 904
whismanoid 0:cb44e2e9ec4c 905 // uncrustify-0.66.1 *INDENT-OFF*
whismanoid 0:cb44e2e9ec4c 906 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 907 // Declare the AnalogIn driver
whismanoid 0:cb44e2e9ec4c 908 // Optional analogIn support. If there is only one it should be analogIn1.
whismanoid 0:cb44e2e9ec4c 909 // A) analog input
whismanoid 0:cb44e2e9ec4c 910 #if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 911 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 912 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 913 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 914 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 915 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 916 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 917 #define HAS_analogIn6 1
whismanoid 0:cb44e2e9ec4c 918 #define HAS_analogIn7 1
whismanoid 0:cb44e2e9ec4c 919 #define HAS_analogIn8 1
whismanoid 0:cb44e2e9ec4c 920 #define HAS_analogIn9 1
whismanoid 0:cb44e2e9ec4c 921 // #define HAS_analogIn10 0
whismanoid 0:cb44e2e9ec4c 922 // #define HAS_analogIn11 0
whismanoid 0:cb44e2e9ec4c 923 // #define HAS_analogIn12 0
whismanoid 0:cb44e2e9ec4c 924 // #define HAS_analogIn13 0
whismanoid 0:cb44e2e9ec4c 925 // #define HAS_analogIn14 0
whismanoid 0:cb44e2e9ec4c 926 // #define HAS_analogIn15 0
whismanoid 0:cb44e2e9ec4c 927 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 928 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 929 #endif
whismanoid 0:cb44e2e9ec4c 930 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 931 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 932 #endif
whismanoid 0:cb44e2e9ec4c 933 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 934 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 935 #endif
whismanoid 0:cb44e2e9ec4c 936 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 937 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 938 #endif
whismanoid 0:cb44e2e9ec4c 939 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 940 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 941 #endif
whismanoid 0:cb44e2e9ec4c 942 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 943 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 944 #endif
whismanoid 0:cb44e2e9ec4c 945 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 946 AnalogIn analogIn6(AIN_6); // TARGET_MAX32630 AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 947 #endif
whismanoid 0:cb44e2e9ec4c 948 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 949 AnalogIn analogIn7(AIN_7); // TARGET_MAX32630 AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 950 #endif
whismanoid 0:cb44e2e9ec4c 951 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 952 AnalogIn analogIn8(AIN_8); // TARGET_MAX32630 AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 953 #endif
whismanoid 0:cb44e2e9ec4c 954 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 955 AnalogIn analogIn9(AIN_9); // TARGET_MAX32630 AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 956 #endif
whismanoid 0:cb44e2e9ec4c 957 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 958 AnalogIn analogIn10(____); // TARGET_MAX32630 AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 959 #endif
whismanoid 0:cb44e2e9ec4c 960 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 961 AnalogIn analogIn11(____); // TARGET_MAX32630 AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 962 #endif
whismanoid 0:cb44e2e9ec4c 963 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 964 AnalogIn analogIn12(____); // TARGET_MAX32630 AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 965 #endif
whismanoid 0:cb44e2e9ec4c 966 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 967 AnalogIn analogIn13(____);
whismanoid 0:cb44e2e9ec4c 968 #endif
whismanoid 0:cb44e2e9ec4c 969 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 970 AnalogIn analogIn14(____);
whismanoid 0:cb44e2e9ec4c 971 #endif
whismanoid 0:cb44e2e9ec4c 972 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 973 AnalogIn analogIn15(____);
whismanoid 0:cb44e2e9ec4c 974 #endif
whismanoid 0:cb44e2e9ec4c 975 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 976 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 977 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 978 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 979 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 980 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 981 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 982 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 983 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 984 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 985 #endif
whismanoid 0:cb44e2e9ec4c 986 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 987 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 988 #endif
whismanoid 0:cb44e2e9ec4c 989 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 990 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 991 #endif
whismanoid 0:cb44e2e9ec4c 992 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 993 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 994 #endif
whismanoid 0:cb44e2e9ec4c 995 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 996 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 997 #endif
whismanoid 0:cb44e2e9ec4c 998 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 999 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1000 #endif
whismanoid 0:cb44e2e9ec4c 1001 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1002 #elif defined(TARGET_MAX32620FTHR)
whismanoid 0:cb44e2e9ec4c 1003 #warning "TARGET_MAX32620FTHR not previously tested; need to verify analogIn0..."
whismanoid 0:cb44e2e9ec4c 1004 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1005 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 1006 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 1007 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 1008 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 1009 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 1010 #define HAS_analogIn6 1
whismanoid 0:cb44e2e9ec4c 1011 #define HAS_analogIn7 1
whismanoid 0:cb44e2e9ec4c 1012 #define HAS_analogIn8 1
whismanoid 0:cb44e2e9ec4c 1013 #define HAS_analogIn9 1
whismanoid 0:cb44e2e9ec4c 1014 // #define HAS_analogIn10 0
whismanoid 0:cb44e2e9ec4c 1015 // #define HAS_analogIn11 0
whismanoid 0:cb44e2e9ec4c 1016 // #define HAS_analogIn12 0
whismanoid 0:cb44e2e9ec4c 1017 // #define HAS_analogIn13 0
whismanoid 0:cb44e2e9ec4c 1018 // #define HAS_analogIn14 0
whismanoid 0:cb44e2e9ec4c 1019 // #define HAS_analogIn15 0
whismanoid 0:cb44e2e9ec4c 1020 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1021 AnalogIn analogIn0(AIN_0); // TARGET_MAX32620FTHR J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1022 #endif
whismanoid 0:cb44e2e9ec4c 1023 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1024 AnalogIn analogIn1(AIN_1); // TARGET_MAX32620FTHR J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1025 #endif
whismanoid 0:cb44e2e9ec4c 1026 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1027 AnalogIn analogIn2(AIN_2); // TARGET_MAX32620FTHR J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1028 #endif
whismanoid 0:cb44e2e9ec4c 1029 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1030 AnalogIn analogIn3(AIN_3); // TARGET_MAX32620FTHR J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1031 #endif
whismanoid 0:cb44e2e9ec4c 1032 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1033 AnalogIn analogIn4(AIN_4); // TARGET_MAX32620FTHR J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1034 #endif
whismanoid 0:cb44e2e9ec4c 1035 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1036 AnalogIn analogIn5(AIN_5); // TARGET_MAX32620FTHR J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1037 #endif
whismanoid 0:cb44e2e9ec4c 1038 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 1039 AnalogIn analogIn6(AIN_6); // TARGET_MAX32620FTHR AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1040 #endif
whismanoid 0:cb44e2e9ec4c 1041 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 1042 AnalogIn analogIn7(AIN_7); // TARGET_MAX32620FTHR AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1043 #endif
whismanoid 0:cb44e2e9ec4c 1044 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 1045 AnalogIn analogIn8(AIN_8); // TARGET_MAX32620FTHR AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1046 #endif
whismanoid 0:cb44e2e9ec4c 1047 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 1048 AnalogIn analogIn9(AIN_9); // TARGET_MAX32620FTHR AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 1049 #endif
whismanoid 0:cb44e2e9ec4c 1050 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 1051 AnalogIn analogIn10(____); // TARGET_MAX32620FTHR AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 1052 #endif
whismanoid 0:cb44e2e9ec4c 1053 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 1054 AnalogIn analogIn11(____); // TARGET_MAX32620FTHR AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1055 #endif
whismanoid 0:cb44e2e9ec4c 1056 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 1057 AnalogIn analogIn12(____); // TARGET_MAX32620FTHR AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1058 #endif
whismanoid 0:cb44e2e9ec4c 1059 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 1060 AnalogIn analogIn13(____);
whismanoid 0:cb44e2e9ec4c 1061 #endif
whismanoid 0:cb44e2e9ec4c 1062 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 1063 AnalogIn analogIn14(____);
whismanoid 0:cb44e2e9ec4c 1064 #endif
whismanoid 0:cb44e2e9ec4c 1065 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 1066 AnalogIn analogIn15(____);
whismanoid 0:cb44e2e9ec4c 1067 #endif
whismanoid 0:cb44e2e9ec4c 1068 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1069 #elif defined(TARGET_MAX32625PICO)
whismanoid 0:cb44e2e9ec4c 1070 #warning "TARGET_MAX32625PICO not previously tested; need to verify analogIn0..."
whismanoid 0:cb44e2e9ec4c 1071 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1072 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 1073 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 1074 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 1075 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 1076 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 1077 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1078 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1079 #endif
whismanoid 0:cb44e2e9ec4c 1080 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1081 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1082 #endif
whismanoid 0:cb44e2e9ec4c 1083 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1084 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1085 #endif
whismanoid 0:cb44e2e9ec4c 1086 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1087 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1088 #endif
whismanoid 0:cb44e2e9ec4c 1089 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1090 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1091 #endif
whismanoid 0:cb44e2e9ec4c 1092 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1093 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1094 #endif
whismanoid 0:cb44e2e9ec4c 1095 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1096 #elif defined(TARGET_MAX32600)
whismanoid 0:cb44e2e9ec4c 1097 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1098 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 1099 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 1100 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 1101 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 1102 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 1103 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1104 AnalogIn analogIn0(A0);
whismanoid 0:cb44e2e9ec4c 1105 #endif
whismanoid 0:cb44e2e9ec4c 1106 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1107 AnalogIn analogIn1(A1);
whismanoid 0:cb44e2e9ec4c 1108 #endif
whismanoid 0:cb44e2e9ec4c 1109 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1110 AnalogIn analogIn2(A2);
whismanoid 0:cb44e2e9ec4c 1111 #endif
whismanoid 0:cb44e2e9ec4c 1112 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1113 AnalogIn analogIn3(A3);
whismanoid 0:cb44e2e9ec4c 1114 #endif
whismanoid 0:cb44e2e9ec4c 1115 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1116 AnalogIn analogIn4(A4);
whismanoid 0:cb44e2e9ec4c 1117 #endif
whismanoid 0:cb44e2e9ec4c 1118 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1119 AnalogIn analogIn5(A5);
whismanoid 0:cb44e2e9ec4c 1120 #endif
whismanoid 0:cb44e2e9ec4c 1121 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1122 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:cb44e2e9ec4c 1123 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1124 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 1125 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 1126 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 1127 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 1128 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 1129 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1130 AnalogIn analogIn0(A0);
whismanoid 0:cb44e2e9ec4c 1131 #endif
whismanoid 0:cb44e2e9ec4c 1132 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1133 AnalogIn analogIn1(A1);
whismanoid 0:cb44e2e9ec4c 1134 #endif
whismanoid 0:cb44e2e9ec4c 1135 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1136 AnalogIn analogIn2(A2);
whismanoid 0:cb44e2e9ec4c 1137 #endif
whismanoid 0:cb44e2e9ec4c 1138 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1139 AnalogIn analogIn3(A3);
whismanoid 0:cb44e2e9ec4c 1140 #endif
whismanoid 0:cb44e2e9ec4c 1141 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1142 AnalogIn analogIn4(A4);
whismanoid 0:cb44e2e9ec4c 1143 #endif
whismanoid 0:cb44e2e9ec4c 1144 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1145 AnalogIn analogIn5(A5);
whismanoid 0:cb44e2e9ec4c 1146 #endif
whismanoid 0:cb44e2e9ec4c 1147 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1148 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 1149 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1150 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 1151 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 1152 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 1153 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 1154 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 1155 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1156 AnalogIn analogIn0(A0);
whismanoid 0:cb44e2e9ec4c 1157 #endif
whismanoid 0:cb44e2e9ec4c 1158 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1159 AnalogIn analogIn1(A1);
whismanoid 0:cb44e2e9ec4c 1160 #endif
whismanoid 0:cb44e2e9ec4c 1161 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1162 AnalogIn analogIn2(A2);
whismanoid 0:cb44e2e9ec4c 1163 #endif
whismanoid 0:cb44e2e9ec4c 1164 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1165 AnalogIn analogIn3(A3);
whismanoid 0:cb44e2e9ec4c 1166 #endif
whismanoid 0:cb44e2e9ec4c 1167 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1168 AnalogIn analogIn4(A4);
whismanoid 0:cb44e2e9ec4c 1169 #endif
whismanoid 0:cb44e2e9ec4c 1170 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1171 AnalogIn analogIn5(A5);
whismanoid 0:cb44e2e9ec4c 1172 #endif
whismanoid 0:cb44e2e9ec4c 1173 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1174 // TODO1: TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:cb44e2e9ec4c 1175 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 1176 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1177 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 1178 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 1179 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 1180 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 1181 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 1182 // #define HAS_analogIn6 1
whismanoid 0:cb44e2e9ec4c 1183 // #define HAS_analogIn7 1
whismanoid 0:cb44e2e9ec4c 1184 // #define HAS_analogIn8 1
whismanoid 0:cb44e2e9ec4c 1185 // #define HAS_analogIn9 1
whismanoid 0:cb44e2e9ec4c 1186 // #define HAS_analogIn10 1
whismanoid 0:cb44e2e9ec4c 1187 // #define HAS_analogIn11 1
whismanoid 0:cb44e2e9ec4c 1188 // #define HAS_analogIn12 1
whismanoid 0:cb44e2e9ec4c 1189 // #define HAS_analogIn13 1
whismanoid 0:cb44e2e9ec4c 1190 // #define HAS_analogIn14 1
whismanoid 0:cb44e2e9ec4c 1191 // #define HAS_analogIn15 1
whismanoid 0:cb44e2e9ec4c 1192 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1193 AnalogIn analogIn0(p15); // TARGET_LPC1768 P0.23/AD0.0/I2SRX_CLK/CAP3.0
whismanoid 0:cb44e2e9ec4c 1194 #endif
whismanoid 0:cb44e2e9ec4c 1195 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1196 AnalogIn analogIn1(p16); // TARGET_LPC1768 P0.24/AD0.1/I2SRX_WS/CAP3.1
whismanoid 0:cb44e2e9ec4c 1197 #endif
whismanoid 0:cb44e2e9ec4c 1198 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1199 AnalogIn analogIn2(p17); // TARGET_LPC1768 P0.25/AD0.2/I2SRX_SDA/TXD3
whismanoid 0:cb44e2e9ec4c 1200 #endif
whismanoid 0:cb44e2e9ec4c 1201 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1202 AnalogIn analogIn3(p18); // TARGET_LPC1768 P0.26/AD0.3/AOUT/RXD3
whismanoid 0:cb44e2e9ec4c 1203 #endif
whismanoid 0:cb44e2e9ec4c 1204 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1205 AnalogIn analogIn4(p19); // TARGET_LPC1768 P1.30/VBUS/AD0.4
whismanoid 0:cb44e2e9ec4c 1206 #endif
whismanoid 0:cb44e2e9ec4c 1207 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1208 AnalogIn analogIn5(p20); // TARGET_LPC1768 P1.31/SCK1/AD0.5
whismanoid 0:cb44e2e9ec4c 1209 #endif
whismanoid 0:cb44e2e9ec4c 1210 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 1211 AnalogIn analogIn6(____);
whismanoid 0:cb44e2e9ec4c 1212 #endif
whismanoid 0:cb44e2e9ec4c 1213 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 1214 AnalogIn analogIn7(____);
whismanoid 0:cb44e2e9ec4c 1215 #endif
whismanoid 0:cb44e2e9ec4c 1216 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 1217 AnalogIn analogIn8(____);
whismanoid 0:cb44e2e9ec4c 1218 #endif
whismanoid 0:cb44e2e9ec4c 1219 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 1220 AnalogIn analogIn9(____);
whismanoid 0:cb44e2e9ec4c 1221 #endif
whismanoid 0:cb44e2e9ec4c 1222 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 1223 AnalogIn analogIn10(____);
whismanoid 0:cb44e2e9ec4c 1224 #endif
whismanoid 0:cb44e2e9ec4c 1225 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 1226 AnalogIn analogIn11(____);
whismanoid 0:cb44e2e9ec4c 1227 #endif
whismanoid 0:cb44e2e9ec4c 1228 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 1229 AnalogIn analogIn12(____);
whismanoid 0:cb44e2e9ec4c 1230 #endif
whismanoid 0:cb44e2e9ec4c 1231 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 1232 AnalogIn analogIn13(____);
whismanoid 0:cb44e2e9ec4c 1233 #endif
whismanoid 0:cb44e2e9ec4c 1234 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 1235 AnalogIn analogIn14(____);
whismanoid 0:cb44e2e9ec4c 1236 #endif
whismanoid 0:cb44e2e9ec4c 1237 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 1238 AnalogIn analogIn15(____);
whismanoid 0:cb44e2e9ec4c 1239 #endif
whismanoid 0:cb44e2e9ec4c 1240 #else
whismanoid 0:cb44e2e9ec4c 1241 // unknown target
whismanoid 0:cb44e2e9ec4c 1242 #endif
whismanoid 0:cb44e2e9ec4c 1243 // uncrustify-0.66.1 *INDENT-ON*
whismanoid 0:cb44e2e9ec4c 1244 #if HAS_analogIn0 || HAS_analogIn1 \
whismanoid 0:cb44e2e9ec4c 1245 || HAS_analogIn2 || HAS_analogIn3 \
whismanoid 0:cb44e2e9ec4c 1246 || HAS_analogIn4 || HAS_analogIn5 \
whismanoid 0:cb44e2e9ec4c 1247 || HAS_analogIn6 || HAS_analogIn7 \
whismanoid 0:cb44e2e9ec4c 1248 || HAS_analogIn8 || HAS_analogIn9 \
whismanoid 0:cb44e2e9ec4c 1249 || HAS_analogIn10 || HAS_analogIn11 \
whismanoid 0:cb44e2e9ec4c 1250 || HAS_analogIn12 || HAS_analogIn13 \
whismanoid 0:cb44e2e9ec4c 1251 || HAS_analogIn14 || HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 1252 #define HAS_analogIns 1
whismanoid 0:cb44e2e9ec4c 1253 #else
whismanoid 0:cb44e2e9ec4c 1254 #warning "Note: There are no analogIn resources defined"
whismanoid 0:cb44e2e9ec4c 1255 #endif
whismanoid 0:cb44e2e9ec4c 1256
whismanoid 0:cb44e2e9ec4c 1257 // DigitalInOut pin resource: print the pin index names to serial
whismanoid 0:cb44e2e9ec4c 1258 #if HAS_digitalInOuts
whismanoid 0:cb44e2e9ec4c 1259 void list_digitalInOutPins(Stream& serialStream)
whismanoid 0:cb44e2e9ec4c 1260 {
whismanoid 0:cb44e2e9ec4c 1261 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 1262 serialStream.printf(" 0");
whismanoid 0:cb44e2e9ec4c 1263 #endif
whismanoid 0:cb44e2e9ec4c 1264 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 1265 serialStream.printf(" 1");
whismanoid 0:cb44e2e9ec4c 1266 #endif
whismanoid 0:cb44e2e9ec4c 1267 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 1268 serialStream.printf(" 2");
whismanoid 0:cb44e2e9ec4c 1269 #endif
whismanoid 0:cb44e2e9ec4c 1270 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 1271 serialStream.printf(" 3");
whismanoid 0:cb44e2e9ec4c 1272 #endif
whismanoid 0:cb44e2e9ec4c 1273 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 1274 serialStream.printf(" 4");
whismanoid 0:cb44e2e9ec4c 1275 #endif
whismanoid 0:cb44e2e9ec4c 1276 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 1277 serialStream.printf(" 5");
whismanoid 0:cb44e2e9ec4c 1278 #endif
whismanoid 0:cb44e2e9ec4c 1279 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 1280 serialStream.printf(" 6");
whismanoid 0:cb44e2e9ec4c 1281 #endif
whismanoid 0:cb44e2e9ec4c 1282 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 1283 serialStream.printf(" 7");
whismanoid 0:cb44e2e9ec4c 1284 #endif
whismanoid 0:cb44e2e9ec4c 1285 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 1286 serialStream.printf(" 8");
whismanoid 0:cb44e2e9ec4c 1287 #endif
whismanoid 0:cb44e2e9ec4c 1288 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 1289 serialStream.printf(" 9");
whismanoid 0:cb44e2e9ec4c 1290 #endif
whismanoid 0:cb44e2e9ec4c 1291 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 1292 serialStream.printf(" 10");
whismanoid 0:cb44e2e9ec4c 1293 #endif
whismanoid 0:cb44e2e9ec4c 1294 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 1295 serialStream.printf(" 11");
whismanoid 0:cb44e2e9ec4c 1296 #endif
whismanoid 0:cb44e2e9ec4c 1297 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 1298 serialStream.printf(" 12");
whismanoid 0:cb44e2e9ec4c 1299 #endif
whismanoid 0:cb44e2e9ec4c 1300 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 1301 serialStream.printf(" 13");
whismanoid 0:cb44e2e9ec4c 1302 #endif
whismanoid 0:cb44e2e9ec4c 1303 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 1304 serialStream.printf(" 14");
whismanoid 0:cb44e2e9ec4c 1305 #endif
whismanoid 0:cb44e2e9ec4c 1306 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 1307 serialStream.printf(" 15");
whismanoid 0:cb44e2e9ec4c 1308 #endif
whismanoid 0:cb44e2e9ec4c 1309 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 1310 serialStream.printf(" 16");
whismanoid 0:cb44e2e9ec4c 1311 #endif
whismanoid 0:cb44e2e9ec4c 1312 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 1313 serialStream.printf(" 17");
whismanoid 0:cb44e2e9ec4c 1314 #endif
whismanoid 0:cb44e2e9ec4c 1315 }
whismanoid 0:cb44e2e9ec4c 1316 #endif
whismanoid 0:cb44e2e9ec4c 1317
whismanoid 0:cb44e2e9ec4c 1318
whismanoid 0:cb44e2e9ec4c 1319 // DigitalInOut pin resource: search index
whismanoid 0:cb44e2e9ec4c 1320 #if HAS_digitalInOuts
whismanoid 0:cb44e2e9ec4c 1321 DigitalInOut& find_digitalInOutPin(int cPinIndex)
whismanoid 0:cb44e2e9ec4c 1322 {
whismanoid 0:cb44e2e9ec4c 1323 switch (cPinIndex)
whismanoid 0:cb44e2e9ec4c 1324 {
whismanoid 0:cb44e2e9ec4c 1325 default: // default to the first defined digitalInOut pin
whismanoid 0:cb44e2e9ec4c 1326 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 1327 case '0': case 0x00: return digitalInOut0;
whismanoid 0:cb44e2e9ec4c 1328 #endif
whismanoid 0:cb44e2e9ec4c 1329 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 1330 case '1': case 0x01: return digitalInOut1;
whismanoid 0:cb44e2e9ec4c 1331 #endif
whismanoid 0:cb44e2e9ec4c 1332 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 1333 case '2': case 0x02: return digitalInOut2;
whismanoid 0:cb44e2e9ec4c 1334 #endif
whismanoid 0:cb44e2e9ec4c 1335 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 1336 case '3': case 0x03: return digitalInOut3;
whismanoid 0:cb44e2e9ec4c 1337 #endif
whismanoid 0:cb44e2e9ec4c 1338 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 1339 case '4': case 0x04: return digitalInOut4;
whismanoid 0:cb44e2e9ec4c 1340 #endif
whismanoid 0:cb44e2e9ec4c 1341 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 1342 case '5': case 0x05: return digitalInOut5;
whismanoid 0:cb44e2e9ec4c 1343 #endif
whismanoid 0:cb44e2e9ec4c 1344 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 1345 case '6': case 0x06: return digitalInOut6;
whismanoid 0:cb44e2e9ec4c 1346 #endif
whismanoid 0:cb44e2e9ec4c 1347 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 1348 case '7': case 0x07: return digitalInOut7;
whismanoid 0:cb44e2e9ec4c 1349 #endif
whismanoid 0:cb44e2e9ec4c 1350 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 1351 case '8': case 0x08: return digitalInOut8;
whismanoid 0:cb44e2e9ec4c 1352 #endif
whismanoid 0:cb44e2e9ec4c 1353 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 1354 case '9': case 0x09: return digitalInOut9;
whismanoid 0:cb44e2e9ec4c 1355 #endif
whismanoid 0:cb44e2e9ec4c 1356 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 1357 case 'a': case 0x0a: return digitalInOut10;
whismanoid 0:cb44e2e9ec4c 1358 #endif
whismanoid 0:cb44e2e9ec4c 1359 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 1360 case 'b': case 0x0b: return digitalInOut11;
whismanoid 0:cb44e2e9ec4c 1361 #endif
whismanoid 0:cb44e2e9ec4c 1362 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 1363 case 'c': case 0x0c: return digitalInOut12;
whismanoid 0:cb44e2e9ec4c 1364 #endif
whismanoid 0:cb44e2e9ec4c 1365 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 1366 case 'd': case 0x0d: return digitalInOut13;
whismanoid 0:cb44e2e9ec4c 1367 #endif
whismanoid 0:cb44e2e9ec4c 1368 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 1369 case 'e': case 0x0e: return digitalInOut14;
whismanoid 0:cb44e2e9ec4c 1370 #endif
whismanoid 0:cb44e2e9ec4c 1371 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 1372 case 'f': case 0x0f: return digitalInOut15;
whismanoid 0:cb44e2e9ec4c 1373 #endif
whismanoid 0:cb44e2e9ec4c 1374 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 1375 case 'g': case 0x10: return digitalInOut16;
whismanoid 0:cb44e2e9ec4c 1376 #endif
whismanoid 0:cb44e2e9ec4c 1377 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 1378 case 'h': case 0x11: return digitalInOut17;
whismanoid 0:cb44e2e9ec4c 1379 #endif
whismanoid 0:cb44e2e9ec4c 1380 }
whismanoid 0:cb44e2e9ec4c 1381 }
whismanoid 0:cb44e2e9ec4c 1382 #endif
whismanoid 0:cb44e2e9ec4c 1383
whismanoid 0:cb44e2e9ec4c 1384
whismanoid 0:cb44e2e9ec4c 1385 // AnalogIn pin resource: search index
whismanoid 0:cb44e2e9ec4c 1386 #if HAS_analogIns
whismanoid 0:cb44e2e9ec4c 1387 AnalogIn& find_analogInPin(int cPinIndex)
whismanoid 0:cb44e2e9ec4c 1388 {
whismanoid 0:cb44e2e9ec4c 1389 switch (cPinIndex)
whismanoid 0:cb44e2e9ec4c 1390 {
whismanoid 0:cb44e2e9ec4c 1391 default: // default to the first defined analogIn pin
whismanoid 0:cb44e2e9ec4c 1392 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 1393 case '0': case 0x00: return analogIn0;
whismanoid 0:cb44e2e9ec4c 1394 #endif
whismanoid 0:cb44e2e9ec4c 1395 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 1396 case '1': case 0x01: return analogIn1;
whismanoid 0:cb44e2e9ec4c 1397 #endif
whismanoid 0:cb44e2e9ec4c 1398 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 1399 case '2': case 0x02: return analogIn2;
whismanoid 0:cb44e2e9ec4c 1400 #endif
whismanoid 0:cb44e2e9ec4c 1401 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 1402 case '3': case 0x03: return analogIn3;
whismanoid 0:cb44e2e9ec4c 1403 #endif
whismanoid 0:cb44e2e9ec4c 1404 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 1405 case '4': case 0x04: return analogIn4;
whismanoid 0:cb44e2e9ec4c 1406 #endif
whismanoid 0:cb44e2e9ec4c 1407 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 1408 case '5': case 0x05: return analogIn5;
whismanoid 0:cb44e2e9ec4c 1409 #endif
whismanoid 0:cb44e2e9ec4c 1410 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 1411 case '6': case 0x06: return analogIn6;
whismanoid 0:cb44e2e9ec4c 1412 #endif
whismanoid 0:cb44e2e9ec4c 1413 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 1414 case '7': case 0x07: return analogIn7;
whismanoid 0:cb44e2e9ec4c 1415 #endif
whismanoid 0:cb44e2e9ec4c 1416 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 1417 case '8': case 0x08: return analogIn8;
whismanoid 0:cb44e2e9ec4c 1418 #endif
whismanoid 0:cb44e2e9ec4c 1419 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 1420 case '9': case 0x09: return analogIn9;
whismanoid 0:cb44e2e9ec4c 1421 #endif
whismanoid 0:cb44e2e9ec4c 1422 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 1423 case 'a': case 0x0a: return analogIn10;
whismanoid 0:cb44e2e9ec4c 1424 #endif
whismanoid 0:cb44e2e9ec4c 1425 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 1426 case 'b': case 0x0b: return analogIn11;
whismanoid 0:cb44e2e9ec4c 1427 #endif
whismanoid 0:cb44e2e9ec4c 1428 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 1429 case 'c': case 0x0c: return analogIn12;
whismanoid 0:cb44e2e9ec4c 1430 #endif
whismanoid 0:cb44e2e9ec4c 1431 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 1432 case 'd': case 0x0d: return analogIn13;
whismanoid 0:cb44e2e9ec4c 1433 #endif
whismanoid 0:cb44e2e9ec4c 1434 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 1435 case 'e': case 0x0e: return analogIn14;
whismanoid 0:cb44e2e9ec4c 1436 #endif
whismanoid 0:cb44e2e9ec4c 1437 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 1438 case 'f': case 0x0f: return analogIn15;
whismanoid 0:cb44e2e9ec4c 1439 #endif
whismanoid 0:cb44e2e9ec4c 1440 }
whismanoid 0:cb44e2e9ec4c 1441 }
whismanoid 0:cb44e2e9ec4c 1442 #endif
whismanoid 0:cb44e2e9ec4c 1443
whismanoid 0:cb44e2e9ec4c 1444 #if HAS_analogIns
whismanoid 0:cb44e2e9ec4c 1445 const float analogInPin_fullScaleVoltage[] = {
whismanoid 0:cb44e2e9ec4c 1446 # if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 1447 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 1448 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 1449 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 1450 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 1451 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1452 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1453 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn6 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1454 ADC_FULL_SCALE_VOLTAGE, // analogIn7 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1455 ADC_FULL_SCALE_VOLTAGE, // analogIn8 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1456 ADC_FULL_SCALE_VOLTAGE * 2.0f, // analogIn9 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 1457 ADC_FULL_SCALE_VOLTAGE, // analogIn10 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 1458 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn11 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1459 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn12 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1460 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 1461 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 1462 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 1463 # elif defined(TARGET_MAX32620FTHR)
whismanoid 0:cb44e2e9ec4c 1464 #warning "TARGET_MAX32620FTHR not previously tested; need to verify analogIn0..."
whismanoid 0:cb44e2e9ec4c 1465 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 1466 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 1467 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 1468 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 1469 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1470 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1471 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn6 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1472 ADC_FULL_SCALE_VOLTAGE, // analogIn7 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1473 ADC_FULL_SCALE_VOLTAGE, // analogIn8 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1474 ADC_FULL_SCALE_VOLTAGE * 2.0f, // analogIn9 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 1475 ADC_FULL_SCALE_VOLTAGE, // analogIn10 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 1476 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn11 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1477 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn12 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1478 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 1479 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 1480 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 1481 #elif defined(TARGET_MAX32625MBED) || defined(TARGET_MAX32625PICO)
whismanoid 0:cb44e2e9ec4c 1482 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn0 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1483 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn1 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1484 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn2 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1485 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn3 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1486 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1487 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1488 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn6 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1489 ADC_FULL_SCALE_VOLTAGE, // analogIn7 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1490 ADC_FULL_SCALE_VOLTAGE, // analogIn8 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1491 ADC_FULL_SCALE_VOLTAGE * 2.0f, // analogIn9 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 1492 ADC_FULL_SCALE_VOLTAGE, // analogIn10 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 1493 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn11 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1494 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn12 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1495 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 1496 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 1497 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 1498 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:cb44e2e9ec4c 1499 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 1500 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 1501 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 1502 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 1503 ADC_FULL_SCALE_VOLTAGE, // analogIn4
whismanoid 0:cb44e2e9ec4c 1504 ADC_FULL_SCALE_VOLTAGE, // analogIn5
whismanoid 0:cb44e2e9ec4c 1505 ADC_FULL_SCALE_VOLTAGE, // analogIn6
whismanoid 0:cb44e2e9ec4c 1506 ADC_FULL_SCALE_VOLTAGE, // analogIn7
whismanoid 0:cb44e2e9ec4c 1507 ADC_FULL_SCALE_VOLTAGE, // analogIn8
whismanoid 0:cb44e2e9ec4c 1508 ADC_FULL_SCALE_VOLTAGE, // analogIn9
whismanoid 0:cb44e2e9ec4c 1509 ADC_FULL_SCALE_VOLTAGE, // analogIn10
whismanoid 0:cb44e2e9ec4c 1510 ADC_FULL_SCALE_VOLTAGE, // analogIn11
whismanoid 0:cb44e2e9ec4c 1511 ADC_FULL_SCALE_VOLTAGE, // analogIn12
whismanoid 0:cb44e2e9ec4c 1512 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 1513 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 1514 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 1515 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 1516 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 1517 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 1518 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 1519 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 1520 ADC_FULL_SCALE_VOLTAGE, // analogIn4
whismanoid 0:cb44e2e9ec4c 1521 ADC_FULL_SCALE_VOLTAGE, // analogIn5
whismanoid 0:cb44e2e9ec4c 1522 ADC_FULL_SCALE_VOLTAGE, // analogIn6
whismanoid 0:cb44e2e9ec4c 1523 ADC_FULL_SCALE_VOLTAGE, // analogIn7
whismanoid 0:cb44e2e9ec4c 1524 ADC_FULL_SCALE_VOLTAGE, // analogIn8
whismanoid 0:cb44e2e9ec4c 1525 ADC_FULL_SCALE_VOLTAGE, // analogIn9
whismanoid 0:cb44e2e9ec4c 1526 ADC_FULL_SCALE_VOLTAGE, // analogIn10
whismanoid 0:cb44e2e9ec4c 1527 ADC_FULL_SCALE_VOLTAGE, // analogIn11
whismanoid 0:cb44e2e9ec4c 1528 ADC_FULL_SCALE_VOLTAGE, // analogIn12
whismanoid 0:cb44e2e9ec4c 1529 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 1530 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 1531 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 1532 //#elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 1533 #else
whismanoid 0:cb44e2e9ec4c 1534 // unknown target
whismanoid 0:cb44e2e9ec4c 1535 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 1536 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 1537 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 1538 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 1539 ADC_FULL_SCALE_VOLTAGE, // analogIn4
whismanoid 0:cb44e2e9ec4c 1540 ADC_FULL_SCALE_VOLTAGE, // analogIn5
whismanoid 0:cb44e2e9ec4c 1541 ADC_FULL_SCALE_VOLTAGE, // analogIn6
whismanoid 0:cb44e2e9ec4c 1542 ADC_FULL_SCALE_VOLTAGE, // analogIn7
whismanoid 0:cb44e2e9ec4c 1543 ADC_FULL_SCALE_VOLTAGE, // analogIn8
whismanoid 0:cb44e2e9ec4c 1544 ADC_FULL_SCALE_VOLTAGE, // analogIn9
whismanoid 0:cb44e2e9ec4c 1545 ADC_FULL_SCALE_VOLTAGE, // analogIn10
whismanoid 0:cb44e2e9ec4c 1546 ADC_FULL_SCALE_VOLTAGE, // analogIn11
whismanoid 0:cb44e2e9ec4c 1547 ADC_FULL_SCALE_VOLTAGE, // analogIn12
whismanoid 0:cb44e2e9ec4c 1548 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 1549 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 1550 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 1551 # endif
whismanoid 0:cb44e2e9ec4c 1552 };
whismanoid 0:cb44e2e9ec4c 1553 #endif
whismanoid 0:cb44e2e9ec4c 1554
whismanoid 0:cb44e2e9ec4c 1555
whismanoid 0:cb44e2e9ec4c 1556
whismanoid 0:cb44e2e9ec4c 1557
whismanoid 0:cb44e2e9ec4c 1558 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 1559 // TODO support CmdLine command menus (like on Serial_Tester)
whismanoid 4:d9b05924ad4c 1560 #ifndef USE_CMDLINE_MENUS
whismanoid 4:d9b05924ad4c 1561 #define USE_CMDLINE_MENUS 1
whismanoid 4:d9b05924ad4c 1562 //~ #undef USE_CMDLINE_MENUS
whismanoid 4:d9b05924ad4c 1563 #endif
whismanoid 4:d9b05924ad4c 1564 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 1565 #include "CmdLine.h"
whismanoid 4:d9b05924ad4c 1566 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 1567 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 1568 extern CmdLine cmdLine; // declared later
whismanoid 4:d9b05924ad4c 1569 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 1570
whismanoid 4:d9b05924ad4c 1571 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 1572 // Datalog trigger types
whismanoid 4:d9b05924ad4c 1573 #ifndef USE_DATALOGGER_TRIGGER
whismanoid 4:d9b05924ad4c 1574 #define USE_DATALOGGER_TRIGGER 1
whismanoid 4:d9b05924ad4c 1575 //~ #undef USE_DATALOGGER_TRIGGER
whismanoid 4:d9b05924ad4c 1576 #endif
whismanoid 4:d9b05924ad4c 1577 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 4:d9b05924ad4c 1578 typedef enum Datalogger_Trigger_enum_t {
whismanoid 4:d9b05924ad4c 1579 trigger_Halt = 0, //!< halt
whismanoid 4:d9b05924ad4c 1580 trigger_FreeRun = 1, //!< free run as fast as possible
whismanoid 4:d9b05924ad4c 1581 trigger_Timer = 2, //!< timer (configure interval)
whismanoid 4:d9b05924ad4c 1582 trigger_PlatformDigitalInput, //!< platform digital input (configure digital input pin reference)
whismanoid 4:d9b05924ad4c 1583 trigger_SPIDeviceRegRead, //!< SPI device register read (configure regaddr, mask value, match value)
whismanoid 4:d9b05924ad4c 1584 } Datalogger_Trigger_enum_t;
whismanoid 4:d9b05924ad4c 1585 Datalogger_Trigger_enum_t Datalogger_Trigger = trigger_FreeRun;
whismanoid 4:d9b05924ad4c 1586 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 4:d9b05924ad4c 1587
whismanoid 4:d9b05924ad4c 1588 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 1589 // print column header banner for csv data columns
whismanoid 4:d9b05924ad4c 1590 void Datalogger_PrintHeader();
whismanoid 4:d9b05924ad4c 1591
whismanoid 4:d9b05924ad4c 1592 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1593 // Option to validate SPI link by reading PART_ID register
whismanoid 0:cb44e2e9ec4c 1594 #ifndef VERIFY_PART_ID_IN_LOOP
whismanoid 3:9055e17e181a 1595 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 1596 #define VERIFY_PART_ID_IN_LOOP 1
whismanoid 3:9055e17e181a 1597 #else
whismanoid 0:cb44e2e9ec4c 1598 #define VERIFY_PART_ID_IN_LOOP 0
whismanoid 3:9055e17e181a 1599 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 1600 #endif
whismanoid 0:cb44e2e9ec4c 1601
whismanoid 3:9055e17e181a 1602 //--------------------------------------------------
whismanoid 3:9055e17e181a 1603 #define NUM_DUT_ANALOG_IN_CHANNELS 10
whismanoid 3:9055e17e181a 1604
whismanoid 3:9055e17e181a 1605 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 1606 // MAX11410 individual channels 1=LSB, 2=Volt, 0=Disabled
whismanoid 3:9055e17e181a 1607 typedef enum SPI_AIN_Enable_t {
whismanoid 3:9055e17e181a 1608 Disable = 0,
whismanoid 3:9055e17e181a 1609 Enable_LSB = 1,
whismanoid 3:9055e17e181a 1610 Enable_Volt = 2,
whismanoid 3:9055e17e181a 1611 } SPI_AIN_Enable_t;
whismanoid 3:9055e17e181a 1612 uint8_t SPI_AIN_Enable_ch[NUM_DUT_ANALOG_IN_CHANNELS] = {
whismanoid 3:9055e17e181a 1613 Enable_LSB, // AIN0 1=LSB
whismanoid 3:9055e17e181a 1614 Enable_LSB, // AIN1 1=LSB
whismanoid 3:9055e17e181a 1615 Enable_LSB, // AIN2 1=LSB
whismanoid 3:9055e17e181a 1616 Enable_LSB, // AIN3 1=LSB
whismanoid 3:9055e17e181a 1617 Enable_LSB, // AIN4 1=LSB
whismanoid 3:9055e17e181a 1618 Enable_LSB, // AIN5 1=LSB
whismanoid 3:9055e17e181a 1619 Enable_LSB, // AIN6 1=LSB
whismanoid 3:9055e17e181a 1620 Enable_LSB, // AIN7 1=LSB
whismanoid 3:9055e17e181a 1621 Enable_LSB, // AIN8 1=LSB
whismanoid 3:9055e17e181a 1622 Enable_LSB, // AIN9 1=LSB
whismanoid 3:9055e17e181a 1623 };
whismanoid 3:9055e17e181a 1624 //
whismanoid 3:9055e17e181a 1625 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 1626 // ---------- Measure_Voltage_custom_props in Measure_Voltage @pre and in class properties ----------
whismanoid 3:9055e17e181a 1627 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 4:d9b05924ad4c 1628 // MAX11410 specific per-channel config register v_filter
whismanoid 3:9055e17e181a 1629 uint8_t SPI_AIN_Cfg_v_filter_ch[NUM_DUT_ANALOG_IN_CHANNELS] = {
whismanoid 3:9055e17e181a 1630 0x34, // AIN0 @ v_filter=0x34
whismanoid 3:9055e17e181a 1631 0x34, // AIN1 @ v_filter=0x34
whismanoid 3:9055e17e181a 1632 0x34, // AIN2 @ v_filter=0x34
whismanoid 3:9055e17e181a 1633 0x34, // AIN3 @ v_filter=0x34
whismanoid 3:9055e17e181a 1634 0x34, // AIN4 @ v_filter=0x34
whismanoid 3:9055e17e181a 1635 0x34, // AIN5 @ v_filter=0x34
whismanoid 3:9055e17e181a 1636 0x34, // AIN6 @ v_filter=0x34
whismanoid 3:9055e17e181a 1637 0x34, // AIN7 @ v_filter=0x34
whismanoid 3:9055e17e181a 1638 0x34, // AIN8 @ v_filter=0x34
whismanoid 3:9055e17e181a 1639 0x34, // AIN9 @ v_filter=0x34
whismanoid 3:9055e17e181a 1640 };
whismanoid 3:9055e17e181a 1641 //
whismanoid 4:d9b05924ad4c 1642 // MAX11410 specific per-channel config register v_ctrl
whismanoid 3:9055e17e181a 1643 uint8_t SPI_AIN_Cfg_v_ctrl_ch[NUM_DUT_ANALOG_IN_CHANNELS] = {
whismanoid 3:9055e17e181a 1644 0x42, // AIN0 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 1645 0x42, // AIN1 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 1646 0x42, // AIN2 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 1647 0x42, // AIN3 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 1648 0x42, // AIN4 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 1649 0x42, // AIN5 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 1650 0x42, // AIN6 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 1651 0x42, // AIN7 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 1652 0x42, // AIN8 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 1653 0x42, // AIN9 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 1654 };
whismanoid 3:9055e17e181a 1655 //
whismanoid 4:d9b05924ad4c 1656 // MAX11410 specific per-channel config register v_pga
whismanoid 3:9055e17e181a 1657 uint8_t SPI_AIN_Cfg_v_pga_ch[NUM_DUT_ANALOG_IN_CHANNELS] = {
whismanoid 3:9055e17e181a 1658 0x00, // AIN0 @ v_pga=0x00
whismanoid 3:9055e17e181a 1659 0x00, // AIN1 @ v_pga=0x00
whismanoid 3:9055e17e181a 1660 0x00, // AIN2 @ v_pga=0x00
whismanoid 3:9055e17e181a 1661 0x00, // AIN3 @ v_pga=0x00
whismanoid 3:9055e17e181a 1662 0x00, // AIN4 @ v_pga=0x00
whismanoid 3:9055e17e181a 1663 0x00, // AIN5 @ v_pga=0x00
whismanoid 3:9055e17e181a 1664 0x00, // AIN6 @ v_pga=0x00
whismanoid 3:9055e17e181a 1665 0x00, // AIN7 @ v_pga=0x00
whismanoid 3:9055e17e181a 1666 0x00, // AIN8 @ v_pga=0x00
whismanoid 3:9055e17e181a 1667 0x00, // AIN9 @ v_pga=0x00
whismanoid 3:9055e17e181a 1668 };
whismanoid 3:9055e17e181a 1669 //
whismanoid 3:9055e17e181a 1670 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 1671 // ---------- Measure_Voltage_custom_props ----------
whismanoid 0:cb44e2e9ec4c 1672 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 1673 // filter register configuration in Measure_Voltage and Read_All_Voltages CONV_TYPE_01_Continuous
whismanoid 0:cb44e2e9ec4c 1674 //~ const uint8_t custom_v_filter = 0x34; // @ v_filter=0x34 --*LINEF_11_SINC4 RATE_0100 | 60SPS
whismanoid 0:cb44e2e9ec4c 1675 //~ const uint8_t custom_v_filter = 0x00; // @ v_filter=0x00 -- LINEF_00_50Hz_60Hz_FIR RATE_0000 | 1.1SPS
whismanoid 0:cb44e2e9ec4c 1676 //~ const uint8_t custom_v_filter = 0x01; // @ v_filter=0x01 -- LINEF_00_50Hz_60Hz_FIR RATE_0001 | 2.1SPS
whismanoid 0:cb44e2e9ec4c 1677 //~ const uint8_t custom_v_filter = 0x02; // @ v_filter=0x02 -- LINEF_00_50Hz_60Hz_FIR RATE_0010 | 4.2SPS
whismanoid 0:cb44e2e9ec4c 1678 //~ const uint8_t custom_v_filter = 0x03; // @ v_filter=0x03 -- LINEF_00_50Hz_60Hz_FIR RATE_0011 | 8.4SPS
whismanoid 0:cb44e2e9ec4c 1679 //~ const uint8_t custom_v_filter = 0x04; // @ v_filter=0x04 -- LINEF_00_50Hz_60Hz_FIR RATE_0100 | 16.8SPS
whismanoid 0:cb44e2e9ec4c 1680 //~ const uint8_t custom_v_filter = 0x10; // @ v_filter=0x10 -- LINEF_01_50Hz_FIR RATE_0000 | 1.3SPS
whismanoid 0:cb44e2e9ec4c 1681 //~ const uint8_t custom_v_filter = 0x11; // @ v_filter=0x11 -- LINEF_01_50Hz_FIR RATE_0001 | 2.7SPS
whismanoid 0:cb44e2e9ec4c 1682 //~ const uint8_t custom_v_filter = 0x12; // @ v_filter=0x12 -- LINEF_01_50Hz_FIR RATE_0010 | 5.3SPS
whismanoid 0:cb44e2e9ec4c 1683 //~ const uint8_t custom_v_filter = 0x13; // @ v_filter=0x13 -- LINEF_01_50Hz_FIR RATE_0011 | 10.7SPS
whismanoid 0:cb44e2e9ec4c 1684 //~ const uint8_t custom_v_filter = 0x14; // @ v_filter=0x14 -- LINEF_01_50Hz_FIR RATE_0100 | 21.3SPS
whismanoid 0:cb44e2e9ec4c 1685 //~ const uint8_t custom_v_filter = 0x15; // @ v_filter=0x15 -- LINEF_01_50Hz_FIR RATE_0101 | 40.0SPS
whismanoid 0:cb44e2e9ec4c 1686 //~ const uint8_t custom_v_filter = 0x20; // @ v_filter=0x20 -- LINEF_10_60Hz_FIR RATE_0000 | 1.3SPS
whismanoid 0:cb44e2e9ec4c 1687 //~ const uint8_t custom_v_filter = 0x21; // @ v_filter=0x21 -- LINEF_10_60Hz_FIR RATE_0001 | 2.7SPS
whismanoid 0:cb44e2e9ec4c 1688 //~ const uint8_t custom_v_filter = 0x22; // @ v_filter=0x22 -- LINEF_10_60Hz_FIR RATE_0010 | 5.3SPS
whismanoid 0:cb44e2e9ec4c 1689 //~ const uint8_t custom_v_filter = 0x23; // @ v_filter=0x23 -- LINEF_10_60Hz_FIR RATE_0011 | 10.7SPS
whismanoid 0:cb44e2e9ec4c 1690 //~ const uint8_t custom_v_filter = 0x24; // @ v_filter=0x24 -- LINEF_10_60Hz_FIR RATE_0100 | 21.3SPS
whismanoid 0:cb44e2e9ec4c 1691 //~ const uint8_t custom_v_filter = 0x25; // @ v_filter=0x25 -- LINEF_10_60Hz_FIR RATE_0101 | 40.0SPS
whismanoid 0:cb44e2e9ec4c 1692 //~ const uint8_t custom_v_filter = 0x30; // @ v_filter=0x30 -- LINEF_11_SINC4 RATE_0000 | 4SPS
whismanoid 0:cb44e2e9ec4c 1693 //~ const uint8_t custom_v_filter = 0x31; // @ v_filter=0x31 -- LINEF_11_SINC4 RATE_0001 | 10SPS
whismanoid 0:cb44e2e9ec4c 1694 //~ const uint8_t custom_v_filter = 0x32; // @ v_filter=0x32 -- LINEF_11_SINC4 RATE_0010 | 20SPS
whismanoid 0:cb44e2e9ec4c 1695 //~ const uint8_t custom_v_filter = 0x33; // @ v_filter=0x33 -- LINEF_11_SINC4 RATE_0011 | 40SPS
whismanoid 0:cb44e2e9ec4c 1696 //~ const uint8_t custom_v_filter = 0x34; // @ v_filter=0x34 --*LINEF_11_SINC4 RATE_0100 | 60SPS
whismanoid 0:cb44e2e9ec4c 1697 //~ const uint8_t custom_v_filter = 0x35; // @ v_filter=0x35 -- LINEF_11_SINC4 RATE_0101 | 120SPS
whismanoid 0:cb44e2e9ec4c 1698 //~ const uint8_t custom_v_filter = 0x36; // @ v_filter=0x36 -- LINEF_11_SINC4 RATE_0110 | 240SPS
whismanoid 0:cb44e2e9ec4c 1699 //~ const uint8_t custom_v_filter = 0x37; // @ v_filter=0x37 -- LINEF_11_SINC4 RATE_0111 | 480SPS
whismanoid 0:cb44e2e9ec4c 1700 //~ const uint8_t custom_v_filter = 0x38; // @ v_filter=0x38 -- LINEF_11_SINC4 RATE_1000 | 960SPS
whismanoid 0:cb44e2e9ec4c 1701 //~ const uint8_t custom_v_filter = 0x39; // @ v_filter=0x39 -- LINEF_11_SINC4 RATE_1001 | 1920SPS
whismanoid 0:cb44e2e9ec4c 1702 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 1703 //
whismanoid 0:cb44e2e9ec4c 1704 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 1705 // pga register configuration in Measure_Voltage and Read_All_Voltages
whismanoid 0:cb44e2e9ec4c 1706 //~ const uint8_t custom_v_pga = 0x00; // @ v_pga=0x00 -- 0x00 SIG_PATH_00_BUFFERED
whismanoid 0:cb44e2e9ec4c 1707 //~ const uint8_t custom_v_pga = 0x00; // @ v_pga=0x00 -- 0x00 SIG_PATH_00_BUFFERED
whismanoid 0:cb44e2e9ec4c 1708 //~ const uint8_t custom_v_pga = 0x10; // @ v_pga=0x10 -- 0x10 SIG_PATH_01_BYPASS
whismanoid 0:cb44e2e9ec4c 1709 //~ const uint8_t custom_v_pga = 0x20; // @ v_pga=0x20 -- 0x20 SIG_PATH_10_PGA GAIN_000_1
whismanoid 0:cb44e2e9ec4c 1710 //~ const uint8_t custom_v_pga = 0x21; // @ v_pga=0x21 --*0x21 SIG_PATH_10_PGA GAIN_001_2
whismanoid 0:cb44e2e9ec4c 1711 //~ const uint8_t custom_v_pga = 0x22; // @ v_pga=0x22 -- 0x22 SIG_PATH_10_PGA GAIN_010_4
whismanoid 0:cb44e2e9ec4c 1712 //~ const uint8_t custom_v_pga = 0x23; // @ v_pga=0x23 -- 0x23 SIG_PATH_10_PGA GAIN_011_8
whismanoid 0:cb44e2e9ec4c 1713 //~ const uint8_t custom_v_pga = 0x24; // @ v_pga=0x24 -- 0x24 SIG_PATH_10_PGA GAIN_100_16
whismanoid 0:cb44e2e9ec4c 1714 //~ const uint8_t custom_v_pga = 0x25; // @ v_pga=0x25 -- 0x25 SIG_PATH_10_PGA GAIN_101_32
whismanoid 0:cb44e2e9ec4c 1715 //~ const uint8_t custom_v_pga = 0x26; // @ v_pga=0x26 -- 0x26 SIG_PATH_10_PGA GAIN_110_64
whismanoid 0:cb44e2e9ec4c 1716 //~ const uint8_t custom_v_pga = 0x27; // @ v_pga=0x27 -- 0x27 SIG_PATH_10_PGA GAIN_111_128
whismanoid 0:cb44e2e9ec4c 1717 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 1718 //
whismanoid 0:cb44e2e9ec4c 1719 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 1720 // ctrl register configuration in Measure_Voltage and Read_All_Voltages
whismanoid 3:9055e17e181a 1721 //~ const uint8_t custom_v_ctrl = 0x42; // @ v_ctrl=0x42 -- 0x40 unipolar, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 1722 //~ const uint8_t custom_v_ctrl = 0x40; // @ v_ctrl=0x40 -- 0x40 unipolar, 0x00 REF_SEL_000_AIN0_AIN1
whismanoid 0:cb44e2e9ec4c 1723 //~ const uint8_t custom_v_ctrl = 0x44; // @ v_ctrl=0x44 -- 0x40 unipolar, 0x04 REF_SEL_100_AIN0_AGND
whismanoid 0:cb44e2e9ec4c 1724 //~ const uint8_t custom_v_ctrl = 0x58; // @ v_ctrl=0x58 -- 0x40 unipolar, 0x00 REF_SEL_000_AIN0_AIN1, 0x18 refbuf
whismanoid 0:cb44e2e9ec4c 1725 //
whismanoid 0:cb44e2e9ec4c 1726 //~ const uint8_t custom_v_ctrl = 0x41; // @ v_ctrl=0x41 -- 0x40 unipolar, 0x01 REF_SEL_001_REF1P_REF1N
whismanoid 0:cb44e2e9ec4c 1727 //~ const uint8_t custom_v_ctrl = 0x45; // @ v_ctrl=0x45 -- 0x40 unipolar, 0x05 REF_SEL_101_REF1P_AGND
whismanoid 0:cb44e2e9ec4c 1728 //~ const uint8_t custom_v_ctrl = 0x59; // @ v_ctrl=0x59 -- 0x40 unipolar, 0x01 REF_SEL_001_REF1P_REF1N, 0x18 refbuf
whismanoid 0:cb44e2e9ec4c 1729 //
whismanoid 0:cb44e2e9ec4c 1730 //~ const uint8_t custom_v_ctrl = 0x42; // @ v_ctrl=0x42 -- 0x40 unipolar, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 1731 //~ const uint8_t custom_v_ctrl = 0x46; // @ v_ctrl=0x46 -- 0x40 unipolar, 0x06 REF_SEL_110_REF2P_AGND
whismanoid 0:cb44e2e9ec4c 1732 //~ const uint8_t custom_v_ctrl = 0x22; // @ v_ctrl=0x22 -- 0x20 bipolar offset binary, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 1733 //~ const uint8_t custom_v_ctrl = 0x02; // @ v_ctrl=0x02 -- 0x00 bipolar 2's complement, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 1734 //
whismanoid 0:cb44e2e9ec4c 1735 //~ const uint8_t custom_v_ctrl = 0x44; // @ v_ctrl=0x44 -- 0x40 unipolar, 0x04 REF_SEL_100_AIN0_AGND
whismanoid 0:cb44e2e9ec4c 1736 //~ const uint8_t custom_v_ctrl = 0x47; // @ v_ctrl=0x47 -- 0x40 unipolar, 0x07 REF_SEL_111_AVDD_AGND
whismanoid 0:cb44e2e9ec4c 1737 //~ const uint8_t custom_v_ctrl = 0x27; // @ v_ctrl=0x27 -- 0x20 bipolar offset binary, 0x07 REF_SEL_111_AVDD_AGND
whismanoid 0:cb44e2e9ec4c 1738 //~ const uint8_t custom_v_ctrl = 0x07; // @ v_ctrl=0x07 -- 0x00 bipolar 2's complement, 0x07 REF_SEL_111_AVDD_AGND
whismanoid 0:cb44e2e9ec4c 1739 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 1740
whismanoid 3:9055e17e181a 1741 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 1742 // example code declare SPI interface (GPIO controlled CS)
whismanoid 0:cb44e2e9ec4c 1743 #if defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 1744 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 1745 DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32625MBED: P1_3 Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 1746 #elif defined(TARGET_MAX32625PICO)
whismanoid 0:cb44e2e9ec4c 1747 #warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
whismanoid 0:cb44e2e9ec4c 1748 SPI spi(SPI0_MOSI, SPI0_MISO, SPI0_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625PICO: pin P0_5 P0_6 P0_4
whismanoid 0:cb44e2e9ec4c 1749 DigitalOut spi_cs(SPI0_SS); // TARGET_MAX32625PICO: pin P0_7
whismanoid 0:cb44e2e9ec4c 1750 #elif defined(TARGET_MAX32600MBED)
whismanoid 0:cb44e2e9ec4c 1751 SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
whismanoid 0:cb44e2e9ec4c 1752 DigitalOut spi_cs(SPI2_SS); // Generic: Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 1753 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 1754 // TODO1: avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 1755 // void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
whismanoid 0:cb44e2e9ec4c 1756 //
whismanoid 0:cb44e2e9ec4c 1757 // TODO1: NUCLEO_F446RE SPI not working; CS and MOSI data looks OK but no SCLK clock pulses.
whismanoid 0:cb44e2e9ec4c 1758 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 1759 DigitalOut spi_cs(SPI_CS); // TARGET_NUCLEO_F446RE: PB_6 Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 1760 //
whismanoid 0:cb44e2e9ec4c 1761 #else
whismanoid 3:9055e17e181a 1762 SPI spi(D11, D12, D13); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
whismanoid 3:9055e17e181a 1763 DigitalOut spi_cs(D10); // Generic: Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 1764 #endif
whismanoid 0:cb44e2e9ec4c 1765
whismanoid 0:cb44e2e9ec4c 1766 // example code declare GPIO interface pins
whismanoid 0:cb44e2e9ec4c 1767 // example code declare device instance
whismanoid 3:9055e17e181a 1768 MAX11410 g_MAX11410_device(spi, spi_cs, MAX11410::MAX11410_IC);
whismanoid 3:9055e17e181a 1769 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 1770
whismanoid 1:747f1602abfc 1771 //--------------------------------------------------
whismanoid 3:9055e17e181a 1772 // Option to Datalog Arduino platform analog inputs
whismanoid 3:9055e17e181a 1773 #ifndef LOG_PLATFORM_AIN
whismanoid 3:9055e17e181a 1774 #define LOG_PLATFORM_AIN 6
whismanoid 3:9055e17e181a 1775 //~ #undef LOG_PLATFORM_AIN
whismanoid 3:9055e17e181a 1776 #endif
whismanoid 3:9055e17e181a 1777 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 1:747f1602abfc 1778 //#ifndef NUM_PLATFORM_ANALOG_IN_CHANNELS
whismanoid 1:747f1602abfc 1779 //#define NUM_PLATFORM_ANALOG_IN_CHANNELS 6
whismanoid 1:747f1602abfc 1780 //#endif
whismanoid 1:747f1602abfc 1781 const int NUM_PLATFORM_ANALOG_IN_CHANNELS = 6;
whismanoid 1:747f1602abfc 1782 const double adc_full_scale_voltage[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 0:cb44e2e9ec4c 1783 1.2,
whismanoid 0:cb44e2e9ec4c 1784 1.2,
whismanoid 0:cb44e2e9ec4c 1785 1.2,
whismanoid 0:cb44e2e9ec4c 1786 1.2,
whismanoid 0:cb44e2e9ec4c 1787 1.2,
whismanoid 0:cb44e2e9ec4c 1788 1.2
whismanoid 0:cb44e2e9ec4c 1789 };
whismanoid 1:747f1602abfc 1790 //--------------------------------------------------
whismanoid 1:747f1602abfc 1791 // Option to log platform analog inputs as raw LSB code
whismanoid 1:747f1602abfc 1792 #ifndef LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 1:747f1602abfc 1793 #define LOG_PLATFORM_ANALOG_IN_LSB 0
whismanoid 1:747f1602abfc 1794 #endif
whismanoid 1:747f1602abfc 1795 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 1:747f1602abfc 1796 int Platform_LSB[NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 1:747f1602abfc 1797 #endif
whismanoid 1:747f1602abfc 1798
whismanoid 1:747f1602abfc 1799 //--------------------------------------------------
whismanoid 1:747f1602abfc 1800 // Option to use platform analog inputs as Voltage
whismanoid 1:747f1602abfc 1801 #ifndef LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 1:747f1602abfc 1802 #define LOG_PLATFORM_ANALOG_IN_VOLTS 1
whismanoid 1:747f1602abfc 1803 #endif
whismanoid 1:747f1602abfc 1804 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 1:747f1602abfc 1805 double Platform_Voltage[NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 1:747f1602abfc 1806 #endif
whismanoid 3:9055e17e181a 1807 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 0:cb44e2e9ec4c 1808
whismanoid 4:d9b05924ad4c 1809 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 1810 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 1811 inline void print_command_prompt()
whismanoid 4:d9b05924ad4c 1812 {
whismanoid 4:d9b05924ad4c 1813 //~ Serial.println(F(">"));
whismanoid 4:d9b05924ad4c 1814 cmdLine.serial().printf("\r\n> ");
whismanoid 4:d9b05924ad4c 1815 }
whismanoid 4:d9b05924ad4c 1816 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 1817
whismanoid 4:d9b05924ad4c 1818 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 1819 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 1820 void main_menu_status(CmdLine & cmdLine)
whismanoid 4:d9b05924ad4c 1821 {
whismanoid 4:d9b05924ad4c 1822 cmdLine.serial().printf("\r\nMain menu");
whismanoid 4:d9b05924ad4c 1823 #if APPLICATION_MAX5715 // main_menu_status banner
whismanoid 4:d9b05924ad4c 1824 cmdLine.serial().printf(" MAX5715 12-bit 4-ch SPI VOUT DAC");
whismanoid 4:d9b05924ad4c 1825 #elif APPLICATION_MAX11131 // main_menu_status banner
whismanoid 4:d9b05924ad4c 1826 cmdLine.serial().printf(" MAX11131 12-bit 3MSps 16-ch ADC");
whismanoid 4:d9b05924ad4c 1827 #elif APPLICATION_MAX5171 // main_menu_status banner
whismanoid 4:d9b05924ad4c 1828 cmdLine.serial().printf(" MAX5171 14-bit Force/Sense VOUT DAC");
whismanoid 4:d9b05924ad4c 1829 #elif APPLICATION_MAX11410 // main_menu_status banner
whismanoid 4:d9b05924ad4c 1830 cmdLine.serial().printf(" MAX11410 24-bit 1.9ksps Delta-Sigma ADC");
whismanoid 4:d9b05924ad4c 1831 #elif APPLICATION_MAX12345 // main_menu_status banner
whismanoid 4:d9b05924ad4c 1832 cmdLine.serial().printf(" MAX12345");
whismanoid 4:d9b05924ad4c 1833 #else
whismanoid 4:d9b05924ad4c 1834 //cmdLine.serial().printf(" ");
whismanoid 4:d9b05924ad4c 1835 #endif
whismanoid 4:d9b05924ad4c 1836 //cmdLine.serial().printf(" %s", TARGET_NAME);
whismanoid 4:d9b05924ad4c 1837 if (cmdLine.nameStr())
whismanoid 4:d9b05924ad4c 1838 {
whismanoid 4:d9b05924ad4c 1839 cmdLine.serial().printf(" [%s]", cmdLine.nameStr());
whismanoid 4:d9b05924ad4c 1840 }
whismanoid 4:d9b05924ad4c 1841 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 4:d9b05924ad4c 1842 cmdLine.serial().printf(" [Button1=DemoConfig1]");
whismanoid 4:d9b05924ad4c 1843 #endif
whismanoid 4:d9b05924ad4c 1844 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 4:d9b05924ad4c 1845 cmdLine.serial().printf(" [Button2=DemoConfig2]");
whismanoid 4:d9b05924ad4c 1846 #endif
whismanoid 4:d9b05924ad4c 1847 #if HAS_BUTTON1_DEMO
whismanoid 4:d9b05924ad4c 1848 // print BUTTON1 status
whismanoid 4:d9b05924ad4c 1849 cmdLine.serial().printf("\r\n BUTTON1 = %d", button1.read());
whismanoid 4:d9b05924ad4c 1850 #endif
whismanoid 4:d9b05924ad4c 1851 #if HAS_BUTTON2_DEMO
whismanoid 4:d9b05924ad4c 1852 // print BUTTON1 status
whismanoid 4:d9b05924ad4c 1853 cmdLine.serial().printf("\r\n BUTTON2 = %d", button2.read());
whismanoid 4:d9b05924ad4c 1854 #endif
whismanoid 4:d9b05924ad4c 1855 cmdLine.serial().printf("\r\n ? -- help");
whismanoid 4:d9b05924ad4c 1856 }
whismanoid 4:d9b05924ad4c 1857 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 1858
whismanoid 4:d9b05924ad4c 1859 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 1860 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 1861 void main_menu_help(CmdLine & cmdLine)
whismanoid 4:d9b05924ad4c 1862 {
whismanoid 4:d9b05924ad4c 1863 // ? -- help
whismanoid 4:d9b05924ad4c 1864 //~ cmdLine.serial().printf("\r\nMenu:");
whismanoid 4:d9b05924ad4c 1865 cmdLine.serial().printf("\r\n # -- lines beginning with # are comments");
whismanoid 4:d9b05924ad4c 1866 #if USE_SELFTEST
whismanoid 4:d9b05924ad4c 1867 cmdLine.serial().printf("\r\n . -- SelfTest");
whismanoid 4:d9b05924ad4c 1868 #endif // USE_SELFTEST
whismanoid 4:d9b05924ad4c 1869 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 4:d9b05924ad4c 1870 // TODO Datalog trigger menu
whismanoid 4:d9b05924ad4c 1871 // set Datalogger_Trigger to trigger_Halt or trigger_FreeRun
whismanoid 4:d9b05924ad4c 1872 // Datalogger_Trigger = trigger_Halt // halt the datalogger; continue accepting commands
whismanoid 4:d9b05924ad4c 1873 // Datalogger_Trigger = trigger_FreeRun // free run as fast as possible
whismanoid 4:d9b05924ad4c 1874 cmdLine.serial().printf("\r\n LR -- Datalog free run as fast as possible");
whismanoid 4:d9b05924ad4c 1875 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 4:d9b05924ad4c 1876 //cmdLine.serial().print(F("\r\n ! -- Initial Configuration"));
whismanoid 4:d9b05924ad4c 1877 //
whismanoid 4:d9b05924ad4c 1878 // % standardize diagnostic commands
whismanoid 4:d9b05924ad4c 1879 // %Hpin -- digital output high
whismanoid 4:d9b05924ad4c 1880 // %Lpin -- digital output low
whismanoid 4:d9b05924ad4c 1881 // %?pin -- digital input
whismanoid 4:d9b05924ad4c 1882 // %A %Apin -- analog input
whismanoid 4:d9b05924ad4c 1883 // %Ppin df=xx -- pwm output
whismanoid 4:d9b05924ad4c 1884 // %Wpin -- measure high pulsewidth input in usec
whismanoid 4:d9b05924ad4c 1885 // %wpin -- measure low pulsewidth input in usec
whismanoid 4:d9b05924ad4c 1886 // %I... -- I2C diagnostics
whismanoid 4:d9b05924ad4c 1887 // %IP -- I2C probe
whismanoid 4:d9b05924ad4c 1888 // %IC scl=100khz ADDR=? -- I2C configure
whismanoid 4:d9b05924ad4c 1889 // %IW ADDR=? cmd=? data,data,data -- write
whismanoid 4:d9b05924ad4c 1890 // %IR ADDR=? RD=? -- read
whismanoid 4:d9b05924ad4c 1891 // %I^ cmd=? -- i2c_smbus_read_word_data
whismanoid 4:d9b05924ad4c 1892 // %S... -- SPI diagnostics
whismanoid 4:d9b05924ad4c 1893 // %SC sclk=1Mhz -- SPI configure
whismanoid 4:d9b05924ad4c 1894 // %SW -- write (write and read)
whismanoid 4:d9b05924ad4c 1895 // %SR -- read (alias for %SW because SPI always write and read)
whismanoid 4:d9b05924ad4c 1896 // A-Z,a-z,0-9 reserved for application use
whismanoid 4:d9b05924ad4c 1897 //
whismanoid 4:d9b05924ad4c 1898 #if HAS_digitalInOuts
whismanoid 4:d9b05924ad4c 1899 // %Hpin -- digital output high
whismanoid 4:d9b05924ad4c 1900 // %Lpin -- digital output low
whismanoid 4:d9b05924ad4c 1901 // %?pin -- digital input
whismanoid 4:d9b05924ad4c 1902 cmdLine.serial().printf("\r\n %%Hn {pin:");
whismanoid 4:d9b05924ad4c 1903 list_digitalInOutPins(cmdLine.serial());
whismanoid 4:d9b05924ad4c 1904 cmdLine.serial().printf("} -- High Output");
whismanoid 4:d9b05924ad4c 1905 cmdLine.serial().printf("\r\n %%Ln {pin:");
whismanoid 4:d9b05924ad4c 1906 list_digitalInOutPins(cmdLine.serial());
whismanoid 4:d9b05924ad4c 1907 cmdLine.serial().printf("} -- Low Output");
whismanoid 4:d9b05924ad4c 1908 cmdLine.serial().printf("\r\n %%?n {pin:");
whismanoid 4:d9b05924ad4c 1909 list_digitalInOutPins(cmdLine.serial());
whismanoid 4:d9b05924ad4c 1910 cmdLine.serial().printf("} -- Input");
whismanoid 4:d9b05924ad4c 1911 #endif
whismanoid 4:d9b05924ad4c 1912
whismanoid 4:d9b05924ad4c 1913 #if HAS_analogIns
whismanoid 4:d9b05924ad4c 1914 // Menu A) analogRead A0..7
whismanoid 4:d9b05924ad4c 1915 // %A %Apin -- analog input
whismanoid 4:d9b05924ad4c 1916 // analogRead(pinIndex) // analog input pins A0, A1, A2, A3, A4, A5; float voltage = analogRead(A0) * (5.0 / 1023.0)
whismanoid 4:d9b05924ad4c 1917 cmdLine.serial().printf("\r\n %%A -- analogRead");
whismanoid 4:d9b05924ad4c 1918 #endif
whismanoid 4:d9b05924ad4c 1919
whismanoid 4:d9b05924ad4c 1920 #if HAS_SPI2_MAX541
whismanoid 4:d9b05924ad4c 1921 // TODO1: MAX541 max541(spi2_max541, spi2_max541_cs);
whismanoid 4:d9b05924ad4c 1922 cmdLine.serial().printf("\r\n %%D -- DAC output MAX541 (SPI2)");
whismanoid 4:d9b05924ad4c 1923 #endif
whismanoid 4:d9b05924ad4c 1924
whismanoid 4:d9b05924ad4c 1925 #if HAS_I2C // SUPPORT_I2C
whismanoid 4:d9b05924ad4c 1926 // TODO: support I2C HAS_I2C // SUPPORT_I2C
whismanoid 4:d9b05924ad4c 1927 // VERIFY: I2C utility commands SUPPORT_I2C
whismanoid 4:d9b05924ad4c 1928 // VERIFY: report g_I2C_SCL_Hz = (F_CPU / ((TWBR * 2) + 16)) from last Wire_Sr.setClock(I2C_SCL_Hz);
whismanoid 4:d9b05924ad4c 1929 // %I... -- I2C diagnostics
whismanoid 4:d9b05924ad4c 1930 // %IP -- I2C probe
whismanoid 4:d9b05924ad4c 1931 // %IC scl=100khz ADDR=? -- I2C configure
whismanoid 4:d9b05924ad4c 1932 // %IW byte byte ... byte RD=? ADDR=0x -- write
whismanoid 4:d9b05924ad4c 1933 // %IR ADDR=? RD=? -- read
whismanoid 4:d9b05924ad4c 1934 // %I^ cmd=? -- i2c_smbus_read_word_data
whismanoid 4:d9b05924ad4c 1935 //g_I2C_SCL_Hz = (F_CPU / ((TWBR * 2) + 16)); // 'F_CPU' 'TWBR' not declared in this scope
whismanoid 4:d9b05924ad4c 1936 cmdLine.serial().printf("\r\n %%IC ADDR=0x%2.2x=(0x%2.2x>>1) SCL=%d=%1.3fkHz -- I2C config",
whismanoid 4:d9b05924ad4c 1937 g_I2C_deviceAddress7, (g_I2C_deviceAddress7 << 1), g_I2C_SCL_Hz,
whismanoid 4:d9b05924ad4c 1938 (g_I2C_SCL_Hz / 1000.));
whismanoid 4:d9b05924ad4c 1939 cmdLine.serial().printf("\r\n %%IW byte byte ... byte RD=? ADDR=0x%2.2x -- I2C write/read",
whismanoid 4:d9b05924ad4c 1940 g_I2C_deviceAddress7);
whismanoid 4:d9b05924ad4c 1941 //
whismanoid 4:d9b05924ad4c 1942 #if SUPPORT_I2C
whismanoid 4:d9b05924ad4c 1943 // Menu ^ cmd=?) i2c_smbus_read_word_data
whismanoid 4:d9b05924ad4c 1944 cmdLine.serial().printf("\r\n %%I^ cmd=? -- i2c_smbus_read_word_data");
whismanoid 4:d9b05924ad4c 1945 // test low-level I2C i2c_smbus_read_word_data
whismanoid 4:d9b05924ad4c 1946 #endif // SUPPORT_I2C
whismanoid 4:d9b05924ad4c 1947 //cmdLine.serial().printf(" H) Hunt for attached I2C devices");
whismanoid 4:d9b05924ad4c 1948 cmdLine.serial().printf("\r\n %%IP -- I2C Probe for attached devices");
whismanoid 4:d9b05924ad4c 1949 // cmdLine.serial().printf(" s) search i2c address");
whismanoid 4:d9b05924ad4c 1950 #endif // SUPPORT_I2C
whismanoid 4:d9b05924ad4c 1951
whismanoid 4:d9b05924ad4c 1952 #if HAS_SPI // SUPPORT_SPI
whismanoid 4:d9b05924ad4c 1953 // TODO: support SPI HAS_SPI // SUPPORT_SPI
whismanoid 4:d9b05924ad4c 1954 // SPI test command S (mosiData)+
whismanoid 4:d9b05924ad4c 1955 // %S... -- SPI diagnostics
whismanoid 4:d9b05924ad4c 1956 // %SC sclk=1Mhz -- SPI configure
whismanoid 4:d9b05924ad4c 1957 // %SW -- write (write and read)
whismanoid 4:d9b05924ad4c 1958 // %SR -- read (alias for %SW because SPI always write and read)
whismanoid 4:d9b05924ad4c 1959 // spi.format(8,0); // int bits_must_be_8, int mode=0_3 CPOL=0,CPHA=0 rising edge (initial default)
whismanoid 4:d9b05924ad4c 1960 // spi.format(8,1); // int bits_must_be_8, int mode=0_3 CPOL=0,CPHA=1 falling edge (initial default)
whismanoid 4:d9b05924ad4c 1961 // spi.format(8,2); // int bits_must_be_8, int mode=0_3 CPOL=1,CPHA=0 falling edge (initial default)
whismanoid 4:d9b05924ad4c 1962 // spi.format(8,3); // int bits_must_be_8, int mode=0_3 CPOL=1,CPHA=1 rising edge (initial default)
whismanoid 4:d9b05924ad4c 1963 // spi.frequency(1000000); // int SCLK_Hz=1000000 = 1MHz (initial default)
whismanoid 4:d9b05924ad4c 1964 // mode | POL PHA
whismanoid 4:d9b05924ad4c 1965 // -----+--------
whismanoid 4:d9b05924ad4c 1966 // 0 | 0 0
whismanoid 4:d9b05924ad4c 1967 // 1 | 0 1
whismanoid 4:d9b05924ad4c 1968 // 2 | 1 0
whismanoid 4:d9b05924ad4c 1969 // 3 | 1 1
whismanoid 4:d9b05924ad4c 1970 //cmdLine.serial().printf(" S) SPI mosi,mosi,...mosi hex bytes SCLK=1000000 CPOL=0 CPHA=0");
whismanoid 4:d9b05924ad4c 1971 // fixed: mbed-os-5.11: [Warning] format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
whismanoid 4:d9b05924ad4c 1972 cmdLine.serial().printf("\r\n %%SC SCLK=%ld=%1.3fMHz CPOL=%d CPHA=%d -- SPI config",
whismanoid 4:d9b05924ad4c 1973 g_SPI_SCLK_Hz, (g_SPI_SCLK_Hz / 1000000.),
whismanoid 4:d9b05924ad4c 1974 ((g_SPI_dataMode & SPI_MODE2) ? 1 : 0),
whismanoid 4:d9b05924ad4c 1975 ((g_SPI_dataMode & SPI_MODE1) ? 1 : 0));
whismanoid 4:d9b05924ad4c 1976 cmdLine.serial().printf("\r\n %%SD -- SPI diagnostic messages ");
whismanoid 4:d9b05924ad4c 1977 if (g_MAX11410_device.onSPIprint) {
whismanoid 4:d9b05924ad4c 1978 cmdLine.serial().printf("hide");
whismanoid 4:d9b05924ad4c 1979 }
whismanoid 4:d9b05924ad4c 1980 else {
whismanoid 4:d9b05924ad4c 1981 cmdLine.serial().printf("show");
whismanoid 4:d9b05924ad4c 1982 }
whismanoid 4:d9b05924ad4c 1983 cmdLine.serial().printf("\r\n %%SW mosi,mosi,...mosi -- SPI write hex bytes");
whismanoid 4:d9b05924ad4c 1984 // VERIFY: parse new SPI settings parse_strCommandArgs() SCLK=1000000 CPOL=0 CPHA=0
whismanoid 4:d9b05924ad4c 1985 #endif // SUPPORT_SPI
whismanoid 4:d9b05924ad4c 1986 //
whismanoid 4:d9b05924ad4c 1987 // Application-specific commands (help text) here
whismanoid 4:d9b05924ad4c 1988 //
whismanoid 4:d9b05924ad4c 1989 #if APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 1990 cmdLine.serial().printf("\r\n A-Z,a-z,0-9 -- reserved for application use"); // ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 1991 #endif // APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 1992 //
whismanoid 4:d9b05924ad4c 1993
whismanoid 4:d9b05924ad4c 1994 //~ extern void MAX11410_menu_help(CmdLine & cmdLine); // defined in Test_Menu_MAX11410.cpp\n
whismanoid 4:d9b05924ad4c 1995 //~ MAX11410_menu_help(cmdLine);
whismanoid 4:d9b05924ad4c 1996 }
whismanoid 4:d9b05924ad4c 1997 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 1998
whismanoid 4:d9b05924ad4c 1999 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 2000 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 2001 void main_menu_onEOLcommandParser(CmdLine& cmdLine)
whismanoid 4:d9b05924ad4c 2002 {
whismanoid 4:d9b05924ad4c 2003 // TODO: process command line
whismanoid 4:d9b05924ad4c 2004 cmdLine.serial().printf("\r\nCmdLine buf:");
whismanoid 4:d9b05924ad4c 2005 cmdLine.serial().printf("%s\r\n", cmdLine.str());
whismanoid 4:d9b05924ad4c 2006
whismanoid 4:d9b05924ad4c 2007 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 4:d9b05924ad4c 2008 // If datalog is free running, halt on any possible received command
whismanoid 4:d9b05924ad4c 2009 if (Datalogger_Trigger == trigger_FreeRun) {
whismanoid 4:d9b05924ad4c 2010 Datalogger_Trigger = trigger_Halt;
whismanoid 4:d9b05924ad4c 2011 }
whismanoid 4:d9b05924ad4c 2012 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 4:d9b05924ad4c 2013
whismanoid 4:d9b05924ad4c 2014 // DIAGNOSTIC: print line buffer
whismanoid 4:d9b05924ad4c 2015 //~ cmdLine.serial().printf("\r\nmain_menu_onEOLcommandParser: ~%s~\r\n", cmdLine.str());
whismanoid 4:d9b05924ad4c 2016 //
whismanoid 4:d9b05924ad4c 2017 switch (cmdLine[0])
whismanoid 4:d9b05924ad4c 2018 {
whismanoid 4:d9b05924ad4c 2019 case '?':
whismanoid 4:d9b05924ad4c 2020 main_menu_status(cmdLine);
whismanoid 4:d9b05924ad4c 2021 main_menu_help(cmdLine);
whismanoid 4:d9b05924ad4c 2022 // print command prompt
whismanoid 4:d9b05924ad4c 2023 //cmdLine.serial().printf("\r\n>");
whismanoid 4:d9b05924ad4c 2024 break;
whismanoid 4:d9b05924ad4c 2025 case '\r': case '\n': // ignore blank line
whismanoid 4:d9b05924ad4c 2026 case '\0': // ignore empty line
whismanoid 4:d9b05924ad4c 2027 case '#': // ignore comment line
whismanoid 4:d9b05924ad4c 2028 // # -- lines beginning with # are comments
whismanoid 4:d9b05924ad4c 2029 main_menu_status(cmdLine);
whismanoid 4:d9b05924ad4c 2030 //~ main_menu_help(cmdLine);
whismanoid 4:d9b05924ad4c 2031 // print command prompt
whismanoid 4:d9b05924ad4c 2032 //cmdLine.serial().printf("\r\n>");
whismanoid 4:d9b05924ad4c 2033 break;
whismanoid 4:d9b05924ad4c 2034 #if ECHO_EOF_ON_EOL
whismanoid 4:d9b05924ad4c 2035 case '\x04': // Unicode (U+0004) EOT END OF TRANSMISSION = CTRL+D as EOF end of file
whismanoid 4:d9b05924ad4c 2036 cmdLine.serial().printf("\x04"); // immediately echo EOF for test scripting
whismanoid 4:d9b05924ad4c 2037 diagnostic_led_EOF();
whismanoid 4:d9b05924ad4c 2038 break;
whismanoid 4:d9b05924ad4c 2039 case '\x1a': // Unicode (U+001A) SUB SUBSTITUTE = CTRL+Z as EOF end of file
whismanoid 4:d9b05924ad4c 2040 cmdLine.serial().printf("\x1a"); // immediately echo EOF for test scripting
whismanoid 4:d9b05924ad4c 2041 diagnostic_led_EOF();
whismanoid 4:d9b05924ad4c 2042 break;
whismanoid 4:d9b05924ad4c 2043 #endif
whismanoid 4:d9b05924ad4c 2044 #if USE_SELFTEST
whismanoid 4:d9b05924ad4c 2045 case '.':
whismanoid 4:d9b05924ad4c 2046 {
whismanoid 4:d9b05924ad4c 2047 // . -- SelfTest
whismanoid 4:d9b05924ad4c 2048 cmdLine.serial().printf("SelfTest()");
whismanoid 4:d9b05924ad4c 2049 SelfTest(cmdLine);
whismanoid 4:d9b05924ad4c 2050 }
whismanoid 4:d9b05924ad4c 2051 break;
whismanoid 4:d9b05924ad4c 2052 #endif // USE_SELFTEST
whismanoid 4:d9b05924ad4c 2053 #if 0 // APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 2054 case '%':
whismanoid 4:d9b05924ad4c 2055 {
whismanoid 4:d9b05924ad4c 2056 pinsMonitor_submenu_onEOLcommandParser(cmdLine);
whismanoid 4:d9b05924ad4c 2057 }
whismanoid 4:d9b05924ad4c 2058 break; // case '%'
whismanoid 4:d9b05924ad4c 2059 #endif // APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 2060 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 4:d9b05924ad4c 2061 // TODO Datalog trigger menu
whismanoid 4:d9b05924ad4c 2062 // set Datalogger_Trigger to trigger_Halt or trigger_FreeRun
whismanoid 4:d9b05924ad4c 2063 // Datalogger_Trigger = trigger_Halt // halt the datalogger; continue accepting commands
whismanoid 4:d9b05924ad4c 2064 // Datalogger_Trigger = trigger_FreeRun // free run as fast as possible
whismanoid 4:d9b05924ad4c 2065 case 'L':
whismanoid 4:d9b05924ad4c 2066 {
whismanoid 4:d9b05924ad4c 2067 // halt the datalogger; continue accepting commands
whismanoid 4:d9b05924ad4c 2068 Datalogger_Trigger = trigger_Halt;
whismanoid 4:d9b05924ad4c 2069 switch (cmdLine[1])
whismanoid 4:d9b05924ad4c 2070 {
whismanoid 4:d9b05924ad4c 2071 case 'R': case 'r':
whismanoid 4:d9b05924ad4c 2072 // free run as fast as possible
whismanoid 4:d9b05924ad4c 2073 Datalogger_Trigger = trigger_FreeRun;
whismanoid 4:d9b05924ad4c 2074 Datalogger_PrintHeader();
whismanoid 4:d9b05924ad4c 2075 return; // instead of break; avoid falling through to print_command_prompt();
whismanoid 4:d9b05924ad4c 2076 }
whismanoid 4:d9b05924ad4c 2077 }
whismanoid 4:d9b05924ad4c 2078 break; // case 'L'
whismanoid 4:d9b05924ad4c 2079 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 4:d9b05924ad4c 2080 //
whismanoid 4:d9b05924ad4c 2081 // Application-specific commands here
whismanoid 4:d9b05924ad4c 2082 // alphanumeric command codes A-Z,a-z,0-9 reserved for application use
whismanoid 4:d9b05924ad4c 2083 //
whismanoid 4:d9b05924ad4c 2084 #if APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 2085 #endif // APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 2086
whismanoid 4:d9b05924ad4c 2087 //
whismanoid 4:d9b05924ad4c 2088 // TODO1: add new commands here
whismanoid 4:d9b05924ad4c 2089 //
whismanoid 4:d9b05924ad4c 2090 default:
whismanoid 4:d9b05924ad4c 2091 #if APPLICATION_MAX5715 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 2092 extern bool MAX5715_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX5715.cpp
whismanoid 4:d9b05924ad4c 2093 if (!MAX5715_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 2094 #elif APPLICATION_MAX11131 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 2095 extern bool MAX11131_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX11131.cpp
whismanoid 4:d9b05924ad4c 2096 if (!MAX11131_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 2097 #elif APPLICATION_MAX5171 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 2098 extern bool MAX5171_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX5171.cpp
whismanoid 4:d9b05924ad4c 2099 if (!MAX5171_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 2100 #elif APPLICATION_MAX11410 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 2101 extern bool MAX11410_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX11410.cpp
whismanoid 4:d9b05924ad4c 2102 if (!MAX11410_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 2103 #elif APPLICATION_MAX12345 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 2104 extern bool MAX12345_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX12345.cpp
whismanoid 4:d9b05924ad4c 2105 if (!MAX12345_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 2106 #else
whismanoid 4:d9b05924ad4c 2107 if (0) // not_handled_by_device_submenu
whismanoid 4:d9b05924ad4c 2108 #endif
whismanoid 4:d9b05924ad4c 2109 {
whismanoid 4:d9b05924ad4c 2110 cmdLine.serial().printf("\r\n unknown command ");
whismanoid 4:d9b05924ad4c 2111 //~ cmdLine.serial().printf("\r\n unknown command 0x%2.2x \"%s\"\r\n", cmdLine.str()[0], cmdLine.str());
whismanoid 4:d9b05924ad4c 2112 # if HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 2113 cmdLine_DAPLINKserial.serial().print("\r\n unknown command 0x%2.2x \"%s\"\r\n",
whismanoid 4:d9b05924ad4c 2114 cmdLine.str()[0], cmdLine.str());
whismanoid 4:d9b05924ad4c 2115 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 2116 }
whismanoid 4:d9b05924ad4c 2117 } // switch (cmdLine[0])
whismanoid 4:d9b05924ad4c 2118 //
whismanoid 4:d9b05924ad4c 2119 // print command prompt
whismanoid 4:d9b05924ad4c 2120 print_command_prompt();
whismanoid 4:d9b05924ad4c 2121 }
whismanoid 4:d9b05924ad4c 2122 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 2123
whismanoid 4:d9b05924ad4c 2124 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 2125 // print column header banner for csv data columns
whismanoid 4:d9b05924ad4c 2126 void Datalogger_PrintHeader()
whismanoid 4:d9b05924ad4c 2127 {
whismanoid 4:d9b05924ad4c 2128 // column header banner for csv data columns
whismanoid 4:d9b05924ad4c 2129 int field_index = 0;
whismanoid 4:d9b05924ad4c 2130 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 4:d9b05924ad4c 2131 for (int channel_index = 0; channel_index < NUM_DUT_ANALOG_IN_CHANNELS; field_index++, channel_index++) {
whismanoid 4:d9b05924ad4c 2132 if (SPI_AIN_Enable_ch[channel_index] == Disable) {
whismanoid 4:d9b05924ad4c 2133 continue;
whismanoid 4:d9b05924ad4c 2134 }
whismanoid 4:d9b05924ad4c 2135 // comma between fields
whismanoid 4:d9b05924ad4c 2136 if (field_index > 0) {
whismanoid 4:d9b05924ad4c 2137 cmdLine.serial().printf(",");
whismanoid 4:d9b05924ad4c 2138 }
whismanoid 4:d9b05924ad4c 2139 // AIN_index column header prefix
whismanoid 4:d9b05924ad4c 2140 #if SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 4:d9b05924ad4c 2141 // MAX11410 v_ctrl bipolar configuration or unipolar?
whismanoid 4:d9b05924ad4c 2142 if ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) {
whismanoid 4:d9b05924ad4c 2143 cmdLine.serial().printf("\"AIN%d-%d_BIP", channel_index, channel_index+1);
whismanoid 4:d9b05924ad4c 2144 }
whismanoid 4:d9b05924ad4c 2145 else {
whismanoid 4:d9b05924ad4c 2146 cmdLine.serial().printf("\"AIN%d", channel_index);
whismanoid 4:d9b05924ad4c 2147 }
whismanoid 4:d9b05924ad4c 2148 #else // SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 4:d9b05924ad4c 2149 cmdLine.serial().printf("\"AIN%d", channel_index);
whismanoid 4:d9b05924ad4c 2150 #endif // SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 4:d9b05924ad4c 2151 if (SPI_AIN_Enable_ch[channel_index] == Enable_LSB) {
whismanoid 4:d9b05924ad4c 2152 cmdLine_DAPLINKserial.serial().printf("\"AIN%d", channel_index);
whismanoid 4:d9b05924ad4c 2153 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 2154 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 4:d9b05924ad4c 2155 // _LSB column header suffix
whismanoid 4:d9b05924ad4c 2156 cmdLine.serial().printf("_LSB\"");
whismanoid 4:d9b05924ad4c 2157 # if HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 2158 cmdLine_DAPLINKserial.serial().printf("_LSB\"");
whismanoid 4:d9b05924ad4c 2159 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 2160 }
whismanoid 4:d9b05924ad4c 2161 else if (SPI_AIN_Enable_ch[channel_index] == Enable_Volt) {
whismanoid 4:d9b05924ad4c 2162 // _V column header suffix
whismanoid 4:d9b05924ad4c 2163 cmdLine.serial().printf("_V\"");
whismanoid 4:d9b05924ad4c 2164 # if HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 2165 cmdLine_DAPLINKserial.serial().printf("_V\"");
whismanoid 4:d9b05924ad4c 2166 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 2167 }
whismanoid 4:d9b05924ad4c 2168 }
whismanoid 4:d9b05924ad4c 2169
whismanoid 4:d9b05924ad4c 2170 #if VERIFY_PART_ID_IN_LOOP
whismanoid 4:d9b05924ad4c 2171 // PART_ID field: Device ID Validation
whismanoid 4:d9b05924ad4c 2172 cmdLine.serial().printf(",\"PART_ID\"");
whismanoid 4:d9b05924ad4c 2173 # if HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 2174 cmdLine_DAPLINKserial.serial().printf(",\"PART_ID\"");
whismanoid 4:d9b05924ad4c 2175 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 2176 #endif // VERIFY_PART_ID_IN_LOOP
whismanoid 4:d9b05924ad4c 2177 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 4:d9b05924ad4c 2178 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 4:d9b05924ad4c 2179 for (int channel_index = 0; channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS; field_index++, channel_index++) {
whismanoid 4:d9b05924ad4c 2180 // comma between fields
whismanoid 4:d9b05924ad4c 2181 if (field_index > 0) {
whismanoid 4:d9b05924ad4c 2182 cmdLine.serial().printf(",");
whismanoid 4:d9b05924ad4c 2183 }
whismanoid 4:d9b05924ad4c 2184 // AIN_index column header prefix
whismanoid 4:d9b05924ad4c 2185 cmdLine.serial().printf("\"A%d", channel_index);
whismanoid 4:d9b05924ad4c 2186 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 4:d9b05924ad4c 2187 // _LSB column header suffix
whismanoid 4:d9b05924ad4c 2188 cmdLine.serial().printf("_LSB\"");
whismanoid 4:d9b05924ad4c 2189 #elif LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 4:d9b05924ad4c 2190 // _V column header suffix
whismanoid 4:d9b05924ad4c 2191 cmdLine.serial().printf("_V\"");
whismanoid 4:d9b05924ad4c 2192 #endif
whismanoid 4:d9b05924ad4c 2193 }
whismanoid 4:d9b05924ad4c 2194 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 4:d9b05924ad4c 2195 // end of column header line
whismanoid 4:d9b05924ad4c 2196 cmdLine.serial().printf("\r\n");
whismanoid 4:d9b05924ad4c 2197 # if HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 2198 cmdLine_DAPLINKserial.serial().printf("\r\n");
whismanoid 4:d9b05924ad4c 2199 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 2200 } // void Datalogger_PrintHeader()
whismanoid 4:d9b05924ad4c 2201
whismanoid 0:cb44e2e9ec4c 2202 // CODE GENERATOR: example code for ADC: serial port declaration
whismanoid 1:747f1602abfc 2203 //--------------------------------------------------
whismanoid 1:747f1602abfc 2204 // Declare the Serial driver
whismanoid 1:747f1602abfc 2205 // default baud rate settings are 9600 8N1
whismanoid 1:747f1602abfc 2206 // install device driver from http://developer.mbed.org/media/downloads/drivers/mbedWinSerial_16466.exe
whismanoid 1:747f1602abfc 2207 // see docs https://docs.mbed.com/docs/mbed-os-handbook/en/5.5/getting_started/what_need/
whismanoid 1:747f1602abfc 2208 #if defined(TARGET_MAX32630)
whismanoid 1:747f1602abfc 2209 #include "USBSerial.h"
whismanoid 1:747f1602abfc 2210 // Hardware serial port over DAPLink
whismanoid 1:747f1602abfc 2211 // The default baud rate for the DapLink UART is 9600
whismanoid 1:747f1602abfc 2212 //Serial DAPLINKserial(P2_1, P2_0); // tx, rx
whismanoid 1:747f1602abfc 2213 // #define HAS_DAPLINK_SERIAL 1
whismanoid 1:747f1602abfc 2214 // Virtual serial port over USB
whismanoid 1:747f1602abfc 2215 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 1:747f1602abfc 2216 USBSerial serial;
whismanoid 1:747f1602abfc 2217 //--------------------------------------------------
whismanoid 1:747f1602abfc 2218 #elif defined(TARGET_MAX32625MBED)
whismanoid 1:747f1602abfc 2219 #include "USBSerial.h"
whismanoid 1:747f1602abfc 2220 // Hardware serial port over DAPLink
whismanoid 1:747f1602abfc 2221 // The default baud rate for the DapLink UART is 9600
whismanoid 1:747f1602abfc 2222 //Serial DAPLINKserial(P2_1, P2_0); // tx, rx
whismanoid 1:747f1602abfc 2223 // #define HAS_DAPLINK_SERIAL 1
whismanoid 1:747f1602abfc 2224 // Virtual serial port over USB
whismanoid 1:747f1602abfc 2225 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 1:747f1602abfc 2226 USBSerial serial;
whismanoid 1:747f1602abfc 2227 //--------------------------------------------------
whismanoid 2:3caa9b974176 2228 #elif defined(TARGET_MAX32625PICO)
whismanoid 2:3caa9b974176 2229 #include "USBSerial.h"
whismanoid 3:9055e17e181a 2230 // Virtual serial port over USB
whismanoid 2:3caa9b974176 2231 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 3:9055e17e181a 2232 USBSerial serial;
whismanoid 3:9055e17e181a 2233 //--------------------------------------------------
whismanoid 3:9055e17e181a 2234 #elif defined(TARGET_MAX32620FTHR)
whismanoid 3:9055e17e181a 2235 #warning "TARGET_MAX32620FTHR not previously tested; need to define serial pins..."
whismanoid 3:9055e17e181a 2236 // Hardware serial port over DAPLink
whismanoid 3:9055e17e181a 2237 // The default baud rate for the DapLink UART is 9600
whismanoid 3:9055e17e181a 2238 Serial DAPLINKserial(USBTX, USBRX); // tx, rx MAX32620FTHR: P2_1,P2_0
whismanoid 3:9055e17e181a 2239 //Serial DAPLINKserial(STDIO_UART_TX, STDIO_UART_RX); // tx, rx
whismanoid 3:9055e17e181a 2240 #define HAS_DAPLINK_SERIAL 1
whismanoid 3:9055e17e181a 2241 // Virtual serial port over USB
whismanoid 3:9055e17e181a 2242 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 3:9055e17e181a 2243 // #include "USBSerial.h"
whismanoid 3:9055e17e181a 2244 //USBSerial serial;
whismanoid 3:9055e17e181a 2245 //Serial serial(UART0_TX, UART0_RX); // tx, rx MAX32620FTHR: P0_1,P0_0 (PMOD Port 0)
whismanoid 3:9055e17e181a 2246 //Serial serial(UART1_TX, UART1_RX); // tx, rx MAX32620FTHR: P2_1,P2_0 (DAPLINK)
whismanoid 3:9055e17e181a 2247 Serial serial(UART2_TX, UART2_RX); // tx, rx MAX32620FTHR: P3_1,P3_0 (J1.15,J1.14)
whismanoid 3:9055e17e181a 2248 //Serial serial(UART3_TX, UART3_RX); // tx, rx MAX32620FTHR: P5_4,P5_3 (J2.7,J2.8)
whismanoid 3:9055e17e181a 2249 //Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx
whismanoid 3:9055e17e181a 2250 //Serial serial(USBTX, USBRX); // tx, rx
whismanoid 3:9055e17e181a 2251 //Serial serial(UART_TX, UART_RX); // tx, rx
whismanoid 3:9055e17e181a 2252 //
whismanoid 2:3caa9b974176 2253 //--------------------------------------------------
whismanoid 1:747f1602abfc 2254 #elif defined(TARGET_MAX32600)
whismanoid 1:747f1602abfc 2255 #include "USBSerial.h"
whismanoid 1:747f1602abfc 2256 // Hardware serial port over DAPLink
whismanoid 1:747f1602abfc 2257 // The default baud rate for the DapLink UART is 9600
whismanoid 1:747f1602abfc 2258 Serial DAPLINKserial(P1_1, P1_0); // tx, rx
whismanoid 1:747f1602abfc 2259 #define HAS_DAPLINK_SERIAL 1
whismanoid 1:747f1602abfc 2260 // Virtual serial port over USB
whismanoid 1:747f1602abfc 2261 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 1:747f1602abfc 2262 USBSerial serial;
whismanoid 1:747f1602abfc 2263 //--------------------------------------------------
whismanoid 1:747f1602abfc 2264 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 1:747f1602abfc 2265 Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx
whismanoid 1:747f1602abfc 2266 //--------------------------------------------------
whismanoid 1:747f1602abfc 2267 #else
whismanoid 1:747f1602abfc 2268 #if defined(SERIAL_TX)
whismanoid 1:747f1602abfc 2269 #warning "target not previously tested; guess serial pins are SERIAL_TX, SERIAL_RX..."
whismanoid 1:747f1602abfc 2270 Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx
whismanoid 1:747f1602abfc 2271 #elif defined(USBTX)
whismanoid 1:747f1602abfc 2272 #warning "target not previously tested; guess serial pins are USBTX, USBRX..."
whismanoid 1:747f1602abfc 2273 Serial serial(USBTX, USBRX); // tx, rx
whismanoid 1:747f1602abfc 2274 #elif defined(UART_TX)
whismanoid 1:747f1602abfc 2275 #warning "target not previously tested; guess serial pins are UART_TX, UART_RX..."
whismanoid 1:747f1602abfc 2276 Serial serial(UART_TX, UART_RX); // tx, rx
whismanoid 1:747f1602abfc 2277 #else
whismanoid 1:747f1602abfc 2278 #warning "target not previously tested; need to define serial pins..."
whismanoid 1:747f1602abfc 2279 #endif
whismanoid 1:747f1602abfc 2280 #endif
whismanoid 1:747f1602abfc 2281 //
whismanoid 1:747f1602abfc 2282 #include "CmdLine.h"
whismanoid 1:747f1602abfc 2283
whismanoid 1:747f1602abfc 2284 # if HAS_DAPLINK_SERIAL
whismanoid 1:747f1602abfc 2285 CmdLine cmdLine_DAPLINKserial(DAPLINKserial, "DAPLINK");
whismanoid 1:747f1602abfc 2286 # endif // HAS_DAPLINK_SERIAL
whismanoid 1:747f1602abfc 2287 CmdLine cmdLine(serial, "serial");
whismanoid 1:747f1602abfc 2288
whismanoid 0:cb44e2e9ec4c 2289 // example code main function
whismanoid 0:cb44e2e9ec4c 2290 int main()
whismanoid 0:cb44e2e9ec4c 2291 {
whismanoid 0:cb44e2e9ec4c 2292 // setup: put your setup code here, to run once
whismanoid 4:d9b05924ad4c 2293 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 2294 // Configure serial ports
whismanoid 4:d9b05924ad4c 2295 cmdLine.clear();
whismanoid 4:d9b05924ad4c 2296 //~ cmdLine.serial().printf("\r\n cmdLine.serial().printf test\r\n");
whismanoid 4:d9b05924ad4c 2297 cmdLine.onEOLcommandParser = main_menu_onEOLcommandParser;
whismanoid 4:d9b05924ad4c 2298 //~ cmdLine.diagnostic_led_EOF = diagnostic_led_EOF;
whismanoid 4:d9b05924ad4c 2299 /// CmdLine::set_immediate_handler(char, functionPointer_void_void_on_immediate_0x21);
whismanoid 4:d9b05924ad4c 2300 //~ cmdLine.on_immediate_0x21 = on_immediate_0x21;
whismanoid 4:d9b05924ad4c 2301 //~ cmdLine.on_immediate_0x7b = on_immediate_0x7b;
whismanoid 4:d9b05924ad4c 2302 //~ cmdLine.on_immediate_0x7d = on_immediate_0x7d;
whismanoid 4:d9b05924ad4c 2303 # if HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 2304 cmdLine_DAPLINKserial.clear();
whismanoid 4:d9b05924ad4c 2305 //~ cmdLine_DAPLINKserial.serial().printf("\r\n cmdLine_DAPLINKserial.serial().printf test\r\n");
whismanoid 4:d9b05924ad4c 2306 cmdLine_DAPLINKserial.onEOLcommandParser = main_menu_onEOLcommandParser;
whismanoid 4:d9b05924ad4c 2307 /// @todo CmdLine::set_immediate_handler(char, functionPointer_void_void_on_immediate_0x21);
whismanoid 4:d9b05924ad4c 2308 //~ cmdLine_DAPLINKserial.on_immediate_0x21 = on_immediate_0x21;
whismanoid 4:d9b05924ad4c 2309 //~ cmdLine_DAPLINKserial.on_immediate_0x7b = on_immediate_0x7b;
whismanoid 4:d9b05924ad4c 2310 //~ cmdLine_DAPLINKserial.on_immediate_0x7d = on_immediate_0x7d;
whismanoid 4:d9b05924ad4c 2311 # endif
whismanoid 4:d9b05924ad4c 2312 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 0:cb44e2e9ec4c 2313
whismanoid 0:cb44e2e9ec4c 2314 // example code: serial port banner message
whismanoid 0:cb44e2e9ec4c 2315 wait(3); // 3000ms timing delay function, platform-specific
whismanoid 3:9055e17e181a 2316 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 2317 cmdLine.serial().printf("\r\nDataLogger_MAX11410\r\n"); // instead of Hello_MAX11410
whismanoid 3:9055e17e181a 2318 #else // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 2319 cmdLine.serial().printf("\r\nInternal_DataLogger\r\n"); // instead of Hello_MAX11410
whismanoid 3:9055e17e181a 2320 # if HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 2321 cmdLine_DAPLINKserial.serial().printf("\r\nInternal_DataLogger\r\n"); // instead of Hello_MAX11410
whismanoid 3:9055e17e181a 2322 # endif // HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 2323 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 2324
whismanoid 1:747f1602abfc 2325 // CODE GENERATOR: get spi properties from device
whismanoid 3:9055e17e181a 2326 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 2327 if (g_SPI_SCLK_Hz > g_MAX11410_device.get_spi_frequency())
whismanoid 3:9055e17e181a 2328 { // Device limits SPI SCLK frequency
whismanoid 3:9055e17e181a 2329 g_SPI_SCLK_Hz = g_MAX11410_device.get_spi_frequency();
whismanoid 3:9055e17e181a 2330 cmdLine.serial().printf("\r\nMAX11410 limits SPI SCLK frequency to %ld Hz\r\n", g_SPI_SCLK_Hz);
whismanoid 3:9055e17e181a 2331
whismanoid 3:9055e17e181a 2332 g_MAX11410_device.Init();
whismanoid 3:9055e17e181a 2333 }
whismanoid 3:9055e17e181a 2334 if (g_MAX11410_device.get_spi_frequency() > g_SPI_SCLK_Hz)
whismanoid 3:9055e17e181a 2335 { // Platform limits SPI SCLK frequency
whismanoid 3:9055e17e181a 2336 g_MAX11410_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 3:9055e17e181a 2337 cmdLine.serial().printf("\r\nPlatform limits MAX11410 SPI SCLK frequency to %ld Hz\r\n", g_SPI_SCLK_Hz);
whismanoid 3:9055e17e181a 2338
whismanoid 3:9055e17e181a 2339 g_MAX11410_device.Init();
whismanoid 3:9055e17e181a 2340 }
whismanoid 0:cb44e2e9ec4c 2341 // g_SPI_dataMode = g_MAX11410_device.get_spi_dataMode();
whismanoid 3:9055e17e181a 2342 while (g_MAX11410_device.Init() == 0)
whismanoid 3:9055e17e181a 2343 {
whismanoid 3:9055e17e181a 2344 wait(3); // 3000ms timing delay function, platform-specific
whismanoid 3:9055e17e181a 2345 cmdLine.serial().printf("\r\nMAX11410 Init failed; retry...\r\n");
whismanoid 3:9055e17e181a 2346
whismanoid 3:9055e17e181a 2347 }
whismanoid 0:cb44e2e9ec4c 2348
whismanoid 0:cb44e2e9ec4c 2349 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 3:9055e17e181a 2350 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 2351 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[0];
whismanoid 3:9055e17e181a 2352 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[0];
whismanoid 3:9055e17e181a 2353 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[0];
whismanoid 3:9055e17e181a 2354 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 2355 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 3:9055e17e181a 2356 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 2357 // CODE GENERATOR: example code: has no member function REF
whismanoid 0:cb44e2e9ec4c 2358 // CODE GENERATOR: example code for ADC: repeat-forever convert and print conversion result, one record per line
whismanoid 0:cb44e2e9ec4c 2359 // CODE GENERATOR: ResolutionBits = 24
whismanoid 0:cb44e2e9ec4c 2360 // CODE GENERATOR: FScode = 0xffffff
whismanoid 0:cb44e2e9ec4c 2361 // CODE GENERATOR: NumChannels = 10
whismanoid 0:cb44e2e9ec4c 2362 // CODE GENERATOR: banner before DataLogHelloCppCodeList while(1)
whismanoid 3:9055e17e181a 2363 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 2364 cmdLine.serial().printf("v_filter = 0x%2.2x\r\n", g_MAX11410_device.v_filter);
whismanoid 0:cb44e2e9ec4c 2365
whismanoid 3:9055e17e181a 2366 cmdLine.serial().printf("v_pga = 0x%2.2x\r\n", g_MAX11410_device.v_pga);
whismanoid 0:cb44e2e9ec4c 2367
whismanoid 3:9055e17e181a 2368 cmdLine.serial().printf("v_ctrl = 0x%2.2x\r\n", g_MAX11410_device.v_ctrl);
whismanoid 3:9055e17e181a 2369
whismanoid 3:9055e17e181a 2370 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 2371
whismanoid 3:9055e17e181a 2372 // column header banner for csv data columns
whismanoid 4:d9b05924ad4c 2373 Datalogger_PrintHeader();
whismanoid 4:d9b05924ad4c 2374
whismanoid 4:d9b05924ad4c 2375 while(1) { // this code repeats forever
whismanoid 4:d9b05924ad4c 2376 // this code repeats forever
whismanoid 4:d9b05924ad4c 2377
whismanoid 4:d9b05924ad4c 2378 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 2379 // TODO support CmdLine command menus (like on Serial_Tester); help and usual boilerplate
whismanoid 4:d9b05924ad4c 2380 if (serial.readable()) {
whismanoid 4:d9b05924ad4c 2381 int c = serial.getc(); // instead of getc() or fgetc()
whismanoid 4:d9b05924ad4c 2382 cmdLine.append(c);
whismanoid 4:d9b05924ad4c 2383 // cmdLine.onEOLcommandParser handler implements menus
whismanoid 4:d9b05924ad4c 2384 } // if (Serial.available())
whismanoid 4:d9b05924ad4c 2385 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 2386
whismanoid 4:d9b05924ad4c 2387 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 4:d9b05924ad4c 2388 // TODO Datalog trigger
whismanoid 4:d9b05924ad4c 2389 if (Datalogger_Trigger == trigger_Halt) {
whismanoid 4:d9b05924ad4c 2390 // halt the datalogger; continue accepting commands
whismanoid 3:9055e17e181a 2391 continue;
whismanoid 3:9055e17e181a 2392 }
whismanoid 4:d9b05924ad4c 2393 if (Datalogger_Trigger == trigger_FreeRun) {
whismanoid 4:d9b05924ad4c 2394 // free run as fast as possible
whismanoid 3:9055e17e181a 2395 }
whismanoid 4:d9b05924ad4c 2396 if (Datalogger_Trigger == trigger_Timer) {
whismanoid 4:d9b05924ad4c 2397 // timer (configure interval)
whismanoid 3:9055e17e181a 2398 }
whismanoid 4:d9b05924ad4c 2399 if (Datalogger_Trigger == trigger_PlatformDigitalInput) {
whismanoid 4:d9b05924ad4c 2400 // platform digital input (configure digital input pin reference)
whismanoid 3:9055e17e181a 2401 }
whismanoid 4:d9b05924ad4c 2402 if (Datalogger_Trigger == trigger_SPIDeviceRegRead) {
whismanoid 4:d9b05924ad4c 2403 // SPI device register read (configure regaddr, mask value, match value)
whismanoid 4:d9b05924ad4c 2404 }
whismanoid 4:d9b05924ad4c 2405 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 0:cb44e2e9ec4c 2406
whismanoid 0:cb44e2e9ec4c 2407 // CODE GENERATOR: example code: has no member function ScanStandardExternalClock
whismanoid 0:cb44e2e9ec4c 2408 // CODE GENERATOR: example code: has no member function ReadAINcode
whismanoid 0:cb44e2e9ec4c 2409 // CODE GENERATOR: example code: member function Read_All_Voltages
whismanoid 3:9055e17e181a 2410 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 2411 // Measure ADC channels in sequence from AIN0 to channelNumber_0_9.
whismanoid 0:cb44e2e9ec4c 2412 // @param[in] g_MAX11410_device.channelNumber_0_15: AIN Channel Number
whismanoid 0:cb44e2e9ec4c 2413 // @param[in] g_MAX11410_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
whismanoid 0:cb44e2e9ec4c 2414 // @param[in] g_MAX11410_device.chan_id_0_1: ADC_MODE_CONTROL.CHAN_ID
whismanoid 3:9055e17e181a 2415 int channelId_0_9 = NUM_DUT_ANALOG_IN_CHANNELS-1+1;
whismanoid 0:cb44e2e9ec4c 2416 //g_MAX11410_device.channelNumber_0_15 = channelId_0_9;
whismanoid 0:cb44e2e9ec4c 2417 //g_MAX11410_device.PowerManagement_0_2 = 0;
whismanoid 0:cb44e2e9ec4c 2418 //g_MAX11410_device.chan_id_0_1 = 1;
whismanoid 3:9055e17e181a 2419 //----------------------------------------
whismanoid 3:9055e17e181a 2420 // scan AIN0..AIN9
whismanoid 3:9055e17e181a 2421 //
whismanoid 3:9055e17e181a 2422 g_MAX11410_device.Read_All_Voltages();
whismanoid 3:9055e17e181a 2423 #endif // SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 3:9055e17e181a 2424 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 0:cb44e2e9ec4c 2425 // mbed
whismanoid 0:cb44e2e9ec4c 2426 // Platform board uses simple analog inputs
whismanoid 1:747f1602abfc 2427 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 1:747f1602abfc 2428 Platform_LSB[0] = analogIn0.read();
whismanoid 1:747f1602abfc 2429 Platform_LSB[1] = analogIn1.read();
whismanoid 1:747f1602abfc 2430 Platform_LSB[2] = analogIn2.read();
whismanoid 1:747f1602abfc 2431 Platform_LSB[3] = analogIn3.read();
whismanoid 1:747f1602abfc 2432 Platform_LSB[4] = analogIn4.read();
whismanoid 1:747f1602abfc 2433 Platform_LSB[5] = analogIn5.read();
whismanoid 1:747f1602abfc 2434 #elif LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 1:747f1602abfc 2435 Platform_Voltage[0] = analogIn0.read() * adc_full_scale_voltage[0];
whismanoid 1:747f1602abfc 2436 Platform_Voltage[1] = analogIn1.read() * adc_full_scale_voltage[1];
whismanoid 1:747f1602abfc 2437 Platform_Voltage[2] = analogIn2.read() * adc_full_scale_voltage[2];
whismanoid 1:747f1602abfc 2438 Platform_Voltage[3] = analogIn3.read() * adc_full_scale_voltage[3];
whismanoid 1:747f1602abfc 2439 Platform_Voltage[4] = analogIn4.read() * adc_full_scale_voltage[4];
whismanoid 1:747f1602abfc 2440 Platform_Voltage[5] = analogIn5.read() * adc_full_scale_voltage[5];
whismanoid 1:747f1602abfc 2441 #endif
whismanoid 3:9055e17e181a 2442 #endif // defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 0:cb44e2e9ec4c 2443
whismanoid 0:cb44e2e9ec4c 2444 #if VERIFY_PART_ID_IN_LOOP
whismanoid 3:9055e17e181a 2445 // PART_ID field: Device ID Validation
whismanoid 0:cb44e2e9ec4c 2446 const uint32_t part_id_expect = 0x000F02;
whismanoid 0:cb44e2e9ec4c 2447 uint32_t part_id_readback;
whismanoid 0:cb44e2e9ec4c 2448 g_MAX11410_device.RegRead(MAX11410::CMD_r001_0001_xxxx_xxxx_xxxx_xxxx_xxxx_xddd_PART_ID, &part_id_readback);
whismanoid 0:cb44e2e9ec4c 2449 #endif // VERIFY_PART_ID_IN_LOOP
whismanoid 0:cb44e2e9ec4c 2450
whismanoid 0:cb44e2e9ec4c 2451 // wait(3.0);
whismanoid 0:cb44e2e9ec4c 2452 // CODE GENERATOR: print conversion result
whismanoid 0:cb44e2e9ec4c 2453 // Use Arduino Serial Plotter to view output: Tools | Serial Plotter
whismanoid 4:d9b05924ad4c 2454 int field_index = 0;
whismanoid 3:9055e17e181a 2455 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 2456 for (int channel_index = 0; channel_index < NUM_DUT_ANALOG_IN_CHANNELS; field_index++, channel_index++) {
whismanoid 3:9055e17e181a 2457 if (SPI_AIN_Enable_ch[channel_index] == Disable) {
whismanoid 3:9055e17e181a 2458 continue;
whismanoid 3:9055e17e181a 2459 }
whismanoid 3:9055e17e181a 2460 // comma between fields
whismanoid 3:9055e17e181a 2461 if (field_index > 0) {
whismanoid 3:9055e17e181a 2462 cmdLine.serial().printf(",");
whismanoid 3:9055e17e181a 2463 # if HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 2464 cmdLine_DAPLINKserial.serial().printf(",");
whismanoid 3:9055e17e181a 2465 # endif // HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 2466 }
whismanoid 3:9055e17e181a 2467 cmdLine.serial().printf("%d", g_MAX11410_device.AINcode[channel_index]);
whismanoid 0:cb44e2e9ec4c 2468 }
whismanoid 0:cb44e2e9ec4c 2469 #if VERIFY_PART_ID_IN_LOOP
whismanoid 3:9055e17e181a 2470 // PART_ID field: Device ID Validation
whismanoid 0:cb44e2e9ec4c 2471 if (part_id_readback != part_id_expect) {
whismanoid 0:cb44e2e9ec4c 2472 cmdLine.serial().printf(",\"FAIL\"");
whismanoid 3:9055e17e181a 2473 # if HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 2474 cmdLine_DAPLINKserial.serial().printf(",\"FAIL\"");
whismanoid 3:9055e17e181a 2475 # endif // HAS_DAPLINK_SERIAL
whismanoid 0:cb44e2e9ec4c 2476
whismanoid 3:9055e17e181a 2477 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 2478 g_MAX11410_device.Init();
whismanoid 3:9055e17e181a 2479 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[0];
whismanoid 3:9055e17e181a 2480 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[0];
whismanoid 3:9055e17e181a 2481 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[0];
whismanoid 3:9055e17e181a 2482 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 2483 }
whismanoid 0:cb44e2e9ec4c 2484 else {
whismanoid 0:cb44e2e9ec4c 2485 cmdLine.serial().printf(",\"OK\"");
whismanoid 3:9055e17e181a 2486 # if HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 2487 cmdLine_DAPLINKserial.serial().printf(",\"OK\"");
whismanoid 3:9055e17e181a 2488 # endif // HAS_DAPLINK_SERIAL
whismanoid 0:cb44e2e9ec4c 2489
whismanoid 0:cb44e2e9ec4c 2490 }
whismanoid 0:cb44e2e9ec4c 2491 #endif // VERIFY_PART_ID_IN_LOOP
whismanoid 3:9055e17e181a 2492 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 2493 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 3:9055e17e181a 2494 for (int channel_index = 0; channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS; field_index++, channel_index++) {
whismanoid 3:9055e17e181a 2495 // comma between fields
whismanoid 3:9055e17e181a 2496 if (field_index > 0) {
whismanoid 3:9055e17e181a 2497 cmdLine.serial().printf(",");
whismanoid 3:9055e17e181a 2498 }
whismanoid 3:9055e17e181a 2499 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 3:9055e17e181a 2500 cmdLine.serial().printf("%u", Platform_LSB[channel_index]);
whismanoid 3:9055e17e181a 2501 # if HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 2502 cmdLine_DAPLINKserial.serial().printf("%u", Platform_LSB[channel_index]);
whismanoid 3:9055e17e181a 2503 # endif // HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 2504 #elif LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 3:9055e17e181a 2505 cmdLine.serial().printf("%6.6fV", Platform_Voltage[channel_index]);
whismanoid 3:9055e17e181a 2506 # if HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 2507 cmdLine_DAPLINKserial.serial().printf("%6.6fV", Platform_Voltage[channel_index]);
whismanoid 3:9055e17e181a 2508 # endif // HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 2509 #endif // #if LOG_PLATFORM_ANALOG_IN_LSB LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 3:9055e17e181a 2510 }
whismanoid 3:9055e17e181a 2511 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 0:cb44e2e9ec4c 2512 cmdLine.serial().printf("\r\n");
whismanoid 3:9055e17e181a 2513 # if HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 2514 cmdLine_DAPLINKserial.serial().printf("\r\n");
whismanoid 3:9055e17e181a 2515 # endif // HAS_DAPLINK_SERIAL
whismanoid 0:cb44e2e9ec4c 2516
whismanoid 0:cb44e2e9ec4c 2517 } // this code repeats forever
whismanoid 0:cb44e2e9ec4c 2518 }
whismanoid 0:cb44e2e9ec4c 2519 //---------- CODE GENERATOR: end DataLogHelloCppCodeList