Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.
Dependencies: MaximTinyTester MAX11410 CmdLine USBDevice
Test_Menu_MAX5715.cpp@25:a2afb91c605a, 2019-07-25 (annotated)
- Committer:
- whismanoid
- Date:
- Thu Jul 25 16:22:53 2019 -0700
- Revision:
- 25:a2afb91c605a
- Parent:
- 10:228a52f8107d
MAX11410 WIP buildable, need test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
whismanoid | 10:228a52f8107d | 1 | // /******************************************************************************* |
whismanoid | 10:228a52f8107d | 2 | // * Copyright (C) 2019 Maxim Integrated Products, Inc., All Rights Reserved. |
whismanoid | 10:228a52f8107d | 3 | // * |
whismanoid | 10:228a52f8107d | 4 | // * Permission is hereby granted, free of charge, to any person obtaining a |
whismanoid | 10:228a52f8107d | 5 | // * copy of this software and associated documentation files (the "Software"), |
whismanoid | 10:228a52f8107d | 6 | // * to deal in the Software without restriction, including without limitation |
whismanoid | 10:228a52f8107d | 7 | // * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
whismanoid | 10:228a52f8107d | 8 | // * and/or sell copies of the Software, and to permit persons to whom the |
whismanoid | 10:228a52f8107d | 9 | // * Software is furnished to do so, subject to the following conditions: |
whismanoid | 10:228a52f8107d | 10 | // * |
whismanoid | 10:228a52f8107d | 11 | // * The above copyright notice and this permission notice shall be included |
whismanoid | 10:228a52f8107d | 12 | // * in all copies or substantial portions of the Software. |
whismanoid | 10:228a52f8107d | 13 | // * |
whismanoid | 10:228a52f8107d | 14 | // * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
whismanoid | 10:228a52f8107d | 15 | // * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
whismanoid | 10:228a52f8107d | 16 | // * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
whismanoid | 10:228a52f8107d | 17 | // * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
whismanoid | 10:228a52f8107d | 18 | // * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
whismanoid | 10:228a52f8107d | 19 | // * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
whismanoid | 10:228a52f8107d | 20 | // * OTHER DEALINGS IN THE SOFTWARE. |
whismanoid | 10:228a52f8107d | 21 | // * |
whismanoid | 10:228a52f8107d | 22 | // * Except as contained in this notice, the name of Maxim Integrated |
whismanoid | 10:228a52f8107d | 23 | // * Products, Inc. shall not be used except as stated in the Maxim Integrated |
whismanoid | 10:228a52f8107d | 24 | // * Products, Inc. Branding Policy. |
whismanoid | 10:228a52f8107d | 25 | // * |
whismanoid | 10:228a52f8107d | 26 | // * The mere transfer of this software does not imply any licenses |
whismanoid | 10:228a52f8107d | 27 | // * of trade secrets, proprietary technology, copyrights, patents, |
whismanoid | 10:228a52f8107d | 28 | // * trademarks, maskwork rights, or any other form of intellectual |
whismanoid | 10:228a52f8107d | 29 | // * property whatsoever. Maxim Integrated Products, Inc. retains all |
whismanoid | 10:228a52f8107d | 30 | // * ownership rights. |
whismanoid | 10:228a52f8107d | 31 | // ******************************************************************************* |
whismanoid | 10:228a52f8107d | 32 | // */ |
whismanoid | 10:228a52f8107d | 33 | |
whismanoid | 10:228a52f8107d | 34 | #include "mbed.h" |
whismanoid | 10:228a52f8107d | 35 | #include "MAX5715.h" |
whismanoid | 10:228a52f8107d | 36 | #include "CmdLine.h" |
whismanoid | 10:228a52f8107d | 37 | |
whismanoid | 10:228a52f8107d | 38 | //-------------------------------------------------- |
whismanoid | 10:228a52f8107d | 39 | // tolerate AT commands, which may be sent during probe, such as: |
whismanoid | 10:228a52f8107d | 40 | // AT |
whismanoid | 10:228a52f8107d | 41 | // AT+CGMI -- request manufacturer identification AT+CMGI=? |
whismanoid | 10:228a52f8107d | 42 | // AT+CGMM -- request manufacturer model |
whismanoid | 10:228a52f8107d | 43 | // AT%IPSYS? |
whismanoid | 10:228a52f8107d | 44 | // ATE0 -- echo disable |
whismanoid | 10:228a52f8107d | 45 | // ATV1 -- verbose result codes OK | ERROR | NO CARRIER |
whismanoid | 10:228a52f8107d | 46 | // AT+CMEE=1 |
whismanoid | 10:228a52f8107d | 47 | // ATX4 |
whismanoid | 10:228a52f8107d | 48 | // AT&C1 |
whismanoid | 10:228a52f8107d | 49 | // ATE0 |
whismanoid | 10:228a52f8107d | 50 | // AT+CMEE=1 |
whismanoid | 10:228a52f8107d | 51 | // AT+GCAP |
whismanoid | 10:228a52f8107d | 52 | // ATI |
whismanoid | 10:228a52f8107d | 53 | // AT+CPIN? |
whismanoid | 10:228a52f8107d | 54 | // AT+CGMM |
whismanoid | 10:228a52f8107d | 55 | #ifndef IGNORE_AT_COMMANDS |
whismanoid | 10:228a52f8107d | 56 | #define IGNORE_AT_COMMANDS 1 |
whismanoid | 10:228a52f8107d | 57 | #endif |
whismanoid | 10:228a52f8107d | 58 | |
whismanoid | 10:228a52f8107d | 59 | extern MAX5715 g_MAX5715_device; // defined in main.cpp |
whismanoid | 10:228a52f8107d | 60 | |
whismanoid | 10:228a52f8107d | 61 | bool MAX5715_menu_onEOLcommandParser(CmdLine & cmdLine) |
whismanoid | 10:228a52f8107d | 62 | { |
whismanoid | 10:228a52f8107d | 63 | switch (cmdLine[0]) |
whismanoid | 10:228a52f8107d | 64 | { |
whismanoid | 10:228a52f8107d | 65 | case '0': |
whismanoid | 10:228a52f8107d | 66 | { |
whismanoid | 10:228a52f8107d | 67 | // recommended for hex command codes 00..0F |
whismanoid | 10:228a52f8107d | 68 | // TODO: cmdLine.serial().printf("\r\n 0 ch=? code=? -- CODEn"); |
whismanoid | 10:228a52f8107d | 69 | // Menu 0 ch=? code=?) CODEn |
whismanoid | 10:228a52f8107d | 70 | // MAX5715_CODEn(uint8_t channel, uint16_t dacCodeLsbs); |
whismanoid | 10:228a52f8107d | 71 | // VERIFY: parse strCommandArgs for additional arguments including key=value pairs |
whismanoid | 10:228a52f8107d | 72 | // TODO: parse command arguments ~ parse_strCommandArgs(strCommandArgs); |
whismanoid | 10:228a52f8107d | 73 | uint16_t ch = g_MAX5715_device.channelNumber_0_3; |
whismanoid | 10:228a52f8107d | 74 | if (cmdLine.parse_uint16_dec("ch", ch)) |
whismanoid | 10:228a52f8107d | 75 | { |
whismanoid | 10:228a52f8107d | 76 | } |
whismanoid | 10:228a52f8107d | 77 | uint16_t code = g_MAX5715_device.CODE[ch]; |
whismanoid | 10:228a52f8107d | 78 | if (cmdLine.parse_uint16_dec("code", code)) |
whismanoid | 10:228a52f8107d | 79 | { |
whismanoid | 10:228a52f8107d | 80 | } |
whismanoid | 10:228a52f8107d | 81 | cmdLine.serial().printf("CODEn ch=%d code=%d", ch, code); |
whismanoid | 10:228a52f8107d | 82 | g_MAX5715_device.CODEn(ch, code); |
whismanoid | 10:228a52f8107d | 83 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 84 | } |
whismanoid | 10:228a52f8107d | 85 | break; |
whismanoid | 10:228a52f8107d | 86 | case '1': |
whismanoid | 10:228a52f8107d | 87 | { |
whismanoid | 10:228a52f8107d | 88 | // recommended for hex command codes 10..1F |
whismanoid | 10:228a52f8107d | 89 | // TODO: cmdLine.serial().printf("\r\n 1 ch=? -- LOADn"); |
whismanoid | 10:228a52f8107d | 90 | // TODO: parse command arguments ~ parse_strCommandArgs(strCommandArgs); |
whismanoid | 10:228a52f8107d | 91 | uint16_t ch = g_MAX5715_device.channelNumber_0_3; |
whismanoid | 10:228a52f8107d | 92 | if (cmdLine.parse_uint16_dec("ch", ch)) |
whismanoid | 10:228a52f8107d | 93 | { |
whismanoid | 10:228a52f8107d | 94 | } |
whismanoid | 10:228a52f8107d | 95 | cmdLine.serial().printf("LOADn ch=%d", ch); |
whismanoid | 10:228a52f8107d | 96 | g_MAX5715_device.LOADn(ch); |
whismanoid | 10:228a52f8107d | 97 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 98 | } |
whismanoid | 10:228a52f8107d | 99 | break; |
whismanoid | 10:228a52f8107d | 100 | case '2': |
whismanoid | 10:228a52f8107d | 101 | { |
whismanoid | 10:228a52f8107d | 102 | // recommended for hex command codes 20..2F |
whismanoid | 10:228a52f8107d | 103 | // TODO: cmdLine.serial().printf("\r\n 2 ch=? code=? -- CODEnLOADall"); |
whismanoid | 10:228a52f8107d | 104 | // TODO: parse command arguments ~ parse_strCommandArgs(strCommandArgs); |
whismanoid | 10:228a52f8107d | 105 | uint16_t ch = g_MAX5715_device.channelNumber_0_3; |
whismanoid | 10:228a52f8107d | 106 | if (cmdLine.parse_uint16_dec("ch", ch)) |
whismanoid | 10:228a52f8107d | 107 | { |
whismanoid | 10:228a52f8107d | 108 | } |
whismanoid | 10:228a52f8107d | 109 | uint16_t code = g_MAX5715_device.CODE[ch]; |
whismanoid | 10:228a52f8107d | 110 | if (cmdLine.parse_uint16_dec("code", code)) |
whismanoid | 10:228a52f8107d | 111 | { |
whismanoid | 10:228a52f8107d | 112 | } |
whismanoid | 10:228a52f8107d | 113 | cmdLine.serial().printf("CODEnLOADall ch=%d code=%d", ch, code); |
whismanoid | 10:228a52f8107d | 114 | g_MAX5715_device.CODEnLOADall(ch, code); |
whismanoid | 10:228a52f8107d | 115 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 116 | } |
whismanoid | 10:228a52f8107d | 117 | break; |
whismanoid | 10:228a52f8107d | 118 | case '3': |
whismanoid | 10:228a52f8107d | 119 | { |
whismanoid | 10:228a52f8107d | 120 | // recommended for hex command codes 30..3F |
whismanoid | 10:228a52f8107d | 121 | // TODO: cmdLine.serial().printf("\r\n 3 ch=? code=? -- CODEnLOADn"); |
whismanoid | 10:228a52f8107d | 122 | // TODO: parse command arguments ~ parse_strCommandArgs(strCommandArgs); |
whismanoid | 10:228a52f8107d | 123 | uint16_t ch = g_MAX5715_device.channelNumber_0_3; |
whismanoid | 10:228a52f8107d | 124 | uint16_t code; |
whismanoid | 10:228a52f8107d | 125 | if (cmdLine.parse_uint16_dec("ch", ch)) |
whismanoid | 10:228a52f8107d | 126 | { |
whismanoid | 10:228a52f8107d | 127 | } |
whismanoid | 10:228a52f8107d | 128 | if (cmdLine.parse_uint16_dec("code", code)) |
whismanoid | 10:228a52f8107d | 129 | { |
whismanoid | 10:228a52f8107d | 130 | } |
whismanoid | 10:228a52f8107d | 131 | cmdLine.serial().printf("CODEnLOADn ch=%d code=%d", ch, code); |
whismanoid | 10:228a52f8107d | 132 | g_MAX5715_device.CODEnLOADn(ch, code); |
whismanoid | 10:228a52f8107d | 133 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 134 | } |
whismanoid | 10:228a52f8107d | 135 | break; |
whismanoid | 10:228a52f8107d | 136 | case '4': |
whismanoid | 10:228a52f8107d | 137 | { |
whismanoid | 10:228a52f8107d | 138 | // recommended for hex command codes 40..4F |
whismanoid | 10:228a52f8107d | 139 | switch (cmdLine[1]) |
whismanoid | 10:228a52f8107d | 140 | { |
whismanoid | 10:228a52f8107d | 141 | case '0': |
whismanoid | 10:228a52f8107d | 142 | { |
whismanoid | 10:228a52f8107d | 143 | // cmdLine.serial().printf("\r\n 40 ch=? -- POWERn_Normal"); |
whismanoid | 10:228a52f8107d | 144 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 145 | "channel_dcba=%d, POWERn_Normal)", |
whismanoid | 10:228a52f8107d | 146 | g_MAX5715_device.channels_bitmask_DCBA); |
whismanoid | 10:228a52f8107d | 147 | g_MAX5715_device.POWER(g_MAX5715_device. |
whismanoid | 10:228a52f8107d | 148 | channels_bitmask_DCBA, |
whismanoid | 10:228a52f8107d | 149 | MAX5715::POWERn_Normal); |
whismanoid | 10:228a52f8107d | 150 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 151 | } |
whismanoid | 10:228a52f8107d | 152 | break; |
whismanoid | 10:228a52f8107d | 153 | case '1': |
whismanoid | 10:228a52f8107d | 154 | { |
whismanoid | 10:228a52f8107d | 155 | // cmdLine.serial().printf("\r\n 41 ch=? -- POWERn_PD1k"); |
whismanoid | 10:228a52f8107d | 156 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 157 | "channel_dcba=%d, POWERn_PD1k)", |
whismanoid | 10:228a52f8107d | 158 | g_MAX5715_device.channels_bitmask_DCBA); |
whismanoid | 10:228a52f8107d | 159 | g_MAX5715_device.POWER(g_MAX5715_device. |
whismanoid | 10:228a52f8107d | 160 | channels_bitmask_DCBA, |
whismanoid | 10:228a52f8107d | 161 | MAX5715::POWERn_PD1k); |
whismanoid | 10:228a52f8107d | 162 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 163 | } |
whismanoid | 10:228a52f8107d | 164 | break; |
whismanoid | 10:228a52f8107d | 165 | case '2': |
whismanoid | 10:228a52f8107d | 166 | { |
whismanoid | 10:228a52f8107d | 167 | // cmdLine.serial().printf("\r\n 42 ch=? -- POWERn_PD100k"); |
whismanoid | 10:228a52f8107d | 168 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 169 | "channel_dcba=%d, POWERn_PD100k)", |
whismanoid | 10:228a52f8107d | 170 | g_MAX5715_device.channels_bitmask_DCBA); |
whismanoid | 10:228a52f8107d | 171 | g_MAX5715_device.POWER(g_MAX5715_device. |
whismanoid | 10:228a52f8107d | 172 | channels_bitmask_DCBA, |
whismanoid | 10:228a52f8107d | 173 | MAX5715::POWERn_PD100k); |
whismanoid | 10:228a52f8107d | 174 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 175 | } |
whismanoid | 10:228a52f8107d | 176 | break; |
whismanoid | 10:228a52f8107d | 177 | case '3': |
whismanoid | 10:228a52f8107d | 178 | { |
whismanoid | 10:228a52f8107d | 179 | // cmdLine.serial().printf("\r\n 43 ch=? -- POWERn_PDHiZ"); |
whismanoid | 10:228a52f8107d | 180 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 181 | "channel_dcba=%d, POWERn_PDHiZ)", |
whismanoid | 10:228a52f8107d | 182 | g_MAX5715_device.channels_bitmask_DCBA); |
whismanoid | 10:228a52f8107d | 183 | g_MAX5715_device.POWER(g_MAX5715_device. |
whismanoid | 10:228a52f8107d | 184 | channels_bitmask_DCBA, |
whismanoid | 10:228a52f8107d | 185 | MAX5715::POWERn_PDHiZ); |
whismanoid | 10:228a52f8107d | 186 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 187 | } |
whismanoid | 10:228a52f8107d | 188 | break; |
whismanoid | 10:228a52f8107d | 189 | } |
whismanoid | 10:228a52f8107d | 190 | break; |
whismanoid | 10:228a52f8107d | 191 | } |
whismanoid | 10:228a52f8107d | 192 | break; |
whismanoid | 10:228a52f8107d | 193 | case '5': |
whismanoid | 10:228a52f8107d | 194 | { |
whismanoid | 10:228a52f8107d | 195 | // recommended for hex command codes 50..5F |
whismanoid | 10:228a52f8107d | 196 | switch (cmdLine[1]) |
whismanoid | 10:228a52f8107d | 197 | { |
whismanoid | 10:228a52f8107d | 198 | case '0': |
whismanoid | 10:228a52f8107d | 199 | { |
whismanoid | 10:228a52f8107d | 200 | // cmdLine.serial().printf("\r\n 50 -- SW_CLEAR"); |
whismanoid | 10:228a52f8107d | 201 | cmdLine.serial().printf("SW_CLEAR"); |
whismanoid | 10:228a52f8107d | 202 | g_MAX5715_device.SW_CLEAR(); |
whismanoid | 10:228a52f8107d | 203 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 204 | } |
whismanoid | 10:228a52f8107d | 205 | break; |
whismanoid | 10:228a52f8107d | 206 | case '1': |
whismanoid | 10:228a52f8107d | 207 | { |
whismanoid | 10:228a52f8107d | 208 | // cmdLine.serial().printf("\r\n 51 -- SW_RESET"); |
whismanoid | 10:228a52f8107d | 209 | cmdLine.serial().printf("SW_RESET"); |
whismanoid | 10:228a52f8107d | 210 | g_MAX5715_device.SW_RESET(); |
whismanoid | 10:228a52f8107d | 211 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 212 | } |
whismanoid | 10:228a52f8107d | 213 | break; |
whismanoid | 10:228a52f8107d | 214 | } |
whismanoid | 10:228a52f8107d | 215 | } |
whismanoid | 10:228a52f8107d | 216 | break; |
whismanoid | 10:228a52f8107d | 217 | case '6': |
whismanoid | 10:228a52f8107d | 218 | { |
whismanoid | 10:228a52f8107d | 219 | // recommended for hex command codes 60..6F |
whismanoid | 10:228a52f8107d | 220 | switch (cmdLine[1]) |
whismanoid | 10:228a52f8107d | 221 | { |
whismanoid | 10:228a52f8107d | 222 | case '0': |
whismanoid | 10:228a52f8107d | 223 | { |
whismanoid | 10:228a52f8107d | 224 | // cmdLine.serial().printf("\r\n 60 ch=? -- CONFIGn_LATCHED"); |
whismanoid | 10:228a52f8107d | 225 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 226 | "MAX5715_CONFIGn_LATCHED(channel_dcba=%d)", |
whismanoid | 10:228a52f8107d | 227 | g_MAX5715_device. |
whismanoid | 10:228a52f8107d | 228 | channels_bitmask_DCBA); |
whismanoid | 10:228a52f8107d | 229 | g_MAX5715_device.CONFIGn_LATCHED(g_MAX5715_device. |
whismanoid | 10:228a52f8107d | 230 | channels_bitmask_DCBA); |
whismanoid | 10:228a52f8107d | 231 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 232 | } |
whismanoid | 10:228a52f8107d | 233 | break; |
whismanoid | 10:228a52f8107d | 234 | case '1': |
whismanoid | 10:228a52f8107d | 235 | { |
whismanoid | 10:228a52f8107d | 236 | // cmdLine.serial().printf("\r\n 61 ch=? -- CONFIGn_TRANSPARENT"); |
whismanoid | 10:228a52f8107d | 237 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 238 | "MAX5715_CONFIGn_TRANSPARENT(channel_dcba=%d)", |
whismanoid | 10:228a52f8107d | 239 | g_MAX5715_device. |
whismanoid | 10:228a52f8107d | 240 | channels_bitmask_DCBA); |
whismanoid | 10:228a52f8107d | 241 | g_MAX5715_device.CONFIGn_TRANSPARENT( |
whismanoid | 10:228a52f8107d | 242 | g_MAX5715_device.channels_bitmask_DCBA); |
whismanoid | 10:228a52f8107d | 243 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 244 | } |
whismanoid | 10:228a52f8107d | 245 | break; |
whismanoid | 10:228a52f8107d | 246 | case '8': |
whismanoid | 10:228a52f8107d | 247 | { |
whismanoid | 10:228a52f8107d | 248 | // cmdLine.serial().printf("\r\n 68 -- CONFIGall_LATCHED"); |
whismanoid | 10:228a52f8107d | 249 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 250 | "MAX5715_CONFIGall_LATCHED()"); |
whismanoid | 10:228a52f8107d | 251 | g_MAX5715_device.CONFIGall_LATCHED(); |
whismanoid | 10:228a52f8107d | 252 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 253 | } |
whismanoid | 10:228a52f8107d | 254 | break; |
whismanoid | 10:228a52f8107d | 255 | case '9': |
whismanoid | 10:228a52f8107d | 256 | { |
whismanoid | 10:228a52f8107d | 257 | // cmdLine.serial().printf("\r\n 69 -- CONFIGall_TRANSPARENT"); |
whismanoid | 10:228a52f8107d | 258 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 259 | "MAX5715_CONFIGall_TRANSPARENT()"); |
whismanoid | 10:228a52f8107d | 260 | g_MAX5715_device.CONFIGall_TRANSPARENT(); |
whismanoid | 10:228a52f8107d | 261 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 262 | } |
whismanoid | 10:228a52f8107d | 263 | break; |
whismanoid | 10:228a52f8107d | 264 | } |
whismanoid | 10:228a52f8107d | 265 | } |
whismanoid | 10:228a52f8107d | 266 | break; |
whismanoid | 10:228a52f8107d | 267 | case '7': |
whismanoid | 10:228a52f8107d | 268 | { |
whismanoid | 10:228a52f8107d | 269 | // recommended for hex command codes 70..7F |
whismanoid | 10:228a52f8107d | 270 | switch (cmdLine[1]) |
whismanoid | 10:228a52f8107d | 271 | { |
whismanoid | 10:228a52f8107d | 272 | case '0': |
whismanoid | 10:228a52f8107d | 273 | { |
whismanoid | 10:228a52f8107d | 274 | // cmdLine.serial().printf("\r\n 70 -- REF_EXT"); |
whismanoid | 10:228a52f8107d | 275 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 276 | "MAX5715_REF(REF_EXT)"); |
whismanoid | 10:228a52f8107d | 277 | g_MAX5715_device.REF(MAX5715::REF_EXT); |
whismanoid | 10:228a52f8107d | 278 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 279 | } |
whismanoid | 10:228a52f8107d | 280 | break; |
whismanoid | 10:228a52f8107d | 281 | case '1': |
whismanoid | 10:228a52f8107d | 282 | { |
whismanoid | 10:228a52f8107d | 283 | // cmdLine.serial().printf("\r\n 71 -- REF_2V500"); |
whismanoid | 10:228a52f8107d | 284 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 285 | "MAX5715_REF(REF_2V500)"); |
whismanoid | 10:228a52f8107d | 286 | g_MAX5715_device.REF(MAX5715::REF_2V500); |
whismanoid | 10:228a52f8107d | 287 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 288 | } |
whismanoid | 10:228a52f8107d | 289 | break; |
whismanoid | 10:228a52f8107d | 290 | case '2': |
whismanoid | 10:228a52f8107d | 291 | { |
whismanoid | 10:228a52f8107d | 292 | // cmdLine.serial().printf("\r\n 72 -- REF_2V048"); |
whismanoid | 10:228a52f8107d | 293 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 294 | "MAX5715_REF(REF_2V048)"); |
whismanoid | 10:228a52f8107d | 295 | g_MAX5715_device.REF(MAX5715::REF_2V048); |
whismanoid | 10:228a52f8107d | 296 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 297 | } |
whismanoid | 10:228a52f8107d | 298 | break; |
whismanoid | 10:228a52f8107d | 299 | case '3': |
whismanoid | 10:228a52f8107d | 300 | { |
whismanoid | 10:228a52f8107d | 301 | // cmdLine.serial().printf("\r\n 73 -- REF_4V096"); |
whismanoid | 10:228a52f8107d | 302 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 303 | "MAX5715_REF(REF_4V096)"); |
whismanoid | 10:228a52f8107d | 304 | g_MAX5715_device.REF(MAX5715::REF_4V096); |
whismanoid | 10:228a52f8107d | 305 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 306 | } |
whismanoid | 10:228a52f8107d | 307 | break; |
whismanoid | 10:228a52f8107d | 308 | case '4': |
whismanoid | 10:228a52f8107d | 309 | { |
whismanoid | 10:228a52f8107d | 310 | // cmdLine.serial().printf("\r\n 74 -- REF_AlwaysOn_EXT"); |
whismanoid | 10:228a52f8107d | 311 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 312 | "MAX5715_REF(REF_AlwaysOn_EXT)"); |
whismanoid | 10:228a52f8107d | 313 | g_MAX5715_device.REF(MAX5715::REF_AlwaysOn_EXT); |
whismanoid | 10:228a52f8107d | 314 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 315 | } |
whismanoid | 10:228a52f8107d | 316 | break; |
whismanoid | 10:228a52f8107d | 317 | case '5': |
whismanoid | 10:228a52f8107d | 318 | { |
whismanoid | 10:228a52f8107d | 319 | // cmdLine.serial().printf("\r\n 75 -- REF_AlwaysOn_2V500"); |
whismanoid | 10:228a52f8107d | 320 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 321 | "MAX5715_REF(REF_AlwaysOn_2V500)"); |
whismanoid | 10:228a52f8107d | 322 | g_MAX5715_device.REF(MAX5715::REF_AlwaysOn_2V500); |
whismanoid | 10:228a52f8107d | 323 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 324 | } |
whismanoid | 10:228a52f8107d | 325 | break; |
whismanoid | 10:228a52f8107d | 326 | case '6': |
whismanoid | 10:228a52f8107d | 327 | { |
whismanoid | 10:228a52f8107d | 328 | // cmdLine.serial().printf("\r\n 76 -- REF_AlwaysOn_2V048"); |
whismanoid | 10:228a52f8107d | 329 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 330 | "MAX5715_REF(REF_AlwaysOn_2V048)"); |
whismanoid | 10:228a52f8107d | 331 | g_MAX5715_device.REF(MAX5715::REF_AlwaysOn_2V048); |
whismanoid | 10:228a52f8107d | 332 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 333 | } |
whismanoid | 10:228a52f8107d | 334 | break; |
whismanoid | 10:228a52f8107d | 335 | case '7': |
whismanoid | 10:228a52f8107d | 336 | { |
whismanoid | 10:228a52f8107d | 337 | // cmdLine.serial().printf("\r\n 77 -- REF_AlwaysOn_4V096"); |
whismanoid | 10:228a52f8107d | 338 | cmdLine.serial().printf( |
whismanoid | 10:228a52f8107d | 339 | "MAX5715_REF(REF_AlwaysOn_4V096)"); |
whismanoid | 10:228a52f8107d | 340 | g_MAX5715_device.REF(MAX5715::REF_AlwaysOn_4V096); |
whismanoid | 10:228a52f8107d | 341 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 342 | } |
whismanoid | 10:228a52f8107d | 343 | break; |
whismanoid | 10:228a52f8107d | 344 | } |
whismanoid | 10:228a52f8107d | 345 | } |
whismanoid | 10:228a52f8107d | 346 | break; |
whismanoid | 10:228a52f8107d | 347 | case '8': |
whismanoid | 10:228a52f8107d | 348 | { |
whismanoid | 10:228a52f8107d | 349 | // recommended for hex command codes 80..8F |
whismanoid | 10:228a52f8107d | 350 | switch (cmdLine[1]) |
whismanoid | 10:228a52f8107d | 351 | { |
whismanoid | 10:228a52f8107d | 352 | case '0': |
whismanoid | 10:228a52f8107d | 353 | { |
whismanoid | 10:228a52f8107d | 354 | // TODO: cmdLine.serial().printf("\r\n 80 code=? -- CODEall"); |
whismanoid | 10:228a52f8107d | 355 | // TODO: parse command arguments ~ parse_strCommandArgs(strCommandArgs); |
whismanoid | 10:228a52f8107d | 356 | g_MAX5715_device.channels_bitmask_DCBA = 0xFF; // store g_MAX5715_device.CODE[allChannels] |
whismanoid | 10:228a52f8107d | 357 | uint16_t code = g_MAX5715_device.CODE[0]; |
whismanoid | 10:228a52f8107d | 358 | if (cmdLine.parse_uint16_dec("code", code)) |
whismanoid | 10:228a52f8107d | 359 | { |
whismanoid | 10:228a52f8107d | 360 | } |
whismanoid | 10:228a52f8107d | 361 | cmdLine.serial().printf("CODEall code=%d", code); |
whismanoid | 10:228a52f8107d | 362 | g_MAX5715_device.CODEall(code); |
whismanoid | 10:228a52f8107d | 363 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 364 | } |
whismanoid | 10:228a52f8107d | 365 | break; |
whismanoid | 10:228a52f8107d | 366 | case '1': |
whismanoid | 10:228a52f8107d | 367 | { |
whismanoid | 10:228a52f8107d | 368 | // TODO: cmdLine.serial().printf("\r\n 81 -- LOADall"); |
whismanoid | 10:228a52f8107d | 369 | cmdLine.serial().printf("LOADall"); |
whismanoid | 10:228a52f8107d | 370 | g_MAX5715_device.LOADall(); |
whismanoid | 10:228a52f8107d | 371 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 372 | } |
whismanoid | 10:228a52f8107d | 373 | break; |
whismanoid | 10:228a52f8107d | 374 | case '2': |
whismanoid | 10:228a52f8107d | 375 | { |
whismanoid | 10:228a52f8107d | 376 | // TODO: cmdLine.serial().printf("\r\n 82 code=? -- CODEallLOADall"); |
whismanoid | 10:228a52f8107d | 377 | uint16_t code = g_MAX5715_device.CODE[0]; |
whismanoid | 10:228a52f8107d | 378 | if (cmdLine.parse_uint16_dec("code", code)) |
whismanoid | 10:228a52f8107d | 379 | { |
whismanoid | 10:228a52f8107d | 380 | } |
whismanoid | 10:228a52f8107d | 381 | cmdLine.serial().printf("CODEallLOADall code=%d", code); |
whismanoid | 10:228a52f8107d | 382 | g_MAX5715_device.CODEallLOADall(code); |
whismanoid | 10:228a52f8107d | 383 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 384 | } |
whismanoid | 10:228a52f8107d | 385 | break; |
whismanoid | 10:228a52f8107d | 386 | } |
whismanoid | 10:228a52f8107d | 387 | } |
whismanoid | 10:228a52f8107d | 388 | break; |
whismanoid | 10:228a52f8107d | 389 | case '9': |
whismanoid | 10:228a52f8107d | 390 | { |
whismanoid | 10:228a52f8107d | 391 | // recommended for hex command codes 90..9F |
whismanoid | 10:228a52f8107d | 392 | } |
whismanoid | 10:228a52f8107d | 393 | break; |
whismanoid | 10:228a52f8107d | 394 | case 'a': case 'A': |
whismanoid | 10:228a52f8107d | 395 | { |
whismanoid | 10:228a52f8107d | 396 | // recommended for hex command codes A0..AF |
whismanoid | 10:228a52f8107d | 397 | switch (cmdLine[1]) |
whismanoid | 10:228a52f8107d | 398 | { |
whismanoid | 10:228a52f8107d | 399 | case 't': case 'T': |
whismanoid | 10:228a52f8107d | 400 | #if IGNORE_AT_COMMANDS |
whismanoid | 10:228a52f8107d | 401 | # if HAS_DAPLINK_SERIAL |
whismanoid | 10:228a52f8107d | 402 | cmdLine_DAPLINKserial.serial().printf("\r\n ignore AT command \"%s\"\r\n", cmdLine.str()); |
whismanoid | 10:228a52f8107d | 403 | # endif // HAS_DAPLINK_SERIAL |
whismanoid | 10:228a52f8107d | 404 | // AT command: skip the prompt to avoid confusing modem detector |
whismanoid | 10:228a52f8107d | 405 | return false; // command not handled |
whismanoid | 10:228a52f8107d | 406 | #endif // IGNORE_AT_COMMANDS |
whismanoid | 10:228a52f8107d | 407 | } |
whismanoid | 10:228a52f8107d | 408 | } |
whismanoid | 10:228a52f8107d | 409 | break; |
whismanoid | 10:228a52f8107d | 410 | case 'b': case 'B': |
whismanoid | 10:228a52f8107d | 411 | { |
whismanoid | 10:228a52f8107d | 412 | // recommended for hex command codes B0..BF |
whismanoid | 10:228a52f8107d | 413 | } |
whismanoid | 10:228a52f8107d | 414 | break; |
whismanoid | 10:228a52f8107d | 415 | case 'c': case 'C': |
whismanoid | 10:228a52f8107d | 416 | { |
whismanoid | 10:228a52f8107d | 417 | // recommended for hex command codes C0..CF |
whismanoid | 10:228a52f8107d | 418 | // // MAX5717 menu function to drive MAX5717_CLRb_Pin CLR# |
whismanoid | 10:228a52f8107d | 419 | // cmdLine.serial().printf("\r\n C -- CLR# pulse CH high CL low"); |
whismanoid | 10:228a52f8107d | 420 | switch (cmdLine[1]) |
whismanoid | 10:228a52f8107d | 421 | { |
whismanoid | 10:228a52f8107d | 422 | default: |
whismanoid | 10:228a52f8107d | 423 | // g_MAX5715_device.CLRboutputPulseLow(); |
whismanoid | 10:228a52f8107d | 424 | g_MAX5715_device.CLRboutputValue(1); |
whismanoid | 10:228a52f8107d | 425 | g_MAX5715_device.CLRboutputValue(0); |
whismanoid | 10:228a52f8107d | 426 | g_MAX5715_device.CLRboutputValue(1); |
whismanoid | 10:228a52f8107d | 427 | break; |
whismanoid | 10:228a52f8107d | 428 | case 'H': case 'h': case '1': |
whismanoid | 10:228a52f8107d | 429 | g_MAX5715_device.CLRboutputValue(1); // GPIOoutputCLRb(int isLogicHigh); |
whismanoid | 10:228a52f8107d | 430 | break; |
whismanoid | 10:228a52f8107d | 431 | case 'L': case 'l': case '0': |
whismanoid | 10:228a52f8107d | 432 | g_MAX5715_device.CLRboutputValue(0); // GPIOoutputCLRb(int isLogicHigh); |
whismanoid | 10:228a52f8107d | 433 | break; |
whismanoid | 10:228a52f8107d | 434 | } |
whismanoid | 10:228a52f8107d | 435 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 436 | } |
whismanoid | 10:228a52f8107d | 437 | break; |
whismanoid | 10:228a52f8107d | 438 | case 'd': case 'D': |
whismanoid | 10:228a52f8107d | 439 | { |
whismanoid | 10:228a52f8107d | 440 | // recommended for hex command codes D0..DF |
whismanoid | 10:228a52f8107d | 441 | } |
whismanoid | 10:228a52f8107d | 442 | break; |
whismanoid | 10:228a52f8107d | 443 | case 'e': case 'E': |
whismanoid | 10:228a52f8107d | 444 | { |
whismanoid | 10:228a52f8107d | 445 | // recommended for hex command codes E0..EF |
whismanoid | 10:228a52f8107d | 446 | } |
whismanoid | 10:228a52f8107d | 447 | break; |
whismanoid | 10:228a52f8107d | 448 | case 'f': case 'F': |
whismanoid | 10:228a52f8107d | 449 | { |
whismanoid | 10:228a52f8107d | 450 | // recommended for hex command codes F0..FF |
whismanoid | 10:228a52f8107d | 451 | } |
whismanoid | 10:228a52f8107d | 452 | break; |
whismanoid | 10:228a52f8107d | 453 | case 'l': case 'L': |
whismanoid | 10:228a52f8107d | 454 | { |
whismanoid | 10:228a52f8107d | 455 | // // MAX5717 menu function to drive MAX5717_LDACb_Pin LDAC# |
whismanoid | 10:228a52f8107d | 456 | // cmdLine.serial().printf("\r\n L -- LDAC# pulse LH high LL low"); |
whismanoid | 10:228a52f8107d | 457 | switch (cmdLine[1]) |
whismanoid | 10:228a52f8107d | 458 | { |
whismanoid | 10:228a52f8107d | 459 | default: |
whismanoid | 10:228a52f8107d | 460 | // g_MAX5715_device.LDACboutputPulseLow(); |
whismanoid | 10:228a52f8107d | 461 | g_MAX5715_device.LDACboutputValue(1); |
whismanoid | 10:228a52f8107d | 462 | g_MAX5715_device.LDACboutputValue(0); |
whismanoid | 10:228a52f8107d | 463 | g_MAX5715_device.LDACboutputValue(1); |
whismanoid | 10:228a52f8107d | 464 | break; |
whismanoid | 10:228a52f8107d | 465 | case 'H': case 'h': case '1': |
whismanoid | 10:228a52f8107d | 466 | g_MAX5715_device.LDACboutputValue(1); // GPIOoutputLDACb(int isLogicHigh); |
whismanoid | 10:228a52f8107d | 467 | break; |
whismanoid | 10:228a52f8107d | 468 | case 'L': case 'l': case '0': |
whismanoid | 10:228a52f8107d | 469 | g_MAX5715_device.LDACboutputValue(0); // GPIOoutputLDACb(int isLogicHigh); |
whismanoid | 10:228a52f8107d | 470 | break; |
whismanoid | 10:228a52f8107d | 471 | } |
whismanoid | 10:228a52f8107d | 472 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 473 | } |
whismanoid | 10:228a52f8107d | 474 | break; |
whismanoid | 10:228a52f8107d | 475 | case 'x': case 'X': |
whismanoid | 10:228a52f8107d | 476 | { |
whismanoid | 10:228a52f8107d | 477 | } |
whismanoid | 10:228a52f8107d | 478 | break; |
whismanoid | 10:228a52f8107d | 479 | case 'y': case 'Y': |
whismanoid | 10:228a52f8107d | 480 | { |
whismanoid | 10:228a52f8107d | 481 | } |
whismanoid | 10:228a52f8107d | 482 | break; |
whismanoid | 10:228a52f8107d | 483 | case 'z': case 'Z': |
whismanoid | 10:228a52f8107d | 484 | { |
whismanoid | 10:228a52f8107d | 485 | } |
whismanoid | 10:228a52f8107d | 486 | break; |
whismanoid | 10:228a52f8107d | 487 | case '~': // TODO: IGNORE_AT_COMMANDS -- ignore ~~~ modem command |
whismanoid | 10:228a52f8107d | 488 | { |
whismanoid | 10:228a52f8107d | 489 | // TODO: '~' is not recommended for menu commands, interferes with ssh |
whismanoid | 10:228a52f8107d | 490 | switch (cmdLine[1]) |
whismanoid | 10:228a52f8107d | 491 | { |
whismanoid | 10:228a52f8107d | 492 | default: |
whismanoid | 10:228a52f8107d | 493 | { |
whismanoid | 10:228a52f8107d | 494 | #if IGNORE_AT_COMMANDS |
whismanoid | 10:228a52f8107d | 495 | # if HAS_DAPLINK_SERIAL |
whismanoid | 10:228a52f8107d | 496 | cmdLine_DAPLINKserial.serial().printf("\r\n ignore AT command \"%s\"\r\n", |
whismanoid | 10:228a52f8107d | 497 | cmdLine.str()); |
whismanoid | 10:228a52f8107d | 498 | # endif // HAS_DAPLINK_SERIAL |
whismanoid | 10:228a52f8107d | 499 | #endif // IGNORE_AT_COMMANDS |
whismanoid | 10:228a52f8107d | 500 | } |
whismanoid | 10:228a52f8107d | 501 | } |
whismanoid | 10:228a52f8107d | 502 | } |
whismanoid | 10:228a52f8107d | 503 | break; |
whismanoid | 10:228a52f8107d | 504 | case '+': // TODO: IGNORE_AT_COMMANDS -- ignore +++ modem command |
whismanoid | 10:228a52f8107d | 505 | { |
whismanoid | 10:228a52f8107d | 506 | #if IGNORE_AT_COMMANDS |
whismanoid | 10:228a52f8107d | 507 | # if HAS_DAPLINK_SERIAL |
whismanoid | 10:228a52f8107d | 508 | cmdLine_DAPLINKserial.serial().printf("\r\n ignore AT command \"%s\"\r\n", cmdLine.str()); |
whismanoid | 10:228a52f8107d | 509 | # endif // HAS_DAPLINK_SERIAL |
whismanoid | 10:228a52f8107d | 510 | #endif // IGNORE_AT_COMMANDS |
whismanoid | 10:228a52f8107d | 511 | } |
whismanoid | 10:228a52f8107d | 512 | break; |
whismanoid | 10:228a52f8107d | 513 | case '@': |
whismanoid | 10:228a52f8107d | 514 | { |
whismanoid | 10:228a52f8107d | 515 | // // |
whismanoid | 10:228a52f8107d | 516 | // // Menu @ -- print device configuration |
whismanoid | 10:228a52f8107d | 517 | // TODO: cmdLine.serial().printf("\r\n @ -- print MAX5715 configuration"); |
whismanoid | 10:228a52f8107d | 518 | // // |
whismanoid | 10:228a52f8107d | 519 | // print shadow register configuration |
whismanoid | 10:228a52f8107d | 520 | // |
whismanoid | 10:228a52f8107d | 521 | // shadow of write-only register CODE dddd_dddd_dddd_0000 |
whismanoid | 10:228a52f8107d | 522 | //~ int16_t CMD_1000_CODE; |
whismanoid | 10:228a52f8107d | 523 | int index = 0; |
whismanoid | 10:228a52f8107d | 524 | for (index = 0; index < 4; index++) |
whismanoid | 10:228a52f8107d | 525 | { |
whismanoid | 10:228a52f8107d | 526 | cmdLine.serial().printf("CODE %c=0x%4.4x MAX5715_VoltageOfCode(%d)=%5.3fV\r\n", |
whismanoid | 10:228a52f8107d | 527 | (char)('A' + index), |
whismanoid | 10:228a52f8107d | 528 | (g_MAX5715_device.Shadow_0010_nnnn_CODE[index] & 0xFFFF), |
whismanoid | 10:228a52f8107d | 529 | g_MAX5715_device.CODE[index], |
whismanoid | 10:228a52f8107d | 530 | g_MAX5715_device.VoltageOfCode(g_MAX5715_device.CODE[index]) |
whismanoid | 10:228a52f8107d | 531 | ); |
whismanoid | 10:228a52f8107d | 532 | } |
whismanoid | 10:228a52f8107d | 533 | // |
whismanoid | 10:228a52f8107d | 534 | cmdLine.serial().printf("\r\n"); |
whismanoid | 10:228a52f8107d | 535 | // |
whismanoid | 10:228a52f8107d | 536 | // |
whismanoid | 10:228a52f8107d | 537 | // Menu @) print MAX5715 configuration AND g_MAX5715_device globals |
whismanoid | 10:228a52f8107d | 538 | // |
whismanoid | 10:228a52f8107d | 539 | #if 1 // SUPPORT_CHANNELS |
whismanoid | 10:228a52f8107d | 540 | cmdLine.serial().printf("channelNumber_0_3=%d channels_bitmask_DCBA=%d\r\n", |
whismanoid | 10:228a52f8107d | 541 | (g_MAX5715_device.channelNumber_0_3 & 0xFFFF), |
whismanoid | 10:228a52f8107d | 542 | (g_MAX5715_device.channels_bitmask_DCBA & 0xFFFF)); |
whismanoid | 10:228a52f8107d | 543 | #endif // SUPPORT_CHANNELS |
whismanoid | 10:228a52f8107d | 544 | // |
whismanoid | 10:228a52f8107d | 545 | cmdLine.serial().printf("VRef=%5.3fV\r\n", g_MAX5715_device.VRef); |
whismanoid | 10:228a52f8107d | 546 | // dtostrf width and precision: 3.3V / 1024 LSB = 0.00322265625 volts per LSB |
whismanoid | 10:228a52f8107d | 547 | return true; // command was handled by MAX5715 |
whismanoid | 10:228a52f8107d | 548 | } |
whismanoid | 10:228a52f8107d | 549 | break; |
whismanoid | 10:228a52f8107d | 550 | } // end switch (cmdLine[0]) |
whismanoid | 10:228a52f8107d | 551 | return false; // command not handled by MAX5715 |
whismanoid | 10:228a52f8107d | 552 | } // end bool MAX5715_menu_onEOLcommandParser(CmdLine & cmdLine) |
whismanoid | 10:228a52f8107d | 553 |