Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.

Dependencies:   MaximTinyTester CmdLine MAX541 USBDevice

Files at this revision

API Documentation at this revision

Comitter:
whismanoid
Date:
Wed Feb 19 00:52:33 2020 +0000
Parent:
63:8f39d21d6157
Child:
65:2117e32f017d
Commit message:
menu items, conflict G gain vs CONVRUN pin name?

Changed in this revision

MAX11043/MAX11043.cpp Show annotated file Show diff for this revision Revisions of this file
MAX11043/MAX11043.h Show annotated file Show diff for this revision Revisions of this file
Test_Menu_MAX11043.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MAX11043/MAX11043.cpp	Tue Feb 18 09:25:29 2020 +0000
+++ b/MAX11043/MAX11043.cpp	Wed Feb 19 00:52:33 2020 +0000
@@ -1069,6 +1069,50 @@
 }
 
 //----------------------------------------
+// Menu item '$' -> adca, adcb, adcc, adcd
+// Read ADCabcd
+//
+// @return 1 on success; 0 on failure
+uint8_t MAX11043::Read_ADCabcd(void)
+{
+    
+    //----------------------------------------
+    // warning -- WIP work in progress
+    #warning "Not Tested Yet: MAX11043::Read_ADCabcd..."
+    
+    //----------------------------------------
+    // read register ADCabcd -> &adca, &adcb, &adcc, &adcd
+    RegRead(CMD_0001_1010_d16o8_d16o8_d16o8_d16o8_Rd06_ADCabcd, 0);
+    
+    //----------------------------------------
+    // success
+    return 1;
+}
+
+//----------------------------------------
+// Menu item 'JA'
+// Write AGain register
+//
+// @param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000
+//
+// @return 1 on success; 0 on failure
+uint8_t MAX11043::Write_AGain(uint32_t gain)
+{
+    
+    //----------------------------------------
+    // warning -- WIP work in progress
+    #warning "Not Tested Yet: MAX11043::Write_AGain..."
+    
+    //----------------------------------------
+    // write register
+    RegWrite(CMD_0100_0100_d16_Wr11_AGain, gain);
+    
+    //----------------------------------------
+    // success
+    return 1;
+}
+
+//----------------------------------------
 // Menu item 'XX'
 //
 // @return 1 on success; 0 on failure
--- a/MAX11043/MAX11043.h	Tue Feb 18 09:25:29 2020 +0000
+++ b/MAX11043/MAX11043.h	Wed Feb 19 00:52:33 2020 +0000
@@ -824,6 +824,22 @@
     const char* RegName(MAX11043_CMD_enum_t commandByte);
 
     //----------------------------------------
+    /// Menu item '$' -> adca, adcb, adcc, adcd
+    /// Read ADCabcd
+    ///
+    /// @return 1 on success; 0 on failure
+    uint8_t Read_ADCabcd(void);
+
+    //----------------------------------------
+    /// Menu item 'JA'
+    /// Write AGain register
+    ///
+    /// @param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000
+    ///
+    /// @return 1 on success; 0 on failure
+    uint8_t Write_AGain(uint32_t gain);
+
+    //----------------------------------------
     /// Menu item 'XX'
     ///
     /// @return 1 on success; 0 on failure
--- a/Test_Menu_MAX11043.cpp	Tue Feb 18 09:25:29 2020 +0000
+++ b/Test_Menu_MAX11043.cpp	Wed Feb 19 00:52:33 2020 +0000
@@ -110,6 +110,36 @@
 // CODE GENERATOR: no Menu item hint in description
 // CODE GENERATOR: MAX11043 Command Name = RegName (MAX11043_CMD_enum_t commandByte) --> const char*
 // CODE GENERATOR: no Menu item hint in description
