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

Dependencies:   MaximTinyTester CmdLine MAX541 USBDevice

Committer:
whismanoid
Date:
Wed Mar 04 10:03:12 2020 +0000
Revision:
93:6b22269935a6
Parent:
92:ce099f7cfd4b
ADCVoltageOfCode_16bit; fix typo Write_AGain 0x2000=1V/V not 1VV/V; onButton2FallingEdge call optional Configure_Demo(); blue LED on

Who changed what in which revision?

UserRevisionLine numberNew 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 83:29bb86cc45bc 32 // */ * MANUAL EDITS PRESENT *
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 84:11cc360628a1 82 //--------------------------------------------------
whismanoid 84:11cc360628a1 83 // Diagnostic: Read 4 command -- Single 4-channel read: CONVRUN pulsed H then L, EOC ignored.
whismanoid 84:11cc360628a1 84 #ifndef Has_Read4Command_Command
whismanoid 84:11cc360628a1 85 #define Has_Read4Command_Command 1
whismanoid 84:11cc360628a1 86 #endif // Has_Read4Command_Command
whismanoid 84:11cc360628a1 87 #if Has_Read4Command_Command
whismanoid 84:11cc360628a1 88 #endif // Has_Read4Command_Command
whismanoid 84:11cc360628a1 89 //--------------------------------------------------
whismanoid 84:11cc360628a1 90 // Diagnostic: Read 4 command -- Single 4-channel read: CONVRUN pulsed H then L, EOC ignored.
whismanoid 84:11cc360628a1 91 #ifndef Use_Read4Command_Thread
whismanoid 84:11cc360628a1 92 #define Use_Read4Command_Thread 1
whismanoid 84:11cc360628a1 93 #endif // Use_Read4Command_Thread
whismanoid 84:11cc360628a1 94 #if Use_Read4Command_Thread
whismanoid 84:11cc360628a1 95 #endif // Use_Read4Command_Thread
whismanoid 84:11cc360628a1 96
whismanoid 84:11cc360628a1 97 //--------------------------------------------------
whismanoid 84:11cc360628a1 98 // Diagnostic: Use MAX32625MBED pin D5 as DigitalOut EOC#-detected
whismanoid 84:11cc360628a1 99 #ifndef MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 84:11cc360628a1 100 #define MAX11043_ScopeTrigger_MAX32625MBED_D5 1
whismanoid 84:11cc360628a1 101 #endif // MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 84:11cc360628a1 102 #if MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 84:11cc360628a1 103 // Diagnostic: Use MAX32625MBED pin D5 as DigitalOut EOC#-detected
whismanoid 84:11cc360628a1 104 // WIP MAX11043 interrupt EOC echo - moving DigitalOut ScopeTrigger to global scope, it compiles but there is no activity on scope
whismanoid 84:11cc360628a1 105 extern DigitalInOut digitalInOut5; // declared in Test_Main_MAX11043.cpp (D5, PIN_INPUT, PullUp, 1)
whismanoid 84:11cc360628a1 106 #endif // MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 84:11cc360628a1 107
whismanoid 84:11cc360628a1 108 #if Use_Read4Command_Thread
whismanoid 88:e4fd5033a55f 109 #define MYTIMEREVENTFLAG_ENABLE_SPI (1UL << 0)
whismanoid 88:e4fd5033a55f 110 #define MYTIMEREVENTFLAG_RESET_MINMAX (1UL << 1)
whismanoid 88:e4fd5033a55f 111 #define MYTIMEREVENTFLAG_FAKE_DATA (1UL << 2)
whismanoid 84:11cc360628a1 112 EventFlags Read4Command_Thread_event_flags;
whismanoid 84:11cc360628a1 113 Thread Read4Command_Thread;
whismanoid 87:4bc981dfd54b 114 int adca_newest = 0;
whismanoid 87:4bc981dfd54b 115 int adcb_newest = 0;
whismanoid 87:4bc981dfd54b 116 int adcc_newest = 0;
whismanoid 87:4bc981dfd54b 117 int adcd_newest = 0;
whismanoid 87:4bc981dfd54b 118 int adcX_MIN_SEEN_INIT_INT16_MAX = 0x7FFF; // INT16_MAX
whismanoid 87:4bc981dfd54b 119 int adcX_MAX_SEEN_INIT_INT16_MIN = 0x8000; // INT16_MIN
whismanoid 87:4bc981dfd54b 120 int adca_MIN_SEEN = adcX_MIN_SEEN_INIT_INT16_MAX;
whismanoid 87:4bc981dfd54b 121 int adca_MAX_SEEN = adcX_MAX_SEEN_INIT_INT16_MIN;
whismanoid 87:4bc981dfd54b 122 int adcb_MIN_SEEN = adcX_MIN_SEEN_INIT_INT16_MAX;
whismanoid 87:4bc981dfd54b 123 int adcb_MAX_SEEN = adcX_MAX_SEEN_INIT_INT16_MIN;
whismanoid 87:4bc981dfd54b 124 int adcc_MIN_SEEN = adcX_MIN_SEEN_INIT_INT16_MAX;
whismanoid 87:4bc981dfd54b 125 int adcc_MAX_SEEN = adcX_MAX_SEEN_INIT_INT16_MIN;
whismanoid 87:4bc981dfd54b 126 int adcd_MIN_SEEN = adcX_MIN_SEEN_INIT_INT16_MAX;
whismanoid 87:4bc981dfd54b 127 int adcd_MAX_SEEN = adcX_MAX_SEEN_INIT_INT16_MIN;
whismanoid 84:11cc360628a1 128 #endif // Use_Read4Command_Thread
whismanoid 84:11cc360628a1 129 #if Use_Read4Command_Thread
whismanoid 84:11cc360628a1 130 void Read4Command_Thread_handler()
whismanoid 84:11cc360628a1 131 {
whismanoid 84:11cc360628a1 132 const int convrun_pulse_width_us = 30;
whismanoid 84:11cc360628a1 133 const int convrun_stop_us = 10;
whismanoid 84:11cc360628a1 134 // running in thread context in Thread Read4Command_Thread
whismanoid 84:11cc360628a1 135 // operate the SPI interface at specified sample rate
whismanoid 84:11cc360628a1 136 // shared read only: periodicInterruptTimer_interval_usec
whismanoid 84:11cc360628a1 137 while (true) {
whismanoid 85:a47ed024c508 138 #if MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 85:a47ed024c508 139 // Diagnostic: Use MAX32625MBED pin D5 as DigitalOut EOC#-detected
whismanoid 85:a47ed024c508 140 //~ digitalInOut5.write(0); // ScopeTrigger
whismanoid 85:a47ed024c508 141 digitalInOut5.write(1); // ScopeTrigger
whismanoid 85:a47ed024c508 142 #endif // MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 84:11cc360628a1 143 //signal_wait(int32_t signals, uint32_t millisec=osWaitForever)
whismanoid 84:11cc360628a1 144 //flags_read = Read4Command_Thread_event_flags.wait_any(MYTIMEREVENTFLAG_ENABLE_SPI);
whismanoid 84:11cc360628a1 145 Read4Command_Thread_event_flags.wait_any(MYTIMEREVENTFLAG_ENABLE_SPI, osWaitForever, false); // clear=false: don't auto clear the flag
whismanoid 84:11cc360628a1 146 //
whismanoid 88:e4fd5033a55f 147 if (Read4Command_Thread_event_flags.get() & MYTIMEREVENTFLAG_RESET_MINMAX)
whismanoid 88:e4fd5033a55f 148 {
whismanoid 88:e4fd5033a55f 149 adca_MIN_SEEN = +32767; // adcX_MIN_SEEN_INIT_INT16_MAX
whismanoid 88:e4fd5033a55f 150 adcb_MIN_SEEN = +32767; // adcX_MIN_SEEN_INIT_INT16_MAX
whismanoid 88:e4fd5033a55f 151 adcc_MIN_SEEN = +32767; // adcX_MIN_SEEN_INIT_INT16_MAX
whismanoid 88:e4fd5033a55f 152 adcd_MIN_SEEN = +32767; // adcX_MIN_SEEN_INIT_INT16_MAX
whismanoid 88:e4fd5033a55f 153 //
whismanoid 88:e4fd5033a55f 154 adca_MAX_SEEN = -32768; // adcX_MAX_SEEN_INIT_INT16_MIN
whismanoid 88:e4fd5033a55f 155 adcb_MAX_SEEN = -32768; // adcX_MAX_SEEN_INIT_INT16_MIN
whismanoid 88:e4fd5033a55f 156 adcc_MAX_SEEN = -32768; // adcX_MAX_SEEN_INIT_INT16_MIN
whismanoid 88:e4fd5033a55f 157 adcd_MAX_SEEN = -32768; // adcX_MAX_SEEN_INIT_INT16_MIN
whismanoid 88:e4fd5033a55f 158 //
whismanoid 88:e4fd5033a55f 159 Read4Command_Thread_event_flags.clear(MYTIMEREVENTFLAG_RESET_MINMAX);
whismanoid 88:e4fd5033a55f 160 }
whismanoid 88:e4fd5033a55f 161 //
whismanoid 85:a47ed024c508 162 // CONVRUN = H -- perform ADC conversions (EOC will pulse, and data registers will update)
whismanoid 84:11cc360628a1 163 g_MAX11043_device.CONVRUNoutputValue(1);
whismanoid 84:11cc360628a1 164 //
whismanoid 85:a47ed024c508 165 // delay at least 9us to ensure at least one converion happens
whismanoid 84:11cc360628a1 166 wait_us(convrun_pulse_width_us);
whismanoid 84:11cc360628a1 167 //
whismanoid 85:a47ed024c508 168 // CONVRUN = L -- stop ADC conversions
whismanoid 84:11cc360628a1 169 g_MAX11043_device.CONVRUNoutputValue(0);
whismanoid 84:11cc360628a1 170 //
whismanoid 85:a47ed024c508 171 // delay at least 9us to ensure final converion complete
whismanoid 84:11cc360628a1 172 wait_us(convrun_stop_us);
whismanoid 84:11cc360628a1 173 //
whismanoid 85:a47ed024c508 174 // run SPI to capture 4 channels
whismanoid 88:e4fd5033a55f 175 if (Read4Command_Thread_event_flags.get() & MYTIMEREVENTFLAG_FAKE_DATA)
whismanoid 88:e4fd5033a55f 176 {
whismanoid 88:e4fd5033a55f 177 // raw uint32_t result code
whismanoid 88:e4fd5033a55f 178 g_MAX11043_device.adca = 0x7FFF; // +32767 adcX_MIN_SEEN_INIT_INT16_MAX;
whismanoid 88:e4fd5033a55f 179 g_MAX11043_device.adcb = 0x000A; // +10
whismanoid 88:e4fd5033a55f 180 g_MAX11043_device.adcc = 0xFFF6; // -10
whismanoid 88:e4fd5033a55f 181 g_MAX11043_device.adcd = 0x8000; // -32768 adcX_MAX_SEEN_INIT_INT16_MIN;
whismanoid 88:e4fd5033a55f 182
whismanoid 88:e4fd5033a55f 183 // are the initial MIN/MAX swapped? adcX_MAX_SEEN_INIT_INT16_MIN adcX_MIN_SEEN_INIT_INT16_MAX
whismanoid 88:e4fd5033a55f 184 adca_MIN_SEEN = +32767; // adcX_MIN_SEEN_INIT_INT16_MAX
whismanoid 88:e4fd5033a55f 185 adcb_MIN_SEEN = +32767; // adcX_MIN_SEEN_INIT_INT16_MAX
whismanoid 88:e4fd5033a55f 186 adcc_MIN_SEEN = +32767; // adcX_MIN_SEEN_INIT_INT16_MAX
whismanoid 88:e4fd5033a55f 187 adcd_MIN_SEEN = +32767; // adcX_MIN_SEEN_INIT_INT16_MAX
whismanoid 88:e4fd5033a55f 188 //
whismanoid 88:e4fd5033a55f 189 adca_MAX_SEEN = -32768; // adcX_MAX_SEEN_INIT_INT16_MIN
whismanoid 88:e4fd5033a55f 190 adcb_MAX_SEEN = -32768; // adcX_MAX_SEEN_INIT_INT16_MIN
whismanoid 88:e4fd5033a55f 191 adcc_MAX_SEEN = -32768; // adcX_MAX_SEEN_INIT_INT16_MIN
whismanoid 88:e4fd5033a55f 192 adcd_MAX_SEEN = -32768; // adcX_MAX_SEEN_INIT_INT16_MIN
whismanoid 88:e4fd5033a55f 193 }
whismanoid 88:e4fd5033a55f 194 else
whismanoid 88:e4fd5033a55f 195 {
whismanoid 88:e4fd5033a55f 196 g_MAX11043_device.Read_ADCabcd();
whismanoid 88:e4fd5033a55f 197 }
whismanoid 84:11cc360628a1 198 // post: g_MAX11043_device.adca was updated
whismanoid 84:11cc360628a1 199 // post: g_MAX11043_device.adcb was updated
whismanoid 84:11cc360628a1 200 // post: g_MAX11043_device.adcc was updated
whismanoid 84:11cc360628a1 201 // post: g_MAX11043_device.adcd was updated
whismanoid 84:11cc360628a1 202 //
whismanoid 85:a47ed024c508 203 // TODO: capture min/max 2's complement value each channel
whismanoid 87:4bc981dfd54b 204 // #define SIGN_EXTEND_INT16_VALUE(x) (((x)&(0x8000))?((x)-65536):(x))
whismanoid 87:4bc981dfd54b 205 // adca_newest = SIGN_EXTEND_INT16_VALUE(g_MAX11043_device.adca);
whismanoid 87:4bc981dfd54b 206 // adcb_newest = SIGN_EXTEND_INT16_VALUE(g_MAX11043_device.adcb);
whismanoid 87:4bc981dfd54b 207 // adcc_newest = SIGN_EXTEND_INT16_VALUE(g_MAX11043_device.adcc);
whismanoid 87:4bc981dfd54b 208 // adcd_newest = SIGN_EXTEND_INT16_VALUE(g_MAX11043_device.adcd);
whismanoid 91:9e78c6194d6e 209 adca_newest = g_MAX11043_device.adca; // if (adca_newest & 0x8000) { adca_newest = adca_newest - 65536; }
whismanoid 91:9e78c6194d6e 210 adcb_newest = g_MAX11043_device.adcb; // if (adcb_newest & 0x8000) { adcb_newest = adcb_newest - 65536; }
whismanoid 91:9e78c6194d6e 211 adcc_newest = g_MAX11043_device.adcc; // if (adcc_newest & 0x8000) { adcc_newest = adcc_newest - 65536; }
whismanoid 91:9e78c6194d6e 212 adcd_newest = g_MAX11043_device.adcd; // if (adcd_newest & 0x8000) { adcd_newest = adcd_newest - 65536; }
whismanoid 87:4bc981dfd54b 213 // 2020-02-26 this fails because using LDRHI instruction (unsigned comparison), must use signed instead.
whismanoid 87:4bc981dfd54b 214 // Try SIGN_EXTEND_INT16_VALUE to force signed comparison (ldrGE, ldrLT, ldrGT, ldrLE) instead of unsigned comparision (ldrHS, ldrLO, ldrHI, ldrLS)
whismanoid 87:4bc981dfd54b 215 if (adca_MAX_SEEN < adca_newest) {
whismanoid 87:4bc981dfd54b 216 adca_MAX_SEEN = adca_newest;
whismanoid 85:a47ed024c508 217 #if MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 85:a47ed024c508 218 // Diagnostic: Use MAX32625MBED pin D5 as DigitalOut EOC#-detected
whismanoid 88:e4fd5033a55f 219 if (Read4Command_Thread_event_flags.get() & MYTIMEREVENTFLAG_FAKE_DATA == 0)
whismanoid 88:e4fd5033a55f 220 {
whismanoid 85:a47ed024c508 221 digitalInOut5.write(0); // ScopeTrigger
whismanoid 85:a47ed024c508 222 wait_us(5);
whismanoid 85:a47ed024c508 223 digitalInOut5.write(1); // ScopeTrigger
whismanoid 88:e4fd5033a55f 224 }
whismanoid 85:a47ed024c508 225 #endif // MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 85:a47ed024c508 226 }
whismanoid 87:4bc981dfd54b 227 if (adca_MIN_SEEN > adca_newest) {
whismanoid 87:4bc981dfd54b 228 adca_MIN_SEEN = adca_newest;
whismanoid 84:11cc360628a1 229 #if MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 84:11cc360628a1 230 // Diagnostic: Use MAX32625MBED pin D5 as DigitalOut EOC#-detected
whismanoid 88:e4fd5033a55f 231 if (Read4Command_Thread_event_flags.get() & MYTIMEREVENTFLAG_FAKE_DATA == 0)
whismanoid 88:e4fd5033a55f 232 {
whismanoid 85:a47ed024c508 233 digitalInOut5.write(0); // ScopeTrigger
whismanoid 85:a47ed024c508 234 wait_us(10);
whismanoid 85:a47ed024c508 235 digitalInOut5.write(1); // ScopeTrigger
whismanoid 88:e4fd5033a55f 236 }
whismanoid 84:11cc360628a1 237 #endif // MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 85:a47ed024c508 238 }
whismanoid 87:4bc981dfd54b 239 if (adcb_MAX_SEEN < adcb_newest) {
whismanoid 87:4bc981dfd54b 240 adcb_MAX_SEEN = adcb_newest;
whismanoid 85:a47ed024c508 241 #if MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 85:a47ed024c508 242 // Diagnostic: Use MAX32625MBED pin D5 as DigitalOut EOC#-detected
whismanoid 88:e4fd5033a55f 243 if (Read4Command_Thread_event_flags.get() & MYTIMEREVENTFLAG_FAKE_DATA == 0)
whismanoid 88:e4fd5033a55f 244 {
whismanoid 85:a47ed024c508 245 digitalInOut5.write(0); // ScopeTrigger
whismanoid 85:a47ed024c508 246 wait_us(15);
whismanoid 85:a47ed024c508 247 digitalInOut5.write(1); // ScopeTrigger
whismanoid 88:e4fd5033a55f 248 }
whismanoid 85:a47ed024c508 249 #endif // MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 85:a47ed024c508 250 }
whismanoid 87:4bc981dfd54b 251 if (adcb_MIN_SEEN > adcb_newest) {
whismanoid 87:4bc981dfd54b 252 adcb_MIN_SEEN = adcb_newest;
whismanoid 85:a47ed024c508 253 #if MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 85:a47ed024c508 254 // Diagnostic: Use MAX32625MBED pin D5 as DigitalOut EOC#-detected
whismanoid 88:e4fd5033a55f 255 if (Read4Command_Thread_event_flags.get() & MYTIMEREVENTFLAG_FAKE_DATA == 0)
whismanoid 88:e4fd5033a55f 256 {
whismanoid 85:a47ed024c508 257 digitalInOut5.write(0); // ScopeTrigger
whismanoid 85:a47ed024c508 258 wait_us(20);
whismanoid 85:a47ed024c508 259 digitalInOut5.write(1); // ScopeTrigger
whismanoid 88:e4fd5033a55f 260 }
whismanoid 88:e4fd5033a55f 261 #endif // MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 88:e4fd5033a55f 262 }
whismanoid 88:e4fd5033a55f 263 if (adcc_MAX_SEEN < adcc_newest) {
whismanoid 88:e4fd5033a55f 264 adcc_MAX_SEEN = adcc_newest;
whismanoid 88:e4fd5033a55f 265 #if MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 88:e4fd5033a55f 266 // Diagnostic: Use MAX32625MBED pin D5 as DigitalOut EOC#-detected
whismanoid 88:e4fd5033a55f 267 if (Read4Command_Thread_event_flags.get() & MYTIMEREVENTFLAG_FAKE_DATA == 0)
whismanoid 88:e4fd5033a55f 268 {
whismanoid 88:e4fd5033a55f 269 digitalInOut5.write(0); // ScopeTrigger
whismanoid 88:e4fd5033a55f 270 wait_us(15);
whismanoid 88:e4fd5033a55f 271 digitalInOut5.write(1); // ScopeTrigger
whismanoid 88:e4fd5033a55f 272 }
whismanoid 85:a47ed024c508 273 #endif // MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 85:a47ed024c508 274 }
whismanoid 88:e4fd5033a55f 275 if (adcc_MIN_SEEN > adcc_newest) {
whismanoid 88:e4fd5033a55f 276 adcc_MIN_SEEN = adcc_newest;
whismanoid 88:e4fd5033a55f 277 #if MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 88:e4fd5033a55f 278 // Diagnostic: Use MAX32625MBED pin D5 as DigitalOut EOC#-detected
whismanoid 88:e4fd5033a55f 279 if (Read4Command_Thread_event_flags.get() & MYTIMEREVENTFLAG_FAKE_DATA == 0)
whismanoid 88:e4fd5033a55f 280 {
whismanoid 88:e4fd5033a55f 281 digitalInOut5.write(0); // ScopeTrigger
whismanoid 88:e4fd5033a55f 282 wait_us(20);
whismanoid 88:e4fd5033a55f 283 digitalInOut5.write(1); // ScopeTrigger
whismanoid 88:e4fd5033a55f 284 }
whismanoid 88:e4fd5033a55f 285 #endif // MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 88:e4fd5033a55f 286 }
whismanoid 88:e4fd5033a55f 287 if (adcd_MAX_SEEN < adcd_newest) {
whismanoid 88:e4fd5033a55f 288 adcd_MAX_SEEN = adcd_newest;
whismanoid 88:e4fd5033a55f 289 #if MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 88:e4fd5033a55f 290 // Diagnostic: Use MAX32625MBED pin D5 as DigitalOut EOC#-detected
whismanoid 88:e4fd5033a55f 291 if (Read4Command_Thread_event_flags.get() & MYTIMEREVENTFLAG_FAKE_DATA == 0)
whismanoid 88:e4fd5033a55f 292 {
whismanoid 88:e4fd5033a55f 293 digitalInOut5.write(0); // ScopeTrigger
whismanoid 88:e4fd5033a55f 294 wait_us(15);
whismanoid 88:e4fd5033a55f 295 digitalInOut5.write(1); // ScopeTrigger
whismanoid 88:e4fd5033a55f 296 }
whismanoid 88:e4fd5033a55f 297 #endif // MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 88:e4fd5033a55f 298 }
whismanoid 88:e4fd5033a55f 299 if (adcd_MIN_SEEN > adcd_newest) {
whismanoid 88:e4fd5033a55f 300 adcd_MIN_SEEN = adcd_newest;
whismanoid 88:e4fd5033a55f 301 #if MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 88:e4fd5033a55f 302 // Diagnostic: Use MAX32625MBED pin D5 as DigitalOut EOC#-detected
whismanoid 88:e4fd5033a55f 303 if (Read4Command_Thread_event_flags.get() & MYTIMEREVENTFLAG_FAKE_DATA == 0)
whismanoid 88:e4fd5033a55f 304 {
whismanoid 88:e4fd5033a55f 305 digitalInOut5.write(0); // ScopeTrigger
whismanoid 88:e4fd5033a55f 306 wait_us(20);
whismanoid 88:e4fd5033a55f 307 digitalInOut5.write(1); // ScopeTrigger
whismanoid 88:e4fd5033a55f 308 }
whismanoid 88:e4fd5033a55f 309 #endif // MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 88:e4fd5033a55f 310 }
whismanoid 85:a47ed024c508 311 // TODO: compare with thresholds, report if exceeded
whismanoid 84:11cc360628a1 312 //
whismanoid 84:11cc360628a1 313 // blocking delay time us_timestamp_t periodicInterruptTimer_interval_usec
whismanoid 84:11cc360628a1 314 //~ const us_timestamp_t overhead_usec = 24;
whismanoid 84:11cc360628a1 315 //~ if (periodicInterruptTimer_interval_usec > overhead_usec) {
whismanoid 84:11cc360628a1 316 //~ wait_us(periodicInterruptTimer_interval_usec - overhead_usec);
whismanoid 84:11cc360628a1 317 //~ }
whismanoid 84:11cc360628a1 318 }
whismanoid 84:11cc360628a1 319 }
whismanoid 84:11cc360628a1 320 #endif // Use_Read4Command_Thread
whismanoid 84:11cc360628a1 321 #if Use_Read4Command_Thread
whismanoid 84:11cc360628a1 322 //~ Read4Command_Thread_event_flags.set(MYTIMEREVENTFLAG_ENABLE_SPI);
whismanoid 84:11cc360628a1 323 #endif // Use_Read4Command_Thread
whismanoid 84:11cc360628a1 324 #if Use_Read4Command_Thread
whismanoid 84:11cc360628a1 325 //~ Read4Command_Thread_event_flags.clear(MYTIMEREVENTFLAG_ENABLE_SPI);
whismanoid 84:11cc360628a1 326 #endif // Use_Read4Command_Thread
whismanoid 84:11cc360628a1 327 #if Use_Read4Command_Thread
whismanoid 84:11cc360628a1 328 // init
whismanoid 84:11cc360628a1 329 //~ Read4Command_Thread.start(Read4Command_Thread_handler);
whismanoid 84:11cc360628a1 330 #endif // Use_Read4Command_Thread
whismanoid 84:11cc360628a1 331
whismanoid 52:607010f0c54e 332 // CODE GENERATOR: build testMenuCommand list
whismanoid 52:607010f0c54e 333 // CODE GENERATOR: build testMenuGlobalArgsDict common/global argument list
whismanoid 52:607010f0c54e 334 // CODE GENERATOR: class member function declarations
whismanoid 52:607010f0c54e 335 // CODE GENERATOR: MAX11043 Command Name = Init (void) --> uint8_t
whismanoid 52:607010f0c54e 336 // CODE GENERATOR: Menu item hint description Menu item '!'
whismanoid 52:607010f0c54e 337 // CODE GENERATOR: Menu item '!' -- Menu item !
whismanoid 52:607010f0c54e 338 // CODE GENERATOR: test menu case '!':
whismanoid 52:607010f0c54e 339 // CODE GENERATOR: helpString '! -- Init'
whismanoid 52:607010f0c54e 340 // CODE GENERATOR: CMD_ 'None'
whismanoid 52:607010f0c54e 341 // CODE GENERATOR: CommandName 'Init'
whismanoid 52:607010f0c54e 342 // CODE GENERATOR: CommandParamIn 'void'
whismanoid 52:607010f0c54e 343 // CODE GENERATOR: CommandReturnType 'uint8_t'
whismanoid 52:607010f0c54e 344 // CODE GENERATOR: CommandPre ''
whismanoid 52:607010f0c54e 345 // CODE GENERATOR: CommandDocParamIn ''
whismanoid 52:607010f0c54e 346 // CODE GENERATOR: CommandDocParamOut ''
whismanoid 52:607010f0c54e 347 // CODE GENERATOR: CommandPost ''
whismanoid 52:607010f0c54e 348 // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure'
whismanoid 52:607010f0c54e 349 // CODE GENERATOR: MAX11043 Command Name = RegWrite (MAX11043_CMD_enum_t commandByte, uint32_t regData) --> uint8_t
whismanoid 52:607010f0c54e 350 // CODE GENERATOR: no Menu item hint in description
whismanoid 52:607010f0c54e 351 // CODE GENERATOR: MAX11043 Command Name = RegRead (MAX11043_CMD_enum_t commandByte, uint32_t* ptrRegData) --> uint8_t
whismanoid 52:607010f0c54e 352 // CODE GENERATOR: no Menu item hint in description
whismanoid 52:607010f0c54e 353 // CODE GENERATOR: MAX11043 Command Name = RegSize (MAX11043_CMD_enum_t commandByte) --> uint8_t
whismanoid 52:607010f0c54e 354 // CODE GENERATOR: no Menu item hint in description
whismanoid 57:1c9da8e90737 355 // CODE GENERATOR: MAX11043 Command Name = DecodeCommand (MAX11043_CMD_enum_t commandByte) --> MAX11043::MAX11043_CMDOP_enum_t
whismanoid 57:1c9da8e90737 356 // CODE GENERATOR: no Menu item hint in description
whismanoid 52:607010f0c54e 357 // CODE GENERATOR: MAX11043 Command Name = RegAddrOfCommand (MAX11043_CMD_enum_t commandByte) --> uint8_t
whismanoid 52:607010f0c54e 358 // CODE GENERATOR: no Menu item hint in description
whismanoid 52:607010f0c54e 359 // CODE GENERATOR: MAX11043 Command Name = IsRegReadCommand (MAX11043_CMD_enum_t commandByte) --> uint8_t
whismanoid 52:607010f0c54e 360 // CODE GENERATOR: no Menu item hint in description
whismanoid 52:607010f0c54e 361 // CODE GENERATOR: MAX11043 Command Name = RegName (MAX11043_CMD_enum_t commandByte) --> const char*
whismanoid 52:607010f0c54e 362 // CODE GENERATOR: no Menu item hint in description
whismanoid 64:a667cfd83492 363 // CODE GENERATOR: MAX11043 Command Name = Read_ADCabcd (void) --> uint8_t
whismanoid 64:a667cfd83492 364 // CODE GENERATOR: Menu item hint description Menu item '$' -> adca, adcb, adcc, adcd
whismanoid 64:a667cfd83492 365 // CODE GENERATOR: Menu item '$' -> adca, adcb, adcc, adcd -- Menu item $
whismanoid 64:a667cfd83492 366 // CODE GENERATOR: test menu case '$':
whismanoid 64:a667cfd83492 367 // CODE GENERATOR: helpString '$ -- Read_ADCabcd'
whismanoid 64:a667cfd83492 368 // CODE GENERATOR: CMD_ 'None'
whismanoid 64:a667cfd83492 369 // CODE GENERATOR: CommandName 'Read_ADCabcd'
whismanoid 64:a667cfd83492 370 // CODE GENERATOR: CommandParamIn 'void'
whismanoid 64:a667cfd83492 371 // CODE GENERATOR: CommandReturnType 'uint8_t'
whismanoid 64:a667cfd83492 372 // CODE GENERATOR: CommandPre ''
whismanoid 64:a667cfd83492 373 // CODE GENERATOR: CommandDocParamIn ''
whismanoid 64:a667cfd83492 374 // CODE GENERATOR: CommandDocParamOut ''
whismanoid 64:a667cfd83492 375 // CODE GENERATOR: CommandPost ''
whismanoid 64:a667cfd83492 376 // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure'
whismanoid 64:a667cfd83492 377 // CODE GENERATOR: MAX11043 Command Name = Write_AGain (uint32_t gain) --> uint8_t
whismanoid 66:3fe92f6f1cfa 378 // CODE GENERATOR: Menu item hint description Menu item 'GA'
whismanoid 66:3fe92f6f1cfa 379 // CODE GENERATOR: Menu item 'GA' -- Menu item GA
whismanoid 66:3fe92f6f1cfa 380 // CODE GENERATOR: MAX11043 help: GA uint32_t gain -- Write_AGain
whismanoid 66:3fe92f6f1cfa 381 // CODE GENERATOR: MAX11043 helpString: 'GA gain=? -- Write_AGain'
whismanoid 66:3fe92f6f1cfa 382 // CODE GENERATOR: test menu case 'GA':
whismanoid 66:3fe92f6f1cfa 383 // CODE GENERATOR: helpString 'GA gain=? -- Write_AGain'
whismanoid 64:a667cfd83492 384 // CODE GENERATOR: CMD_ 'None'
whismanoid 64:a667cfd83492 385 // CODE GENERATOR: CommandName 'Write_AGain'
whismanoid 64:a667cfd83492 386 // CODE GENERATOR: CommandParamIn 'uint32_t gain'
whismanoid 64:a667cfd83492 387 // CODE GENERATOR: CommandReturnType 'uint8_t'
whismanoid 64:a667cfd83492 388 // CODE GENERATOR: CommandPre ''
whismanoid 93:6b22269935a6 389 // CODE GENERATOR: CommandDocParamIn '@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1V/V, 0x4000=2V/V, default=0x2000'
whismanoid 64:a667cfd83492 390 // CODE GENERATOR: CommandDocParamOut ''
whismanoid 64:a667cfd83492 391 // CODE GENERATOR: CommandPost ''
whismanoid 64:a667cfd83492 392 // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure'
whismanoid 89:20fd6ce5e4dd 393 // CODE GENERATOR: MAX11043 Command Name = Configure_Demo (void) --> void
whismanoid 89:20fd6ce5e4dd 394 // CODE GENERATOR: Menu item hint description Menu item 'XD'
whismanoid 89:20fd6ce5e4dd 395 // CODE GENERATOR: Menu item 'XD' -- Menu item XD
whismanoid 89:20fd6ce5e4dd 396 // CODE GENERATOR: test menu case 'XD':
whismanoid 89:20fd6ce5e4dd 397 // CODE GENERATOR: helpString 'XD -- Configure_Demo'
whismanoid 89:20fd6ce5e4dd 398 // CODE GENERATOR: CMD_ 'None'
whismanoid 89:20fd6ce5e4dd 399 // CODE GENERATOR: CommandName 'Configure_Demo'
whismanoid 89:20fd6ce5e4dd 400 // CODE GENERATOR: CommandParamIn 'void'
whismanoid 89:20fd6ce5e4dd 401 // CODE GENERATOR: CommandReturnType 'void'
whismanoid 89:20fd6ce5e4dd 402 // CODE GENERATOR: CommandPre ''
whismanoid 89:20fd6ce5e4dd 403 // CODE GENERATOR: CommandDocParamIn ''
whismanoid 89:20fd6ce5e4dd 404 // CODE GENERATOR: CommandDocParamOut ''
whismanoid 89:20fd6ce5e4dd 405 // CODE GENERATOR: CommandPost ''
whismanoid 89:20fd6ce5e4dd 406 // CODE GENERATOR: CommandReturn ''
whismanoid 59:47538bcf6cda 407 // CODE GENERATOR: MAX11043 Command Name = Configure_XXXXX (uint8_t linef, uint8_t rate) --> uint8_t
whismanoid 59:47538bcf6cda 408 // CODE GENERATOR: Menu item hint description Menu item 'XX'
whismanoid 59:47538bcf6cda 409 // CODE GENERATOR: Menu item 'XX' -- Menu item XX
whismanoid 59:47538bcf6cda 410 // CODE GENERATOR: MAX11043 help: XX uint8_t linef, uint8_t rate -- Configure_XXXXX
whismanoid 59:47538bcf6cda 411 // CODE GENERATOR: MAX11043 helpString: 'XX linef=? rate=? -- Configure_XXXXX'
whismanoid 59:47538bcf6cda 412 // CODE GENERATOR: test menu case 'XX':
whismanoid 59:47538bcf6cda 413 // CODE GENERATOR: helpString 'XX linef=? rate=? -- Configure_XXXXX'
whismanoid 59:47538bcf6cda 414 // CODE GENERATOR: CMD_ 'None'
whismanoid 59:47538bcf6cda 415 // CODE GENERATOR: CommandName 'Configure_XXXXX'
whismanoid 59:47538bcf6cda 416 // CODE GENERATOR: CommandParamIn 'uint8_t linef, uint8_t rate'
whismanoid 59:47538bcf6cda 417 // CODE GENERATOR: CommandReturnType 'uint8_t'
whismanoid 59:47538bcf6cda 418 // CODE GENERATOR: CommandPre ''
whismanoid 59:47538bcf6cda 419 // CODE GENERATOR: CommandDocParamIn ''
whismanoid 59:47538bcf6cda 420 // CODE GENERATOR: CommandDocParamOut ''
whismanoid 59:47538bcf6cda 421 // CODE GENERATOR: CommandPost ''
whismanoid 59:47538bcf6cda 422 // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure'
whismanoid 59:47538bcf6cda 423 // CODE GENERATOR: MAX11043 Command Name = Configure_XXXXY (uint8_t linef, uint8_t rate) --> uint8_t
whismanoid 59:47538bcf6cda 424 // CODE GENERATOR: Menu item hint description Menu item 'XY'
whismanoid 59:47538bcf6cda 425 // CODE GENERATOR: Menu item 'XY' -- Menu item XY
whismanoid 59:47538bcf6cda 426 // CODE GENERATOR: MAX11043 help: XY uint8_t linef, uint8_t rate -- Configure_XXXXY
whismanoid 59:47538bcf6cda 427 // CODE GENERATOR: MAX11043 helpString: 'XY linef=? rate=? -- Configure_XXXXY'
whismanoid 59:47538bcf6cda 428 // CODE GENERATOR: test menu case 'XY':
whismanoid 59:47538bcf6cda 429 // CODE GENERATOR: helpString 'XY linef=? rate=? -- Configure_XXXXY'
whismanoid 59:47538bcf6cda 430 // CODE GENERATOR: CMD_ 'None'
whismanoid 59:47538bcf6cda 431 // CODE GENERATOR: CommandName 'Configure_XXXXY'
whismanoid 59:47538bcf6cda 432 // CODE GENERATOR: CommandParamIn 'uint8_t linef, uint8_t rate'
whismanoid 59:47538bcf6cda 433 // CODE GENERATOR: CommandReturnType 'uint8_t'
whismanoid 59:47538bcf6cda 434 // CODE GENERATOR: CommandPre ''
whismanoid 59:47538bcf6cda 435 // CODE GENERATOR: CommandDocParamIn ''
whismanoid 59:47538bcf6cda 436 // CODE GENERATOR: CommandDocParamOut ''
whismanoid 59:47538bcf6cda 437 // CODE GENERATOR: CommandPost ''
whismanoid 59:47538bcf6cda 438 // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure'
whismanoid 52:607010f0c54e 439 // CODE GENERATOR: testMenuGlobalArgsDict scan global property list g_MAX11043_device
whismanoid 52:607010f0c54e 440
whismanoid 59:47538bcf6cda 441 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.VRef
whismanoid 59:47538bcf6cda 442 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.VRef argname = VRef
whismanoid 59:47538bcf6cda 443 // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['alias'] = 'None'
whismanoid 59:47538bcf6cda 444 // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['argtype'] = 'double'
whismanoid 59:47538bcf6cda 445 // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['usedByCommandName'] = 'None'
whismanoid 59:47538bcf6cda 446 // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['usedBytestMenuItemName'] = 'None'
whismanoid 52:607010f0c54e 447
whismanoid 59:47538bcf6cda 448 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.config
whismanoid 59:47538bcf6cda 449 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.config shadow of argname = config
whismanoid 59:47538bcf6cda 450 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.config argname = config
whismanoid 59:47538bcf6cda 451 // CODE GENERATOR: testMenuGlobalArgsDict['config']['alias'] = 'None'
whismanoid 59:47538bcf6cda 452 // CODE GENERATOR: testMenuGlobalArgsDict['config']['argtype'] = 'uint16_t'
whismanoid 59:47538bcf6cda 453 // CODE GENERATOR: testMenuGlobalArgsDict['config']['usedByCommandName'] = 'None'
whismanoid 59:47538bcf6cda 454 // CODE GENERATOR: testMenuGlobalArgsDict['config']['usedBytestMenuItemName'] = 'None'
whismanoid 52:607010f0c54e 455
whismanoid 52:607010f0c54e 456 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.status
whismanoid 52:607010f0c54e 457 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.status shadow of argname = status
whismanoid 52:607010f0c54e 458 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.status argname = status
whismanoid 52:607010f0c54e 459 // CODE GENERATOR: testMenuGlobalArgsDict['status']['alias'] = 'None'
whismanoid 90:d6ed8a8c5f26 460 // CODE GENERATOR: testMenuGlobalArgsDict['status']['argtype'] = 'uint8_t'
whismanoid 52:607010f0c54e 461 // CODE GENERATOR: testMenuGlobalArgsDict['status']['usedByCommandName'] = 'None'
whismanoid 52:607010f0c54e 462 // CODE GENERATOR: testMenuGlobalArgsDict['status']['usedBytestMenuItemName'] = 'None'
whismanoid 52:607010f0c54e 463
whismanoid 59:47538bcf6cda 464 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adca
whismanoid 59:47538bcf6cda 465 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adca shadow of argname = ADCa
whismanoid 59:47538bcf6cda 466 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adca argname = ADCa
whismanoid 59:47538bcf6cda 467 // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['alias'] = 'None'
whismanoid 90:d6ed8a8c5f26 468 // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['argtype'] = 'int'
whismanoid 59:47538bcf6cda 469 // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['usedByCommandName'] = 'None'
whismanoid 59:47538bcf6cda 470 // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['usedBytestMenuItemName'] = 'None'
whismanoid 59:47538bcf6cda 471
whismanoid 59:47538bcf6cda 472 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcb
whismanoid 59:47538bcf6cda 473 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcb shadow of argname = ADCb
whismanoid 59:47538bcf6cda 474 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcb argname = ADCb
whismanoid 59:47538bcf6cda 475 // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['alias'] = 'None'
whismanoid 90:d6ed8a8c5f26 476 // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['argtype'] = 'int'
whismanoid 59:47538bcf6cda 477 // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['usedByCommandName'] = 'None'
whismanoid 59:47538bcf6cda 478 // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['usedBytestMenuItemName'] = 'None'
whismanoid 52:607010f0c54e 479
whismanoid 59:47538bcf6cda 480 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcc
whismanoid 59:47538bcf6cda 481 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcc shadow of argname = ADCc
whismanoid 59:47538bcf6cda 482 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcc argname = ADCc
whismanoid 59:47538bcf6cda 483 // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['alias'] = 'None'
whismanoid 90:d6ed8a8c5f26 484 // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['argtype'] = 'int'
whismanoid 59:47538bcf6cda 485 // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['usedByCommandName'] = 'None'
whismanoid 59:47538bcf6cda 486 // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['usedBytestMenuItemName'] = 'None'
whismanoid 59:47538bcf6cda 487
whismanoid 59:47538bcf6cda 488 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcd
whismanoid 59:47538bcf6cda 489 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcd shadow of argname = ADCd
whismanoid 59:47538bcf6cda 490 // CODE GENERATOR: testMenuGlobalArgsDict add global property g_MAX11043_device.adcd argname = ADCd
whismanoid 59:47538bcf6cda 491 // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['alias'] = 'None'
whismanoid 90:d6ed8a8c5f26 492 // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['argtype'] = 'int'
whismanoid 59:47538bcf6cda 493 // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['usedByCommandName'] = 'None'
whismanoid 59:47538bcf6cda 494 // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['usedBytestMenuItemName'] = 'None'
whismanoid 59:47538bcf6cda 495
whismanoid 52:607010f0c54e 496
whismanoid 52:607010f0c54e 497 // CODE GENERATOR: scan testMenuCommand list for items that can be shortened to single character
whismanoid 59:47538bcf6cda 498 // CODE GENERATOR: multiple commands begin with character 'X'
whismanoid 89:20fd6ce5e4dd 499 // CODE GENERATOR: multiple commands begin with character 'X'
whismanoid 52:607010f0c54e 500 // CODE GENERATOR: shorten testMenuCommand to single character if unambiguous
whismanoid 52:607010f0c54e 501 // CODE GENERATOR: testMenuCommand '!' already single character
whismanoid 64:a667cfd83492 502 // CODE GENERATOR: testMenuCommand '$' already single character
whismanoid 66:3fe92f6f1cfa 503 // CODE GENERATOR: shorten testMenuCommand 'GA' to single character 'G'
whismanoid 66:3fe92f6f1cfa 504 // CODE GENERATOR: re.sub pattern:'GA' with repl:'G' in helpString 'GA gain=? -- Write_AGain'
whismanoid 66:3fe92f6f1cfa 505 // CODE GENERATOR: updated 'G' help string to 'G gain=? -- Write_AGain'
whismanoid 89:20fd6ce5e4dd 506 // CODE GENERATOR: cannot shorten testMenuCommand 'XD' to single character due to duplicates
whismanoid 59:47538bcf6cda 507 // CODE GENERATOR: cannot shorten testMenuCommand 'XX' to single character due to duplicates
whismanoid 59:47538bcf6cda 508 // CODE GENERATOR: cannot shorten testMenuCommand 'XY' to single character due to duplicates
whismanoid 52:607010f0c54e 509
whismanoid 52:607010f0c54e 510 // CODE GENERATOR: help menu
whismanoid 52:607010f0c54e 511 bool MAX11043_menu_help(CmdLine & cmdLine)
whismanoid 52:607010f0c54e 512 {
whismanoid 52:607010f0c54e 513 // CODE GENERATOR: command: !
whismanoid 52:607010f0c54e 514 // CODE GENERATOR: help: ! -- Init
whismanoid 52:607010f0c54e 515 cmdLine.serial().printf("\r\n ! -- Init");
whismanoid 64:a667cfd83492 516 // CODE GENERATOR: command: $
whismanoid 64:a667cfd83492 517 // CODE GENERATOR: help: $ -- Read_ADCabcd
whismanoid 64:a667cfd83492 518 cmdLine.serial().printf("\r\n $ -- Read_ADCabcd");
whismanoid 66:3fe92f6f1cfa 519 // CODE GENERATOR: command: G
whismanoid 66:3fe92f6f1cfa 520 // CODE GENERATOR: help: G gain=? -- Write_AGain
whismanoid 66:3fe92f6f1cfa 521 cmdLine.serial().printf("\r\n G gain=? -- Write_AGain");
whismanoid 89:20fd6ce5e4dd 522 // CODE GENERATOR: command: XD
whismanoid 89:20fd6ce5e4dd 523 // CODE GENERATOR: help: XD -- Configure_Demo
whismanoid 89:20fd6ce5e4dd 524 cmdLine.serial().printf("\r\n XD -- Configure_Demo");
whismanoid 59:47538bcf6cda 525 // CODE GENERATOR: command: XX
whismanoid 59:47538bcf6cda 526 // CODE GENERATOR: help: XX linef=? rate=? -- Configure_XXXXX
whismanoid 59:47538bcf6cda 527 cmdLine.serial().printf("\r\n XX linef=? rate=? -- Configure_XXXXX");
whismanoid 59:47538bcf6cda 528 // CODE GENERATOR: command: XY
whismanoid 59:47538bcf6cda 529 // CODE GENERATOR: help: XY linef=? rate=? -- Configure_XXXXY
whismanoid 59:47538bcf6cda 530 cmdLine.serial().printf("\r\n XY linef=? rate=? -- Configure_XXXXY");
whismanoid 52:607010f0c54e 531 //
whismanoid 52:607010f0c54e 532 cmdLine.serial().printf("\r\n @ -- print MAX11043 configuration");
whismanoid 52:607010f0c54e 533
whismanoid 52:607010f0c54e 534 // CODE GENERATOR: help menu if has_register_write_command: *regname? -- read register; *regname=regvalue -- write register
whismanoid 52:607010f0c54e 535 cmdLine.serial().printf("\r\n *regname? -- read register\r\n *regname=regvalue -- write register");
whismanoid 52:607010f0c54e 536
whismanoid 52:607010f0c54e 537 //
whismanoid 52:607010f0c54e 538 // CODE GENERATOR: TODO1: generate GPIO commands for LDAC, CLR, etc. based on device driver function names (menu_help)
whismanoid 52:607010f0c54e 539 // case 'G'..'Z','g'..'z' are reserved for GPIO commands
whismanoid 52:607010f0c54e 540 // case 'A'..'F','a'..'f' may be available if not claimed by bitstream commands
whismanoid 52:607010f0c54e 541 // CODE GENERATOR: TODO1: prevent conflict ExternFunctionGPIOPinCommand with reserved case 'A'..'F','a'..'f'
whismanoid 52:607010f0c54e 542 // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['PinName'] = 'CONVRUN'
whismanoid 52:607010f0c54e 543 // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['Direction'] = 'output'
whismanoid 52:607010f0c54e 544 // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 545 // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['FunctionName'] = 'CONVRUNoutputValue'
whismanoid 52:607010f0c54e 546
whismanoid 52:607010f0c54e 547 // CODE GENERATOR: warning: conflict testMenuGPIOItemsDict['CONVRUN']['PinName'] = 'CONVRUN'
whismanoid 52:607010f0c54e 548 #warning "No command case for 'CONVRUN' 'PinName' 'CONVRUN' due to conflict with reserved commands A-F, try changing pin name"
whismanoid 66:3fe92f6f1cfa 549 #warning "Randomly assigned command 'H' for 'CONVRUN' due to name conflict"
whismanoid 52:607010f0c54e 550 // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['PinName'] = 'DACSTEP'
whismanoid 52:607010f0c54e 551 // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['Direction'] = 'output'
whismanoid 52:607010f0c54e 552 // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 553 // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['FunctionName'] = 'DACSTEPoutputValue'
whismanoid 52:607010f0c54e 554
whismanoid 52:607010f0c54e 555 // CODE GENERATOR: warning: conflict testMenuGPIOItemsDict['DACSTEP']['PinName'] = 'DACSTEP'
whismanoid 52:607010f0c54e 556 #warning "No command case for 'DACSTEP' 'PinName' 'DACSTEP' due to conflict with reserved commands A-F, try changing pin name"
whismanoid 66:3fe92f6f1cfa 557 #warning "Randomly assigned command 'I' for 'DACSTEP' due to name conflict"
whismanoid 52:607010f0c54e 558 // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['PinName'] = 'EOC'
whismanoid 52:607010f0c54e 559 // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['Direction'] = 'input'
whismanoid 52:607010f0c54e 560 // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 561 // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['FunctionName'] = 'EOCinputValue'
whismanoid 52:607010f0c54e 562
whismanoid 52:607010f0c54e 563 // CODE GENERATOR: warning: conflict testMenuGPIOItemsDict['EOC']['PinName'] = 'EOC'
whismanoid 52:607010f0c54e 564 #warning "No command case for 'EOC' 'PinName' 'EOC' due to conflict with reserved commands A-F, try changing pin name"
whismanoid 66:3fe92f6f1cfa 565 #warning "Randomly assigned command 'J' for 'EOC' due to name conflict"
whismanoid 52:607010f0c54e 566 // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['PinName'] = 'SHDN'
whismanoid 52:607010f0c54e 567 // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['Direction'] = 'output'
whismanoid 52:607010f0c54e 568 // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 569 // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['FunctionName'] = 'SHDNoutputValue'
whismanoid 52:607010f0c54e 570
whismanoid 52:607010f0c54e 571 // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['PinName'] = 'UP_slash_DWNb'
whismanoid 52:607010f0c54e 572 // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['Direction'] = 'output'
whismanoid 52:607010f0c54e 573 // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 574 // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['FunctionName'] = 'UP_slash_DWNboutputValue'
whismanoid 52:607010f0c54e 575
whismanoid 66:3fe92f6f1cfa 576 // CODE GENERATOR: ExternFunctionGPIOPinCommand 'H' 'CONVRUN'
whismanoid 52:607010f0c54e 577 // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['PinName'] = 'CONVRUN'
whismanoid 52:607010f0c54e 578 // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['Direction'] = 'output'
whismanoid 52:607010f0c54e 579 // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 580 // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['FunctionName'] = 'CONVRUNoutputValue'
whismanoid 66:3fe92f6f1cfa 581 cmdLine.serial().printf("\r\n H -- CONVRUN output HH high HL low"); // TODO: ExternFunctionGPIOPinCommand testMenuGPIOItemsDict
whismanoid 66:3fe92f6f1cfa 582 // CODE GENERATOR: ExternFunctionGPIOPinCommand 'I' 'DACSTEP'
whismanoid 52:607010f0c54e 583 // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['PinName'] = 'DACSTEP'
whismanoid 52:607010f0c54e 584 // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['Direction'] = 'output'
whismanoid 52:607010f0c54e 585 // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 586 // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['FunctionName'] = 'DACSTEPoutputValue'
whismanoid 66:3fe92f6f1cfa 587 cmdLine.serial().printf("\r\n I -- DACSTEP output IH high IL low"); // TODO: ExternFunctionGPIOPinCommand testMenuGPIOItemsDict
whismanoid 66:3fe92f6f1cfa 588 // CODE GENERATOR: ExternFunctionGPIOPinCommand 'J' 'EOC'
whismanoid 52:607010f0c54e 589 // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['PinName'] = 'EOC'
whismanoid 52:607010f0c54e 590 // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['Direction'] = 'input'
whismanoid 52:607010f0c54e 591 // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 592 // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['FunctionName'] = 'EOCinputValue'
whismanoid 66:3fe92f6f1cfa 593 cmdLine.serial().printf("\r\n J -- EOC input value"); // TODO: ExternFunctionGPIOPinCommand testMenuGPIOItemsDict
whismanoid 52:607010f0c54e 594 // CODE GENERATOR: ExternFunctionGPIOPinCommand 'S' 'SHDN'
whismanoid 52:607010f0c54e 595 // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['PinName'] = 'SHDN'
whismanoid 52:607010f0c54e 596 // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['Direction'] = 'output'
whismanoid 52:607010f0c54e 597 // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 598 // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['FunctionName'] = 'SHDNoutputValue'
whismanoid 52:607010f0c54e 599 cmdLine.serial().printf("\r\n S -- SHDN output SH high SL low"); // TODO: ExternFunctionGPIOPinCommand testMenuGPIOItemsDict
whismanoid 52:607010f0c54e 600 // CODE GENERATOR: ExternFunctionGPIOPinCommand 'U' 'UP_slash_DWNb'
whismanoid 52:607010f0c54e 601 // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['PinName'] = 'UP_slash_DWNb'
whismanoid 52:607010f0c54e 602 // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['Direction'] = 'output'
whismanoid 52:607010f0c54e 603 // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 604 // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['FunctionName'] = 'UP_slash_DWNboutputValue'
whismanoid 52:607010f0c54e 605 cmdLine.serial().printf("\r\n U -- UP_slash_DWNb output UH high UL low"); // TODO: ExternFunctionGPIOPinCommand testMenuGPIOItemsDict
whismanoid 52:607010f0c54e 606
whismanoid 84:11cc360628a1 607 #if Has_Read4Command_Command
whismanoid 83:29bb86cc45bc 608 // Read 4 command -- Single 4-channel read: CONVRUN pulsed H then L, EOC ignored.
whismanoid 83:29bb86cc45bc 609 cmdLine.serial().printf("\r\n ^ -- Single 4-channel read: CONVRUN pulsed H then L, EOC ignored.");
whismanoid 84:11cc360628a1 610 #endif // Has_Read4Command_Command
whismanoid 83:29bb86cc45bc 611
whismanoid 52:607010f0c54e 612 //
whismanoid 83:29bb86cc45bc 613 return true; // why is MAXxxxxx_menu_help() function bool not void?
whismanoid 52:607010f0c54e 614 }
whismanoid 52:607010f0c54e 615
whismanoid 52:607010f0c54e 616 bool MAX11043_menu_onEOLcommandParser(CmdLine & cmdLine)
whismanoid 52:607010f0c54e 617 {
whismanoid 52:607010f0c54e 618
whismanoid 52:607010f0c54e 619 // CODE GENERATOR: testMenuGlobalArgsDict Consolidate common/global argument parsing
whismanoid 52:607010f0c54e 620
whismanoid 59:47538bcf6cda 621 // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['alias'] = 'None'
whismanoid 90:d6ed8a8c5f26 622 // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['argtype'] = 'int'
whismanoid 59:47538bcf6cda 623 // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['usedByCommandName'] = 'None'
whismanoid 59:47538bcf6cda 624 // CODE GENERATOR: testMenuGlobalArgsDict['ADCa']['usedBytestMenuItemName'] = 'None'
whismanoid 90:d6ed8a8c5f26 625 // parse argument int ADCa
whismanoid 90:d6ed8a8c5f26 626 //int ADCa = 0; // ~~~ g_MAX11043_device.__WARNING_no_match_for_argname_ADCa_in_MAX11043_device_t__; // default to global property value
whismanoid 90:d6ed8a8c5f26 627 //if (cmdLine.parse_int16_dec("ADCa", ADCa))
whismanoid 90:d6ed8a8c5f26 628 // [Error] Test_Menu_MAX11043.cpp@627,49: invalid initialization of non-const reference of type 'int16_t& {aka short int&}' from an rvalue of type 'int16_t {aka short int}'
whismanoid 90:d6ed8a8c5f26 629 //{
whismanoid 59:47538bcf6cda 630 // g_MAX11043_device.__WARNING_no_match_for_argname_ADCa_in_MAX11043_device_t__ = ADCa; // update global property value
whismanoid 90:d6ed8a8c5f26 631 //}
whismanoid 59:47538bcf6cda 632
whismanoid 59:47538bcf6cda 633 // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['alias'] = 'None'
whismanoid 90:d6ed8a8c5f26 634 // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['argtype'] = 'int'
whismanoid 59:47538bcf6cda 635 // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['usedByCommandName'] = 'None'
whismanoid 59:47538bcf6cda 636 // CODE GENERATOR: testMenuGlobalArgsDict['ADCb']['usedBytestMenuItemName'] = 'None'
whismanoid 90:d6ed8a8c5f26 637 // parse argument int ADCb
whismanoid 90:d6ed8a8c5f26 638 //int ADCb = 0; // ~~~ g_MAX11043_device.__WARNING_no_match_for_argname_ADCb_in_MAX11043_device_t__; // default to global property value
whismanoid 90:d6ed8a8c5f26 639 //if (cmdLine.parse_int16_dec("ADCb", ADCb))
whismanoid 90:d6ed8a8c5f26 640 //{
whismanoid 90:d6ed8a8c5f26 641 // // g_MAX11043_device.__WARNING_no_match_for_argname_ADCb_in_MAX11043_device_t__ = ADCb; // update global property value
whismanoid 90:d6ed8a8c5f26 642 //}
whismanoid 52:607010f0c54e 643
whismanoid 59:47538bcf6cda 644 // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['alias'] = 'None'
whismanoid 90:d6ed8a8c5f26 645 // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['argtype'] = 'int'
whismanoid 59:47538bcf6cda 646 // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['usedByCommandName'] = 'None'
whismanoid 59:47538bcf6cda 647 // CODE GENERATOR: testMenuGlobalArgsDict['ADCc']['usedBytestMenuItemName'] = 'None'
whismanoid 90:d6ed8a8c5f26 648 // parse argument int ADCc
whismanoid 90:d6ed8a8c5f26 649 //int ADCc = 0; // ~~~ g_MAX11043_device.__WARNING_no_match_for_argname_ADCc_in_MAX11043_device_t__; // default to global property value
whismanoid 90:d6ed8a8c5f26 650 //if (cmdLine.parse_int16_dec("ADCc", ADCc))
whismanoid 90:d6ed8a8c5f26 651 //{
whismanoid 90:d6ed8a8c5f26 652 // // g_MAX11043_device.__WARNING_no_match_for_argname_ADCc_in_MAX11043_device_t__ = ADCc; // update global property value
whismanoid 90:d6ed8a8c5f26 653 //}
whismanoid 52:607010f0c54e 654
whismanoid 59:47538bcf6cda 655 // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['alias'] = 'None'
whismanoid 90:d6ed8a8c5f26 656 // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['argtype'] = 'int'
whismanoid 59:47538bcf6cda 657 // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['usedByCommandName'] = 'None'
whismanoid 59:47538bcf6cda 658 // CODE GENERATOR: testMenuGlobalArgsDict['ADCd']['usedBytestMenuItemName'] = 'None'
whismanoid 90:d6ed8a8c5f26 659 // parse argument int ADCd
whismanoid 90:d6ed8a8c5f26 660 //int ADCd = 0; // ~~~ g_MAX11043_device.__WARNING_no_match_for_argname_ADCd_in_MAX11043_device_t__; // default to global property value
whismanoid 90:d6ed8a8c5f26 661 //if (cmdLine.parse_int16_dec("ADCd", ADCd))
whismanoid 90:d6ed8a8c5f26 662 //{
whismanoid 90:d6ed8a8c5f26 663 // // g_MAX11043_device.__WARNING_no_match_for_argname_ADCd_in_MAX11043_device_t__ = ADCd; // update global property value
whismanoid 90:d6ed8a8c5f26 664 //}
whismanoid 52:607010f0c54e 665
whismanoid 59:47538bcf6cda 666 // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['alias'] = 'None'
whismanoid 59:47538bcf6cda 667 // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['argtype'] = 'double'
whismanoid 59:47538bcf6cda 668 // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['usedByCommandName'] = 'None'
whismanoid 59:47538bcf6cda 669 // CODE GENERATOR: testMenuGlobalArgsDict['VRef']['usedBytestMenuItemName'] = 'None'
whismanoid 59:47538bcf6cda 670 // parse argument double VRef
whismanoid 59:47538bcf6cda 671 double VRef = g_MAX11043_device.VRef; // default to global property value
whismanoid 59:47538bcf6cda 672 if (cmdLine.parse_double("VRef", VRef))
whismanoid 52:607010f0c54e 673 {
whismanoid 59:47538bcf6cda 674 g_MAX11043_device.VRef = VRef; // update global property value
whismanoid 59:47538bcf6cda 675 }
whismanoid 59:47538bcf6cda 676
whismanoid 59:47538bcf6cda 677 // CODE GENERATOR: testMenuGlobalArgsDict['config']['alias'] = 'None'
whismanoid 59:47538bcf6cda 678 // CODE GENERATOR: testMenuGlobalArgsDict['config']['argtype'] = 'uint16_t'
whismanoid 59:47538bcf6cda 679 // CODE GENERATOR: testMenuGlobalArgsDict['config']['usedByCommandName'] = 'None'
whismanoid 59:47538bcf6cda 680 // CODE GENERATOR: testMenuGlobalArgsDict['config']['usedBytestMenuItemName'] = 'None'
whismanoid 59:47538bcf6cda 681 // parse argument uint16_t config
whismanoid 59:47538bcf6cda 682 uint16_t config = g_MAX11043_device.config; // default to global property value
whismanoid 59:47538bcf6cda 683 if (cmdLine.parse_uint16_dec("config", config))
whismanoid 59:47538bcf6cda 684 {
whismanoid 59:47538bcf6cda 685 g_MAX11043_device.config = config; // update global property value
whismanoid 52:607010f0c54e 686 }
whismanoid 52:607010f0c54e 687
whismanoid 52:607010f0c54e 688 // CODE GENERATOR: testMenuGlobalArgsDict['status']['alias'] = 'None'
whismanoid 90:d6ed8a8c5f26 689 // CODE GENERATOR: testMenuGlobalArgsDict['status']['argtype'] = 'uint8_t'
whismanoid 52:607010f0c54e 690 // CODE GENERATOR: testMenuGlobalArgsDict['status']['usedByCommandName'] = 'None'
whismanoid 52:607010f0c54e 691 // CODE GENERATOR: testMenuGlobalArgsDict['status']['usedBytestMenuItemName'] = 'None'
whismanoid 90:d6ed8a8c5f26 692 // parse argument uint8_t status
whismanoid 90:d6ed8a8c5f26 693 uint8_t status = g_MAX11043_device.status; // default to global property value
whismanoid 90:d6ed8a8c5f26 694 if (cmdLine.parse_uint8_dec("status", status))
whismanoid 52:607010f0c54e 695 {
whismanoid 52:607010f0c54e 696 g_MAX11043_device.status = status; // update global property value
whismanoid 52:607010f0c54e 697 }
whismanoid 52:607010f0c54e 698
whismanoid 52:607010f0c54e 699 switch (cmdLine[0])
whismanoid 52:607010f0c54e 700 {
whismanoid 84:11cc360628a1 701 #if Has_Read4Command_Command
whismanoid 83:29bb86cc45bc 702 // Read 4 command -- Single 4-channel read: CONVRUN pulsed H then L, EOC ignored.
whismanoid 83:29bb86cc45bc 703 case '^':
whismanoid 83:29bb86cc45bc 704 {
whismanoid 83:29bb86cc45bc 705 // cmdLine.serial().printf("\r\n ^ -- Single 4-channel read: CONVRUN pulsed H then L, EOC ignored.");
whismanoid 84:11cc360628a1 706 #if Use_Read4Command_Thread
whismanoid 85:a47ed024c508 707 Callback<void(size_t, uint8_t*, uint8_t*)> saved_onSPIprint_handler = g_MAX11043_device.onSPIprint;
whismanoid 85:a47ed024c508 708 g_MAX11043_device.onSPIprint = NULL; // temporarily suppress SPI diagnostic messages
whismanoid 84:11cc360628a1 709 //~ int convrun_pulse_width_us = 30;
whismanoid 84:11cc360628a1 710 //~ int convrun_stop_us = 10;
whismanoid 85:a47ed024c508 711 cmdLine.serial().printf(" Testing CONVRUN pulsed H then L, EOC ignored.\r\n");
whismanoid 85:a47ed024c508 712 cmdLine.serial().printf(" press D to display min/max limits (based on data seen)\r\n");
whismanoid 85:a47ed024c508 713 cmdLine.serial().printf(" press R to reset min/max limits (force scope trigger)\r\n");
whismanoid 88:e4fd5033a55f 714 cmdLine.serial().printf(" press F for fake data +32767, +1, -1, -32768 (internal 2's complement test) \r\n");
whismanoid 85:a47ed024c508 715 cmdLine.serial().printf(" press X to stop...\r\n");
whismanoid 84:11cc360628a1 716 //~ cmdLine.serial().printf(" Testing, press RESET to stop...\r\n");
whismanoid 84:11cc360628a1 717 //~ int serial_is_blocking = cmdLine.serial().is_blocking();
whismanoid 84:11cc360628a1 718 //~ cmdLine.serial().set_blocking(0);
whismanoid 84:11cc360628a1 719 //
whismanoid 84:11cc360628a1 720 #if MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 84:11cc360628a1 721 digitalInOut5.output(); // ScopeTrigger
whismanoid 84:11cc360628a1 722 digitalInOut5.write(1); // ScopeTrigger
whismanoid 84:11cc360628a1 723 #endif // MAX11043_ScopeTrigger_MAX32625MBED_D5
whismanoid 84:11cc360628a1 724 //
whismanoid 85:a47ed024c508 725 // reset min/max limits
whismanoid 86:c116654dfa32 726 adca_MIN_SEEN = adcX_MIN_SEEN_INIT_INT16_MAX;
whismanoid 86:c116654dfa32 727 adca_MAX_SEEN = adcX_MAX_SEEN_INIT_INT16_MIN;
whismanoid 86:c116654dfa32 728 adcb_MIN_SEEN = adcX_MIN_SEEN_INIT_INT16_MAX;
whismanoid 86:c116654dfa32 729 adcb_MAX_SEEN = adcX_MAX_SEEN_INIT_INT16_MIN;
whismanoid 85:a47ed024c508 730 //
whismanoid 85:a47ed024c508 731 // init thread
whismanoid 84:11cc360628a1 732 Read4Command_Thread.start(Read4Command_Thread_handler);
whismanoid 84:11cc360628a1 733 // TODO: is there any harm in multiple start?
whismanoid 84:11cc360628a1 734 //
whismanoid 84:11cc360628a1 735 // Start the test
whismanoid 84:11cc360628a1 736 Read4Command_Thread_event_flags.set(MYTIMEREVENTFLAG_ENABLE_SPI);
whismanoid 84:11cc360628a1 737 // Work will be done inside Read4Command_Thread_handler
whismanoid 84:11cc360628a1 738 while (1)
whismanoid 84:11cc360628a1 739 {
whismanoid 84:11cc360628a1 740 char ch = cmdLine.serial().getc(); // blocking read
whismanoid 84:11cc360628a1 741 if (ch == '\r') { cmdLine.serial().printf(" (ignored \\r) "); continue; }
whismanoid 84:11cc360628a1 742 if (ch == '\n') { cmdLine.serial().printf(" (ignored \\n) "); continue; }
whismanoid 85:a47ed024c508 743 if (ch == '?') {
whismanoid 85:a47ed024c508 744 cmdLine.serial().printf(" Testing CONVRUN pulsed H then L, EOC ignored.\r\n");
whismanoid 85:a47ed024c508 745 cmdLine.serial().printf(" press D to display min/max limits (based on data seen)\r\n");
whismanoid 85:a47ed024c508 746 cmdLine.serial().printf(" press R to reset min/max limits (force scope trigger)\r\n");
whismanoid 88:e4fd5033a55f 747 cmdLine.serial().printf(" press F for fake data +32767, +1, -1, -32768 (internal 2's complement test) \r\n");
whismanoid 85:a47ed024c508 748 cmdLine.serial().printf(" press X to stop...\r\n");
whismanoid 85:a47ed024c508 749 continue;
whismanoid 85:a47ed024c508 750 }
whismanoid 85:a47ed024c508 751 if (ch == 'R' || ch == 'r') {
whismanoid 85:a47ed024c508 752 // reset min/max limits
whismanoid 88:e4fd5033a55f 753 Read4Command_Thread_event_flags.clear(MYTIMEREVENTFLAG_FAKE_DATA);
whismanoid 88:e4fd5033a55f 754 Read4Command_Thread_event_flags.set(MYTIMEREVENTFLAG_RESET_MINMAX);
whismanoid 88:e4fd5033a55f 755 cmdLine.serial().printf(" Reset limts \r\n");
whismanoid 88:e4fd5033a55f 756 wait_us(100);
whismanoid 87:4bc981dfd54b 757 }
whismanoid 88:e4fd5033a55f 758 if (ch == 'F' || ch == 'f') {
whismanoid 88:e4fd5033a55f 759 // fake data
whismanoid 88:e4fd5033a55f 760 Read4Command_Thread_event_flags.set(MYTIMEREVENTFLAG_FAKE_DATA);
whismanoid 88:e4fd5033a55f 761 // g_MAX11043_device.adca = 0x7FFF; // +32767 adcX_MIN_SEEN_INIT_INT16_MAX;
whismanoid 88:e4fd5033a55f 762 // g_MAX11043_device.adcb = 0x0001; // +1
whismanoid 88:e4fd5033a55f 763 // g_MAX11043_device.adcc = 0xFFFF; // -1
whismanoid 88:e4fd5033a55f 764 // g_MAX11043_device.adcd = 0x8000; // -32768 adcX_MAX_SEEN_INIT_INT16_MIN;
whismanoid 88:e4fd5033a55f 765 cmdLine.serial().printf(" fake data +32767, +1, -1, -32768 (internal 2's complement test) \r\n");
whismanoid 88:e4fd5033a55f 766 wait_us(100);
whismanoid 88:e4fd5033a55f 767 }
whismanoid 88:e4fd5033a55f 768 if (ch == 'D' || ch == 'd' || ch == 'F' || ch == 'f' || ch == 'R' || ch == 'r' || ch == 'X' || ch == 'x' || ch == '\x03') {
whismanoid 87:4bc981dfd54b 769 // display min/max limits
whismanoid 88:e4fd5033a55f 770 cmdLine.serial().printf(" %s\tNEW 0x%4.4x %+6d \tMIN 0x%4.4x %+6d \tMAX 0x%4.4x %+6d \r\n",
whismanoid 87:4bc981dfd54b 771 "adca",
whismanoid 87:4bc981dfd54b 772 (adca_newest & 0xFFFF),
whismanoid 87:4bc981dfd54b 773 (adca_newest ),
whismanoid 87:4bc981dfd54b 774 (adca_MIN_SEEN & 0xFFFF),
whismanoid 87:4bc981dfd54b 775 (adca_MIN_SEEN ),
whismanoid 87:4bc981dfd54b 776 (adca_MAX_SEEN & 0xFFFF),
whismanoid 87:4bc981dfd54b 777 (adca_MAX_SEEN )
whismanoid 87:4bc981dfd54b 778 );
whismanoid 88:e4fd5033a55f 779 cmdLine.serial().printf(" %s\tNEW 0x%4.4x %+6d \tMIN 0x%4.4x %+6d \tMAX 0x%4.4x %+6d \r\n",
whismanoid 87:4bc981dfd54b 780 "adcb",
whismanoid 87:4bc981dfd54b 781 (adcb_newest & 0xFFFF),
whismanoid 87:4bc981dfd54b 782 (adcb_newest ),
whismanoid 87:4bc981dfd54b 783 (adcb_MIN_SEEN & 0xFFFF),
whismanoid 87:4bc981dfd54b 784 (adcb_MIN_SEEN ),
whismanoid 87:4bc981dfd54b 785 (adcb_MAX_SEEN & 0xFFFF),
whismanoid 87:4bc981dfd54b 786 (adcb_MAX_SEEN )
whismanoid 87:4bc981dfd54b 787 );
whismanoid 88:e4fd5033a55f 788 cmdLine.serial().printf(" %s\tNEW 0x%4.4x %+6d \tMIN 0x%4.4x %+6d \tMAX 0x%4.4x %+6d \r\n",
whismanoid 87:4bc981dfd54b 789 "adcc",
whismanoid 87:4bc981dfd54b 790 (adcc_newest & 0xFFFF),
whismanoid 87:4bc981dfd54b 791 (adcc_newest ),
whismanoid 87:4bc981dfd54b 792 (adcc_MIN_SEEN & 0xFFFF),
whismanoid 87:4bc981dfd54b 793 (adcc_MIN_SEEN ),
whismanoid 87:4bc981dfd54b 794 (adcc_MAX_SEEN & 0xFFFF),
whismanoid 87:4bc981dfd54b 795 (adcc_MAX_SEEN )
whismanoid 87:4bc981dfd54b 796 );
whismanoid 88:e4fd5033a55f 797 cmdLine.serial().printf(" %s\tNEW 0x%4.4x %+6d \tMIN 0x%4.4x %+6d \tMAX 0x%4.4x %+6d \r\n",
whismanoid 88:e4fd5033a55f 798 "adcd__",
whismanoid 87:4bc981dfd54b 799 (adcd_newest & 0xFFFF),
whismanoid 87:4bc981dfd54b 800 (adcd_newest ),
whismanoid 87:4bc981dfd54b 801 (adcd_MIN_SEEN & 0xFFFF),
whismanoid 87:4bc981dfd54b 802 (adcd_MIN_SEEN ),
whismanoid 87:4bc981dfd54b 803 (adcd_MAX_SEEN & 0xFFFF),
whismanoid 87:4bc981dfd54b 804 (adcd_MAX_SEEN )
whismanoid 87:4bc981dfd54b 805 );
whismanoid 93:6b22269935a6 806 cmdLine.serial().printf("\r\n");
whismanoid 87:4bc981dfd54b 807 }
whismanoid 88:e4fd5033a55f 808 if (ch == 'D' || ch == 'd' || ch == 'F' || ch == 'f' || ch == 'R' || ch == 'r') {
whismanoid 85:a47ed024c508 809 continue;
whismanoid 85:a47ed024c508 810 }
whismanoid 85:a47ed024c508 811 if (ch == 'X' || ch == 'x' || ch == '\x03') {
whismanoid 85:a47ed024c508 812 break;
whismanoid 85:a47ed024c508 813 }
whismanoid 93:6b22269935a6 814 cmdLine.serial().printf(" (ignored \\x%2.2x)\r\nD:Display F:Fake R:Reset X:Exit\r\n", (int)ch);
whismanoid 84:11cc360628a1 815 }
whismanoid 84:11cc360628a1 816 // Stop the test
whismanoid 84:11cc360628a1 817 Read4Command_Thread_event_flags.clear(MYTIMEREVENTFLAG_ENABLE_SPI);
whismanoid 93:6b22269935a6 818 wait_us(200);
whismanoid 84:11cc360628a1 819 //~ cmdLine.serial().set_blocking(serial_is_blocking);
whismanoid 84:11cc360628a1 820 cmdLine.serial().printf(" Stopped.\r\n");
whismanoid 85:a47ed024c508 821 g_MAX11043_device.onSPIprint = saved_onSPIprint_handler;
whismanoid 84:11cc360628a1 822 #else // Use_Read4Command_Thread
whismanoid 83:29bb86cc45bc 823 int convrun_pulse_width_us = 30;
whismanoid 83:29bb86cc45bc 824 int convrun_stop_us = 10;
whismanoid 83:29bb86cc45bc 825 //~ cmdLine.serial().printf(" Testing, press X to stop...\r\n");
whismanoid 83:29bb86cc45bc 826 cmdLine.serial().printf(" Testing, press RESET to stop...\r\n");
whismanoid 83:29bb86cc45bc 827 //~ int serial_is_blocking = cmdLine.serial().is_blocking();
whismanoid 83:29bb86cc45bc 828 //~ cmdLine.serial().set_blocking(0);
whismanoid 83:29bb86cc45bc 829 while (1)
whismanoid 83:29bb86cc45bc 830 {
whismanoid 83:29bb86cc45bc 831 // TODO: CONVRUN = H -- perform ADC conversions (EOC will pulse, and data registers will update)
whismanoid 83:29bb86cc45bc 832 g_MAX11043_device.CONVRUNoutputValue(1);
whismanoid 83:29bb86cc45bc 833 //
whismanoid 83:29bb86cc45bc 834 // TODO: delay at least 9us to ensure at least one converion happens
whismanoid 83:29bb86cc45bc 835 wait_us(convrun_pulse_width_us);
whismanoid 83:29bb86cc45bc 836 //
whismanoid 83:29bb86cc45bc 837 // TODO: CONVRUN = L -- stop ADC conversions
whismanoid 83:29bb86cc45bc 838 g_MAX11043_device.CONVRUNoutputValue(0);
whismanoid 83:29bb86cc45bc 839 //
whismanoid 83:29bb86cc45bc 840 // TODO: delay at least 9us to ensure final converion complete
whismanoid 83:29bb86cc45bc 841 wait_us(convrun_stop_us);
whismanoid 83:29bb86cc45bc 842 //
whismanoid 83:29bb86cc45bc 843 // TODO: run SPI to capture 4 channels
whismanoid 83:29bb86cc45bc 844 // TODO: get rid of the other interrupt/thread, only to read here
whismanoid 83:29bb86cc45bc 845 g_MAX11043_device.Read_ADCabcd();
whismanoid 83:29bb86cc45bc 846 // post: g_MAX11043_device.adca was updated
whismanoid 83:29bb86cc45bc 847 // post: g_MAX11043_device.adcb was updated
whismanoid 83:29bb86cc45bc 848 // post: g_MAX11043_device.adcc was updated
whismanoid 83:29bb86cc45bc 849 // post: g_MAX11043_device.adcd was updated
whismanoid 83:29bb86cc45bc 850 //
whismanoid 83:29bb86cc45bc 851 // TODO: compare with thresholds, report if exceeded
whismanoid 83:29bb86cc45bc 852 //
whismanoid 83:29bb86cc45bc 853 // TODO: break on keypress
whismanoid 83:29bb86cc45bc 854 // TODO: this isn't working, serial().getc() is blocking and .readable() always returns 1 so we stall in getc().
whismanoid 83:29bb86cc45bc 855 unsigned int num_read_available = cmdLine.serial().readable();
whismanoid 83:29bb86cc45bc 856 if (num_read_available > 1) // should test >0; but always returns 1?
whismanoid 83:29bb86cc45bc 857 {
whismanoid 83:29bb86cc45bc 858 cmdLine.serial().printf(" (num_read_available %u) ", num_read_available);
whismanoid 83:29bb86cc45bc 859 char ch = cmdLine.serial().getc(); // blocking read
whismanoid 83:29bb86cc45bc 860 if (ch == '\r') { cmdLine.serial().printf(" (ignored \\r) "); continue; }
whismanoid 83:29bb86cc45bc 861 if (ch == '\n') { cmdLine.serial().printf(" (ignored \\n) "); continue; }
whismanoid 83:29bb86cc45bc 862 if (ch == '\x03') break; // CTRL+C break
whismanoid 83:29bb86cc45bc 863 if (ch == 'x') break;
whismanoid 83:29bb86cc45bc 864 if (ch == 'X') break;
whismanoid 83:29bb86cc45bc 865 cmdLine.serial().printf(" (ignored \\x%2.2x) ", (int)ch);
whismanoid 83:29bb86cc45bc 866 }
whismanoid 83:29bb86cc45bc 867 }
whismanoid 83:29bb86cc45bc 868 //~ cmdLine.serial().set_blocking(serial_is_blocking);
whismanoid 83:29bb86cc45bc 869 cmdLine.serial().printf(" Stopped.\r\n");
whismanoid 84:11cc360628a1 870 #endif // Use_Read4Command_Thread
whismanoid 83:29bb86cc45bc 871 return true; // command handled by MAX11043
whismanoid 83:29bb86cc45bc 872 }
whismanoid 83:29bb86cc45bc 873 break;
whismanoid 84:11cc360628a1 874 #endif // Has_Read4Command_Command
whismanoid 52:607010f0c54e 875 // CODE GENERATOR: generate * command read/write reg *reg? *reg=value
whismanoid 52:607010f0c54e 876 case '*':
whismanoid 52:607010f0c54e 877 {
whismanoid 52:607010f0c54e 878 // if buffer starts with a regName:
whismanoid 52:607010f0c54e 879 // for each reg value (0..n) if(cmdLine.has_keyword(device.regName(r))):
whismanoid 52:607010f0c54e 880 cmdLine.serial().printf(" scan RegName...\r\n");
whismanoid 52:607010f0c54e 881 for (uint8_t regAddress = 0; regAddress < 0x80; regAddress++)
whismanoid 52:607010f0c54e 882 {
whismanoid 52:607010f0c54e 883 uint32_t regData = 0;
whismanoid 52:607010f0c54e 884 bool is_regname_query = false;
whismanoid 52:607010f0c54e 885 bool is_regname_assignment = false;
whismanoid 52:607010f0c54e 886 if (cmdLine.parse_uint32_dec(g_MAX11043_device.RegName((MAX11043::MAX11043_CMD_enum_t)regAddress), regData))
whismanoid 52:607010f0c54e 887 {
whismanoid 52:607010f0c54e 888 cmdLine.serial().printf(" regAddress=0x%2.2X\r\n", (regAddress & 0xFF));
whismanoid 52:607010f0c54e 889 cmdLine.serial().printf(" RegName=%s\r\n", g_MAX11043_device.RegName((MAX11043::MAX11043_CMD_enum_t)regAddress));
whismanoid 52:607010f0c54e 890 // accept regName "?" as "RegRead" by name
whismanoid 52:607010f0c54e 891 is_regname_query = (cmdLine.chSeparator == '?');
whismanoid 52:607010f0c54e 892 is_regname_assignment = (cmdLine.chSeparator == '=');
whismanoid 52:607010f0c54e 893 if (is_regname_query)
whismanoid 52:607010f0c54e 894 {
whismanoid 52:607010f0c54e 895 cmdLine.serial().printf(" RegRead");
whismanoid 52:607010f0c54e 896 g_MAX11043_device.RegRead((MAX11043::MAX11043_CMD_enum_t)regAddress, &regData);
whismanoid 52:607010f0c54e 897 cmdLine.serial().printf("regData=0x%6.6x\r\n", (regData & 0x00FFFFFF));
whismanoid 52:607010f0c54e 898 return true; // command handled by MAX11043
whismanoid 52:607010f0c54e 899 }
whismanoid 52:607010f0c54e 900 // accept regName "=0x123456" as "RegWrite" by name
whismanoid 52:607010f0c54e 901 if (is_regname_assignment)
whismanoid 52:607010f0c54e 902 {
whismanoid 52:607010f0c54e 903 cmdLine.serial().printf(" RegWrite");
whismanoid 52:607010f0c54e 904 cmdLine.serial().printf("regData=0x%6.6x\r\n", (regData & 0x00FFFFFF));
whismanoid 52:607010f0c54e 905 g_MAX11043_device.RegWrite((MAX11043::MAX11043_CMD_enum_t)regAddress, regData);
whismanoid 52:607010f0c54e 906 return true; // command handled by MAX11043
whismanoid 52:607010f0c54e 907 }
whismanoid 52:607010f0c54e 908 }
whismanoid 52:607010f0c54e 909 } // end for regAddr
whismanoid 52:607010f0c54e 910 // not a valid register name
whismanoid 57:1c9da8e90737 911 Callback<void(size_t, uint8_t*, uint8_t*)> saved_onSPIprint_handler = g_MAX11043_device.onSPIprint;
whismanoid 57:1c9da8e90737 912 g_MAX11043_device.onSPIprint = NULL; // temporarily suppress SPI diagnostic messages
whismanoid 52:607010f0c54e 913 // read "all" registers by name
whismanoid 57:1c9da8e90737 914 // TODO: KLUDGE: this constant array should live in the device driver, not the menu
whismanoid 57:1c9da8e90737 915 const MAX11043::MAX11043_CMD_enum_t readAllStatusList[] = {
whismanoid 59:47538bcf6cda 916 MAX11043::CMD_0000_0010_d16o8_Rd00_ADCa,
whismanoid 59:47538bcf6cda 917 MAX11043::CMD_0000_0110_d16o8_Rd01_ADCb,
whismanoid 59:47538bcf6cda 918 MAX11043::CMD_0000_1010_d16o8_Rd02_ADCc,
whismanoid 59:47538bcf6cda 919 MAX11043::CMD_0000_1110_d16o8_Rd03_ADCd,
whismanoid 57:1c9da8e90737 920 MAX11043::CMD_0001_1110_d8_Rd07_Status,
whismanoid 57:1c9da8e90737 921 MAX11043::CMD_0010_0010_d16_Rd08_Configuration,
whismanoid 57:1c9da8e90737 922 MAX11043::CMD_0010_0110_d16_Rd09_DAC,
whismanoid 57:1c9da8e90737 923 MAX11043::CMD_0010_1010_d16_Rd0A_DACStep,
whismanoid 57:1c9da8e90737 924 MAX11043::CMD_0010_1110_d16_Rd0B_DACHDACL,
whismanoid 57:1c9da8e90737 925 MAX11043::CMD_0011_0010_d16_Rd0C_ConfigA,
whismanoid 57:1c9da8e90737 926 MAX11043::CMD_0011_0110_d16_Rd0D_ConfigB,
whismanoid 57:1c9da8e90737 927 MAX11043::CMD_0011_1010_d16_Rd0E_ConfigC,
whismanoid 57:1c9da8e90737 928 MAX11043::CMD_0011_1110_d16_Rd0F_ConfigD,
whismanoid 57:1c9da8e90737 929 MAX11043::CMD_0100_0010_d16_Rd10_Reference,
whismanoid 57:1c9da8e90737 930 MAX11043::CMD_0100_0110_d16_Rd11_AGain,
whismanoid 57:1c9da8e90737 931 MAX11043::CMD_0100_1010_d16_Rd12_BGain,
whismanoid 57:1c9da8e90737 932 MAX11043::CMD_0100_1110_d16_Rd13_CGain,
whismanoid 57:1c9da8e90737 933 MAX11043::CMD_0101_0010_d16_Rd14_DGain,
whismanoid 57:1c9da8e90737 934 };
whismanoid 57:1c9da8e90737 935 for (uint8_t readAllStatusIndex = 0; readAllStatusIndex < (sizeof(readAllStatusList)/sizeof(MAX11043::MAX11043_CMD_enum_t)); readAllStatusIndex++)
whismanoid 52:607010f0c54e 936 {
whismanoid 57:1c9da8e90737 937 MAX11043::MAX11043_CMD_enum_t regAddress = readAllStatusList[readAllStatusIndex];
whismanoid 52:607010f0c54e 938 uint32_t regData = 0;
whismanoid 57:1c9da8e90737 939 if (g_MAX11043_device.RegSize(regAddress) == 0) continue; // skip undefined regs
whismanoid 57:1c9da8e90737 940 if (g_MAX11043_device.RegRead(regAddress, &regData) == 0) continue; // skip unreadable regs
whismanoid 57:1c9da8e90737 941 cmdLine.serial().printf("%s=0x%6.6x\r\n", g_MAX11043_device.RegName(regAddress), regData);
whismanoid 52:607010f0c54e 942 } // end for regAddr
whismanoid 52:607010f0c54e 943 g_MAX11043_device.onSPIprint = saved_onSPIprint_handler;
whismanoid 52:607010f0c54e 944 return true; // command handled by MAX11043
whismanoid 52:607010f0c54e 945 }
whismanoid 52:607010f0c54e 946 break;
whismanoid 52:607010f0c54e 947
whismanoid 52:607010f0c54e 948 // CODE GENERATOR: generate @ command print global property values of g_MAX11043_device
whismanoid 52:607010f0c54e 949 case '@':
whismanoid 52:607010f0c54e 950 {
whismanoid 59:47538bcf6cda 951 // CODE GENERATOR: @ command print double g_MAX11043_device.VRef
whismanoid 59:47538bcf6cda 952 cmdLine.serial().printf("VRef = ");
whismanoid 59:47538bcf6cda 953 cmdLine.serial().printf("%f\r\n", g_MAX11043_device.VRef);
whismanoid 59:47538bcf6cda 954 // CODE GENERATOR: @ command print uint16_t g_MAX11043_device.config
whismanoid 59:47538bcf6cda 955 cmdLine.serial().printf("config = ");
whismanoid 59:47538bcf6cda 956 cmdLine.serial().printf("%d = 0x%4.4x\r\n", g_MAX11043_device.config, g_MAX11043_device.config);
whismanoid 90:d6ed8a8c5f26 957 // CODE GENERATOR: @ command print uint8_t g_MAX11043_device.status
whismanoid 52:607010f0c54e 958 cmdLine.serial().printf("status = ");
whismanoid 90:d6ed8a8c5f26 959 cmdLine.serial().printf("%d = 0x%2.2x\r\n", g_MAX11043_device.status, g_MAX11043_device.status);
whismanoid 90:d6ed8a8c5f26 960 // CODE GENERATOR: @ command print int g_MAX11043_device.adca
whismanoid 59:47538bcf6cda 961 cmdLine.serial().printf("adca = ");
whismanoid 59:47538bcf6cda 962 cmdLine.serial().printf("%d = 0x%8.8x\r\n", g_MAX11043_device.adca, g_MAX11043_device.adca);
whismanoid 90:d6ed8a8c5f26 963 // CODE GENERATOR: @ command print int g_MAX11043_device.adcb
whismanoid 59:47538bcf6cda 964 cmdLine.serial().printf("adcb = ");
whismanoid 59:47538bcf6cda 965 cmdLine.serial().printf("%d = 0x%8.8x\r\n", g_MAX11043_device.adcb, g_MAX11043_device.adcb);
whismanoid 90:d6ed8a8c5f26 966 // CODE GENERATOR: @ command print int g_MAX11043_device.adcc
whismanoid 59:47538bcf6cda 967 cmdLine.serial().printf("adcc = ");
whismanoid 59:47538bcf6cda 968 cmdLine.serial().printf("%d = 0x%8.8x\r\n", g_MAX11043_device.adcc, g_MAX11043_device.adcc);
whismanoid 90:d6ed8a8c5f26 969 // CODE GENERATOR: @ command print int g_MAX11043_device.adcd
whismanoid 59:47538bcf6cda 970 cmdLine.serial().printf("adcd = ");
whismanoid 59:47538bcf6cda 971 cmdLine.serial().printf("%d = 0x%8.8x\r\n", g_MAX11043_device.adcd, g_MAX11043_device.adcd);
whismanoid 52:607010f0c54e 972 return true; // command handled by MAX11043
whismanoid 52:607010f0c54e 973 break;
whismanoid 52:607010f0c54e 974 }
whismanoid 52:607010f0c54e 975 // CODE GENERATOR: TODO1: generate GPIO commands for LDAC, CLR, etc. based on device driver function names
whismanoid 52:607010f0c54e 976 // case 'G'..'Z','g'..'z' are reserved for GPIO commands
whismanoid 52:607010f0c54e 977 // case 'A'..'F','a'..'f' may be available if not claimed by bitstream commands
whismanoid 66:3fe92f6f1cfa 978 // CODE GENERATOR: ExternFunctionGPIOPinCommand 'H' 'CONVRUN'
whismanoid 52:607010f0c54e 979 // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['PinName'] = 'CONVRUN'
whismanoid 52:607010f0c54e 980 // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['Direction'] = 'output'
whismanoid 52:607010f0c54e 981 // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 982 // CODE GENERATOR: testMenuGPIOItemsDict['CONVRUN']['FunctionName'] = 'CONVRUNoutputValue'
whismanoid 66:3fe92f6f1cfa 983 case 'H':
whismanoid 52:607010f0c54e 984 {
whismanoid 52:607010f0c54e 985 switch (cmdLine[1])
whismanoid 52:607010f0c54e 986 {
whismanoid 52:607010f0c54e 987 case 'H':
whismanoid 52:607010f0c54e 988 {
whismanoid 52:607010f0c54e 989 g_MAX11043_device.CONVRUNoutputValue(1);
whismanoid 52:607010f0c54e 990 break;
whismanoid 52:607010f0c54e 991 }
whismanoid 52:607010f0c54e 992 case 'L':
whismanoid 52:607010f0c54e 993 {
whismanoid 52:607010f0c54e 994 g_MAX11043_device.CONVRUNoutputValue(0);
whismanoid 52:607010f0c54e 995 break;
whismanoid 52:607010f0c54e 996 }
whismanoid 52:607010f0c54e 997 }
whismanoid 52:607010f0c54e 998 return true; // command handled by MAX11043
whismanoid 52:607010f0c54e 999 break;
whismanoid 52:607010f0c54e 1000 }
whismanoid 52:607010f0c54e 1001
whismanoid 66:3fe92f6f1cfa 1002 // CODE GENERATOR: ExternFunctionGPIOPinCommand 'I' 'DACSTEP'
whismanoid 52:607010f0c54e 1003 // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['PinName'] = 'DACSTEP'
whismanoid 52:607010f0c54e 1004 // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['Direction'] = 'output'
whismanoid 52:607010f0c54e 1005 // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 1006 // CODE GENERATOR: testMenuGPIOItemsDict['DACSTEP']['FunctionName'] = 'DACSTEPoutputValue'
whismanoid 66:3fe92f6f1cfa 1007 case 'I':
whismanoid 52:607010f0c54e 1008 {
whismanoid 52:607010f0c54e 1009 switch (cmdLine[1])
whismanoid 52:607010f0c54e 1010 {
whismanoid 52:607010f0c54e 1011 case 'H':
whismanoid 52:607010f0c54e 1012 {
whismanoid 52:607010f0c54e 1013 g_MAX11043_device.DACSTEPoutputValue(1);
whismanoid 52:607010f0c54e 1014 break;
whismanoid 52:607010f0c54e 1015 }
whismanoid 52:607010f0c54e 1016 case 'L':
whismanoid 52:607010f0c54e 1017 {
whismanoid 52:607010f0c54e 1018 g_MAX11043_device.DACSTEPoutputValue(0);
whismanoid 52:607010f0c54e 1019 break;
whismanoid 52:607010f0c54e 1020 }
whismanoid 52:607010f0c54e 1021 }
whismanoid 52:607010f0c54e 1022 return true; // command handled by MAX11043
whismanoid 52:607010f0c54e 1023 break;
whismanoid 52:607010f0c54e 1024 }
whismanoid 52:607010f0c54e 1025
whismanoid 66:3fe92f6f1cfa 1026 // CODE GENERATOR: ExternFunctionGPIOPinCommand 'J' 'EOC'
whismanoid 52:607010f0c54e 1027 // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['PinName'] = 'EOC'
whismanoid 52:607010f0c54e 1028 // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['Direction'] = 'input'
whismanoid 52:607010f0c54e 1029 // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 1030 // CODE GENERATOR: testMenuGPIOItemsDict['EOC']['FunctionName'] = 'EOCinputValue'
whismanoid 66:3fe92f6f1cfa 1031 case 'J':
whismanoid 52:607010f0c54e 1032 {
whismanoid 52:607010f0c54e 1033 // TODO capture and print input Value
whismanoid 52:607010f0c54e 1034 cmdLine.serial().printf("%d", g_MAX11043_device.EOCinputValue());
whismanoid 52:607010f0c54e 1035 return true; // command handled by MAX11043
whismanoid 52:607010f0c54e 1036 break;
whismanoid 52:607010f0c54e 1037 }
whismanoid 52:607010f0c54e 1038
whismanoid 52:607010f0c54e 1039 // CODE GENERATOR: ExternFunctionGPIOPinCommand 'S' 'SHDN'
whismanoid 52:607010f0c54e 1040 // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['PinName'] = 'SHDN'
whismanoid 52:607010f0c54e 1041 // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['Direction'] = 'output'
whismanoid 52:607010f0c54e 1042 // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 1043 // CODE GENERATOR: testMenuGPIOItemsDict['SHDN']['FunctionName'] = 'SHDNoutputValue'
whismanoid 52:607010f0c54e 1044 case 'S':
whismanoid 52:607010f0c54e 1045 {
whismanoid 52:607010f0c54e 1046 switch (cmdLine[1])
whismanoid 52:607010f0c54e 1047 {
whismanoid 52:607010f0c54e 1048 case 'H':
whismanoid 52:607010f0c54e 1049 {
whismanoid 52:607010f0c54e 1050 g_MAX11043_device.SHDNoutputValue(1);
whismanoid 52:607010f0c54e 1051 break;
whismanoid 52:607010f0c54e 1052 }
whismanoid 52:607010f0c54e 1053 case 'L':
whismanoid 52:607010f0c54e 1054 {
whismanoid 52:607010f0c54e 1055 g_MAX11043_device.SHDNoutputValue(0);
whismanoid 52:607010f0c54e 1056 break;
whismanoid 52:607010f0c54e 1057 }
whismanoid 52:607010f0c54e 1058 }
whismanoid 52:607010f0c54e 1059 return true; // command handled by MAX11043
whismanoid 52:607010f0c54e 1060 break;
whismanoid 52:607010f0c54e 1061 }
whismanoid 52:607010f0c54e 1062
whismanoid 52:607010f0c54e 1063 // CODE GENERATOR: ExternFunctionGPIOPinCommand 'U' 'UP_slash_DWNb'
whismanoid 52:607010f0c54e 1064 // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['PinName'] = 'UP_slash_DWNb'
whismanoid 52:607010f0c54e 1065 // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['Direction'] = 'output'
whismanoid 52:607010f0c54e 1066 // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['Operation'] = 'Value'
whismanoid 52:607010f0c54e 1067 // CODE GENERATOR: testMenuGPIOItemsDict['UP_slash_DWNb']['FunctionName'] = 'UP_slash_DWNboutputValue'
whismanoid 52:607010f0c54e 1068 case 'U':
whismanoid 52:607010f0c54e 1069 {
whismanoid 52:607010f0c54e 1070 switch (cmdLine[1])
whismanoid 52:607010f0c54e 1071 {
whismanoid 52:607010f0c54e 1072 case 'H':
whismanoid 52:607010f0c54e 1073 {
whismanoid 52:607010f0c54e 1074 g_MAX11043_device.UP_slash_DWNboutputValue(1);
whismanoid 52:607010f0c54e 1075 break;
whismanoid 52:607010f0c54e 1076 }
whismanoid 52:607010f0c54e 1077 case 'L':
whismanoid 52:607010f0c54e 1078 {
whismanoid 52:607010f0c54e 1079 g_MAX11043_device.UP_slash_DWNboutputValue(0);
whismanoid 52:607010f0c54e 1080 break;
whismanoid 52:607010f0c54e 1081 }
whismanoid 52:607010f0c54e 1082 }
whismanoid 52:607010f0c54e 1083 return true; // command handled by MAX11043
whismanoid 52:607010f0c54e 1084 break;
whismanoid 52:607010f0c54e 1085 }
whismanoid 52:607010f0c54e 1086
whismanoid 52:607010f0c54e 1087
whismanoid 52:607010f0c54e 1088 // CODE GENERATOR: test menu
whismanoid 52:607010f0c54e 1089 // case '0'..'9','A'..'F','a'..'f' letters are reserved for bitstream commands
whismanoid 52:607010f0c54e 1090 // has_register_write_command: case '0'..'9','A'..'F','a'..'f' letters are reserved for bitstream commands
whismanoid 52:607010f0c54e 1091 // CODE GENERATOR: top of loop: testMenuCommand="!", testMenuFirstCharHandler="None"
whismanoid 52:607010f0c54e 1092 // CODE GENERATOR: test menu case '!':
whismanoid 52:607010f0c54e 1093 // CODE GENERATOR: helpString '! -- Init'
whismanoid 52:607010f0c54e 1094 // CODE GENERATOR: CMD_ 'None'
whismanoid 52:607010f0c54e 1095 // CODE GENERATOR: CommandName 'Init'
whismanoid 52:607010f0c54e 1096 // CODE GENERATOR: CommandParamIn 'void'
whismanoid 52:607010f0c54e 1097 // CODE GENERATOR: CommandReturnType 'uint8_t'
whismanoid 52:607010f0c54e 1098 // CODE GENERATOR: CommandPre ''
whismanoid 52:607010f0c54e 1099 // CODE GENERATOR: CommandDocParamIn ''
whismanoid 52:607010f0c54e 1100 // CODE GENERATOR: CommandDocParamOut ''
whismanoid 52:607010f0c54e 1101 // CODE GENERATOR: CommandPost ''
whismanoid 52:607010f0c54e 1102 // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure'
whismanoid 52:607010f0c54e 1103 // case '!': // (single character) (testMenuFirstCharHandler="None")
whismanoid 52:607010f0c54e 1104 case '!':
whismanoid 52:607010f0c54e 1105 {
whismanoid 52:607010f0c54e 1106 // test menu command '!' handler:
whismanoid 52:607010f0c54e 1107 // helpString='! -- Init'
whismanoid 52:607010f0c54e 1108 // CMD_='None'
whismanoid 52:607010f0c54e 1109 // CommandName='Init'
whismanoid 52:607010f0c54e 1110 // CommandParamIn='void'
whismanoid 52:607010f0c54e 1111 // CommandReturnType='uint8_t'
whismanoid 52:607010f0c54e 1112 // @Pre=''
whismanoid 52:607010f0c54e 1113 // @Param[in]=''
whismanoid 52:607010f0c54e 1114 // @Param[out]=''
whismanoid 52:607010f0c54e 1115 // @Post=''
whismanoid 52:607010f0c54e 1116 // displayPost=''
whismanoid 52:607010f0c54e 1117 // @Return='@return 1 on success; 0 on failure'
whismanoid 52:607010f0c54e 1118 cmdLine.serial().printf("Init");
whismanoid 52:607010f0c54e 1119 // call function Init
whismanoid 52:607010f0c54e 1120 uint8_t result = g_MAX11043_device.Init();
whismanoid 65:2117e32f017d 1121 cmdLine.serial().printf(" =%d\r\n", result);
whismanoid 52:607010f0c54e 1122 return true; // command handled by MAX11043
whismanoid 52:607010f0c54e 1123 // CODE GENERATOR: bottom of loop: testMenuCommand="!", testMenuFirstCharHandler="None"
whismanoid 52:607010f0c54e 1124 } // end case '!'
whismanoid 52:607010f0c54e 1125 break;
whismanoid 52:607010f0c54e 1126
whismanoid 64:a667cfd83492 1127 // CODE GENERATOR: top of loop: testMenuCommand="$", testMenuFirstCharHandler="None"
whismanoid 64:a667cfd83492 1128 // CODE GENERATOR: test menu case '$':
whismanoid 64:a667cfd83492 1129 // CODE GENERATOR: helpString '$ -- Read_ADCabcd'
whismanoid 64:a667cfd83492 1130 // CODE GENERATOR: CMD_ 'None'
whismanoid 64:a667cfd83492 1131 // CODE GENERATOR: CommandName 'Read_ADCabcd'
whismanoid 64:a667cfd83492 1132 // CODE GENERATOR: CommandParamIn 'void'
whismanoid 64:a667cfd83492 1133 // CODE GENERATOR: CommandReturnType 'uint8_t'
whismanoid 64:a667cfd83492 1134 // CODE GENERATOR: CommandPre ''
whismanoid 64:a667cfd83492 1135 // CODE GENERATOR: CommandDocParamIn ''
whismanoid 64:a667cfd83492 1136 // CODE GENERATOR: CommandDocParamOut ''
whismanoid 64:a667cfd83492 1137 // CODE GENERATOR: CommandPost ''
whismanoid 64:a667cfd83492 1138 // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure'
whismanoid 64:a667cfd83492 1139 // case '$': // (single character) (testMenuFirstCharHandler="None")
whismanoid 64:a667cfd83492 1140 case '$':
whismanoid 64:a667cfd83492 1141 {
whismanoid 64:a667cfd83492 1142 // test menu command '$' handler:
whismanoid 64:a667cfd83492 1143 // helpString='$ -- Read_ADCabcd'
whismanoid 64:a667cfd83492 1144 // CMD_='None'
whismanoid 64:a667cfd83492 1145 // CommandName='Read_ADCabcd'
whismanoid 64:a667cfd83492 1146 // CommandParamIn='void'
whismanoid 64:a667cfd83492 1147 // CommandReturnType='uint8_t'
whismanoid 64:a667cfd83492 1148 // @Pre=''
whismanoid 64:a667cfd83492 1149 // @Param[in]=''
whismanoid 64:a667cfd83492 1150 // @Param[out]=''
whismanoid 64:a667cfd83492 1151 // @Post=''
whismanoid 64:a667cfd83492 1152 // displayPost='adca, adcb, adcc, adcd'
whismanoid 64:a667cfd83492 1153 // @Return='@return 1 on success; 0 on failure'
whismanoid 64:a667cfd83492 1154 cmdLine.serial().printf("Read_ADCabcd");
whismanoid 64:a667cfd83492 1155 // call function Read_ADCabcd
whismanoid 64:a667cfd83492 1156 uint8_t result = g_MAX11043_device.Read_ADCabcd();
whismanoid 65:2117e32f017d 1157 cmdLine.serial().printf(" =%d\r\n", result);
whismanoid 64:a667cfd83492 1158 // Menu item '$' -> adca, adcb, adcc, adcd
whismanoid 64:a667cfd83492 1159 cmdLine.serial().printf("%s=%d\r\n", "adca", g_MAX11043_device.adca);
whismanoid 64:a667cfd83492 1160 cmdLine.serial().printf("%s=%d\r\n", "adcb", g_MAX11043_device.adcb);
whismanoid 64:a667cfd83492 1161 cmdLine.serial().printf("%s=%d\r\n", "adcc", g_MAX11043_device.adcc);
whismanoid 64:a667cfd83492 1162 cmdLine.serial().printf("%s=%d\r\n", "adcd", g_MAX11043_device.adcd);
whismanoid 64:a667cfd83492 1163 return true; // command handled by MAX11043
whismanoid 64:a667cfd83492 1164 // CODE GENERATOR: bottom of loop: testMenuCommand="$", testMenuFirstCharHandler="None"
whismanoid 64:a667cfd83492 1165 } // end case '$'
whismanoid 64:a667cfd83492 1166 break;
whismanoid 64:a667cfd83492 1167
whismanoid 66:3fe92f6f1cfa 1168 // CODE GENERATOR: top of loop: testMenuCommand="G", testMenuFirstCharHandler="None"
whismanoid 66:3fe92f6f1cfa 1169 // CODE GENERATOR: test menu case 'G':
whismanoid 66:3fe92f6f1cfa 1170 // CODE GENERATOR: helpString 'G gain=? -- Write_AGain'
whismanoid 64:a667cfd83492 1171 // CODE GENERATOR: CMD_ 'None'
whismanoid 64:a667cfd83492 1172 // CODE GENERATOR: CommandName 'Write_AGain'
whismanoid 64:a667cfd83492 1173 // CODE GENERATOR: CommandParamIn 'uint32_t gain'
whismanoid 64:a667cfd83492 1174 // CODE GENERATOR: CommandReturnType 'uint8_t'
whismanoid 64:a667cfd83492 1175 // CODE GENERATOR: CommandPre ''
whismanoid 93:6b22269935a6 1176 // CODE GENERATOR: CommandDocParamIn '@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1V/V, 0x4000=2V/V, default=0x2000'
whismanoid 64:a667cfd83492 1177 // CODE GENERATOR: CommandDocParamOut ''
whismanoid 64:a667cfd83492 1178 // CODE GENERATOR: CommandPost ''
whismanoid 64:a667cfd83492 1179 // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure'
whismanoid 66:3fe92f6f1cfa 1180 // case 'G': // (single character) (testMenuFirstCharHandler="None")
whismanoid 66:3fe92f6f1cfa 1181 case 'G':
whismanoid 64:a667cfd83492 1182 {
whismanoid 66:3fe92f6f1cfa 1183 // test menu command 'G' handler:
whismanoid 66:3fe92f6f1cfa 1184 // helpString='G gain=? -- Write_AGain'
whismanoid 64:a667cfd83492 1185 // CMD_='None'
whismanoid 64:a667cfd83492 1186 // CommandName='Write_AGain'
whismanoid 64:a667cfd83492 1187 // CommandParamIn='uint32_t gain'
whismanoid 64:a667cfd83492 1188 // CommandReturnType='uint8_t'
whismanoid 64:a667cfd83492 1189 // @Pre=''
whismanoid 93:6b22269935a6 1190 // @Param[in]='@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1V/V, 0x4000=2V/V, default=0x2000'
whismanoid 64:a667cfd83492 1191 // @Param[out]=''
whismanoid 64:a667cfd83492 1192 // @Post=''
whismanoid 64:a667cfd83492 1193 // displayPost=''
whismanoid 64:a667cfd83492 1194 // @Return='@return 1 on success; 0 on failure'
whismanoid 64:a667cfd83492 1195 // parse argument list
whismanoid 93:6b22269935a6 1196 // 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=1V/V, 0x4000=2V/V, default=0x2000'
whismanoid 64:a667cfd83492 1197 // parse argument uint32_t gain
whismanoid 64:a667cfd83492 1198 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 1199 if (cmdLine.parse_uint32_dec("gain", gain))
whismanoid 64:a667cfd83492 1200 {
whismanoid 64:a667cfd83492 1201 // g_MAX11043_device.__WARNING_no_match_for_argname_gain_in_MAX11043_device_t__ = gain; // update global property value
whismanoid 64:a667cfd83492 1202 }
whismanoid 64:a667cfd83492 1203 // print arguments
whismanoid 64:a667cfd83492 1204 cmdLine.serial().printf("Write_AGain");
whismanoid 64:a667cfd83492 1205 cmdLine.serial().printf(" gain=%d", gain);
whismanoid 64:a667cfd83492 1206 cmdLine.serial().printf("\r\n");
whismanoid 64:a667cfd83492 1207 // call function Write_AGain(gain)
whismanoid 64:a667cfd83492 1208 uint8_t result = g_MAX11043_device.Write_AGain(gain);
whismanoid 64:a667cfd83492 1209 cmdLine.serial().printf(" =%d\r\n", result);
whismanoid 64:a667cfd83492 1210 return true; // command handled by MAX11043
whismanoid 66:3fe92f6f1cfa 1211 // CODE GENERATOR: bottom of loop: testMenuCommand="G", testMenuFirstCharHandler="None"
whismanoid 66:3fe92f6f1cfa 1212 } // end case 'G'
whismanoid 64:a667cfd83492 1213 break;
whismanoid 64:a667cfd83492 1214
whismanoid 89:20fd6ce5e4dd 1215 // CODE GENERATOR: top of loop: testMenuCommand="XD", testMenuFirstCharHandler="None"
whismanoid 89:20fd6ce5e4dd 1216 // CODE GENERATOR: test menu case 'XD':
whismanoid 89:20fd6ce5e4dd 1217 // CODE GENERATOR: helpString 'XD -- Configure_Demo'
whismanoid 89:20fd6ce5e4dd 1218 // CODE GENERATOR: CMD_ 'None'
whismanoid 89:20fd6ce5e4dd 1219 // CODE GENERATOR: CommandName 'Configure_Demo'
whismanoid 89:20fd6ce5e4dd 1220 // CODE GENERATOR: CommandParamIn 'void'
whismanoid 89:20fd6ce5e4dd 1221 // CODE GENERATOR: CommandReturnType 'void'
whismanoid 89:20fd6ce5e4dd 1222 // CODE GENERATOR: CommandPre ''
whismanoid 89:20fd6ce5e4dd 1223 // CODE GENERATOR: CommandDocParamIn ''
whismanoid 89:20fd6ce5e4dd 1224 // CODE GENERATOR: CommandDocParamOut ''
whismanoid 89:20fd6ce5e4dd 1225 // CODE GENERATOR: CommandPost ''
whismanoid 89:20fd6ce5e4dd 1226 // CODE GENERATOR: CommandReturn ''
whismanoid 89:20fd6ce5e4dd 1227 case 'X': // (multiple characters) (testMenuFirstCharHandler="X"):
whismanoid 89:20fd6ce5e4dd 1228 {
whismanoid 89:20fd6ce5e4dd 1229 switch (cmdLine[1])
whismanoid 89:20fd6ce5e4dd 1230 {
whismanoid 89:20fd6ce5e4dd 1231 case 'D': // (nested inside case 'X')
whismanoid 89:20fd6ce5e4dd 1232 {
whismanoid 89:20fd6ce5e4dd 1233 // test menu command 'XD' handler:
whismanoid 89:20fd6ce5e4dd 1234 // helpString='XD -- Configure_Demo'
whismanoid 89:20fd6ce5e4dd 1235 // CMD_='None'
whismanoid 89:20fd6ce5e4dd 1236 // CommandName='Configure_Demo'
whismanoid 89:20fd6ce5e4dd 1237 // CommandParamIn='void'
whismanoid 89:20fd6ce5e4dd 1238 // CommandReturnType='void'
whismanoid 89:20fd6ce5e4dd 1239 // @Pre=''
whismanoid 89:20fd6ce5e4dd 1240 // @Param[in]=''
whismanoid 89:20fd6ce5e4dd 1241 // @Param[out]=''
whismanoid 89:20fd6ce5e4dd 1242 // @Post=''
whismanoid 89:20fd6ce5e4dd 1243 // displayPost=''
whismanoid 89:20fd6ce5e4dd 1244 // @Return=''
whismanoid 89:20fd6ce5e4dd 1245 cmdLine.serial().printf("Configure_Demo");
whismanoid 89:20fd6ce5e4dd 1246 // call function Configure_Demo
whismanoid 89:20fd6ce5e4dd 1247 g_MAX11043_device.Configure_Demo();
whismanoid 89:20fd6ce5e4dd 1248 return true; // command handled by MAX11043
whismanoid 89:20fd6ce5e4dd 1249 // CODE GENERATOR: bottom of loop: testMenuCommand="XD", testMenuFirstCharHandler="X"
whismanoid 89:20fd6ce5e4dd 1250 } // end nested case 'XD'
whismanoid 89:20fd6ce5e4dd 1251 break;
whismanoid 89:20fd6ce5e4dd 1252
whismanoid 89:20fd6ce5e4dd 1253 // CODE GENERATOR: top of loop: testMenuCommand="XX", testMenuFirstCharHandler="X"
whismanoid 89:20fd6ce5e4dd 1254 // CODE GENERATOR: top of loop: nested switch "X" is currently open
whismanoid 59:47538bcf6cda 1255 // CODE GENERATOR: test menu case 'XX':
whismanoid 59:47538bcf6cda 1256 // CODE GENERATOR: helpString 'XX linef=? rate=? -- Configure_XXXXX'
whismanoid 59:47538bcf6cda 1257 // CODE GENERATOR: CMD_ 'None'
whismanoid 59:47538bcf6cda 1258 // CODE GENERATOR: CommandName 'Configure_XXXXX'
whismanoid 59:47538bcf6cda 1259 // CODE GENERATOR: CommandParamIn 'uint8_t linef, uint8_t rate'
whismanoid 59:47538bcf6cda 1260 // CODE GENERATOR: CommandReturnType 'uint8_t'
whismanoid 59:47538bcf6cda 1261 // CODE GENERATOR: CommandPre ''
whismanoid 59:47538bcf6cda 1262 // CODE GENERATOR: CommandDocParamIn ''
whismanoid 59:47538bcf6cda 1263 // CODE GENERATOR: CommandDocParamOut ''
whismanoid 59:47538bcf6cda 1264 // CODE GENERATOR: CommandPost ''
whismanoid 59:47538bcf6cda 1265 // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure'
whismanoid 59:47538bcf6cda 1266 case 'X': // (nested inside case 'X')
whismanoid 59:47538bcf6cda 1267 {
whismanoid 59:47538bcf6cda 1268 // test menu command 'XX' handler:
whismanoid 59:47538bcf6cda 1269 // helpString='XX linef=? rate=? -- Configure_XXXXX'
whismanoid 59:47538bcf6cda 1270 // CMD_='None'
whismanoid 59:47538bcf6cda 1271 // CommandName='Configure_XXXXX'
whismanoid 59:47538bcf6cda 1272 // CommandParamIn='uint8_t linef, uint8_t rate'
whismanoid 59:47538bcf6cda 1273 // CommandReturnType='uint8_t'
whismanoid 59:47538bcf6cda 1274 // @Pre=''
whismanoid 59:47538bcf6cda 1275 // @Param[in]=''
whismanoid 59:47538bcf6cda 1276 // @Param[out]=''
whismanoid 59:47538bcf6cda 1277 // @Post=''
whismanoid 59:47538bcf6cda 1278 // displayPost=''
whismanoid 59:47538bcf6cda 1279 // @Return='@return 1 on success; 0 on failure'
whismanoid 59:47538bcf6cda 1280 // parse argument list
whismanoid 59:47538bcf6cda 1281 // parse argument uint8_t linef
whismanoid 59:47538bcf6cda 1282 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 1283 if (cmdLine.parse_uint8_dec("linef", linef))
whismanoid 59:47538bcf6cda 1284 {
whismanoid 59:47538bcf6cda 1285 // g_MAX11043_device.__WARNING_no_match_for_argname_linef_in_MAX11043_device_t__ = linef; // update global property value
whismanoid 59:47538bcf6cda 1286 }
whismanoid 59:47538bcf6cda 1287 // parse argument uint8_t rate
whismanoid 59:47538bcf6cda 1288 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 1289 if (cmdLine.parse_uint8_dec("rate", rate))
whismanoid 59:47538bcf6cda 1290 {
whismanoid 59:47538bcf6cda 1291 // g_MAX11043_device.__WARNING_no_match_for_argname_rate_in_MAX11043_device_t__ = rate; // update global property value
whismanoid 59:47538bcf6cda 1292 }
whismanoid 59:47538bcf6cda 1293 // print arguments
whismanoid 59:47538bcf6cda 1294 cmdLine.serial().printf("Configure_XXXXX");
whismanoid 59:47538bcf6cda 1295 cmdLine.serial().printf(" linef=%d", linef);
whismanoid 59:47538bcf6cda 1296 cmdLine.serial().printf(" rate=%d", rate);
whismanoid 59:47538bcf6cda 1297 cmdLine.serial().printf("\r\n");
whismanoid 59:47538bcf6cda 1298 // call function Configure_XXXXX(linef, rate)
whismanoid 59:47538bcf6cda 1299 uint8_t result = g_MAX11043_device.Configure_XXXXX(linef, rate);
whismanoid 59:47538bcf6cda 1300 cmdLine.serial().printf(" =%d\r\n", result);
whismanoid 59:47538bcf6cda 1301 return true; // command handled by MAX11043
whismanoid 59:47538bcf6cda 1302 // CODE GENERATOR: bottom of loop: testMenuCommand="XX", testMenuFirstCharHandler="X"
whismanoid 59:47538bcf6cda 1303 } // end nested case 'XX'
whismanoid 59:47538bcf6cda 1304 break;
whismanoid 59:47538bcf6cda 1305
whismanoid 59:47538bcf6cda 1306 // CODE GENERATOR: top of loop: testMenuCommand="XY", testMenuFirstCharHandler="X"
whismanoid 59:47538bcf6cda 1307 // CODE GENERATOR: top of loop: nested switch "X" is currently open
whismanoid 59:47538bcf6cda 1308 // CODE GENERATOR: test menu case 'XY':
whismanoid 59:47538bcf6cda 1309 // CODE GENERATOR: helpString 'XY linef=? rate=? -- Configure_XXXXY'
whismanoid 59:47538bcf6cda 1310 // CODE GENERATOR: CMD_ 'None'
whismanoid 59:47538bcf6cda 1311 // CODE GENERATOR: CommandName 'Configure_XXXXY'
whismanoid 59:47538bcf6cda 1312 // CODE GENERATOR: CommandParamIn 'uint8_t linef, uint8_t rate'
whismanoid 59:47538bcf6cda 1313 // CODE GENERATOR: CommandReturnType 'uint8_t'
whismanoid 59:47538bcf6cda 1314 // CODE GENERATOR: CommandPre ''
whismanoid 59:47538bcf6cda 1315 // CODE GENERATOR: CommandDocParamIn ''
whismanoid 59:47538bcf6cda 1316 // CODE GENERATOR: CommandDocParamOut ''
whismanoid 59:47538bcf6cda 1317 // CODE GENERATOR: CommandPost ''
whismanoid 59:47538bcf6cda 1318 // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure'
whismanoid 59:47538bcf6cda 1319 case 'Y': // (nested inside case 'X')
whismanoid 59:47538bcf6cda 1320 {
whismanoid 59:47538bcf6cda 1321 // test menu command 'XY' handler:
whismanoid 59:47538bcf6cda 1322 // helpString='XY linef=? rate=? -- Configure_XXXXY'
whismanoid 59:47538bcf6cda 1323 // CMD_='None'
whismanoid 59:47538bcf6cda 1324 // CommandName='Configure_XXXXY'
whismanoid 59:47538bcf6cda 1325 // CommandParamIn='uint8_t linef, uint8_t rate'
whismanoid 59:47538bcf6cda 1326 // CommandReturnType='uint8_t'
whismanoid 59:47538bcf6cda 1327 // @Pre=''
whismanoid 59:47538bcf6cda 1328 // @Param[in]=''
whismanoid 59:47538bcf6cda 1329 // @Param[out]=''
whismanoid 59:47538bcf6cda 1330 // @Post=''
whismanoid 59:47538bcf6cda 1331 // displayPost=''
whismanoid 59:47538bcf6cda 1332 // @Return='@return 1 on success; 0 on failure'
whismanoid 59:47538bcf6cda 1333 // parse argument list
whismanoid 59:47538bcf6cda 1334 // parse argument uint8_t linef
whismanoid 59:47538bcf6cda 1335 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 1336 if (cmdLine.parse_uint8_dec("linef", linef))
whismanoid 59:47538bcf6cda 1337 {
whismanoid 59:47538bcf6cda 1338 // g_MAX11043_device.__WARNING_no_match_for_argname_linef_in_MAX11043_device_t__ = linef; // update global property value
whismanoid 59:47538bcf6cda 1339 }
whismanoid 59:47538bcf6cda 1340 // parse argument uint8_t rate
whismanoid 59:47538bcf6cda 1341 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 1342 if (cmdLine.parse_uint8_dec("rate", rate))
whismanoid 59:47538bcf6cda 1343 {
whismanoid 59:47538bcf6cda 1344 // g_MAX11043_device.__WARNING_no_match_for_argname_rate_in_MAX11043_device_t__ = rate; // update global property value
whismanoid 59:47538bcf6cda 1345 }
whismanoid 59:47538bcf6cda 1346 // print arguments
whismanoid 59:47538bcf6cda 1347 cmdLine.serial().printf("Configure_XXXXY");
whismanoid 59:47538bcf6cda 1348 cmdLine.serial().printf(" linef=%d", linef);
whismanoid 59:47538bcf6cda 1349 cmdLine.serial().printf(" rate=%d", rate);
whismanoid 59:47538bcf6cda 1350 cmdLine.serial().printf("\r\n");
whismanoid 59:47538bcf6cda 1351 // call function Configure_XXXXY(linef, rate)
whismanoid 59:47538bcf6cda 1352 uint8_t result = g_MAX11043_device.Configure_XXXXY(linef, rate);
whismanoid 59:47538bcf6cda 1353 cmdLine.serial().printf(" =%d\r\n", result);
whismanoid 59:47538bcf6cda 1354 return true; // command handled by MAX11043
whismanoid 59:47538bcf6cda 1355 // CODE GENERATOR: bottom of loop: testMenuCommand="XY", testMenuFirstCharHandler="X"
whismanoid 59:47538bcf6cda 1356 } // end nested case 'XY'
whismanoid 59:47538bcf6cda 1357 break;
whismanoid 59:47538bcf6cda 1358
whismanoid 59:47538bcf6cda 1359 } // end nested switch (cmdLine[1]) inside case 'X'
whismanoid 59:47538bcf6cda 1360 break;
whismanoid 59:47538bcf6cda 1361 } // end case 'X'
whismanoid 52:607010f0c54e 1362 // has_register_write_command: case '0'..'9','A'..'F','a'..'f' letters are reserved for bitstream commands
whismanoid 52:607010f0c54e 1363 case '0': case '1': case '2': case '3': case '4':
whismanoid 52:607010f0c54e 1364 case '5': case '6': case '7': case '8': case '9':
whismanoid 52:607010f0c54e 1365 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
whismanoid 52:607010f0c54e 1366 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
whismanoid 52:607010f0c54e 1367 {
whismanoid 52:607010f0c54e 1368 // hexadecimal codes get parsed as bytecodes
whismanoid 52:607010f0c54e 1369 //
whismanoid 52:607010f0c54e 1370 // parse_byteCount_byteList_dec() assumes all keyword args have already been removed from the buffer
whismanoid 52:607010f0c54e 1371 // parse cmdLine byte list --> int byteCount; int mosiData[MAX_SPI_BYTE_COUNT];
whismanoid 52:607010f0c54e 1372 #define MAX_SPI_BYTE_COUNT 32
whismanoid 52:607010f0c54e 1373 size_t byteCount = byteCount;
whismanoid 52:607010f0c54e 1374 static char mosiData[MAX_SPI_BYTE_COUNT];
whismanoid 52:607010f0c54e 1375 static char misoData[MAX_SPI_BYTE_COUNT];
whismanoid 52:607010f0c54e 1376 if (cmdLine.parse_byteCount_byteList_hex(byteCount, mosiData,
whismanoid 52:607010f0c54e 1377 MAX_SPI_BYTE_COUNT))
whismanoid 52:607010f0c54e 1378 {
whismanoid 57:1c9da8e90737 1379 // TODO: decode operation from commandByte
whismanoid 57:1c9da8e90737 1380 // TODO: OVERSIMPLIFICATION: if length is 1 byte then operation is RegRead, otherwise RegWrite
whismanoid 52:607010f0c54e 1381 // register_read_function 'IsRegReadCommand'
whismanoid 52:607010f0c54e 1382 // register_write_function 'RegWrite'
whismanoid 52:607010f0c54e 1383 // register_name_function 'RegName'
whismanoid 52:607010f0c54e 1384 // register_size_function 'RegSize'
whismanoid 57:1c9da8e90737 1385 // CODE GENERATOR: does the chip have a defined CMDOP_1aaa_aaaa_ReadRegister bit?
whismanoid 57:1c9da8e90737 1386 // MAX11043::MAX11043_CMD_enum_t regAddress = (MAX11043::MAX11043_CMD_enum_t)((mosiData[0] &~ MAX11043::CMDOP_1aaa_aaaa_ReadRegister) & 0xFF);
whismanoid 52:607010f0c54e 1387 MAX11043::MAX11043_CMD_enum_t commandByte = (MAX11043::MAX11043_CMD_enum_t)(mosiData[0]);
whismanoid 57:1c9da8e90737 1388 MAX11043::MAX11043_CMDOP_enum_t commandOp = g_MAX11043_device.DecodeCommand(commandByte);
whismanoid 52:607010f0c54e 1389 int regAddress = g_MAX11043_device.RegAddrOfCommand(commandByte);
whismanoid 52:607010f0c54e 1390 cmdLine.serial().printf(" regAddress=0x%2.2x\r\n", (regAddress & 0xFF));
whismanoid 52:607010f0c54e 1391 cmdLine.serial().printf(" RegName=%s\r\n", g_MAX11043_device.RegName(commandByte));
whismanoid 52:607010f0c54e 1392 uint32_t regData = 0;
whismanoid 52:607010f0c54e 1393 int regSize = g_MAX11043_device.RegSize(commandByte);
whismanoid 52:607010f0c54e 1394 cmdLine.serial().printf(" RegSize=%d\r\n", regSize);
whismanoid 52:607010f0c54e 1395 switch(regSize)
whismanoid 52:607010f0c54e 1396 {
whismanoid 52:607010f0c54e 1397 case 8:
whismanoid 52:607010f0c54e 1398 regData = ((uint32_t)mosiData[1] & 0xFF);
whismanoid 52:607010f0c54e 1399 break;
whismanoid 52:607010f0c54e 1400 case 16:
whismanoid 52:607010f0c54e 1401 regData = (((uint32_t)mosiData[1] & 0xFF) << 8) + ((uint32_t)mosiData[2] & 0xFF);
whismanoid 52:607010f0c54e 1402 break;
whismanoid 52:607010f0c54e 1403 case 24:
whismanoid 52:607010f0c54e 1404 regData = (((uint32_t)mosiData[1] & 0xFF) << 16) + (((uint32_t)mosiData[2] & 0xFF) << 8) + ((uint32_t)mosiData[3] & 0xFF);
whismanoid 52:607010f0c54e 1405 break;
whismanoid 52:607010f0c54e 1406 }
whismanoid 57:1c9da8e90737 1407 // CODE GENERATOR: does the chip have a defined CMDOP_1aaa_aaaa_ReadRegister bit?
whismanoid 57:1c9da8e90737 1408 // if ((byteCount == 1) || (regAddress & MAX11043::CMDOP_1aaa_aaaa_ReadRegister))
whismanoid 52:607010f0c54e 1409 if ((byteCount == 1) || g_MAX11043_device.IsRegReadCommand(commandByte))
whismanoid 52:607010f0c54e 1410 {
whismanoid 52:607010f0c54e 1411 cmdLine.serial().printf(" RegRead");
whismanoid 52:607010f0c54e 1412 g_MAX11043_device.RegRead(commandByte, &regData);
whismanoid 52:607010f0c54e 1413 cmdLine.serial().printf("regData=0x%6.6x\r\n", (regData & 0x00FFFFFF));
whismanoid 52:607010f0c54e 1414 }
whismanoid 52:607010f0c54e 1415 else
whismanoid 52:607010f0c54e 1416 {
whismanoid 52:607010f0c54e 1417 cmdLine.serial().printf(" RegWrite regData=0x%6.6X\r\n", (regData & 0x00FFFFFF));
whismanoid 52:607010f0c54e 1418 g_MAX11043_device.RegWrite(commandByte, regData);
whismanoid 52:607010f0c54e 1419 }
whismanoid 52:607010f0c54e 1420 // is there support function shadow regValue of regAddr?
whismanoid 52:607010f0c54e 1421 }
whismanoid 52:607010f0c54e 1422 return true; // command handled by MAX11043
whismanoid 52:607010f0c54e 1423 //
whismanoid 52:607010f0c54e 1424 } // end case '0'..'9','A'..'F','a'..'f'
whismanoid 52:607010f0c54e 1425 break;
whismanoid 52:607010f0c54e 1426 } // end switch (cmdLine[0])
whismanoid 52:607010f0c54e 1427 return false; // command not handled by MAX11043
whismanoid 52:607010f0c54e 1428 } // end bool MAX11043_menu_onEOLcommandParser(CmdLine & cmdLine)
whismanoid 52:607010f0c54e 1429
whismanoid 52:607010f0c54e 1430 // CODE GENERATOR: class declaration statement close