Maxim Integrated MAX5719 20-bit, 0.05nV-sec DAC Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.
Dependencies: MaximTinyTester CmdLine MAX5719 USBDevice
Test_Menu_MAX5719.cpp@25:9d4012b0887f, 2021-01-03 (annotated)
- Committer:
- whismanoid
- Date:
- Sun Jan 03 04:44:40 2021 +0000
- Revision:
- 25:9d4012b0887f
- Child:
- 26:ec719cd9a579
Initial commit MAX5719BOB Serial Tester
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
whismanoid | 25:9d4012b0887f | 1 | // /******************************************************************************* |
whismanoid | 25:9d4012b0887f | 2 | // * Copyright (C) 2021 Maxim Integrated Products, Inc., All Rights Reserved. |
whismanoid | 25:9d4012b0887f | 3 | // * |
whismanoid | 25:9d4012b0887f | 4 | // * Permission is hereby granted, free of charge, to any person obtaining a |
whismanoid | 25:9d4012b0887f | 5 | // * copy of this software and associated documentation files (the "Software"), |
whismanoid | 25:9d4012b0887f | 6 | // * to deal in the Software without restriction, including without limitation |
whismanoid | 25:9d4012b0887f | 7 | // * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
whismanoid | 25:9d4012b0887f | 8 | // * and/or sell copies of the Software, and to permit persons to whom the |
whismanoid | 25:9d4012b0887f | 9 | // * Software is furnished to do so, subject to the following conditions: |
whismanoid | 25:9d4012b0887f | 10 | // * |
whismanoid | 25:9d4012b0887f | 11 | // * The above copyright notice and this permission notice shall be included |
whismanoid | 25:9d4012b0887f | 12 | // * in all copies or substantial portions of the Software. |
whismanoid | 25:9d4012b0887f | 13 | // * |
whismanoid | 25:9d4012b0887f | 14 | // * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
whismanoid | 25:9d4012b0887f | 15 | // * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
whismanoid | 25:9d4012b0887f | 16 | // * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
whismanoid | 25:9d4012b0887f | 17 | // * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
whismanoid | 25:9d4012b0887f | 18 | // * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
whismanoid | 25:9d4012b0887f | 19 | // * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
whismanoid | 25:9d4012b0887f | 20 | // * OTHER DEALINGS IN THE SOFTWARE. |
whismanoid | 25:9d4012b0887f | 21 | // * |
whismanoid | 25:9d4012b0887f | 22 | // * Except as contained in this notice, the name of Maxim Integrated |
whismanoid | 25:9d4012b0887f | 23 | // * Products, Inc. shall not be used except as stated in the Maxim Integrated |
whismanoid | 25:9d4012b0887f | 24 | // * Products, Inc. Branding Policy. |
whismanoid | 25:9d4012b0887f | 25 | // * |
whismanoid | 25:9d4012b0887f | 26 | // * The mere transfer of this software does not imply any licenses |
whismanoid | 25:9d4012b0887f | 27 | // * of trade secrets, proprietary technology, copyrights, patents, |
whismanoid | 25:9d4012b0887f | 28 | // * trademarks, maskwork rights, or any other form of intellectual |
whismanoid | 25:9d4012b0887f | 29 | // * property whatsoever. Maxim Integrated Products, Inc. retains all |
whismanoid | 25:9d4012b0887f | 30 | // * ownership rights. |
whismanoid | 25:9d4012b0887f | 31 | // ******************************************************************************* |
whismanoid | 25:9d4012b0887f | 32 | // */ |
whismanoid | 25:9d4012b0887f | 33 | // example code includes |
whismanoid | 25:9d4012b0887f | 34 | // standard include for target platform -- Platform_Include_Boilerplate |
whismanoid | 25:9d4012b0887f | 35 | #include "mbed.h" |
whismanoid | 25:9d4012b0887f | 36 | // Platforms: |
whismanoid | 25:9d4012b0887f | 37 | // - MAX32625MBED |
whismanoid | 25:9d4012b0887f | 38 | // - supports mbed-os-5.11, requires USBDevice library |
whismanoid | 25:9d4012b0887f | 39 | // - add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/ |
whismanoid | 25:9d4012b0887f | 40 | // - remove max32630fthr library (if present) |
whismanoid | 25:9d4012b0887f | 41 | // - remove MAX32620FTHR library (if present) |
whismanoid | 25:9d4012b0887f | 42 | // - MAX32600MBED |
whismanoid | 25:9d4012b0887f | 43 | // - Please note the last supported version is Mbed OS 6.3. |
whismanoid | 25:9d4012b0887f | 44 | // - remove max32630fthr library (if present) |
whismanoid | 25:9d4012b0887f | 45 | // - remove MAX32620FTHR library (if present) |
whismanoid | 25:9d4012b0887f | 46 | // - Windows 10 note: Don't connect HDK until you are ready to load new firmware into the board. |
whismanoid | 25:9d4012b0887f | 47 | // - NUCLEO_F446RE |
whismanoid | 25:9d4012b0887f | 48 | // - remove USBDevice library |
whismanoid | 25:9d4012b0887f | 49 | // - remove max32630fthr library (if present) |
whismanoid | 25:9d4012b0887f | 50 | // - remove MAX32620FTHR library (if present) |
whismanoid | 25:9d4012b0887f | 51 | // - NUCLEO_F401RE |
whismanoid | 25:9d4012b0887f | 52 | // - remove USBDevice library |
whismanoid | 25:9d4012b0887f | 53 | // - remove max32630fthr library (if present) |
whismanoid | 25:9d4012b0887f | 54 | // - remove MAX32620FTHR library (if present) |
whismanoid | 25:9d4012b0887f | 55 | // - MAX32630FTHR |
whismanoid | 25:9d4012b0887f | 56 | // - #include "max32630fthr.h" |
whismanoid | 25:9d4012b0887f | 57 | // - add http://developer.mbed.org/teams/MaximIntegrated/code/max32630fthr/ |
whismanoid | 25:9d4012b0887f | 58 | // - remove MAX32620FTHR library (if present) |
whismanoid | 25:9d4012b0887f | 59 | // - MAX32620FTHR |
whismanoid | 25:9d4012b0887f | 60 | // - #include "MAX32620FTHR.h" |
whismanoid | 25:9d4012b0887f | 61 | // - remove max32630fthr library (if present) |
whismanoid | 25:9d4012b0887f | 62 | // - add https://os.mbed.com/teams/MaximIntegrated/code/MAX32620FTHR/ |
whismanoid | 25:9d4012b0887f | 63 | // - not tested yet |
whismanoid | 25:9d4012b0887f | 64 | // - MAX32625PICO |
whismanoid | 25:9d4012b0887f | 65 | // - #include "max32625pico.h" |
whismanoid | 25:9d4012b0887f | 66 | // - add https://os.mbed.com/users/switches/code/max32625pico/ |
whismanoid | 25:9d4012b0887f | 67 | // - remove max32630fthr library (if present) |
whismanoid | 25:9d4012b0887f | 68 | // - remove MAX32620FTHR library (if present) |
whismanoid | 25:9d4012b0887f | 69 | // - not tested yet |
whismanoid | 25:9d4012b0887f | 70 | // - see https://os.mbed.com/users/switches/code/max32625pico/ |
whismanoid | 25:9d4012b0887f | 71 | // - see https://os.mbed.com/users/switches/code/PICO_board_demo/ |
whismanoid | 25:9d4012b0887f | 72 | // - see https://os.mbed.com/users/switches/code/PICO_USB_I2C_SPI/ |
whismanoid | 25:9d4012b0887f | 73 | // - see https://os.mbed.com/users/switches/code/SerialInterface/ |
whismanoid | 25:9d4012b0887f | 74 | // - Note: To load the MAX32625PICO firmware, hold the button while |
whismanoid | 25:9d4012b0887f | 75 | // connecting the USB cable, then copy firmware bin file |
whismanoid | 25:9d4012b0887f | 76 | // to the MAINTENANCE drive. |
whismanoid | 25:9d4012b0887f | 77 | // - see https://os.mbed.com/platforms/MAX32625PICO/ |
whismanoid | 25:9d4012b0887f | 78 | // - see https://os.mbed.com/teams/MaximIntegrated/wiki/MAX32625PICO-Firmware-Updates |
whismanoid | 25:9d4012b0887f | 79 | // |
whismanoid | 25:9d4012b0887f | 80 | // end Platform_Include_Boilerplate |
whismanoid | 25:9d4012b0887f | 81 | #include "MAX5719.h" |
whismanoid | 25:9d4012b0887f | 82 | #include "CmdLine.h" |
whismanoid | 25:9d4012b0887f | 83 | #include "MaximTinyTester.h" |
whismanoid | 25:9d4012b0887f | 84 | |
whismanoid | 25:9d4012b0887f | 85 | #include "MAX5719.h" |
whismanoid | 25:9d4012b0887f | 86 | extern MAX5719 g_MAX5719_device; // defined in main.cpp |
whismanoid | 25:9d4012b0887f | 87 | |
whismanoid | 25:9d4012b0887f | 88 | |
whismanoid | 25:9d4012b0887f | 89 | |
whismanoid | 25:9d4012b0887f | 90 | void MAX5719_menu_help(CmdLine & cmdLine) |
whismanoid | 25:9d4012b0887f | 91 | { |
whismanoid | 25:9d4012b0887f | 92 | cmdLine.serial().printf("\r\n ! -- Init"); |
whismanoid | 25:9d4012b0887f | 93 | cmdLine.serial().printf("\r\n A code=? -- CODE"); |
whismanoid | 25:9d4012b0887f | 94 | cmdLine.serial().printf("\r\n B -- LOAD"); |
whismanoid | 25:9d4012b0887f | 95 | cmdLine.serial().printf("\r\n C code=? -- CODE_LOAD"); |
whismanoid | 25:9d4012b0887f | 96 | // |
whismanoid | 25:9d4012b0887f | 97 | cmdLine.serial().printf("\r\n @ -- print MAX5719 configuration"); |
whismanoid | 25:9d4012b0887f | 98 | |
whismanoid | 25:9d4012b0887f | 99 | // |
whismanoid | 25:9d4012b0887f | 100 | // case 'G'..'Z','g'..'z' are reserved for GPIO commands |
whismanoid | 25:9d4012b0887f | 101 | // case 'A'..'F','a'..'f' may be available if not claimed by bitstream commands |
whismanoid | 25:9d4012b0887f | 102 | cmdLine.serial().printf("\r\n L -- LDACb output LH high LL low"); // TODO: ExternFunctionGPIOPinCommand testMenuGPIOItemsDict |
whismanoid | 25:9d4012b0887f | 103 | |
whismanoid | 25:9d4012b0887f | 104 | // |
whismanoid | 25:9d4012b0887f | 105 | } |
whismanoid | 25:9d4012b0887f | 106 | |
whismanoid | 25:9d4012b0887f | 107 | bool MAX5719_menu_onEOLcommandParser(CmdLine & cmdLine) |
whismanoid | 25:9d4012b0887f | 108 | { |
whismanoid | 25:9d4012b0887f | 109 | |
whismanoid | 25:9d4012b0887f | 110 | |
whismanoid | 25:9d4012b0887f | 111 | // parse argument int32_t DACCode |
whismanoid | 25:9d4012b0887f | 112 | int32_t DACCode = g_MAX5719_device.DACCode; // default to global property value |
whismanoid | 25:9d4012b0887f | 113 | if (cmdLine.parse_int32_dec("DACCode", DACCode)) |
whismanoid | 25:9d4012b0887f | 114 | { |
whismanoid | 25:9d4012b0887f | 115 | g_MAX5719_device.DACCode = DACCode; // update global property value |
whismanoid | 25:9d4012b0887f | 116 | } |
whismanoid | 25:9d4012b0887f | 117 | // "code" is an alias for argument "DACCode" |
whismanoid | 25:9d4012b0887f | 118 | if (cmdLine.parse_int32_dec("code", DACCode)) |
whismanoid | 25:9d4012b0887f | 119 | { |
whismanoid | 25:9d4012b0887f | 120 | g_MAX5719_device.DACCode = DACCode; // update global property value |
whismanoid | 25:9d4012b0887f | 121 | } |
whismanoid | 25:9d4012b0887f | 122 | |
whismanoid | 25:9d4012b0887f | 123 | // parse argument double VRef |
whismanoid | 25:9d4012b0887f | 124 | double VRef = g_MAX5719_device.VRef; // default to global property value |
whismanoid | 25:9d4012b0887f | 125 | if (cmdLine.parse_double("VRef", VRef)) |
whismanoid | 25:9d4012b0887f | 126 | { |
whismanoid | 25:9d4012b0887f | 127 | g_MAX5719_device.VRef = VRef; // update global property value |
whismanoid | 25:9d4012b0887f | 128 | } |
whismanoid | 25:9d4012b0887f | 129 | |
whismanoid | 25:9d4012b0887f | 130 | switch (cmdLine[0]) |
whismanoid | 25:9d4012b0887f | 131 | { |
whismanoid | 25:9d4012b0887f | 132 | case '@': |
whismanoid | 25:9d4012b0887f | 133 | { |
whismanoid | 25:9d4012b0887f | 134 | cmdLine.serial().printf("VRef = "); |
whismanoid | 25:9d4012b0887f | 135 | cmdLine.serial().printf("%1.6f\r\n", g_MAX5719_device.VRef); |
whismanoid | 25:9d4012b0887f | 136 | cmdLine.serial().printf("DACCode = "); |
whismanoid | 25:9d4012b0887f | 137 | cmdLine.serial().printf("%ld = 0x%8.8lx\r\n", g_MAX5719_device.DACCode, g_MAX5719_device.DACCode); |
whismanoid | 25:9d4012b0887f | 138 | return true; // command handled by MAX5719 |
whismanoid | 25:9d4012b0887f | 139 | break; |
whismanoid | 25:9d4012b0887f | 140 | } |
whismanoid | 25:9d4012b0887f | 141 | // case 'G'..'Z','g'..'z' are reserved for GPIO commands |
whismanoid | 25:9d4012b0887f | 142 | // case 'A'..'F','a'..'f' may be available if not claimed by bitstream commands |
whismanoid | 25:9d4012b0887f | 143 | case 'L': |
whismanoid | 25:9d4012b0887f | 144 | { |
whismanoid | 25:9d4012b0887f | 145 | switch (cmdLine[1]) |
whismanoid | 25:9d4012b0887f | 146 | { |
whismanoid | 25:9d4012b0887f | 147 | case 'H': |
whismanoid | 25:9d4012b0887f | 148 | { |
whismanoid | 25:9d4012b0887f | 149 | g_MAX5719_device.LDACboutputValue(1); |
whismanoid | 25:9d4012b0887f | 150 | break; |
whismanoid | 25:9d4012b0887f | 151 | } |
whismanoid | 25:9d4012b0887f | 152 | case 'L': |
whismanoid | 25:9d4012b0887f | 153 | { |
whismanoid | 25:9d4012b0887f | 154 | g_MAX5719_device.LDACboutputValue(0); |
whismanoid | 25:9d4012b0887f | 155 | break; |
whismanoid | 25:9d4012b0887f | 156 | } |
whismanoid | 25:9d4012b0887f | 157 | } |
whismanoid | 25:9d4012b0887f | 158 | return true; // command handled by MAX5719 |
whismanoid | 25:9d4012b0887f | 159 | break; |
whismanoid | 25:9d4012b0887f | 160 | } |
whismanoid | 25:9d4012b0887f | 161 | // case '0'..'9','A'..'F','a'..'f' letters are reserved for bitstream commands |
whismanoid | 25:9d4012b0887f | 162 | case '!': |
whismanoid | 25:9d4012b0887f | 163 | { |
whismanoid | 25:9d4012b0887f | 164 | // test menu command '!' handler: |
whismanoid | 25:9d4012b0887f | 165 | // helpString='! -- Init' |
whismanoid | 25:9d4012b0887f | 166 | // CMD_='None' |
whismanoid | 25:9d4012b0887f | 167 | // CommandName='Init' |
whismanoid | 25:9d4012b0887f | 168 | // CommandParamIn='void' |
whismanoid | 25:9d4012b0887f | 169 | // CommandReturnType='void' |
whismanoid | 25:9d4012b0887f | 170 | // @Pre='' |
whismanoid | 25:9d4012b0887f | 171 | // @Param[in]='' |
whismanoid | 25:9d4012b0887f | 172 | // @Param[out]='' |
whismanoid | 25:9d4012b0887f | 173 | // @Post='' |
whismanoid | 25:9d4012b0887f | 174 | // displayPost='' |
whismanoid | 25:9d4012b0887f | 175 | // @Return='' |
whismanoid | 25:9d4012b0887f | 176 | // @Test='@test group CODE_LOAD // Verify function CODE_LOAD vs platform AIN0 analog input (enabled by default)' |
whismanoid | 25:9d4012b0887f | 177 | // @Test='@test group CODE_LOAD tinyTester.print("VRef = 4.096 MAX5719 20-bit LSB = 0.000004V = 3.90625uV")' |
whismanoid | 25:9d4012b0887f | 178 | // @Test='@test group CODE_LOAD tinyTester.print("Wire MAX5719 OUT to platform AIN0 for analog loopback tests...")' |
whismanoid | 25:9d4012b0887f | 179 | // @Test='@test group CODE_LOAD VRef = 4.096' |
whismanoid | 25:9d4012b0887f | 180 | // @Test='@test group CODE_LOAD tinyTester.blink_time_msec = 75 // default 75 resume hardware self test' |
whismanoid | 25:9d4012b0887f | 181 | // @Test='@test group CODE_LOAD tinyTester.settle_time_msec = 500' |
whismanoid | 25:9d4012b0887f | 182 | // @Test='@test Init()' |
whismanoid | 25:9d4012b0887f | 183 | // @Test='@test VRef expect 4.096 // Nominal Full-Scale Voltage Reference' |
whismanoid | 25:9d4012b0887f | 184 | // @Test='@test group CODE_LOAD tinyTester.err_threshold = 0.050' |
whismanoid | 25:9d4012b0887f | 185 | // @Test='@test group CODE_LOAD tinyTester.print("0x000000 = 0.000V")' |
whismanoid | 25:9d4012b0887f | 186 | // @Test='@test group CODE_LOAD CODE_LOAD(0x000000) // 0.000V' |
whismanoid | 25:9d4012b0887f | 187 | // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()' |
whismanoid | 25:9d4012b0887f | 188 | // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(0.000000)' |
whismanoid | 25:9d4012b0887f | 189 | // @Test='@test group CODE_LOAD tinyTester.print("0x01f400 = 0.500V")' |
whismanoid | 25:9d4012b0887f | 190 | // @Test='@test group CODE_LOAD CODE_LOAD(0x01f400) // 0.500V' |
whismanoid | 25:9d4012b0887f | 191 | // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()' |
whismanoid | 25:9d4012b0887f | 192 | // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(0.500000)' |
whismanoid | 25:9d4012b0887f | 193 | // @Test='@test group CODE_LOAD tinyTester.print("0x03e800 = 1.000V")' |
whismanoid | 25:9d4012b0887f | 194 | // @Test='@test group CODE_LOAD CODE_LOAD(0x03e800) // 1.000V' |
whismanoid | 25:9d4012b0887f | 195 | // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()' |
whismanoid | 25:9d4012b0887f | 196 | // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(1.000000)' |
whismanoid | 25:9d4012b0887f | 197 | // @Test='@test group CODE_LOAD tinyTester.print("0x05dc00 = 1.500V")' |
whismanoid | 25:9d4012b0887f | 198 | // @Test='@test group CODE_LOAD CODE_LOAD(0x05dc00) // 1.500V' |
whismanoid | 25:9d4012b0887f | 199 | // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()' |
whismanoid | 25:9d4012b0887f | 200 | // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(1.500000)' |
whismanoid | 25:9d4012b0887f | 201 | // @Test='@test group CODE_LOAD tinyTester.print("0x07d000 = 2.000V")' |
whismanoid | 25:9d4012b0887f | 202 | // @Test='@test group CODE_LOAD CODE_LOAD(0x07d000) // 2.000V' |
whismanoid | 25:9d4012b0887f | 203 | // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()' |
whismanoid | 25:9d4012b0887f | 204 | // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(2.000000)' |
whismanoid | 25:9d4012b0887f | 205 | // @Test='@test group CODE_LOAD tinyTester.print("0x09c400 = 2.500V")' |
whismanoid | 25:9d4012b0887f | 206 | // @Test='@test group CODE_LOAD CODE_LOAD(0x09c400) // 2.500V' |
whismanoid | 25:9d4012b0887f | 207 | // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()' |
whismanoid | 25:9d4012b0887f | 208 | // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(2.500000)' |
whismanoid | 25:9d4012b0887f | 209 | // @Test='@test group CODE_LOAD tinyTester.print("0x0bb800 = 3.000V")' |
whismanoid | 25:9d4012b0887f | 210 | // @Test='@test group CODE_LOAD CODE_LOAD(0x0bb800) // 3.000V' |
whismanoid | 25:9d4012b0887f | 211 | // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()' |
whismanoid | 25:9d4012b0887f | 212 | // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(3.000000)' |
whismanoid | 25:9d4012b0887f | 213 | // @Test='@test group CODE_LOAD tinyTester.print("0x0dac00 = 3.500V")' |
whismanoid | 25:9d4012b0887f | 214 | // @Test='@test group CODE_LOAD CODE_LOAD(0x0dac00) // 3.500V' |
whismanoid | 25:9d4012b0887f | 215 | // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()' |
whismanoid | 25:9d4012b0887f | 216 | // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(3.500000)' |
whismanoid | 25:9d4012b0887f | 217 | // @Test='@test group CODE_LOAD tinyTester.print("0x0fa000 = 4.000V")' |
whismanoid | 25:9d4012b0887f | 218 | // @Test='@test group CODE_LOAD CODE_LOAD(0x0fa000) // 4.000V' |
whismanoid | 25:9d4012b0887f | 219 | // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()' |
whismanoid | 25:9d4012b0887f | 220 | // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(4.000000)' |
whismanoid | 25:9d4012b0887f | 221 | // @Test='@test group CODE_LOAD tinyTester.print("0x0fffff = 4.095V")' |
whismanoid | 25:9d4012b0887f | 222 | // @Test='@test group CODE_LOAD CODE_LOAD(0x0fffff) // 4.095V' |
whismanoid | 25:9d4012b0887f | 223 | // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()' |
whismanoid | 25:9d4012b0887f | 224 | // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(4.095000)' |
whismanoid | 25:9d4012b0887f | 225 | // @Test='@test group CODE_LOAD tinyTester.print("0x080000 // 2.048V")' |
whismanoid | 25:9d4012b0887f | 226 | // @Test='@test group CODE_LOAD CODE_LOAD(0x080000) // 2.048V' |
whismanoid | 25:9d4012b0887f | 227 | // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()' |
whismanoid | 25:9d4012b0887f | 228 | // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(2.048000)' |
whismanoid | 25:9d4012b0887f | 229 | cmdLine.serial().printf("Init"); |
whismanoid | 25:9d4012b0887f | 230 | // call function Init |
whismanoid | 25:9d4012b0887f | 231 | g_MAX5719_device.Init(); |
whismanoid | 25:9d4012b0887f | 232 | return true; // command handled by MAX5719 |
whismanoid | 25:9d4012b0887f | 233 | } // end case '!' |
whismanoid | 25:9d4012b0887f | 234 | break; |
whismanoid | 25:9d4012b0887f | 235 | case 'A': |
whismanoid | 25:9d4012b0887f | 236 | { |
whismanoid | 25:9d4012b0887f | 237 | // test menu command 'A' handler: |
whismanoid | 25:9d4012b0887f | 238 | // helpString='A code=? -- CODE' |
whismanoid | 25:9d4012b0887f | 239 | // CMD_='None' |
whismanoid | 25:9d4012b0887f | 240 | // CommandName='CODE' |
whismanoid | 25:9d4012b0887f | 241 | // CommandParamIn='uint32_t dacCodeLsbs' |
whismanoid | 25:9d4012b0887f | 242 | // CommandReturnType='uint8_t' |
whismanoid | 25:9d4012b0887f | 243 | // @Pre='' |
whismanoid | 25:9d4012b0887f | 244 | // @Param[in]='' |
whismanoid | 25:9d4012b0887f | 245 | // @Param[out]='' |
whismanoid | 25:9d4012b0887f | 246 | // @Post='' |
whismanoid | 25:9d4012b0887f | 247 | // displayPost='' |
whismanoid | 25:9d4012b0887f | 248 | // @Return='@return 1 on success; 0 on failure' |
whismanoid | 25:9d4012b0887f | 249 | // parse argument list |
whismanoid | 25:9d4012b0887f | 250 | // parse argument uint32_t dacCodeLsbs |
whismanoid | 25:9d4012b0887f | 251 | uint32_t dacCodeLsbs = 0; // --- g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__; // default to global property value |
whismanoid | 25:9d4012b0887f | 252 | if (cmdLine.parse_uint32_dec("dacCodeLsbs", dacCodeLsbs)) |
whismanoid | 25:9d4012b0887f | 253 | { |
whismanoid | 25:9d4012b0887f | 254 | // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value |
whismanoid | 25:9d4012b0887f | 255 | } |
whismanoid | 25:9d4012b0887f | 256 | // "code" is an alias for argument "dacCodeLsbs" |
whismanoid | 25:9d4012b0887f | 257 | if (cmdLine.parse_uint32_dec("code", dacCodeLsbs)) |
whismanoid | 25:9d4012b0887f | 258 | { |
whismanoid | 25:9d4012b0887f | 259 | // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value |
whismanoid | 25:9d4012b0887f | 260 | } |
whismanoid | 25:9d4012b0887f | 261 | // print arguments |
whismanoid | 25:9d4012b0887f | 262 | cmdLine.serial().printf("CODE"); |
whismanoid | 25:9d4012b0887f | 263 | cmdLine.serial().printf(" dacCodeLsbs=%ld", dacCodeLsbs); |
whismanoid | 25:9d4012b0887f | 264 | cmdLine.serial().printf("\r\n"); |
whismanoid | 25:9d4012b0887f | 265 | // call function CODE(dacCodeLsbs) |
whismanoid | 25:9d4012b0887f | 266 | uint8_t result = g_MAX5719_device.CODE(dacCodeLsbs); |
whismanoid | 25:9d4012b0887f | 267 | cmdLine.serial().printf(" =%d\r\n", result); |
whismanoid | 25:9d4012b0887f | 268 | return true; // command handled by MAX5719 |
whismanoid | 25:9d4012b0887f | 269 | } // end case 'A' |
whismanoid | 25:9d4012b0887f | 270 | break; |
whismanoid | 25:9d4012b0887f | 271 | case 'B': |
whismanoid | 25:9d4012b0887f | 272 | { |
whismanoid | 25:9d4012b0887f | 273 | // test menu command 'B' handler: |
whismanoid | 25:9d4012b0887f | 274 | // helpString='B -- LOAD' |
whismanoid | 25:9d4012b0887f | 275 | // CMD_='None' |
whismanoid | 25:9d4012b0887f | 276 | // CommandName='LOAD' |
whismanoid | 25:9d4012b0887f | 277 | // CommandParamIn='void' |
whismanoid | 25:9d4012b0887f | 278 | // CommandReturnType='uint8_t' |
whismanoid | 25:9d4012b0887f | 279 | // @Pre='' |
whismanoid | 25:9d4012b0887f | 280 | // @Param[in]='' |
whismanoid | 25:9d4012b0887f | 281 | // @Param[out]='' |
whismanoid | 25:9d4012b0887f | 282 | // @Post='' |
whismanoid | 25:9d4012b0887f | 283 | // displayPost='' |
whismanoid | 25:9d4012b0887f | 284 | // @Return='@return 1 on success; 0 on failure' |
whismanoid | 25:9d4012b0887f | 285 | cmdLine.serial().printf("LOAD"); |
whismanoid | 25:9d4012b0887f | 286 | // call function LOAD |
whismanoid | 25:9d4012b0887f | 287 | uint8_t result = g_MAX5719_device.LOAD(); |
whismanoid | 25:9d4012b0887f | 288 | cmdLine.serial().printf(" =%d\r\n", result); |
whismanoid | 25:9d4012b0887f | 289 | return true; // command handled by MAX5719 |
whismanoid | 25:9d4012b0887f | 290 | } // end case 'B' |
whismanoid | 25:9d4012b0887f | 291 | break; |
whismanoid | 25:9d4012b0887f | 292 | case 'C': |
whismanoid | 25:9d4012b0887f | 293 | { |
whismanoid | 25:9d4012b0887f | 294 | // test menu command 'C' handler: |
whismanoid | 25:9d4012b0887f | 295 | // helpString='C code=? -- CODE_LOAD' |
whismanoid | 25:9d4012b0887f | 296 | // CMD_='None' |
whismanoid | 25:9d4012b0887f | 297 | // CommandName='CODE_LOAD' |
whismanoid | 25:9d4012b0887f | 298 | // CommandParamIn='uint32_t dacCodeLsbs' |
whismanoid | 25:9d4012b0887f | 299 | // CommandReturnType='uint8_t' |
whismanoid | 25:9d4012b0887f | 300 | // @Pre='' |
whismanoid | 25:9d4012b0887f | 301 | // @Param[in]='' |
whismanoid | 25:9d4012b0887f | 302 | // @Param[out]='' |
whismanoid | 25:9d4012b0887f | 303 | // @Post='' |
whismanoid | 25:9d4012b0887f | 304 | // displayPost='' |
whismanoid | 25:9d4012b0887f | 305 | // @Return='@return 1 on success; 0 on failure' |
whismanoid | 25:9d4012b0887f | 306 | // parse argument list |
whismanoid | 25:9d4012b0887f | 307 | // parse argument uint32_t dacCodeLsbs |
whismanoid | 25:9d4012b0887f | 308 | uint32_t dacCodeLsbs = 0; // --- g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__; // default to global property value |
whismanoid | 25:9d4012b0887f | 309 | if (cmdLine.parse_uint32_dec("dacCodeLsbs", dacCodeLsbs)) |
whismanoid | 25:9d4012b0887f | 310 | { |
whismanoid | 25:9d4012b0887f | 311 | // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value |
whismanoid | 25:9d4012b0887f | 312 | } |
whismanoid | 25:9d4012b0887f | 313 | // "code" is an alias for argument "dacCodeLsbs" |
whismanoid | 25:9d4012b0887f | 314 | if (cmdLine.parse_uint32_dec("code", dacCodeLsbs)) |
whismanoid | 25:9d4012b0887f | 315 | { |
whismanoid | 25:9d4012b0887f | 316 | // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value |
whismanoid | 25:9d4012b0887f | 317 | } |
whismanoid | 25:9d4012b0887f | 318 | // print arguments |
whismanoid | 25:9d4012b0887f | 319 | cmdLine.serial().printf("CODE_LOAD"); |
whismanoid | 25:9d4012b0887f | 320 | cmdLine.serial().printf(" dacCodeLsbs=%ld", dacCodeLsbs); |
whismanoid | 25:9d4012b0887f | 321 | cmdLine.serial().printf("\r\n"); |
whismanoid | 25:9d4012b0887f | 322 | // call function CODE_LOAD(dacCodeLsbs) |
whismanoid | 25:9d4012b0887f | 323 | uint8_t result = g_MAX5719_device.CODE_LOAD(dacCodeLsbs); |
whismanoid | 25:9d4012b0887f | 324 | cmdLine.serial().printf(" =%d\r\n", result); |
whismanoid | 25:9d4012b0887f | 325 | return true; // command handled by MAX5719 |
whismanoid | 25:9d4012b0887f | 326 | } // end case 'C' |
whismanoid | 25:9d4012b0887f | 327 | break; |
whismanoid | 25:9d4012b0887f | 328 | } // end switch (cmdLine[0]) |
whismanoid | 25:9d4012b0887f | 329 | return false; // command not handled by MAX5719 |
whismanoid | 25:9d4012b0887f | 330 | } // end bool MAX5719_menu_onEOLcommandParser(CmdLine & cmdLine) |
whismanoid | 25:9d4012b0887f | 331 | |
whismanoid | 25:9d4012b0887f | 332 |