+// CODE GENERATOR: MAX11043 Command Name = Read_ADCabcd (void) --> uint8_t
+// CODE GENERATOR: Menu item hint description Menu item '$' -> adca, adcb, adcc, adcd
+// CODE GENERATOR: Menu item '$' -> adca, adcb, adcc, adcd -- Menu item $
+// CODE GENERATOR: test menu case '$':
+// CODE GENERATOR:           helpString '$ -- Read_ADCabcd'
+// CODE GENERATOR:           CMD_ 'None'
+// CODE GENERATOR:           CommandName 'Read_ADCabcd'
+// CODE GENERATOR:           CommandParamIn 'void'
+// CODE GENERATOR:           CommandReturnType 'uint8_t'
+// CODE GENERATOR:           CommandPre ''
+// CODE GENERATOR:           CommandDocParamIn ''
+// CODE GENERATOR:           CommandDocParamOut ''
+// CODE GENERATOR:           CommandPost ''
+// CODE GENERATOR:           CommandReturn '@return 1 on success; 0 on failure'
+// CODE GENERATOR: MAX11043 Command Name = Write_AGain (uint32_t gain) --> uint8_t
+// CODE GENERATOR: Menu item hint description Menu item 'JA'
+// CODE GENERATOR: Menu item 'JA' -- Menu item JA
+// CODE GENERATOR: MAX11043 help: JA uint32_t gain -- Write_AGain
+// CODE GENERATOR: MAX11043 helpString: 'JA gain=? -- Write_AGain'
+// CODE GENERATOR: test menu case 'JA':
+// CODE GENERATOR:           helpString 'JA gain=? -- Write_AGain'
+// CODE GENERATOR:           CMD_ 'None'
+// CODE GENERATOR:           CommandName 'Write_AGain'
+// CODE GENERATOR:           CommandParamIn 'uint32_t gain'
+// CODE GENERATOR:           CommandReturnType 'uint8_t'
+// CODE GENERATOR:           CommandPre ''
+// 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'
+// CODE GENERATOR:           CommandDocParamOut ''
+// CODE GENERATOR:           CommandPost ''
+// CODE GENERATOR:           CommandReturn '@return 1 on success; 0 on failure'
 // CODE GENERATOR: MAX11043 Command Name = Configure_XXXXX (uint8_t linef, uint8_t rate) --> uint8_t
 // CODE GENERATOR: Menu item hint description Menu item 'XX'
 // CODE GENERATOR: Menu item 'XX' -- Menu item XX
@@ -204,6 +234,10 @@
 // CODE GENERATOR: multiple commands begin with character 'X'
 // CODE GENERATOR: shorten testMenuCommand to single character if unambiguous
 // CODE GENERATOR: testMenuCommand '!' already single character
+// CODE GENERATOR: testMenuCommand '$' already single character
+// CODE GENERATOR: shorten testMenuCommand 'JA' to single character 'J'
+// CODE GENERATOR: re.sub pattern:'JA' with repl:'J' in helpString 'JA gain=? -- Write_AGain'
+// CODE GENERATOR: updated 'J' help string to 'J gain=? -- Write_AGain'
 // CODE GENERATOR: cannot shorten testMenuCommand 'XX' to single character due to duplicates
 // CODE GENERATOR: cannot shorten testMenuCommand 'XY' to single character due to duplicates
 
@@ -213,6 +247,12 @@
     // CODE GENERATOR: command: !
     // CODE GENERATOR: help: ! -- Init
     cmdLine.serial().printf("\r\n ! -- Init");
+    // CODE GENERATOR: command: $
+    // CODE GENERATOR: help: $ -- Read_ADCabcd
+    cmdLine.serial().printf("\r\n $ -- Read_ADCabcd");
+    // CODE GENERATOR: command: J
+    // CODE GENERATOR: help: J gain=? -- Write_AGain
+    cmdLine.serial().printf("\r\n J gain=? -- Write_AGain");
     // CODE GENERATOR: command: XX
     // CODE GENERATOR: help: XX linef=? rate=? -- Configure_XXXXX
     cmdLine.serial().printf("\r\n XX linef=? rate=? -- Configure_XXXXX");
@@ -658,6 +698,94 @@
         } // end case '!'
         break;
 
