Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.
Dependencies: MaximTinyTester MAX11410 CmdLine USBDevice
Diff: Test_Menu_MAX11410.cpp
- Revision:
- 19:8f951e448ab1
- Child:
- 28:d2ee1c57ff81
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Test_Menu_MAX11410.cpp Wed Jul 24 23:16:08 2019 -0700 @@ -0,0 +1,207 @@ +// /******************************************************************************* +// * Copyright (C) 2019 Maxim Integrated Products, Inc., All Rights Reserved. +// * +// * Permission is hereby granted, free of charge, to any person obtaining a +// * copy of this software and associated documentation files (the "Software"), +// * to deal in the Software without restriction, including without limitation +// * the rights to use, copy, modify, merge, publish, distribute, sublicense, +// * and/or sell copies of the Software, and to permit persons to whom the +// * Software is furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included +// * in all copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES +// * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// * OTHER DEALINGS IN THE SOFTWARE. +// * +// * Except as contained in this notice, the name of Maxim Integrated +// * Products, Inc. shall not be used except as stated in the Maxim Integrated +// * Products, Inc. Branding Policy. +// * +// * The mere transfer of this software does not imply any licenses +// * of trade secrets, proprietary technology, copyrights, patents, +// * trademarks, maskwork rights, or any other form of intellectual +// * property whatsoever. Maxim Integrated Products, Inc. retains all +// * ownership rights. +// ******************************************************************************* +// */ + +#include "mbed.h" +#include "MAX11410.h" +#include "CmdLine.h" + +//-------------------------------------------------- +// tolerate AT commands, which may be sent during probe, such as: +// AT +// AT+CGMI -- request manufacturer identification AT+CMGI=? +// AT+CGMM -- request manufacturer model +// AT%IPSYS? +// ATE0 -- echo disable +// ATV1 -- verbose result codes OK | ERROR | NO CARRIER +// AT+CMEE=1 +// ATX4 +// AT&C1 +// ATE0 +// AT+CMEE=1 +// AT+GCAP +// ATI +// AT+CPIN? +// AT+CGMM +#ifndef IGNORE_AT_COMMANDS +#define IGNORE_AT_COMMANDS 1 +#endif + +//~ extern MAX11410 g_MAX11410_device; // defined in main.cpp + +bool MAX11410_menu_onEOLcommandParser(CmdLine & cmdLine) +{ + switch (cmdLine[0]) + { + // TODO1: MAX11410 main_menu_onEOLcommandParser + case '0': + { + // // recommended for hex command codes 00..0F + // // placeholder: cmdLine.serial().printf("\r\n 3 ch=? code=? -- CODEnLOADn"); + // uint16_t ch = g_MAX5715_device.channelNumber_0_3; + // uint16_t code; + // if (cmdLine.parse_uint16_dec("ch", ch)) + // { + // } + // if (cmdLine.parse_uint16_dec("code", code)) + // { + // } + // if (cmdLine.parse_flag("xyzzy", g_xyzzy_flag, XYZZY_FLAG)) + // { + // isUpdatedSPIConfig = true; + // } + // cmdLine.serial().printf("CODEnLOADn ch=%d code=%d", ch, code); + // //~ MAX5715_CODEnLOADn(ch, code); + // cmdLine.serial().printf("\r\n placeholder"); + return true; // command was handled by MAX11410 + } + break; + case '1': + { + // recommended for hex command codes 10..1F + } + break; + case '2': + { + // recommended for hex command codes 20..2F + } + break; + case '3': + { + // recommended for hex command codes 30..3F + } + break; + case '4': + { + // recommended for hex command codes 40..4F + } + break; + case '5': + { + // recommended for hex command codes 50..5F + } + break; + case '6': + { + // recommended for hex command codes 60..6F + } + break; + case '7': + { + // recommended for hex command codes 70..7F + } + break; + case '8': + { + // recommended for hex command codes 80..8F + } + break; + case '9': + { + // recommended for hex command codes 90..9F + } + break; + case 'a': case 'A': + { + // recommended for hex command codes A0..AF + switch (cmdLine[1]) + { + case 't': case 'T': +#if IGNORE_AT_COMMANDS +# if HAS_DAPLINK_SERIAL + cmdLine_DAPLINKserial.serial().printf("\r\n ignore AT command \"%s\"\r\n", cmdLine.str()); +# endif // HAS_DAPLINK_SERIAL + // AT command: skip the prompt to avoid confusing modem detector + return false; // command not handled +#endif // IGNORE_AT_COMMANDS + } + } + break; + case 'b': case 'B': + { + // recommended for hex command codes B0..BF + } + break; + case 'c': case 'C': + { + // recommended for hex command codes C0..CF + } + break; + case 'd': case 'D': + { + // recommended for hex command codes D0..DF + } + break; + case 'e': case 'E': + { + // recommended for hex command codes E0..EF + } + break; + case 'f': case 'F': + { + // recommended for hex command codes F0..FF + } + break; + case 'x': case 'X': + { + } + break; + case 'y': case 'Y': + { + } + break; + case 'z': case 'Z': + { + } + break; + case '~': // TODO: IGNORE_AT_COMMANDS -- ignore ~~~ modem command + { + // TODO: '~' is not recommended for menu commands, interferes with ssh +#if IGNORE_AT_COMMANDS +# if HAS_DAPLINK_SERIAL + cmdLine_DAPLINKserial.serial().printf("\r\n ignore AT command \"%s\"\r\n", cmdLine.str()); +# endif // HAS_DAPLINK_SERIAL +#endif // IGNORE_AT_COMMANDS + } + break; + case '+': // TODO: IGNORE_AT_COMMANDS -- ignore +++ modem command + { +#if IGNORE_AT_COMMANDS +# if HAS_DAPLINK_SERIAL + cmdLine_DAPLINKserial.serial().printf("\r\n ignore AT command \"%s\"\r\n", cmdLine.str()); +# endif // HAS_DAPLINK_SERIAL +#endif // IGNORE_AT_COMMANDS + } + break; + } // end switch (cmdLine[0]) + return false; // command not handled +} // end bool MAX11410_menu_onEOLcommandParser(CmdLine & cmdLine)