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

Committer:
whismanoid
Date:
Wed Jun 30 15:45:03 2021 -0700
Revision:
36:5d768b0d40d2
Parent:
35:eb705b9c219f
help string code=? | code=1.234V

Who changed what in which revision?

UserRevisionLine numberNew 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 36:5d768b0d40d2 93 cmdLine.serial().printf("\r\n A code=?|code=1.234V -- CODE");
whismanoid 25:9d4012b0887f 94 cmdLine.serial().printf("\r\n B -- LOAD");
whismanoid 36:5d768b0d40d2 95 cmdLine.serial().printf("\r\n C code=?|code=1.234V -- 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 28:bae17ff10fa7 117 // "code" is an alias for argument "DACCode"; support DACCodeOfVoltage
whismanoid 29:074e680ba5ea 118 { // enclose temporary voltageV
whismanoid 28:bae17ff10fa7 119 double voltageV; // support DACCodeOfVoltage
whismanoid 28:bae17ff10fa7 120 switch (cmdLine.parse_double_or_int32("code", voltageV, DACCode))
whismanoid 28:bae17ff10fa7 121 {
whismanoid 28:bae17ff10fa7 122 case 2: // 2: parsed as double
whismanoid 28:bae17ff10fa7 123 // parse_double_or_uint32 returns 1: parsed as integer; 2: parsed as double
whismanoid 28:bae17ff10fa7 124 DACCode = g_MAX5719_device.DACCodeOfVoltage((double)voltageV);
whismanoid 28:bae17ff10fa7 125 g_MAX5719_device.DACCode = DACCode; // update global property value
whismanoid 28:bae17ff10fa7 126 cmdLine.serial().printf("\r\nDACCodeOfVoltage(%1.6fV)=0x%6.6X\r\n", voltageV, g_MAX5719_device.DACCode);
whismanoid 28:bae17ff10fa7 127 break;
whismanoid 28:bae17ff10fa7 128 case 1: // 1: parsed as integer
whismanoid 28:bae17ff10fa7 129 g_MAX5719_device.DACCode = DACCode; // update global property value
whismanoid 28:bae17ff10fa7 130 break;
whismanoid 28:bae17ff10fa7 131 }
whismanoid 29:074e680ba5ea 132 } // enclose temporary voltageV
whismanoid 25:9d4012b0887f 133
whismanoid 25:9d4012b0887f 134 // parse argument double VRef
whismanoid 25:9d4012b0887f 135 double VRef = g_MAX5719_device.VRef; // default to global property value
whismanoid 25:9d4012b0887f 136 if (cmdLine.parse_double("VRef", VRef))
whismanoid 25:9d4012b0887f 137 {
whismanoid 25:9d4012b0887f 138 g_MAX5719_device.VRef = VRef; // update global property value
whismanoid 25:9d4012b0887f 139 }
whismanoid 25:9d4012b0887f 140
whismanoid 25:9d4012b0887f 141 switch (cmdLine[0])
whismanoid 25:9d4012b0887f 142 {
whismanoid 25:9d4012b0887f 143 case '@':
whismanoid 25:9d4012b0887f 144 {
whismanoid 25:9d4012b0887f 145 cmdLine.serial().printf("VRef = ");
whismanoid 25:9d4012b0887f 146 cmdLine.serial().printf("%1.6f\r\n", g_MAX5719_device.VRef);
whismanoid 25:9d4012b0887f 147 cmdLine.serial().printf("DACCode = ");
whismanoid 25:9d4012b0887f 148 cmdLine.serial().printf("%ld = 0x%8.8lx\r\n", g_MAX5719_device.DACCode, g_MAX5719_device.DACCode);
whismanoid 25:9d4012b0887f 149 return true; // command handled by MAX5719
whismanoid 25:9d4012b0887f 150 break;
whismanoid 25:9d4012b0887f 151 }
whismanoid 25:9d4012b0887f 152 // case 'G'..'Z','g'..'z' are reserved for GPIO commands
whismanoid 25:9d4012b0887f 153 // case 'A'..'F','a'..'f' may be available if not claimed by bitstream commands
whismanoid 25:9d4012b0887f 154 case 'L':
whismanoid 25:9d4012b0887f 155 {
whismanoid 25:9d4012b0887f 156 switch (cmdLine[1])
whismanoid 25:9d4012b0887f 157 {
whismanoid 25:9d4012b0887f 158 case 'H':
whismanoid 25:9d4012b0887f 159 {
whismanoid 25:9d4012b0887f 160 g_MAX5719_device.LDACboutputValue(1);
whismanoid 25:9d4012b0887f 161 break;
whismanoid 25:9d4012b0887f 162 }
whismanoid 25:9d4012b0887f 163 case 'L':
whismanoid 25:9d4012b0887f 164 {
whismanoid 25:9d4012b0887f 165 g_MAX5719_device.LDACboutputValue(0);
whismanoid 25:9d4012b0887f 166 break;
whismanoid 25:9d4012b0887f 167 }
whismanoid 25:9d4012b0887f 168 }
whismanoid 25:9d4012b0887f 169 return true; // command handled by MAX5719
whismanoid 25:9d4012b0887f 170 break;
whismanoid 25:9d4012b0887f 171 }
whismanoid 25:9d4012b0887f 172 // case '0'..'9','A'..'F','a'..'f' letters are reserved for bitstream commands
whismanoid 25:9d4012b0887f 173 case '!':
whismanoid 25:9d4012b0887f 174 {
whismanoid 25:9d4012b0887f 175 // test menu command '!' handler:
whismanoid 25:9d4012b0887f 176 // helpString='! -- Init'
whismanoid 25:9d4012b0887f 177 // CMD_='None'
whismanoid 25:9d4012b0887f 178 // CommandName='Init'
whismanoid 25:9d4012b0887f 179 // CommandParamIn='void'
whismanoid 25:9d4012b0887f 180 // CommandReturnType='void'
whismanoid 25:9d4012b0887f 181 // @Pre=''
whismanoid 25:9d4012b0887f 182 // @Param[in]=''
whismanoid 25:9d4012b0887f 183 // @Param[out]=''
whismanoid 25:9d4012b0887f 184 // @Post=''
whismanoid 25:9d4012b0887f 185 // displayPost=''
whismanoid 25:9d4012b0887f 186 // @Return=''
whismanoid 25:9d4012b0887f 187 // @Test='@test group CODE_LOAD // Verify function CODE_LOAD vs platform AIN0 analog input (enabled by default)'
whismanoid 25:9d4012b0887f 188 // @Test='@test group CODE_LOAD tinyTester.print("VRef = 4.096 MAX5719 20-bit LSB = 0.000004V = 3.90625uV")'
whismanoid 25:9d4012b0887f 189 // @Test='@test group CODE_LOAD tinyTester.print("Wire MAX5719 OUT to platform AIN0 for analog loopback tests...")'
whismanoid 25:9d4012b0887f 190 // @Test='@test group CODE_LOAD VRef = 4.096'
whismanoid 25:9d4012b0887f 191 // @Test='@test group CODE_LOAD tinyTester.blink_time_msec = 75 // default 75 resume hardware self test'
whismanoid 25:9d4012b0887f 192 // @Test='@test group CODE_LOAD tinyTester.settle_time_msec = 500'
whismanoid 25:9d4012b0887f 193 // @Test='@test Init()'
whismanoid 25:9d4012b0887f 194 // @Test='@test VRef expect 4.096 // Nominal Full-Scale Voltage Reference'
whismanoid 25:9d4012b0887f 195 // @Test='@test group CODE_LOAD tinyTester.err_threshold = 0.050'
whismanoid 25:9d4012b0887f 196 // @Test='@test group CODE_LOAD tinyTester.print("0x000000 = 0.000V")'
whismanoid 25:9d4012b0887f 197 // @Test='@test group CODE_LOAD CODE_LOAD(0x000000) // 0.000V'
whismanoid 25:9d4012b0887f 198 // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()'
whismanoid 25:9d4012b0887f 199 // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(0.000000)'
whismanoid 27:485b1b2f334c 200 // @Test='/*mbed:@test group CODE_LOAD tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 25:9d4012b0887f 201 // @Test='@test group CODE_LOAD tinyTester.print("0x01f400 = 0.500V")'
whismanoid 25:9d4012b0887f 202 // @Test='@test group CODE_LOAD CODE_LOAD(0x01f400) // 0.500V'
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(0.500000)'
whismanoid 27:485b1b2f334c 205 // @Test='/*mbed:@test group CODE_LOAD tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 25:9d4012b0887f 206 // @Test='@test group CODE_LOAD tinyTester.print("0x03e800 = 1.000V")'
whismanoid 25:9d4012b0887f 207 // @Test='@test group CODE_LOAD CODE_LOAD(0x03e800) // 1.000V'
whismanoid 25:9d4012b0887f 208 // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()'
whismanoid 25:9d4012b0887f 209 // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(1.000000)'
whismanoid 27:485b1b2f334c 210 // @Test='/*mbed:@test group CODE_LOAD tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 26:ec719cd9a579 211 // @Test='@test group CODE_LOAD tinyTester.err_threshold = /*Arduino:0.050*/ /*mbed:0.075*/ /*eabi:0.050*/'
whismanoid 25:9d4012b0887f 212 // @Test='@test group CODE_LOAD tinyTester.print("0x05dc00 = 1.500V")'
whismanoid 25:9d4012b0887f 213 // @Test='@test group CODE_LOAD CODE_LOAD(0x05dc00) // 1.500V'
whismanoid 25:9d4012b0887f 214 // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()'
whismanoid 25:9d4012b0887f 215 // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(1.500000)'
whismanoid 27:485b1b2f334c 216 // @Test='/*mbed:@test group CODE_LOAD tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 26:ec719cd9a579 217 // @Test='@test group CODE_LOAD tinyTester.err_threshold = /*Arduino:0.050*/ /*mbed:0.100*/ /*eabi:0.050*/'
whismanoid 25:9d4012b0887f 218 // @Test='@test group CODE_LOAD tinyTester.print("0x07d000 = 2.000V")'
whismanoid 25:9d4012b0887f 219 // @Test='@test group CODE_LOAD CODE_LOAD(0x07d000) // 2.000V'
whismanoid 25:9d4012b0887f 220 // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()'
whismanoid 25:9d4012b0887f 221 // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(2.000000)'
whismanoid 27:485b1b2f334c 222 // @Test='/*mbed:@test group CODE_LOAD tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 26:ec719cd9a579 223 // @Test='@test group CODE_LOAD tinyTester.err_threshold = /*Arduino:0.050*/ /*mbed:0.150*/ /*eabi:0.050*/'
whismanoid 25:9d4012b0887f 224 // @Test='@test group CODE_LOAD tinyTester.print("0x09c400 = 2.500V")'
whismanoid 25:9d4012b0887f 225 // @Test='@test group CODE_LOAD CODE_LOAD(0x09c400) // 2.500V'
whismanoid 25:9d4012b0887f 226 // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()'
whismanoid 25:9d4012b0887f 227 // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(2.500000)'
whismanoid 27:485b1b2f334c 228 // @Test='/*mbed:@test group CODE_LOAD tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 35:eb705b9c219f 229 // @Test='@test group CODE_LOAD tinyTester.err_threshold = /*Arduino:0.200*/ /*mbed:0.200*/ /*eabi:0.050*/'
whismanoid 25:9d4012b0887f 230 // @Test='@test group CODE_LOAD tinyTester.print("0x0bb800 = 3.000V")'
whismanoid 25:9d4012b0887f 231 // @Test='@test group CODE_LOAD CODE_LOAD(0x0bb800) // 3.000V'
whismanoid 25:9d4012b0887f 232 // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()'
whismanoid 25:9d4012b0887f 233 // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(3.000000)'
whismanoid 27:485b1b2f334c 234 // @Test='/*mbed:@test group CODE_LOAD tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 35:eb705b9c219f 235 // @Test='@test group CODE_LOAD tinyTester.err_threshold = /*Arduino:0.250*/ /*mbed:0.250*/ /*eabi:0.050*/'
whismanoid 25:9d4012b0887f 236 // @Test='@test group CODE_LOAD tinyTester.print("0x0dac00 = 3.500V")'
whismanoid 25:9d4012b0887f 237 // @Test='@test group CODE_LOAD CODE_LOAD(0x0dac00) // 3.500V'
whismanoid 25:9d4012b0887f 238 // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()'
whismanoid 25:9d4012b0887f 239 // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(3.500000)'
whismanoid 27:485b1b2f334c 240 // @Test='/*mbed:@test group CODE_LOAD tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 35:eb705b9c219f 241 // @Test='@test group CODE_LOAD tinyTester.err_threshold = /*Arduino:0.500*/ /*mbed:0.500*/ /*eabi:0.050*/'
whismanoid 25:9d4012b0887f 242 // @Test='@test group CODE_LOAD tinyTester.print("0x0fa000 = 4.000V")'
whismanoid 25:9d4012b0887f 243 // @Test='@test group CODE_LOAD CODE_LOAD(0x0fa000) // 4.000V'
whismanoid 25:9d4012b0887f 244 // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()'
whismanoid 25:9d4012b0887f 245 // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(4.000000)'
whismanoid 27:485b1b2f334c 246 // @Test='/*mbed:@test group CODE_LOAD tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 35:eb705b9c219f 247 // @Test='@test group CODE_LOAD tinyTester.err_threshold = /*Arduino:0.750*/ /*mbed:0.750*/ /*eabi:0.050*/'
whismanoid 25:9d4012b0887f 248 // @Test='@test group CODE_LOAD tinyTester.print("0x0fffff = 4.095V")'
whismanoid 25:9d4012b0887f 249 // @Test='@test group CODE_LOAD CODE_LOAD(0x0fffff) // 4.095V'
whismanoid 25:9d4012b0887f 250 // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()'
whismanoid 25:9d4012b0887f 251 // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(4.095000)'
whismanoid 27:485b1b2f334c 252 // @Test='/*mbed:@test group CODE_LOAD tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 35:eb705b9c219f 253 // @Test='@test group CODE_LOAD tinyTester.err_threshold = /*Arduino:0.200*/ /*mbed:0.200*/ /*eabi:0.050*/'
whismanoid 25:9d4012b0887f 254 // @Test='@test group CODE_LOAD tinyTester.print("0x080000 // 2.048V")'
whismanoid 25:9d4012b0887f 255 // @Test='@test group CODE_LOAD CODE_LOAD(0x080000) // 2.048V'
whismanoid 25:9d4012b0887f 256 // @Test='@test group CODE_LOAD tinyTester.Wait_Output_Settling()'
whismanoid 25:9d4012b0887f 257 // @Test='@test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(2.048000)'
whismanoid 27:485b1b2f334c 258 // @Test='/*mbed:@test group CODE_LOAD tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 33:2c675744a01b 259 // @Test='@test group CODE_LOAD_2V5 // Verify function CODE_LOAD vs platform AIN0 analog input (enabled by default) (no run on button)'
whismanoid 35:eb705b9c219f 260 // @Test='@test group CODE_LOAD_2V5 tinyTester.err_threshold = /*Arduino:0.150*/ /*mbed:0.150*/ /*eabi:0.050*/'
whismanoid 33:2c675744a01b 261 // @Test='@test group CODE_LOAD_2V5 tinyTester.print("0x09c400 = 2.500V")'
whismanoid 33:2c675744a01b 262 // @Test='@test group CODE_LOAD_2V5 CODE_LOAD(0x09c400) // 2.500V'
whismanoid 33:2c675744a01b 263 // @Test='@test group CODE_LOAD_2V5 tinyTester.Wait_Output_Settling()'
whismanoid 33:2c675744a01b 264 // @Test='@test group CODE_LOAD_2V5 tinyTester.AnalogIn0_Read_Expect_voltageV(2.500000)'
whismanoid 33:2c675744a01b 265 // @Test='/*mbed:@test group CODE_LOAD_2V5 tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 33:2c675744a01b 266 // @Test='@test group CODE_LOAD_3V0 // Verify function CODE_LOAD vs platform AIN0 analog input (enabled by default) (no run on button)'
whismanoid 35:eb705b9c219f 267 // @Test='@test group CODE_LOAD_3V0 tinyTester.err_threshold = /*Arduino:0.200*/ /*mbed:0.200*/ /*eabi:0.050*/'
whismanoid 33:2c675744a01b 268 // @Test='@test group CODE_LOAD_3V0 tinyTester.print("0x0bb800 = 3.000V")'
whismanoid 33:2c675744a01b 269 // @Test='@test group CODE_LOAD_3V0 CODE_LOAD(0x0bb800) // 3.000V'
whismanoid 33:2c675744a01b 270 // @Test='@test group CODE_LOAD_3V0 tinyTester.Wait_Output_Settling()'
whismanoid 33:2c675744a01b 271 // @Test='@test group CODE_LOAD_3V0 tinyTester.AnalogIn0_Read_Expect_voltageV(3.000000)'
whismanoid 33:2c675744a01b 272 // @Test='/*mbed:@test group CODE_LOAD_3V0 tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 33:2c675744a01b 273 // @Test='@test group CODE_LOAD_4V1 // Verify function CODE_LOAD vs platform AIN0 analog input (enabled by default) (no run on button)'
whismanoid 35:eb705b9c219f 274 // @Test='@test group CODE_LOAD_4V1 tinyTester.err_threshold = /*Arduino:0.750*/ /*mbed:0.750*/ /*eabi:0.050*/'
whismanoid 33:2c675744a01b 275 // @Test='@test group CODE_LOAD_4V1 tinyTester.print("0x0fffff = 4.095V")'
whismanoid 33:2c675744a01b 276 // @Test='@test group CODE_LOAD_4V1 CODE_LOAD(0x0fffff) // 4.095V'
whismanoid 33:2c675744a01b 277 // @Test='@test group CODE_LOAD_4V1 tinyTester.Wait_Output_Settling()'
whismanoid 33:2c675744a01b 278 // @Test='@test group CODE_LOAD_4V1 tinyTester.AnalogIn0_Read_Expect_voltageV(4.095000)'
whismanoid 33:2c675744a01b 279 // @Test='/*mbed:@test group CODE_LOAD_4V1 tinyTester.AnalogIn1_Read_Report_voltageV(); // remove unwanted loading on AIN0 */'
whismanoid 25:9d4012b0887f 280 cmdLine.serial().printf("Init");
whismanoid 25:9d4012b0887f 281 // call function Init
whismanoid 25:9d4012b0887f 282 g_MAX5719_device.Init();
whismanoid 25:9d4012b0887f 283 return true; // command handled by MAX5719
whismanoid 25:9d4012b0887f 284 } // end case '!'
whismanoid 25:9d4012b0887f 285 break;
whismanoid 25:9d4012b0887f 286 case 'A':
whismanoid 25:9d4012b0887f 287 {
whismanoid 25:9d4012b0887f 288 // test menu command 'A' handler:
whismanoid 36:5d768b0d40d2 289 // helpString='A code=?|code=1.234V -- CODE'
whismanoid 25:9d4012b0887f 290 // CMD_='None'
whismanoid 25:9d4012b0887f 291 // CommandName='CODE'
whismanoid 25:9d4012b0887f 292 // CommandParamIn='uint32_t dacCodeLsbs'
whismanoid 25:9d4012b0887f 293 // CommandReturnType='uint8_t'
whismanoid 25:9d4012b0887f 294 // @Pre=''
whismanoid 25:9d4012b0887f 295 // @Param[in]=''
whismanoid 25:9d4012b0887f 296 // @Param[out]=''
whismanoid 25:9d4012b0887f 297 // @Post=''
whismanoid 25:9d4012b0887f 298 // displayPost=''
whismanoid 25:9d4012b0887f 299 // @Return='@return 1 on success; 0 on failure'
whismanoid 25:9d4012b0887f 300 // parse argument list
whismanoid 25:9d4012b0887f 301 // parse argument uint32_t dacCodeLsbs
whismanoid 25:9d4012b0887f 302 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 303 if (cmdLine.parse_uint32_dec("dacCodeLsbs", dacCodeLsbs))
whismanoid 25:9d4012b0887f 304 {
whismanoid 25:9d4012b0887f 305 // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value
whismanoid 25:9d4012b0887f 306 }
whismanoid 28:bae17ff10fa7 307 // "code" is an alias for argument "dacCodeLsbs"; support DACCodeOfVoltage
whismanoid 29:074e680ba5ea 308 { // enclose temporary voltageV
whismanoid 28:bae17ff10fa7 309 double voltageV; // support DACCodeOfVoltage
whismanoid 28:bae17ff10fa7 310 switch (cmdLine.parse_double_or_uint32("code", voltageV, dacCodeLsbs))
whismanoid 28:bae17ff10fa7 311 {
whismanoid 28:bae17ff10fa7 312 case 2: // 2: parsed as double
whismanoid 28:bae17ff10fa7 313 // parse_double_or_uint32 returns 1: parsed as integer; 2: parsed as double
whismanoid 28:bae17ff10fa7 314 dacCodeLsbs = g_MAX5719_device.DACCodeOfVoltage((double)voltageV);
whismanoid 29:074e680ba5ea 315 // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value
whismanoid 28:bae17ff10fa7 316 cmdLine.serial().printf("\r\nDACCodeOfVoltage(%1.6fV)=0x%6.6X\r\n", voltageV, dacCodeLsbs);
whismanoid 28:bae17ff10fa7 317 break;
whismanoid 28:bae17ff10fa7 318 case 1: // 1: parsed as integer
whismanoid 29:074e680ba5ea 319 // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value
whismanoid 28:bae17ff10fa7 320 break;
whismanoid 28:bae17ff10fa7 321 }
whismanoid 29:074e680ba5ea 322 } // enclose temporary voltageV
whismanoid 25:9d4012b0887f 323 // print arguments
whismanoid 25:9d4012b0887f 324 cmdLine.serial().printf("CODE");
whismanoid 25:9d4012b0887f 325 cmdLine.serial().printf(" dacCodeLsbs=%ld", dacCodeLsbs);
whismanoid 25:9d4012b0887f 326 cmdLine.serial().printf("\r\n");
whismanoid 25:9d4012b0887f 327 // call function CODE(dacCodeLsbs)
whismanoid 25:9d4012b0887f 328 uint8_t result = g_MAX5719_device.CODE(dacCodeLsbs);
whismanoid 25:9d4012b0887f 329 cmdLine.serial().printf(" =%d\r\n", result);
whismanoid 25:9d4012b0887f 330 return true; // command handled by MAX5719
whismanoid 25:9d4012b0887f 331 } // end case 'A'
whismanoid 25:9d4012b0887f 332 break;
whismanoid 25:9d4012b0887f 333 case 'B':
whismanoid 25:9d4012b0887f 334 {
whismanoid 25:9d4012b0887f 335 // test menu command 'B' handler:
whismanoid 25:9d4012b0887f 336 // helpString='B -- LOAD'
whismanoid 25:9d4012b0887f 337 // CMD_='None'
whismanoid 25:9d4012b0887f 338 // CommandName='LOAD'
whismanoid 25:9d4012b0887f 339 // CommandParamIn='void'
whismanoid 25:9d4012b0887f 340 // CommandReturnType='uint8_t'
whismanoid 25:9d4012b0887f 341 // @Pre=''
whismanoid 25:9d4012b0887f 342 // @Param[in]=''
whismanoid 25:9d4012b0887f 343 // @Param[out]=''
whismanoid 25:9d4012b0887f 344 // @Post=''
whismanoid 25:9d4012b0887f 345 // displayPost=''
whismanoid 25:9d4012b0887f 346 // @Return='@return 1 on success; 0 on failure'
whismanoid 25:9d4012b0887f 347 cmdLine.serial().printf("LOAD");
whismanoid 25:9d4012b0887f 348 // call function LOAD
whismanoid 25:9d4012b0887f 349 uint8_t result = g_MAX5719_device.LOAD();
whismanoid 25:9d4012b0887f 350 cmdLine.serial().printf(" =%d\r\n", result);
whismanoid 25:9d4012b0887f 351 return true; // command handled by MAX5719
whismanoid 25:9d4012b0887f 352 } // end case 'B'
whismanoid 25:9d4012b0887f 353 break;
whismanoid 25:9d4012b0887f 354 case 'C':
whismanoid 25:9d4012b0887f 355 {
whismanoid 25:9d4012b0887f 356 // test menu command 'C' handler:
whismanoid 36:5d768b0d40d2 357 // helpString='C code=?|code=1.234V -- CODE_LOAD'
whismanoid 25:9d4012b0887f 358 // CMD_='None'
whismanoid 25:9d4012b0887f 359 // CommandName='CODE_LOAD'
whismanoid 25:9d4012b0887f 360 // CommandParamIn='uint32_t dacCodeLsbs'
whismanoid 25:9d4012b0887f 361 // CommandReturnType='uint8_t'
whismanoid 25:9d4012b0887f 362 // @Pre=''
whismanoid 25:9d4012b0887f 363 // @Param[in]=''
whismanoid 25:9d4012b0887f 364 // @Param[out]=''
whismanoid 25:9d4012b0887f 365 // @Post=''
whismanoid 25:9d4012b0887f 366 // displayPost=''
whismanoid 25:9d4012b0887f 367 // @Return='@return 1 on success; 0 on failure'
whismanoid 25:9d4012b0887f 368 // parse argument list
whismanoid 25:9d4012b0887f 369 // parse argument uint32_t dacCodeLsbs
whismanoid 25:9d4012b0887f 370 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 371 if (cmdLine.parse_uint32_dec("dacCodeLsbs", dacCodeLsbs))
whismanoid 25:9d4012b0887f 372 {
whismanoid 25:9d4012b0887f 373 // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value
whismanoid 25:9d4012b0887f 374 }
whismanoid 28:bae17ff10fa7 375 // "code" is an alias for argument "dacCodeLsbs"; support DACCodeOfVoltage
whismanoid 29:074e680ba5ea 376 { // enclose temporary voltageV
whismanoid 28:bae17ff10fa7 377 double voltageV; // support DACCodeOfVoltage
whismanoid 28:bae17ff10fa7 378 switch (cmdLine.parse_double_or_uint32("code", voltageV, dacCodeLsbs))
whismanoid 28:bae17ff10fa7 379 {
whismanoid 28:bae17ff10fa7 380 case 2: // 2: parsed as double
whismanoid 28:bae17ff10fa7 381 // parse_double_or_uint32 returns 1: parsed as integer; 2: parsed as double
whismanoid 28:bae17ff10fa7 382 dacCodeLsbs = g_MAX5719_device.DACCodeOfVoltage((double)voltageV);
whismanoid 29:074e680ba5ea 383 // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value
whismanoid 28:bae17ff10fa7 384 cmdLine.serial().printf("\r\nDACCodeOfVoltage(%1.6fV)=0x%6.6X\r\n", voltageV, dacCodeLsbs);
whismanoid 28:bae17ff10fa7 385 break;
whismanoid 28:bae17ff10fa7 386 case 1: // 1: parsed as integer
whismanoid 29:074e680ba5ea 387 // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value
whismanoid 28:bae17ff10fa7 388 break;
whismanoid 28:bae17ff10fa7 389 }
whismanoid 29:074e680ba5ea 390 } // enclose temporary voltageV
whismanoid 25:9d4012b0887f 391 // print arguments
whismanoid 25:9d4012b0887f 392 cmdLine.serial().printf("CODE_LOAD");
whismanoid 25:9d4012b0887f 393 cmdLine.serial().printf(" dacCodeLsbs=%ld", dacCodeLsbs);
whismanoid 25:9d4012b0887f 394 cmdLine.serial().printf("\r\n");
whismanoid 25:9d4012b0887f 395 // call function CODE_LOAD(dacCodeLsbs)
whismanoid 25:9d4012b0887f 396 uint8_t result = g_MAX5719_device.CODE_LOAD(dacCodeLsbs);
whismanoid 25:9d4012b0887f 397 cmdLine.serial().printf(" =%d\r\n", result);
whismanoid 25:9d4012b0887f 398 return true; // command handled by MAX5719
whismanoid 25:9d4012b0887f 399 } // end case 'C'
whismanoid 25:9d4012b0887f 400 break;
whismanoid 25:9d4012b0887f 401 } // end switch (cmdLine[0])
whismanoid 25:9d4012b0887f 402 return false; // command not handled by MAX5719
whismanoid 25:9d4012b0887f 403 } // end bool MAX5719_menu_onEOLcommandParser(CmdLine & cmdLine)
whismanoid 25:9d4012b0887f 404