Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.

Dependencies:   MaximTinyTester CmdLine MAX541 MAX5715 USBDevice

Committer:
whismanoid
Date:
Thu Jul 18 18:37:55 2019 -0700
Revision:
18:14afc2a2150f
Parent:
17:bf4efc8f5eee
MAX32620FTHR support: USBSerial not working yet...

Who changed what in which revision?

UserRevisionLine numberNew contents of line
whismanoid 0:3edb3708c8c5 1 /*******************************************************************************
whismanoid 0:3edb3708c8c5 2 * Copyright (C) 2019 Maxim Integrated Products, Inc., All Rights Reserved.
whismanoid 0:3edb3708c8c5 3 *
whismanoid 0:3edb3708c8c5 4 * Permission is hereby granted, free of charge, to any person obtaining a
whismanoid 0:3edb3708c8c5 5 * copy of this software and associated documentation files (the "Software"),
whismanoid 0:3edb3708c8c5 6 * to deal in the Software without restriction, including without limitation
whismanoid 0:3edb3708c8c5 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
whismanoid 0:3edb3708c8c5 8 * and/or sell copies of the Software, and to permit persons to whom the
whismanoid 0:3edb3708c8c5 9 * Software is furnished to do so, subject to the following conditions:
whismanoid 0:3edb3708c8c5 10 *
whismanoid 0:3edb3708c8c5 11 * The above copyright notice and this permission notice shall be included
whismanoid 0:3edb3708c8c5 12 * in all copies or substantial portions of the Software.
whismanoid 0:3edb3708c8c5 13 *
whismanoid 0:3edb3708c8c5 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
whismanoid 0:3edb3708c8c5 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
whismanoid 0:3edb3708c8c5 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
whismanoid 0:3edb3708c8c5 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
whismanoid 0:3edb3708c8c5 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
whismanoid 0:3edb3708c8c5 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
whismanoid 0:3edb3708c8c5 20 * OTHER DEALINGS IN THE SOFTWARE.
whismanoid 0:3edb3708c8c5 21 *
whismanoid 0:3edb3708c8c5 22 * Except as contained in this notice, the name of Maxim Integrated
whismanoid 0:3edb3708c8c5 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
whismanoid 0:3edb3708c8c5 24 * Products, Inc. Branding Policy.
whismanoid 0:3edb3708c8c5 25 *
whismanoid 0:3edb3708c8c5 26 * The mere transfer of this software does not imply any licenses
whismanoid 0:3edb3708c8c5 27 * of trade secrets, proprietary technology, copyrights, patents,
whismanoid 0:3edb3708c8c5 28 * trademarks, maskwork rights, or any other form of intellectual
whismanoid 0:3edb3708c8c5 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
whismanoid 0:3edb3708c8c5 30 * ownership rights.
whismanoid 0:3edb3708c8c5 31 *******************************************************************************
whismanoid 0:3edb3708c8c5 32 */
whismanoid 0:3edb3708c8c5 33
whismanoid 0:3edb3708c8c5 34 // Test fixture and application menu for breakout boards:
whismanoid 0:3edb3708c8c5 35 // - MAX5715BOB
whismanoid 0:3edb3708c8c5 36 // - MAX11131BOB
whismanoid 0:3edb3708c8c5 37 // - MAX5171BOB
whismanoid 0:3edb3708c8c5 38 // Platforms:
whismanoid 0:3edb3708c8c5 39 // - MAX32625MBED
whismanoid 13:e36d51f46794 40 // - supports mbed-os-5.11, requires USBDevice library
whismanoid 17:bf4efc8f5eee 41 // - remove max32630fthr library (if present)
whismanoid 17:bf4efc8f5eee 42 // - remove MAX32620FTHR library (if present)
whismanoid 13:e36d51f46794 43 // - MAX32600MBED
whismanoid 17:bf4efc8f5eee 44 // - remove max32630fthr library (if present)
whismanoid 17:bf4efc8f5eee 45 // - remove MAX32620FTHR library (if present)
whismanoid 0:3edb3708c8c5 46 // - NUCLEO_F446RE
whismanoid 13:e36d51f46794 47 // - remove USBDevice library
whismanoid 17:bf4efc8f5eee 48 // - remove max32630fthr library (if present)
whismanoid 17:bf4efc8f5eee 49 // - remove MAX32620FTHR library (if present)
whismanoid 0:3edb3708c8c5 50 // - NUCLEO_F401RE
whismanoid 13:e36d51f46794 51 // - remove USBDevice library
whismanoid 17:bf4efc8f5eee 52 // - remove max32630fthr library (if present)
whismanoid 17:bf4efc8f5eee 53 // - remove MAX32620FTHR library (if present)
whismanoid 13:e36d51f46794 54 // - MAX32630FTHR
whismanoid 17:bf4efc8f5eee 55 // - add http://os.mbed.org/teams/MaximIntegrated/code/max32630fthr/
whismanoid 17:bf4efc8f5eee 56 // - remove MAX32620FTHR library (if present)
whismanoid 17:bf4efc8f5eee 57 // - MAX32620FTHR
whismanoid 17:bf4efc8f5eee 58 // - remove max32630fthr library (if present)
whismanoid 17:bf4efc8f5eee 59 // - add https://os.mbed.com/teams/MaximIntegrated/code/MAX32620FTHR/
whismanoid 17:bf4efc8f5eee 60 // - not tested yet
whismanoid 17:bf4efc8f5eee 61 // - MAX32625PICO
whismanoid 17:bf4efc8f5eee 62 // - remove max32630fthr library (if present)
whismanoid 17:bf4efc8f5eee 63 // - remove MAX32620FTHR library (if present)
whismanoid 17:bf4efc8f5eee 64 // - not tested yet
whismanoid 0:3edb3708c8c5 65
whismanoid 0:3edb3708c8c5 66 #include "mbed.h"
whismanoid 16:3c75011e705a 67 // mbed shared event queue run onTimerTick() in Thread context not Interrupt context
whismanoid 16:3c75011e705a 68 #include "mbed_events.h"
whismanoid 0:3edb3708c8c5 69 #if defined(TARGET)
whismanoid 0:3edb3708c8c5 70 // TARGET_NAME macros from targets/TARGET_Maxim/TARGET_MAX32625/device/mxc_device.h
whismanoid 0:3edb3708c8c5 71 // Create a string definition for the TARGET
whismanoid 0:3edb3708c8c5 72 #define STRING_ARG(arg) #arg
whismanoid 0:3edb3708c8c5 73 #define STRING_NAME(name) STRING_ARG(name)
whismanoid 0:3edb3708c8c5 74 #define TARGET_NAME STRING_NAME(TARGET)
whismanoid 11:9fa2402071de 75 #elif defined(TARGET_MAX32600)
whismanoid 11:9fa2402071de 76 #define TARGET_NAME "MAX32600"
whismanoid 0:3edb3708c8c5 77 #elif defined(TARGET_LPC1768)
whismanoid 0:3edb3708c8c5 78 #define TARGET_NAME "LPC1768"
whismanoid 0:3edb3708c8c5 79 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:3edb3708c8c5 80 #define TARGET_NAME "NUCLEO_F446RE"
whismanoid 0:3edb3708c8c5 81 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:3edb3708c8c5 82 #define TARGET_NAME "NUCLEO_F401RE"
whismanoid 0:3edb3708c8c5 83 #else
whismanoid 0:3edb3708c8c5 84 #error TARGET NOT DEFINED
whismanoid 0:3edb3708c8c5 85 #endif
whismanoid 0:3edb3708c8c5 86 #if defined(TARGET_MAX32630)
whismanoid 0:3edb3708c8c5 87 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 88 // TARGET=MAX32630FTHR ARM Cortex-M4F 96MHz 2048kB Flash 512kB SRAM
whismanoid 0:3edb3708c8c5 89 // +-------------[microUSB]-------------+
whismanoid 0:3edb3708c8c5 90 // | J1 MAX32630FTHR J2 |
whismanoid 0:3edb3708c8c5 91 // ______ | [ ] RST GND [ ] |
whismanoid 0:3edb3708c8c5 92 // ______ | [ ] 3V3 BAT+[ ] |
whismanoid 0:3edb3708c8c5 93 // ______ | [ ] 1V8 reset SW1 |
whismanoid 0:3edb3708c8c5 94 // ______ | [ ] GND J4 J3 |
whismanoid 0:3edb3708c8c5 95 // analogIn0/4 | [a] AIN_0 1.2Vfs (bat) SYS [ ] | switched BAT+
whismanoid 0:3edb3708c8c5 96 // analogIn1/5 | [a] AIN_1 1.2Vfs PWR [ ] | external pwr btn
whismanoid 0:3edb3708c8c5 97 // analogIn2 | [a] AIN_2 1.2Vfs +5V VBUS [ ] | USB +5V power
whismanoid 13:e36d51f46794 98 // analogIn3 | [a] AIN_3 1.2Vfs 1-WIRE P4_0 [d] | D0 dig9
whismanoid 13:e36d51f46794 99 // (I2C2.SDA) | [d] P5_7 SDA2 SRN P5_6 [d] | D1 dig8
whismanoid 13:e36d51f46794 100 // (I2C2.SCL) | [d] P6_0 SCL2 SDIO3 P5_5 [d] | D2 dig7
whismanoid 13:e36d51f46794 101 // D13/SCLK | [s] P5_0 SCLK SDIO2 P5_4 [d] | D3 dig6
whismanoid 13:e36d51f46794 102 // D11/MOSI | [s] P5_1 MOSI SSEL P5_3 [d] | D4 dig5
whismanoid 13:e36d51f46794 103 // D12/MISO | [s] P5_2 MISO RTS P3_3 [d] | D5 dig4
whismanoid 13:e36d51f46794 104 // D10/CS | [s] P3_0 RX CTS P3_2 [d] | D6 dig3
whismanoid 13:e36d51f46794 105 // D9 dig0 | [d] P3_1 TX SCL P3_5 [d] | D7 dig2
whismanoid 13:e36d51f46794 106 // ______ | [ ] GND SDA P3_4 [d] | D8 dig1
whismanoid 0:3edb3708c8c5 107 // | |
whismanoid 0:3edb3708c8c5 108 // | XIP Flash MAX14690N |
whismanoid 0:3edb3708c8c5 109 // | XIP_SCLK P1_0 SDA2 P5_7 |
whismanoid 0:3edb3708c8c5 110 // | XIP_MOSI P1_1 SCL2 P6_0 |
whismanoid 0:3edb3708c8c5 111 // | XIP_MISO P1_2 PMIC_INIT P3_7 |
whismanoid 0:3edb3708c8c5 112 // | XIP_SSEL P1_3 MPC P2_7 |
whismanoid 0:3edb3708c8c5 113 // | XIP_DIO2 P1_4 MON AIN_0 |
whismanoid 0:3edb3708c8c5 114 // | XIP_DIO3 P1_5 |
whismanoid 0:3edb3708c8c5 115 // | |
whismanoid 0:3edb3708c8c5 116 // | PAN1326B MicroSD LED |
whismanoid 0:3edb3708c8c5 117 // | BT_RX P0_0 SD_SCLK P0_4 r P2_4 |
whismanoid 0:3edb3708c8c5 118 // | BT_TX P0_1 SD_MOSI P0_5 g P2_5 |
whismanoid 0:3edb3708c8c5 119 // | BT_CTS P0_2 SD_MISO P0_6 b P2_6 |
whismanoid 0:3edb3708c8c5 120 // | BT_RTS P0_3 SD_SSEL P0_7 |
whismanoid 0:3edb3708c8c5 121 // | BT_RST P1_6 DETECT P2_2 |
whismanoid 0:3edb3708c8c5 122 // | BT_CLK P1_7 SW2 P2_3 |
whismanoid 0:3edb3708c8c5 123 // +------------------------------------+
whismanoid 0:3edb3708c8c5 124 // 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:3edb3708c8c5 125 // 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:3edb3708c8c5 126 // AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 127 // AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 128 // AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 129 // AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 130 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:3edb3708c8c5 131 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:3edb3708c8c5 132 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:3edb3708c8c5 133 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:3edb3708c8c5 134 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:3edb3708c8c5 135 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:3edb3708c8c5 136 // AIN_10 = x undefined?
whismanoid 0:3edb3708c8c5 137 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:3edb3708c8c5 138 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:3edb3708c8c5 139 //
whismanoid 0:3edb3708c8c5 140 #include "max32630fthr.h"
whismanoid 0:3edb3708c8c5 141 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
whismanoid 0:3edb3708c8c5 142 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:3edb3708c8c5 143 // MAX32630FTHR board supports only internal VREF = 1.200V at bypass capacitor C15
whismanoid 0:3edb3708c8c5 144 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 13:e36d51f46794 145 // Arduino connector
whismanoid 13:e36d51f46794 146 #ifndef A0
whismanoid 13:e36d51f46794 147 #define A0 AIN_0
whismanoid 13:e36d51f46794 148 #endif
whismanoid 13:e36d51f46794 149 #ifndef A1
whismanoid 13:e36d51f46794 150 #define A1 AIN_1
whismanoid 13:e36d51f46794 151 #endif
whismanoid 13:e36d51f46794 152 #ifndef A2
whismanoid 13:e36d51f46794 153 #define A2 AIN_2
whismanoid 13:e36d51f46794 154 #endif
whismanoid 13:e36d51f46794 155 #ifndef A3
whismanoid 13:e36d51f46794 156 #define A3 AIN_3
whismanoid 13:e36d51f46794 157 #endif
whismanoid 13:e36d51f46794 158 #ifndef D0
whismanoid 13:e36d51f46794 159 #define D0 P4_0
whismanoid 13:e36d51f46794 160 #endif
whismanoid 13:e36d51f46794 161 #ifndef D1
whismanoid 13:e36d51f46794 162 #define D1 P5_6
whismanoid 13:e36d51f46794 163 #endif
whismanoid 13:e36d51f46794 164 #ifndef D2
whismanoid 13:e36d51f46794 165 #define D2 P5_5
whismanoid 13:e36d51f46794 166 #endif
whismanoid 13:e36d51f46794 167 #ifndef D3
whismanoid 13:e36d51f46794 168 #define D3 P5_4
whismanoid 13:e36d51f46794 169 #endif
whismanoid 13:e36d51f46794 170 #ifndef D4
whismanoid 13:e36d51f46794 171 #define D4 P5_3
whismanoid 13:e36d51f46794 172 #endif
whismanoid 13:e36d51f46794 173 #ifndef D5
whismanoid 13:e36d51f46794 174 #define D5 P3_3
whismanoid 13:e36d51f46794 175 #endif
whismanoid 13:e36d51f46794 176 #ifndef D6
whismanoid 13:e36d51f46794 177 #define D6 P3_2
whismanoid 13:e36d51f46794 178 #endif
whismanoid 13:e36d51f46794 179 #ifndef D7
whismanoid 13:e36d51f46794 180 #define D7 P3_5
whismanoid 13:e36d51f46794 181 #endif
whismanoid 13:e36d51f46794 182 #ifndef D8
whismanoid 13:e36d51f46794 183 #define D8 P3_4
whismanoid 13:e36d51f46794 184 #endif
whismanoid 13:e36d51f46794 185 #ifndef D9
whismanoid 13:e36d51f46794 186 #define D9 P3_1
whismanoid 13:e36d51f46794 187 #endif
whismanoid 13:e36d51f46794 188 #ifndef D10
whismanoid 13:e36d51f46794 189 #define D10 P3_0
whismanoid 13:e36d51f46794 190 #endif
whismanoid 13:e36d51f46794 191 #ifndef D11
whismanoid 13:e36d51f46794 192 #define D11 P5_1
whismanoid 13:e36d51f46794 193 #endif
whismanoid 13:e36d51f46794 194 #ifndef D12
whismanoid 13:e36d51f46794 195 #define D12 P5_2
whismanoid 13:e36d51f46794 196 #endif
whismanoid 13:e36d51f46794 197 #ifndef D13
whismanoid 13:e36d51f46794 198 #define D13 P5_0
whismanoid 13:e36d51f46794 199 #endif
whismanoid 0:3edb3708c8c5 200 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 201 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:3edb3708c8c5 202 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 203 // TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:3edb3708c8c5 204 // +-------------------------------------+
whismanoid 0:3edb3708c8c5 205 // | MAX32625MBED Arduino UNO header |
whismanoid 0:3edb3708c8c5 206 // | |
whismanoid 0:3edb3708c8c5 207 // | A5/SCL[ ] | P1_7 dig15
whismanoid 0:3edb3708c8c5 208 // | A4/SDA[ ] | P1_6 dig14
whismanoid 0:3edb3708c8c5 209 // | AREF=N/C[ ] |
whismanoid 0:3edb3708c8c5 210 // | GND[ ] |
whismanoid 0:3edb3708c8c5 211 // | [ ]N/C SCK/13[ ] | P1_0 dig13
whismanoid 0:3edb3708c8c5 212 // | [ ]IOREF=3V3 MISO/12[ ] | P1_2 dig12
whismanoid 0:3edb3708c8c5 213 // | [ ]RST MOSI/11[ ]~| P1_1 dig11
whismanoid 0:3edb3708c8c5 214 // | [ ]3V3 CS/10[ ]~| P1_3 dig10
whismanoid 0:3edb3708c8c5 215 // | [ ]5V0 9[ ]~| P1_5 dig9
whismanoid 0:3edb3708c8c5 216 // | [ ]GND 8[ ] | P1_4 dig8
whismanoid 0:3edb3708c8c5 217 // | [ ]GND |
whismanoid 0:3edb3708c8c5 218 // | [ ]Vin 7[ ] | P0_7 dig7
whismanoid 0:3edb3708c8c5 219 // | 6[ ]~| P0_6 dig6
whismanoid 0:3edb3708c8c5 220 // AIN_0 | [ ]A0 5[ ]~| P0_5 dig5
whismanoid 0:3edb3708c8c5 221 // AIN_1 | [ ]A1 4[ ] | P0_4 dig4
whismanoid 0:3edb3708c8c5 222 // AIN_2 | [ ]A2 INT1/3[ ]~| P0_3 dig3
whismanoid 0:3edb3708c8c5 223 // AIN_3 | [ ]A3 INT0/2[ ] | P0_2 dig2
whismanoid 0:3edb3708c8c5 224 // dig16 P3_4 | [ ]A4/SDA RST SCK MISO TX>1[ ] | P0_1 dig1
whismanoid 0:3edb3708c8c5 225 // dig17 P3_5 | [ ]A5/SCL [ ] [ ] [ ] RX<0[ ] | P0_0 dig0
whismanoid 0:3edb3708c8c5 226 // | [ ] [ ] [ ] |
whismanoid 0:3edb3708c8c5 227 // | UNO_R3 GND MOSI 5V ____________/
whismanoid 0:3edb3708c8c5 228 // \_______________________/
whismanoid 0:3edb3708c8c5 229 //
whismanoid 0:3edb3708c8c5 230 // +------------------------+
whismanoid 0:3edb3708c8c5 231 // | |
whismanoid 0:3edb3708c8c5 232 // | MicroSD LED |
whismanoid 0:3edb3708c8c5 233 // | SD_SCLK P2_4 r P3_0 |
whismanoid 0:3edb3708c8c5 234 // | SD_MOSI P2_5 g P3_1 |
whismanoid 0:3edb3708c8c5 235 // | SD_MISO P2_6 b P3_2 |
whismanoid 0:3edb3708c8c5 236 // | SD_SSEL P2_7 y P3_3 |
whismanoid 0:3edb3708c8c5 237 // | |
whismanoid 0:3edb3708c8c5 238 // | DAPLINK BUTTONS |
whismanoid 0:3edb3708c8c5 239 // | TX P2_1 SW3 P2_3 |
whismanoid 0:3edb3708c8c5 240 // | RX P2_0 SW2 P2_2 |
whismanoid 0:3edb3708c8c5 241 // +------------------------+
whismanoid 0:3edb3708c8c5 242 //
whismanoid 0:3edb3708c8c5 243 // AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 244 // AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 245 // AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 246 // AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 247 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:3edb3708c8c5 248 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:3edb3708c8c5 249 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:3edb3708c8c5 250 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:3edb3708c8c5 251 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:3edb3708c8c5 252 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:3edb3708c8c5 253 // AIN_10 = x undefined?
whismanoid 0:3edb3708c8c5 254 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:3edb3708c8c5 255 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:3edb3708c8c5 256 //
whismanoid 0:3edb3708c8c5 257 //#include "max32625mbed.h" // ?
whismanoid 0:3edb3708c8c5 258 //MAX32625MBED mbed(MAX32625MBED::VIO_3V3); // ?
whismanoid 0:3edb3708c8c5 259 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:3edb3708c8c5 260 // MAX32630FTHR board supports only internal VREF = 1.200V at bypass capacitor C15
whismanoid 0:3edb3708c8c5 261 const float ADC_FULL_SCALE_VOLTAGE = 1.200; // TODO: ADC_FULL_SCALE_VOLTAGE Pico?
whismanoid 0:3edb3708c8c5 262 // Arduino connector
whismanoid 0:3edb3708c8c5 263 #ifndef A0
whismanoid 0:3edb3708c8c5 264 #define A0 AIN_0
whismanoid 0:3edb3708c8c5 265 #endif
whismanoid 0:3edb3708c8c5 266 #ifndef A1
whismanoid 0:3edb3708c8c5 267 #define A1 AIN_1
whismanoid 0:3edb3708c8c5 268 #endif
whismanoid 0:3edb3708c8c5 269 #ifndef A2
whismanoid 0:3edb3708c8c5 270 #define A2 AIN_2
whismanoid 0:3edb3708c8c5 271 #endif
whismanoid 0:3edb3708c8c5 272 #ifndef A3
whismanoid 0:3edb3708c8c5 273 #define A3 AIN_3
whismanoid 0:3edb3708c8c5 274 #endif
whismanoid 0:3edb3708c8c5 275 #ifndef D0
whismanoid 0:3edb3708c8c5 276 #define D0 P0_0
whismanoid 0:3edb3708c8c5 277 #endif
whismanoid 0:3edb3708c8c5 278 #ifndef D1
whismanoid 0:3edb3708c8c5 279 #define D1 P0_1
whismanoid 0:3edb3708c8c5 280 #endif
whismanoid 0:3edb3708c8c5 281 #ifndef D2
whismanoid 0:3edb3708c8c5 282 #define D2 P0_2
whismanoid 0:3edb3708c8c5 283 #endif
whismanoid 0:3edb3708c8c5 284 #ifndef D3
whismanoid 0:3edb3708c8c5 285 #define D3 P0_3
whismanoid 0:3edb3708c8c5 286 #endif
whismanoid 0:3edb3708c8c5 287 #ifndef D4
whismanoid 0:3edb3708c8c5 288 #define D4 P0_4
whismanoid 0:3edb3708c8c5 289 #endif
whismanoid 0:3edb3708c8c5 290 #ifndef D5
whismanoid 0:3edb3708c8c5 291 #define D5 P0_5
whismanoid 0:3edb3708c8c5 292 #endif
whismanoid 0:3edb3708c8c5 293 #ifndef D6
whismanoid 0:3edb3708c8c5 294 #define D6 P0_6
whismanoid 0:3edb3708c8c5 295 #endif
whismanoid 0:3edb3708c8c5 296 #ifndef D7
whismanoid 0:3edb3708c8c5 297 #define D7 P0_7
whismanoid 0:3edb3708c8c5 298 #endif
whismanoid 0:3edb3708c8c5 299 #ifndef D8
whismanoid 0:3edb3708c8c5 300 #define D8 P1_4
whismanoid 0:3edb3708c8c5 301 #endif
whismanoid 0:3edb3708c8c5 302 #ifndef D9
whismanoid 0:3edb3708c8c5 303 #define D9 P1_5
whismanoid 0:3edb3708c8c5 304 #endif
whismanoid 0:3edb3708c8c5 305 #ifndef D10
whismanoid 0:3edb3708c8c5 306 #define D10 P1_3
whismanoid 0:3edb3708c8c5 307 #endif
whismanoid 0:3edb3708c8c5 308 #ifndef D11
whismanoid 0:3edb3708c8c5 309 #define D11 P1_1
whismanoid 0:3edb3708c8c5 310 #endif
whismanoid 0:3edb3708c8c5 311 #ifndef D12
whismanoid 0:3edb3708c8c5 312 #define D12 P1_2
whismanoid 0:3edb3708c8c5 313 #endif
whismanoid 0:3edb3708c8c5 314 #ifndef D13
whismanoid 0:3edb3708c8c5 315 #define D13 P1_0
whismanoid 0:3edb3708c8c5 316 #endif
whismanoid 0:3edb3708c8c5 317 //--------------------------------------------------
whismanoid 11:9fa2402071de 318 #elif defined(TARGET_MAX32600)
whismanoid 11:9fa2402071de 319 // target MAX32600
whismanoid 11:9fa2402071de 320 //
whismanoid 11:9fa2402071de 321 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 11:9fa2402071de 322 const float ADC_FULL_SCALE_VOLTAGE = 1.500;
whismanoid 11:9fa2402071de 323 //
whismanoid 11:9fa2402071de 324 //--------------------------------------------------
whismanoid 16:3c75011e705a 325 #elif defined(TARGET_MAX32620FTHR)
whismanoid 16:3c75011e705a 326 #warning "TARGET_MAX32620FTHR not previously tested; need to define pins..."
whismanoid 17:bf4efc8f5eee 327 #include "MAX32620FTHR.h"
whismanoid 17:bf4efc8f5eee 328 // Initialize I/O voltages on MAX32620FTHR board
whismanoid 17:bf4efc8f5eee 329 MAX32620FTHR fthr(MAX32620FTHR::VIO_3V3);
whismanoid 16:3c75011e705a 330 //#define USE_LEDS 0 ?
whismanoid 16:3c75011e705a 331 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 16:3c75011e705a 332 #warning "TARGET_MAX32620FTHR not previously tested; need to verify ADC_FULL_SCALE_VOLTAGE..."
whismanoid 16:3c75011e705a 333 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 16:3c75011e705a 334 //
whismanoid 16:3c75011e705a 335 //--------------------------------------------------
whismanoid 16:3c75011e705a 336 #elif defined(TARGET_MAX32625PICO)
whismanoid 16:3c75011e705a 337 #warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
whismanoid 16:3c75011e705a 338 //#define USE_LEDS 0 ?
whismanoid 16:3c75011e705a 339 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 18:14afc2a2150f 340 #warning "TARGET_MAX32625PICO not previously tested; need to verify ADC_FULL_SCALE_VOLTAGE..."
whismanoid 16:3c75011e705a 341 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 16:3c75011e705a 342 //
whismanoid 16:3c75011e705a 343 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 344 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:3edb3708c8c5 345 // TODO1: target NUCLEO_F446RE
whismanoid 0:3edb3708c8c5 346 //
whismanoid 0:3edb3708c8c5 347 // USER_BUTTON PC13
whismanoid 0:3edb3708c8c5 348 // LED1 is shared with SPI_SCK on NUCLEO_F446RE PA_5, so don't use LED1.
whismanoid 0:3edb3708c8c5 349 #define USE_LEDS 0
whismanoid 0:3edb3708c8c5 350 // SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK);
whismanoid 7:bf501f8cb637 351 // Serial serial(SERIAL_TX, SERIAL_RX);
whismanoid 0:3edb3708c8c5 352 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:3edb3708c8c5 353 const float ADC_FULL_SCALE_VOLTAGE = 3.300; // TODO: ADC_FULL_SCALE_VOLTAGE Pico?
whismanoid 0:3edb3708c8c5 354 //
whismanoid 0:3edb3708c8c5 355 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 356 #elif defined(TARGET_LPC1768)
whismanoid 0:3edb3708c8c5 357 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 358 // TARGET=LPC1768 ARM Cortex-M3 100 MHz 512kB flash 64kB SRAM
whismanoid 0:3edb3708c8c5 359 // +-------------[microUSB]-------------+
whismanoid 0:3edb3708c8c5 360 // ______ | [ ] GND +3.3V VOUT [ ] | ______
whismanoid 0:3edb3708c8c5 361 // ______ | [ ] 4.5V<VIN<9.0V +5.0V VU [ ] | ______
whismanoid 0:3edb3708c8c5 362 // ______ | [ ] VB USB.IF- [ ] | ______
whismanoid 0:3edb3708c8c5 363 // ______ | [ ] nR USB.IF+ [ ] | ______
whismanoid 0:3edb3708c8c5 364 // digitalInOut0 | [ ] p5 MOSI ETHERNET.RD- [ ] | ______
whismanoid 0:3edb3708c8c5 365 // digitalInOut1 | [ ] p6 MISO ETHERNET.RD+ [ ] | ______
whismanoid 0:3edb3708c8c5 366 // digitalInOut2 | [ ] p7 SCLK ETHERNET.TD- [ ] | ______
whismanoid 0:3edb3708c8c5 367 // digitalInOut3 | [ ] p8 ETHERNET.TD+ [ ] | ______
whismanoid 0:3edb3708c8c5 368 // digitalInOut4 | [ ] p9 TX SDA USB.D- [ ] | ______
whismanoid 0:3edb3708c8c5 369 // digitalInOut5 | [ ] p10 RX SCL USB.D+ [ ] | ______
whismanoid 0:3edb3708c8c5 370 // digitalInOut6 | [ ] p11 MOSI CAN-RD p30 [ ] | digitalInOut13
whismanoid 0:3edb3708c8c5 371 // digitalInOut7 | [ ] p12 MISO CAN-TD p29 [ ] | digitalInOut12
whismanoid 0:3edb3708c8c5 372 // digitalInOut8 | [ ] p13 TX SCLK SDA TX p28 [ ] | digitalInOut11
whismanoid 0:3edb3708c8c5 373 // digitalInOut9 | [ ] p14 RX SCL RX p27 [ ] | digitalInOut10
whismanoid 0:3edb3708c8c5 374 // analogIn0 | [ ] p15 AIN0 3.3Vfs PWM1 p26 [ ] | pwmDriver1
whismanoid 0:3edb3708c8c5 375 // analogIn1 | [ ] p16 AIN1 3.3Vfs PWM2 p25 [ ] | pwmDriver2
whismanoid 0:3edb3708c8c5 376 // analogIn2 | [ ] p17 AIN2 3.3Vfs PWM3 p24 [ ] | pwmDriver3
whismanoid 0:3edb3708c8c5 377 // analogIn3 | [ ] p18 AIN3 AOUT PWM4 p23 [ ] | pwmDriver4
whismanoid 0:3edb3708c8c5 378 // analogIn4 | [ ] p19 AIN4 3.3Vfs PWM5 p22 [ ] | pwmDriver5
whismanoid 0:3edb3708c8c5 379 // analogIn5 | [ ] p20 AIN5 3.3Vfs PWM6 p21 [ ] | pwmDriver6
whismanoid 0:3edb3708c8c5 380 // +------------------------------------+
whismanoid 0:3edb3708c8c5 381 // AIN6 = P0.3 = TGT_SBL_RXD?
whismanoid 0:3edb3708c8c5 382 // AIN7 = P0.2 = TGT_SBL_TXD?
whismanoid 0:3edb3708c8c5 383 //
whismanoid 0:3edb3708c8c5 384 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 385 // LPC1768 board uses VREF = 3.300V +A3,3V thru L1 to bypass capacitor C14
whismanoid 0:3edb3708c8c5 386 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:3edb3708c8c5 387 const float ADC_FULL_SCALE_VOLTAGE = 3.300;
whismanoid 0:3edb3708c8c5 388 #else // not defined(TARGET_LPC1768 etc.)
whismanoid 0:3edb3708c8c5 389 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 390 // unknown target
whismanoid 0:3edb3708c8c5 391 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 392 #endif // target definition
whismanoid 0:3edb3708c8c5 393
whismanoid 0:3edb3708c8c5 394
whismanoid 0:3edb3708c8c5 395 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 396 // alphanumeric command codes A-Z,a-z,0-9 reserved for application use
whismanoid 0:3edb3708c8c5 397 #ifndef APPLICATION_ArduinoPinsMonitor
whismanoid 0:3edb3708c8c5 398 #define APPLICATION_ArduinoPinsMonitor 1
whismanoid 0:3edb3708c8c5 399 #endif // APPLICATION_ArduinoPinsMonitor
whismanoid 0:3edb3708c8c5 400
whismanoid 0:3edb3708c8c5 401 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 402 // Support MAX5715BOB Breakout Board
whismanoid 0:3edb3708c8c5 403 #ifndef APPLICATION_MAX5715
whismanoid 0:3edb3708c8c5 404 #define APPLICATION_MAX5715 1
whismanoid 0:3edb3708c8c5 405 #endif // APPLICATION_MAX5715
whismanoid 0:3edb3708c8c5 406 #if APPLICATION_MAX5715 // header file
whismanoid 0:3edb3708c8c5 407 #include "MAX5715.h"
whismanoid 0:3edb3708c8c5 408 // suppress the I2C diagnostics, not relevant to this chip
whismanoid 0:3edb3708c8c5 409 #define HAS_I2C 0
whismanoid 0:3edb3708c8c5 410 #endif // APPLICATION_MAX5715
whismanoid 0:3edb3708c8c5 411
whismanoid 0:3edb3708c8c5 412 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 413 // Support MAX11131BOB Breakout Board
whismanoid 0:3edb3708c8c5 414 #ifndef APPLICATION_MAX11131
whismanoid 0:3edb3708c8c5 415 #define APPLICATION_MAX11131 0
whismanoid 0:3edb3708c8c5 416 #endif // APPLICATION_MAX11131
whismanoid 0:3edb3708c8c5 417 #if APPLICATION_MAX11131 // header file
whismanoid 0:3edb3708c8c5 418 #include "MAX11131.h"
whismanoid 0:3edb3708c8c5 419 // suppress the I2C diagnostics, not relevant to this chip
whismanoid 0:3edb3708c8c5 420 #define HAS_I2C 0
whismanoid 0:3edb3708c8c5 421 #endif // APPLICATION_MAX11131
whismanoid 0:3edb3708c8c5 422
whismanoid 0:3edb3708c8c5 423 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 424 // Support MAX5171BOB Breakout Board
whismanoid 0:3edb3708c8c5 425 #ifndef APPLICATION_MAX5171
whismanoid 0:3edb3708c8c5 426 #define APPLICATION_MAX5171 0
whismanoid 0:3edb3708c8c5 427 #endif // APPLICATION_MAX5171
whismanoid 0:3edb3708c8c5 428 #if APPLICATION_MAX5171 // header file
whismanoid 0:3edb3708c8c5 429 #include "MAX5171.h"
whismanoid 0:3edb3708c8c5 430 // suppress the I2C diagnostics, not relevant to this chip
whismanoid 0:3edb3708c8c5 431 #define HAS_I2C 0
whismanoid 0:3edb3708c8c5 432 #endif // APPLICATION_MAX5171
whismanoid 0:3edb3708c8c5 433
whismanoid 0:3edb3708c8c5 434 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 435 // Support MAX11410BOB Breakout Board (placeholder)
whismanoid 0:3edb3708c8c5 436 #ifndef APPLICATION_MAX11410
whismanoid 0:3edb3708c8c5 437 #define APPLICATION_MAX11410 0
whismanoid 0:3edb3708c8c5 438 #endif // APPLICATION_MAX11410
whismanoid 0:3edb3708c8c5 439 #if APPLICATION_MAX11410 // header file
whismanoid 0:3edb3708c8c5 440 #include "MAX11410.h"
whismanoid 15:2c21eaa9188b 441 #define HAS_I2C 0
whismanoid 0:3edb3708c8c5 442 #endif // APPLICATION_MAX11410
whismanoid 0:3edb3708c8c5 443
whismanoid 0:3edb3708c8c5 444 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 445 // Support MAX12345BOB Breakout Board (placeholder)
whismanoid 0:3edb3708c8c5 446 #ifndef APPLICATION_MAX12345
whismanoid 0:3edb3708c8c5 447 #define APPLICATION_MAX12345 0
whismanoid 0:3edb3708c8c5 448 #endif // APPLICATION_MAX12345
whismanoid 0:3edb3708c8c5 449 #if APPLICATION_MAX12345 // header file
whismanoid 0:3edb3708c8c5 450 #include "MAX12345.h"
whismanoid 15:2c21eaa9188b 451 #define HAS_I2C 0
whismanoid 0:3edb3708c8c5 452 #endif // APPLICATION_MAX12345
whismanoid 0:3edb3708c8c5 453
whismanoid 0:3edb3708c8c5 454
whismanoid 0:3edb3708c8c5 455 #include "MAX541.h"
whismanoid 0:3edb3708c8c5 456
whismanoid 0:3edb3708c8c5 457 #include "MaximTinyTester.h"
whismanoid 0:3edb3708c8c5 458
whismanoid 0:3edb3708c8c5 459 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 460 // Option to dedicate SPI port pins
whismanoid 0:3edb3708c8c5 461 //
whismanoid 0:3edb3708c8c5 462 // SPI2_MOSI = P5_1
whismanoid 0:3edb3708c8c5 463 // SPI2_MISO = P5_2
whismanoid 0:3edb3708c8c5 464 // SPI2_SCK = P5_0
whismanoid 0:3edb3708c8c5 465 // On this board I'm using P3_0 as spi_cs
whismanoid 0:3edb3708c8c5 466 // SPI2_SS = P5_3
whismanoid 0:3edb3708c8c5 467 // SPI2_SDIO2 = P5_4
whismanoid 0:3edb3708c8c5 468 // SPI2_SDIO3 = P5_5
whismanoid 0:3edb3708c8c5 469 // SPI2_SRN = P5_6
whismanoid 0:3edb3708c8c5 470 //
whismanoid 0:3edb3708c8c5 471 #ifndef HAS_SPI
whismanoid 0:3edb3708c8c5 472 #define HAS_SPI 1
whismanoid 0:3edb3708c8c5 473 #endif
whismanoid 0:3edb3708c8c5 474 #if HAS_SPI
whismanoid 0:3edb3708c8c5 475 #define SPI_MODE0 0
whismanoid 0:3edb3708c8c5 476 #define SPI_MODE1 1
whismanoid 0:3edb3708c8c5 477 #define SPI_MODE2 2
whismanoid 0:3edb3708c8c5 478 #define SPI_MODE3 3
whismanoid 0:3edb3708c8c5 479 //
whismanoid 0:3edb3708c8c5 480 // Define application-specific default SPI_SCLK_Hz and SPI_dataMode
whismanoid 0:3edb3708c8c5 481 #if APPLICATION_MAX5715 // SPI interface default settings
whismanoid 0:3edb3708c8c5 482 //
whismanoid 0:3edb3708c8c5 483 //#define SPI_SCLK_Hz 48000000 // 48MHz
whismanoid 0:3edb3708c8c5 484 //#define SPI_SCLK_Hz 24000000 // 24MHz
whismanoid 0:3edb3708c8c5 485 #define SPI_SCLK_Hz 12000000 // 12MHz
whismanoid 0:3edb3708c8c5 486 //#define SPI_SCLK_Hz 4000000 // 4MHz
whismanoid 0:3edb3708c8c5 487 //#define SPI_SCLK_Hz 2000000 // 2MHz
whismanoid 0:3edb3708c8c5 488 //#define SPI_SCLK_Hz 1000000 // 1MHz
whismanoid 0:3edb3708c8c5 489 #define SPI_dataMode SPI_MODE2 // CPOL=1,CPHA=0: Falling Edge stable; SCLK idle High
whismanoid 0:3edb3708c8c5 490 //
whismanoid 0:3edb3708c8c5 491 #elif APPLICATION_MAX11131 // SPI interface default settings
whismanoid 0:3edb3708c8c5 492 //
whismanoid 0:3edb3708c8c5 493 //#define SPI_SCLK_Hz 48000000 // 48MHz
whismanoid 0:3edb3708c8c5 494 //#define SPI_SCLK_Hz 24000000 // 24MHz
whismanoid 0:3edb3708c8c5 495 #define SPI_SCLK_Hz 12000000 // 12MHz
whismanoid 0:3edb3708c8c5 496 //#define SPI_SCLK_Hz 4000000 // 4MHz
whismanoid 0:3edb3708c8c5 497 //#define SPI_SCLK_Hz 2000000 // 2MHz
whismanoid 0:3edb3708c8c5 498 //#define SPI_SCLK_Hz 1000000 // 1MHz
whismanoid 0:3edb3708c8c5 499 #define SPI_dataMode SPI_MODE3 // CPOL=1,CPHA=1: Rising Edge stable; SCLK idle High
whismanoid 0:3edb3708c8c5 500 //
whismanoid 0:3edb3708c8c5 501 #elif APPLICATION_MAX5171 // SPI interface default settings
whismanoid 0:3edb3708c8c5 502 //
whismanoid 0:3edb3708c8c5 503 //#define SPI_SCLK_Hz 48000000 // 48MHz
whismanoid 0:3edb3708c8c5 504 //#define SPI_SCLK_Hz 24000000 // 24MHz
whismanoid 0:3edb3708c8c5 505 #define SPI_SCLK_Hz 12000000 // 12MHz
whismanoid 0:3edb3708c8c5 506 //#define SPI_SCLK_Hz 4000000 // 4MHz
whismanoid 0:3edb3708c8c5 507 //#define SPI_SCLK_Hz 2000000 // 2MHz
whismanoid 0:3edb3708c8c5 508 //#define SPI_SCLK_Hz 1000000 // 1MHz
whismanoid 0:3edb3708c8c5 509 #define SPI_dataMode SPI_MODE3 // CPOL=1,CPHA=1: Rising Edge stable; SCLK idle High
whismanoid 0:3edb3708c8c5 510 //
whismanoid 0:3edb3708c8c5 511 #elif APPLICATION_MAX11410 // SPI interface default settings
whismanoid 0:3edb3708c8c5 512 //
whismanoid 0:3edb3708c8c5 513 //#define SPI_SCLK_Hz 48000000 // 48MHz
whismanoid 0:3edb3708c8c5 514 //#define SPI_SCLK_Hz 24000000 // 24MHz
whismanoid 0:3edb3708c8c5 515 //#define SPI_SCLK_Hz 12000000 // 12MHz
whismanoid 0:3edb3708c8c5 516 #define SPI_SCLK_Hz 8000000 // 8MHz
whismanoid 0:3edb3708c8c5 517 //#define SPI_SCLK_Hz 4000000 // 4MHz
whismanoid 0:3edb3708c8c5 518 //#define SPI_SCLK_Hz 2000000 // 2MHz
whismanoid 0:3edb3708c8c5 519 //#define SPI_SCLK_Hz 1000000 // 1MHz
whismanoid 0:3edb3708c8c5 520 #define SPI_dataMode SPI_MODE0 // CPOL=0,CPHA=0: Falling Edge stable; SCLK idle Low
whismanoid 0:3edb3708c8c5 521 //
whismanoid 0:3edb3708c8c5 522 #elif APPLICATION_MAX12345 // SPI interface default settings
whismanoid 0:3edb3708c8c5 523 //
whismanoid 0:3edb3708c8c5 524 //#define SPI_SCLK_Hz 48000000 // 48MHz
whismanoid 0:3edb3708c8c5 525 //#define SPI_SCLK_Hz 24000000 // 24MHz
whismanoid 0:3edb3708c8c5 526 #define SPI_SCLK_Hz 12000000 // 12MHz
whismanoid 0:3edb3708c8c5 527 //#define SPI_SCLK_Hz 4000000 // 4MHz
whismanoid 0:3edb3708c8c5 528 //#define SPI_SCLK_Hz 2000000 // 2MHz
whismanoid 0:3edb3708c8c5 529 //#define SPI_SCLK_Hz 1000000 // 1MHz
whismanoid 0:3edb3708c8c5 530 #define SPI_dataMode SPI_MODE3 // CPOL=1,CPHA=1: Rising Edge stable; SCLK idle High
whismanoid 0:3edb3708c8c5 531 //
whismanoid 0:3edb3708c8c5 532 #else // APPLICATION_ArduinoPinsMonitor diagnostic
whismanoid 0:3edb3708c8c5 533 //
whismanoid 0:3edb3708c8c5 534 //#define SPI_SCLK_Hz 48000000 // 48MHz
whismanoid 0:3edb3708c8c5 535 //#define SPI_SCLK_Hz 4000000 // 4MHz
whismanoid 0:3edb3708c8c5 536 //#define SPI_SCLK_Hz 2000000 // 2MHz
whismanoid 0:3edb3708c8c5 537 #define SPI_SCLK_Hz 1000000 // 1MHz
whismanoid 0:3edb3708c8c5 538 //#define SPI_dataMode SPI_MODE0 // CPOL=0,CPHA=0: Rising Edge stable; SCLK idle Low
whismanoid 0:3edb3708c8c5 539 //#define SPI_dataMode SPI_MODE1 // CPOL=0,CPHA=1: Falling Edge stable; SCLK idle Low
whismanoid 0:3edb3708c8c5 540 //#define SPI_dataMode SPI_MODE2 // CPOL=1,CPHA=0: Falling Edge stable; SCLK idle High
whismanoid 0:3edb3708c8c5 541 #define SPI_dataMode SPI_MODE3 // CPOL=1,CPHA=1: Rising Edge stable; SCLK idle High
whismanoid 0:3edb3708c8c5 542 //
whismanoid 0:3edb3708c8c5 543 #endif
whismanoid 0:3edb3708c8c5 544 //
whismanoid 14:cbe972986136 545 #if defined(TARGET_MAX32630)
whismanoid 14:cbe972986136 546 // Before setting global variables g_SPI_SCLK_Hz and g_SPI_dataMode,
whismanoid 14:cbe972986136 547 // workaround for TARGET_MAX32630 SPI_MODE2 SPI_MODE3 problem (issue #30)
whismanoid 14:cbe972986136 548 #warning "MAX32630 SPI workaround..."
whismanoid 14:cbe972986136 549 // replace SPI_MODE2 (CPOL=1,CPHA=0) with SPI_MODE1 (CPOL=0,CPHA=1) Falling Edge stable
whismanoid 14:cbe972986136 550 // replace SPI_MODE3 (CPOL=1,CPHA=1) with SPI_MODE0 (CPOL=0,CPHA=0) Rising Edge stable
whismanoid 14:cbe972986136 551 # if ((SPI_dataMode) == (SPI_MODE2))
whismanoid 14:cbe972986136 552 #warning "MAX32630 SPI_MODE2 workaround, changing SPI_dataMode to SPI_MODE1..."
whismanoid 14:cbe972986136 553 // SPI_dataMode SPI_MODE2 // CPOL=1,CPHA=0: Falling Edge stable; SCLK idle High
whismanoid 14:cbe972986136 554 # undef SPI_dataMode
whismanoid 14:cbe972986136 555 # define SPI_dataMode SPI_MODE1 // CPOL=0,CPHA=1: Falling Edge stable; SCLK idle Low
whismanoid 14:cbe972986136 556 # elif ((SPI_dataMode) == (SPI_MODE3))
whismanoid 14:cbe972986136 557 #warning "MAX32630 SPI_MODE3 workaround, changing SPI_dataMode to SPI_MODE0..."
whismanoid 14:cbe972986136 558 // SPI_dataMode SPI_MODE3 // CPOL=1,CPHA=1: Rising Edge stable; SCLK idle High
whismanoid 14:cbe972986136 559 # undef SPI_dataMode
whismanoid 14:cbe972986136 560 # define SPI_dataMode SPI_MODE0 // CPOL=0,CPHA=0: Rising Edge stable; SCLK idle Low
whismanoid 14:cbe972986136 561 # endif // workaround for TARGET_MAX32630 SPI_MODE2 SPI_MODE3 problem
whismanoid 14:cbe972986136 562 // workaround for TARGET_MAX32630 SPI_MODE2 SPI_MODE3 problem (issue #30)
whismanoid 14:cbe972986136 563 // limit SPI SCLK speed to 6MHz or less
whismanoid 14:cbe972986136 564 # if ((SPI_SCLK_Hz) > (6000000))
whismanoid 14:cbe972986136 565 #warning "MAX32630 SPI speed workaround, changing SPI_SCLK_Hz to 6000000 or 6MHz..."
whismanoid 14:cbe972986136 566 # undef SPI_SCLK_Hz
whismanoid 14:cbe972986136 567 # define SPI_SCLK_Hz 6000000 // 6MHz
whismanoid 14:cbe972986136 568 # endif
whismanoid 14:cbe972986136 569 #endif
whismanoid 14:cbe972986136 570 //
whismanoid 0:3edb3708c8c5 571 uint32_t g_SPI_SCLK_Hz = SPI_SCLK_Hz;
whismanoid 0:3edb3708c8c5 572 // TODO1: validate g_SPI_SCLK_Hz against system clock frequency SystemCoreClock F_CPU
whismanoid 0:3edb3708c8c5 573 #if defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:3edb3708c8c5 574 // Nucleo SPI frequency isn't working quite as expected...
whismanoid 0:3edb3708c8c5 575 // Looks like STMF4 has an spi clock prescaler (2,4,8,16,32,64,128,256)
whismanoid 0:3edb3708c8c5 576 // so 180MHz->[90.0, 45.0, 22.5, 11.25, 5.625, 2.8125, 1.40625, 0.703125]
whismanoid 0:3edb3708c8c5 577 // %SC SCLK=1MHz sets spi frequency 703.125kHz
whismanoid 0:3edb3708c8c5 578 // %SC SCLK=2MHz sets spi frequency 1.40625MHz
whismanoid 0:3edb3708c8c5 579 // %SC SCLK=3MHz sets spi frequency 2.8125MHz
whismanoid 0:3edb3708c8c5 580 // %SC SCLK=6MHz sets spi frequency 5.625MHz
whismanoid 0:3edb3708c8c5 581 // %SC SCLK=12MHz sets spi frequency 11.25MHz
whismanoid 0:3edb3708c8c5 582 // %SC SCLK=23MHz sets spi frequency 22.5MHz
whismanoid 0:3edb3708c8c5 583 // %SC SCLK=45MHz sets spi frequency 45.0MHz
whismanoid 0:3edb3708c8c5 584 // Don't know why I can't reach spi frequency 90.0MHz, but ok whatever.
whismanoid 0:3edb3708c8c5 585 const uint32_t limit_min_SPI_SCLK_divisor = 2;
whismanoid 0:3edb3708c8c5 586 const uint32_t limit_max_SPI_SCLK_divisor = 256;
whismanoid 0:3edb3708c8c5 587 // not really a divisor, just a powers-of-two prescaler with no intermediate divisors.
whismanoid 0:3edb3708c8c5 588 #else
whismanoid 0:3edb3708c8c5 589 const uint32_t limit_min_SPI_SCLK_divisor = 2;
whismanoid 0:3edb3708c8c5 590 const uint32_t limit_max_SPI_SCLK_divisor = 8191;
whismanoid 0:3edb3708c8c5 591 #endif
whismanoid 0:3edb3708c8c5 592 const uint32_t limit_max_SPI_SCLK_Hz = (SystemCoreClock / limit_min_SPI_SCLK_divisor); // F_CPU / 2; // 8MHz / 2 = 4MHz
whismanoid 0:3edb3708c8c5 593 const uint32_t limit_min_SPI_SCLK_Hz = (SystemCoreClock / limit_max_SPI_SCLK_divisor); // F_CPU / 128; // 8MHz / 128 = 62.5kHz
whismanoid 0:3edb3708c8c5 594 //
whismanoid 0:3edb3708c8c5 595 uint8_t g_SPI_dataMode = SPI_dataMode;
whismanoid 0:3edb3708c8c5 596 uint8_t g_SPI_cs_state = 1;
whismanoid 0:3edb3708c8c5 597 //
whismanoid 0:3edb3708c8c5 598 #if defined(TARGET_MAX32630)
whismanoid 0:3edb3708c8c5 599 // TODO1: avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:3edb3708c8c5 600 // void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
whismanoid 0:3edb3708c8c5 601 //SPI spi0(SPI0_MOSI, SPI0_MISO, SPI0_SCK); // mosi, miso, sclk spi0 MAX32630FTHR: P0_5 P0_6 P0_4 ok but this is the microSD card, can't contact pins
whismanoid 0:3edb3708c8c5 602 //SPI spi1(SPI1_MOSI, SPI1_MISO, SPI1_SCK); // mosi, miso, sclk spi1 MAX32630FTHR: P1_1 P1_2 P1_0 ok but this is the xip flash, can't contact pins
whismanoid 0:3edb3708c8c5 603 //SPI spi2(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi2 MAX32630FTHR: P5_1, P5_2, P5_0
whismanoid 0:3edb3708c8c5 604 SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi2 MAX32630FTHR: P5_1, P5_2, P5_0
whismanoid 0:3edb3708c8c5 605 //
whismanoid 0:3edb3708c8c5 606 DigitalOut spi_cs(P3_0);
whismanoid 0:3edb3708c8c5 607 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:3edb3708c8c5 608 // TODO1: avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:3edb3708c8c5 609 // void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
whismanoid 0:3edb3708c8c5 610 //SPI spi(SPI0_MOSI, SPI0_MISO, SPI0_SCK); // mosi, miso, sclk spi0 TARGET_MAX32635MBED: P0_5 P0_6 P0_4 Arduino 8-pin header D5 D6 D7
whismanoid 0:3edb3708c8c5 611 //DigitalOut spi_cs(SPI0_SS); // TARGET_MAX32635MBED: P0_7 Arduino 8-pin header D4
whismanoid 0:3edb3708c8c5 612 SPI spi(SPI1_MOSI, SPI1_MISO, SPI1_SCK); // mosi, miso, sclk spi1 TARGET_MAX32635MBED: P1_1 P1_2 P1_0 Arduino 10-pin header D11 D12 D13
whismanoid 0:3edb3708c8c5 613 DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32635MBED: P1_3 Arduino 10-pin header D10
whismanoid 0:3edb3708c8c5 614 SPI spi2_max541(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi2 TARGET_MAX32635MBED: P2_5 P2_6 P2_4 Arduino 2x3-pin header; microSD
whismanoid 0:3edb3708c8c5 615 DigitalOut spi2_max541_cs(SPI2_SS); // TARGET_MAX32635MBED: P2_7 Arduino 2x3-pin header
whismanoid 0:3edb3708c8c5 616 #define HAS_SPI2_MAX541 1
whismanoid 0:3edb3708c8c5 617 //
whismanoid 16:3c75011e705a 618 #elif defined(TARGET_MAX32620FTHR)
whismanoid 16:3c75011e705a 619 #warning "TARGET_MAX32620FTHR not previously tested; need to define SPI pins..."
whismanoid 16:3c75011e705a 620 //
whismanoid 16:3c75011e705a 621 // SPI0 P0_ PMOD Port 0 Back access
whismanoid 16:3c75011e705a 622 //SPI spi0(SPI0_MOSI, SPI0_MISO, SPI0_SCK); // mosi, miso, sclk spi1 TARGET_MAX32620FTHR: PMOD Port 0 Back access
whismanoid 16:3c75011e705a 623 //DigitalOut spi_cs0(SPI0_SS); // TARGET_MAX32620FTHR: PMOD Port 0 Back access
whismanoid 16:3c75011e705a 624 //
whismanoid 16:3c75011e705a 625 // SPI1 P1_ PMOD Port 1 Top Access
whismanoid 16:3c75011e705a 626 SPI spi(SPI1_MOSI, SPI1_MISO, SPI1_SCK); // mosi, miso, sclk spi1 TARGET_MAX32620FTHR: PMOD Port 1 Top Access
whismanoid 16:3c75011e705a 627 DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32620FTHR: PMOD Port 1 Top Access
whismanoid 16:3c75011e705a 628 //
whismanoid 16:3c75011e705a 629 // SPI2 P5_ Feather J1.11,12,13
whismanoid 16:3c75011e705a 630 //SPI spi2(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi1 TARGET_MAX32620FTHR: Feather J1.11,12,13
whismanoid 16:3c75011e705a 631 //DigitalOut spi_cs2(SPI2_SS); // TARGET_MAX32620FTHR: Feather J1.11,12,13
whismanoid 16:3c75011e705a 632 //
whismanoid 16:3c75011e705a 633 #elif defined(TARGET_MAX32625PICO)
whismanoid 16:3c75011e705a 634 #warning "TARGET_MAX32625PICO not previously tested; need to define SPI pins..."
whismanoid 16:3c75011e705a 635 // Note to software maintainer:
whismanoid 16:3c75011e705a 636 // when adding new platform support,
whismanoid 16:3c75011e705a 637 // add another #elif block above to support the new platform
whismanoid 16:3c75011e705a 638 SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625PICO: 15 P0_5 MOSI; 14 P0_6 MISO; 16 P0_4 SCLK
whismanoid 16:3c75011e705a 639 DigitalOut spi_cs(SPI_SS); // TARGET_MAX32625PICO: 13 P0_7 SSEL
whismanoid 16:3c75011e705a 640 //
whismanoid 11:9fa2402071de 641 #elif defined(TARGET_MAX32600)
whismanoid 11:9fa2402071de 642 SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
whismanoid 11:9fa2402071de 643 DigitalOut spi_cs(SPI2_SS); // Generic: Arduino 10-pin header D10
whismanoid 11:9fa2402071de 644 //
whismanoid 0:3edb3708c8c5 645 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:3edb3708c8c5 646 // TODO1: avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:3edb3708c8c5 647 // void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
whismanoid 0:3edb3708c8c5 648 //
whismanoid 0:3edb3708c8c5 649 // TODO1: NUCLEO_F446RE SPI not working; CS and MOSI data looks OK but no SCLK clock pulses.
whismanoid 0:3edb3708c8c5 650 SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK); // mosi, miso, sclk spi1 TARGET_NUCLEO_F446RE: Arduino 10-pin header D11 D12 D13
whismanoid 0:3edb3708c8c5 651 DigitalOut spi_cs(SPI_CS); // TARGET_NUCLEO_F446RE: PB_6 Arduino 10-pin header D10
whismanoid 0:3edb3708c8c5 652 //
whismanoid 0:3edb3708c8c5 653 #elif defined(TARGET_LPC1768)
whismanoid 0:3edb3708c8c5 654 // TODO1: avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:3edb3708c8c5 655 // void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
whismanoid 0:3edb3708c8c5 656 //SPI spi0(SPI0_MOSI, SPI0_MISO, SPI0_SCK); // mosi, miso, sclk spi0 MAX32630FTHR: P0_5 P0_6 P0_4 ok but this is the microSD card, can't contact pins
whismanoid 0:3edb3708c8c5 657 //SPI spi1(SPI1_MOSI, SPI1_MISO, SPI1_SCK); // mosi, miso, sclk spi1 MAX32630FTHR: P1_1 P1_2 P1_0 ok but this is the xip flash, can't contact pins
whismanoid 0:3edb3708c8c5 658 //SPI spi2(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi2 MAX32630FTHR: P5_1, P5_2, P5_0
whismanoid 0:3edb3708c8c5 659 SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi2 MAX32630FTHR: P5_1, P5_2, P5_0
whismanoid 0:3edb3708c8c5 660 //
whismanoid 0:3edb3708c8c5 661 DigitalOut spi_cs(P3_0);
whismanoid 16:3c75011e705a 662 //
whismanoid 0:3edb3708c8c5 663 #else
whismanoid 0:3edb3708c8c5 664 // unknown target
whismanoid 16:3c75011e705a 665 #warning "target not previously tested; need to define SPI pins..."
whismanoid 16:3c75011e705a 666 // Note to software maintainer:
whismanoid 16:3c75011e705a 667 // when adding new platform support,
whismanoid 16:3c75011e705a 668 // add another #elif block above to support the new platform
whismanoid 16:3c75011e705a 669 //SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK); // mosi, miso, sclk spi1 TARGET_xxx: Arduino 10-pin header D11 D12 D13
whismanoid 16:3c75011e705a 670 //DigitalOut spi_cs(SPI_CS); // TARGET_xxx: PX_x Arduino 10-pin header D10
whismanoid 0:3edb3708c8c5 671 #endif
whismanoid 0:3edb3708c8c5 672 #endif
whismanoid 0:3edb3708c8c5 673
whismanoid 0:3edb3708c8c5 674 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 675 // Device driver object
whismanoid 0:3edb3708c8c5 676 #if APPLICATION_MAX5715 // SPI interface default settings
whismanoid 0:3edb3708c8c5 677 DigitalOut LDACb_pin(D9); // Arduino 10-pin header D9
whismanoid 0:3edb3708c8c5 678 DigitalOut CLRb_pin(D8); // Arduino 10-pin header D8
whismanoid 0:3edb3708c8c5 679 //~ DigitalIn RDYb_pin(D12); // Arduino 10-pin header D12 (MISO)
whismanoid 0:3edb3708c8c5 680 MAX5715 g_MAX5715_device(spi, spi_cs,
whismanoid 0:3edb3708c8c5 681 LDACb_pin,
whismanoid 0:3edb3708c8c5 682 CLRb_pin,
whismanoid 0:3edb3708c8c5 683 ///* RDYb_pin */ digitalInOut12,
whismanoid 0:3edb3708c8c5 684 MAX5715::MAX5715_IC);
whismanoid 0:3edb3708c8c5 685 //
whismanoid 0:3edb3708c8c5 686 #elif APPLICATION_MAX11131 // SPI interface default settings
whismanoid 0:3edb3708c8c5 687 DigitalOut CNVSTb_pin(D9); // Arduino 10-pin header D9
whismanoid 0:3edb3708c8c5 688 //DigitalOut CLRb_pin(D8); // Arduino 10-pin header D8
whismanoid 0:3edb3708c8c5 689 DigitalIn EOCb_pin(D12); // Arduino 10-pin header D12 (MISO)
whismanoid 0:3edb3708c8c5 690 MAX11131 g_MAX11131_device(spi, spi_cs,
whismanoid 0:3edb3708c8c5 691 CNVSTb_pin,
whismanoid 0:3edb3708c8c5 692 EOCb_pin,
whismanoid 0:3edb3708c8c5 693 ///* RDYb_pin */ digitalInOut12,
whismanoid 0:3edb3708c8c5 694 MAX11131::MAX11131_IC);
whismanoid 0:3edb3708c8c5 695 //
whismanoid 0:3edb3708c8c5 696 //
whismanoid 0:3edb3708c8c5 697 #elif APPLICATION_MAX5171 // SPI interface default settings
whismanoid 0:3edb3708c8c5 698 // AnalogOut FB_pin(Px_x_PortName_To_Be_Determined); // Analog Input to MAX5171 device
whismanoid 0:3edb3708c8c5 699 DigitalOut RS_pin(D9); // Digital Configuration Input to MAX5171 device
whismanoid 0:3edb3708c8c5 700 DigitalOut PDLb_pin(D8); // Digital Configuration Input to MAX5171 device
whismanoid 0:3edb3708c8c5 701 DigitalOut CLRb_pin(D7); // Digital Configuration Input to MAX5171 device
whismanoid 0:3edb3708c8c5 702 DigitalOut SHDN_pin(D6); // Digital Configuration Input to MAX5171 device
whismanoid 0:3edb3708c8c5 703 // AnalogIn OUT_pin(A0); // Analog Output from MAX5171 device
whismanoid 0:3edb3708c8c5 704 DigitalIn UPO_pin(D2); // Digital General-Purpose Output from MAX5171 device
whismanoid 0:3edb3708c8c5 705 MAX5171 g_MAX5171_device(spi, spi_cs, RS_pin, PDLb_pin, CLRb_pin, SHDN_pin, UPO_pin, MAX5171::MAX5171_IC);
whismanoid 0:3edb3708c8c5 706 //
whismanoid 0:3edb3708c8c5 707 #elif APPLICATION_MAX11410 // SPI interface default settings
whismanoid 0:3edb3708c8c5 708 //
whismanoid 0:3edb3708c8c5 709 MAX11410 g_MAX11410_device(spi, spi_cs, MAX11410::MAX11410_IC);
whismanoid 0:3edb3708c8c5 710 //
whismanoid 0:3edb3708c8c5 711 #elif APPLICATION_MAX12345 // SPI interface default settings
whismanoid 0:3edb3708c8c5 712 //
whismanoid 0:3edb3708c8c5 713 MAX12345 g_MAX12345_device(spi, spi_cs, ...);
whismanoid 0:3edb3708c8c5 714 //
whismanoid 0:3edb3708c8c5 715 #else // APPLICATION_ArduinoPinsMonitor diagnostic
whismanoid 0:3edb3708c8c5 716 //
whismanoid 0:3edb3708c8c5 717 #endif
whismanoid 0:3edb3708c8c5 718
whismanoid 0:3edb3708c8c5 719
whismanoid 0:3edb3708c8c5 720 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 721 // Option to dedicate I2C port pins
whismanoid 0:3edb3708c8c5 722 //
whismanoid 0:3edb3708c8c5 723 #ifndef HAS_I2C
whismanoid 0:3edb3708c8c5 724 #define HAS_I2C 1
whismanoid 0:3edb3708c8c5 725 #endif
whismanoid 0:3edb3708c8c5 726 #if HAS_I2C
whismanoid 0:3edb3708c8c5 727 //#include "I2C.h"
whismanoid 0:3edb3708c8c5 728 //#include "I2CSlave.h"
whismanoid 0:3edb3708c8c5 729 //#define I2C_SCL_Hz 400000 // 400kHz
whismanoid 0:3edb3708c8c5 730 //#define I2C_SCL_Hz 200000 // 200kHz
whismanoid 0:3edb3708c8c5 731 #define I2C_SCL_Hz 100000 // 100kHz
whismanoid 0:3edb3708c8c5 732 //
whismanoid 0:3edb3708c8c5 733 #if defined(TARGET_MAX32630)
whismanoid 0:3edb3708c8c5 734 // TODO1: validate g_I2C_SCL_Hz against system clock frequency SystemCoreClock F_CPU
whismanoid 0:3edb3708c8c5 735 const uint32_t limit_max_I2C_SCL_Hz = (SystemCoreClock / 2); // F_CPU / 2; // 8MHz / 2 = 4MHz
whismanoid 0:3edb3708c8c5 736 const uint32_t limit_min_I2C_SCL_Hz = (SystemCoreClock / 8191); // F_CPU / 128; // 8MHz / 128 = 62.5kHz
whismanoid 0:3edb3708c8c5 737 //
whismanoid 0:3edb3708c8c5 738 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:3edb3708c8c5 739 //I2C i2cMaster0(I2C0_SDA, I2C0_SCL); // sda scl MAX32630FTHR: NOT_CONNECTED
whismanoid 0:3edb3708c8c5 740 //I2C i2cMaster1(I2C1_SDA, I2C1_SCL); // sda scl MAX32630FTHR: P3_4, P3_5
whismanoid 0:3edb3708c8c5 741 //I2C i2cMaster2(I2C2_SDA, I2C2_SCL); // sda scl MAX32630FTHR: P5_7, P6_0
whismanoid 0:3edb3708c8c5 742 //I2C i2cMaster(I2C2_SDA, I2C2_SCL); // sda scl MAX32630FTHR: P5_7, P6_0
whismanoid 0:3edb3708c8c5 743 //
whismanoid 0:3edb3708c8c5 744 //I2CSlave i2cSlave0(I2C0_SDA, I2C0_SCL); // sda scl MAX32630FTHR: NOT_CONNECTED
whismanoid 0:3edb3708c8c5 745 //I2CSlave i2cSlave1(I2C1_SDA, I2C1_SCL); // sda scl MAX32630FTHR: P3_4, P3_5
whismanoid 0:3edb3708c8c5 746 //I2CSlave i2cSlave2(I2C2_SDA, I2C2_SCL); // sda scl MAX32630FTHR: P5_7, P6_0
whismanoid 0:3edb3708c8c5 747 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:3edb3708c8c5 748 // TODO1: validate g_I2C_SCL_Hz against system clock frequency SystemCoreClock F_CPU
whismanoid 0:3edb3708c8c5 749 const uint32_t limit_max_I2C_SCL_Hz = (SystemCoreClock / 2); // F_CPU / 2; // 8MHz / 2 = 4MHz
whismanoid 0:3edb3708c8c5 750 const uint32_t limit_min_I2C_SCL_Hz = (SystemCoreClock / 8191); // F_CPU / 128; // 8MHz / 128 = 62.5kHz
whismanoid 0:3edb3708c8c5 751 //
whismanoid 0:3edb3708c8c5 752 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:3edb3708c8c5 753 //I2C i2cMaster0(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 0:3edb3708c8c5 754 //I2C i2cMaster1(I2C1_SDA, I2C1_SCL); // sda scl TARGET_MAX32635MBED: P3_4, P3_5 Arduino 6-pin header
whismanoid 0:3edb3708c8c5 755 // declare in narrower scope: MAX32625MBED I2C i2cMaster(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 0:3edb3708c8c5 756 //
whismanoid 0:3edb3708c8c5 757 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:3edb3708c8c5 758 // TODO1: validate g_I2C_SCL_Hz against system clock frequency SystemCoreClock F_CPU
whismanoid 0:3edb3708c8c5 759 const uint32_t limit_max_I2C_SCL_Hz = (SystemCoreClock / 2); // F_CPU / 2; // 8MHz / 2 = 4MHz
whismanoid 0:3edb3708c8c5 760 const uint32_t limit_min_I2C_SCL_Hz = (SystemCoreClock / 8191); // F_CPU / 128; // 8MHz / 128 = 62.5kHz
whismanoid 0:3edb3708c8c5 761 //
whismanoid 0:3edb3708c8c5 762 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:3edb3708c8c5 763 //I2C i2cMaster0(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 0:3edb3708c8c5 764 //I2C i2cMaster1(I2C1_SDA, I2C1_SCL); // sda scl TARGET_MAX32635MBED: P3_4, P3_5 Arduino 6-pin header
whismanoid 0:3edb3708c8c5 765 // declare in narrower scope: MAX32625MBED I2C i2cMaster(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 0:3edb3708c8c5 766 # ifndef I2C0_SDA
whismanoid 0:3edb3708c8c5 767 # define I2C0_SDA I2C_SDA
whismanoid 0:3edb3708c8c5 768 # define I2C0_SCL I2C_SCL
whismanoid 0:3edb3708c8c5 769 # endif
whismanoid 0:3edb3708c8c5 770 //
whismanoid 0:3edb3708c8c5 771 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:3edb3708c8c5 772 // TODO1: validate g_I2C_SCL_Hz against system clock frequency SystemCoreClock F_CPU
whismanoid 0:3edb3708c8c5 773 const uint32_t limit_max_I2C_SCL_Hz = (SystemCoreClock / 2); // F_CPU / 2; // 8MHz / 2 = 4MHz
whismanoid 0:3edb3708c8c5 774 const uint32_t limit_min_I2C_SCL_Hz = (SystemCoreClock / 8191); // F_CPU / 128; // 8MHz / 128 = 62.5kHz
whismanoid 0:3edb3708c8c5 775 //
whismanoid 0:3edb3708c8c5 776 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:3edb3708c8c5 777 //I2C i2cMaster0(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 0:3edb3708c8c5 778 //I2C i2cMaster1(I2C1_SDA, I2C1_SCL); // sda scl TARGET_MAX32635MBED: P3_4, P3_5 Arduino 6-pin header
whismanoid 0:3edb3708c8c5 779 // declare in narrower scope: MAX32625MBED I2C i2cMaster(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 0:3edb3708c8c5 780 # ifndef I2C0_SDA
whismanoid 0:3edb3708c8c5 781 # define I2C0_SDA I2C_SDA
whismanoid 0:3edb3708c8c5 782 # define I2C0_SCL I2C_SCL
whismanoid 0:3edb3708c8c5 783 # endif
whismanoid 0:3edb3708c8c5 784 //
whismanoid 0:3edb3708c8c5 785 #elif defined(TARGET_LPC1768)
whismanoid 0:3edb3708c8c5 786 #else
whismanoid 0:3edb3708c8c5 787 // unknown target
whismanoid 16:3c75011e705a 788 #warning "target not previously tested; need to define I2C pins..."
whismanoid 0:3edb3708c8c5 789 #endif
whismanoid 0:3edb3708c8c5 790 //
whismanoid 0:3edb3708c8c5 791 #endif
whismanoid 0:3edb3708c8c5 792 #if HAS_I2C
whismanoid 0:3edb3708c8c5 793 uint32_t g_I2C_SCL_Hz = I2C_SCL_Hz;
whismanoid 0:3edb3708c8c5 794 uint8_t g_I2C_status = 0; // g_I2C_status = Wire_Sr.endTransmission();
whismanoid 0:3edb3708c8c5 795 uint8_t g_I2C_deviceAddress7 = (0xA0 >> 1); // I2C device address (slave address on I2C bus), 7-bits, RIGHT-justified.
whismanoid 0:3edb3708c8c5 796 uint8_t g_I2C_read_count = 0;
whismanoid 0:3edb3708c8c5 797 uint8_t g_I2C_write_count = 0;
whismanoid 0:3edb3708c8c5 798 uint8_t g_I2C_write_data[256];
whismanoid 0:3edb3708c8c5 799 uint8_t g_I2C_command_regAddress;
whismanoid 0:3edb3708c8c5 800 //
whismanoid 0:3edb3708c8c5 801 // TODO: i2c init
whismanoid 0:3edb3708c8c5 802 // i2cMaster.frequency(g_I2C_SCL_Hz);
whismanoid 0:3edb3708c8c5 803 #endif
whismanoid 0:3edb3708c8c5 804 #if HAS_I2C
whismanoid 0:3edb3708c8c5 805 // TODO: i2c transfer
whismanoid 0:3edb3708c8c5 806 //const int addr7bit = 0x48; // 7 bit I2C address
whismanoid 0:3edb3708c8c5 807 //const int addr8bit = 0x48 << 1; // 8bit I2C address, 0x90
whismanoid 0:3edb3708c8c5 808 // /* int */ i2cMaster.read (int addr8bit, char *data, int length, bool repeated=false) // Read from an I2C slave.
whismanoid 0:3edb3708c8c5 809 // /* int */ i2cMaster.read (int ack) // Read a single byte from the I2C bus.
whismanoid 0:3edb3708c8c5 810 // /* int */ i2cMaster.write (int addr8bit, const char *data, int length, bool repeated=false) // Write to an I2C slave.
whismanoid 0:3edb3708c8c5 811 // /* int */ i2cMaster.write (int data) // Write single byte out on the I2C bus.
whismanoid 0:3edb3708c8c5 812 // /* void */ i2cMaster.start (void) // Creates a start condition on the I2C bus.
whismanoid 0:3edb3708c8c5 813 // /* void */ i2cMaster.stop (void) // Creates a stop condition on the I2C bus.
whismanoid 0:3edb3708c8c5 814 // /* int */ i2cMaster.transfer (int addr8bit, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t &callback, int event=I2C_EVENT_TRANSFER_COMPLETE, bool repeated=false) // Start nonblocking I2C transfer. More...
whismanoid 0:3edb3708c8c5 815 // /* void */ i2cMaster.abort_transfer () // Abort the ongoing I2C transfer. More...
whismanoid 0:3edb3708c8c5 816 #endif
whismanoid 0:3edb3708c8c5 817
whismanoid 0:3edb3708c8c5 818
whismanoid 0:3edb3708c8c5 819 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 820 // Declare the Serial driver
whismanoid 0:3edb3708c8c5 821 // default baud rate settings are 9600 8N1
whismanoid 0:3edb3708c8c5 822 // install device driver from http://developer.mbed.org/media/downloads/drivers/mbedWinSerial_16466.exe
whismanoid 0:3edb3708c8c5 823 // see docs https://docs.mbed.com/docs/mbed-os-handbook/en/5.5/getting_started/what_need/
whismanoid 0:3edb3708c8c5 824 #if defined(TARGET_MAX32630)
whismanoid 0:3edb3708c8c5 825 #include "USBSerial.h"
whismanoid 0:3edb3708c8c5 826 // Hardware serial port over DAPLink
whismanoid 0:3edb3708c8c5 827 // The default baud rate for the DapLink UART is 9600
whismanoid 0:3edb3708c8c5 828 Serial DAPLINKserial(P2_1, P2_0); // tx, rx
whismanoid 0:3edb3708c8c5 829 #define HAS_DAPLINK_SERIAL 1
whismanoid 0:3edb3708c8c5 830 // Virtual serial port over USB
whismanoid 0:3edb3708c8c5 831 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 7:bf501f8cb637 832 USBSerial serial;
whismanoid 0:3edb3708c8c5 833 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 834 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:3edb3708c8c5 835 #include "USBSerial.h"
whismanoid 0:3edb3708c8c5 836 // Hardware serial port over DAPLink
whismanoid 0:3edb3708c8c5 837 // The default baud rate for the DapLink UART is 9600
whismanoid 0:3edb3708c8c5 838 Serial DAPLINKserial(P2_1, P2_0); // tx, rx
whismanoid 0:3edb3708c8c5 839 #define HAS_DAPLINK_SERIAL 1
whismanoid 0:3edb3708c8c5 840 // Virtual serial port over USB
whismanoid 0:3edb3708c8c5 841 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 7:bf501f8cb637 842 USBSerial serial;
whismanoid 16:3c75011e705a 843 //
whismanoid 16:3c75011e705a 844 //--------------------------------------------------
whismanoid 16:3c75011e705a 845 #elif defined(TARGET_MAX32620FTHR)
whismanoid 16:3c75011e705a 846 #warning "TARGET_MAX32620FTHR not previously tested; need to define serial pins..."
whismanoid 18:14afc2a2150f 847 // Hardware serial port over DAPLink
whismanoid 18:14afc2a2150f 848 // The default baud rate for the DapLink UART is 9600
whismanoid 18:14afc2a2150f 849 Serial DAPLINKserial(USBTX, USBRX); // tx, rx MAX32620FTHR: P2_1,P2_0
whismanoid 18:14afc2a2150f 850 //Serial DAPLINKserial(STDIO_UART_TX, STDIO_UART_RX); // tx, rx
whismanoid 18:14afc2a2150f 851 #define HAS_DAPLINK_SERIAL 1
whismanoid 18:14afc2a2150f 852 // Virtual serial port over USB
whismanoid 18:14afc2a2150f 853 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 18:14afc2a2150f 854 // #include "USBSerial.h"
whismanoid 18:14afc2a2150f 855 //USBSerial serial;
whismanoid 18:14afc2a2150f 856 //Serial serial(UART0_TX, UART0_RX); // tx, rx MAX32620FTHR: P0_1,P0_0 (PMOD Port 0)
whismanoid 18:14afc2a2150f 857 //Serial serial(UART1_TX, UART1_RX); // tx, rx MAX32620FTHR: P2_1,P2_0 (DAPLINK)
whismanoid 18:14afc2a2150f 858 Serial serial(UART2_TX, UART2_RX); // tx, rx MAX32620FTHR: P3_1,P3_0 (J1.15,J1.14)
whismanoid 18:14afc2a2150f 859 //Serial serial(UART3_TX, UART3_RX); // tx, rx MAX32620FTHR: P5_4,P5_3 (J2.7,J2.8)
whismanoid 16:3c75011e705a 860 //Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx
whismanoid 18:14afc2a2150f 861 //Serial serial(USBTX, USBRX); // tx, rx
whismanoid 16:3c75011e705a 862 //Serial serial(UART_TX, UART_RX); // tx, rx
whismanoid 16:3c75011e705a 863 //
whismanoid 16:3c75011e705a 864 //--------------------------------------------------
whismanoid 16:3c75011e705a 865 #elif defined(TARGET_MAX32625PICO)
whismanoid 16:3c75011e705a 866 #warning "TARGET_MAX32625PICO not previously tested; need to verify serial pins..."
whismanoid 16:3c75011e705a 867 // Note to software maintainer:
whismanoid 16:3c75011e705a 868 // when adding new platform support,
whismanoid 16:3c75011e705a 869 // add another #elif block above to support the new platform
whismanoid 16:3c75011e705a 870 Serial serial(UART_TX, UART_RX); // tx, rx
whismanoid 16:3c75011e705a 871 //
whismanoid 0:3edb3708c8c5 872 //--------------------------------------------------
whismanoid 11:9fa2402071de 873 #elif defined(TARGET_MAX32600)
whismanoid 11:9fa2402071de 874 #include "USBSerial.h"
whismanoid 11:9fa2402071de 875 // Hardware serial port over DAPLink
whismanoid 11:9fa2402071de 876 // The default baud rate for the DapLink UART is 9600
whismanoid 11:9fa2402071de 877 Serial DAPLINKserial(P1_1, P1_0); // tx, rx
whismanoid 11:9fa2402071de 878 #define HAS_DAPLINK_SERIAL 1
whismanoid 11:9fa2402071de 879 // Virtual serial port over USB
whismanoid 11:9fa2402071de 880 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 11:9fa2402071de 881 USBSerial serial;
whismanoid 11:9fa2402071de 882 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 883 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 7:bf501f8cb637 884 Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx
whismanoid 0:3edb3708c8c5 885 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 886 // TODO1: TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:3edb3708c8c5 887 #elif defined(TARGET_LPC1768)
whismanoid 7:bf501f8cb637 888 Serial serial(USBTX, USBRX); // tx, rx
whismanoid 0:3edb3708c8c5 889 #else
whismanoid 0:3edb3708c8c5 890 // unknown target
whismanoid 16:3c75011e705a 891 #if defined(SERIAL_TX)
whismanoid 16:3c75011e705a 892 #warning "target not previously tested; guess serial pins are SERIAL_TX, SERIAL_RX..."
whismanoid 16:3c75011e705a 893 Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx
whismanoid 16:3c75011e705a 894 #elif defined(USBTX)
whismanoid 16:3c75011e705a 895 #warning "target not previously tested; guess serial pins are USBTX, USBRX..."
whismanoid 16:3c75011e705a 896 Serial serial(USBTX, USBRX); // tx, rx
whismanoid 16:3c75011e705a 897 #elif defined(UART_TX)
whismanoid 16:3c75011e705a 898 #warning "target not previously tested; guess serial pins are UART_TX, UART_RX..."
whismanoid 16:3c75011e705a 899 Serial serial(UART_TX, UART_RX); // tx, rx
whismanoid 16:3c75011e705a 900 #else
whismanoid 16:3c75011e705a 901 #warning "target not previously tested; need to define serial pins..."
whismanoid 16:3c75011e705a 902 #endif
whismanoid 0:3edb3708c8c5 903 #endif
whismanoid 0:3edb3708c8c5 904
whismanoid 0:3edb3708c8c5 905 void on_immediate_0x21(); // Unicode (U+0021) ! EXCLAMATION MARK
whismanoid 0:3edb3708c8c5 906 void on_immediate_0x7b(); // Unicode (U+007B) { LEFT CURLY BRACKET
whismanoid 0:3edb3708c8c5 907 void on_immediate_0x7d(); // Unicode (U+007D) } RIGHT CURLY BRACKET
whismanoid 0:3edb3708c8c5 908
whismanoid 0:3edb3708c8c5 909 #include "CmdLine.h"
whismanoid 0:3edb3708c8c5 910
whismanoid 0:3edb3708c8c5 911 # if HAS_DAPLINK_SERIAL
whismanoid 0:3edb3708c8c5 912 CmdLine cmdLine_DAPLINKserial(DAPLINKserial, "DAPLINK");
whismanoid 0:3edb3708c8c5 913 # endif // HAS_DAPLINK_SERIAL
whismanoid 7:bf501f8cb637 914 CmdLine cmdLine_serial(serial, "serial");
whismanoid 0:3edb3708c8c5 915
whismanoid 0:3edb3708c8c5 916
whismanoid 0:3edb3708c8c5 917 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 918 // tolerate AT commands, which may be sent during probe, such as:
whismanoid 0:3edb3708c8c5 919 // AT
whismanoid 0:3edb3708c8c5 920 // AT+CGMI -- request manufacturer identification AT+CMGI=?
whismanoid 0:3edb3708c8c5 921 // AT+CGMM -- request manufacturer model
whismanoid 0:3edb3708c8c5 922 // AT%IPSYS?
whismanoid 0:3edb3708c8c5 923 // ATE0 -- echo disable
whismanoid 0:3edb3708c8c5 924 // ATV1 -- verbose result codes OK | ERROR | NO CARRIER
whismanoid 0:3edb3708c8c5 925 // AT+CMEE=1
whismanoid 0:3edb3708c8c5 926 // ATX4
whismanoid 0:3edb3708c8c5 927 // AT&C1
whismanoid 0:3edb3708c8c5 928 // ATE0
whismanoid 0:3edb3708c8c5 929 // AT+CMEE=1
whismanoid 0:3edb3708c8c5 930 // AT+GCAP
whismanoid 0:3edb3708c8c5 931 // ATI
whismanoid 0:3edb3708c8c5 932 // AT+CPIN?
whismanoid 0:3edb3708c8c5 933 // AT+CGMM
whismanoid 0:3edb3708c8c5 934 #ifndef IGNORE_AT_COMMANDS
whismanoid 0:3edb3708c8c5 935 #define IGNORE_AT_COMMANDS 1
whismanoid 0:3edb3708c8c5 936 #endif
whismanoid 0:3edb3708c8c5 937
whismanoid 0:3edb3708c8c5 938
whismanoid 0:3edb3708c8c5 939 // uncrustify-0.66.1 *INDENT-OFF*
whismanoid 0:3edb3708c8c5 940 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 941 // Declare the DigitalInOut GPIO pins
whismanoid 0:3edb3708c8c5 942 // Optional digitalInOut support. If there is only one it should be digitalInOut1.
whismanoid 0:3edb3708c8c5 943 // D) Digital High/Low/Input Pin
whismanoid 0:3edb3708c8c5 944 #if defined(TARGET_MAX32630)
whismanoid 0:3edb3708c8c5 945 // +-------------[microUSB]-------------+
whismanoid 0:3edb3708c8c5 946 // | J1 MAX32630FTHR J2 |
whismanoid 0:3edb3708c8c5 947 // | [ ] RST GND [ ] |
whismanoid 0:3edb3708c8c5 948 // | [ ] 3V3 BAT+[ ] |
whismanoid 0:3edb3708c8c5 949 // | [ ] 1V8 reset SW1 |
whismanoid 0:3edb3708c8c5 950 // | [ ] GND J4 J3 |
whismanoid 0:3edb3708c8c5 951 // | [ ] AIN_0 1.2Vfs (bat) SYS [ ] |
whismanoid 0:3edb3708c8c5 952 // | [ ] AIN_1 1.2Vfs PWR [ ] |
whismanoid 0:3edb3708c8c5 953 // | [ ] AIN_2 1.2Vfs +5V VBUS [ ] |
whismanoid 0:3edb3708c8c5 954 // | [ ] AIN_3 1.2Vfs 1-WIRE P4_0 [ ] | dig9
whismanoid 0:3edb3708c8c5 955 // dig10 | [x] P5_7 SDA2 SRN P5_6 [ ] | dig8
whismanoid 0:3edb3708c8c5 956 // dig11 | [x] P6_0 SCL2 SDIO3 P5_5 [ ] | dig7
whismanoid 0:3edb3708c8c5 957 // dig12 | [x] P5_0 SCLK SDIO2 P5_4 [ ] | dig6
whismanoid 0:3edb3708c8c5 958 // dig13 | [x] P5_1 MOSI SSEL P5_3 [x] | dig5
whismanoid 0:3edb3708c8c5 959 // dig14 | [ ] P5_2 MISO RTS P3_3 [ ] | dig4
whismanoid 0:3edb3708c8c5 960 // dig15 | [ ] P3_0 RX CTS P3_2 [ ] | dig3
whismanoid 0:3edb3708c8c5 961 // dig0 | [ ] P3_1 TX SCL P3_5 [x] | dig2
whismanoid 0:3edb3708c8c5 962 // | [ ] GND SDA P3_4 [x] | dig1
whismanoid 0:3edb3708c8c5 963 // +------------------------------------+
whismanoid 0:3edb3708c8c5 964 #define HAS_digitalInOut0 1 // P3_1 TARGET_MAX32630 J1.15
whismanoid 0:3edb3708c8c5 965 #define HAS_digitalInOut1 1 // P3_4 TARGET_MAX32630 J3.12
whismanoid 0:3edb3708c8c5 966 #define HAS_digitalInOut2 1 // P3_5 TARGET_MAX32630 J3.11
whismanoid 0:3edb3708c8c5 967 #define HAS_digitalInOut3 1 // P3_2 TARGET_MAX32630 J3.10
whismanoid 0:3edb3708c8c5 968 #define HAS_digitalInOut4 1 // P3_3 TARGET_MAX32630 J3.9
whismanoid 0:3edb3708c8c5 969 #define HAS_digitalInOut5 1 // P5_3 TARGET_MAX32630 J3.8
whismanoid 0:3edb3708c8c5 970 #define HAS_digitalInOut6 1 // P5_4 TARGET_MAX32630 J3.7
whismanoid 0:3edb3708c8c5 971 #define HAS_digitalInOut7 1 // P5_5 TARGET_MAX32630 J3.6
whismanoid 0:3edb3708c8c5 972 #define HAS_digitalInOut8 1 // P5_6 TARGET_MAX32630 J3.5
whismanoid 0:3edb3708c8c5 973 #define HAS_digitalInOut9 1 // P4_0 TARGET_MAX32630 J3.4
whismanoid 0:3edb3708c8c5 974 #if HAS_I2C
whismanoid 0:3edb3708c8c5 975 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:3edb3708c8c5 976 #define HAS_digitalInOut10 0 // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:3edb3708c8c5 977 #define HAS_digitalInOut11 0 // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:3edb3708c8c5 978 #else // HAS_I2C
whismanoid 0:3edb3708c8c5 979 #define HAS_digitalInOut10 1 // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:3edb3708c8c5 980 #define HAS_digitalInOut11 1 // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:3edb3708c8c5 981 #endif // HAS_I2C
whismanoid 0:3edb3708c8c5 982 #if HAS_SPI
whismanoid 0:3edb3708c8c5 983 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:3edb3708c8c5 984 #define HAS_digitalInOut12 0 // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:3edb3708c8c5 985 #define HAS_digitalInOut13 0 // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:3edb3708c8c5 986 #define HAS_digitalInOut14 0 // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:3edb3708c8c5 987 #define HAS_digitalInOut15 0 // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:3edb3708c8c5 988 #else // HAS_SPI
whismanoid 0:3edb3708c8c5 989 #define HAS_digitalInOut12 1 // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:3edb3708c8c5 990 #define HAS_digitalInOut13 1 // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:3edb3708c8c5 991 #define HAS_digitalInOut14 1 // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:3edb3708c8c5 992 #define HAS_digitalInOut15 1 // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:3edb3708c8c5 993 #endif // HAS_SPI
whismanoid 0:3edb3708c8c5 994 #if HAS_digitalInOut0
whismanoid 0:3edb3708c8c5 995 DigitalInOut digitalInOut0(P3_1, PIN_INPUT, PullUp, 1); // P3_1 TARGET_MAX32630 J1.15
whismanoid 0:3edb3708c8c5 996 #endif
whismanoid 0:3edb3708c8c5 997 #if HAS_digitalInOut1
whismanoid 0:3edb3708c8c5 998 DigitalInOut digitalInOut1(P3_4, PIN_INPUT, PullUp, 1); // P3_4 TARGET_MAX32630 J3.12
whismanoid 0:3edb3708c8c5 999 #endif
whismanoid 0:3edb3708c8c5 1000 #if HAS_digitalInOut2
whismanoid 0:3edb3708c8c5 1001 DigitalInOut digitalInOut2(P3_5, PIN_INPUT, PullUp, 1); // P3_5 TARGET_MAX32630 J3.11
whismanoid 0:3edb3708c8c5 1002 #endif
whismanoid 0:3edb3708c8c5 1003 #if HAS_digitalInOut3
whismanoid 0:3edb3708c8c5 1004 DigitalInOut digitalInOut3(P3_2, PIN_INPUT, PullUp, 1); // P3_2 TARGET_MAX32630 J3.10
whismanoid 0:3edb3708c8c5 1005 #endif
whismanoid 0:3edb3708c8c5 1006 #if HAS_digitalInOut4
whismanoid 0:3edb3708c8c5 1007 DigitalInOut digitalInOut4(P3_3, PIN_INPUT, PullUp, 1); // P3_3 TARGET_MAX32630 J3.9
whismanoid 0:3edb3708c8c5 1008 #endif
whismanoid 0:3edb3708c8c5 1009 #if HAS_digitalInOut5
whismanoid 0:3edb3708c8c5 1010 DigitalInOut digitalInOut5(P5_3, PIN_INPUT, PullUp, 1); // P5_3 TARGET_MAX32630 J3.8
whismanoid 0:3edb3708c8c5 1011 #endif
whismanoid 0:3edb3708c8c5 1012 #if HAS_digitalInOut6
whismanoid 0:3edb3708c8c5 1013 DigitalInOut digitalInOut6(P5_4, PIN_INPUT, PullUp, 1); // P5_4 TARGET_MAX32630 J3.7
whismanoid 0:3edb3708c8c5 1014 #endif
whismanoid 0:3edb3708c8c5 1015 #if HAS_digitalInOut7
whismanoid 0:3edb3708c8c5 1016 DigitalInOut digitalInOut7(P5_5, PIN_INPUT, PullUp, 1); // P5_5 TARGET_MAX32630 J3.6
whismanoid 0:3edb3708c8c5 1017 #endif
whismanoid 0:3edb3708c8c5 1018 #if HAS_digitalInOut8
whismanoid 0:3edb3708c8c5 1019 DigitalInOut digitalInOut8(P5_6, PIN_INPUT, PullUp, 1); // P5_6 TARGET_MAX32630 J3.5
whismanoid 0:3edb3708c8c5 1020 #endif
whismanoid 0:3edb3708c8c5 1021 #if HAS_digitalInOut9
whismanoid 0:3edb3708c8c5 1022 DigitalInOut digitalInOut9(P4_0, PIN_INPUT, PullUp, 1); // P4_0 TARGET_MAX32630 J3.4
whismanoid 0:3edb3708c8c5 1023 #endif
whismanoid 0:3edb3708c8c5 1024 #if HAS_digitalInOut10
whismanoid 0:3edb3708c8c5 1025 DigitalInOut digitalInOut10(P5_7, PIN_INPUT, PullUp, 1); // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:3edb3708c8c5 1026 #endif
whismanoid 0:3edb3708c8c5 1027 #if HAS_digitalInOut11
whismanoid 0:3edb3708c8c5 1028 DigitalInOut digitalInOut11(P6_0, PIN_INPUT, PullUp, 1); // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:3edb3708c8c5 1029 #endif
whismanoid 0:3edb3708c8c5 1030 #if HAS_digitalInOut12
whismanoid 0:3edb3708c8c5 1031 DigitalInOut digitalInOut12(P5_0, PIN_INPUT, PullUp, 1); // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:3edb3708c8c5 1032 #endif
whismanoid 0:3edb3708c8c5 1033 #if HAS_digitalInOut13
whismanoid 0:3edb3708c8c5 1034 DigitalInOut digitalInOut13(P5_1, PIN_INPUT, PullUp, 1); // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:3edb3708c8c5 1035 #endif
whismanoid 0:3edb3708c8c5 1036 #if HAS_digitalInOut14
whismanoid 0:3edb3708c8c5 1037 DigitalInOut digitalInOut14(P5_2, PIN_INPUT, PullUp, 1); // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:3edb3708c8c5 1038 #endif
whismanoid 0:3edb3708c8c5 1039 #if HAS_digitalInOut15
whismanoid 0:3edb3708c8c5 1040 DigitalInOut digitalInOut15(P3_0, PIN_INPUT, PullUp, 1); // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:3edb3708c8c5 1041 #endif
whismanoid 0:3edb3708c8c5 1042 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1043 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:3edb3708c8c5 1044 // TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:3edb3708c8c5 1045 // +-------------------------------------+
whismanoid 0:3edb3708c8c5 1046 // | MAX32625MBED Arduino UNO header |
whismanoid 0:3edb3708c8c5 1047 // | |
whismanoid 0:3edb3708c8c5 1048 // | A5/SCL[ ] | P1_7 dig15
whismanoid 0:3edb3708c8c5 1049 // | A4/SDA[ ] | P1_6 dig14
whismanoid 0:3edb3708c8c5 1050 // | AREF=N/C[ ] |
whismanoid 0:3edb3708c8c5 1051 // | GND[ ] |
whismanoid 0:3edb3708c8c5 1052 // | [ ]N/C SCK/13[ ] | P1_0 dig13
whismanoid 0:3edb3708c8c5 1053 // | [ ]IOREF=3V3 MISO/12[ ] | P1_2 dig12
whismanoid 0:3edb3708c8c5 1054 // | [ ]RST MOSI/11[ ]~| P1_1 dig11
whismanoid 0:3edb3708c8c5 1055 // | [ ]3V3 CS/10[ ]~| P1_3 dig10
whismanoid 0:3edb3708c8c5 1056 // | [ ]5V0 9[ ]~| P1_5 dig9
whismanoid 0:3edb3708c8c5 1057 // | [ ]GND 8[ ] | P1_4 dig8
whismanoid 0:3edb3708c8c5 1058 // | [ ]GND |
whismanoid 0:3edb3708c8c5 1059 // | [ ]Vin 7[ ] | P0_7 dig7
whismanoid 0:3edb3708c8c5 1060 // | 6[ ]~| P0_6 dig6
whismanoid 0:3edb3708c8c5 1061 // AIN_0 | [ ]A0 5[ ]~| P0_5 dig5
whismanoid 0:3edb3708c8c5 1062 // AIN_1 | [ ]A1 4[ ] | P0_4 dig4
whismanoid 0:3edb3708c8c5 1063 // AIN_2 | [ ]A2 INT1/3[ ]~| P0_3 dig3
whismanoid 0:3edb3708c8c5 1064 // AIN_3 | [ ]A3 INT0/2[ ] | P0_2 dig2
whismanoid 0:3edb3708c8c5 1065 // dig16 P3_4 | [ ]A4/SDA RST SCK MISO TX>1[ ] | P0_1 dig1
whismanoid 0:3edb3708c8c5 1066 // dig17 P3_5 | [ ]A5/SCL [ ] [ ] [ ] RX<0[ ] | P0_0 dig0
whismanoid 0:3edb3708c8c5 1067 // | [ ] [ ] [ ] |
whismanoid 0:3edb3708c8c5 1068 // | UNO_R3 GND MOSI 5V ____________/
whismanoid 0:3edb3708c8c5 1069 // \_______________________/
whismanoid 0:3edb3708c8c5 1070 //
whismanoid 0:3edb3708c8c5 1071 #define HAS_digitalInOut0 1 // P0_0 TARGET_MAX32625MBED D0
whismanoid 0:3edb3708c8c5 1072 #define HAS_digitalInOut1 1 // P0_1 TARGET_MAX32625MBED D1
whismanoid 0:3edb3708c8c5 1073 #if APPLICATION_MAX11131
whismanoid 0:3edb3708c8c5 1074 #define HAS_digitalInOut2 0 // P0_2 TARGET_MAX32625MBED D2 -- MAX11131 EOC DigitalIn
whismanoid 0:3edb3708c8c5 1075 #else
whismanoid 0:3edb3708c8c5 1076 #define HAS_digitalInOut2 1 // P0_2 TARGET_MAX32625MBED D2
whismanoid 0:3edb3708c8c5 1077 #endif
whismanoid 0:3edb3708c8c5 1078 #define HAS_digitalInOut3 1 // P0_3 TARGET_MAX32625MBED D3
whismanoid 0:3edb3708c8c5 1079 #define HAS_digitalInOut4 1 // P0_4 TARGET_MAX32625MBED D4
whismanoid 0:3edb3708c8c5 1080 #define HAS_digitalInOut5 1 // P0_5 TARGET_MAX32625MBED D5
whismanoid 0:3edb3708c8c5 1081 #define HAS_digitalInOut6 1 // P0_6 TARGET_MAX32625MBED D6
whismanoid 0:3edb3708c8c5 1082 #define HAS_digitalInOut7 1 // P0_7 TARGET_MAX32625MBED D7
whismanoid 0:3edb3708c8c5 1083 #define HAS_digitalInOut8 1 // P1_4 TARGET_MAX32625MBED D8
whismanoid 0:3edb3708c8c5 1084 #if APPLICATION_MAX11131
whismanoid 0:3edb3708c8c5 1085 #define HAS_digitalInOut9 0 // P1_5 TARGET_MAX32625MBED D9 -- MAX11131 CNVST DigitalOut
whismanoid 0:3edb3708c8c5 1086 #else
whismanoid 0:3edb3708c8c5 1087 #define HAS_digitalInOut9 1 // P1_5 TARGET_MAX32625MBED D9
whismanoid 0:3edb3708c8c5 1088 #endif
whismanoid 0:3edb3708c8c5 1089 #if HAS_SPI
whismanoid 0:3edb3708c8c5 1090 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:3edb3708c8c5 1091 #define HAS_digitalInOut10 0 // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:3edb3708c8c5 1092 #define HAS_digitalInOut11 0 // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:3edb3708c8c5 1093 #define HAS_digitalInOut12 0 // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:3edb3708c8c5 1094 #define HAS_digitalInOut13 0 // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:3edb3708c8c5 1095 #else // HAS_SPI
whismanoid 0:3edb3708c8c5 1096 #define HAS_digitalInOut10 1 // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:3edb3708c8c5 1097 #define HAS_digitalInOut11 1 // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:3edb3708c8c5 1098 #define HAS_digitalInOut12 1 // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:3edb3708c8c5 1099 #define HAS_digitalInOut13 1 // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:3edb3708c8c5 1100 #endif // HAS_SPI
whismanoid 0:3edb3708c8c5 1101 #if HAS_I2C
whismanoid 0:3edb3708c8c5 1102 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:3edb3708c8c5 1103 #define HAS_digitalInOut14 0 // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:3edb3708c8c5 1104 #define HAS_digitalInOut15 0 // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:3edb3708c8c5 1105 #define HAS_digitalInOut16 0 // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:3edb3708c8c5 1106 #define HAS_digitalInOut17 0 // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:3edb3708c8c5 1107 #else // HAS_I2C
whismanoid 0:3edb3708c8c5 1108 #define HAS_digitalInOut14 1 // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:3edb3708c8c5 1109 #define HAS_digitalInOut15 1 // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:3edb3708c8c5 1110 #define HAS_digitalInOut16 1 // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:3edb3708c8c5 1111 #define HAS_digitalInOut17 1 // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:3edb3708c8c5 1112 #endif // HAS_I2C
whismanoid 0:3edb3708c8c5 1113 #if HAS_digitalInOut0
whismanoid 0:3edb3708c8c5 1114 DigitalInOut digitalInOut0(P0_0, PIN_INPUT, PullUp, 1); // P0_0 TARGET_MAX32625MBED D0
whismanoid 0:3edb3708c8c5 1115 #endif
whismanoid 0:3edb3708c8c5 1116 #if HAS_digitalInOut1
whismanoid 0:3edb3708c8c5 1117 DigitalInOut digitalInOut1(P0_1, PIN_INPUT, PullUp, 1); // P0_1 TARGET_MAX32625MBED D1
whismanoid 0:3edb3708c8c5 1118 #endif
whismanoid 0:3edb3708c8c5 1119 #if HAS_digitalInOut2
whismanoid 0:3edb3708c8c5 1120 DigitalInOut digitalInOut2(P0_2, PIN_INPUT, PullUp, 1); // P0_2 TARGET_MAX32625MBED D2
whismanoid 0:3edb3708c8c5 1121 #endif
whismanoid 0:3edb3708c8c5 1122 #if HAS_digitalInOut3
whismanoid 0:3edb3708c8c5 1123 DigitalInOut digitalInOut3(P0_3, PIN_INPUT, PullUp, 1); // P0_3 TARGET_MAX32625MBED D3
whismanoid 0:3edb3708c8c5 1124 #endif
whismanoid 0:3edb3708c8c5 1125 #if HAS_digitalInOut4
whismanoid 0:3edb3708c8c5 1126 DigitalInOut digitalInOut4(P0_4, PIN_INPUT, PullUp, 1); // P0_4 TARGET_MAX32625MBED D4
whismanoid 0:3edb3708c8c5 1127 #endif
whismanoid 0:3edb3708c8c5 1128 #if HAS_digitalInOut5
whismanoid 0:3edb3708c8c5 1129 DigitalInOut digitalInOut5(P0_5, PIN_INPUT, PullUp, 1); // P0_5 TARGET_MAX32625MBED D5
whismanoid 0:3edb3708c8c5 1130 #endif
whismanoid 0:3edb3708c8c5 1131 #if HAS_digitalInOut6
whismanoid 0:3edb3708c8c5 1132 DigitalInOut digitalInOut6(P0_6, PIN_INPUT, PullUp, 1); // P0_6 TARGET_MAX32625MBED D6
whismanoid 0:3edb3708c8c5 1133 #endif
whismanoid 0:3edb3708c8c5 1134 #if HAS_digitalInOut7
whismanoid 0:3edb3708c8c5 1135 DigitalInOut digitalInOut7(P0_7, PIN_INPUT, PullUp, 1); // P0_7 TARGET_MAX32625MBED D7
whismanoid 0:3edb3708c8c5 1136 #endif
whismanoid 0:3edb3708c8c5 1137 #if HAS_digitalInOut8
whismanoid 0:3edb3708c8c5 1138 DigitalInOut digitalInOut8(P1_4, PIN_INPUT, PullUp, 1); // P1_4 TARGET_MAX32625MBED D8
whismanoid 0:3edb3708c8c5 1139 #endif
whismanoid 0:3edb3708c8c5 1140 #if HAS_digitalInOut9
whismanoid 0:3edb3708c8c5 1141 DigitalInOut digitalInOut9(P1_5, PIN_INPUT, PullUp, 1); // P1_5 TARGET_MAX32625MBED D9
whismanoid 0:3edb3708c8c5 1142 #endif
whismanoid 0:3edb3708c8c5 1143 #if HAS_digitalInOut10
whismanoid 0:3edb3708c8c5 1144 DigitalInOut digitalInOut10(P1_3, PIN_INPUT, PullUp, 1); // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:3edb3708c8c5 1145 #endif
whismanoid 0:3edb3708c8c5 1146 #if HAS_digitalInOut11
whismanoid 0:3edb3708c8c5 1147 DigitalInOut digitalInOut11(P1_1, PIN_INPUT, PullUp, 1); // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:3edb3708c8c5 1148 #endif
whismanoid 0:3edb3708c8c5 1149 #if HAS_digitalInOut12
whismanoid 0:3edb3708c8c5 1150 DigitalInOut digitalInOut12(P1_2, PIN_INPUT, PullUp, 1); // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:3edb3708c8c5 1151 #endif
whismanoid 0:3edb3708c8c5 1152 #if HAS_digitalInOut13
whismanoid 0:3edb3708c8c5 1153 DigitalInOut digitalInOut13(P1_0, PIN_INPUT, PullUp, 1); // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:3edb3708c8c5 1154 #endif
whismanoid 0:3edb3708c8c5 1155 #if HAS_digitalInOut14
whismanoid 0:3edb3708c8c5 1156 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:3edb3708c8c5 1157 // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain
whismanoid 0:3edb3708c8c5 1158 DigitalInOut digitalInOut14(P1_6, PIN_INPUT, OpenDrain, 1); // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:3edb3708c8c5 1159 #endif
whismanoid 0:3edb3708c8c5 1160 #if HAS_digitalInOut15
whismanoid 0:3edb3708c8c5 1161 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:3edb3708c8c5 1162 DigitalInOut digitalInOut15(P1_7, PIN_INPUT, OpenDrain, 1); // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:3edb3708c8c5 1163 #endif
whismanoid 0:3edb3708c8c5 1164 #if HAS_digitalInOut16
whismanoid 0:3edb3708c8c5 1165 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:3edb3708c8c5 1166 // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain
whismanoid 0:3edb3708c8c5 1167 // PullUp-->3.4V, PullDown-->1.7V, PullNone-->3.5V, OpenDrain-->0.00V
whismanoid 0:3edb3708c8c5 1168 DigitalInOut digitalInOut16(P3_4, PIN_INPUT, OpenDrain, 0); // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:3edb3708c8c5 1169 #endif
whismanoid 0:3edb3708c8c5 1170 #if HAS_digitalInOut17
whismanoid 0:3edb3708c8c5 1171 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:3edb3708c8c5 1172 DigitalInOut digitalInOut17(P3_5, PIN_INPUT, OpenDrain, 0); // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:3edb3708c8c5 1173 #endif
whismanoid 0:3edb3708c8c5 1174 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1175 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:3edb3708c8c5 1176 #define HAS_digitalInOut0 0 // P0_0 TARGET_MAX32625MBED D0
whismanoid 0:3edb3708c8c5 1177 #define HAS_digitalInOut1 0 // P0_1 TARGET_MAX32625MBED D1
whismanoid 0:3edb3708c8c5 1178 #if APPLICATION_MAX11131
whismanoid 0:3edb3708c8c5 1179 #define HAS_digitalInOut2 0 // P0_2 TARGET_MAX32625MBED D2 -- MAX11131 EOC DigitalIn
whismanoid 0:3edb3708c8c5 1180 #else
whismanoid 0:3edb3708c8c5 1181 #define HAS_digitalInOut2 1 // P0_2 TARGET_MAX32625MBED D2
whismanoid 0:3edb3708c8c5 1182 #endif
whismanoid 0:3edb3708c8c5 1183 #define HAS_digitalInOut3 1 // P0_3 TARGET_MAX32625MBED D3
whismanoid 0:3edb3708c8c5 1184 #define HAS_digitalInOut4 1 // P0_4 TARGET_MAX32625MBED D4
whismanoid 0:3edb3708c8c5 1185 #define HAS_digitalInOut5 1 // P0_5 TARGET_MAX32625MBED D5
whismanoid 0:3edb3708c8c5 1186 #define HAS_digitalInOut6 1 // P0_6 TARGET_MAX32625MBED D6
whismanoid 0:3edb3708c8c5 1187 #define HAS_digitalInOut7 1 // P0_7 TARGET_MAX32625MBED D7
whismanoid 0:3edb3708c8c5 1188 #if APPLICATION_MAX5715
whismanoid 0:3edb3708c8c5 1189 #define HAS_digitalInOut8 0 // P1_4 TARGET_MAX32625MBED D8 -- MAX5715 CLRb DigitalOut
whismanoid 0:3edb3708c8c5 1190 #else
whismanoid 0:3edb3708c8c5 1191 #define HAS_digitalInOut8 1 // P1_4 TARGET_MAX32625MBED D8
whismanoid 0:3edb3708c8c5 1192 #endif
whismanoid 0:3edb3708c8c5 1193 #if APPLICATION_MAX5715
whismanoid 0:3edb3708c8c5 1194 #define HAS_digitalInOut9 0 // P1_5 TARGET_MAX32625MBED D9 -- MAX5715 LDACb DigitalOut
whismanoid 0:3edb3708c8c5 1195 #elif APPLICATION_MAX11131
whismanoid 0:3edb3708c8c5 1196 #define HAS_digitalInOut9 0 // P1_5 TARGET_MAX32625MBED D9 -- MAX11131 CNVST DigitalOut
whismanoid 0:3edb3708c8c5 1197 #else
whismanoid 0:3edb3708c8c5 1198 #define HAS_digitalInOut9 1 // P1_5 TARGET_MAX32625MBED D9
whismanoid 0:3edb3708c8c5 1199 #endif
whismanoid 0:3edb3708c8c5 1200 #if HAS_SPI
whismanoid 0:3edb3708c8c5 1201 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:3edb3708c8c5 1202 // Arduino digital pin D10 SPI function is CS/10
whismanoid 0:3edb3708c8c5 1203 // Arduino digital pin D11 SPI function is MOSI/11
whismanoid 0:3edb3708c8c5 1204 // Arduino digital pin D12 SPI function is MISO/12
whismanoid 0:3edb3708c8c5 1205 // Arduino digital pin D13 SPI function is SCK/13
whismanoid 0:3edb3708c8c5 1206 #define HAS_digitalInOut10 0
whismanoid 0:3edb3708c8c5 1207 #define HAS_digitalInOut11 0
whismanoid 0:3edb3708c8c5 1208 #define HAS_digitalInOut12 0
whismanoid 0:3edb3708c8c5 1209 #define HAS_digitalInOut13 0
whismanoid 0:3edb3708c8c5 1210 #else // HAS_SPI
whismanoid 0:3edb3708c8c5 1211 #define HAS_digitalInOut10 1
whismanoid 0:3edb3708c8c5 1212 #define HAS_digitalInOut11 1
whismanoid 0:3edb3708c8c5 1213 #define HAS_digitalInOut12 1
whismanoid 0:3edb3708c8c5 1214 #define HAS_digitalInOut13 1
whismanoid 0:3edb3708c8c5 1215 #endif // HAS_SPI
whismanoid 0:3edb3708c8c5 1216 #if HAS_I2C
whismanoid 0:3edb3708c8c5 1217 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:3edb3708c8c5 1218 // Arduino digital pin D14 I2C function is A4/SDA (10pin digital connector)
whismanoid 0:3edb3708c8c5 1219 // Arduino digital pin D15 I2C function is A5/SCL (10pin digital connector)
whismanoid 0:3edb3708c8c5 1220 // Arduino digital pin D16 I2C function is A4/SDA (6pin analog connector)
whismanoid 0:3edb3708c8c5 1221 // Arduino digital pin D17 I2C function is A5/SCL (6pin analog connector)
whismanoid 0:3edb3708c8c5 1222 #define HAS_digitalInOut14 0
whismanoid 0:3edb3708c8c5 1223 #define HAS_digitalInOut15 0
whismanoid 0:3edb3708c8c5 1224 #define HAS_digitalInOut16 0
whismanoid 0:3edb3708c8c5 1225 #define HAS_digitalInOut17 0
whismanoid 0:3edb3708c8c5 1226 #else // HAS_I2C
whismanoid 0:3edb3708c8c5 1227 #define HAS_digitalInOut14 1
whismanoid 0:3edb3708c8c5 1228 #define HAS_digitalInOut15 1
whismanoid 0:3edb3708c8c5 1229 #define HAS_digitalInOut16 0
whismanoid 0:3edb3708c8c5 1230 #define HAS_digitalInOut17 0
whismanoid 0:3edb3708c8c5 1231 #endif // HAS_I2C
whismanoid 0:3edb3708c8c5 1232 #if HAS_digitalInOut0
whismanoid 0:3edb3708c8c5 1233 DigitalInOut digitalInOut0(D0, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1234 #endif
whismanoid 0:3edb3708c8c5 1235 #if HAS_digitalInOut1
whismanoid 0:3edb3708c8c5 1236 DigitalInOut digitalInOut1(D1, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1237 #endif
whismanoid 0:3edb3708c8c5 1238 #if HAS_digitalInOut2
whismanoid 0:3edb3708c8c5 1239 DigitalInOut digitalInOut2(D2, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1240 #endif
whismanoid 0:3edb3708c8c5 1241 #if HAS_digitalInOut3
whismanoid 0:3edb3708c8c5 1242 DigitalInOut digitalInOut3(D3, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1243 #endif
whismanoid 0:3edb3708c8c5 1244 #if HAS_digitalInOut4
whismanoid 0:3edb3708c8c5 1245 DigitalInOut digitalInOut4(D4, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1246 #endif
whismanoid 0:3edb3708c8c5 1247 #if HAS_digitalInOut5
whismanoid 0:3edb3708c8c5 1248 DigitalInOut digitalInOut5(D5, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1249 #endif
whismanoid 0:3edb3708c8c5 1250 #if HAS_digitalInOut6
whismanoid 0:3edb3708c8c5 1251 DigitalInOut digitalInOut6(D6, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1252 #endif
whismanoid 0:3edb3708c8c5 1253 #if HAS_digitalInOut7
whismanoid 0:3edb3708c8c5 1254 DigitalInOut digitalInOut7(D7, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1255 #endif
whismanoid 0:3edb3708c8c5 1256 #if HAS_digitalInOut8
whismanoid 0:3edb3708c8c5 1257 DigitalInOut digitalInOut8(D8, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1258 #endif
whismanoid 0:3edb3708c8c5 1259 #if HAS_digitalInOut9
whismanoid 0:3edb3708c8c5 1260 DigitalInOut digitalInOut9(D9, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1261 #endif
whismanoid 0:3edb3708c8c5 1262 #if HAS_digitalInOut10
whismanoid 0:3edb3708c8c5 1263 // Arduino digital pin D10 SPI function is CS/10
whismanoid 0:3edb3708c8c5 1264 DigitalInOut digitalInOut10(D10, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1265 #endif
whismanoid 0:3edb3708c8c5 1266 #if HAS_digitalInOut11
whismanoid 0:3edb3708c8c5 1267 // Arduino digital pin D11 SPI function is MOSI/11
whismanoid 0:3edb3708c8c5 1268 DigitalInOut digitalInOut11(D11, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1269 #endif
whismanoid 0:3edb3708c8c5 1270 #if HAS_digitalInOut12
whismanoid 0:3edb3708c8c5 1271 // Arduino digital pin D12 SPI function is MISO/12
whismanoid 0:3edb3708c8c5 1272 DigitalInOut digitalInOut12(D12, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1273 #endif
whismanoid 0:3edb3708c8c5 1274 #if HAS_digitalInOut13
whismanoid 0:3edb3708c8c5 1275 // Arduino digital pin D13 SPI function is SCK/13
whismanoid 0:3edb3708c8c5 1276 DigitalInOut digitalInOut13(D13, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1277 #endif
whismanoid 0:3edb3708c8c5 1278 #if HAS_digitalInOut14
whismanoid 0:3edb3708c8c5 1279 // Arduino digital pin D14 I2C function is A4/SDA (10pin digital connector)
whismanoid 0:3edb3708c8c5 1280 DigitalInOut digitalInOut14(D14, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1281 #endif
whismanoid 0:3edb3708c8c5 1282 #if HAS_digitalInOut15
whismanoid 0:3edb3708c8c5 1283 // Arduino digital pin D15 I2C function is A5/SCL (10pin digital connector)
whismanoid 0:3edb3708c8c5 1284 DigitalInOut digitalInOut15(D15, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1285 #endif
whismanoid 0:3edb3708c8c5 1286 #if HAS_digitalInOut16
whismanoid 0:3edb3708c8c5 1287 // Arduino digital pin D16 I2C function is A4/SDA (6pin analog connector)
whismanoid 0:3edb3708c8c5 1288 DigitalInOut digitalInOut16(D16, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1289 #endif
whismanoid 0:3edb3708c8c5 1290 #if HAS_digitalInOut17
whismanoid 0:3edb3708c8c5 1291 // Arduino digital pin D17 I2C function is A5/SCL (6pin analog connector)
whismanoid 0:3edb3708c8c5 1292 DigitalInOut digitalInOut17(D17, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1293 #endif
whismanoid 0:3edb3708c8c5 1294 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1295 #elif defined(TARGET_LPC1768)
whismanoid 0:3edb3708c8c5 1296 #define HAS_digitalInOut0 1
whismanoid 0:3edb3708c8c5 1297 #define HAS_digitalInOut1 1
whismanoid 0:3edb3708c8c5 1298 #define HAS_digitalInOut2 1
whismanoid 0:3edb3708c8c5 1299 #define HAS_digitalInOut3 1
whismanoid 0:3edb3708c8c5 1300 #define HAS_digitalInOut4 1
whismanoid 0:3edb3708c8c5 1301 #define HAS_digitalInOut5 1
whismanoid 0:3edb3708c8c5 1302 #define HAS_digitalInOut6 1
whismanoid 0:3edb3708c8c5 1303 #define HAS_digitalInOut7 1
whismanoid 0:3edb3708c8c5 1304 #define HAS_digitalInOut8 1
whismanoid 0:3edb3708c8c5 1305 #define HAS_digitalInOut9 1
whismanoid 0:3edb3708c8c5 1306 // #define HAS_digitalInOut10 1
whismanoid 0:3edb3708c8c5 1307 // #define HAS_digitalInOut11 1
whismanoid 0:3edb3708c8c5 1308 // #define HAS_digitalInOut12 1
whismanoid 0:3edb3708c8c5 1309 // #define HAS_digitalInOut13 1
whismanoid 0:3edb3708c8c5 1310 // #define HAS_digitalInOut14 1
whismanoid 0:3edb3708c8c5 1311 // #define HAS_digitalInOut15 1
whismanoid 0:3edb3708c8c5 1312 #if HAS_digitalInOut0
whismanoid 0:3edb3708c8c5 1313 DigitalInOut digitalInOut0(p5, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.9/I2STX_SDA/MOSI1/MAT2.3
whismanoid 0:3edb3708c8c5 1314 #endif
whismanoid 0:3edb3708c8c5 1315 #if HAS_digitalInOut1
whismanoid 0:3edb3708c8c5 1316 DigitalInOut digitalInOut1(p6, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.8/I2STX_WS/MISO1/MAT2.2
whismanoid 0:3edb3708c8c5 1317 #endif
whismanoid 0:3edb3708c8c5 1318 #if HAS_digitalInOut2
whismanoid 0:3edb3708c8c5 1319 DigitalInOut digitalInOut2(p7, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.7/I2STX_CLK/SCK1/MAT2.1
whismanoid 0:3edb3708c8c5 1320 #endif
whismanoid 0:3edb3708c8c5 1321 #if HAS_digitalInOut3
whismanoid 0:3edb3708c8c5 1322 DigitalInOut digitalInOut3(p8, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.6/I2SRX_SDA/SSEL1/MAT2.0
whismanoid 0:3edb3708c8c5 1323 #endif
whismanoid 0:3edb3708c8c5 1324 #if HAS_digitalInOut4
whismanoid 0:3edb3708c8c5 1325 DigitalInOut digitalInOut4(p9, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.0/CAN_RX1/TXD3/SDA1
whismanoid 0:3edb3708c8c5 1326 #endif
whismanoid 0:3edb3708c8c5 1327 #if HAS_digitalInOut5
whismanoid 0:3edb3708c8c5 1328 DigitalInOut digitalInOut5(p10, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.1/CAN_TX1/RXD3/SCL1
whismanoid 0:3edb3708c8c5 1329 #endif
whismanoid 0:3edb3708c8c5 1330 #if HAS_digitalInOut6
whismanoid 0:3edb3708c8c5 1331 DigitalInOut digitalInOut6(p11, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.18/DCD1/MOSI0/MOSI1
whismanoid 0:3edb3708c8c5 1332 #endif
whismanoid 0:3edb3708c8c5 1333 #if HAS_digitalInOut7
whismanoid 0:3edb3708c8c5 1334 DigitalInOut digitalInOut7(p12, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.17/CTS1/MISO0/MISO
whismanoid 0:3edb3708c8c5 1335 #endif
whismanoid 0:3edb3708c8c5 1336 #if HAS_digitalInOut8
whismanoid 0:3edb3708c8c5 1337 DigitalInOut digitalInOut8(p13, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.15/TXD1/SCK0/SCK
whismanoid 0:3edb3708c8c5 1338 #endif
whismanoid 0:3edb3708c8c5 1339 #if HAS_digitalInOut9
whismanoid 0:3edb3708c8c5 1340 DigitalInOut digitalInOut9(p14, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.16/RXD1/SSEL0/SSEL
whismanoid 0:3edb3708c8c5 1341 #endif
whismanoid 0:3edb3708c8c5 1342 //
whismanoid 0:3edb3708c8c5 1343 // these pins support analog input analogIn0 .. analogIn5
whismanoid 0:3edb3708c8c5 1344 //DigitalInOut digitalInOut_(p15, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.23/AD0.0/I2SRX_CLK/CAP3.0
whismanoid 0:3edb3708c8c5 1345 //DigitalInOut digitalInOut_(p16, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.24/AD0.1/I2SRX_WS/CAP3.1
whismanoid 0:3edb3708c8c5 1346 //DigitalInOut digitalInOut_(p17, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.25/AD0.2/I2SRX_SDA/TXD3
whismanoid 0:3edb3708c8c5 1347 //DigitalInOut digitalInOut_(p18, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.26/AD0.3/AOUT/RXD3
whismanoid 0:3edb3708c8c5 1348 //DigitalInOut digitalInOut_(p19, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P1.30/VBUS/AD0.4
whismanoid 0:3edb3708c8c5 1349 //DigitalInOut digitalInOut_(p20, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P1.31/SCK1/AD0.5
whismanoid 0:3edb3708c8c5 1350 //
whismanoid 0:3edb3708c8c5 1351 // these pins support PWM pwmDriver1 .. pwmDriver6
whismanoid 0:3edb3708c8c5 1352 //DigitalInOut digitalInOut_(p21, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.5/PWM1.6/DTR1/TRACEDATA0
whismanoid 0:3edb3708c8c5 1353 //DigitalInOut digitalInOut_(p22, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.4/PWM1.5/DSR1/TRACEDATA1
whismanoid 0:3edb3708c8c5 1354 //DigitalInOut digitalInOut_(p23, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.3/PWM1.4/DCD1/TRACEDATA2
whismanoid 0:3edb3708c8c5 1355 //DigitalInOut digitalInOut_(p24, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.2/PWM1.3/CTS1/TRACEDATA3
whismanoid 0:3edb3708c8c5 1356 //DigitalInOut digitalInOut_(p25, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.1/PWM1.2/RXD1
whismanoid 0:3edb3708c8c5 1357 //DigitalInOut digitalInOut_(p26, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.0/PWM1.1/TXD1/TRACECLK
whismanoid 0:3edb3708c8c5 1358 //
whismanoid 0:3edb3708c8c5 1359 // these could be additional digitalInOut pins
whismanoid 0:3edb3708c8c5 1360 #if HAS_digitalInOut10
whismanoid 0:3edb3708c8c5 1361 DigitalInOut digitalInOut10(p27, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.11/RXD2/SCL2/MAT3.1
whismanoid 0:3edb3708c8c5 1362 #endif
whismanoid 0:3edb3708c8c5 1363 #if HAS_digitalInOut11
whismanoid 0:3edb3708c8c5 1364 DigitalInOut digitalInOut11(p28, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.10/TXD2/SDA2/MAT3.0
whismanoid 0:3edb3708c8c5 1365 #endif
whismanoid 0:3edb3708c8c5 1366 #if HAS_digitalInOut12
whismanoid 0:3edb3708c8c5 1367 DigitalInOut digitalInOut12(p29, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.5/I2SRX_WS/CAN_TX2/CAP2.1
whismanoid 0:3edb3708c8c5 1368 #endif
whismanoid 0:3edb3708c8c5 1369 #if HAS_digitalInOut13
whismanoid 0:3edb3708c8c5 1370 DigitalInOut digitalInOut13(p30, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.4/I2SRX_CLK/CAN_RX2/CAP2.0
whismanoid 0:3edb3708c8c5 1371 #endif
whismanoid 0:3edb3708c8c5 1372 #if HAS_digitalInOut14
whismanoid 0:3edb3708c8c5 1373 DigitalInOut digitalInOut14(___, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1374 #endif
whismanoid 0:3edb3708c8c5 1375 #if HAS_digitalInOut15
whismanoid 0:3edb3708c8c5 1376 DigitalInOut digitalInOut15(___, PIN_INPUT, PullUp, 1);
whismanoid 0:3edb3708c8c5 1377 #endif
whismanoid 0:3edb3708c8c5 1378 #else
whismanoid 0:3edb3708c8c5 1379 // unknown target
whismanoid 0:3edb3708c8c5 1380 #endif
whismanoid 0:3edb3708c8c5 1381 // uncrustify-0.66.1 *INDENT-ON*
whismanoid 0:3edb3708c8c5 1382 #if HAS_digitalInOut0 || HAS_digitalInOut1 \
whismanoid 0:3edb3708c8c5 1383 || HAS_digitalInOut2 || HAS_digitalInOut3 \
whismanoid 0:3edb3708c8c5 1384 || HAS_digitalInOut4 || HAS_digitalInOut5 \
whismanoid 0:3edb3708c8c5 1385 || HAS_digitalInOut6 || HAS_digitalInOut7 \
whismanoid 0:3edb3708c8c5 1386 || HAS_digitalInOut8 || HAS_digitalInOut9 \
whismanoid 0:3edb3708c8c5 1387 || HAS_digitalInOut10 || HAS_digitalInOut11 \
whismanoid 0:3edb3708c8c5 1388 || HAS_digitalInOut12 || HAS_digitalInOut13 \
whismanoid 0:3edb3708c8c5 1389 || HAS_digitalInOut14 || HAS_digitalInOut15 \
whismanoid 0:3edb3708c8c5 1390 || HAS_digitalInOut16 || HAS_digitalInOut17
whismanoid 0:3edb3708c8c5 1391 #define HAS_digitalInOuts 1
whismanoid 0:3edb3708c8c5 1392 #endif
whismanoid 0:3edb3708c8c5 1393
whismanoid 0:3edb3708c8c5 1394 // uncrustify-0.66.1 *INDENT-OFF*
whismanoid 0:3edb3708c8c5 1395 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1396 // Declare the AnalogIn driver
whismanoid 0:3edb3708c8c5 1397 // Optional analogIn support. If there is only one it should be analogIn1.
whismanoid 0:3edb3708c8c5 1398 // A) analog input
whismanoid 0:3edb3708c8c5 1399 #if defined(TARGET_MAX32630)
whismanoid 0:3edb3708c8c5 1400 #define HAS_analogIn0 1
whismanoid 0:3edb3708c8c5 1401 #define HAS_analogIn1 1
whismanoid 0:3edb3708c8c5 1402 #define HAS_analogIn2 1
whismanoid 0:3edb3708c8c5 1403 #define HAS_analogIn3 1
whismanoid 0:3edb3708c8c5 1404 #define HAS_analogIn4 1
whismanoid 0:3edb3708c8c5 1405 #define HAS_analogIn5 1
whismanoid 0:3edb3708c8c5 1406 #define HAS_analogIn6 1
whismanoid 0:3edb3708c8c5 1407 #define HAS_analogIn7 1
whismanoid 0:3edb3708c8c5 1408 #define HAS_analogIn8 1
whismanoid 0:3edb3708c8c5 1409 #define HAS_analogIn9 1
whismanoid 0:3edb3708c8c5 1410 // #define HAS_analogIn10 0
whismanoid 0:3edb3708c8c5 1411 // #define HAS_analogIn11 0
whismanoid 0:3edb3708c8c5 1412 // #define HAS_analogIn12 0
whismanoid 0:3edb3708c8c5 1413 // #define HAS_analogIn13 0
whismanoid 0:3edb3708c8c5 1414 // #define HAS_analogIn14 0
whismanoid 0:3edb3708c8c5 1415 // #define HAS_analogIn15 0
whismanoid 0:3edb3708c8c5 1416 #if HAS_analogIn0
whismanoid 0:3edb3708c8c5 1417 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 1418 #endif
whismanoid 0:3edb3708c8c5 1419 #if HAS_analogIn1
whismanoid 0:3edb3708c8c5 1420 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 1421 #endif
whismanoid 0:3edb3708c8c5 1422 #if HAS_analogIn2
whismanoid 0:3edb3708c8c5 1423 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 1424 #endif
whismanoid 0:3edb3708c8c5 1425 #if HAS_analogIn3
whismanoid 0:3edb3708c8c5 1426 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 1427 #endif
whismanoid 0:3edb3708c8c5 1428 #if HAS_analogIn4
whismanoid 0:3edb3708c8c5 1429 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:3edb3708c8c5 1430 #endif
whismanoid 0:3edb3708c8c5 1431 #if HAS_analogIn5
whismanoid 0:3edb3708c8c5 1432 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:3edb3708c8c5 1433 #endif
whismanoid 0:3edb3708c8c5 1434 #if HAS_analogIn6
whismanoid 0:3edb3708c8c5 1435 AnalogIn analogIn6(AIN_6); // TARGET_MAX32630 AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:3edb3708c8c5 1436 #endif
whismanoid 0:3edb3708c8c5 1437 #if HAS_analogIn7
whismanoid 0:3edb3708c8c5 1438 AnalogIn analogIn7(AIN_7); // TARGET_MAX32630 AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:3edb3708c8c5 1439 #endif
whismanoid 0:3edb3708c8c5 1440 #if HAS_analogIn8
whismanoid 0:3edb3708c8c5 1441 AnalogIn analogIn8(AIN_8); // TARGET_MAX32630 AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:3edb3708c8c5 1442 #endif
whismanoid 0:3edb3708c8c5 1443 #if HAS_analogIn9
whismanoid 0:3edb3708c8c5 1444 AnalogIn analogIn9(AIN_9); // TARGET_MAX32630 AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:3edb3708c8c5 1445 #endif
whismanoid 0:3edb3708c8c5 1446 #if HAS_analogIn10
whismanoid 0:3edb3708c8c5 1447 AnalogIn analogIn10(____); // TARGET_MAX32630 AIN_10 = x undefined?
whismanoid 0:3edb3708c8c5 1448 #endif
whismanoid 0:3edb3708c8c5 1449 #if HAS_analogIn11
whismanoid 0:3edb3708c8c5 1450 AnalogIn analogIn11(____); // TARGET_MAX32630 AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:3edb3708c8c5 1451 #endif
whismanoid 0:3edb3708c8c5 1452 #if HAS_analogIn12
whismanoid 0:3edb3708c8c5 1453 AnalogIn analogIn12(____); // TARGET_MAX32630 AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:3edb3708c8c5 1454 #endif
whismanoid 0:3edb3708c8c5 1455 #if HAS_analogIn13
whismanoid 0:3edb3708c8c5 1456 AnalogIn analogIn13(____);
whismanoid 0:3edb3708c8c5 1457 #endif
whismanoid 0:3edb3708c8c5 1458 #if HAS_analogIn14
whismanoid 0:3edb3708c8c5 1459 AnalogIn analogIn14(____);
whismanoid 0:3edb3708c8c5 1460 #endif
whismanoid 0:3edb3708c8c5 1461 #if HAS_analogIn15
whismanoid 0:3edb3708c8c5 1462 AnalogIn analogIn15(____);
whismanoid 0:3edb3708c8c5 1463 #endif
whismanoid 0:3edb3708c8c5 1464 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1465 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:3edb3708c8c5 1466 #define HAS_analogIn0 1
whismanoid 0:3edb3708c8c5 1467 #define HAS_analogIn1 1
whismanoid 0:3edb3708c8c5 1468 #define HAS_analogIn2 1
whismanoid 0:3edb3708c8c5 1469 #define HAS_analogIn3 1
whismanoid 0:3edb3708c8c5 1470 #define HAS_analogIn4 1
whismanoid 0:3edb3708c8c5 1471 #define HAS_analogIn5 1
whismanoid 0:3edb3708c8c5 1472 #if HAS_analogIn0
whismanoid 0:3edb3708c8c5 1473 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 1474 #endif
whismanoid 0:3edb3708c8c5 1475 #if HAS_analogIn1
whismanoid 0:3edb3708c8c5 1476 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 1477 #endif
whismanoid 0:3edb3708c8c5 1478 #if HAS_analogIn2
whismanoid 0:3edb3708c8c5 1479 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 1480 #endif
whismanoid 0:3edb3708c8c5 1481 #if HAS_analogIn3
whismanoid 0:3edb3708c8c5 1482 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:3edb3708c8c5 1483 #endif
whismanoid 0:3edb3708c8c5 1484 #if HAS_analogIn4
whismanoid 0:3edb3708c8c5 1485 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:3edb3708c8c5 1486 #endif
whismanoid 0:3edb3708c8c5 1487 #if HAS_analogIn5
whismanoid 0:3edb3708c8c5 1488 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:3edb3708c8c5 1489 #endif
whismanoid 0:3edb3708c8c5 1490 //--------------------------------------------------
whismanoid 16:3c75011e705a 1491 #elif defined(TARGET_MAX32620FTHR)
whismanoid 16:3c75011e705a 1492 #warning "TARGET_MAX32620FTHR not previously tested; need to verify analogIn0..."
whismanoid 16:3c75011e705a 1493 #define HAS_analogIn0 1
whismanoid 16:3c75011e705a 1494 #define HAS_analogIn1 1
whismanoid 16:3c75011e705a 1495 #define HAS_analogIn2 1
whismanoid 16:3c75011e705a 1496 #define HAS_analogIn3 1
whismanoid 16:3c75011e705a 1497 #define HAS_analogIn4 1
whismanoid 16:3c75011e705a 1498 #define HAS_analogIn5 1
whismanoid 16:3c75011e705a 1499 #define HAS_analogIn6 1
whismanoid 16:3c75011e705a 1500 #define HAS_analogIn7 1
whismanoid 16:3c75011e705a 1501 #define HAS_analogIn8 1
whismanoid 16:3c75011e705a 1502 #define HAS_analogIn9 1
whismanoid 16:3c75011e705a 1503 // #define HAS_analogIn10 0
whismanoid 16:3c75011e705a 1504 // #define HAS_analogIn11 0
whismanoid 16:3c75011e705a 1505 // #define HAS_analogIn12 0
whismanoid 16:3c75011e705a 1506 // #define HAS_analogIn13 0
whismanoid 16:3c75011e705a 1507 // #define HAS_analogIn14 0
whismanoid 16:3c75011e705a 1508 // #define HAS_analogIn15 0
whismanoid 16:3c75011e705a 1509 #if HAS_analogIn0
whismanoid 16:3c75011e705a 1510 AnalogIn analogIn0(AIN_0); // TARGET_MAX32620FTHR J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 16:3c75011e705a 1511 #endif
whismanoid 16:3c75011e705a 1512 #if HAS_analogIn1
whismanoid 16:3c75011e705a 1513 AnalogIn analogIn1(AIN_1); // TARGET_MAX32620FTHR J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 16:3c75011e705a 1514 #endif
whismanoid 16:3c75011e705a 1515 #if HAS_analogIn2
whismanoid 16:3c75011e705a 1516 AnalogIn analogIn2(AIN_2); // TARGET_MAX32620FTHR J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 16:3c75011e705a 1517 #endif
whismanoid 16:3c75011e705a 1518 #if HAS_analogIn3
whismanoid 16:3c75011e705a 1519 AnalogIn analogIn3(AIN_3); // TARGET_MAX32620FTHR J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 16:3c75011e705a 1520 #endif
whismanoid 16:3c75011e705a 1521 #if HAS_analogIn4
whismanoid 16:3c75011e705a 1522 AnalogIn analogIn4(AIN_4); // TARGET_MAX32620FTHR J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 16:3c75011e705a 1523 #endif
whismanoid 16:3c75011e705a 1524 #if HAS_analogIn5
whismanoid 16:3c75011e705a 1525 AnalogIn analogIn5(AIN_5); // TARGET_MAX32620FTHR J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 16:3c75011e705a 1526 #endif
whismanoid 16:3c75011e705a 1527 #if HAS_analogIn6
whismanoid 16:3c75011e705a 1528 AnalogIn analogIn6(AIN_6); // TARGET_MAX32620FTHR AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 16:3c75011e705a 1529 #endif
whismanoid 16:3c75011e705a 1530 #if HAS_analogIn7
whismanoid 16:3c75011e705a 1531 AnalogIn analogIn7(AIN_7); // TARGET_MAX32620FTHR AIN_7 = VDD18 fullscale is 1.2V
whismanoid 16:3c75011e705a 1532 #endif
whismanoid 16:3c75011e705a 1533 #if HAS_analogIn8
whismanoid 16:3c75011e705a 1534 AnalogIn analogIn8(AIN_8); // TARGET_MAX32620FTHR AIN_8 = VDD12 fullscale is 1.2V
whismanoid 16:3c75011e705a 1535 #endif
whismanoid 16:3c75011e705a 1536 #if HAS_analogIn9
whismanoid 16:3c75011e705a 1537 AnalogIn analogIn9(AIN_9); // TARGET_MAX32620FTHR AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 16:3c75011e705a 1538 #endif
whismanoid 16:3c75011e705a 1539 #if HAS_analogIn10
whismanoid 16:3c75011e705a 1540 AnalogIn analogIn10(____); // TARGET_MAX32620FTHR AIN_10 = x undefined?
whismanoid 16:3c75011e705a 1541 #endif
whismanoid 16:3c75011e705a 1542 #if HAS_analogIn11
whismanoid 16:3c75011e705a 1543 AnalogIn analogIn11(____); // TARGET_MAX32620FTHR AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 16:3c75011e705a 1544 #endif
whismanoid 16:3c75011e705a 1545 #if HAS_analogIn12
whismanoid 16:3c75011e705a 1546 AnalogIn analogIn12(____); // TARGET_MAX32620FTHR AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 16:3c75011e705a 1547 #endif
whismanoid 16:3c75011e705a 1548 #if HAS_analogIn13
whismanoid 16:3c75011e705a 1549 AnalogIn analogIn13(____);
whismanoid 16:3c75011e705a 1550 #endif
whismanoid 16:3c75011e705a 1551 #if HAS_analogIn14
whismanoid 16:3c75011e705a 1552 AnalogIn analogIn14(____);
whismanoid 16:3c75011e705a 1553 #endif
whismanoid 16:3c75011e705a 1554 #if HAS_analogIn15
whismanoid 16:3c75011e705a 1555 AnalogIn analogIn15(____);
whismanoid 16:3c75011e705a 1556 #endif
whismanoid 16:3c75011e705a 1557 //--------------------------------------------------
whismanoid 16:3c75011e705a 1558 #elif defined(TARGET_MAX32625PICO)
whismanoid 16:3c75011e705a 1559 #warning "TARGET_MAX32625PICO not previously tested; need to verify analogIn0..."
whismanoid 16:3c75011e705a 1560 #define HAS_analogIn0 1
whismanoid 16:3c75011e705a 1561 #define HAS_analogIn1 1
whismanoid 16:3c75011e705a 1562 #define HAS_analogIn2 1
whismanoid 16:3c75011e705a 1563 #define HAS_analogIn3 1
whismanoid 16:3c75011e705a 1564 #define HAS_analogIn4 1
whismanoid 16:3c75011e705a 1565 #define HAS_analogIn5 1
whismanoid 16:3c75011e705a 1566 #if HAS_analogIn0
whismanoid 16:3c75011e705a 1567 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 16:3c75011e705a 1568 #endif
whismanoid 16:3c75011e705a 1569 #if HAS_analogIn1
whismanoid 16:3c75011e705a 1570 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 16:3c75011e705a 1571 #endif
whismanoid 16:3c75011e705a 1572 #if HAS_analogIn2
whismanoid 16:3c75011e705a 1573 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 16:3c75011e705a 1574 #endif
whismanoid 16:3c75011e705a 1575 #if HAS_analogIn3
whismanoid 16:3c75011e705a 1576 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 16:3c75011e705a 1577 #endif
whismanoid 16:3c75011e705a 1578 #if HAS_analogIn4
whismanoid 16:3c75011e705a 1579 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 16:3c75011e705a 1580 #endif
whismanoid 16:3c75011e705a 1581 #if HAS_analogIn5
whismanoid 16:3c75011e705a 1582 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 16:3c75011e705a 1583 #endif
whismanoid 16:3c75011e705a 1584 //--------------------------------------------------
whismanoid 11:9fa2402071de 1585 #elif defined(TARGET_MAX32600)
whismanoid 11:9fa2402071de 1586 #define HAS_analogIn0 1
whismanoid 11:9fa2402071de 1587 #define HAS_analogIn1 1
whismanoid 11:9fa2402071de 1588 #define HAS_analogIn2 1
whismanoid 11:9fa2402071de 1589 #define HAS_analogIn3 1
whismanoid 11:9fa2402071de 1590 #define HAS_analogIn4 1
whismanoid 11:9fa2402071de 1591 #define HAS_analogIn5 1
whismanoid 11:9fa2402071de 1592 #if HAS_analogIn0
whismanoid 11:9fa2402071de 1593 AnalogIn analogIn0(A0);
whismanoid 11:9fa2402071de 1594 #endif
whismanoid 11:9fa2402071de 1595 #if HAS_analogIn1
whismanoid 11:9fa2402071de 1596 AnalogIn analogIn1(A1);
whismanoid 11:9fa2402071de 1597 #endif
whismanoid 11:9fa2402071de 1598 #if HAS_analogIn2
whismanoid 11:9fa2402071de 1599 AnalogIn analogIn2(A2);
whismanoid 11:9fa2402071de 1600 #endif
whismanoid 11:9fa2402071de 1601 #if HAS_analogIn3
whismanoid 11:9fa2402071de 1602 AnalogIn analogIn3(A3);
whismanoid 11:9fa2402071de 1603 #endif
whismanoid 11:9fa2402071de 1604 #if HAS_analogIn4
whismanoid 11:9fa2402071de 1605 AnalogIn analogIn4(A4);
whismanoid 11:9fa2402071de 1606 #endif
whismanoid 11:9fa2402071de 1607 #if HAS_analogIn5
whismanoid 11:9fa2402071de 1608 AnalogIn analogIn5(A5);
whismanoid 11:9fa2402071de 1609 #endif
whismanoid 11:9fa2402071de 1610 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1611 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:3edb3708c8c5 1612 #define HAS_analogIn0 1
whismanoid 0:3edb3708c8c5 1613 #define HAS_analogIn1 1
whismanoid 0:3edb3708c8c5 1614 #define HAS_analogIn2 1
whismanoid 0:3edb3708c8c5 1615 #define HAS_analogIn3 1
whismanoid 0:3edb3708c8c5 1616 #define HAS_analogIn4 1
whismanoid 0:3edb3708c8c5 1617 #define HAS_analogIn5 1
whismanoid 0:3edb3708c8c5 1618 #if HAS_analogIn0
whismanoid 0:3edb3708c8c5 1619 AnalogIn analogIn0(A0);
whismanoid 0:3edb3708c8c5 1620 #endif
whismanoid 0:3edb3708c8c5 1621 #if HAS_analogIn1
whismanoid 0:3edb3708c8c5 1622 AnalogIn analogIn1(A1);
whismanoid 0:3edb3708c8c5 1623 #endif
whismanoid 0:3edb3708c8c5 1624 #if HAS_analogIn2
whismanoid 0:3edb3708c8c5 1625 AnalogIn analogIn2(A2);
whismanoid 0:3edb3708c8c5 1626 #endif
whismanoid 0:3edb3708c8c5 1627 #if HAS_analogIn3
whismanoid 0:3edb3708c8c5 1628 AnalogIn analogIn3(A3);
whismanoid 0:3edb3708c8c5 1629 #endif
whismanoid 0:3edb3708c8c5 1630 #if HAS_analogIn4
whismanoid 0:3edb3708c8c5 1631 AnalogIn analogIn4(A4);
whismanoid 0:3edb3708c8c5 1632 #endif
whismanoid 0:3edb3708c8c5 1633 #if HAS_analogIn5
whismanoid 0:3edb3708c8c5 1634 AnalogIn analogIn5(A5);
whismanoid 0:3edb3708c8c5 1635 #endif
whismanoid 0:3edb3708c8c5 1636 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1637 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:3edb3708c8c5 1638 #define HAS_analogIn0 1
whismanoid 0:3edb3708c8c5 1639 #define HAS_analogIn1 1
whismanoid 0:3edb3708c8c5 1640 #define HAS_analogIn2 1
whismanoid 0:3edb3708c8c5 1641 #define HAS_analogIn3 1
whismanoid 0:3edb3708c8c5 1642 #define HAS_analogIn4 1
whismanoid 0:3edb3708c8c5 1643 #define HAS_analogIn5 1
whismanoid 0:3edb3708c8c5 1644 #if HAS_analogIn0
whismanoid 0:3edb3708c8c5 1645 AnalogIn analogIn0(A0);
whismanoid 0:3edb3708c8c5 1646 #endif
whismanoid 0:3edb3708c8c5 1647 #if HAS_analogIn1
whismanoid 0:3edb3708c8c5 1648 AnalogIn analogIn1(A1);
whismanoid 0:3edb3708c8c5 1649 #endif
whismanoid 0:3edb3708c8c5 1650 #if HAS_analogIn2
whismanoid 0:3edb3708c8c5 1651 AnalogIn analogIn2(A2);
whismanoid 0:3edb3708c8c5 1652 #endif
whismanoid 0:3edb3708c8c5 1653 #if HAS_analogIn3
whismanoid 0:3edb3708c8c5 1654 AnalogIn analogIn3(A3);
whismanoid 0:3edb3708c8c5 1655 #endif
whismanoid 0:3edb3708c8c5 1656 #if HAS_analogIn4
whismanoid 0:3edb3708c8c5 1657 AnalogIn analogIn4(A4);
whismanoid 0:3edb3708c8c5 1658 #endif
whismanoid 0:3edb3708c8c5 1659 #if HAS_analogIn5
whismanoid 0:3edb3708c8c5 1660 AnalogIn analogIn5(A5);
whismanoid 0:3edb3708c8c5 1661 #endif
whismanoid 0:3edb3708c8c5 1662 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1663 // TODO1: TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:3edb3708c8c5 1664 #elif defined(TARGET_LPC1768)
whismanoid 0:3edb3708c8c5 1665 #define HAS_analogIn0 1
whismanoid 0:3edb3708c8c5 1666 #define HAS_analogIn1 1
whismanoid 0:3edb3708c8c5 1667 #define HAS_analogIn2 1
whismanoid 0:3edb3708c8c5 1668 #define HAS_analogIn3 1
whismanoid 0:3edb3708c8c5 1669 #define HAS_analogIn4 1
whismanoid 0:3edb3708c8c5 1670 #define HAS_analogIn5 1
whismanoid 0:3edb3708c8c5 1671 // #define HAS_analogIn6 1
whismanoid 0:3edb3708c8c5 1672 // #define HAS_analogIn7 1
whismanoid 0:3edb3708c8c5 1673 // #define HAS_analogIn8 1
whismanoid 0:3edb3708c8c5 1674 // #define HAS_analogIn9 1
whismanoid 0:3edb3708c8c5 1675 // #define HAS_analogIn10 1
whismanoid 0:3edb3708c8c5 1676 // #define HAS_analogIn11 1
whismanoid 0:3edb3708c8c5 1677 // #define HAS_analogIn12 1
whismanoid 0:3edb3708c8c5 1678 // #define HAS_analogIn13 1
whismanoid 0:3edb3708c8c5 1679 // #define HAS_analogIn14 1
whismanoid 0:3edb3708c8c5 1680 // #define HAS_analogIn15 1
whismanoid 0:3edb3708c8c5 1681 #if HAS_analogIn0
whismanoid 0:3edb3708c8c5 1682 AnalogIn analogIn0(p15); // TARGET_LPC1768 P0.23/AD0.0/I2SRX_CLK/CAP3.0
whismanoid 0:3edb3708c8c5 1683 #endif
whismanoid 0:3edb3708c8c5 1684 #if HAS_analogIn1
whismanoid 0:3edb3708c8c5 1685 AnalogIn analogIn1(p16); // TARGET_LPC1768 P0.24/AD0.1/I2SRX_WS/CAP3.1
whismanoid 0:3edb3708c8c5 1686 #endif
whismanoid 0:3edb3708c8c5 1687 #if HAS_analogIn2
whismanoid 0:3edb3708c8c5 1688 AnalogIn analogIn2(p17); // TARGET_LPC1768 P0.25/AD0.2/I2SRX_SDA/TXD3
whismanoid 0:3edb3708c8c5 1689 #endif
whismanoid 0:3edb3708c8c5 1690 #if HAS_analogIn3
whismanoid 0:3edb3708c8c5 1691 AnalogIn analogIn3(p18); // TARGET_LPC1768 P0.26/AD0.3/AOUT/RXD3
whismanoid 0:3edb3708c8c5 1692 #endif
whismanoid 0:3edb3708c8c5 1693 #if HAS_analogIn4
whismanoid 0:3edb3708c8c5 1694 AnalogIn analogIn4(p19); // TARGET_LPC1768 P1.30/VBUS/AD0.4
whismanoid 0:3edb3708c8c5 1695 #endif
whismanoid 0:3edb3708c8c5 1696 #if HAS_analogIn5
whismanoid 0:3edb3708c8c5 1697 AnalogIn analogIn5(p20); // TARGET_LPC1768 P1.31/SCK1/AD0.5
whismanoid 0:3edb3708c8c5 1698 #endif
whismanoid 0:3edb3708c8c5 1699 #if HAS_analogIn6
whismanoid 0:3edb3708c8c5 1700 AnalogIn analogIn6(____);
whismanoid 0:3edb3708c8c5 1701 #endif
whismanoid 0:3edb3708c8c5 1702 #if HAS_analogIn7
whismanoid 0:3edb3708c8c5 1703 AnalogIn analogIn7(____);
whismanoid 0:3edb3708c8c5 1704 #endif
whismanoid 0:3edb3708c8c5 1705 #if HAS_analogIn8
whismanoid 0:3edb3708c8c5 1706 AnalogIn analogIn8(____);
whismanoid 0:3edb3708c8c5 1707 #endif
whismanoid 0:3edb3708c8c5 1708 #if HAS_analogIn9
whismanoid 0:3edb3708c8c5 1709 AnalogIn analogIn9(____);
whismanoid 0:3edb3708c8c5 1710 #endif
whismanoid 0:3edb3708c8c5 1711 #if HAS_analogIn10
whismanoid 0:3edb3708c8c5 1712 AnalogIn analogIn10(____);
whismanoid 0:3edb3708c8c5 1713 #endif
whismanoid 0:3edb3708c8c5 1714 #if HAS_analogIn11
whismanoid 0:3edb3708c8c5 1715 AnalogIn analogIn11(____);
whismanoid 0:3edb3708c8c5 1716 #endif
whismanoid 0:3edb3708c8c5 1717 #if HAS_analogIn12
whismanoid 0:3edb3708c8c5 1718 AnalogIn analogIn12(____);
whismanoid 0:3edb3708c8c5 1719 #endif
whismanoid 0:3edb3708c8c5 1720 #if HAS_analogIn13
whismanoid 0:3edb3708c8c5 1721 AnalogIn analogIn13(____);
whismanoid 0:3edb3708c8c5 1722 #endif
whismanoid 0:3edb3708c8c5 1723 #if HAS_analogIn14
whismanoid 0:3edb3708c8c5 1724 AnalogIn analogIn14(____);
whismanoid 0:3edb3708c8c5 1725 #endif
whismanoid 0:3edb3708c8c5 1726 #if HAS_analogIn15
whismanoid 0:3edb3708c8c5 1727 AnalogIn analogIn15(____);
whismanoid 0:3edb3708c8c5 1728 #endif
whismanoid 0:3edb3708c8c5 1729 #else
whismanoid 0:3edb3708c8c5 1730 // unknown target
whismanoid 0:3edb3708c8c5 1731 #endif
whismanoid 0:3edb3708c8c5 1732 // uncrustify-0.66.1 *INDENT-ON*
whismanoid 0:3edb3708c8c5 1733 #if HAS_analogIn0 || HAS_analogIn1 \
whismanoid 0:3edb3708c8c5 1734 || HAS_analogIn2 || HAS_analogIn3 \
whismanoid 0:3edb3708c8c5 1735 || HAS_analogIn4 || HAS_analogIn5 \
whismanoid 0:3edb3708c8c5 1736 || HAS_analogIn6 || HAS_analogIn7 \
whismanoid 0:3edb3708c8c5 1737 || HAS_analogIn8 || HAS_analogIn9 \
whismanoid 0:3edb3708c8c5 1738 || HAS_analogIn10 || HAS_analogIn11 \
whismanoid 0:3edb3708c8c5 1739 || HAS_analogIn12 || HAS_analogIn13 \
whismanoid 0:3edb3708c8c5 1740 || HAS_analogIn14 || HAS_analogIn15
whismanoid 0:3edb3708c8c5 1741 #define HAS_analogIns 1
whismanoid 0:3edb3708c8c5 1742 #endif
whismanoid 0:3edb3708c8c5 1743
whismanoid 0:3edb3708c8c5 1744 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1745 // Option to use LEDs to show status
whismanoid 0:3edb3708c8c5 1746 #ifndef USE_LEDS
whismanoid 0:3edb3708c8c5 1747 #define USE_LEDS 1
whismanoid 0:3edb3708c8c5 1748 #endif
whismanoid 0:3edb3708c8c5 1749 #if USE_LEDS
whismanoid 0:3edb3708c8c5 1750 #if defined(TARGET_MAX32630)
whismanoid 0:3edb3708c8c5 1751 # define LED_ON 0
whismanoid 0:3edb3708c8c5 1752 # define LED_OFF 1
whismanoid 0:3edb3708c8c5 1753 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1754 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:3edb3708c8c5 1755 # define LED_ON 0
whismanoid 0:3edb3708c8c5 1756 # define LED_OFF 1
whismanoid 0:3edb3708c8c5 1757 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1758 // TODO1: TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:3edb3708c8c5 1759 #elif defined(TARGET_LPC1768)
whismanoid 0:3edb3708c8c5 1760 # define LED_ON 1
whismanoid 0:3edb3708c8c5 1761 # define LED_OFF 0
whismanoid 0:3edb3708c8c5 1762 #else // not defined(TARGET_LPC1768 etc.)
whismanoid 0:3edb3708c8c5 1763 # define LED_ON 1
whismanoid 0:3edb3708c8c5 1764 # define LED_OFF 0
whismanoid 0:3edb3708c8c5 1765 #endif // target definition
whismanoid 0:3edb3708c8c5 1766 DigitalOut led1(LED1, LED_OFF); // MAX32630FTHR: LED1 = LED_RED
whismanoid 0:3edb3708c8c5 1767 DigitalOut led2(LED2, LED_OFF); // MAX32630FTHR: LED2 = LED_GREEN
whismanoid 0:3edb3708c8c5 1768 DigitalOut led3(LED3, LED_OFF); // MAX32630FTHR: LED3 = LED_BLUE
whismanoid 0:3edb3708c8c5 1769 DigitalOut led4(LED4, LED_OFF);
whismanoid 12:5d3f9663ea0c 1770 #else // USE_LEDS=0
whismanoid 12:5d3f9663ea0c 1771 // issue #41 support Nucleo_F446RE
whismanoid 12:5d3f9663ea0c 1772 // there are no LED indicators on the board, LED1 interferes with SPI;
whismanoid 12:5d3f9663ea0c 1773 // but we still need placeholders led1 led2 led3 led4.
whismanoid 12:5d3f9663ea0c 1774 // Declare DigitalOut led1 led2 led3 led4 targeting safe pins.
whismanoid 12:5d3f9663ea0c 1775 // PinName NC means NOT_CONNECTED; DigitalOut::is_connected() returns false
whismanoid 12:5d3f9663ea0c 1776 # define LED_ON 0
whismanoid 12:5d3f9663ea0c 1777 # define LED_OFF 1
whismanoid 12:5d3f9663ea0c 1778 DigitalOut led1(NC, LED_OFF);
whismanoid 12:5d3f9663ea0c 1779 DigitalOut led2(NC, LED_OFF);
whismanoid 12:5d3f9663ea0c 1780 DigitalOut led3(NC, LED_OFF);
whismanoid 12:5d3f9663ea0c 1781 DigitalOut led4(NC, LED_OFF);
whismanoid 0:3edb3708c8c5 1782 #endif // USE_LEDS
whismanoid 0:3edb3708c8c5 1783
whismanoid 0:3edb3708c8c5 1784 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1785 #if USE_LEDS
whismanoid 0:3edb3708c8c5 1786 class RGB_LED {
whismanoid 0:3edb3708c8c5 1787 public:
whismanoid 0:3edb3708c8c5 1788 RGB_LED(DigitalOut &led_red, DigitalOut &led_green, DigitalOut &led_blue)
whismanoid 0:3edb3708c8c5 1789 : m_red(led_red), m_green(led_green), m_blue(led_blue)
whismanoid 0:3edb3708c8c5 1790 {
whismanoid 0:3edb3708c8c5 1791 };
whismanoid 0:3edb3708c8c5 1792 DigitalOut &m_red;
whismanoid 0:3edb3708c8c5 1793 DigitalOut &m_green;
whismanoid 0:3edb3708c8c5 1794 DigitalOut &m_blue;
whismanoid 0:3edb3708c8c5 1795 ~RGB_LED()
whismanoid 0:3edb3708c8c5 1796 {
whismanoid 0:3edb3708c8c5 1797 };
whismanoid 0:3edb3708c8c5 1798 /* diagnostic rbg led RED
whismanoid 0:3edb3708c8c5 1799 */
whismanoid 0:3edb3708c8c5 1800 void red() {
whismanoid 0:3edb3708c8c5 1801 m_red = LED_ON; m_green = LED_OFF; m_blue = LED_OFF; // diagnostic rbg led RED
whismanoid 0:3edb3708c8c5 1802 };
whismanoid 0:3edb3708c8c5 1803 /* diagnostic rbg led GREEN
whismanoid 0:3edb3708c8c5 1804 */
whismanoid 0:3edb3708c8c5 1805 void green() {
whismanoid 0:3edb3708c8c5 1806 m_red = LED_OFF; m_green = LED_ON; m_blue = LED_OFF; // diagnostic rbg led GREEN
whismanoid 0:3edb3708c8c5 1807 };
whismanoid 0:3edb3708c8c5 1808 /* diagnostic rbg led BLUE
whismanoid 0:3edb3708c8c5 1809 */
whismanoid 0:3edb3708c8c5 1810 void blue() {
whismanoid 0:3edb3708c8c5 1811 m_red = LED_OFF; m_green = LED_OFF; m_blue = LED_ON; // diagnostic rbg led BLUE
whismanoid 0:3edb3708c8c5 1812 };
whismanoid 0:3edb3708c8c5 1813 /* diagnostic rbg led RED+GREEN+BLUE=WHITE
whismanoid 0:3edb3708c8c5 1814 */
whismanoid 0:3edb3708c8c5 1815 void white() {
whismanoid 0:3edb3708c8c5 1816 m_red = LED_ON; m_green = LED_ON; m_blue = LED_ON; // diagnostic rbg led RED+GREEN+BLUE=WHITE
whismanoid 0:3edb3708c8c5 1817 };
whismanoid 0:3edb3708c8c5 1818 /* diagnostic rbg led GREEN+BLUE=CYAN
whismanoid 0:3edb3708c8c5 1819 */
whismanoid 0:3edb3708c8c5 1820 void cyan() {
whismanoid 0:3edb3708c8c5 1821 m_red = LED_OFF; m_green = LED_ON; m_blue = LED_ON; // diagnostic rbg led GREEN+BLUE=CYAN
whismanoid 0:3edb3708c8c5 1822 };
whismanoid 0:3edb3708c8c5 1823 /* diagnostic rbg led RED+BLUE=MAGENTA
whismanoid 0:3edb3708c8c5 1824 */
whismanoid 0:3edb3708c8c5 1825 void magenta() {
whismanoid 0:3edb3708c8c5 1826 m_red = LED_ON; m_green = LED_OFF; m_blue = LED_ON; // diagnostic rbg led RED+BLUE=MAGENTA
whismanoid 0:3edb3708c8c5 1827 };
whismanoid 0:3edb3708c8c5 1828 /* diagnostic rbg led RED+GREEN=YELLOW
whismanoid 0:3edb3708c8c5 1829 */
whismanoid 0:3edb3708c8c5 1830 void yellow() {
whismanoid 0:3edb3708c8c5 1831 m_red = LED_ON; m_green = LED_ON; m_blue = LED_OFF; // diagnostic rbg led RED+GREEN=YELLOW
whismanoid 0:3edb3708c8c5 1832 };
whismanoid 0:3edb3708c8c5 1833 /* diagnostic rbg led BLACK
whismanoid 0:3edb3708c8c5 1834 */
whismanoid 0:3edb3708c8c5 1835 void black() {
whismanoid 0:3edb3708c8c5 1836 m_red = LED_OFF; m_green = LED_OFF; m_blue = LED_OFF; // diagnostic rbg led BLACK
whismanoid 0:3edb3708c8c5 1837 };
whismanoid 0:3edb3708c8c5 1838 };
whismanoid 0:3edb3708c8c5 1839 RGB_LED rgb_led(led1, led2, led3); // red, green, blue LEDs
whismanoid 0:3edb3708c8c5 1840 #endif // USE_LEDS
whismanoid 0:3edb3708c8c5 1841
whismanoid 0:3edb3708c8c5 1842 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1843 // use BUTTON1 trigger some action
whismanoid 0:3edb3708c8c5 1844 #if defined(TARGET_MAX32630)
whismanoid 0:3edb3708c8c5 1845 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 13:e36d51f46794 1846 #define HAS_BUTTON2_DEMO 0
whismanoid 13:e36d51f46794 1847 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 16:3c75011e705a 1848 #elif defined(TARGET_MAX32625PICO)
whismanoid 16:3c75011e705a 1849 #warning "TARGET_MAX32625PICO not previously tested; need to define buttons..."
whismanoid 16:3c75011e705a 1850 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 16:3c75011e705a 1851 #define HAS_BUTTON2_DEMO 0
whismanoid 16:3c75011e705a 1852 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 0:3edb3708c8c5 1853 #elif defined(TARGET_MAX32625)
whismanoid 0:3edb3708c8c5 1854 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 0:3edb3708c8c5 1855 #define HAS_BUTTON2_DEMO_INTERRUPT 1
whismanoid 16:3c75011e705a 1856 #elif defined(TARGET_MAX32620FTHR)
whismanoid 16:3c75011e705a 1857 #warning "TARGET_MAX32620FTHR not previously tested; need to define buttons..."
whismanoid 16:3c75011e705a 1858 #define BUTTON1 SW1
whismanoid 16:3c75011e705a 1859 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 16:3c75011e705a 1860 #define HAS_BUTTON2_DEMO 0
whismanoid 16:3c75011e705a 1861 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 0:3edb3708c8c5 1862 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:3edb3708c8c5 1863 #define HAS_BUTTON1_DEMO_INTERRUPT 0
whismanoid 0:3edb3708c8c5 1864 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 0:3edb3708c8c5 1865 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:3edb3708c8c5 1866 #define HAS_BUTTON1_DEMO_INTERRUPT 0
whismanoid 0:3edb3708c8c5 1867 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 16:3c75011e705a 1868 #else
whismanoid 16:3c75011e705a 1869 #warning "target not previously tested; need to define buttons..."
whismanoid 0:3edb3708c8c5 1870 #endif
whismanoid 0:3edb3708c8c5 1871 //
whismanoid 0:3edb3708c8c5 1872 #ifndef HAS_BUTTON1_DEMO
whismanoid 0:3edb3708c8c5 1873 #define HAS_BUTTON1_DEMO 0
whismanoid 0:3edb3708c8c5 1874 #endif
whismanoid 0:3edb3708c8c5 1875 #ifndef HAS_BUTTON2_DEMO
whismanoid 0:3edb3708c8c5 1876 #define HAS_BUTTON2_DEMO 0
whismanoid 0:3edb3708c8c5 1877 #endif
whismanoid 0:3edb3708c8c5 1878 //
whismanoid 0:3edb3708c8c5 1879 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 0:3edb3708c8c5 1880 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 0:3edb3708c8c5 1881 #ifndef HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 0:3edb3708c8c5 1882 #define HAS_BUTTON1_DEMO_INTERRUPT_POLLING 1
whismanoid 0:3edb3708c8c5 1883 #endif
whismanoid 0:3edb3708c8c5 1884 //
whismanoid 0:3edb3708c8c5 1885 #ifndef HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 0:3edb3708c8c5 1886 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 0:3edb3708c8c5 1887 #endif
whismanoid 0:3edb3708c8c5 1888 #ifndef HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 0:3edb3708c8c5 1889 #define HAS_BUTTON2_DEMO_INTERRUPT 1
whismanoid 0:3edb3708c8c5 1890 #endif
whismanoid 0:3edb3708c8c5 1891 //
whismanoid 0:3edb3708c8c5 1892 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 0:3edb3708c8c5 1893 # if HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 0:3edb3708c8c5 1894 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 0:3edb3708c8c5 1895 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 0:3edb3708c8c5 1896 DigitalIn button1(BUTTON1);
whismanoid 0:3edb3708c8c5 1897 # else
whismanoid 0:3edb3708c8c5 1898 InterruptIn button1(BUTTON1);
whismanoid 0:3edb3708c8c5 1899 # endif
whismanoid 0:3edb3708c8c5 1900 #elif HAS_BUTTON1_DEMO
whismanoid 0:3edb3708c8c5 1901 DigitalIn button1(BUTTON1);
whismanoid 0:3edb3708c8c5 1902 #endif
whismanoid 0:3edb3708c8c5 1903 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 0:3edb3708c8c5 1904 # if HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 0:3edb3708c8c5 1905 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 0:3edb3708c8c5 1906 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 0:3edb3708c8c5 1907 DigitalIn button2(BUTTON2);
whismanoid 0:3edb3708c8c5 1908 # else
whismanoid 0:3edb3708c8c5 1909 InterruptIn button2(BUTTON2);
whismanoid 0:3edb3708c8c5 1910 # endif
whismanoid 0:3edb3708c8c5 1911 #elif HAS_BUTTON2_DEMO
whismanoid 0:3edb3708c8c5 1912 DigitalIn button2(BUTTON2);
whismanoid 0:3edb3708c8c5 1913 #endif
whismanoid 0:3edb3708c8c5 1914
whismanoid 0:3edb3708c8c5 1915 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 1916 // Ticker is the periodic interrupt timer itself
whismanoid 16:3c75011e705a 1917 #ifndef USE_PERIODIC_TIMER
whismanoid 0:3edb3708c8c5 1918 #define USE_PERIODIC_TIMER 0
whismanoid 16:3c75011e705a 1919 #endif
whismanoid 0:3edb3708c8c5 1920 #if USE_PERIODIC_TIMER
whismanoid 0:3edb3708c8c5 1921 Ticker periodicInterruptTimer;
whismanoid 0:3edb3708c8c5 1922 us_timestamp_t periodicInterruptTimer_interval_usec = 50;
whismanoid 0:3edb3708c8c5 1923 us_timestamp_t periodicInterruptTimer_interval_usec_MAX = 1000;
whismanoid 0:3edb3708c8c5 1924 us_timestamp_t periodicInterruptTimer_interval_usec_MIN = 20;
whismanoid 0:3edb3708c8c5 1925 #endif
whismanoid 0:3edb3708c8c5 1926
whismanoid 0:3edb3708c8c5 1927
whismanoid 0:3edb3708c8c5 1928 #if APPLICATION_MAX11131 // hardware interface functions
whismanoid 0:3edb3708c8c5 1929 //----------------------------------------
whismanoid 0:3edb3708c8c5 1930 void print_value(CmdLine& cmdLine, int16_t value_u12, int channelId)
whismanoid 0:3edb3708c8c5 1931 {
whismanoid 0:3edb3708c8c5 1932 int channelPairIndex = channelId / 2;
whismanoid 0:3edb3708c8c5 1933 // format: 1 0 0 0 1 UCH0/1 UCH2/3 UCH4/5 UCH6/7 UCH8/9 UCH10/11 UCH12/13 UCH14/15 PDIFF_COM x x
whismanoid 0:3edb3708c8c5 1934 // unused variable: int UCHn = (g_MAX11131_device.UNIPOLAR >> (10 - channelPairIndex)) & 0x01;
whismanoid 0:3edb3708c8c5 1935 int BCHn = (g_MAX11131_device.BIPOLAR >> (10 - channelPairIndex)) & 0x01;
whismanoid 0:3edb3708c8c5 1936 // unused variable: int RANGEn = (g_MAX11131_device.RANGE >> (10 - channelPairIndex)) & 0x01;
whismanoid 0:3edb3708c8c5 1937 //
whismanoid 0:3edb3708c8c5 1938 cmdLine.serial().printf(" ch=");
whismanoid 0:3edb3708c8c5 1939 // TODO1: if CHANID=0 don't print ch=channelId
whismanoid 0:3edb3708c8c5 1940 if ((g_MAX11131_device.isExternalClock == 0) || (g_MAX11131_device.chan_id_0_1 == 1))
whismanoid 0:3edb3708c8c5 1941 {
whismanoid 0:3edb3708c8c5 1942 // Internal clock modes always use channel ID.
whismanoid 0:3edb3708c8c5 1943 // External clock modes use channel ID if ADC_MODE_CONTROL.CHAN_ID is 1.
whismanoid 0:3edb3708c8c5 1944 cmdLine.serial().printf("%d", channelId);
whismanoid 0:3edb3708c8c5 1945 } else {
whismanoid 0:3edb3708c8c5 1946 cmdLine.serial().printf("?");
whismanoid 0:3edb3708c8c5 1947 }
whismanoid 0:3edb3708c8c5 1948 if (BCHn)
whismanoid 0:3edb3708c8c5 1949 {
whismanoid 3:8913cb4a8b9f 1950 cmdLine.serial().printf(" xb=%ld", g_MAX11131_device.TwosComplementValue(value_u12));
whismanoid 0:3edb3708c8c5 1951 }
whismanoid 0:3edb3708c8c5 1952 else
whismanoid 0:3edb3708c8c5 1953 {
whismanoid 0:3edb3708c8c5 1954 cmdLine.serial().printf(" xu=%d", value_u12);
whismanoid 0:3edb3708c8c5 1955 }
whismanoid 0:3edb3708c8c5 1956 cmdLine.serial().printf(" = 0x%4.4x = %6.4fV",
whismanoid 0:3edb3708c8c5 1957 (value_u12 & 0xFFFF),
whismanoid 0:3edb3708c8c5 1958 g_MAX11131_device.VoltageOfCode(value_u12, channelId)
whismanoid 0:3edb3708c8c5 1959 );
whismanoid 0:3edb3708c8c5 1960 // dtostrf width and precision: 2.5v / 4096 LSB = 0.0006103515625 volts per LSB
whismanoid 0:3edb3708c8c5 1961 }
whismanoid 0:3edb3708c8c5 1962
whismanoid 0:3edb3708c8c5 1963 //----------------------------------------
whismanoid 0:3edb3708c8c5 1964 // read data words
whismanoid 0:3edb3708c8c5 1965 // @pre RAW_misoData16[index] contains the raw SPI Master-In,Slave-Out data
whismanoid 0:3edb3708c8c5 1966 // @pre AINcode[NUM_CHANNELS] contains the latest readings in LSBs
whismanoid 0:3edb3708c8c5 1967 // For internal clock modes, the data format always includes the channel address.
whismanoid 0:3edb3708c8c5 1968 // misoData16 = CH[3:0] DATA[11:0]
whismanoid 0:3edb3708c8c5 1969 void AINcode_print_value_chanID(CmdLine& cmdLine, int nWords)
whismanoid 0:3edb3708c8c5 1970 {
whismanoid 0:3edb3708c8c5 1971 cmdLine.serial().printf("ScanRead_nWords_chanID nWords=%d\r\n", nWords);
whismanoid 0:3edb3708c8c5 1972 for (int index = 0; index < nWords; index++) {
whismanoid 0:3edb3708c8c5 1973 //~ int16_t misoData16 = MAX11131_ScanRead();
whismanoid 0:3edb3708c8c5 1974 // For internal clock modes, the data format always includes the channel address.
whismanoid 0:3edb3708c8c5 1975 // misoData16 = CH[3:0] DATA[11:0]
whismanoid 0:3edb3708c8c5 1976 int16_t value_u12 = (g_MAX11131_device.RAW_misoData16[index] & 0x0FFF);
whismanoid 0:3edb3708c8c5 1977 int channelId = ((g_MAX11131_device.RAW_misoData16[index] >> 12) & 0x000F);
whismanoid 0:3edb3708c8c5 1978 // diagnostic: print raw MISO data
whismanoid 0:3edb3708c8c5 1979 cmdLine.serial().printf(" MAX11131.MISO[%u]=0x%4.4x:", index,
whismanoid 0:3edb3708c8c5 1980 (g_MAX11131_device.RAW_misoData16[index] & 0xFFFF));
whismanoid 0:3edb3708c8c5 1981 print_value(cmdLine, value_u12, channelId);
whismanoid 0:3edb3708c8c5 1982 cmdLine.serial().printf("\r\n");
whismanoid 0:3edb3708c8c5 1983 }
whismanoid 0:3edb3708c8c5 1984 }
whismanoid 0:3edb3708c8c5 1985
whismanoid 0:3edb3708c8c5 1986 //----------------------------------------
whismanoid 0:3edb3708c8c5 1987 // read data words
whismanoid 0:3edb3708c8c5 1988 // @pre RAW_misoData16[index] contains the raw SPI Master-In,Slave-Out data
whismanoid 0:3edb3708c8c5 1989 // @pre AINcode[NUM_CHANNELS] contains the latest readings in LSBs
whismanoid 0:3edb3708c8c5 1990 // For external clock modes, the data format returned depends on the CHAN_ID bit.
whismanoid 0:3edb3708c8c5 1991 // when CHAN_ID = 0: misoData16 = 0 DATA[11:0] x x x
whismanoid 0:3edb3708c8c5 1992 // when CHAN_ID = 1: misoData16 = CH[3:0] DATA[11:0]
whismanoid 0:3edb3708c8c5 1993 void AINcode_print_value_externalClock(CmdLine& cmdLine, int nWords)
whismanoid 0:3edb3708c8c5 1994 {
whismanoid 0:3edb3708c8c5 1995 // For external clock modes, the data format returned depends on the CHAN_ID bit.
whismanoid 0:3edb3708c8c5 1996 // when CHAN_ID = 0: misoData16 = 0 DATA[11:0] x x x
whismanoid 0:3edb3708c8c5 1997 // when CHAN_ID = 1: misoData16 = CH[3:0] DATA[11:0]
whismanoid 0:3edb3708c8c5 1998 // For internal clock modes, the data format always includes the channel address.
whismanoid 0:3edb3708c8c5 1999 // misoData16 = CH[3:0] DATA[11:0]
whismanoid 0:3edb3708c8c5 2000 if (g_MAX11131_device.chan_id_0_1 != 0) {
whismanoid 0:3edb3708c8c5 2001 AINcode_print_value_chanID(cmdLine, nWords);
whismanoid 0:3edb3708c8c5 2002 return;
whismanoid 0:3edb3708c8c5 2003 }
whismanoid 0:3edb3708c8c5 2004 cmdLine.serial().printf("ScanRead_nWords_externalClock nWords=%d\r\n", nWords);
whismanoid 0:3edb3708c8c5 2005 for (int index = 0; index < nWords; index++) {
whismanoid 0:3edb3708c8c5 2006 // int16_t misoData16 = MAX11131_ScanRead();
whismanoid 0:3edb3708c8c5 2007 int16_t value_u12 = ((g_MAX11131_device.RAW_misoData16[index] >> 3) & 0x0FFF);
whismanoid 0:3edb3708c8c5 2008 int channelId = g_MAX11131_device.channelNumber_0_15;
whismanoid 0:3edb3708c8c5 2009 // diagnostic: print raw MISO data
whismanoid 0:3edb3708c8c5 2010 cmdLine.serial().printf(" MAX11131.MISO[%u]=0x%4.4x:", index,
whismanoid 0:3edb3708c8c5 2011 (g_MAX11131_device.RAW_misoData16[index] & 0xFFFF));
whismanoid 0:3edb3708c8c5 2012 print_value(cmdLine, value_u12, channelId);
whismanoid 0:3edb3708c8c5 2013 cmdLine.serial().printf("\r\n");
whismanoid 0:3edb3708c8c5 2014 }
whismanoid 0:3edb3708c8c5 2015 }
whismanoid 0:3edb3708c8c5 2016
whismanoid 0:3edb3708c8c5 2017 //----------------------------------------
whismanoid 0:3edb3708c8c5 2018 // read data words and calculate mean, stddev
whismanoid 0:3edb3708c8c5 2019 // @pre RAW_misoData16[index] contains the raw SPI Master-In,Slave-Out data
whismanoid 0:3edb3708c8c5 2020 // @pre AINcode[NUM_CHANNELS] contains the latest readings in LSBs
whismanoid 0:3edb3708c8c5 2021 void AINcode_print_value_chanID_mean(CmdLine& cmdLine, int nWords)
whismanoid 0:3edb3708c8c5 2022 {
whismanoid 0:3edb3708c8c5 2023 cmdLine.serial().printf("ScanRead_nWords_chanID_mean nWords=%d\r\n", nWords);
whismanoid 0:3edb3708c8c5 2024 double Sx = 0;
whismanoid 0:3edb3708c8c5 2025 double Sxx = 0;
whismanoid 0:3edb3708c8c5 2026 for (int index = 0; index < nWords; index++) {
whismanoid 0:3edb3708c8c5 2027 //~ int16_t misoData16 = MAX11131_ScanRead();
whismanoid 0:3edb3708c8c5 2028 // For internal clock modes, the data format always includes the channel address.
whismanoid 0:3edb3708c8c5 2029 // misoData16 = CH[3:0] DATA[11:0]
whismanoid 0:3edb3708c8c5 2030 int16_t value_u12 = (g_MAX11131_device.RAW_misoData16[index] & 0x0FFF);
whismanoid 0:3edb3708c8c5 2031 int channelId = ((g_MAX11131_device.RAW_misoData16[index] >> 12) & 0x000F);
whismanoid 0:3edb3708c8c5 2032 // TODO: sign-extend value_s12 from value_u12
whismanoid 0:3edb3708c8c5 2033 //
whismanoid 0:3edb3708c8c5 2034 cmdLine.serial().printf("n=%d", index);
whismanoid 0:3edb3708c8c5 2035 print_value(cmdLine, value_u12, channelId);
whismanoid 0:3edb3708c8c5 2036 //
whismanoid 0:3edb3708c8c5 2037 Sx = Sx + value_u12;
whismanoid 0:3edb3708c8c5 2038 Sxx = Sxx + ((double)value_u12 * value_u12);
whismanoid 0:3edb3708c8c5 2039 cmdLine.serial().printf(" Sx=%f Sxx=%f\r\n", Sx, Sxx);
whismanoid 0:3edb3708c8c5 2040 }
whismanoid 0:3edb3708c8c5 2041 double mean = Sx / nWords;
whismanoid 0:3edb3708c8c5 2042 cmdLine.serial().printf(" mean=%f=0x%4.4x", mean, (int)mean);
whismanoid 0:3edb3708c8c5 2043 // calculate standard deviation from N, Sx, Sxx
whismanoid 0:3edb3708c8c5 2044 if (nWords >= 2)
whismanoid 0:3edb3708c8c5 2045 {
whismanoid 0:3edb3708c8c5 2046 double variance = (Sxx - ( Sx * Sx / nWords)) / (nWords - 1);
whismanoid 0:3edb3708c8c5 2047 // stddev = square root of variance
whismanoid 0:3edb3708c8c5 2048 double stddev = sqrt(variance);
whismanoid 0:3edb3708c8c5 2049 cmdLine.serial().printf(" variance=%f stddev=%f", variance, stddev);
whismanoid 0:3edb3708c8c5 2050 }
whismanoid 0:3edb3708c8c5 2051 cmdLine.serial().printf("\r\n");
whismanoid 0:3edb3708c8c5 2052 }
whismanoid 0:3edb3708c8c5 2053
whismanoid 0:3edb3708c8c5 2054 /* MAX11131_print_register_verbose
whismanoid 0:3edb3708c8c5 2055 *
whismanoid 0:3edb3708c8c5 2056 * TODO: document this function
whismanoid 0:3edb3708c8c5 2057 * This header was inserted by uncrustify; see uncrustify_func_header.txt.
whismanoid 0:3edb3708c8c5 2058 *
whismanoid 0:3edb3708c8c5 2059 */
whismanoid 0:3edb3708c8c5 2060 void MAX11131_print_register_verbose(CmdLine& cmdLine, int16_t registerData)
whismanoid 0:3edb3708c8c5 2061 {
whismanoid 0:3edb3708c8c5 2062 if (registerData & 0x8000)
whismanoid 0:3edb3708c8c5 2063 {
whismanoid 0:3edb3708c8c5 2064 switch (registerData & 0xF800)
whismanoid 0:3edb3708c8c5 2065 {
whismanoid 0:3edb3708c8c5 2066 case 0x8000: // ADC_CONFIGURATION 0x8000..0x87FF format: 1 0 0 0 0 REFSEL AVGON NAVG[1:0] NSCAN[1:0] SPM[1:0] ECHO 0 0
whismanoid 0:3edb3708c8c5 2067 cmdLine.serial().printf(" ADC_CONFIGURATION");
whismanoid 0:3edb3708c8c5 2068 {
whismanoid 0:3edb3708c8c5 2069 // define write-only register ADC_CONFIGURATION
whismanoid 0:3edb3708c8c5 2070 //int16_t ADC_CONFIGURATION = 0x8000; //!< registerData 0x8000..0x87FF format: 1 0 0 0 0 REFSEL AVGON NAVG[1:0] NSCAN[1:0] SPM[1:0] ECHO 0 0
whismanoid 0:3edb3708c8c5 2071 const int REFSEL_LSB = 10; const int REFSEL_BITS = 0x01; // ADC_CONFIGURATION.REFSEL
whismanoid 0:3edb3708c8c5 2072 const int AVGON_LSB = 9; const int AVGON_BITS = 0x01; // ADC_CONFIGURATION.AVGON
whismanoid 0:3edb3708c8c5 2073 const int NAVG_LSB = 7; const int NAVG_BITS = 0x03; // ADC_CONFIGURATION.NAVG[1:0]
whismanoid 0:3edb3708c8c5 2074 const int NSCAN_LSB = 5; const int NSCAN_BITS = 0x03; // ADC_CONFIGURATION.NSCAN[1:0]
whismanoid 0:3edb3708c8c5 2075 const int SPM_LSB = 3; const int SPM_BITS = 0x03; // ADC_CONFIGURATION.SPM[1:0]
whismanoid 0:3edb3708c8c5 2076 const int ECHO_LSB = 2; const int ECHO_BITS = 0x01; // ADC_CONFIGURATION.ECHO
whismanoid 0:3edb3708c8c5 2077
whismanoid 0:3edb3708c8c5 2078 const int REFSEL = ((registerData >> REFSEL_LSB) & REFSEL_BITS);
whismanoid 0:3edb3708c8c5 2079 const int AVGON = ((registerData >> AVGON_LSB) & AVGON_BITS);
whismanoid 0:3edb3708c8c5 2080 const int NAVG = ((registerData >> NAVG_LSB) & NAVG_BITS);
whismanoid 0:3edb3708c8c5 2081 const int NSCAN = ((registerData >> NSCAN_LSB) & NSCAN_BITS);
whismanoid 0:3edb3708c8c5 2082 const int SPM = ((registerData >> SPM_LSB) & SPM_BITS);
whismanoid 0:3edb3708c8c5 2083 const int ECHO = ((registerData >> ECHO_LSB) & ECHO_BITS);
whismanoid 0:3edb3708c8c5 2084
whismanoid 0:3edb3708c8c5 2085 if (REFSEL) {
whismanoid 0:3edb3708c8c5 2086 cmdLine.serial().printf(" REFSEL=%d", REFSEL);
whismanoid 0:3edb3708c8c5 2087 }
whismanoid 0:3edb3708c8c5 2088 if (AVGON) {
whismanoid 0:3edb3708c8c5 2089 cmdLine.serial().printf(" AVGON=%d", AVGON);
whismanoid 0:3edb3708c8c5 2090 }
whismanoid 0:3edb3708c8c5 2091 if (NAVG) {
whismanoid 0:3edb3708c8c5 2092 cmdLine.serial().printf(" NAVG=%d", NAVG);
whismanoid 0:3edb3708c8c5 2093 }
whismanoid 0:3edb3708c8c5 2094 if (NSCAN) {
whismanoid 0:3edb3708c8c5 2095 cmdLine.serial().printf(" NSCAN=%d", NSCAN);
whismanoid 0:3edb3708c8c5 2096 }
whismanoid 0:3edb3708c8c5 2097 if (SPM) {
whismanoid 0:3edb3708c8c5 2098 cmdLine.serial().printf(" SPM=%d", SPM);
whismanoid 0:3edb3708c8c5 2099 }
whismanoid 0:3edb3708c8c5 2100 if (ECHO) {
whismanoid 0:3edb3708c8c5 2101 cmdLine.serial().printf(" ECHO=%d", ECHO);
whismanoid 0:3edb3708c8c5 2102 }
whismanoid 0:3edb3708c8c5 2103 }
whismanoid 0:3edb3708c8c5 2104 break;
whismanoid 0:3edb3708c8c5 2105 case 0x8800: // UNIPOLAR 0x8800..0x8FFF format: 1 0 0 0 1 UCH0/1 UCH2/3 UCH4/5 UCH6/7 UCH8/9 UCH10/11 UCH12/13 UCH14/15 PDIFF_COM x x
whismanoid 0:3edb3708c8c5 2106 cmdLine.serial().printf(" UNIPOLAR 0x%4.4x", ((registerData >> 3) & 0xFF));
whismanoid 0:3edb3708c8c5 2107 if ((registerData >> 2) & 0x01) {
whismanoid 0:3edb3708c8c5 2108 cmdLine.serial().printf(" PDIFF_COM");
whismanoid 0:3edb3708c8c5 2109 }
whismanoid 0:3edb3708c8c5 2110 break;
whismanoid 0:3edb3708c8c5 2111 case 0x9000: // BIPOLAR 0x9000..0x97FF format: 1 0 0 1 0 BCH0/1 BCH2/3 BCH4/5 BCH6/7 BCH8/9 BCH10/11 BCH12/13 BCH14/15 x x x
whismanoid 0:3edb3708c8c5 2112 cmdLine.serial().printf(" BIPOLAR 0x%4.4x", ((registerData >> 3) & 0xFF));
whismanoid 0:3edb3708c8c5 2113 break;
whismanoid 0:3edb3708c8c5 2114 case 0x9800: // RANGE 0x9800..0x9FFF format: 1 0 0 1 1 RANGE0/1 RANGE2/3 RANGE4/5 RANGE6/7 RANGE8/9 RANGE10/11 RANGE12/13 RANGE14/15 x x x
whismanoid 0:3edb3708c8c5 2115 cmdLine.serial().printf(" RANGE 0x%4.4x", ((registerData >> 3) & 0xFF));
whismanoid 0:3edb3708c8c5 2116 break;
whismanoid 0:3edb3708c8c5 2117 case 0xA000: // CSCAN0 0xA000..0xA7FF format: 1 0 1 0 0 CHSCAN15 CHSCAN14 CHSCAN13 CHSCAN12 CHSCAN11 CHSCAN10 CHSCAN9 CHSCAN8 x x x
whismanoid 0:3edb3708c8c5 2118 cmdLine.serial().printf(" CSCAN0 0x%4.4x", ((registerData >> 3) & 0xFF));
whismanoid 0:3edb3708c8c5 2119 break;
whismanoid 0:3edb3708c8c5 2120 case 0xA800: // CSCAN1 0xA800..0xAFFF format: 1 0 1 0 1 CHSCAN7 CHSCAN6 CHSCAN5 CHSCAN4 CHSCAN3 CHSCAN2 CHSCAN1 CHSCAN0 x x x
whismanoid 0:3edb3708c8c5 2121 cmdLine.serial().printf(" CSCAN1 0x%4.4x", ((registerData >> 3) & 0xFF));
whismanoid 0:3edb3708c8c5 2122 break;
whismanoid 0:3edb3708c8c5 2123 case 0xB000: // SAMPLESET 0xB000..0xB7FF format: 1 0 1 1 0 SEQ_LENGTH[7:0] x x x
whismanoid 0:3edb3708c8c5 2124 cmdLine.serial().printf(" SAMPLESET SEQ_LENGTH[7:0]=0x%4.4x", ((registerData >> 3) & 0xFF));
whismanoid 0:3edb3708c8c5 2125 cmdLine.serial().printf(" so length=%d channels", (((registerData >> 3) & 0xFF) + 1));
whismanoid 0:3edb3708c8c5 2126 break;
whismanoid 0:3edb3708c8c5 2127 default:
whismanoid 0:3edb3708c8c5 2128 cmdLine.serial().printf(" ???");
whismanoid 0:3edb3708c8c5 2129 break;
whismanoid 0:3edb3708c8c5 2130 }
whismanoid 0:3edb3708c8c5 2131 }
whismanoid 0:3edb3708c8c5 2132 else
whismanoid 0:3edb3708c8c5 2133 {
whismanoid 0:3edb3708c8c5 2134 // ADC_MODE_CONTROL 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0
whismanoid 0:3edb3708c8c5 2135 cmdLine.serial().printf(" ADC_MODE_CONTROL");
whismanoid 0:3edb3708c8c5 2136
whismanoid 0:3edb3708c8c5 2137 // define write-only register ADC_MODE_CONTROL
whismanoid 0:3edb3708c8c5 2138 //int16_t ADC_MODE_CONTROL = 0; //!< registerData 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0
whismanoid 0:3edb3708c8c5 2139 const int SCAN_LSB = 11; const int SCAN_BITS = 0x0F; //!< ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)
whismanoid 0:3edb3708c8c5 2140 const int CHSEL_LSB = 7; const int CHSEL_BITS = 0x0F; //!< ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select AIN0..AIN15
whismanoid 0:3edb3708c8c5 2141 const int RESET_LSB = 5; const int RESET_BITS = 0x03; //!< ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved
whismanoid 0:3edb3708c8c5 2142 const int PM_LSB = 3; const int PM_BITS = 0x03; //!< ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved
whismanoid 0:3edb3708c8c5 2143 const int CHAN_ID_LSB = 2; const int CHAN_ID_BITS = 0x01; //!< ADC_MODE_CONTROL.CHAN_ID
whismanoid 0:3edb3708c8c5 2144 const int SWCNV_LSB = 1; const int SWCNV_BITS = 0x01; //!< ADC_MODE_CONTROL.SWCNV
whismanoid 0:3edb3708c8c5 2145
whismanoid 0:3edb3708c8c5 2146 const int SCAN = ((registerData >> SCAN_LSB) & SCAN_BITS);
whismanoid 0:3edb3708c8c5 2147 const int CHSEL = ((registerData >> CHSEL_LSB) & CHSEL_BITS);
whismanoid 0:3edb3708c8c5 2148 const int RESET = ((registerData >> RESET_LSB) & RESET_BITS);
whismanoid 0:3edb3708c8c5 2149 const int PM = ((registerData >> PM_LSB) & PM_BITS);
whismanoid 0:3edb3708c8c5 2150 const int CHANID = ((registerData >> CHAN_ID_LSB) & CHAN_ID_BITS);
whismanoid 0:3edb3708c8c5 2151 const int SWCNV = ((registerData >> SWCNV_LSB) & SWCNV_BITS);
whismanoid 0:3edb3708c8c5 2152
whismanoid 0:3edb3708c8c5 2153 switch (SCAN)
whismanoid 0:3edb3708c8c5 2154 {
whismanoid 0:3edb3708c8c5 2155 case MAX11131::SCAN_0000_NOP:
whismanoid 0:3edb3708c8c5 2156 cmdLine.serial().printf(" SCAN_0000_NOP");
whismanoid 0:3edb3708c8c5 2157 break;
whismanoid 0:3edb3708c8c5 2158 case MAX11131::SCAN_0001_Manual:
whismanoid 0:3edb3708c8c5 2159 cmdLine.serial().printf(" SCAN_0001_Manual CHSEL=%d", CHSEL);
whismanoid 0:3edb3708c8c5 2160 break;
whismanoid 0:3edb3708c8c5 2161 case MAX11131::SCAN_0010_Repeat:
whismanoid 0:3edb3708c8c5 2162 cmdLine.serial().printf(" SCAN_0010_Repeat CHSEL=%d", CHSEL);
whismanoid 0:3edb3708c8c5 2163 break;
whismanoid 0:3edb3708c8c5 2164 case MAX11131::SCAN_0011_StandardInternalClock:
whismanoid 0:3edb3708c8c5 2165 cmdLine.serial().printf(" SCAN_0011_StandardInt CHSEL=%d", CHSEL);
whismanoid 0:3edb3708c8c5 2166 break;
whismanoid 0:3edb3708c8c5 2167 case MAX11131::SCAN_0100_StandardExternalClock:
whismanoid 0:3edb3708c8c5 2168 cmdLine.serial().printf(" SCAN_0100_StandardExt CHSEL=%d", CHSEL);
whismanoid 0:3edb3708c8c5 2169 break;
whismanoid 0:3edb3708c8c5 2170 case MAX11131::SCAN_0101_UpperInternalClock:
whismanoid 0:3edb3708c8c5 2171 cmdLine.serial().printf(" SCAN_0101_UpperInt CHSEL=%d", CHSEL);
whismanoid 0:3edb3708c8c5 2172 break;
whismanoid 0:3edb3708c8c5 2173 case MAX11131::SCAN_0110_UpperExternalClock:
whismanoid 0:3edb3708c8c5 2174 cmdLine.serial().printf(" SCAN_0110_UpperExt CHSEL=%d", CHSEL);
whismanoid 0:3edb3708c8c5 2175 break;
whismanoid 0:3edb3708c8c5 2176 case MAX11131::SCAN_0111_CustomInternalClock:
whismanoid 0:3edb3708c8c5 2177 cmdLine.serial().printf(" SCAN_0111_CustomInt");
whismanoid 0:3edb3708c8c5 2178 break;
whismanoid 0:3edb3708c8c5 2179 case MAX11131::SCAN_1000_CustomExternalClock:
whismanoid 0:3edb3708c8c5 2180 cmdLine.serial().printf(" SCAN_1000_CustomExt");
whismanoid 0:3edb3708c8c5 2181 break;
whismanoid 0:3edb3708c8c5 2182 case MAX11131::SCAN_1001_SampleSetExternalClock:
whismanoid 0:3edb3708c8c5 2183 cmdLine.serial().printf(" SCAN_1001_SampleSetExt");
whismanoid 0:3edb3708c8c5 2184 break;
whismanoid 0:3edb3708c8c5 2185 default:
whismanoid 0:3edb3708c8c5 2186 cmdLine.serial().printf(" SCAN=%d", SCAN);
whismanoid 0:3edb3708c8c5 2187 cmdLine.serial().printf(" CHSEL=%d", CHSEL);
whismanoid 0:3edb3708c8c5 2188 }
whismanoid 0:3edb3708c8c5 2189 if (RESET) {
whismanoid 0:3edb3708c8c5 2190 cmdLine.serial().printf(" RESET=%d", RESET);
whismanoid 0:3edb3708c8c5 2191 }
whismanoid 0:3edb3708c8c5 2192 if (PM) {
whismanoid 0:3edb3708c8c5 2193 cmdLine.serial().printf(" PM=%d", PM);
whismanoid 0:3edb3708c8c5 2194 }
whismanoid 0:3edb3708c8c5 2195 if (SCAN != MAX11131::SCAN_0000_NOP)
whismanoid 0:3edb3708c8c5 2196 {
whismanoid 0:3edb3708c8c5 2197 if (g_MAX11131_device.isExternalClock)
whismanoid 0:3edb3708c8c5 2198 {
whismanoid 0:3edb3708c8c5 2199 // if external clock mode, print CHANID
whismanoid 0:3edb3708c8c5 2200 cmdLine.serial().printf(" CHANID=%d", CHANID);
whismanoid 0:3edb3708c8c5 2201 }
whismanoid 0:3edb3708c8c5 2202 else
whismanoid 0:3edb3708c8c5 2203 {
whismanoid 0:3edb3708c8c5 2204 // if internal clock mode, print SWCNV
whismanoid 0:3edb3708c8c5 2205 cmdLine.serial().printf(" SWCNV=%d", SWCNV);
whismanoid 0:3edb3708c8c5 2206 }
whismanoid 0:3edb3708c8c5 2207 }
whismanoid 0:3edb3708c8c5 2208 }
whismanoid 0:3edb3708c8c5 2209 cmdLine.serial().printf("\r\n");
whismanoid 0:3edb3708c8c5 2210 }
whismanoid 0:3edb3708c8c5 2211 #endif
whismanoid 0:3edb3708c8c5 2212
whismanoid 0:3edb3708c8c5 2213
whismanoid 0:3edb3708c8c5 2214 #if APPLICATION_MAX5171 // hardware interface functions
whismanoid 0:3edb3708c8c5 2215 #endif
whismanoid 0:3edb3708c8c5 2216
whismanoid 0:3edb3708c8c5 2217
whismanoid 0:3edb3708c8c5 2218 #if APPLICATION_MAX11410 // hardware interface functions
whismanoid 0:3edb3708c8c5 2219 #endif
whismanoid 0:3edb3708c8c5 2220
whismanoid 0:3edb3708c8c5 2221
whismanoid 0:3edb3708c8c5 2222 #if APPLICATION_MAX12345 // hardware interface functions
whismanoid 0:3edb3708c8c5 2223 #endif
whismanoid 0:3edb3708c8c5 2224
whismanoid 0:3edb3708c8c5 2225
whismanoid 0:3edb3708c8c5 2226 //--------------------------------------------------
whismanoid 0:3edb3708c8c5 2227 // print banner message to serial port
whismanoid 0:3edb3708c8c5 2228 void print_banner()
whismanoid 0:3edb3708c8c5 2229 {
whismanoid 0:3edb3708c8c5 2230 #if HAS_DAPLINK_SERIAL
whismanoid 0:3edb3708c8c5 2231 DAPLINKserial.printf("\r\n");
whismanoid 0:3edb3708c8c5 2232 # if defined(TARGET_MAX32630)
whismanoid 0:3edb3708c8c5 2233 DAPLINKserial.printf("MAX32630");
whismanoid 0:3edb3708c8c5 2234 # elif defined(TARGET_MAX32625MBED)
whismanoid 0:3edb3708c8c5 2235 DAPLINKserial.printf("MAX32625MBED");
whismanoid 0:3edb3708c8c5 2236 # elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:3edb3708c8c5 2237 DAPLINKserial.printf("NUCLEO_F446RE");
whismanoid 0:3edb3708c8c5 2238 # elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:3edb3708c8c5 2239 DAPLINKserial.printf("NUCLEO_F401RE");
whismanoid 0:3edb3708c8c5 2240 # elif defined(TARGET_LPC1768)
whismanoid 0:3edb3708c8c5 2241 DAPLINKserial.printf("LPC1768");
whismanoid 0:3edb3708c8c5 2242 # else
whismanoid 0:3edb3708c8c5 2243 // unknown target
whismanoid 0:3edb3708c8c5 2244 DAPLINKserial.printf("unknownTarget");
whismanoid 0:3edb3708c8c5 2245 # endif
whismanoid 0:3edb3708c8c5 2246 DAPLINKserial.printf(" DAPLINKserial\r\n");
whismanoid 0:3edb3708c8c5 2247 #endif // HAS_DAPLINK_SERIAL
whismanoid 0:3edb3708c8c5 2248
whismanoid 7:bf501f8cb637 2249 serial.printf("\r\n");
whismanoid 0:3edb3708c8c5 2250 # if defined(TARGET_MAX32630)
whismanoid 7:bf501f8cb637 2251 serial.printf("MAX32630");
whismanoid 0:3edb3708c8c5 2252 # elif defined(TARGET_MAX32625MBED)
whismanoid 7:bf501f8cb637 2253 serial.printf("MAX32625MBED");
whismanoid 0:3edb3708c8c5 2254 # elif defined(TARGET_NUCLEO_F446RE)
whismanoid 7:bf501f8cb637 2255 serial.printf("NUCLEO_F446RE");
whismanoid 0:3edb3708c8c5 2256 # elif defined(TARGET_NUCLEO_F401RE)
whismanoid 7:bf501f8cb637 2257 serial.printf("NUCLEO_F401RE");
whismanoid 0:3edb3708c8c5 2258 # elif defined(TARGET_LPC1768)
whismanoid 7:bf501f8cb637 2259 serial.printf("LPC1768");
whismanoid 0:3edb3708c8c5 2260 # else
whismanoid 0:3edb3708c8c5 2261 // unknown target
whismanoid 7:bf501f8cb637 2262 serial.printf("unknownTarget");
whismanoid 0:3edb3708c8c5 2263 # endif
whismanoid 7:bf501f8cb637 2264 serial.printf(" Tester\r\n");
whismanoid 0:3edb3708c8c5 2265 }
whismanoid 0:3edb3708c8c5 2266
whismanoid 7:bf501f8cb637 2267 // DigitalInOut pin resource: print the pin index names to serial
whismanoid 0:3edb3708c8c5 2268 #if HAS_digitalInOuts
whismanoid 0:3edb3708c8c5 2269 void list_digitalInOutPins(Stream& serialStream)
whismanoid 0:3edb3708c8c5 2270 {
whismanoid 0:3edb3708c8c5 2271 #if HAS_digitalInOut0
whismanoid 0:3edb3708c8c5 2272 serialStream.printf(" 0");
whismanoid 0:3edb3708c8c5 2273 #endif
whismanoid 0:3edb3708c8c5 2274 #if HAS_digitalInOut1
whismanoid 0:3edb3708c8c5 2275 serialStream.printf(" 1");
whismanoid 0:3edb3708c8c5 2276 #endif
whismanoid 0:3edb3708c8c5 2277 #if HAS_digitalInOut2
whismanoid 0:3edb3708c8c5 2278 serialStream.printf(" 2");
whismanoid 0:3edb3708c8c5 2279 #endif
whismanoid 0:3edb3708c8c5 2280 #if HAS_digitalInOut3
whismanoid 0:3edb3708c8c5 2281 serialStream.printf(" 3");
whismanoid 0:3edb3708c8c5 2282 #endif
whismanoid 0:3edb3708c8c5 2283 #if HAS_digitalInOut4
whismanoid 0:3edb3708c8c5 2284 serialStream.printf(" 4");
whismanoid 0:3edb3708c8c5 2285 #endif
whismanoid 0:3edb3708c8c5 2286 #if HAS_digitalInOut5
whismanoid 0:3edb3708c8c5 2287 serialStream.printf(" 5");
whismanoid 0:3edb3708c8c5 2288 #endif
whismanoid 0:3edb3708c8c5 2289 #if HAS_digitalInOut6
whismanoid 0:3edb3708c8c5 2290 serialStream.printf(" 6");
whismanoid 0:3edb3708c8c5 2291 #endif
whismanoid 0:3edb3708c8c5 2292 #if HAS_digitalInOut7
whismanoid 0:3edb3708c8c5 2293 serialStream.printf(" 7");
whismanoid 0:3edb3708c8c5 2294 #endif
whismanoid 0:3edb3708c8c5 2295 #if HAS_digitalInOut8
whismanoid 0:3edb3708c8c5 2296 serialStream.printf(" 8");
whismanoid 0:3edb3708c8c5 2297 #endif
whismanoid 0:3edb3708c8c5 2298 #if HAS_digitalInOut9
whismanoid 0:3edb3708c8c5 2299 serialStream.printf(" 9");
whismanoid 0:3edb3708c8c5 2300 #endif
whismanoid 0:3edb3708c8c5 2301 #if HAS_digitalInOut10
whismanoid 0:3edb3708c8c5 2302 serialStream.printf(" 10");
whismanoid 0:3edb3708c8c5 2303 #endif
whismanoid 0:3edb3708c8c5 2304 #if HAS_digitalInOut11
whismanoid 0:3edb3708c8c5 2305 serialStream.printf(" 11");
whismanoid 0:3edb3708c8c5 2306 #endif
whismanoid 0:3edb3708c8c5 2307 #if HAS_digitalInOut12
whismanoid 0:3edb3708c8c5 2308 serialStream.printf(" 12");
whismanoid 0:3edb3708c8c5 2309 #endif
whismanoid 0:3edb3708c8c5 2310 #if HAS_digitalInOut13
whismanoid 0:3edb3708c8c5 2311 serialStream.printf(" 13");
whismanoid 0:3edb3708c8c5 2312 #endif
whismanoid 0:3edb3708c8c5 2313 #if HAS_digitalInOut14
whismanoid 0:3edb3708c8c5 2314 serialStream.printf(" 14");
whismanoid 0:3edb3708c8c5 2315 #endif
whismanoid 0:3edb3708c8c5 2316 #if HAS_digitalInOut15
whismanoid 0:3edb3708c8c5 2317 serialStream.printf(" 15");
whismanoid 0:3edb3708c8c5 2318 #endif
whismanoid 0:3edb3708c8c5 2319 #if HAS_digitalInOut16
whismanoid 0:3edb3708c8c5 2320 serialStream.printf(" 16");
whismanoid 0:3edb3708c8c5 2321 #endif
whismanoid 0:3edb3708c8c5 2322 #if HAS_digitalInOut17
whismanoid 0:3edb3708c8c5 2323 serialStream.printf(" 17");
whismanoid 0:3edb3708c8c5 2324 #endif
whismanoid 0:3edb3708c8c5 2325 }
whismanoid 0:3edb3708c8c5 2326 #endif
whismanoid 0:3edb3708c8c5 2327
whismanoid 0:3edb3708c8c5 2328 // DigitalInOut pin resource: present?
whismanoid 0:3edb3708c8c5 2329 #if HAS_digitalInOuts
whismanoid 0:3edb3708c8c5 2330 bool has_digitalInOutPin(int cPinIndex)
whismanoid 0:3edb3708c8c5 2331 {
whismanoid 0:3edb3708c8c5 2332 switch (cPinIndex)
whismanoid 0:3edb3708c8c5 2333 {
whismanoid 0:3edb3708c8c5 2334 #if HAS_digitalInOut0
whismanoid 0:3edb3708c8c5 2335 case '0': case 0x00: return true;
whismanoid 0:3edb3708c8c5 2336 #endif
whismanoid 0:3edb3708c8c5 2337 #if HAS_digitalInOut1
whismanoid 0:3edb3708c8c5 2338 case '1': case 0x01: return true;
whismanoid 0:3edb3708c8c5 2339 #endif
whismanoid 0:3edb3708c8c5 2340 #if HAS_digitalInOut2
whismanoid 0:3edb3708c8c5 2341 case '2': case 0x02: return true;
whismanoid 0:3edb3708c8c5 2342 #endif
whismanoid 0:3edb3708c8c5 2343 #if HAS_digitalInOut3
whismanoid 0:3edb3708c8c5 2344 case '3': case 0x03: return true;
whismanoid 0:3edb3708c8c5 2345 #endif
whismanoid 0:3edb3708c8c5 2346 #if HAS_digitalInOut4
whismanoid 0:3edb3708c8c5 2347 case '4': case 0x04: return true;
whismanoid 0:3edb3708c8c5 2348 #endif
whismanoid 0:3edb3708c8c5 2349 #if HAS_digitalInOut5
whismanoid 0:3edb3708c8c5 2350 case '5': case 0x05: return true;
whismanoid 0:3edb3708c8c5 2351 #endif
whismanoid 0:3edb3708c8c5 2352 #if HAS_digitalInOut6
whismanoid 0:3edb3708c8c5 2353 case '6': case 0x06: return true;
whismanoid 0:3edb3708c8c5 2354 #endif
whismanoid 0:3edb3708c8c5 2355 #if HAS_digitalInOut7
whismanoid 0:3edb3708c8c5 2356 case '7': case 0x07: return true;
whismanoid 0:3edb3708c8c5 2357 #endif
whismanoid 0:3edb3708c8c5 2358 #if HAS_digitalInOut8
whismanoid 0:3edb3708c8c5 2359 case '8': case 0x08: return true;
whismanoid 0:3edb3708c8c5 2360 #endif
whismanoid 0:3edb3708c8c5 2361 #if HAS_digitalInOut9
whismanoid 0:3edb3708c8c5 2362 case '9': case 0x09: return true;
whismanoid 0:3edb3708c8c5 2363 #endif
whismanoid 0:3edb3708c8c5 2364 #if HAS_digitalInOut10
whismanoid 0:3edb3708c8c5 2365 case 'a': case 0x0a: return true;
whismanoid 0:3edb3708c8c5 2366 #endif
whismanoid 0:3edb3708c8c5 2367 #if HAS_digitalInOut11
whismanoid 0:3edb3708c8c5 2368 case 'b': case 0x0b: return true;
whismanoid 0:3edb3708c8c5 2369 #endif
whismanoid 0:3edb3708c8c5 2370 #if HAS_digitalInOut12
whismanoid 0:3edb3708c8c5 2371 case 'c': case 0x0c: return true;
whismanoid 0:3edb3708c8c5 2372 #endif
whismanoid 0:3edb3708c8c5 2373 #if HAS_digitalInOut13
whismanoid 0:3edb3708c8c5 2374 case 'd': case 0x0d: return true;
whismanoid 0:3edb3708c8c5 2375 #endif
whismanoid 0:3edb3708c8c5 2376 #if HAS_digitalInOut14
whismanoid 0:3edb3708c8c5 2377 case 'e': case 0x0e: return true;
whismanoid 0:3edb3708c8c5 2378 #endif
whismanoid 0:3edb3708c8c5 2379 #if HAS_digitalInOut15
whismanoid 0:3edb3708c8c5 2380 case 'f': case 0x0f: return true;
whismanoid 0:3edb3708c8c5 2381 #endif
whismanoid 0:3edb3708c8c5 2382 default:
whismanoid 0:3edb3708c8c5 2383 return false;
whismanoid 0:3edb3708c8c5 2384 }
whismanoid 0:3edb3708c8c5 2385 }
whismanoid 0:3edb3708c8c5 2386 #endif
whismanoid 0:3edb3708c8c5 2387
whismanoid 0:3edb3708c8c5 2388 // DigitalInOut pin resource: search index
whismanoid 0:3edb3708c8c5 2389 #if HAS_digitalInOuts
whismanoid 0:3edb3708c8c5 2390 DigitalInOut& find_digitalInOutPin(int cPinIndex)
whismanoid 0:3edb3708c8c5 2391 {
whismanoid 0:3edb3708c8c5 2392 switch (cPinIndex)
whismanoid 0:3edb3708c8c5 2393 {
whismanoid 0:3edb3708c8c5 2394 default: // default to the first defined digitalInOut pin
whismanoid 0:3edb3708c8c5 2395 #if HAS_digitalInOut0
whismanoid 0:3edb3708c8c5 2396 case '0': case 0x00: return digitalInOut0;
whismanoid 0:3edb3708c8c5 2397 #endif
whismanoid 0:3edb3708c8c5 2398 #if HAS_digitalInOut1
whismanoid 0:3edb3708c8c5 2399 case '1': case 0x01: return digitalInOut1;
whismanoid 0:3edb3708c8c5 2400 #endif
whismanoid 0:3edb3708c8c5 2401 #if HAS_digitalInOut2
whismanoid 0:3edb3708c8c5 2402 case '2': case 0x02: return digitalInOut2;
whismanoid 0:3edb3708c8c5 2403 #endif
whismanoid 0:3edb3708c8c5 2404 #if HAS_digitalInOut3
whismanoid 0:3edb3708c8c5 2405 case '3': case 0x03: return digitalInOut3;
whismanoid 0:3edb3708c8c5 2406 #endif
whismanoid 0:3edb3708c8c5 2407 #if HAS_digitalInOut4
whismanoid 0:3edb3708c8c5 2408 case '4': case 0x04: return digitalInOut4;
whismanoid 0:3edb3708c8c5 2409 #endif
whismanoid 0:3edb3708c8c5 2410 #if HAS_digitalInOut5
whismanoid 0:3edb3708c8c5 2411 case '5': case 0x05: return digitalInOut5;
whismanoid 0:3edb3708c8c5 2412 #endif
whismanoid 0:3edb3708c8c5 2413 #if HAS_digitalInOut6
whismanoid 0:3edb3708c8c5 2414 case '6': case 0x06: return digitalInOut6;
whismanoid 0:3edb3708c8c5 2415 #endif
whismanoid 0:3edb3708c8c5 2416 #if HAS_digitalInOut7
whismanoid 0:3edb3708c8c5 2417 case '7': case 0x07: return digitalInOut7;
whismanoid 0:3edb3708c8c5 2418 #endif
whismanoid 0:3edb3708c8c5 2419 #if HAS_digitalInOut8
whismanoid 0:3edb3708c8c5 2420 case '8': case 0x08: return digitalInOut8;
whismanoid 0:3edb3708c8c5 2421 #endif
whismanoid 0:3edb3708c8c5 2422 #if HAS_digitalInOut9
whismanoid 0:3edb3708c8c5 2423 case '9': case 0x09: return digitalInOut9;
whismanoid 0:3edb3708c8c5 2424 #endif
whismanoid 0:3edb3708c8c5 2425 #if HAS_digitalInOut10
whismanoid 0:3edb3708c8c5 2426 case 'a': case 0x0a: return digitalInOut10;
whismanoid 0:3edb3708c8c5 2427 #endif
whismanoid 0:3edb3708c8c5 2428 #if HAS_digitalInOut11
whismanoid 0:3edb3708c8c5 2429 case 'b': case 0x0b: return digitalInOut11;
whismanoid 0:3edb3708c8c5 2430 #endif
whismanoid 0:3edb3708c8c5 2431 #if HAS_digitalInOut12
whismanoid 0:3edb3708c8c5 2432 case 'c': case 0x0c: return digitalInOut12;
whismanoid 0:3edb3708c8c5 2433 #endif
whismanoid 0:3edb3708c8c5 2434 #if HAS_digitalInOut13
whismanoid 0:3edb3708c8c5 2435 case 'd': case 0x0d: return digitalInOut13;
whismanoid 0:3edb3708c8c5 2436 #endif
whismanoid 0:3edb3708c8c5 2437 #if HAS_digitalInOut14
whismanoid 0:3edb3708c8c5 2438 case 'e': case 0x0e: return digitalInOut14;
whismanoid 0:3edb3708c8c5 2439 #endif
whismanoid 0:3edb3708c8c5 2440 #if HAS_digitalInOut15
whismanoid 0:3edb3708c8c5 2441 case 'f': case 0x0f: return digitalInOut15;
whismanoid 0:3edb3708c8c5 2442 #endif
whismanoid 0:3edb3708c8c5 2443 #if HAS_digitalInOut16
whismanoid 0:3edb3708c8c5 2444 case 'g': case 0x10: return digitalInOut16;
whismanoid 0:3edb3708c8c5 2445 #endif
whismanoid 0:3edb3708c8c5 2446 #if HAS_digitalInOut17
whismanoid 0:3edb3708c8c5 2447 case 'h': case 0x11: return digitalInOut17;
whismanoid 0:3edb3708c8c5 2448 #endif
whismanoid 0:3edb3708c8c5 2449 }
whismanoid 0:3edb3708c8c5 2450 }
whismanoid 0:3edb3708c8c5 2451 #endif
whismanoid 0:3edb3708c8c5 2452
whismanoid 7:bf501f8cb637 2453 // AnalogIn pin resource: print the pin index names to serial
whismanoid 0:3edb3708c8c5 2454 #if HAS_analogIns
whismanoid 0:3edb3708c8c5 2455 void list_analogInPins(Stream& serialStream)
whismanoid 0:3edb3708c8c5 2456 {
whismanoid 0:3edb3708c8c5 2457 #if HAS_analogIn0
whismanoid 0:3edb3708c8c5 2458 serialStream.printf(" 0");
whismanoid 0:3edb3708c8c5 2459 #endif
whismanoid 0:3edb3708c8c5 2460 #if HAS_analogIn1
whismanoid 0:3edb3708c8c5 2461 serialStream.printf(" 1");
whismanoid 0:3edb3708c8c5 2462 #endif
whismanoid 0:3edb3708c8c5 2463 #if HAS_analogIn2
whismanoid 0:3edb3708c8c5 2464 serialStream.printf(" 2");
whismanoid 0:3edb3708c8c5 2465 #endif
whismanoid 0:3edb3708c8c5 2466 #if HAS_analogIn3
whismanoid 0:3edb3708c8c5 2467 serialStream.printf(" 3");
whismanoid 0:3edb3708c8c5 2468 #endif
whismanoid 0:3edb3708c8c5 2469 #if HAS_analogIn4
whismanoid 0:3edb3708c8c5 2470 serialStream.printf(" 4");
whismanoid 0:3edb3708c8c5 2471 #endif
whismanoid 0:3edb3708c8c5 2472 #if HAS_analogIn5
whismanoid 0:3edb3708c8c5 2473 serialStream.printf(" 5");
whismanoid 0:3edb3708c8c5 2474 #endif
whismanoid 0:3edb3708c8c5 2475 #if HAS_analogIn6
whismanoid 0:3edb3708c8c5 2476 serialStream.printf(" 6");
whismanoid 0:3edb3708c8c5 2477 #endif
whismanoid 0:3edb3708c8c5 2478 #if HAS_analogIn7
whismanoid 0:3edb3708c8c5 2479 serialStream.printf(" 7");
whismanoid 0:3edb3708c8c5 2480 #endif
whismanoid 0:3edb3708c8c5 2481 #if HAS_analogIn8
whismanoid 0:3edb3708c8c5 2482 serialStream.printf(" 8");
whismanoid 0:3edb3708c8c5 2483 #endif
whismanoid 0:3edb3708c8c5 2484 #if HAS_analogIn9
whismanoid 0:3edb3708c8c5 2485 serialStream.printf(" 9");
whismanoid 0:3edb3708c8c5 2486 #endif
whismanoid 0:3edb3708c8c5 2487 #if HAS_analogIn10
whismanoid 0:3edb3708c8c5 2488 serialStream.printf(" a");
whismanoid 0:3edb3708c8c5 2489 #endif
whismanoid 0:3edb3708c8c5 2490 #if HAS_analogIn11
whismanoid 0:3edb3708c8c5 2491 serialStream.printf(" b");
whismanoid 0:3edb3708c8c5 2492 #endif
whismanoid 0:3edb3708c8c5 2493 #if HAS_analogIn12
whismanoid 0:3edb3708c8c5