Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.
Dependencies: MaximTinyTester CmdLine MAX541 USBDevice
Test_Menu_MAX11043.cpp@64:a667cfd83492, 2020-02-19 (annotated)
- Committer:
- whismanoid
- Date:
- Wed Feb 19 00:52:33 2020 +0000
- Revision:
- 64:a667cfd83492
- Parent:
- 59:47538bcf6cda
- Child:
- 65:2117e32f017d
menu items, conflict G gain vs CONVRUN pin name?
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
whismanoid | 52:607010f0c54e | 1 | // /******************************************************************************* |
whismanoid | 52:607010f0c54e | 2 | // * Copyright (C) 2020 Maxim Integrated Products, Inc., All Rights Reserved. |
whismanoid | 52:607010f0c54e | 3 | // * |
whismanoid | 52:607010f0c54e | 4 | // * Permission is hereby granted, free of charge, to any person obtaining a |
whismanoid | 52:607010f0c54e | 5 | // * copy of this software and associated documentation files (the "Software"), |
whismanoid | 52:607010f0c54e | 6 | // * to deal in the Software without restriction, including without limitation |
whismanoid | 52:607010f0c54e | 7 | // * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
whismanoid | 52:607010f0c54e | 8 | // * and/or sell copies of the Software, and to permit persons to whom the |
whismanoid | 52:607010f0c54e | 9 | // * Software is furnished to do so, subject to the following conditions: |
whismanoid | 52:607010f0c54e | 10 | // * |
whismanoid | 52:607010f0c54e | 11 | // * The above copyright notice and this permission notice shall be included |
whismanoid | 52:607010f0c54e | 12 | // * in all copies or substantial portions of the Software. |
whismanoid | 52:607010f0c54e | 13 | // * |
whismanoid | 52:607010f0c54e | 14 | // * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
whismanoid | 52:607010f0c54e | 15 | // * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
whismanoid | 52:607010f0c54e | 16 | // * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
whismanoid | 52:607010f0c54e | 17 | // * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
whismanoid | 52:607010f0c54e | 18 | // * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
whismanoid | 52:607010f0c54e | 19 | // * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
whismanoid | 52:607010f0c54e | 20 | // * OTHER DEALINGS IN THE SOFTWARE. |
whismanoid | 52:607010f0c54e | 21 | // * |
whismanoid | 52:607010f0c54e | 22 | // * Except as contained in this notice, the name of Maxim Integrated |
whismanoid | 52:607010f0c54e | 23 | // * Products, Inc. shall not be used except as stated in the Maxim Integrated |
whismanoid | 52:607010f0c54e | 24 | // * Products, Inc. Branding Policy. |
whismanoid | 52:607010f0c54e | 25 | // * |
whismanoid | 52:607010f0c54e | 26 | // * The mere transfer of this software does not imply any licenses |
whismanoid | 52:607010f0c54e | 27 | // * of trade secrets, proprietary technology, copyrights, patents, |
whismanoid | 52:607010f0c54e | 28 | // * trademarks, maskwork rights, or any other form of intellectual |
whismanoid | 52:607010f0c54e | 29 | // * property whatsoever. Maxim Integrated Products, Inc. retains all |
whismanoid | 52:607010f0c54e | 30 | // * ownership rights. |
whismanoid | 52:607010f0c54e | 31 | // ******************************************************************************* |
whismanoid | 52:607010f0c54e | 32 | // */ |
whismanoid | 52:607010f0c54e | 33 | #include "CmdLine.h" |
whismanoid | 52:607010f0c54e | 34 | #include "MaximTinyTester.h" |
whismanoid | 52:607010f0c54e | 35 | // CODE GENERATOR: class declaration and docstrings |
whismanoid | 52:607010f0c54e | 36 | // CODE GENERATOR: example code includes |
whismanoid | 52:607010f0c54e | 37 | // example code includes |
whismanoid | 52:607010f0c54e | 38 | // standard include for target platform -- Platform_Include_Boilerplate |
whismanoid | 52:607010f0c54e | 39 | #include "mbed.h" |
whismanoid | 52:607010f0c54e | 40 | // Platforms: |
whismanoid | 52:607010f0c54e | 41 | // - MAX32625MBED |
whismanoid | 52:607010f0c54e | 42 | // - supports mbed-os-5.11, requires USBDevice library |
whismanoid | 52:607010f0c54e | 43 | // - add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/ |
whismanoid | 52:607010f0c54e | 44 | // - remove max32630fthr library (if present) |
whismanoid | 52:607010f0c54e | 45 | // - remove MAX32620FTHR library (if present) |
whismanoid | 52:607010f0c54e | 46 | // - MAX32600MBED |
whismanoid | 52:607010f0c54e | 47 | // - remove max32630fthr library (if present) |
whismanoid | 52:607010f0c54e | 48 | // - remove MAX32620FTHR library (if present) |
whismanoid | 52:607010f0c54e | 49 | // - Windows 10 note: Don't connect HDK until you are ready to load new firmware into the board. |
whismanoid | 52:607010f0c54e | 50 | // - NUCLEO_F446RE |
whismanoid | 52:607010f0c54e | 51 | // - remove USBDevice library |
whismanoid | 52:607010f0c54e | 52 | // - remove max32630fthr library (if present) |
whismanoid | 52:607010f0c54e | 53 | // - remove MAX32620FTHR library (if present) |
whismanoid | 52:607010f0c54e | 54 | // - NUCLEO_F401RE |
whismanoid | 52:607010f0c54e | 55 | // - remove USBDevice library |
whismanoid | 52:607010f0c54e | 56 | // - remove max32630fthr library (if present) |
whismanoid | 52:607010f0c54e | 57 | // - remove MAX32620FTHR library (if present) |
whismanoid | 52:607010f0c54e | 58 | // - MAX32630FTHR |
whismanoid | 52:607010f0c54e | 59 | // - #include "max32630fthr.h" |
whismanoid | 52:607010f0c54e | 60 | // - add http://os.mbed.org/teams/MaximIntegrated/code/max32630fthr/ |
whismanoid | 52:607010f0c54e | 61 | // - remove MAX32620FTHR library (if present) |
whismanoid | 52:607010f0c54e | 62 | // - MAX32620FTHR |
whismanoid | 52:607010f0c54e | 63 | // - #include "MAX32620FTHR.h" |
whismanoid | 52:607010f0c54e | 64 | // - remove max32630fthr library (if present) |
whismanoid | 52:607010f0c54e | 65 | // - add https://os.mbed.com/teams/MaximIntegrated/code/MAX32620FTHR/ |
whismanoid | 52:607010f0c54e | 66 | // - not tested yet |
whismanoid | 52:607010f0c54e | 67 | // - MAX32625PICO |
whismanoid | 52:607010f0c54e | 68 | // - remove max32630fthr library (if present) |
whismanoid | 52:607010f0c54e | 69 | // - remove MAX32620FTHR library (if present) |
whismanoid | 52:607010f0c54e | 70 | // - not tested yet |
whismanoid | 52:607010f0c54e | 71 | // |
whismanoid | 52:607010f0c54e | 72 | // end Platform_Include_Boilerplate |
whismanoid | 52:607010f0c54e | 73 | #include "MAX11043.h" |
whismanoid | 52:607010f0c54e | 74 | #include "CmdLine.h" |
whismanoid | 52:607010f0c54e | 75 | #include "MaximTinyTester.h" |
whismanoid | 52:607010f0c54e | 76 | // CODE GENERATOR: class declaration statement open |
whismanoid | 52:607010f0c54e | 77 | |
whismanoid | 52:607010f0c54e | 78 | // CODE GENERATOR: Test_Menu externs |
whismanoid | 52:607010f0c54e | 79 | #include "MAX11043.h" |
whismanoid | 52:607010f0c54e | 80 | extern MAX11043 g_MAX11043_device; // defined in main.cpp |
whismanoid | 52:607010f0c54e | 81 | |
whismanoid | 52:607010f0c54e | 82 | // CODE GENERATOR: build testMenuCommand list |
whismanoid | 52:607010f0c54e | 83 | // CODE GENERATOR: build testMenuGlobalArgsDict common/global argument list |
whismanoid | 52:607010f0c54e | 84 | // CODE GENERATOR: class member function declarations |
whismanoid | 52:607010f0c54e | 85 | // CODE GENERATOR: MAX11043 Command Name = Init (void) --> uint8_t |
whismanoid | 52:607010f0c54e | 86 | // CODE GENERATOR: Menu item hint description Menu item '!' |
whismanoid | 52:607010f0c54e | 87 | // CODE GENERATOR: Menu item '!' -- Menu item ! |
whismanoid | 52:607010f0c54e | 88 | // CODE GENERATOR: test menu case '!': |
whismanoid | 52:607010f0c54e | 89 | // CODE GENERATOR: helpString '! -- Init' |
whismanoid | 52:607010f0c54e | 90 | // CODE GENERATOR: CMD_ 'None' |
whismanoid | 52:607010f0c54e | 91 | // CODE GENERATOR: CommandName 'Init' |
whismanoid | 52:607010f0c54e | 92 | // CODE GENERATOR: CommandParamIn 'void' |
whismanoid | 52:607010f0c54e | 93 | // CODE GENERATOR: CommandReturnType 'uint8_t' |
whismanoid | 52:607010f0c54e | 94 | // CODE GENERATOR: CommandPre '' |
whismanoid | 52:607010f0c54e | 95 | // CODE GENERATOR: CommandDocParamIn '' |
whismanoid | 52:607010f0c54e | 96 | // CODE GENERATOR: CommandDocParamOut '' |
whismanoid | 52:607010f0c54e | 97 | // CODE GENERATOR: CommandPost '' |
whismanoid | 52:607010f0c54e | 98 | // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure' |
whismanoid | 52:607010f0c54e | 99 | // CODE GENERATOR: MAX11043 Command Name = RegWrite (MAX11043_CMD_enum_t commandByte, uint32_t regData) --> uint8_t |
whismanoid | 52:607010f0c54e | 100 | // CODE GENERATOR: no Menu item hint in description |
whismanoid | 52:607010f0c54e | 101 | // CODE GENERATOR: MAX11043 Command Name = RegRead (MAX11043_CMD_enum_t commandByte, uint32_t* ptrRegData) --> uint8_t |
whismanoid | 52:607010f0c54e | 102 | // CODE GENERATOR: no Menu item hint in description |
whismanoid | 52:607010f0c54e | 103 | // CODE GENERATOR: MAX11043 Command Name = RegSize (MAX11043_CMD_enum_t commandByte) --> uint8_t |
whismanoid | 52:607010f0c54e | 104 | // CODE GENERATOR: no Menu item hint in description |
whismanoid | 57:1c9da8e90737 | 105 | // CODE GENERATOR: MAX11043 Command Name = DecodeCommand (MAX11043_CMD_enum_t commandByte) --> MAX11043::MAX11043_CMDOP_enum_t |
whismanoid | 57:1c9da8e90737 | 106 | // CODE GENERATOR: no Menu item hint in description |
whismanoid | 52:607010f0c54e | 107 | // CODE GENERATOR: MAX11043 Command Name = RegAddrOfCommand (MAX11043_CMD_enum_t commandByte) --> uint8_t |
whismanoid | 52:607010f0c54e | 108 | // CODE GENERATOR: no Menu item hint in description |
whismanoid | 52:607010f0c54e | 109 | // CODE GENERATOR: MAX11043 Command Name = IsRegReadCommand (MAX11043_CMD_enum_t commandByte) --> uint8_t |
whismanoid | 52:607010f0c54e | 110 | // CODE GENERATOR: no Menu item hint in description |
whismanoid | 52:607010f0c54e | 111 | // CODE GENERATOR: MAX11043 Command Name = RegName (MAX11043_CMD_enum_t commandByte) --> const char* |
whismanoid | 52:607010f0c54e | 112 | // CODE GENERATOR: no Menu item hint in description |
whismanoid | 64:a667cfd83492 | 113 | // CODE GENERATOR: MAX11043 Command Name = Read_ADCabcd (void) --> uint8_t |
whismanoid | 64:a667cfd83492 | 114 | // CODE GENERATOR: Menu item hint description Menu item '$' -> adca, adcb, adcc, adcd |
whismanoid | 64:a667cfd83492 | 115 | // CODE GENERATOR: Menu item '$' -> adca, adcb, adcc, adcd -- Menu item $ |
whismanoid | 64:a667cfd83492 | 116 | // CODE GENERATOR: test menu case '$': |
whismanoid | 64:a667cfd83492 | 117 | // CODE GENERATOR: helpString '$ -- Read_ADCabcd' |
whismanoid | 64:a667cfd83492 | 118 | // CODE GENERATOR: CMD_ 'None' |
whismanoid | 64:a667cfd83492 | 119 | // CODE GENERATOR: CommandName 'Read_ADCabcd' |
whismanoid | 64:a667cfd83492 | 120 | // CODE GENERATOR: CommandParamIn 'void' |
whismanoid | 64:a667cfd83492 | 121 | // CODE GENERATOR: CommandReturnType 'uint8_t' |
whismanoid | 64:a667cfd83492 | 122 | // CODE GENERATOR: CommandPre '' |
whismanoid | 64:a667cfd83492 | 123 | // CODE GENERATOR: CommandDocParamIn '' |
whismanoid | 64:a667cfd83492 | 124 | // CODE GENERATOR: CommandDocParamOut '' |
whismanoid | 64:a667cfd83492 | 125 | // CODE GENERATOR: CommandPost '' |
whismanoid | 64:a667cfd83492 | 126 | // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure' |
whismanoid | 64:a667cfd83492 | 127 | // CODE GENERATOR: MAX11043 Command Name = Write_AGain (uint32_t gain) --> uint8_t |
whismanoid | 64:a667cfd83492 | 128 | // CODE GENERATOR: Menu item hint description Menu item 'JA' |
whismanoid | 64:a667cfd83492 | 129 | // CODE GENERATOR: Menu item 'JA' -- Menu item JA |
whismanoid | 64:a667cfd83492 | 130 | // CODE GENERATOR: MAX11043 help: JA uint32_t gain -- Write_AGain |
whismanoid | 64:a667cfd83492 | 131 | // CODE GENERATOR: MAX11043 helpString: 'JA gain=? -- Write_AGain' |
whismanoid | 64:a667cfd83492 | 132 | // CODE GENERATOR: test menu case 'JA': |
whismanoid | 64:a667cfd83492 | 133 | // CODE GENERATOR: helpString 'JA gain=? -- Write_AGain' |
whismanoid | 64:a667cfd83492 | 134 | // CODE GENERATOR: CMD_ 'None' |
whismanoid | 64:a667cfd83492 | 135 | // CODE GENERATOR: CommandName 'Write_AGain' |
whismanoid | 64:a667cfd83492 | 136 | // CODE GENERATOR: CommandParamIn 'uint32_t gain' |
whismanoid | 64:a667cfd83492 | 137 | // CODE GENERATOR: CommandReturnType 'uint8_t' |
whismanoid | 64:a667cfd83492 | 138 | // CODE GENERATOR: CommandPre '' |
whismanoid | 64:a667cfd83492 | 139 | // CODE GENERATOR: CommandDocParamIn '@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000' |
whismanoid | 64:a667cfd83492 | 140 | // CODE GENERATOR: CommandDocParamOut '' |
whismanoid | 64:a667cfd83492 | 141 | // CODE GENERATOR: CommandPost '' |
whismanoid | 64:a667cfd83492 | 142 | // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure' |
whismanoid | 59:47538bcf6cda | 143 | // CODE GENERATOR: MAX11043 Command Name = Configure_XXXXX (uint8_t linef, uint8_t rate) --> uint8_t |
whismanoid | 59:47538bcf6cda | 144 | // CODE GENERATOR: Menu item hint description Menu item 'XX' |
whismanoid | 59:47538bcf6cda | 145 | // CODE GENERATOR: Menu item 'XX' -- Menu item XX |
whismanoid | 59:47538bcf6cda | 146 | // CODE GENERATOR: MAX11043 help: XX uint8_t linef, uint8_t rate -- Configure_XXXXX |
whismanoid | 59:47538bcf6cda | 147 | // CODE GENERATOR: MAX11043 helpString: 'XX linef=? rate=? -- Configure_XXXXX' |
whismanoid | 59:47538bcf6cda | 148 | // CODE GENERATOR: test menu case 'XX': |
whismanoid | 59:47538bcf6cda | 149 | // CODE GENERATOR: helpString 'XX linef=? rate=? -- Configure_XXXXX' |
whismanoid | 59:47538bcf6cda | 150 | // CODE GENERATOR: CMD_ 'None' |
whismanoid | 59:47538bcf6cda | 151 | // CODE GENERATOR: CommandName 'Configure_XXXXX' |
whismanoid | 59:47538bcf6cda | 152 | // CODE GENERATOR: CommandParamIn 'uint8_t linef, uint8_t rate' |
whismanoid | 59:47538bcf6cda | 153 | // CODE GENERATOR: CommandReturnType 'uint8_t' |
whismanoid | 59:47538bcf6cda | 154 | // CODE GENERATOR: CommandPre '' |
whismanoid | 59:47538bcf6cda | 155 | // CODE GENERATOR: CommandDocParamIn '' |
whismanoid | 59:47538bcf6cda | 156 | // CODE GENERATOR: CommandDocParamOut '' |
whismanoid | 59:47538bcf6cda | 157 | // CODE GENERATOR: CommandPost '' |
whismanoid | 59:47538bcf6cda | 158 | // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure' |
whismanoid | 59:47538bcf6cda | 159 | // CODE GENERATOR: MAX11043 Command Name = Configure_XXXXY (uint8_t linef, uint8_t rate) --> uint8_t |
whismanoid | 59:47538bcf6cda | 160 | // CODE GENERATOR: Menu item hint description Menu item 'XY' |
whismanoid | 59:47538bcf6cda | 161 | // CODE GENERATOR: Menu item 'XY' -- Menu item XY |
whismanoid | 59:47538bcf6cda | 162 | // CODE GENERATOR: MAX11043 help: XY uint8_t linef, uint8_t rate -- Configure_XXXXY |
whismanoid | 59:47538bcf6cda | 163 | // CODE GENERATOR: MAX11043 helpString: 'XY linef=? rate=? -- Configure_XXXXY' |
whismanoid | 59:47538bcf6cda | 164 | // CODE GENERATOR: test menu case 'XY': |
whismanoid | 59:47538bcf6cda | 165 | // CODE GENERATOR: helpString 'XY linef=? rate=? -- Configure_XXXXY' |
whismanoid | 59:47538bcf6cda | 166 | // CODE GENERATOR: CMD_ 'None' |
whismanoid | 59:47538bcf6cda | 167 | // CODE GENERATOR: CommandName 'Configure_XXXXY' |
whismanoid | 59:47538bcf6cda | 168 | // CODE GENERATOR: CommandParamIn 'uint8_t linef, uint8_t rate' |
whismanoid | 59:47538bcf6cda | 169 | // CODE GENERATOR: CommandReturnType 'uint8_t' |
whismanoid | 59:47538bcf6cda | 170 | // CODE GENERATOR: CommandPre '' |
whismanoid | 59:47538bcf6cda | 171 | // CODE GENERATOR: CommandDocParamIn '' |
whismanoid | 59:47538bcf6cda | 172 | // CODE GENERATOR: CommandDocParamOut '' |
whismanoid | 59:47538bcf6cda | 173 | // CODE GENERATOR: CommandPost '' |
whismanoid | 59:47538bcf6cda | 174 | // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure' |
whismanoid | 52:607010f0c54e | 175 | // CODE GENERATOR: testMenuGlobalArgsDict scan global property list g_MAX11043_device |
whismanoid | 52:607010f0c54e | 176 | |
whismanoid | 59:47538bcf6cda | 177 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.VRef |
whismanoid | 59:47538bcf6cda | 178 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.VRef argname = VRef |
whismanoid | 59:47538bcf6cda | 179 | // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['alias'] = 'None' |
whismanoid | 59:47538bcf6cda | 180 | // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['argtype'] = 'double' |
whismanoid | 59:47538bcf6cda | 181 | // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['usedByCommandName'] = 'None' |
whismanoid | 59:47538bcf6cda | 182 | // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['usedBytestMenuItemName'] = 'None' |
whismanoid | 52:607010f0c54e | 183 | |
whismanoid | 59:47538bcf6cda | 184 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.config |
whismanoid | 59:47538bcf6cda | 185 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.config shadow of argname = config |
whismanoid | 59:47538bcf6cda | 186 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.config argname = config |
whismanoid | 59:47538bcf6cda | 187 | // CODE GENERATOR: testMenuGlobalArgsDict['config']['alias'] = 'None' |
whismanoid | 59:47538bcf6cda | 188 | // CODE GENERATOR: testMenuGlobalArgsDict['config']['argtype'] = 'uint16_t' |
whismanoid | 59:47538bcf6cda | 189 | // CODE GENERATOR: testMenuGlobalArgsDict['config']['usedByCommandName'] = 'None' |
whismanoid | 59:47538bcf6cda | 190 | // CODE GENERATOR: testMenuGlobalArgsDict['config']['usedBytestMenuItemName'] = 'None' |
whismanoid | 52:607010f0c54e | 191 | |
whismanoid | 52:607010f0c54e | 192 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.status |
whismanoid | 52:607010f0c54e | 193 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.status shadow of argname = status |
whismanoid | 52:607010f0c54e | 194 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.status argname = status |
whismanoid | 52:607010f0c54e | 195 | // CODE GENERATOR: testMenuGlobalArgsDict['status']['alias'] = 'None' |
whismanoid | 52:607010f0c54e | 196 | // CODE GENERATOR: testMenuGlobalArgsDict['status']['argtype'] = 'uint32_t' |
whismanoid | 52:607010f0c54e | 197 | // CODE GENERATOR: testMenuGlobalArgsDict['status']['usedByCommandName'] = 'None' |
whismanoid | 52:607010f0c54e | 198 | // CODE GENERATOR: testMenuGlobalArgsDict['status']['usedBytestMenuItemName'] = 'None' |
whismanoid | 52:607010f0c54e | 199 | |
whismanoid | 59:47538bcf6cda | 200 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adca |
whismanoid | 59:47538bcf6cda | 201 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adca shadow of argname = ADCa |
whismanoid | 59:47538bcf6cda | 202 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adca argname = ADCa |
whismanoid | 59:47538bcf6cda | 203 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['alias'] = 'None' |
whismanoid | 59:47538bcf6cda | 204 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['argtype'] = 'uint32_t' |
whismanoid | 59:47538bcf6cda | 205 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['usedByCommandName'] = 'None' |
whismanoid | 59:47538bcf6cda | 206 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['usedBytestMenuItemName'] = 'None' |
whismanoid | 59:47538bcf6cda | 207 | |
whismanoid | 59:47538bcf6cda | 208 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcb |
whismanoid | 59:47538bcf6cda | 209 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcb shadow of argname = ADCb |
whismanoid | 59:47538bcf6cda | 210 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcb argname = ADCb |
whismanoid | 59:47538bcf6cda | 211 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['alias'] = 'None' |
whismanoid | 59:47538bcf6cda | 212 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['argtype'] = 'uint32_t' |
whismanoid | 59:47538bcf6cda | 213 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['usedByCommandName'] = 'None' |
whismanoid | 59:47538bcf6cda | 214 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['usedBytestMenuItemName'] = 'None' |
whismanoid | 52:607010f0c54e | 215 | |
whismanoid | 59:47538bcf6cda | 216 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcc |
whismanoid | 59:47538bcf6cda | 217 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcc shadow of argname = ADCc |
whismanoid | 59:47538bcf6cda | 218 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcc argname = ADCc |
whismanoid | 59:47538bcf6cda | 219 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['alias'] = 'None' |
whismanoid | 59:47538bcf6cda | 220 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['argtype'] = 'uint32_t' |
whismanoid | 59:47538bcf6cda | 221 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['usedByCommandName'] = 'None' |
whismanoid | 59:47538bcf6cda | 222 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['usedBytestMenuItemName'] = 'None' |
whismanoid | 59:47538bcf6cda | 223 | |
whismanoid | 59:47538bcf6cda | 224 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcd |
whismanoid | 59:47538bcf6cda | 225 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcd shadow of argname = ADCd |
whismanoid | 59:47538bcf6cda | 226 | // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcd argname = ADCd |
whismanoid | 59:47538bcf6cda | 227 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['alias'] = 'None' |
whismanoid | 59:47538bcf6cda | 228 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['argtype'] = 'uint32_t' |
whismanoid | 59:47538bcf6cda | 229 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['usedByCommandName'] = 'None' |
whismanoid | 59:47538bcf6cda | 230 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['usedBytestMenuItemName'] = 'None' |
whismanoid | 59:47538bcf6cda | 231 | |
whismanoid | 52:607010f0c54e | 232 | |
whismanoid | 52:607010f0c54e | 233 | // CODE GENERATOR: scan testMenuCommand list for items that can be shortened to single character |
whismanoid | 59:47538bcf6cda | 234 | // CODE GENERATOR: multiple commands begin with character 'X' |
whismanoid | 52:607010f0c54e | 235 | // CODE GENERATOR: shorten testMenuCommand to single character if unambiguous |
whismanoid | 52:607010f0c54e | 236 | // CODE GENERATOR: testMenuCommand '!' already single character |
whismanoid | 64:a667cfd83492 | 237 | // CODE GENERATOR: testMenuCommand '$' already single character |
whismanoid | 64:a667cfd83492 | 238 | // CODE GENERATOR: shorten testMenuCommand 'JA' to single character 'J' |
whismanoid | 64:a667cfd83492 | 239 | // CODE GENERATOR: re.sub pattern:'JA' with repl:'J' in helpString 'JA gain=? -- Write_AGain' |
whismanoid | 64:a667cfd83492 | 240 | // CODE GENERATOR: updated 'J' help string to 'J gain=? -- Write_AGain' |
whismanoid | 59:47538bcf6cda | 241 | // CODE GENERATOR: cannot shorten testMenuCommand 'XX' to single character due to duplicates |
whismanoid | 59:47538bcf6cda | 242 | // CODE GENERATOR: cannot shorten testMenuCommand 'XY' to single character due to duplicates |
whismanoid | 52:607010f0c54e | 243 | |
whismanoid | 52:607010f0c54e | 244 | // CODE GENERATOR: help menu |
whismanoid | 52:607010f0c54e | 245 | bool MAX11043_menu_help(CmdLine & cmdLine) |
whismanoid | 52:607010f0c54e | 246 | { |
whismanoid | 52:607010f0c54e | 247 | // CODE GENERATOR: command: ! |
whismanoid | 52:607010f0c54e | 248 | // CODE GENERATOR: help: ! -- Init |
whismanoid | 52:607010f0c54e | 249 | cmdLine.serial().printf("\r\n ! -- Init"); |
whismanoid | 64:a667cfd83492 | 250 | // CODE GENERATOR: command: $ |
whismanoid | 64:a667cfd83492 | 251 | // CODE GENERATOR: help: $ -- Read_ADCabcd |
whismanoid | 64:a667cfd83492 | 252 | cmdLine.serial().printf("\r\n $ -- Read_ADCabcd"); |
whismanoid | 64:a667cfd83492 | 253 | // CODE GENERATOR: command: J |
whismanoid | 64:a667cfd83492 | 254 | // CODE GENERATOR: help: J gain=? -- Write_AGain |
whismanoid | 64:a667cfd83492 | 255 | cmdLine.serial().printf("\r\n J gain=? -- Write_AGain"); |
whismanoid | 59:47538bcf6cda | 256 | // CODE GENERATOR: command: XX |
whismanoid | 59:47538bcf6cda | 257 | // CODE GENERATOR: help: XX linef=? rate=? -- Configure_XXXXX |
whismanoid | 59:47538bcf6cda | 258 | cmdLine.serial().printf("\r\n XX linef=? rate=? -- Configure_XXXXX"); |
whismanoid | 59:47538bcf6cda | 259 | // CODE GENERATOR: command: XY |
whismanoid | 59:47538bcf6cda | 260 | // CODE GENERATOR: help: XY linef=? rate=? -- Configure_XXXXY |
whismanoid | 59:47538bcf6cda | 261 | cmdLine.serial().printf("\r\n XY linef=? rate=? -- Configure_XXXXY"); |
whismanoid | 52:607010f0c54e | 262 | // |
whismanoid | 52:607010f0c54e | 263 | cmdLine.serial().printf("\r\n @ -- print MAX11043 configuration"); |
whismanoid | 52:607010f0c54e | 264 | |
whismanoid | 52:607010f0c54e | 265 | // CODE GENERATOR: help menu if has_register_write_command: *regname? -- read register; *regname=regvalue -- write register |
whismanoid | 52:607010f0c54e | 266 | cmdLine.serial().printf("\r\n *regname? -- read register\r\n *regname=regvalue -- write register"); |
whismanoid | 52:607010f0c54e | 267 | |
whismanoid | 52:607010f0c54e | 268 | // |
whismanoid | 52:607010f0c54e | 269 | // CODE GENERATOR: TODO1: generate GPIO commands for LDAC, CLR, etc. based on device driver function names (menu_help) |
whismanoid | 52:607010f0c54e | 270 | // case 'G'..'Z','g'..'z' are reserved for GPIO commands |
whismanoid | 52:607010f0c54e | 271 | // case 'A'..'F','a'..'f' may be available if not claimed by bitstream commands |
whismanoid | 52:607010f0c54e | 272 | // CODE GENERATOR: TODO1: prevent conflict ExternFunctionGPIOPinCommand with reserved case 'A'..'F','a'..'f' |
whismanoid | 52:607010f0c54e | 273 | // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['PinName'] = 'CONVRUN' |
whismanoid | 52:607010f0c54e | 274 | // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['Direction'] = 'output' |
whismanoid | 52:607010f0c54e | 275 | // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 276 | // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['FunctionName'] = 'CONVRUNoutputValue' |
whismanoid | 52:607010f0c54e | 277 | |
whismanoid | 52:607010f0c54e | 278 | // CODE GENERATOR: warning: conflict testMenuGPIOItemsDict['CONVRUN']['PinName'] = 'CONVRUN' |
whismanoid | 52:607010f0c54e | 279 | #warning "No command case for 'CONVRUN' 'PinName' 'CONVRUN' due to conflict with reserved commands A-F, try changing pin name" |
whismanoid | 52:607010f0c54e | 280 | #warning "Randomly assigned command 'G' for 'CONVRUN' due to name conflict" |
whismanoid | 52:607010f0c54e | 281 | // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['PinName'] = 'DACSTEP' |
whismanoid | 52:607010f0c54e | 282 | // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['Direction'] = 'output' |
whismanoid | 52:607010f0c54e | 283 | // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 284 | // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['FunctionName'] = 'DACSTEPoutputValue' |
whismanoid | 52:607010f0c54e | 285 | |
whismanoid | 52:607010f0c54e | 286 | // CODE GENERATOR: warning: conflict testMenuGPIOItemsDict['DACSTEP']['PinName'] = 'DACSTEP' |
whismanoid | 52:607010f0c54e | 287 | #warning "No command case for 'DACSTEP' 'PinName' 'DACSTEP' due to conflict with reserved commands A-F, try changing pin name" |
whismanoid | 52:607010f0c54e | 288 | #warning "Randomly assigned command 'H' for 'DACSTEP' due to name conflict" |
whismanoid | 52:607010f0c54e | 289 | // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['PinName'] = 'EOC' |
whismanoid | 52:607010f0c54e | 290 | // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['Direction'] = 'input' |
whismanoid | 52:607010f0c54e | 291 | // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 292 | // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['FunctionName'] = 'EOCinputValue' |
whismanoid | 52:607010f0c54e | 293 | |
whismanoid | 52:607010f0c54e | 294 | // CODE GENERATOR: warning: conflict testMenuGPIOItemsDict['EOC']['PinName'] = 'EOC' |
whismanoid | 52:607010f0c54e | 295 | #warning "No command case for 'EOC' 'PinName' 'EOC' due to conflict with reserved commands A-F, try changing pin name" |
whismanoid | 52:607010f0c54e | 296 | #warning "Randomly assigned command 'I' for 'EOC' due to name conflict" |
whismanoid | 52:607010f0c54e | 297 | // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['PinName'] = 'SHDN' |
whismanoid | 52:607010f0c54e | 298 | // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['Direction'] = 'output' |
whismanoid | 52:607010f0c54e | 299 | // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 300 | // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['FunctionName'] = 'SHDNoutputValue' |
whismanoid | 52:607010f0c54e | 301 | |
whismanoid | 52:607010f0c54e | 302 | // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['PinName'] = 'UP_slash_DWNb' |
whismanoid | 52:607010f0c54e | 303 | // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['Direction'] = 'output' |
whismanoid | 52:607010f0c54e | 304 | // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 305 | // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['FunctionName'] = 'UP_slash_DWNboutputValue' |
whismanoid | 52:607010f0c54e | 306 | |
whismanoid | 52:607010f0c54e | 307 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'A' 'None' |
whismanoid | 52:607010f0c54e | 308 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'B' 'None' |
whismanoid | 52:607010f0c54e | 309 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'C' 'None' |
whismanoid | 52:607010f0c54e | 310 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'D' 'None' |
whismanoid | 52:607010f0c54e | 311 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'E' 'None' |
whismanoid | 52:607010f0c54e | 312 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'F' 'None' |
whismanoid | 52:607010f0c54e | 313 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'G' 'CONVRUN' |
whismanoid | 52:607010f0c54e | 314 | // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['PinName'] = 'CONVRUN' |
whismanoid | 52:607010f0c54e | 315 | // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['Direction'] = 'output' |
whismanoid | 52:607010f0c54e | 316 | // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 317 | // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['FunctionName'] = 'CONVRUNoutputValue' |
whismanoid | 52:607010f0c54e | 318 | cmdLine.serial().printf("\r\n G -- CONVRUN output GH high GL low"); // TODO: ExternFunctionGPIOPinCommand testMenuGPIOItemsDict |
whismanoid | 52:607010f0c54e | 319 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'H' 'DACSTEP' |
whismanoid | 52:607010f0c54e | 320 | // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['PinName'] = 'DACSTEP' |
whismanoid | 52:607010f0c54e | 321 | // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['Direction'] = 'output' |
whismanoid | 52:607010f0c54e | 322 | // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 323 | // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['FunctionName'] = 'DACSTEPoutputValue' |
whismanoid | 52:607010f0c54e | 324 | cmdLine.serial().printf("\r\n H -- DACSTEP output HH high HL low"); // TODO: ExternFunctionGPIOPinCommand testMenuGPIOItemsDict |
whismanoid | 52:607010f0c54e | 325 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'I' 'EOC' |
whismanoid | 52:607010f0c54e | 326 | // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['PinName'] = 'EOC' |
whismanoid | 52:607010f0c54e | 327 | // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['Direction'] = 'input' |
whismanoid | 52:607010f0c54e | 328 | // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 329 | // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['FunctionName'] = 'EOCinputValue' |
whismanoid | 52:607010f0c54e | 330 | cmdLine.serial().printf("\r\n I -- EOC input value"); // TODO: ExternFunctionGPIOPinCommand testMenuGPIOItemsDict |
whismanoid | 52:607010f0c54e | 331 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'S' 'SHDN' |
whismanoid | 52:607010f0c54e | 332 | // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['PinName'] = 'SHDN' |
whismanoid | 52:607010f0c54e | 333 | // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['Direction'] = 'output' |
whismanoid | 52:607010f0c54e | 334 | // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 335 | // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['FunctionName'] = 'SHDNoutputValue' |
whismanoid | 52:607010f0c54e | 336 | cmdLine.serial().printf("\r\n S -- SHDN output SH high SL low"); // TODO: ExternFunctionGPIOPinCommand testMenuGPIOItemsDict |
whismanoid | 52:607010f0c54e | 337 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'U' 'UP_slash_DWNb' |
whismanoid | 52:607010f0c54e | 338 | // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['PinName'] = 'UP_slash_DWNb' |
whismanoid | 52:607010f0c54e | 339 | // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['Direction'] = 'output' |
whismanoid | 52:607010f0c54e | 340 | // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 341 | // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['FunctionName'] = 'UP_slash_DWNboutputValue' |
whismanoid | 52:607010f0c54e | 342 | cmdLine.serial().printf("\r\n U -- UP_slash_DWNb output UH high UL low"); // TODO: ExternFunctionGPIOPinCommand testMenuGPIOItemsDict |
whismanoid | 52:607010f0c54e | 343 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'a' 'None' |
whismanoid | 52:607010f0c54e | 344 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'b' 'None' |
whismanoid | 52:607010f0c54e | 345 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'c' 'None' |
whismanoid | 52:607010f0c54e | 346 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'd' 'None' |
whismanoid | 52:607010f0c54e | 347 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'e' 'None' |
whismanoid | 52:607010f0c54e | 348 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'f' 'None' |
whismanoid | 52:607010f0c54e | 349 | |
whismanoid | 52:607010f0c54e | 350 | // |
whismanoid | 52:607010f0c54e | 351 | } |
whismanoid | 52:607010f0c54e | 352 | |
whismanoid | 52:607010f0c54e | 353 | bool MAX11043_menu_onEOLcommandParser(CmdLine & cmdLine) |
whismanoid | 52:607010f0c54e | 354 | { |
whismanoid | 52:607010f0c54e | 355 | |
whismanoid | 52:607010f0c54e | 356 | // CODE GENERATOR: testMenuGlobalArgsDict Consolidate common/global argument parsing |
whismanoid | 52:607010f0c54e | 357 | |
whismanoid | 59:47538bcf6cda | 358 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['alias'] = 'None' |
whismanoid | 59:47538bcf6cda | 359 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['argtype'] = 'uint32_t' |
whismanoid | 59:47538bcf6cda | 360 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['usedByCommandName'] = 'None' |
whismanoid | 59:47538bcf6cda | 361 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['usedBytestMenuItemName'] = 'None' |
whismanoid | 59:47538bcf6cda | 362 | // parse argument uint32_t ADCa |
whismanoid | 59:47538bcf6cda | 363 | uint32_t ADCa = 0; // ~~~ g_MAX11043_device.__WARNING_no_match_for_argname_ADCa_in_MAX11043_device_t__; // default to global property value |
whismanoid | 59:47538bcf6cda | 364 | if (cmdLine.parse_uint32_dec("ADCa", ADCa)) |
whismanoid | 52:607010f0c54e | 365 | { |
whismanoid | 59:47538bcf6cda | 366 | // g_MAX11043_device.__WARNING_no_match_for_argname_ADCa_in_MAX11043_device_t__ = ADCa; // update global property value |
whismanoid | 59:47538bcf6cda | 367 | } |
whismanoid | 59:47538bcf6cda | 368 | |
whismanoid | 59:47538bcf6cda | 369 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['alias'] = 'None' |
whismanoid | 59:47538bcf6cda | 370 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['argtype'] = 'uint32_t' |
whismanoid | 59:47538bcf6cda | 371 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['usedByCommandName'] = 'None' |
whismanoid | 59:47538bcf6cda | 372 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['usedBytestMenuItemName'] = 'None' |
whismanoid | 59:47538bcf6cda | 373 | // parse argument uint32_t ADCb |
whismanoid | 59:47538bcf6cda | 374 | uint32_t ADCb = 0; // ~~~ g_MAX11043_device.__WARNING_no_match_for_argname_ADCb_in_MAX11043_device_t__; // default to global property value |
whismanoid | 59:47538bcf6cda | 375 | if (cmdLine.parse_uint32_dec("ADCb", ADCb)) |
whismanoid | 59:47538bcf6cda | 376 | { |
whismanoid | 59:47538bcf6cda | 377 | // g_MAX11043_device.__WARNING_no_match_for_argname_ADCb_in_MAX11043_device_t__ = ADCb; // update global property value |
whismanoid | 52:607010f0c54e | 378 | } |
whismanoid | 52:607010f0c54e | 379 | |
whismanoid | 59:47538bcf6cda | 380 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['alias'] = 'None' |
whismanoid | 59:47538bcf6cda | 381 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['argtype'] = 'uint32_t' |
whismanoid | 59:47538bcf6cda | 382 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['usedByCommandName'] = 'None' |
whismanoid | 59:47538bcf6cda | 383 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['usedBytestMenuItemName'] = 'None' |
whismanoid | 59:47538bcf6cda | 384 | // parse argument uint32_t ADCc |
whismanoid | 59:47538bcf6cda | 385 | uint32_t ADCc = 0; // ~~~ g_MAX11043_device.__WARNING_no_match_for_argname_ADCc_in_MAX11043_device_t__; // default to global property value |
whismanoid | 59:47538bcf6cda | 386 | if (cmdLine.parse_uint32_dec("ADCc", ADCc)) |
whismanoid | 52:607010f0c54e | 387 | { |
whismanoid | 59:47538bcf6cda | 388 | // g_MAX11043_device.__WARNING_no_match_for_argname_ADCc_in_MAX11043_device_t__ = ADCc; // update global property value |
whismanoid | 52:607010f0c54e | 389 | } |
whismanoid | 52:607010f0c54e | 390 | |
whismanoid | 59:47538bcf6cda | 391 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['alias'] = 'None' |
whismanoid | 59:47538bcf6cda | 392 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['argtype'] = 'uint32_t' |
whismanoid | 59:47538bcf6cda | 393 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['usedByCommandName'] = 'None' |
whismanoid | 59:47538bcf6cda | 394 | // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['usedBytestMenuItemName'] = 'None' |
whismanoid | 59:47538bcf6cda | 395 | // parse argument uint32_t ADCd |
whismanoid | 59:47538bcf6cda | 396 | uint32_t ADCd = 0; // ~~~ g_MAX11043_device.__WARNING_no_match_for_argname_ADCd_in_MAX11043_device_t__; // default to global property value |
whismanoid | 59:47538bcf6cda | 397 | if (cmdLine.parse_uint32_dec("ADCd", ADCd)) |
whismanoid | 52:607010f0c54e | 398 | { |
whismanoid | 59:47538bcf6cda | 399 | // g_MAX11043_device.__WARNING_no_match_for_argname_ADCd_in_MAX11043_device_t__ = ADCd; // update global property value |
whismanoid | 52:607010f0c54e | 400 | } |
whismanoid | 52:607010f0c54e | 401 | |
whismanoid | 59:47538bcf6cda | 402 | // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['alias'] = 'None' |
whismanoid | 59:47538bcf6cda | 403 | // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['argtype'] = 'double' |
whismanoid | 59:47538bcf6cda | 404 | // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['usedByCommandName'] = 'None' |
whismanoid | 59:47538bcf6cda | 405 | // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['usedBytestMenuItemName'] = 'None' |
whismanoid | 59:47538bcf6cda | 406 | // parse argument double VRef |
whismanoid | 59:47538bcf6cda | 407 | double VRef = g_MAX11043_device.VRef; // default to global property value |
whismanoid | 59:47538bcf6cda | 408 | if (cmdLine.parse_double("VRef", VRef)) |
whismanoid | 52:607010f0c54e | 409 | { |
whismanoid | 59:47538bcf6cda | 410 | g_MAX11043_device.VRef = VRef; // update global property value |
whismanoid | 59:47538bcf6cda | 411 | } |
whismanoid | 59:47538bcf6cda | 412 | |
whismanoid | 59:47538bcf6cda | 413 | // CODE GENERATOR: testMenuGlobalArgsDict['config']['alias'] = 'None' |
whismanoid | 59:47538bcf6cda | 414 | // CODE GENERATOR: testMenuGlobalArgsDict['config']['argtype'] = 'uint16_t' |
whismanoid | 59:47538bcf6cda | 415 | // CODE GENERATOR: testMenuGlobalArgsDict['config']['usedByCommandName'] = 'None' |
whismanoid | 59:47538bcf6cda | 416 | // CODE GENERATOR: testMenuGlobalArgsDict['config']['usedBytestMenuItemName'] = 'None' |
whismanoid | 59:47538bcf6cda | 417 | // parse argument uint16_t config |
whismanoid | 59:47538bcf6cda | 418 | uint16_t config = g_MAX11043_device.config; // default to global property value |
whismanoid | 59:47538bcf6cda | 419 | if (cmdLine.parse_uint16_dec("config", config)) |
whismanoid | 59:47538bcf6cda | 420 | { |
whismanoid | 59:47538bcf6cda | 421 | g_MAX11043_device.config = config; // update global property value |
whismanoid | 52:607010f0c54e | 422 | } |
whismanoid | 52:607010f0c54e | 423 | |
whismanoid | 52:607010f0c54e | 424 | // CODE GENERATOR: testMenuGlobalArgsDict['status']['alias'] = 'None' |
whismanoid | 52:607010f0c54e | 425 | // CODE GENERATOR: testMenuGlobalArgsDict['status']['argtype'] = 'uint32_t' |
whismanoid | 52:607010f0c54e | 426 | // CODE GENERATOR: testMenuGlobalArgsDict['status']['usedByCommandName'] = 'None' |
whismanoid | 52:607010f0c54e | 427 | // CODE GENERATOR: testMenuGlobalArgsDict['status']['usedBytestMenuItemName'] = 'None' |
whismanoid | 52:607010f0c54e | 428 | // parse argument uint32_t status |
whismanoid | 52:607010f0c54e | 429 | uint32_t status = g_MAX11043_device.status; // default to global property value |
whismanoid | 52:607010f0c54e | 430 | if (cmdLine.parse_uint32_dec("status", status)) |
whismanoid | 52:607010f0c54e | 431 | { |
whismanoid | 52:607010f0c54e | 432 | g_MAX11043_device.status = status; // update global property value |
whismanoid | 52:607010f0c54e | 433 | } |
whismanoid | 52:607010f0c54e | 434 | |
whismanoid | 52:607010f0c54e | 435 | switch (cmdLine[0]) |
whismanoid | 52:607010f0c54e | 436 | { |
whismanoid | 52:607010f0c54e | 437 | // CODE GENERATOR: generate * command read/write reg *reg? *reg=value |
whismanoid | 52:607010f0c54e | 438 | case '*': |
whismanoid | 52:607010f0c54e | 439 | { |
whismanoid | 52:607010f0c54e | 440 | // if buffer starts with a regName: |
whismanoid | 52:607010f0c54e | 441 | // for each reg value (0..n) if(cmdLine.has_keyword(device.regName(r))): |
whismanoid | 52:607010f0c54e | 442 | cmdLine.serial().printf(" scan RegName...\r\n"); |
whismanoid | 52:607010f0c54e | 443 | for (uint8_t regAddress = 0; regAddress < 0x80; regAddress++) |
whismanoid | 52:607010f0c54e | 444 | { |
whismanoid | 52:607010f0c54e | 445 | uint32_t regData = 0; |
whismanoid | 52:607010f0c54e | 446 | bool is_regname_query = false; |
whismanoid | 52:607010f0c54e | 447 | bool is_regname_assignment = false; |
whismanoid | 52:607010f0c54e | 448 | if (cmdLine.parse_uint32_dec(g_MAX11043_device.RegName((MAX11043::MAX11043_CMD_enum_t)regAddress), regData)) |
whismanoid | 52:607010f0c54e | 449 | { |
whismanoid | 52:607010f0c54e | 450 | cmdLine.serial().printf(" regAddress=0x%2.2X\r\n", (regAddress & 0xFF)); |
whismanoid | 52:607010f0c54e | 451 | cmdLine.serial().printf(" RegName=%s\r\n", g_MAX11043_device.RegName((MAX11043::MAX11043_CMD_enum_t)regAddress)); |
whismanoid | 52:607010f0c54e | 452 | // accept regName "?" as "RegRead" by name |
whismanoid | 52:607010f0c54e | 453 | is_regname_query = (cmdLine.chSeparator == '?'); |
whismanoid | 52:607010f0c54e | 454 | is_regname_assignment = (cmdLine.chSeparator == '='); |
whismanoid | 52:607010f0c54e | 455 | if (is_regname_query) |
whismanoid | 52:607010f0c54e | 456 | { |
whismanoid | 52:607010f0c54e | 457 | cmdLine.serial().printf(" RegRead"); |
whismanoid | 52:607010f0c54e | 458 | g_MAX11043_device.RegRead((MAX11043::MAX11043_CMD_enum_t)regAddress, ®Data); |
whismanoid | 52:607010f0c54e | 459 | cmdLine.serial().printf("regData=0x%6.6x\r\n", (regData & 0x00FFFFFF)); |
whismanoid | 52:607010f0c54e | 460 | return true; // command handled by MAX11043 |
whismanoid | 52:607010f0c54e | 461 | } |
whismanoid | 52:607010f0c54e | 462 | // accept regName "=0x123456" as "RegWrite" by name |
whismanoid | 52:607010f0c54e | 463 | if (is_regname_assignment) |
whismanoid | 52:607010f0c54e | 464 | { |
whismanoid | 52:607010f0c54e | 465 | cmdLine.serial().printf(" RegWrite"); |
whismanoid | 52:607010f0c54e | 466 | cmdLine.serial().printf("regData=0x%6.6x\r\n", (regData & 0x00FFFFFF)); |
whismanoid | 52:607010f0c54e | 467 | g_MAX11043_device.RegWrite((MAX11043::MAX11043_CMD_enum_t)regAddress, regData); |
whismanoid | 52:607010f0c54e | 468 | return true; // command handled by MAX11043 |
whismanoid | 52:607010f0c54e | 469 | } |
whismanoid | 52:607010f0c54e | 470 | } |
whismanoid | 52:607010f0c54e | 471 | } // end for regAddr |
whismanoid | 52:607010f0c54e | 472 | // not a valid register name |
whismanoid | 57:1c9da8e90737 | 473 | Callback<void(size_t, uint8_t*, uint8_t*)> saved_onSPIprint_handler = g_MAX11043_device.onSPIprint; |
whismanoid | 57:1c9da8e90737 | 474 | g_MAX11043_device.onSPIprint = NULL; // temporarily suppress SPI diagnostic messages |
whismanoid | 52:607010f0c54e | 475 | // read "all" registers by name |
whismanoid | 57:1c9da8e90737 | 476 | // TODO: KLUDGE: this constant array should live in the device driver, not the menu |
whismanoid | 57:1c9da8e90737 | 477 | const MAX11043::MAX11043_CMD_enum_t readAllStatusList[] = { |
whismanoid | 59:47538bcf6cda | 478 | MAX11043::CMD_0000_0010_d16o8_Rd00_ADCa, |
whismanoid | 59:47538bcf6cda | 479 | MAX11043::CMD_0000_0110_d16o8_Rd01_ADCb, |
whismanoid | 59:47538bcf6cda | 480 | MAX11043::CMD_0000_1010_d16o8_Rd02_ADCc, |
whismanoid | 59:47538bcf6cda | 481 | MAX11043::CMD_0000_1110_d16o8_Rd03_ADCd, |
whismanoid | 57:1c9da8e90737 | 482 | MAX11043::CMD_0001_1110_d8_Rd07_Status, |
whismanoid | 57:1c9da8e90737 | 483 | MAX11043::CMD_0010_0010_d16_Rd08_Configuration, |
whismanoid | 57:1c9da8e90737 | 484 | MAX11043::CMD_0010_0110_d16_Rd09_DAC, |
whismanoid | 57:1c9da8e90737 | 485 | MAX11043::CMD_0010_1010_d16_Rd0A_DACStep, |
whismanoid | 57:1c9da8e90737 | 486 | MAX11043::CMD_0010_1110_d16_Rd0B_DACHDACL, |
whismanoid | 57:1c9da8e90737 | 487 | MAX11043::CMD_0011_0010_d16_Rd0C_ConfigA, |
whismanoid | 57:1c9da8e90737 | 488 | MAX11043::CMD_0011_0110_d16_Rd0D_ConfigB, |
whismanoid | 57:1c9da8e90737 | 489 | MAX11043::CMD_0011_1010_d16_Rd0E_ConfigC, |
whismanoid | 57:1c9da8e90737 | 490 | MAX11043::CMD_0011_1110_d16_Rd0F_ConfigD, |
whismanoid | 57:1c9da8e90737 | 491 | MAX11043::CMD_0100_0010_d16_Rd10_Reference, |
whismanoid | 57:1c9da8e90737 | 492 | MAX11043::CMD_0100_0110_d16_Rd11_AGain, |
whismanoid | 57:1c9da8e90737 | 493 | MAX11043::CMD_0100_1010_d16_Rd12_BGain, |
whismanoid | 57:1c9da8e90737 | 494 | MAX11043::CMD_0100_1110_d16_Rd13_CGain, |
whismanoid | 57:1c9da8e90737 | 495 | MAX11043::CMD_0101_0010_d16_Rd14_DGain, |
whismanoid | 57:1c9da8e90737 | 496 | }; |
whismanoid | 57:1c9da8e90737 | 497 | for (uint8_t readAllStatusIndex = 0; readAllStatusIndex < (sizeof(readAllStatusList)/sizeof(MAX11043::MAX11043_CMD_enum_t)); readAllStatusIndex++) |
whismanoid | 52:607010f0c54e | 498 | { |
whismanoid | 57:1c9da8e90737 | 499 | MAX11043::MAX11043_CMD_enum_t regAddress = readAllStatusList[readAllStatusIndex]; |
whismanoid | 52:607010f0c54e | 500 | uint32_t regData = 0; |
whismanoid | 57:1c9da8e90737 | 501 | if (g_MAX11043_device.RegSize(regAddress) == 0) continue; // skip undefined regs |
whismanoid | 57:1c9da8e90737 | 502 | if (g_MAX11043_device.RegRead(regAddress, ®Data) == 0) continue; // skip unreadable regs |
whismanoid | 57:1c9da8e90737 | 503 | cmdLine.serial().printf("%s=0x%6.6x\r\n", g_MAX11043_device.RegName(regAddress), regData); |
whismanoid | 52:607010f0c54e | 504 | } // end for regAddr |
whismanoid | 52:607010f0c54e | 505 | g_MAX11043_device.onSPIprint = saved_onSPIprint_handler; |
whismanoid | 52:607010f0c54e | 506 | return true; // command handled by MAX11043 |
whismanoid | 52:607010f0c54e | 507 | } |
whismanoid | 52:607010f0c54e | 508 | break; |
whismanoid | 52:607010f0c54e | 509 | |
whismanoid | 52:607010f0c54e | 510 | // CODE GENERATOR: generate @ command print global property values of g_MAX11043_device |
whismanoid | 52:607010f0c54e | 511 | case '@': |
whismanoid | 52:607010f0c54e | 512 | { |
whismanoid | 59:47538bcf6cda | 513 | // CODE GENERATOR: @ command print double g_MAX11043_device.VRef |
whismanoid | 59:47538bcf6cda | 514 | cmdLine.serial().printf("VRef = "); |
whismanoid | 59:47538bcf6cda | 515 | cmdLine.serial().printf("%f\r\n", g_MAX11043_device.VRef); |
whismanoid | 59:47538bcf6cda | 516 | // CODE GENERATOR: @ command print uint16_t g_MAX11043_device.config |
whismanoid | 59:47538bcf6cda | 517 | cmdLine.serial().printf("config = "); |
whismanoid | 59:47538bcf6cda | 518 | cmdLine.serial().printf("%d = 0x%4.4x\r\n", g_MAX11043_device.config, g_MAX11043_device.config); |
whismanoid | 52:607010f0c54e | 519 | // CODE GENERATOR: @ command print uint32_t g_MAX11043_device.status |
whismanoid | 52:607010f0c54e | 520 | cmdLine.serial().printf("status = "); |
whismanoid | 52:607010f0c54e | 521 | cmdLine.serial().printf("%d = 0x%8.8x\r\n", g_MAX11043_device.status, g_MAX11043_device.status); |
whismanoid | 59:47538bcf6cda | 522 | // CODE GENERATOR: @ command print uint32_t g_MAX11043_device.adca |
whismanoid | 59:47538bcf6cda | 523 | cmdLine.serial().printf("adca = "); |
whismanoid | 59:47538bcf6cda | 524 | cmdLine.serial().printf("%d = 0x%8.8x\r\n", g_MAX11043_device.adca, g_MAX11043_device.adca); |
whismanoid | 59:47538bcf6cda | 525 | // CODE GENERATOR: @ command print uint32_t g_MAX11043_device.adcb |
whismanoid | 59:47538bcf6cda | 526 | cmdLine.serial().printf("adcb = "); |
whismanoid | 59:47538bcf6cda | 527 | cmdLine.serial().printf("%d = 0x%8.8x\r\n", g_MAX11043_device.adcb, g_MAX11043_device.adcb); |
whismanoid | 59:47538bcf6cda | 528 | // CODE GENERATOR: @ command print uint32_t g_MAX11043_device.adcc |
whismanoid | 59:47538bcf6cda | 529 | cmdLine.serial().printf("adcc = "); |
whismanoid | 59:47538bcf6cda | 530 | cmdLine.serial().printf("%d = 0x%8.8x\r\n", g_MAX11043_device.adcc, g_MAX11043_device.adcc); |
whismanoid | 59:47538bcf6cda | 531 | // CODE GENERATOR: @ command print uint32_t g_MAX11043_device.adcd |
whismanoid | 59:47538bcf6cda | 532 | cmdLine.serial().printf("adcd = "); |
whismanoid | 59:47538bcf6cda | 533 | cmdLine.serial().printf("%d = 0x%8.8x\r\n", g_MAX11043_device.adcd, g_MAX11043_device.adcd); |
whismanoid | 52:607010f0c54e | 534 | return true; // command handled by MAX11043 |
whismanoid | 52:607010f0c54e | 535 | break; |
whismanoid | 52:607010f0c54e | 536 | } |
whismanoid | 52:607010f0c54e | 537 | // CODE GENERATOR: TODO1: generate GPIO commands for LDAC, CLR, etc. based on device driver function names |
whismanoid | 52:607010f0c54e | 538 | // case 'G'..'Z','g'..'z' are reserved for GPIO commands |
whismanoid | 52:607010f0c54e | 539 | // case 'A'..'F','a'..'f' may be available if not claimed by bitstream commands |
whismanoid | 52:607010f0c54e | 540 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'A' 'None' |
whismanoid | 52:607010f0c54e | 541 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'B' 'None' |
whismanoid | 52:607010f0c54e | 542 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'C' 'None' |
whismanoid | 52:607010f0c54e | 543 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'D' 'None' |
whismanoid | 52:607010f0c54e | 544 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'E' 'None' |
whismanoid | 52:607010f0c54e | 545 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'F' 'None' |
whismanoid | 52:607010f0c54e | 546 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'G' 'CONVRUN' |
whismanoid | 52:607010f0c54e | 547 | // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['PinName'] = 'CONVRUN' |
whismanoid | 52:607010f0c54e | 548 | // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['Direction'] = 'output' |
whismanoid | 52:607010f0c54e | 549 | // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 550 | // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['FunctionName'] = 'CONVRUNoutputValue' |
whismanoid | 52:607010f0c54e | 551 | case 'G': |
whismanoid | 52:607010f0c54e | 552 | { |
whismanoid | 52:607010f0c54e | 553 | switch (cmdLine[1]) |
whismanoid | 52:607010f0c54e | 554 | { |
whismanoid | 52:607010f0c54e | 555 | case 'H': |
whismanoid | 52:607010f0c54e | 556 | { |
whismanoid | 52:607010f0c54e | 557 | g_MAX11043_device.CONVRUNoutputValue(1); |
whismanoid | 52:607010f0c54e | 558 | break; |
whismanoid | 52:607010f0c54e | 559 | } |
whismanoid | 52:607010f0c54e | 560 | case 'L': |
whismanoid | 52:607010f0c54e | 561 | { |
whismanoid | 52:607010f0c54e | 562 | g_MAX11043_device.CONVRUNoutputValue(0); |
whismanoid | 52:607010f0c54e | 563 | break; |
whismanoid | 52:607010f0c54e | 564 | } |
whismanoid | 52:607010f0c54e | 565 | } |
whismanoid | 52:607010f0c54e | 566 | return true; // command handled by MAX11043 |
whismanoid | 52:607010f0c54e | 567 | break; |
whismanoid | 52:607010f0c54e | 568 | } |
whismanoid | 52:607010f0c54e | 569 | |
whismanoid | 52:607010f0c54e | 570 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'H' 'DACSTEP' |
whismanoid | 52:607010f0c54e | 571 | // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['PinName'] = 'DACSTEP' |
whismanoid | 52:607010f0c54e | 572 | // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['Direction'] = 'output' |
whismanoid | 52:607010f0c54e | 573 | // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 574 | // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['FunctionName'] = 'DACSTEPoutputValue' |
whismanoid | 52:607010f0c54e | 575 | case 'H': |
whismanoid | 52:607010f0c54e | 576 | { |
whismanoid | 52:607010f0c54e | 577 | switch (cmdLine[1]) |
whismanoid | 52:607010f0c54e | 578 | { |
whismanoid | 52:607010f0c54e | 579 | case 'H': |
whismanoid | 52:607010f0c54e | 580 | { |
whismanoid | 52:607010f0c54e | 581 | g_MAX11043_device.DACSTEPoutputValue(1); |
whismanoid | 52:607010f0c54e | 582 | break; |
whismanoid | 52:607010f0c54e | 583 | } |
whismanoid | 52:607010f0c54e | 584 | case 'L': |
whismanoid | 52:607010f0c54e | 585 | { |
whismanoid | 52:607010f0c54e | 586 | g_MAX11043_device.DACSTEPoutputValue(0); |
whismanoid | 52:607010f0c54e | 587 | break; |
whismanoid | 52:607010f0c54e | 588 | } |
whismanoid | 52:607010f0c54e | 589 | } |
whismanoid | 52:607010f0c54e | 590 | return true; // command handled by MAX11043 |
whismanoid | 52:607010f0c54e | 591 | break; |
whismanoid | 52:607010f0c54e | 592 | } |
whismanoid | 52:607010f0c54e | 593 | |
whismanoid | 52:607010f0c54e | 594 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'I' 'EOC' |
whismanoid | 52:607010f0c54e | 595 | // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['PinName'] = 'EOC' |
whismanoid | 52:607010f0c54e | 596 | // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['Direction'] = 'input' |
whismanoid | 52:607010f0c54e | 597 | // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 598 | // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['FunctionName'] = 'EOCinputValue' |
whismanoid | 52:607010f0c54e | 599 | case 'I': |
whismanoid | 52:607010f0c54e | 600 | { |
whismanoid | 52:607010f0c54e | 601 | // TODO capture and print input Value |
whismanoid | 52:607010f0c54e | 602 | cmdLine.serial().printf("%d", g_MAX11043_device.EOCinputValue()); |
whismanoid | 52:607010f0c54e | 603 | return true; // command handled by MAX11043 |
whismanoid | 52:607010f0c54e | 604 | break; |
whismanoid | 52:607010f0c54e | 605 | } |
whismanoid | 52:607010f0c54e | 606 | |
whismanoid | 52:607010f0c54e | 607 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'S' 'SHDN' |
whismanoid | 52:607010f0c54e | 608 | // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['PinName'] = 'SHDN' |
whismanoid | 52:607010f0c54e | 609 | // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['Direction'] = 'output' |
whismanoid | 52:607010f0c54e | 610 | // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 611 | // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['FunctionName'] = 'SHDNoutputValue' |
whismanoid | 52:607010f0c54e | 612 | case 'S': |
whismanoid | 52:607010f0c54e | 613 | { |
whismanoid | 52:607010f0c54e | 614 | switch (cmdLine[1]) |
whismanoid | 52:607010f0c54e | 615 | { |
whismanoid | 52:607010f0c54e | 616 | case 'H': |
whismanoid | 52:607010f0c54e | 617 | { |
whismanoid | 52:607010f0c54e | 618 | g_MAX11043_device.SHDNoutputValue(1); |
whismanoid | 52:607010f0c54e | 619 | break; |
whismanoid | 52:607010f0c54e | 620 | } |
whismanoid | 52:607010f0c54e | 621 | case 'L': |
whismanoid | 52:607010f0c54e | 622 | { |
whismanoid | 52:607010f0c54e | 623 | g_MAX11043_device.SHDNoutputValue(0); |
whismanoid | 52:607010f0c54e | 624 | break; |
whismanoid | 52:607010f0c54e | 625 | } |
whismanoid | 52:607010f0c54e | 626 | } |
whismanoid | 52:607010f0c54e | 627 | return true; // command handled by MAX11043 |
whismanoid | 52:607010f0c54e | 628 | break; |
whismanoid | 52:607010f0c54e | 629 | } |
whismanoid | 52:607010f0c54e | 630 | |
whismanoid | 52:607010f0c54e | 631 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'U' 'UP_slash_DWNb' |
whismanoid | 52:607010f0c54e | 632 | // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['PinName'] = 'UP_slash_DWNb' |
whismanoid | 52:607010f0c54e | 633 | // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['Direction'] = 'output' |
whismanoid | 52:607010f0c54e | 634 | // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['Operation'] = 'Value' |
whismanoid | 52:607010f0c54e | 635 | // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['FunctionName'] = 'UP_slash_DWNboutputValue' |
whismanoid | 52:607010f0c54e | 636 | case 'U': |
whismanoid | 52:607010f0c54e | 637 | { |
whismanoid | 52:607010f0c54e | 638 | switch (cmdLine[1]) |
whismanoid | 52:607010f0c54e | 639 | { |
whismanoid | 52:607010f0c54e | 640 | case 'H': |
whismanoid | 52:607010f0c54e | 641 | { |
whismanoid | 52:607010f0c54e | 642 | g_MAX11043_device.UP_slash_DWNboutputValue(1); |
whismanoid | 52:607010f0c54e | 643 | break; |
whismanoid | 52:607010f0c54e | 644 | } |
whismanoid | 52:607010f0c54e | 645 | case 'L': |
whismanoid | 52:607010f0c54e | 646 | { |
whismanoid | 52:607010f0c54e | 647 | g_MAX11043_device.UP_slash_DWNboutputValue(0); |
whismanoid | 52:607010f0c54e | 648 | break; |
whismanoid | 52:607010f0c54e | 649 | } |
whismanoid | 52:607010f0c54e | 650 | } |
whismanoid | 52:607010f0c54e | 651 | return true; // command handled by MAX11043 |
whismanoid | 52:607010f0c54e | 652 | break; |
whismanoid | 52:607010f0c54e | 653 | } |
whismanoid | 52:607010f0c54e | 654 | |
whismanoid | 52:607010f0c54e | 655 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'a' 'None' |
whismanoid | 52:607010f0c54e | 656 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'b' 'None' |
whismanoid | 52:607010f0c54e | 657 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'c' 'None' |
whismanoid | 52:607010f0c54e | 658 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'd' 'None' |
whismanoid | 52:607010f0c54e | 659 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'e' 'None' |
whismanoid | 52:607010f0c54e | 660 | // CODE GENERATOR: ExternFunctionGPIOPinCommand 'f' 'None' |
whismanoid | 52:607010f0c54e | 661 | |
whismanoid | 52:607010f0c54e | 662 | // CODE GENERATOR: test menu |
whismanoid | 52:607010f0c54e | 663 | // case '0'..'9','A'..'F','a'..'f' letters are reserved for bitstream commands |
whismanoid | 52:607010f0c54e | 664 | // has_register_write_command: case '0'..'9','A'..'F','a'..'f' letters are reserved for bitstream commands |
whismanoid | 52:607010f0c54e | 665 | // CODE GENERATOR: top of loop: testMenuCommand="!", testMenuFirstCharHandler="None" |
whismanoid | 52:607010f0c54e | 666 | // CODE GENERATOR: test menu case '!': |
whismanoid | 52:607010f0c54e | 667 | // CODE GENERATOR: helpString '! -- Init' |
whismanoid | 52:607010f0c54e | 668 | // CODE GENERATOR: CMD_ 'None' |
whismanoid | 52:607010f0c54e | 669 | // CODE GENERATOR: CommandName 'Init' |
whismanoid | 52:607010f0c54e | 670 | // CODE GENERATOR: CommandParamIn 'void' |
whismanoid | 52:607010f0c54e | 671 | // CODE GENERATOR: CommandReturnType 'uint8_t' |
whismanoid | 52:607010f0c54e | 672 | // CODE GENERATOR: CommandPre '' |
whismanoid | 52:607010f0c54e | 673 | // CODE GENERATOR: CommandDocParamIn '' |
whismanoid | 52:607010f0c54e | 674 | // CODE GENERATOR: CommandDocParamOut '' |
whismanoid | 52:607010f0c54e | 675 | // CODE GENERATOR: CommandPost '' |
whismanoid | 52:607010f0c54e | 676 | // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure' |
whismanoid | 52:607010f0c54e | 677 | // case '!': // (single character) (testMenuFirstCharHandler="None") |
whismanoid | 52:607010f0c54e | 678 | case '!': |
whismanoid | 52:607010f0c54e | 679 | { |
whismanoid | 52:607010f0c54e | 680 | // test menu command '!' handler: |
whismanoid | 52:607010f0c54e | 681 | // helpString='! -- Init' |
whismanoid | 52:607010f0c54e | 682 | // CMD_='None' |
whismanoid | 52:607010f0c54e | 683 | // CommandName='Init' |
whismanoid | 52:607010f0c54e | 684 | // CommandParamIn='void' |
whismanoid | 52:607010f0c54e | 685 | // CommandReturnType='uint8_t' |
whismanoid | 52:607010f0c54e | 686 | // @Pre='' |
whismanoid | 52:607010f0c54e | 687 | // @Param[in]='' |
whismanoid | 52:607010f0c54e | 688 | // @Param[out]='' |
whismanoid | 52:607010f0c54e | 689 | // @Post='' |
whismanoid | 52:607010f0c54e | 690 | // displayPost='' |
whismanoid | 52:607010f0c54e | 691 | // @Return='@return 1 on success; 0 on failure' |
whismanoid | 52:607010f0c54e | 692 | cmdLine.serial().printf("Init"); |
whismanoid | 52:607010f0c54e | 693 | // call function Init |
whismanoid | 52:607010f0c54e | 694 | uint8_t result = g_MAX11043_device.Init(); |
whismanoid | 52:607010f0c54e | 695 | cmdLine.serial().printf(" =%d", result); |
whismanoid | 52:607010f0c54e | 696 | return true; // command handled by MAX11043 |
whismanoid | 52:607010f0c54e | 697 | // CODE GENERATOR: bottom of loop: testMenuCommand="!", testMenuFirstCharHandler="None" |
whismanoid | 52:607010f0c54e | 698 | } // end case '!' |
whismanoid | 52:607010f0c54e | 699 | break; |
whismanoid | 52:607010f0c54e | 700 | |
whismanoid | 64:a667cfd83492 | 701 | // CODE GENERATOR: top of loop: testMenuCommand="$", testMenuFirstCharHandler="None" |
whismanoid | 64:a667cfd83492 | 702 | // CODE GENERATOR: test menu case '$': |
whismanoid | 64:a667cfd83492 | 703 | // CODE GENERATOR: helpString '$ -- Read_ADCabcd' |
whismanoid | 64:a667cfd83492 | 704 | // CODE GENERATOR: CMD_ 'None' |
whismanoid | 64:a667cfd83492 | 705 | // CODE GENERATOR: CommandName 'Read_ADCabcd' |
whismanoid | 64:a667cfd83492 | 706 | // CODE GENERATOR: CommandParamIn 'void' |
whismanoid | 64:a667cfd83492 | 707 | // CODE GENERATOR: CommandReturnType 'uint8_t' |
whismanoid | 64:a667cfd83492 | 708 | // CODE GENERATOR: CommandPre '' |
whismanoid | 64:a667cfd83492 | 709 | // CODE GENERATOR: CommandDocParamIn '' |
whismanoid | 64:a667cfd83492 | 710 | // CODE GENERATOR: CommandDocParamOut '' |
whismanoid | 64:a667cfd83492 | 711 | // CODE GENERATOR: CommandPost '' |
whismanoid | 64:a667cfd83492 | 712 | // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure' |
whismanoid | 64:a667cfd83492 | 713 | // case '$': // (single character) (testMenuFirstCharHandler="None") |
whismanoid | 64:a667cfd83492 | 714 | case '$': |
whismanoid | 64:a667cfd83492 | 715 | { |
whismanoid | 64:a667cfd83492 | 716 | // test menu command '$' handler: |
whismanoid | 64:a667cfd83492 | 717 | // helpString='$ -- Read_ADCabcd' |
whismanoid | 64:a667cfd83492 | 718 | // CMD_='None' |
whismanoid | 64:a667cfd83492 | 719 | // CommandName='Read_ADCabcd' |
whismanoid | 64:a667cfd83492 | 720 | // CommandParamIn='void' |
whismanoid | 64:a667cfd83492 | 721 | // CommandReturnType='uint8_t' |
whismanoid | 64:a667cfd83492 | 722 | // @Pre='' |
whismanoid | 64:a667cfd83492 | 723 | // @Param[in]='' |
whismanoid | 64:a667cfd83492 | 724 | // @Param[out]='' |
whismanoid | 64:a667cfd83492 | 725 | // @Post='' |
whismanoid | 64:a667cfd83492 | 726 | // displayPost='adca, adcb, adcc, adcd' |
whismanoid | 64:a667cfd83492 | 727 | // @Return='@return 1 on success; 0 on failure' |
whismanoid | 64:a667cfd83492 | 728 | cmdLine.serial().printf("Read_ADCabcd"); |
whismanoid | 64:a667cfd83492 | 729 | // call function Read_ADCabcd |
whismanoid | 64:a667cfd83492 | 730 | uint8_t result = g_MAX11043_device.Read_ADCabcd(); |
whismanoid | 64:a667cfd83492 | 731 | cmdLine.serial().printf(" =%d", result); |
whismanoid | 64:a667cfd83492 | 732 | // Menu item '$' -> adca, adcb, adcc, adcd |
whismanoid | 64:a667cfd83492 | 733 | cmdLine.serial().printf("%s=%d\r\n", "adca", g_MAX11043_device.adca); |
whismanoid | 64:a667cfd83492 | 734 | cmdLine.serial().printf("%s=%d\r\n", "adcb", g_MAX11043_device.adcb); |
whismanoid | 64:a667cfd83492 | 735 | cmdLine.serial().printf("%s=%d\r\n", "adcc", g_MAX11043_device.adcc); |
whismanoid | 64:a667cfd83492 | 736 | cmdLine.serial().printf("%s=%d\r\n", "adcd", g_MAX11043_device.adcd); |
whismanoid | 64:a667cfd83492 | 737 | return true; // command handled by MAX11043 |
whismanoid | 64:a667cfd83492 | 738 | // CODE GENERATOR: bottom of loop: testMenuCommand="$", testMenuFirstCharHandler="None" |
whismanoid | 64:a667cfd83492 | 739 | } // end case '$' |
whismanoid | 64:a667cfd83492 | 740 | break; |
whismanoid | 64:a667cfd83492 | 741 | |
whismanoid | 64:a667cfd83492 | 742 | // CODE GENERATOR: top of loop: testMenuCommand="J", testMenuFirstCharHandler="None" |
whismanoid | 64:a667cfd83492 | 743 | // CODE GENERATOR: test menu case 'J': |
whismanoid | 64:a667cfd83492 | 744 | // CODE GENERATOR: helpString 'J gain=? -- Write_AGain' |
whismanoid | 64:a667cfd83492 | 745 | // CODE GENERATOR: CMD_ 'None' |
whismanoid | 64:a667cfd83492 | 746 | // CODE GENERATOR: CommandName 'Write_AGain' |
whismanoid | 64:a667cfd83492 | 747 | // CODE GENERATOR: CommandParamIn 'uint32_t gain' |
whismanoid | 64:a667cfd83492 | 748 | // CODE GENERATOR: CommandReturnType 'uint8_t' |
whismanoid | 64:a667cfd83492 | 749 | // CODE GENERATOR: CommandPre '' |
whismanoid | 64:a667cfd83492 | 750 | // CODE GENERATOR: CommandDocParamIn '@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000' |
whismanoid | 64:a667cfd83492 | 751 | // CODE GENERATOR: CommandDocParamOut '' |
whismanoid | 64:a667cfd83492 | 752 | // CODE GENERATOR: CommandPost '' |
whismanoid | 64:a667cfd83492 | 753 | // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure' |
whismanoid | 64:a667cfd83492 | 754 | // case 'J': // (single character) (testMenuFirstCharHandler="None") |
whismanoid | 64:a667cfd83492 | 755 | case 'J': |
whismanoid | 64:a667cfd83492 | 756 | { |
whismanoid | 64:a667cfd83492 | 757 | // test menu command 'J' handler: |
whismanoid | 64:a667cfd83492 | 758 | // helpString='J gain=? -- Write_AGain' |
whismanoid | 64:a667cfd83492 | 759 | // CMD_='None' |
whismanoid | 64:a667cfd83492 | 760 | // CommandName='Write_AGain' |
whismanoid | 64:a667cfd83492 | 761 | // CommandParamIn='uint32_t gain' |
whismanoid | 64:a667cfd83492 | 762 | // CommandReturnType='uint8_t' |
whismanoid | 64:a667cfd83492 | 763 | // @Pre='' |
whismanoid | 64:a667cfd83492 | 764 | // @Param[in]='@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000' |
whismanoid | 64:a667cfd83492 | 765 | // @Param[out]='' |
whismanoid | 64:a667cfd83492 | 766 | // @Post='' |
whismanoid | 64:a667cfd83492 | 767 | // displayPost='' |
whismanoid | 64:a667cfd83492 | 768 | // @Return='@return 1 on success; 0 on failure' |
whismanoid | 64:a667cfd83492 | 769 | // parse argument list |
whismanoid | 64:a667cfd83492 | 770 | // argname default_argvalue numeric literal specified in CommandDocParamIn @Param[in]='@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000' |
whismanoid | 64:a667cfd83492 | 771 | // parse argument uint32_t gain |
whismanoid | 64:a667cfd83492 | 772 | uint32_t gain = (uint32_t)0x2000; // --- g_MAX11043_device.__WARNING_no_match_for_argname_gain_in_MAX11043_device_t__; // default to global property value |
whismanoid | 64:a667cfd83492 | 773 | if (cmdLine.parse_uint32_dec("gain", gain)) |
whismanoid | 64:a667cfd83492 | 774 | { |
whismanoid | 64:a667cfd83492 | 775 | // g_MAX11043_device.__WARNING_no_match_for_argname_gain_in_MAX11043_device_t__ = gain; // update global property value |
whismanoid | 64:a667cfd83492 | 776 | } |
whismanoid | 64:a667cfd83492 | 777 | // print arguments |
whismanoid | 64:a667cfd83492 | 778 | cmdLine.serial().printf("Write_AGain"); |
whismanoid | 64:a667cfd83492 | 779 | cmdLine.serial().printf(" gain=%d", gain); |
whismanoid | 64:a667cfd83492 | 780 | cmdLine.serial().printf("\r\n"); |
whismanoid | 64:a667cfd83492 | 781 | // call function Write_AGain(gain) |
whismanoid | 64:a667cfd83492 | 782 | uint8_t result = g_MAX11043_device.Write_AGain(gain); |
whismanoid | 64:a667cfd83492 | 783 | cmdLine.serial().printf(" =%d\r\n", result); |
whismanoid | 64:a667cfd83492 | 784 | return true; // command handled by MAX11043 |
whismanoid | 64:a667cfd83492 | 785 | // CODE GENERATOR: bottom of loop: testMenuCommand="J", testMenuFirstCharHandler="None" |
whismanoid | 64:a667cfd83492 | 786 | } // end case 'J' |
whismanoid | 64:a667cfd83492 | 787 | break; |
whismanoid | 64:a667cfd83492 | 788 | |
whismanoid | 59:47538bcf6cda | 789 | // CODE GENERATOR: top of loop: testMenuCommand="XX", testMenuFirstCharHandler="None" |
whismanoid | 59:47538bcf6cda | 790 | // CODE GENERATOR: test menu case 'XX': |
whismanoid | 59:47538bcf6cda | 791 | // CODE GENERATOR: helpString 'XX linef=? rate=? -- Configure_XXXXX' |
whismanoid | 59:47538bcf6cda | 792 | // CODE GENERATOR: CMD_ 'None' |
whismanoid | 59:47538bcf6cda | 793 | // CODE GENERATOR: CommandName 'Configure_XXXXX' |
whismanoid | 59:47538bcf6cda | 794 | // CODE GENERATOR: CommandParamIn 'uint8_t linef, uint8_t rate' |
whismanoid | 59:47538bcf6cda | 795 | // CODE GENERATOR: CommandReturnType 'uint8_t' |
whismanoid | 59:47538bcf6cda | 796 | // CODE GENERATOR: CommandPre '' |
whismanoid | 59:47538bcf6cda | 797 | // CODE GENERATOR: CommandDocParamIn '' |
whismanoid | 59:47538bcf6cda | 798 | // CODE GENERATOR: CommandDocParamOut '' |
whismanoid | 59:47538bcf6cda | 799 | // CODE GENERATOR: CommandPost '' |
whismanoid | 59:47538bcf6cda | 800 | // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure' |
whismanoid | 59:47538bcf6cda | 801 | case 'X': // (multiple characters) (testMenuFirstCharHandler="X"): |
whismanoid | 59:47538bcf6cda | 802 | { |
whismanoid | 59:47538bcf6cda | 803 | switch (cmdLine[1]) |
whismanoid | 59:47538bcf6cda | 804 | { |
whismanoid | 59:47538bcf6cda | 805 | case 'X': // (nested inside case 'X') |
whismanoid | 59:47538bcf6cda | 806 | { |
whismanoid | 59:47538bcf6cda | 807 | // test menu command 'XX' handler: |
whismanoid | 59:47538bcf6cda | 808 | // helpString='XX linef=? rate=? -- Configure_XXXXX' |
whismanoid | 59:47538bcf6cda | 809 | // CMD_='None' |
whismanoid | 59:47538bcf6cda | 810 | // CommandName='Configure_XXXXX' |
whismanoid | 59:47538bcf6cda | 811 | // CommandParamIn='uint8_t linef, uint8_t rate' |
whismanoid | 59:47538bcf6cda | 812 | // CommandReturnType='uint8_t' |
whismanoid | 59:47538bcf6cda | 813 | // @Pre='' |
whismanoid | 59:47538bcf6cda | 814 | // @Param[in]='' |
whismanoid | 59:47538bcf6cda | 815 | // @Param[out]='' |
whismanoid | 59:47538bcf6cda | 816 | // @Post='' |
whismanoid | 59:47538bcf6cda | 817 | // displayPost='' |
whismanoid | 59:47538bcf6cda | 818 | // @Return='@return 1 on success; 0 on failure' |
whismanoid | 59:47538bcf6cda | 819 | // parse argument list |
whismanoid | 59:47538bcf6cda | 820 | // parse argument uint8_t linef |
whismanoid | 59:47538bcf6cda | 821 | uint8_t linef = 0; // --- g_MAX11043_device.__WARNING_no_match_for_argname_linef_in_MAX11043_device_t__; // default to global property value |
whismanoid | 59:47538bcf6cda | 822 | if (cmdLine.parse_uint8_dec("linef", linef)) |
whismanoid | 59:47538bcf6cda | 823 | { |
whismanoid | 59:47538bcf6cda | 824 | // g_MAX11043_device.__WARNING_no_match_for_argname_linef_in_MAX11043_device_t__ = linef; // update global property value |
whismanoid | 59:47538bcf6cda | 825 | } |
whismanoid | 59:47538bcf6cda | 826 | // parse argument uint8_t rate |
whismanoid | 59:47538bcf6cda | 827 | uint8_t rate = 0; // --- g_MAX11043_device.__WARNING_no_match_for_argname_rate_in_MAX11043_device_t__; // default to global property value |
whismanoid | 59:47538bcf6cda | 828 | if (cmdLine.parse_uint8_dec("rate", rate)) |
whismanoid | 59:47538bcf6cda | 829 | { |
whismanoid | 59:47538bcf6cda | 830 | // g_MAX11043_device.__WARNING_no_match_for_argname_rate_in_MAX11043_device_t__ = rate; // update global property value |
whismanoid | 59:47538bcf6cda | 831 | } |
whismanoid | 59:47538bcf6cda | 832 | // print arguments |
whismanoid | 59:47538bcf6cda | 833 | cmdLine.serial().printf("Configure_XXXXX"); |
whismanoid | 59:47538bcf6cda | 834 | cmdLine.serial().printf(" linef=%d", linef); |
whismanoid | 59:47538bcf6cda | 835 | cmdLine.serial().printf(" rate=%d", rate); |
whismanoid | 59:47538bcf6cda | 836 | cmdLine.serial().printf("\r\n"); |
whismanoid | 59:47538bcf6cda | 837 | // call function Configure_XXXXX(linef, rate) |
whismanoid | 59:47538bcf6cda | 838 | uint8_t result = g_MAX11043_device.Configure_XXXXX(linef, rate); |
whismanoid | 59:47538bcf6cda | 839 | cmdLine.serial().printf(" =%d\r\n", result); |
whismanoid | 59:47538bcf6cda | 840 | return true; // command handled by MAX11043 |
whismanoid | 59:47538bcf6cda | 841 | // CODE GENERATOR: bottom of loop: testMenuCommand="XX", testMenuFirstCharHandler="X" |
whismanoid | 59:47538bcf6cda | 842 | } // end nested case 'XX' |
whismanoid | 59:47538bcf6cda | 843 | break; |
whismanoid | 59:47538bcf6cda | 844 | |
whismanoid | 59:47538bcf6cda | 845 | // CODE GENERATOR: top of loop: testMenuCommand="XY", testMenuFirstCharHandler="X" |
whismanoid | 59:47538bcf6cda | 846 | // CODE GENERATOR: top of loop: nested switch "X" is currently open |
whismanoid | 59:47538bcf6cda | 847 | // CODE GENERATOR: test menu case 'XY': |
whismanoid | 59:47538bcf6cda | 848 | // CODE GENERATOR: helpString 'XY linef=? rate=? -- Configure_XXXXY' |
whismanoid | 59:47538bcf6cda | 849 | // CODE GENERATOR: CMD_ 'None' |
whismanoid | 59:47538bcf6cda | 850 | // CODE GENERATOR: CommandName 'Configure_XXXXY' |
whismanoid | 59:47538bcf6cda | 851 | // CODE GENERATOR: CommandParamIn 'uint8_t linef, uint8_t rate' |
whismanoid | 59:47538bcf6cda | 852 | // CODE GENERATOR: CommandReturnType 'uint8_t' |
whismanoid | 59:47538bcf6cda | 853 | // CODE GENERATOR: CommandPre '' |
whismanoid | 59:47538bcf6cda | 854 | // CODE GENERATOR: CommandDocParamIn '' |
whismanoid | 59:47538bcf6cda | 855 | // CODE GENERATOR: CommandDocParamOut '' |
whismanoid | 59:47538bcf6cda | 856 | // CODE GENERATOR: CommandPost '' |
whismanoid | 59:47538bcf6cda | 857 | // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure' |
whismanoid | 59:47538bcf6cda | 858 | case 'Y': // (nested inside case 'X') |
whismanoid | 59:47538bcf6cda | 859 | { |
whismanoid | 59:47538bcf6cda | 860 | // test menu command 'XY' handler: |
whismanoid | 59:47538bcf6cda | 861 | // helpString='XY linef=? rate=? -- Configure_XXXXY' |
whismanoid | 59:47538bcf6cda | 862 | // CMD_='None' |
whismanoid | 59:47538bcf6cda | 863 | // CommandName='Configure_XXXXY' |
whismanoid | 59:47538bcf6cda | 864 | // CommandParamIn='uint8_t linef, uint8_t rate' |
whismanoid | 59:47538bcf6cda | 865 | // CommandReturnType='uint8_t' |
whismanoid | 59:47538bcf6cda | 866 | // @Pre='' |
whismanoid | 59:47538bcf6cda | 867 | // @Param[in]='' |
whismanoid | 59:47538bcf6cda | 868 | // @Param[out]='' |
whismanoid | 59:47538bcf6cda | 869 | // @Post='' |
whismanoid | 59:47538bcf6cda | 870 | // displayPost='' |
whismanoid | 59:47538bcf6cda | 871 | // @Return='@return 1 on success; 0 on failure' |
whismanoid | 59:47538bcf6cda | 872 | // parse argument list |
whismanoid | 59:47538bcf6cda | 873 | // parse argument uint8_t linef |
whismanoid | 59:47538bcf6cda | 874 | uint8_t linef = 0; // --- g_MAX11043_device.__WARNING_no_match_for_argname_linef_in_MAX11043_device_t__; // default to global property value |
whismanoid | 59:47538bcf6cda | 875 | if (cmdLine.parse_uint8_dec("linef", linef)) |
whismanoid | 59:47538bcf6cda | 876 | { |
whismanoid | 59:47538bcf6cda | 877 | // g_MAX11043_device.__WARNING_no_match_for_argname_linef_in_MAX11043_device_t__ = linef; // update global property value |
whismanoid | 59:47538bcf6cda | 878 | } |
whismanoid | 59:47538bcf6cda | 879 | // parse argument uint8_t rate |
whismanoid | 59:47538bcf6cda | 880 | uint8_t rate = 0; // --- g_MAX11043_device.__WARNING_no_match_for_argname_rate_in_MAX11043_device_t__; // default to global property value |
whismanoid | 59:47538bcf6cda | 881 | if (cmdLine.parse_uint8_dec("rate", rate)) |
whismanoid | 59:47538bcf6cda | 882 | { |
whismanoid | 59:47538bcf6cda | 883 | // g_MAX11043_device.__WARNING_no_match_for_argname_rate_in_MAX11043_device_t__ = rate; // update global property value |
whismanoid | 59:47538bcf6cda | 884 | } |
whismanoid | 59:47538bcf6cda | 885 | // print arguments |
whismanoid | 59:47538bcf6cda | 886 | cmdLine.serial().printf("Configure_XXXXY"); |
whismanoid | 59:47538bcf6cda | 887 | cmdLine.serial().printf(" linef=%d", linef); |
whismanoid | 59:47538bcf6cda | 888 | cmdLine.serial().printf(" rate=%d", rate); |
whismanoid | 59:47538bcf6cda | 889 | cmdLine.serial().printf("\r\n"); |
whismanoid | 59:47538bcf6cda | 890 | // call function Configure_XXXXY(linef, rate) |
whismanoid | 59:47538bcf6cda | 891 | uint8_t result = g_MAX11043_device.Configure_XXXXY(linef, rate); |
whismanoid | 59:47538bcf6cda | 892 | cmdLine.serial().printf(" =%d\r\n", result); |
whismanoid | 59:47538bcf6cda | 893 | return true; // command handled by MAX11043 |
whismanoid | 59:47538bcf6cda | 894 | // CODE GENERATOR: bottom of loop: testMenuCommand="XY", testMenuFirstCharHandler="X" |
whismanoid | 59:47538bcf6cda | 895 | } // end nested case 'XY' |
whismanoid | 59:47538bcf6cda | 896 | break; |
whismanoid | 59:47538bcf6cda | 897 | |
whismanoid | 59:47538bcf6cda | 898 | } // end nested switch (cmdLine[1]) inside case 'X' |
whismanoid | 59:47538bcf6cda | 899 | break; |
whismanoid | 59:47538bcf6cda | 900 | } // end case 'X' |
whismanoid | 52:607010f0c54e | 901 | // has_register_write_command: case '0'..'9','A'..'F','a'..'f' letters are reserved for bitstream commands |
whismanoid | 52:607010f0c54e | 902 | case '0': case '1': case '2': case '3': case '4': |
whismanoid | 52:607010f0c54e | 903 | case '5': case '6': case '7': case '8': case '9': |
whismanoid | 52:607010f0c54e | 904 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': |
whismanoid | 52:607010f0c54e | 905 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': |
whismanoid | 52:607010f0c54e | 906 | { |
whismanoid | 52:607010f0c54e | 907 | // hexadecimal codes get parsed as bytecodes |
whismanoid | 52:607010f0c54e | 908 | // |
whismanoid | 52:607010f0c54e | 909 | // parse_byteCount_byteList_dec() assumes all keyword args have already been removed from the buffer |
whismanoid | 52:607010f0c54e | 910 | // parse cmdLine byte list --> int byteCount; int mosiData[MAX_SPI_BYTE_COUNT]; |
whismanoid | 52:607010f0c54e | 911 | #define MAX_SPI_BYTE_COUNT 32 |
whismanoid | 52:607010f0c54e | 912 | size_t byteCount = byteCount; |
whismanoid | 52:607010f0c54e | 913 | static char mosiData[MAX_SPI_BYTE_COUNT]; |
whismanoid | 52:607010f0c54e | 914 | static char misoData[MAX_SPI_BYTE_COUNT]; |
whismanoid | 52:607010f0c54e | 915 | if (cmdLine.parse_byteCount_byteList_hex(byteCount, mosiData, |
whismanoid | 52:607010f0c54e | 916 | MAX_SPI_BYTE_COUNT)) |
whismanoid | 52:607010f0c54e | 917 | { |
whismanoid | 57:1c9da8e90737 | 918 | // TODO: decode operation from commandByte |
whismanoid | 57:1c9da8e90737 | 919 | // TODO: OVERSIMPLIFICATION: if length is 1 byte then operation is RegRead, otherwise RegWrite |
whismanoid | 52:607010f0c54e | 920 | // register_read_function 'IsRegReadCommand' |
whismanoid | 52:607010f0c54e | 921 | // register_write_function 'RegWrite' |
whismanoid | 52:607010f0c54e | 922 | // register_name_function 'RegName' |
whismanoid | 52:607010f0c54e | 923 | // register_size_function 'RegSize' |
whismanoid | 57:1c9da8e90737 | 924 | // CODE GENERATOR: does the chip have a defined CMDOP_1aaa_aaaa_ReadRegister bit? |
whismanoid | 57:1c9da8e90737 | 925 | // MAX11043::MAX11043_CMD_enum_t regAddress = (MAX11043::MAX11043_CMD_enum_t)((mosiData[0] &~ MAX11043::CMDOP_1aaa_aaaa_ReadRegister) & 0xFF); |
whismanoid | 52:607010f0c54e | 926 | MAX11043::MAX11043_CMD_enum_t commandByte = (MAX11043::MAX11043_CMD_enum_t)(mosiData[0]); |
whismanoid | 57:1c9da8e90737 | 927 | MAX11043::MAX11043_CMDOP_enum_t commandOp = g_MAX11043_device.DecodeCommand(commandByte); |
whismanoid | 52:607010f0c54e | 928 | int regAddress = g_MAX11043_device.RegAddrOfCommand(commandByte); |
whismanoid | 52:607010f0c54e | 929 | cmdLine.serial().printf(" regAddress=0x%2.2x\r\n", (regAddress & 0xFF)); |
whismanoid | 52:607010f0c54e | 930 | cmdLine.serial().printf(" RegName=%s\r\n", g_MAX11043_device.RegName(commandByte)); |
whismanoid | 52:607010f0c54e | 931 | uint32_t regData = 0; |
whismanoid | 52:607010f0c54e | 932 | int regSize = g_MAX11043_device.RegSize(commandByte); |
whismanoid | 52:607010f0c54e | 933 | cmdLine.serial().printf(" RegSize=%d\r\n", regSize); |
whismanoid | 52:607010f0c54e | 934 | switch(regSize) |
whismanoid | 52:607010f0c54e | 935 | { |
whismanoid | 52:607010f0c54e | 936 | case 8: |
whismanoid | 52:607010f0c54e | 937 | regData = ((uint32_t)mosiData[1] & 0xFF); |
whismanoid | 52:607010f0c54e | 938 | break; |
whismanoid | 52:607010f0c54e | 939 | case 16: |
whismanoid | 52:607010f0c54e | 940 | regData = (((uint32_t)mosiData[1] & 0xFF) << 8) + ((uint32_t)mosiData[2] & 0xFF); |
whismanoid | 52:607010f0c54e | 941 | break; |
whismanoid | 52:607010f0c54e | 942 | case 24: |
whismanoid | 52:607010f0c54e | 943 | regData = (((uint32_t)mosiData[1] & 0xFF) << 16) + (((uint32_t)mosiData[2] & 0xFF) << 8) + ((uint32_t)mosiData[3] & 0xFF); |
whismanoid | 52:607010f0c54e | 944 | break; |
whismanoid | 52:607010f0c54e | 945 | } |
whismanoid | 57:1c9da8e90737 | 946 | // CODE GENERATOR: does the chip have a defined CMDOP_1aaa_aaaa_ReadRegister bit? |
whismanoid | 57:1c9da8e90737 | 947 | // if ((byteCount == 1) || (regAddress & MAX11043::CMDOP_1aaa_aaaa_ReadRegister)) |
whismanoid | 52:607010f0c54e | 948 | if ((byteCount == 1) || g_MAX11043_device.IsRegReadCommand(commandByte)) |
whismanoid | 52:607010f0c54e | 949 | { |
whismanoid | 52:607010f0c54e | 950 | cmdLine.serial().printf(" RegRead"); |
whismanoid | 52:607010f0c54e | 951 | g_MAX11043_device.RegRead(commandByte, ®Data); |
whismanoid | 52:607010f0c54e | 952 | cmdLine.serial().printf("regData=0x%6.6x\r\n", (regData & 0x00FFFFFF)); |
whismanoid | 52:607010f0c54e | 953 | } |
whismanoid | 52:607010f0c54e | 954 | else |
whismanoid | 52:607010f0c54e | 955 | { |
whismanoid | 52:607010f0c54e | 956 | cmdLine.serial().printf(" RegWrite regData=0x%6.6X\r\n", (regData & 0x00FFFFFF)); |
whismanoid | 52:607010f0c54e | 957 | g_MAX11043_device.RegWrite(commandByte, regData); |
whismanoid | 52:607010f0c54e | 958 | } |
whismanoid | 52:607010f0c54e | 959 | // is there support function shadow regValue of regAddr? |
whismanoid | 52:607010f0c54e | 960 | } |
whismanoid | 52:607010f0c54e | 961 | return true; // command handled by MAX11043 |
whismanoid | 52:607010f0c54e | 962 | // |
whismanoid | 52:607010f0c54e | 963 | } // end case '0'..'9','A'..'F','a'..'f' |
whismanoid | 52:607010f0c54e | 964 | break; |
whismanoid | 52:607010f0c54e | 965 | } // end switch (cmdLine[0]) |
whismanoid | 52:607010f0c54e | 966 | return false; // command not handled by MAX11043 |
whismanoid | 52:607010f0c54e | 967 | } // end bool MAX11043_menu_onEOLcommandParser(CmdLine & cmdLine) |
whismanoid | 52:607010f0c54e | 968 | |
whismanoid | 52:607010f0c54e | 969 | // CODE GENERATOR: class declaration statement close |