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

Dependencies:   MaximTinyTester CmdLine MAX541 USBDevice

Committer:
whismanoid
Date:
Fri Jul 26 03:28:52 2019 -0700
Revision:
32:ad00de965151
Parent:
31:8068c5394e0d
MAX11410 future menu items 'W' 'R' regs; '@' VRef,status,data0 for test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
whismanoid 19:8f951e448ab1 1 // /*******************************************************************************
whismanoid 19:8f951e448ab1 2 // * Copyright (C) 2019 Maxim Integrated Products, Inc., All Rights Reserved.
whismanoid 19:8f951e448ab1 3 // *
whismanoid 19:8f951e448ab1 4 // * Permission is hereby granted, free of charge, to any person obtaining a
whismanoid 19:8f951e448ab1 5 // * copy of this software and associated documentation files (the "Software"),
whismanoid 19:8f951e448ab1 6 // * to deal in the Software without restriction, including without limitation
whismanoid 19:8f951e448ab1 7 // * the rights to use, copy, modify, merge, publish, distribute, sublicense,
whismanoid 19:8f951e448ab1 8 // * and/or sell copies of the Software, and to permit persons to whom the
whismanoid 19:8f951e448ab1 9 // * Software is furnished to do so, subject to the following conditions:
whismanoid 19:8f951e448ab1 10 // *
whismanoid 19:8f951e448ab1 11 // * The above copyright notice and this permission notice shall be included
whismanoid 19:8f951e448ab1 12 // * in all copies or substantial portions of the Software.
whismanoid 19:8f951e448ab1 13 // *
whismanoid 19:8f951e448ab1 14 // * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
whismanoid 19:8f951e448ab1 15 // * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
whismanoid 19:8f951e448ab1 16 // * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
whismanoid 19:8f951e448ab1 17 // * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
whismanoid 19:8f951e448ab1 18 // * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
whismanoid 19:8f951e448ab1 19 // * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
whismanoid 19:8f951e448ab1 20 // * OTHER DEALINGS IN THE SOFTWARE.
whismanoid 19:8f951e448ab1 21 // *
whismanoid 19:8f951e448ab1 22 // * Except as contained in this notice, the name of Maxim Integrated
whismanoid 19:8f951e448ab1 23 // * Products, Inc. shall not be used except as stated in the Maxim Integrated
whismanoid 19:8f951e448ab1 24 // * Products, Inc. Branding Policy.
whismanoid 19:8f951e448ab1 25 // *
whismanoid 19:8f951e448ab1 26 // * The mere transfer of this software does not imply any licenses
whismanoid 19:8f951e448ab1 27 // * of trade secrets, proprietary technology, copyrights, patents,
whismanoid 19:8f951e448ab1 28 // * trademarks, maskwork rights, or any other form of intellectual
whismanoid 19:8f951e448ab1 29 // * property whatsoever. Maxim Integrated Products, Inc. retains all
whismanoid 19:8f951e448ab1 30 // * ownership rights.
whismanoid 19:8f951e448ab1 31 // *******************************************************************************
whismanoid 19:8f951e448ab1 32 // */
whismanoid 19:8f951e448ab1 33
whismanoid 19:8f951e448ab1 34 #include "mbed.h"
whismanoid 19:8f951e448ab1 35 #include "MAX11410.h"
whismanoid 19:8f951e448ab1 36 #include "CmdLine.h"
whismanoid 19:8f951e448ab1 37
whismanoid 19:8f951e448ab1 38 //--------------------------------------------------
whismanoid 19:8f951e448ab1 39 // tolerate AT commands, which may be sent during probe, such as:
whismanoid 19:8f951e448ab1 40 // AT
whismanoid 19:8f951e448ab1 41 // AT+CGMI -- request manufacturer identification AT+CMGI=?
whismanoid 19:8f951e448ab1 42 // AT+CGMM -- request manufacturer model
whismanoid 19:8f951e448ab1 43 // AT%IPSYS?
whismanoid 19:8f951e448ab1 44 // ATE0 -- echo disable
whismanoid 19:8f951e448ab1 45 // ATV1 -- verbose result codes OK | ERROR | NO CARRIER
whismanoid 19:8f951e448ab1 46 // AT+CMEE=1
whismanoid 19:8f951e448ab1 47 // ATX4
whismanoid 19:8f951e448ab1 48 // AT&C1
whismanoid 19:8f951e448ab1 49 // ATE0
whismanoid 19:8f951e448ab1 50 // AT+CMEE=1
whismanoid 19:8f951e448ab1 51 // AT+GCAP
whismanoid 19:8f951e448ab1 52 // ATI
whismanoid 19:8f951e448ab1 53 // AT+CPIN?
whismanoid 19:8f951e448ab1 54 // AT+CGMM
whismanoid 19:8f951e448ab1 55 #ifndef IGNORE_AT_COMMANDS
whismanoid 19:8f951e448ab1 56 #define IGNORE_AT_COMMANDS 1
whismanoid 19:8f951e448ab1 57 #endif
whismanoid 19:8f951e448ab1 58
whismanoid 30:9eb6eff512e7 59 extern MAX11410 g_MAX11410_device; // defined in main.cpp
whismanoid 19:8f951e448ab1 60
whismanoid 19:8f951e448ab1 61 bool MAX11410_menu_onEOLcommandParser(CmdLine & cmdLine)
whismanoid 19:8f951e448ab1 62 {
whismanoid 19:8f951e448ab1 63 switch (cmdLine[0])
whismanoid 19:8f951e448ab1 64 {
whismanoid 19:8f951e448ab1 65 // TODO1: MAX11410 main_menu_onEOLcommandParser
whismanoid 19:8f951e448ab1 66 case '0':
whismanoid 19:8f951e448ab1 67 {
whismanoid 19:8f951e448ab1 68 // // recommended for hex command codes 00..0F
whismanoid 19:8f951e448ab1 69 // // placeholder: cmdLine.serial().printf("\r\n 3 ch=? code=? -- CODEnLOADn");
whismanoid 19:8f951e448ab1 70 // uint16_t ch = g_MAX5715_device.channelNumber_0_3;
whismanoid 19:8f951e448ab1 71 // uint16_t code;
whismanoid 19:8f951e448ab1 72 // if (cmdLine.parse_uint16_dec("ch", ch))
whismanoid 19:8f951e448ab1 73 // {
whismanoid 19:8f951e448ab1 74 // }
whismanoid 19:8f951e448ab1 75 // if (cmdLine.parse_uint16_dec("code", code))
whismanoid 19:8f951e448ab1 76 // {
whismanoid 19:8f951e448ab1 77 // }
whismanoid 19:8f951e448ab1 78 // if (cmdLine.parse_flag("xyzzy", g_xyzzy_flag, XYZZY_FLAG))
whismanoid 19:8f951e448ab1 79 // {
whismanoid 19:8f951e448ab1 80 // isUpdatedSPIConfig = true;
whismanoid 19:8f951e448ab1 81 // }
whismanoid 19:8f951e448ab1 82 // cmdLine.serial().printf("CODEnLOADn ch=%d code=%d", ch, code);
whismanoid 19:8f951e448ab1 83 // //~ MAX5715_CODEnLOADn(ch, code);
whismanoid 19:8f951e448ab1 84 // cmdLine.serial().printf("\r\n placeholder");
whismanoid 19:8f951e448ab1 85 return true; // command was handled by MAX11410
whismanoid 19:8f951e448ab1 86 }
whismanoid 19:8f951e448ab1 87 break;
whismanoid 19:8f951e448ab1 88 case '1':
whismanoid 19:8f951e448ab1 89 {
whismanoid 19:8f951e448ab1 90 // recommended for hex command codes 10..1F
whismanoid 19:8f951e448ab1 91 }
whismanoid 19:8f951e448ab1 92 break;
whismanoid 19:8f951e448ab1 93 case '2':
whismanoid 19:8f951e448ab1 94 {
whismanoid 19:8f951e448ab1 95 // recommended for hex command codes 20..2F
whismanoid 19:8f951e448ab1 96 }
whismanoid 19:8f951e448ab1 97 break;
whismanoid 19:8f951e448ab1 98 case '3':
whismanoid 19:8f951e448ab1 99 {
whismanoid 19:8f951e448ab1 100 // recommended for hex command codes 30..3F
whismanoid 19:8f951e448ab1 101 }
whismanoid 19:8f951e448ab1 102 break;
whismanoid 19:8f951e448ab1 103 case '4':
whismanoid 19:8f951e448ab1 104 {
whismanoid 19:8f951e448ab1 105 // recommended for hex command codes 40..4F
whismanoid 19:8f951e448ab1 106 }
whismanoid 19:8f951e448ab1 107 break;
whismanoid 19:8f951e448ab1 108 case '5':
whismanoid 19:8f951e448ab1 109 {
whismanoid 19:8f951e448ab1 110 // recommended for hex command codes 50..5F
whismanoid 19:8f951e448ab1 111 }
whismanoid 19:8f951e448ab1 112 break;
whismanoid 19:8f951e448ab1 113 case '6':
whismanoid 19:8f951e448ab1 114 {
whismanoid 19:8f951e448ab1 115 // recommended for hex command codes 60..6F
whismanoid 19:8f951e448ab1 116 }
whismanoid 19:8f951e448ab1 117 break;
whismanoid 19:8f951e448ab1 118 case '7':
whismanoid 19:8f951e448ab1 119 {
whismanoid 19:8f951e448ab1 120 // recommended for hex command codes 70..7F
whismanoid 19:8f951e448ab1 121 }
whismanoid 19:8f951e448ab1 122 break;
whismanoid 19:8f951e448ab1 123 case '8':
whismanoid 19:8f951e448ab1 124 {
whismanoid 19:8f951e448ab1 125 // recommended for hex command codes 80..8F
whismanoid 19:8f951e448ab1 126 }
whismanoid 19:8f951e448ab1 127 break;
whismanoid 19:8f951e448ab1 128 case '9':
whismanoid 19:8f951e448ab1 129 {
whismanoid 19:8f951e448ab1 130 // recommended for hex command codes 90..9F
whismanoid 19:8f951e448ab1 131 }
whismanoid 19:8f951e448ab1 132 break;
whismanoid 19:8f951e448ab1 133 case 'a': case 'A':
whismanoid 19:8f951e448ab1 134 {
whismanoid 19:8f951e448ab1 135 // recommended for hex command codes A0..AF
whismanoid 19:8f951e448ab1 136 switch (cmdLine[1])
whismanoid 19:8f951e448ab1 137 {
whismanoid 19:8f951e448ab1 138 case 't': case 'T':
whismanoid 19:8f951e448ab1 139 #if IGNORE_AT_COMMANDS
whismanoid 19:8f951e448ab1 140 # if HAS_DAPLINK_SERIAL
whismanoid 19:8f951e448ab1 141 cmdLine_DAPLINKserial.serial().printf("\r\n ignore AT command \"%s\"\r\n", cmdLine.str());
whismanoid 19:8f951e448ab1 142 # endif // HAS_DAPLINK_SERIAL
whismanoid 19:8f951e448ab1 143 // AT command: skip the prompt to avoid confusing modem detector
whismanoid 19:8f951e448ab1 144 return false; // command not handled
whismanoid 19:8f951e448ab1 145 #endif // IGNORE_AT_COMMANDS
whismanoid 19:8f951e448ab1 146 }
whismanoid 19:8f951e448ab1 147 }
whismanoid 19:8f951e448ab1 148 break;
whismanoid 19:8f951e448ab1 149 case 'b': case 'B':
whismanoid 19:8f951e448ab1 150 {
whismanoid 19:8f951e448ab1 151 // recommended for hex command codes B0..BF
whismanoid 19:8f951e448ab1 152 }
whismanoid 19:8f951e448ab1 153 break;
whismanoid 19:8f951e448ab1 154 case 'c': case 'C':
whismanoid 19:8f951e448ab1 155 {
whismanoid 19:8f951e448ab1 156 // recommended for hex command codes C0..CF
whismanoid 28:d2ee1c57ff81 157 // cmdLine.serial().printf("\r\n CV ch=? ainp=? ainn=? pga=? -- (future) Voltage configuration");
whismanoid 28:d2ee1c57ff81 158 // cmdLine.serial().printf("\r\n CT -- (future) Thermocouple configuration");
whismanoid 28:d2ee1c57ff81 159 // cmdLine.serial().printf("\r\n CR -- (future) Resistive Temperature Device (RTD) configuration");
whismanoid 29:7d0bc70036be 160 #warning "Not Implemented Yet: MAX11410 menu C Voltage / Thermocouple / RTD configuration"
whismanoid 19:8f951e448ab1 161 }
whismanoid 19:8f951e448ab1 162 break;
whismanoid 19:8f951e448ab1 163 case 'd': case 'D':
whismanoid 19:8f951e448ab1 164 {
whismanoid 19:8f951e448ab1 165 // recommended for hex command codes D0..DF
whismanoid 19:8f951e448ab1 166 }
whismanoid 19:8f951e448ab1 167 break;
whismanoid 19:8f951e448ab1 168 case 'e': case 'E':
whismanoid 19:8f951e448ab1 169 {
whismanoid 19:8f951e448ab1 170 // recommended for hex command codes E0..EF
whismanoid 19:8f951e448ab1 171 }
whismanoid 19:8f951e448ab1 172 break;
whismanoid 19:8f951e448ab1 173 case 'f': case 'F':
whismanoid 19:8f951e448ab1 174 {
whismanoid 19:8f951e448ab1 175 // recommended for hex command codes F0..FF
whismanoid 19:8f951e448ab1 176 }
whismanoid 19:8f951e448ab1 177 break;
whismanoid 28:d2ee1c57ff81 178 // case 'g': case 'G':
whismanoid 28:d2ee1c57ff81 179 // case 'h': case 'H':
whismanoid 28:d2ee1c57ff81 180 // case 'i': case 'I':
whismanoid 28:d2ee1c57ff81 181 // case 'j': case 'J':
whismanoid 28:d2ee1c57ff81 182 // case 'k': case 'K':
whismanoid 28:d2ee1c57ff81 183 // case 'l': case 'L':
whismanoid 28:d2ee1c57ff81 184 case 'm': case 'M':
whismanoid 28:d2ee1c57ff81 185 {
whismanoid 28:d2ee1c57ff81 186 // cmdLine.serial().printf("\r\n MV -- (future) Voltage measurement");
whismanoid 28:d2ee1c57ff81 187 // cmdLine.serial().printf("\r\n MT -- (future) Thermocouple measurement");
whismanoid 28:d2ee1c57ff81 188 // cmdLine.serial().printf("\r\n MR -- (future) RTD measurement");
whismanoid 29:7d0bc70036be 189 #warning "Not Implemented Yet: MAX11410 menu M measure Voltage / Thermocouple / RTD"
whismanoid 28:d2ee1c57ff81 190 }
whismanoid 28:d2ee1c57ff81 191 break;
whismanoid 28:d2ee1c57ff81 192 // case 'n': case 'N':
whismanoid 28:d2ee1c57ff81 193 // case 'o': case 'O':
whismanoid 28:d2ee1c57ff81 194 // case 'p': case 'P':
whismanoid 28:d2ee1c57ff81 195 // case 'q': case 'Q':
whismanoid 28:d2ee1c57ff81 196 case 'r': case 'R':
whismanoid 28:d2ee1c57ff81 197 {
whismanoid 28:d2ee1c57ff81 198 // cmdLine.serial().printf("\r\n R reg=? -- (future) read register");
whismanoid 31:8068c5394e0d 199 #warning "Not Tested Yet: MAX11410 menu R read register"
whismanoid 31:8068c5394e0d 200 uint8_t regAddress; // = g_MAX11410_device.reg; ??
whismanoid 31:8068c5394e0d 201 if (cmdLine.parse_byte_dec("reg", regAddress))
whismanoid 31:8068c5394e0d 202 {
whismanoid 31:8068c5394e0d 203 }
whismanoid 31:8068c5394e0d 204 if (regAddress <= MAX11410::CMD_r001_0000_xxxx_xxxx_WAIT_START)
whismanoid 31:8068c5394e0d 205 {
whismanoid 31:8068c5394e0d 206 // regAddress range 0x00 .. 0x10 are 8-bit registers
whismanoid 31:8068c5394e0d 207 uint8_t regData;
whismanoid 31:8068c5394e0d 208 g_MAX11410_device.Read_8bit((MAX11410::MAX11410_CMD_enum_t)regAddress, &regData);
whismanoid 32:ad00de965151 209 cmdLine.serial().printf("r reg=0x%2.2x --> data=0x%2.2x\r\n",
whismanoid 32:ad00de965151 210 regAddress, regData);
whismanoid 31:8068c5394e0d 211 }
whismanoid 31:8068c5394e0d 212 else if (regAddress <= MAX11410::CMD_r011_1001_dddd_dddd_dddd_dddd_dxxd_dddd_STATUS_IE)
whismanoid 31:8068c5394e0d 213 {
whismanoid 31:8068c5394e0d 214 // regAddress range 0x11 .. 0x39 are 24-bit registers
whismanoid 31:8068c5394e0d 215 uint32_t regData;
whismanoid 31:8068c5394e0d 216 g_MAX11410_device.Read_24bit((MAX11410::MAX11410_CMD_enum_t)regAddress, &regData);
whismanoid 32:ad00de965151 217 cmdLine.serial().printf("r reg=0x%2.2x --> data=0x%6.6lx\r\n",
whismanoid 32:ad00de965151 218 regAddress, regData);
whismanoid 31:8068c5394e0d 219 }
whismanoid 31:8068c5394e0d 220 else
whismanoid 31:8068c5394e0d 221 {
whismanoid 31:8068c5394e0d 222 // regAddress range 0x3a .. 0x6f are 16-bit registers
whismanoid 31:8068c5394e0d 223 uint16_t regData;
whismanoid 31:8068c5394e0d 224 g_MAX11410_device.Read_16bit((MAX11410::MAX11410_CMD_enum_t)regAddress, &regData);
whismanoid 32:ad00de965151 225 cmdLine.serial().printf("r reg=0x%2.2x --> data=0x%4.4x\r\n",
whismanoid 32:ad00de965151 226 regAddress, regData);
whismanoid 31:8068c5394e0d 227 }
whismanoid 32:ad00de965151 228 return true; // command was handled by MAX11410
whismanoid 28:d2ee1c57ff81 229 }
whismanoid 28:d2ee1c57ff81 230 break;
whismanoid 28:d2ee1c57ff81 231 case 's': case 'S':
whismanoid 28:d2ee1c57ff81 232 {
whismanoid 28:d2ee1c57ff81 233 // cmdLine.serial().printf("\r\n S -- (future) read status register");
whismanoid 31:8068c5394e0d 234 #warning "Not Tested Yet: MAX11410 menu S read status register"
whismanoid 31:8068c5394e0d 235 g_MAX11410_device.Read_24bit(MAX11410::CMD_r011_1000_dddd_dddd_dddd_dddd_dxxx_dddd_STATUS, &g_MAX11410_device.status);
whismanoid 31:8068c5394e0d 236 cmdLine.serial().printf("status=0x%6.6lx\r\n",
whismanoid 31:8068c5394e0d 237 g_MAX11410_device.status);
whismanoid 32:ad00de965151 238 return true; // command was handled by MAX11410
whismanoid 28:d2ee1c57ff81 239 }
whismanoid 28:d2ee1c57ff81 240 break;
whismanoid 28:d2ee1c57ff81 241 // case 't': case 'T':
whismanoid 28:d2ee1c57ff81 242 // case 'u': case 'U':
whismanoid 28:d2ee1c57ff81 243 // case 'v': case 'V':
whismanoid 28:d2ee1c57ff81 244 case 'w': case 'W':
whismanoid 28:d2ee1c57ff81 245 {
whismanoid 28:d2ee1c57ff81 246 // cmdLine.serial().printf("\r\n W reg=? data=? -- (future) write register");
whismanoid 31:8068c5394e0d 247 #warning "Not Tested Yet: MAX11410 menu W write register"
whismanoid 31:8068c5394e0d 248 uint8_t regAddress; // = g_MAX11410_device.reg; ??
whismanoid 31:8068c5394e0d 249 if (cmdLine.parse_byte_dec("reg", regAddress))
whismanoid 31:8068c5394e0d 250 {
whismanoid 31:8068c5394e0d 251 }
whismanoid 31:8068c5394e0d 252 if (regAddress <= MAX11410::CMD_r001_0000_xxxx_xxxx_WAIT_START)
whismanoid 31:8068c5394e0d 253 {
whismanoid 31:8068c5394e0d 254 // regAddress range 0x00 .. 0x10 are 8-bit registers
whismanoid 31:8068c5394e0d 255 uint8_t regData;
whismanoid 31:8068c5394e0d 256 if (cmdLine.parse_byte_dec("data", regData))
whismanoid 31:8068c5394e0d 257 {
whismanoid 31:8068c5394e0d 258 }
whismanoid 31:8068c5394e0d 259 g_MAX11410_device.Write_8bit((MAX11410::MAX11410_CMD_enum_t)regAddress, regData);
whismanoid 32:ad00de965151 260 cmdLine.serial().printf("w reg=0x%2.2x data=0x%2.2x\r\n",
whismanoid 32:ad00de965151 261 regAddress, regData);
whismanoid 31:8068c5394e0d 262 }
whismanoid 31:8068c5394e0d 263 else if (regAddress <= MAX11410::CMD_r011_1001_dddd_dddd_dddd_dddd_dxxd_dddd_STATUS_IE)
whismanoid 31:8068c5394e0d 264 {
whismanoid 31:8068c5394e0d 265 // regAddress range 0x11 .. 0x39 are 24-bit registers
whismanoid 31:8068c5394e0d 266 #warning "CmdLine needs to define parse_uint32_dec()"
whismanoid 31:8068c5394e0d 267 //uint32_t regData;
whismanoid 31:8068c5394e0d 268 //if (cmdLine.parse_uint32_dec("data", regData))
whismanoid 31:8068c5394e0d 269 uint16_t regData;
whismanoid 31:8068c5394e0d 270 if (cmdLine.parse_uint16_dec("data", regData))
whismanoid 31:8068c5394e0d 271 {
whismanoid 31:8068c5394e0d 272 }
whismanoid 31:8068c5394e0d 273 g_MAX11410_device.Write_24bit((MAX11410::MAX11410_CMD_enum_t)regAddress, regData);
whismanoid 32:ad00de965151 274 cmdLine.serial().printf("w reg=0x%2.2x data=0x%6.6lx\r\n",
whismanoid 32:ad00de965151 275 regAddress, regData);
whismanoid 31:8068c5394e0d 276 }
whismanoid 31:8068c5394e0d 277 else
whismanoid 31:8068c5394e0d 278 {
whismanoid 31:8068c5394e0d 279 // regAddress range 0x3a .. 0x6f are 16-bit registers
whismanoid 31:8068c5394e0d 280 uint16_t regData;
whismanoid 31:8068c5394e0d 281 if (cmdLine.parse_uint16_dec("data", regData))
whismanoid 31:8068c5394e0d 282 {
whismanoid 31:8068c5394e0d 283 }
whismanoid 31:8068c5394e0d 284 g_MAX11410_device.Write_16bit((MAX11410::MAX11410_CMD_enum_t)regAddress, regData);
whismanoid 32:ad00de965151 285 cmdLine.serial().printf("w reg=0x%2.2x regData=0x%4.4x\r\n",
whismanoid 32:ad00de965151 286 regAddress, regData);
whismanoid 31:8068c5394e0d 287 }
whismanoid 31:8068c5394e0d 288 // g_MAX11410_device.Write_8bit(MAX11410_CMD_enum_t regAddress, uint8_t regData)
whismanoid 31:8068c5394e0d 289 // g_MAX11410_device.Write_16bit(MAX11410_CMD_enum_t regAddress, uint16_t regData);
whismanoid 31:8068c5394e0d 290 // g_MAX11410_device.Write_24bit(MAX11410_CMD_enum_t regAddress, uint32_t regData);
whismanoid 32:ad00de965151 291 return true; // command was handled by MAX11410
whismanoid 28:d2ee1c57ff81 292 }
whismanoid 28:d2ee1c57ff81 293 break;
whismanoid 19:8f951e448ab1 294 case 'x': case 'X':
whismanoid 19:8f951e448ab1 295 {
whismanoid 19:8f951e448ab1 296 }
whismanoid 19:8f951e448ab1 297 break;
whismanoid 19:8f951e448ab1 298 case 'y': case 'Y':
whismanoid 19:8f951e448ab1 299 {
whismanoid 19:8f951e448ab1 300 }
whismanoid 19:8f951e448ab1 301 break;
whismanoid 19:8f951e448ab1 302 case 'z': case 'Z':
whismanoid 19:8f951e448ab1 303 {
whismanoid 19:8f951e448ab1 304 }
whismanoid 19:8f951e448ab1 305 break;
whismanoid 19:8f951e448ab1 306 case '~': // TODO: IGNORE_AT_COMMANDS -- ignore ~~~ modem command
whismanoid 19:8f951e448ab1 307 {
whismanoid 19:8f951e448ab1 308 // TODO: '~' is not recommended for menu commands, interferes with ssh
whismanoid 19:8f951e448ab1 309 #if IGNORE_AT_COMMANDS
whismanoid 19:8f951e448ab1 310 # if HAS_DAPLINK_SERIAL
whismanoid 19:8f951e448ab1 311 cmdLine_DAPLINKserial.serial().printf("\r\n ignore AT command \"%s\"\r\n", cmdLine.str());
whismanoid 19:8f951e448ab1 312 # endif // HAS_DAPLINK_SERIAL
whismanoid 19:8f951e448ab1 313 #endif // IGNORE_AT_COMMANDS
whismanoid 19:8f951e448ab1 314 }
whismanoid 19:8f951e448ab1 315 break;
whismanoid 19:8f951e448ab1 316 case '+': // TODO: IGNORE_AT_COMMANDS -- ignore +++ modem command
whismanoid 19:8f951e448ab1 317 {
whismanoid 19:8f951e448ab1 318 #if IGNORE_AT_COMMANDS
whismanoid 19:8f951e448ab1 319 # if HAS_DAPLINK_SERIAL
whismanoid 19:8f951e448ab1 320 cmdLine_DAPLINKserial.serial().printf("\r\n ignore AT command \"%s\"\r\n", cmdLine.str());
whismanoid 19:8f951e448ab1 321 # endif // HAS_DAPLINK_SERIAL
whismanoid 19:8f951e448ab1 322 #endif // IGNORE_AT_COMMANDS
whismanoid 19:8f951e448ab1 323 }
whismanoid 19:8f951e448ab1 324 break;
whismanoid 29:7d0bc70036be 325 case '@':
whismanoid 29:7d0bc70036be 326 {
whismanoid 29:7d0bc70036be 327 // // Menu @ -- print device configuration
whismanoid 29:7d0bc70036be 328 // cmdLine.serial().printf("\r\n @ -- (future) print device configuration");
whismanoid 30:9eb6eff512e7 329 #warning "Not Tested Yet: MAX11410 menu @ print device configuration"
whismanoid 30:9eb6eff512e7 330 // //
whismanoid 30:9eb6eff512e7 331 // print shadow register configuration
whismanoid 30:9eb6eff512e7 332 //
whismanoid 30:9eb6eff512e7 333 // shadow of write-only register CODE dddd_dddd_dddd_0000
whismanoid 30:9eb6eff512e7 334 //~ int16_t CMD_1000_CODE;
whismanoid 30:9eb6eff512e7 335 // int index = 0;
whismanoid 30:9eb6eff512e7 336 // for (index = 0; index < 4; index++)
whismanoid 30:9eb6eff512e7 337 // {
whismanoid 30:9eb6eff512e7 338 // cmdLine.serial().printf("CODE %c=0x%4.4x MAX5715_VoltageOfCode(%d)=%5.3fV\r\n",
whismanoid 30:9eb6eff512e7 339 // (char)('A' + index),
whismanoid 30:9eb6eff512e7 340 // (g_MAX5715_device.Shadow_0010_nnnn_CODE[index] & 0xFFFF),
whismanoid 30:9eb6eff512e7 341 // g_MAX5715_device.CODE[index],
whismanoid 30:9eb6eff512e7 342 // g_MAX5715_device.VoltageOfCode(g_MAX5715_device.CODE[index])
whismanoid 30:9eb6eff512e7 343 // );
whismanoid 30:9eb6eff512e7 344 // }
whismanoid 30:9eb6eff512e7 345 //
whismanoid 30:9eb6eff512e7 346 // cmdLine.serial().printf("\r\n");
whismanoid 30:9eb6eff512e7 347 //
whismanoid 30:9eb6eff512e7 348 //cmdLine.serial().printf("channelNumber_0_3=%d channels_bitmask_DCBA=%d\r\n",
whismanoid 30:9eb6eff512e7 349 // (g_MAX5715_device.channelNumber_0_3 & 0xFFFF),
whismanoid 30:9eb6eff512e7 350 // (g_MAX5715_device.channels_bitmask_DCBA & 0xFFFF));
whismanoid 30:9eb6eff512e7 351 //
whismanoid 30:9eb6eff512e7 352 cmdLine.serial().printf("VRef=%5.6fV\r\n", g_MAX11410_device.VRef);
whismanoid 30:9eb6eff512e7 353 // dtostrf width and precision: 2.5V / 2^24 LSB = ______ volts per LSB
whismanoid 30:9eb6eff512e7 354 //
whismanoid 30:9eb6eff512e7 355 // shadow of register CMD_r011_1000_dddd_dddd_dddd_dddd_dxxx_dddd_STATUS
whismanoid 31:8068c5394e0d 356 cmdLine.serial().printf("status=0x%6.6lx\r\n",
whismanoid 30:9eb6eff512e7 357 g_MAX11410_device.status);
whismanoid 30:9eb6eff512e7 358 //
whismanoid 30:9eb6eff512e7 359 // shadow of register CMD_r011_0000_dddd_dddd_dddd_dddd_dddd_dddd_DATA0
whismanoid 30:9eb6eff512e7 360 double voltage_of_data0;
whismanoid 30:9eb6eff512e7 361 voltage_of_data0 = g_MAX11410_device.VoltageOfCode(g_MAX11410_device.data0);
whismanoid 31:8068c5394e0d 362 cmdLine.serial().printf("data0=0x%6.6lx=%lu=%ld=%5.6fV\r\n",
whismanoid 30:9eb6eff512e7 363 g_MAX11410_device.data0,
whismanoid 30:9eb6eff512e7 364 g_MAX11410_device.data0,
whismanoid 30:9eb6eff512e7 365 g_MAX11410_device.data0,
whismanoid 30:9eb6eff512e7 366 voltage_of_data0);
whismanoid 30:9eb6eff512e7 367 //
whismanoid 30:9eb6eff512e7 368 return true; // command was handled by MAX11410
whismanoid 29:7d0bc70036be 369 }
whismanoid 29:7d0bc70036be 370 break;
whismanoid 19:8f951e448ab1 371 } // end switch (cmdLine[0])
whismanoid 19:8f951e448ab1 372 return false; // command not handled
whismanoid 19:8f951e448ab1 373 } // end bool MAX11410_menu_onEOLcommandParser(CmdLine & cmdLine)