+// CODE GENERATOR: top of loop: testMenuCommand="$", testMenuFirstCharHandler="None"
+// CODE GENERATOR: test menu case '$':
+// CODE GENERATOR:           helpString '$ -- Read_ADCabcd'
+// CODE GENERATOR:           CMD_ 'None'
+// CODE GENERATOR:           CommandName 'Read_ADCabcd'
+// CODE GENERATOR:           CommandParamIn 'void'
+// CODE GENERATOR:           CommandReturnType 'uint8_t'
+// CODE GENERATOR:           CommandPre ''
+// CODE GENERATOR:           CommandDocParamIn ''
+// CODE GENERATOR:           CommandDocParamOut ''
+// CODE GENERATOR:           CommandPost ''
+// CODE GENERATOR:           CommandReturn '@return 1 on success; 0 on failure'
+        // case '$': // (single character) (testMenuFirstCharHandler="None")
+        case '$':
+        {
+                    // test menu command '$' handler:
+                    // helpString='$ -- Read_ADCabcd'
+                    // CMD_='None'
+                    // CommandName='Read_ADCabcd'
+                    // CommandParamIn='void'
+                    // CommandReturnType='uint8_t'
+                    // @Pre=''
+                    // @Param[in]=''
+                    // @Param[out]=''
+                    // @Post=''
+                    // displayPost='adca, adcb, adcc, adcd'
+                    // @Return='@return 1 on success; 0 on failure'
+                    cmdLine.serial().printf("Read_ADCabcd");
+                    // call function Read_ADCabcd
+                    uint8_t result = g_MAX11043_device.Read_ADCabcd();
+                    cmdLine.serial().printf(" =%d", result);
+                    // Menu item '$' -> adca, adcb, adcc, adcd
+                    cmdLine.serial().printf("%s=%d\r\n", "adca", g_MAX11043_device.adca);
+                    cmdLine.serial().printf("%s=%d\r\n", "adcb", g_MAX11043_device.adcb);
+                    cmdLine.serial().printf("%s=%d\r\n", "adcc", g_MAX11043_device.adcc);
+                    cmdLine.serial().printf("%s=%d\r\n", "adcd", g_MAX11043_device.adcd);
+                    return true; // command handled by MAX11043
+// CODE GENERATOR: bottom of loop: testMenuCommand="$", testMenuFirstCharHandler="None"
+        } // end case '$'
+        break;
+
+// CODE GENERATOR: top of loop: testMenuCommand="J", testMenuFirstCharHandler="None"
+// CODE GENERATOR: test menu case 'J':
+// CODE GENERATOR:           helpString 'J gain=? -- Write_AGain'
+// CODE GENERATOR:           CMD_ 'None'
+// CODE GENERATOR:           CommandName 'Write_AGain'
+// CODE GENERATOR:           CommandParamIn 'uint32_t gain'
+// CODE GENERATOR:           CommandReturnType 'uint8_t'
+// CODE GENERATOR:           CommandPre ''
+// 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'
+// CODE GENERATOR:           CommandDocParamOut ''
+// CODE GENERATOR:           CommandPost ''
+// CODE GENERATOR:           CommandReturn '@return 1 on success; 0 on failure'
+        // case 'J': // (single character) (testMenuFirstCharHandler="None")
+        case 'J':
+        {
+                    // test menu command 'J' handler:
+                    // helpString='J gain=? -- Write_AGain'
+                    // CMD_='None'
+                    // CommandName='Write_AGain'
+                    // CommandParamIn='uint32_t gain'
+                    // CommandReturnType='uint8_t'
+                    // @Pre=''
+                    // @Param[in]='@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000'
+                    // @Param[out]=''
+                    // @Post=''
+                    // displayPost=''
+                    // @Return='@return 1 on success; 0 on failure'
+                    // parse argument list
+                    // 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'
+                    // parse argument uint32_t gain
+                    uint32_t gain = (uint32_t)0x2000; // --- g_MAX11043_device.__WARNING_no_match_for_argname_gain_in_MAX11043_device_t__; // default to global property value
+                    if (cmdLine.parse_uint32_dec("gain", gain))
+                    {
+                        // g_MAX11043_device.__WARNING_no_match_for_argname_gain_in_MAX11043_device_t__ = gain; // update global property value
+                    }
+                    // print arguments
+                    cmdLine.serial().printf("Write_AGain");
+                    cmdLine.serial().printf(" gain=%d", gain);
+                    cmdLine.serial().printf("\r\n");
+                    // call function Write_AGain(gain)
+                    uint8_t result = g_MAX11043_device.Write_AGain(gain);
+                    cmdLine.serial().printf(" =%d\r\n", result);
+                    return true; // command handled by MAX11043
+// CODE GENERATOR: bottom of loop: testMenuCommand="J", testMenuFirstCharHandler="None"
+        } // end case 'J'
+        break;
+
 // CODE GENERATOR: top of loop: testMenuCommand="XX", testMenuFirstCharHandler="None"
 // CODE GENERATOR: test menu case 'XX':
 // CODE GENERATOR:           helpString 'XX linef=? rate=? -- Configure_XXXXX'