Internal_Datalogger but with USB support removed (for MAX40108 Demo board), proof of concept that MAX32625 can be used successfully with VDDB(USB) left unpowered, as long as the USB library is not used.

Dependencies:   max32625pico CmdLine

Committer:
whismanoid
Date:
Thu May 12 15:49:35 2022 -0700
Revision:
62:a618b70c4f22
Parent:
61:52456e705fa8
L@ Datalogger_RunActionTable() fully support math channels; rephrase comment text

Who changed what in which revision?

UserRevisionLine numberNew contents of line
whismanoid 0:cb44e2e9ec4c 1 // /*******************************************************************************
whismanoid 28:a9a3a9db592b 2 // * Copyright (C) 2021 Maxim Integrated Products, Inc., All Rights Reserved.
whismanoid 0:cb44e2e9ec4c 3 // *
whismanoid 0:cb44e2e9ec4c 4 // * Permission is hereby granted, free of charge, to any person obtaining a
whismanoid 0:cb44e2e9ec4c 5 // * copy of this software and associated documentation files (the "Software"),
whismanoid 0:cb44e2e9ec4c 6 // * to deal in the Software without restriction, including without limitation
whismanoid 0:cb44e2e9ec4c 7 // * the rights to use, copy, modify, merge, publish, distribute, sublicense,
whismanoid 0:cb44e2e9ec4c 8 // * and/or sell copies of the Software, and to permit persons to whom the
whismanoid 0:cb44e2e9ec4c 9 // * Software is furnished to do so, subject to the following conditions:
whismanoid 0:cb44e2e9ec4c 10 // *
whismanoid 0:cb44e2e9ec4c 11 // * The above copyright notice and this permission notice shall be included
whismanoid 0:cb44e2e9ec4c 12 // * in all copies or substantial portions of the Software.
whismanoid 0:cb44e2e9ec4c 13 // *
whismanoid 0:cb44e2e9ec4c 14 // * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
whismanoid 0:cb44e2e9ec4c 15 // * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
whismanoid 0:cb44e2e9ec4c 16 // * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
whismanoid 0:cb44e2e9ec4c 17 // * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
whismanoid 0:cb44e2e9ec4c 18 // * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
whismanoid 0:cb44e2e9ec4c 19 // * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
whismanoid 0:cb44e2e9ec4c 20 // * OTHER DEALINGS IN THE SOFTWARE.
whismanoid 0:cb44e2e9ec4c 21 // *
whismanoid 0:cb44e2e9ec4c 22 // * Except as contained in this notice, the name of Maxim Integrated
whismanoid 0:cb44e2e9ec4c 23 // * Products, Inc. shall not be used except as stated in the Maxim Integrated
whismanoid 0:cb44e2e9ec4c 24 // * Products, Inc. Branding Policy.
whismanoid 0:cb44e2e9ec4c 25 // *
whismanoid 0:cb44e2e9ec4c 26 // * The mere transfer of this software does not imply any licenses
whismanoid 0:cb44e2e9ec4c 27 // * of trade secrets, proprietary technology, copyrights, patents,
whismanoid 0:cb44e2e9ec4c 28 // * trademarks, maskwork rights, or any other form of intellectual
whismanoid 0:cb44e2e9ec4c 29 // * property whatsoever. Maxim Integrated Products, Inc. retains all
whismanoid 0:cb44e2e9ec4c 30 // * ownership rights.
whismanoid 0:cb44e2e9ec4c 31 // *******************************************************************************
whismanoid 0:cb44e2e9ec4c 32 // */
whismanoid 0:cb44e2e9ec4c 33 // *******************************************************************************
whismanoid 0:cb44e2e9ec4c 34 // COM port settings are 9600 baud 8N1
whismanoid 0:cb44e2e9ec4c 35 // *******************************************************************************
whismanoid 19:5ff09c8e9daf 36 // Support custom target MAX40108DEMOP2U9 based on MAX32625PICO but MAX32625_NO_BOOT
whismanoid 19:5ff09c8e9daf 37 // file custom_targets.json:
whismanoid 19:5ff09c8e9daf 38 // {
whismanoid 19:5ff09c8e9daf 39 // "MAX40108DEMOP2U9": {
whismanoid 19:5ff09c8e9daf 40 // "inherits": ["MAX32625_BASE"],
whismanoid 19:5ff09c8e9daf 41 // "macros_remove": [],
whismanoid 19:5ff09c8e9daf 42 // "macros_add": ["MAX32625_NO_BOOT"]
whismanoid 19:5ff09c8e9daf 43 // }
whismanoid 19:5ff09c8e9daf 44 // }
whismanoid 19:5ff09c8e9daf 45 // files copied from mbed-os\targets\TARGET_Maxim\TARGET_MAX32625\TARGET_MAX32625PICO
whismanoid 19:5ff09c8e9daf 46 // file TARGET_MAX40108DEMOP2U9\PeripheralNames.h -- copied from TARGET_MAX32625PICO
whismanoid 19:5ff09c8e9daf 47 // file TARGET_MAX40108DEMOP2U9\PinNames.h -- copied from TARGET_MAX32625PICO
whismanoid 19:5ff09c8e9daf 48 // files copied from mbed-os\targets\TARGET_Maxim\TARGET_MAX32625\device\___\TARGET_MAX32625_NO_BOOT
whismanoid 19:5ff09c8e9daf 49 // file TARGET_MAX40108DEMOP2U9\device\TOOLCHAIN_ARM_STD\MAX32625.sct
whismanoid 19:5ff09c8e9daf 50 // file TARGET_MAX40108DEMOP2U9\device\TOOLCHAIN_GCC_ARM\max32625.ld
whismanoid 19:5ff09c8e9daf 51 // file TARGET_MAX40108DEMOP2U9\device\TOOLCHAIN_IAR\MAX32625.icf
whismanoid 19:5ff09c8e9daf 52 // file mbed_app.json:
whismanoid 19:5ff09c8e9daf 53 // {
whismanoid 19:5ff09c8e9daf 54 // "config": {
whismanoid 19:5ff09c8e9daf 55 // },
whismanoid 19:5ff09c8e9daf 56 // "macros": [
whismanoid 19:5ff09c8e9daf 57 // "MAX40108_DEMO=9"
whismanoid 19:5ff09c8e9daf 58 // ],
whismanoid 19:5ff09c8e9daf 59 // "target_overrides": {
whismanoid 19:5ff09c8e9daf 60 // }
whismanoid 19:5ff09c8e9daf 61 // }
whismanoid 19:5ff09c8e9daf 62 // *******************************************************************************
whismanoid 19:5ff09c8e9daf 63 // Validating project global defines from mbed_app.json "macros": []
whismanoid 19:5ff09c8e9daf 64 #ifndef MAX40108_DEMO
whismanoid 19:5ff09c8e9daf 65 #warning "MAX40108_DEMO not defined, missing mbed_app.json"
whismanoid 19:5ff09c8e9daf 66 #else // #ifndef MAX40108_DEMO
whismanoid 19:5ff09c8e9daf 67 #warning "Note: MAX40108_DEMO is defined, which is expected"
whismanoid 19:5ff09c8e9daf 68 #if (MAX40108_DEMO)==(9)
whismanoid 19:5ff09c8e9daf 69 #warning "Note: MAX40108_DEMO is defined with the expected value of 9"
whismanoid 19:5ff09c8e9daf 70 #elif (MAX40108_DEMO)==(5)
whismanoid 19:5ff09c8e9daf 71 #warning "Note: MAX40108_DEMO is defined with the wrong value 5"
whismanoid 19:5ff09c8e9daf 72 #else
whismanoid 19:5ff09c8e9daf 73 #warning "Note: MAX40108_DEMO is defined, but with an unsupported value"
whismanoid 19:5ff09c8e9daf 74 #endif
whismanoid 19:5ff09c8e9daf 75 #endif // #ifndef MAX40108_DEMO
whismanoid 19:5ff09c8e9daf 76 // *******************************************************************************
whismanoid 14:d4092094dbfe 77 #ifndef MAX40108_DEMO
whismanoid 17:9397ea3ea7e9 78 // #define MAX40108_DEMO 5 for U5, or #define MAX40108_DEMO 9 for U9 in banner
whismanoid 17:9397ea3ea7e9 79 #define MAX40108_DEMO 9
whismanoid 15:37c83ec50ea0 80 #define HAS_DAPLINK_SERIAL 1
whismanoid 14:d4092094dbfe 81 #endif // MAX40108_DEMO
whismanoid 42:89607d5d4e6d 82
whismanoid 42:89607d5d4e6d 83 // data unique to certain boards based on serial number
whismanoid 42:89607d5d4e6d 84 #include "Board_Calibration_Data.h"
whismanoid 42:89607d5d4e6d 85
whismanoid 36:e7aac874b8be 86 #ifdef BOARD_SERIAL_NUMBER
whismanoid 47:f1a56afb4aca 87 uint32_t g_board_serial_number = 0xFFFFFFFF; // BOARD_SERIAL_NUMBER;
whismanoid 36:e7aac874b8be 88 // data unique to certain boards based on serial number
whismanoid 36:e7aac874b8be 89 # if (BOARD_SERIAL_NUMBER) == 0
whismanoid 55:477ba09475d7 90 #warning "info: (BOARD_SERIAL_NUMBER) == 0"
whismanoid 36:e7aac874b8be 91 //
whismanoid 36:e7aac874b8be 92 # elif (BOARD_SERIAL_NUMBER) == 1
whismanoid 55:477ba09475d7 93 #warning "info: (BOARD_SERIAL_NUMBER) == 1"
whismanoid 36:e7aac874b8be 94 //
whismanoid 36:e7aac874b8be 95 # elif (BOARD_SERIAL_NUMBER) == 2
whismanoid 55:477ba09475d7 96 #warning "info: (BOARD_SERIAL_NUMBER) == 2"
whismanoid 36:e7aac874b8be 97 //
whismanoid 36:e7aac874b8be 98 # elif (BOARD_SERIAL_NUMBER) == 3
whismanoid 55:477ba09475d7 99 #warning "info: (BOARD_SERIAL_NUMBER) == 3"
whismanoid 36:e7aac874b8be 100 //
whismanoid 36:e7aac874b8be 101 # elif (BOARD_SERIAL_NUMBER) == 4
whismanoid 55:477ba09475d7 102 #warning "info: (BOARD_SERIAL_NUMBER) == 4"
whismanoid 36:e7aac874b8be 103 //
whismanoid 36:e7aac874b8be 104 # elif (BOARD_SERIAL_NUMBER) == 5
whismanoid 55:477ba09475d7 105 #warning "info: (BOARD_SERIAL_NUMBER) == 5"
whismanoid 36:e7aac874b8be 106 //
whismanoid 36:e7aac874b8be 107 # elif (BOARD_SERIAL_NUMBER) == 6
whismanoid 55:477ba09475d7 108 #warning "info: (BOARD_SERIAL_NUMBER) == 6"
whismanoid 36:e7aac874b8be 109 //
whismanoid 36:e7aac874b8be 110 # else
whismanoid 36:e7aac874b8be 111 #warning "BOARD_SERIAL_NUMBER defined but not recognized"
whismanoid 36:e7aac874b8be 112 # endif
whismanoid 36:e7aac874b8be 113 #else // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 36:e7aac874b8be 114 #warning "BOARD_SERIAL_NUMBER not defined; using default values"
whismanoid 47:f1a56afb4aca 115 uint32_t g_board_serial_number = 0xFFFFFFFF;
whismanoid 36:e7aac874b8be 116 //
whismanoid 36:e7aac874b8be 117 #endif // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 0:cb44e2e9ec4c 118 //---------- CODE GENERATOR: DataLogHelloCppCodeList
whismanoid 0:cb44e2e9ec4c 119 // CODE GENERATOR: example code includes
whismanoid 0:cb44e2e9ec4c 120
whismanoid 0:cb44e2e9ec4c 121 // example code includes
whismanoid 0:cb44e2e9ec4c 122 // standard include for target platform -- Platform_Include_Boilerplate
whismanoid 0:cb44e2e9ec4c 123 #include "mbed.h"
whismanoid 0:cb44e2e9ec4c 124 // Platforms:
whismanoid 0:cb44e2e9ec4c 125 // - MAX32625MBED
whismanoid 0:cb44e2e9ec4c 126 // - supports mbed-os-5.11, requires USBDevice library
whismanoid 0:cb44e2e9ec4c 127 // - add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/
whismanoid 0:cb44e2e9ec4c 128 // - remove max32630fthr library (if present)
whismanoid 0:cb44e2e9ec4c 129 // - remove MAX32620FTHR library (if present)
whismanoid 0:cb44e2e9ec4c 130 // - MAX32600MBED
whismanoid 7:949ec8581f5e 131 // - Please note the last supported version is Mbed OS 6.3.
whismanoid 0:cb44e2e9ec4c 132 // - remove max32630fthr library (if present)
whismanoid 0:cb44e2e9ec4c 133 // - remove MAX32620FTHR library (if present)
whismanoid 0:cb44e2e9ec4c 134 // - Windows 10 note: Don't connect HDK until you are ready to load new firmware into the board.
whismanoid 0:cb44e2e9ec4c 135 // - NUCLEO_F446RE
whismanoid 0:cb44e2e9ec4c 136 // - remove USBDevice library
whismanoid 0:cb44e2e9ec4c 137 // - remove max32630fthr library (if present)
whismanoid 0:cb44e2e9ec4c 138 // - remove MAX32620FTHR library (if present)
whismanoid 0:cb44e2e9ec4c 139 // - NUCLEO_F401RE
whismanoid 0:cb44e2e9ec4c 140 // - remove USBDevice library
whismanoid 0:cb44e2e9ec4c 141 // - remove max32630fthr library (if present)
whismanoid 0:cb44e2e9ec4c 142 // - remove MAX32620FTHR library (if present)
whismanoid 0:cb44e2e9ec4c 143 // - MAX32630FTHR
whismanoid 0:cb44e2e9ec4c 144 // - #include "max32630fthr.h"
whismanoid 7:949ec8581f5e 145 // - add http://developer.mbed.org/teams/MaximIntegrated/code/max32630fthr/
whismanoid 0:cb44e2e9ec4c 146 // - remove MAX32620FTHR library (if present)
whismanoid 0:cb44e2e9ec4c 147 // - MAX32620FTHR
whismanoid 0:cb44e2e9ec4c 148 // - #include "MAX32620FTHR.h"
whismanoid 0:cb44e2e9ec4c 149 // - remove max32630fthr library (if present)
whismanoid 0:cb44e2e9ec4c 150 // - add https://os.mbed.com/teams/MaximIntegrated/code/MAX32620FTHR/
whismanoid 0:cb44e2e9ec4c 151 // - not tested yet
whismanoid 0:cb44e2e9ec4c 152 // - MAX32625PICO
whismanoid 0:cb44e2e9ec4c 153 // - #include "max32625pico.h"
whismanoid 0:cb44e2e9ec4c 154 // - add https://os.mbed.com/users/switches/code/max32625pico/
whismanoid 0:cb44e2e9ec4c 155 // - remove max32630fthr library (if present)
whismanoid 0:cb44e2e9ec4c 156 // - remove MAX32620FTHR library (if present)
whismanoid 0:cb44e2e9ec4c 157 // - not tested yet
whismanoid 0:cb44e2e9ec4c 158 // - see https://os.mbed.com/users/switches/code/max32625pico/
whismanoid 0:cb44e2e9ec4c 159 // - see https://os.mbed.com/users/switches/code/PICO_board_demo/
whismanoid 0:cb44e2e9ec4c 160 // - see https://os.mbed.com/users/switches/code/PICO_USB_I2C_SPI/
whismanoid 0:cb44e2e9ec4c 161 // - see https://os.mbed.com/users/switches/code/SerialInterface/
whismanoid 0:cb44e2e9ec4c 162 // - Note: To load the MAX32625PICO firmware, hold the button while
whismanoid 0:cb44e2e9ec4c 163 // connecting the USB cable, then copy firmware bin file
whismanoid 0:cb44e2e9ec4c 164 // to the MAINTENANCE drive.
whismanoid 0:cb44e2e9ec4c 165 // - see https://os.mbed.com/platforms/MAX32625PICO/
whismanoid 0:cb44e2e9ec4c 166 // - see https://os.mbed.com/teams/MaximIntegrated/wiki/MAX32625PICO-Firmware-Updates
whismanoid 41:13a6a097502c 167 // - update from mbed-os-5.11.5 to mbed-os-5.15 to support deep sleep
whismanoid 41:13a6a097502c 168 // - cd mbed-os ; mbed update mbed-os-5.15.7 ; cd .. ; mbed remove USBDevice ; mbed sync
whismanoid 41:13a6a097502c 169 // - (Internal_DataLogger_NoUSB_MAX32625PICO does not use USBDevice library anyway)
whismanoid 0:cb44e2e9ec4c 170 //
whismanoid 0:cb44e2e9ec4c 171 // end Platform_Include_Boilerplate
whismanoid 0:cb44e2e9ec4c 172
whismanoid 0:cb44e2e9ec4c 173 //--------------------------------------------------
whismanoid 46:469d0061df5d 174 // MAX32625 flash peek/poke support (MAX40108 demo) #312
whismanoid 46:469d0061df5d 175 #ifndef HAS_FLASH_PEEK
whismanoid 46:469d0061df5d 176 #define HAS_FLASH_PEEK 1
whismanoid 46:469d0061df5d 177 // #undef HAS_FLASH_PEEK
whismanoid 46:469d0061df5d 178 #endif
whismanoid 46:469d0061df5d 179 #ifndef HAS_FLASH_POKE
whismanoid 46:469d0061df5d 180 #define HAS_FLASH_POKE 0
whismanoid 46:469d0061df5d 181 // #undef HAS_FLASH_POKE
whismanoid 46:469d0061df5d 182 #endif
whismanoid 46:469d0061df5d 183 //--------------------------------------------------
whismanoid 46:469d0061df5d 184 // mbed interface to on-chip Flash
whismanoid 46:469d0061df5d 185 //--------------------------------------------------
whismanoid 46:469d0061df5d 186 #if defined(HAS_FLASH_PEEK) || defined(HAS_FLASH_POKE)
whismanoid 46:469d0061df5d 187 #if HAS_FLASH_PEEK
whismanoid 46:469d0061df5d 188 #warning "info: using HAS_FLASH_PEEK supporting %F peek=addr len=..."
whismanoid 46:469d0061df5d 189 #endif
whismanoid 46:469d0061df5d 190 #if HAS_FLASH_POKE
whismanoid 46:469d0061df5d 191 #warning "info: using HAS_FLASH_POKE supporting %F poke=addr data... "
whismanoid 46:469d0061df5d 192 #endif
whismanoid 46:469d0061df5d 193 #if HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 194 #warning "info: using HAS_FLASH_LOAD_SAVE supporting %F save... and %F load... "
whismanoid 46:469d0061df5d 195 #endif
whismanoid 46:469d0061df5d 196 // Maxim MAX32625 flash interface flc.h not .\mbed-os\drivers\FlashIAP.h
whismanoid 46:469d0061df5d 197 // .\mbed-os\targets\TARGET_Maxim\TARGET_MAX32625\mxc\flc.h
whismanoid 46:469d0061df5d 198 // .\mbed-os\targets\TARGET_Maxim\TARGET_MAX32625\mxc\flc.c
whismanoid 46:469d0061df5d 199 // int FLC_Init(void);
whismanoid 46:469d0061df5d 200 // int FLC_PageErase(uint32_t address, uint8_t erase_code, uint8_t unlock_key);
whismanoid 46:469d0061df5d 201 // int FLC_Write(uint32_t address, const void *data, uint32_t length, uint8_t unlock_key);
whismanoid 46:469d0061df5d 202 // example see CommunicationHandler Interpreter.cpp
whismanoid 46:469d0061df5d 203 // https://os.mbed.com/users/MuratAslan/code/CommunicationHandler/
whismanoid 46:469d0061df5d 204 #include "flc.h"
whismanoid 46:469d0061df5d 205 //
whismanoid 46:469d0061df5d 206 // Other targets like STM use FlashIAP interface
whismanoid 46:469d0061df5d 207 // #if !DEVICE_FLASH
whismanoid 46:469d0061df5d 208 // #error [NOT_SUPPORTED] Flash API not supported for this target
whismanoid 46:469d0061df5d 209 // #else
whismanoid 46:469d0061df5d 210 // #warning "DEVICE_FLASH is defined, so FlashIAP Flash API is // supported for this target"
whismanoid 46:469d0061df5d 211 // #endif
whismanoid 46:469d0061df5d 212 // .\mbed-os\drivers\FlashIAP.h
whismanoid 46:469d0061df5d 213 // #warning "using FlashIAP.h"
whismanoid 46:469d0061df5d 214 // #include <FlashIAP.h>
whismanoid 46:469d0061df5d 215 // mbed interface to on-chip Flash
whismanoid 46:469d0061df5d 216 // FlashIAP flash;
whismanoid 46:469d0061df5d 217 // error: 'FlashIAP' does not name a type
whismanoid 46:469d0061df5d 218 //--------------------------------------------------
whismanoid 55:477ba09475d7 219 // assign a unique 32-bit header for each flash save element #312
whismanoid 55:477ba09475d7 220 typedef enum flash_item_id_enum_t {
whismanoid 55:477ba09475d7 221 flash_blank_ff = 0xffffffff,
whismanoid 55:477ba09475d7 222 flash_wiped_00 = 0x00000000,
whismanoid 55:477ba09475d7 223 //
whismanoid 55:477ba09475d7 224 flash_g_board_serial_number = 0x04000053,
whismanoid 55:477ba09475d7 225 //
whismanoid 55:477ba09475d7 226 flash_calibration_05_V0 = 0x08001053,
whismanoid 55:477ba09475d7 227 flash_calibration_05_V1 = 0x08001153,
whismanoid 55:477ba09475d7 228 flash_calibration_05_V2 = 0x08001253,
whismanoid 55:477ba09475d7 229 flash_calibration_05_V3 = 0x08001353,
whismanoid 55:477ba09475d7 230 flash_calibration_05_V4 = 0x08001453,
whismanoid 55:477ba09475d7 231 flash_calibration_05_V5 = 0x08001553,
whismanoid 55:477ba09475d7 232 flash_calibration_05_normValue_0_10 = 0x08002053,
whismanoid 55:477ba09475d7 233 flash_calibration_05_normValue_0_11 = 0x08002153,
whismanoid 55:477ba09475d7 234 flash_calibration_05_normValue_0_12 = 0x08002253,
whismanoid 55:477ba09475d7 235 flash_calibration_05_normValue_0_13 = 0x08002353,
whismanoid 55:477ba09475d7 236 flash_calibration_05_normValue_0_14 = 0x08002453,
whismanoid 55:477ba09475d7 237 flash_calibration_05_normValue_0_15 = 0x08002553,
whismanoid 55:477ba09475d7 238 flash_calibration_95_V0 = 0x08003053,
whismanoid 55:477ba09475d7 239 flash_calibration_95_V1 = 0x08003153,
whismanoid 55:477ba09475d7 240 flash_calibration_95_V2 = 0x08003253,
whismanoid 55:477ba09475d7 241 flash_calibration_95_V3 = 0x08003353,
whismanoid 55:477ba09475d7 242 flash_calibration_95_V4 = 0x08003453,
whismanoid 55:477ba09475d7 243 flash_calibration_95_V5 = 0x08003553,
whismanoid 55:477ba09475d7 244 flash_calibration_95_normValue_0_10 = 0x08004053,
whismanoid 55:477ba09475d7 245 flash_calibration_95_normValue_0_11 = 0x08004153,
whismanoid 55:477ba09475d7 246 flash_calibration_95_normValue_0_12 = 0x08004253,
whismanoid 55:477ba09475d7 247 flash_calibration_95_normValue_0_13 = 0x08004353,
whismanoid 55:477ba09475d7 248 flash_calibration_95_normValue_0_14 = 0x08004453,
whismanoid 55:477ba09475d7 249 flash_calibration_95_normValue_0_15 = 0x08004553,
whismanoid 55:477ba09475d7 250 //
whismanoid 55:477ba09475d7 251 flash_Platform_AIN_Average_N = 0x04000153,
whismanoid 55:477ba09475d7 252 //
whismanoid 55:477ba09475d7 253 flash_Datalogger_action_table_row_count = 0x04000253,
whismanoid 55:477ba09475d7 254 flash_Datalogger_action_table = 0x41005053,
whismanoid 55:477ba09475d7 255 //
whismanoid 55:477ba09475d7 256 flash_onButton1_command_table_00 = 0x42061053,
whismanoid 55:477ba09475d7 257 flash_onButton1_command_table_01 = 0x42061153,
whismanoid 55:477ba09475d7 258 flash_onButton1_command_table_02 = 0x42061253,
whismanoid 55:477ba09475d7 259 flash_onButton1_command_table_03 = 0x42061353,
whismanoid 55:477ba09475d7 260 flash_onButton1_command_table_04 = 0x42061453,
whismanoid 55:477ba09475d7 261 flash_onButton1_command_table_05 = 0x42061553,
whismanoid 55:477ba09475d7 262 flash_onButton1_command_table_06 = 0x42061653,
whismanoid 55:477ba09475d7 263 flash_onButton1_command_table_07 = 0x42061753,
whismanoid 55:477ba09475d7 264 flash_onButton1_command_table_08 = 0x42061853,
whismanoid 55:477ba09475d7 265 flash_onButton1_command_table_09 = 0x42061953,
whismanoid 55:477ba09475d7 266 //
whismanoid 55:477ba09475d7 267 flash_onButton2_command_table_00 = 0x42062053,
whismanoid 55:477ba09475d7 268 flash_onButton2_command_table_01 = 0x42062153,
whismanoid 55:477ba09475d7 269 flash_onButton2_command_table_02 = 0x42062253,
whismanoid 55:477ba09475d7 270 flash_onButton2_command_table_03 = 0x42062353,
whismanoid 55:477ba09475d7 271 flash_onButton2_command_table_04 = 0x42062453,
whismanoid 55:477ba09475d7 272 flash_onButton2_command_table_05 = 0x42062553,
whismanoid 55:477ba09475d7 273 flash_onButton2_command_table_06 = 0x42062653,
whismanoid 55:477ba09475d7 274 flash_onButton2_command_table_07 = 0x42062753,
whismanoid 55:477ba09475d7 275 flash_onButton2_command_table_08 = 0x42062853,
whismanoid 55:477ba09475d7 276 flash_onButton2_command_table_09 = 0x42062953,
whismanoid 55:477ba09475d7 277 //
whismanoid 55:477ba09475d7 278 flash_onButton3_command_table_00 = 0x42063053,
whismanoid 55:477ba09475d7 279 flash_onButton3_command_table_01 = 0x42063153,
whismanoid 55:477ba09475d7 280 flash_onButton3_command_table_02 = 0x42063253,
whismanoid 55:477ba09475d7 281 flash_onButton3_command_table_03 = 0x42063353,
whismanoid 55:477ba09475d7 282 flash_onButton3_command_table_04 = 0x42063453,
whismanoid 55:477ba09475d7 283 flash_onButton3_command_table_05 = 0x42063553,
whismanoid 55:477ba09475d7 284 flash_onButton3_command_table_06 = 0x42063653,
whismanoid 55:477ba09475d7 285 flash_onButton3_command_table_07 = 0x42063753,
whismanoid 55:477ba09475d7 286 flash_onButton3_command_table_08 = 0x42063853,
whismanoid 55:477ba09475d7 287 flash_onButton3_command_table_09 = 0x42063953,
whismanoid 55:477ba09475d7 288 //
whismanoid 55:477ba09475d7 289 flash_onButton4_command_table_00 = 0x42064053,
whismanoid 55:477ba09475d7 290 flash_onButton4_command_table_01 = 0x42064153,
whismanoid 55:477ba09475d7 291 flash_onButton4_command_table_02 = 0x42064253,
whismanoid 55:477ba09475d7 292 flash_onButton4_command_table_03 = 0x42064353,
whismanoid 55:477ba09475d7 293 flash_onButton4_command_table_04 = 0x42064453,
whismanoid 55:477ba09475d7 294 flash_onButton4_command_table_05 = 0x42064553,
whismanoid 55:477ba09475d7 295 flash_onButton4_command_table_06 = 0x42064653,
whismanoid 55:477ba09475d7 296 flash_onButton4_command_table_07 = 0x42064753,
whismanoid 55:477ba09475d7 297 flash_onButton4_command_table_08 = 0x42064853,
whismanoid 55:477ba09475d7 298 flash_onButton4_command_table_09 = 0x42064953,
whismanoid 55:477ba09475d7 299 //
whismanoid 55:477ba09475d7 300 flash_onButton5_command_table_00 = 0x42065053,
whismanoid 55:477ba09475d7 301 flash_onButton5_command_table_01 = 0x42065153,
whismanoid 55:477ba09475d7 302 flash_onButton5_command_table_02 = 0x42065253,
whismanoid 55:477ba09475d7 303 flash_onButton5_command_table_03 = 0x42065353,
whismanoid 55:477ba09475d7 304 flash_onButton5_command_table_04 = 0x42065453,
whismanoid 55:477ba09475d7 305 flash_onButton5_command_table_05 = 0x42065553,
whismanoid 55:477ba09475d7 306 flash_onButton5_command_table_06 = 0x42065653,
whismanoid 55:477ba09475d7 307 flash_onButton5_command_table_07 = 0x42065753,
whismanoid 55:477ba09475d7 308 flash_onButton5_command_table_08 = 0x42065853,
whismanoid 55:477ba09475d7 309 flash_onButton5_command_table_09 = 0x42065953,
whismanoid 55:477ba09475d7 310 //
whismanoid 55:477ba09475d7 311 flash_onButton6_command_table_00 = 0x42066053,
whismanoid 55:477ba09475d7 312 flash_onButton6_command_table_01 = 0x42066153,
whismanoid 55:477ba09475d7 313 flash_onButton6_command_table_02 = 0x42066253,
whismanoid 55:477ba09475d7 314 flash_onButton6_command_table_03 = 0x42066353,
whismanoid 55:477ba09475d7 315 flash_onButton6_command_table_04 = 0x42066453,
whismanoid 55:477ba09475d7 316 flash_onButton6_command_table_05 = 0x42066553,
whismanoid 55:477ba09475d7 317 flash_onButton6_command_table_06 = 0x42066653,
whismanoid 55:477ba09475d7 318 flash_onButton6_command_table_07 = 0x42066753,
whismanoid 55:477ba09475d7 319 flash_onButton6_command_table_08 = 0x42066853,
whismanoid 55:477ba09475d7 320 flash_onButton6_command_table_09 = 0x42066953,
whismanoid 55:477ba09475d7 321 //
whismanoid 55:477ba09475d7 322 flash_onButton7_command_table_00 = 0x42067053,
whismanoid 55:477ba09475d7 323 flash_onButton7_command_table_01 = 0x42067153,
whismanoid 55:477ba09475d7 324 flash_onButton7_command_table_02 = 0x42067253,
whismanoid 55:477ba09475d7 325 flash_onButton7_command_table_03 = 0x42067353,
whismanoid 55:477ba09475d7 326 flash_onButton7_command_table_04 = 0x42067453,
whismanoid 55:477ba09475d7 327 flash_onButton7_command_table_05 = 0x42067553,
whismanoid 55:477ba09475d7 328 flash_onButton7_command_table_06 = 0x42067653,
whismanoid 55:477ba09475d7 329 flash_onButton7_command_table_07 = 0x42067753,
whismanoid 55:477ba09475d7 330 flash_onButton7_command_table_08 = 0x42067853,
whismanoid 55:477ba09475d7 331 flash_onButton7_command_table_09 = 0x42067953,
whismanoid 55:477ba09475d7 332 //
whismanoid 55:477ba09475d7 333 flash_onButton8_command_table_00 = 0x42068053,
whismanoid 55:477ba09475d7 334 flash_onButton8_command_table_01 = 0x42068153,
whismanoid 55:477ba09475d7 335 flash_onButton8_command_table_02 = 0x42068253,
whismanoid 55:477ba09475d7 336 flash_onButton8_command_table_03 = 0x42068353,
whismanoid 55:477ba09475d7 337 flash_onButton8_command_table_04 = 0x42068453,
whismanoid 55:477ba09475d7 338 flash_onButton8_command_table_05 = 0x42068553,
whismanoid 55:477ba09475d7 339 flash_onButton8_command_table_06 = 0x42068653,
whismanoid 55:477ba09475d7 340 flash_onButton8_command_table_07 = 0x42068753,
whismanoid 55:477ba09475d7 341 flash_onButton8_command_table_08 = 0x42068853,
whismanoid 55:477ba09475d7 342 flash_onButton8_command_table_09 = 0x42068953,
whismanoid 55:477ba09475d7 343 //
whismanoid 55:477ba09475d7 344 flash_onButton9_command_table_00 = 0x42069053,
whismanoid 55:477ba09475d7 345 flash_onButton9_command_table_01 = 0x42069153,
whismanoid 55:477ba09475d7 346 flash_onButton9_command_table_02 = 0x42069253,
whismanoid 55:477ba09475d7 347 flash_onButton9_command_table_03 = 0x42069353,
whismanoid 55:477ba09475d7 348 flash_onButton9_command_table_04 = 0x42069453,
whismanoid 55:477ba09475d7 349 flash_onButton9_command_table_05 = 0x42069553,
whismanoid 55:477ba09475d7 350 flash_onButton9_command_table_06 = 0x42069653,
whismanoid 55:477ba09475d7 351 flash_onButton9_command_table_07 = 0x42069753,
whismanoid 55:477ba09475d7 352 flash_onButton9_command_table_08 = 0x42069853,
whismanoid 55:477ba09475d7 353 flash_onButton9_command_table_09 = 0x42069953,
whismanoid 55:477ba09475d7 354 //
whismanoid 55:477ba09475d7 355 flash_Platform_AIN_customChannelHeader_ch0 = 0x42079053,
whismanoid 55:477ba09475d7 356 flash_Platform_AIN_customChannelHeader_ch1 = 0x42079153,
whismanoid 55:477ba09475d7 357 flash_Platform_AIN_customChannelHeader_ch2 = 0x42079253,
whismanoid 55:477ba09475d7 358 flash_Platform_AIN_customChannelHeader_ch3 = 0x42079353,
whismanoid 55:477ba09475d7 359 flash_Platform_AIN_customChannelHeader_ch4 = 0x42079453,
whismanoid 55:477ba09475d7 360 flash_Platform_AIN_customChannelHeader_ch5 = 0x42079553,
whismanoid 55:477ba09475d7 361 //
whismanoid 58:9b1e13e0527d 362 // flash header flash_Platform_Enable_ch012345 for `Platform_Enable_ch[0..5]` array #380
whismanoid 58:9b1e13e0527d 363 flash_Platform_Enable_ch012345 = 0x08070000,
whismanoid 58:9b1e13e0527d 364 //
whismanoid 55:477ba09475d7 365 flash_Platform_MathOffsetA0 = 0x08071053,
whismanoid 55:477ba09475d7 366 flash_Platform_MathOffsetA1 = 0x08071153,
whismanoid 55:477ba09475d7 367 flash_Platform_MathOffsetA2 = 0x08071253,
whismanoid 55:477ba09475d7 368 flash_Platform_MathOffsetA3 = 0x08071353,
whismanoid 55:477ba09475d7 369 flash_Platform_MathOffsetA4 = 0x08071453,
whismanoid 55:477ba09475d7 370 flash_Platform_MathOffsetA5 = 0x08071553,
whismanoid 55:477ba09475d7 371 //
whismanoid 55:477ba09475d7 372 flash_Platform_MathGainMulA0 = 0x08072053,
whismanoid 55:477ba09475d7 373 flash_Platform_MathGainMulA1 = 0x08072153,
whismanoid 55:477ba09475d7 374 flash_Platform_MathGainMulA2 = 0x08072253,
whismanoid 55:477ba09475d7 375 flash_Platform_MathGainMulA3 = 0x08072353,
whismanoid 55:477ba09475d7 376 flash_Platform_MathGainMulA4 = 0x08072453,
whismanoid 55:477ba09475d7 377 flash_Platform_MathGainMulA5 = 0x08072553,
whismanoid 55:477ba09475d7 378 //
whismanoid 55:477ba09475d7 379 flash_Platform_MathGainDivA0 = 0x08073053,
whismanoid 55:477ba09475d7 380 flash_Platform_MathGainDivA1 = 0x08073153,
whismanoid 55:477ba09475d7 381 flash_Platform_MathGainDivA2 = 0x08073253,
whismanoid 55:477ba09475d7 382 flash_Platform_MathGainDivA3 = 0x08073353,
whismanoid 55:477ba09475d7 383 flash_Platform_MathGainDivA4 = 0x08073453,
whismanoid 55:477ba09475d7 384 flash_Platform_MathGainDivA5 = 0x08073553,
whismanoid 55:477ba09475d7 385 //
whismanoid 55:477ba09475d7 386 flash_Platform_MathUnitString_ch0 = 0x42078053,
whismanoid 55:477ba09475d7 387 flash_Platform_MathUnitString_ch1 = 0x42078153,
whismanoid 55:477ba09475d7 388 flash_Platform_MathUnitString_ch2 = 0x42078253,
whismanoid 55:477ba09475d7 389 flash_Platform_MathUnitString_ch3 = 0x42078353,
whismanoid 55:477ba09475d7 390 flash_Platform_MathUnitString_ch4 = 0x42078453,
whismanoid 55:477ba09475d7 391 flash_Platform_MathUnitString_ch5 = 0x42078553,
whismanoid 55:477ba09475d7 392 //
whismanoid 55:477ba09475d7 393 } flash_item_id_enum_t;
whismanoid 55:477ba09475d7 394 //--------------------------------------------------
whismanoid 55:477ba09475d7 395 // flash_LE_bytes(bigEndianValue) -> four bytes in little-endian order, for flash memory
whismanoid 55:477ba09475d7 396 #define flash_LE_bytes(itemBE) (((itemBE))&0xFF),(((itemBE)>>8)&0xFF),(((itemBE)>>16)&0xFF),(((itemBE)>>24)&0xFF)
whismanoid 55:477ba09475d7 397 //--------------------------------------------------
whismanoid 51:a41d3fd5e441 398 // MAX40108 calibration values assign absolute address
whismanoid 51:a41d3fd5e441 399 // Note this data is little-endian, least significant byte first
whismanoid 47:f1a56afb4aca 400 const char flash_page_configuration_back_up[8192] __attribute__((aligned(8192))) = {
whismanoid 47:f1a56afb4aca 401 // 0x04000053, 0xffffffff, 0xffffffff, 0xffffffff, // g_board_serial_number is blank 0xFFFFFFFF
whismanoid 51:a41d3fd5e441 402 // 3, ___2, ___1, ___0, ___7, ___6, ___5, ___4, ___b, ___a, ___9, ___8, ___f, ___e, ___d, ___c,
whismanoid 55:477ba09475d7 403 flash_LE_bytes(flash_g_board_serial_number), flash_LE_bytes(0x7dd374cf), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // 0x04000053 g_board_serial_number %A sn=2111009999 -- serial number
whismanoid 55:477ba09475d7 404 0x53, 0x10, 0x00, 0x08, flash_LE_bytes(0x40000000), flash_LE_bytes(0x3fec0aa6), flash_LE_bytes(flash_blank_ff), // 0x08001053 calibration_05_V[0]
whismanoid 55:477ba09475d7 405 0x53, 0x11, 0x00, 0x08, flash_LE_bytes(0x40000000), flash_LE_bytes(0x3fec0aa6), flash_LE_bytes(flash_blank_ff), // 0x08001153 calibration_05_V[1]
whismanoid 55:477ba09475d7 406 0x53, 0x12, 0x00, 0x08, flash_LE_bytes(0x40000000), flash_LE_bytes(0x3fec0aa6), flash_LE_bytes(flash_blank_ff), // 0x08001253 calibration_05_V[2]
whismanoid 55:477ba09475d7 407 0x53, 0x13, 0x00, 0x08, flash_LE_bytes(0x40000000), flash_LE_bytes(0x3fec0aa6), flash_LE_bytes(flash_blank_ff), // 0x08001353 calibration_05_V[3]
whismanoid 55:477ba09475d7 408 0x53, 0x14, 0x00, 0x08, flash_LE_bytes(0x00000000), flash_LE_bytes(0x3ff175f7), flash_LE_bytes(flash_blank_ff), // 0x08001453 calibration_05_V[4]
whismanoid 55:477ba09475d7 409 0x53, 0x15, 0x00, 0x08, flash_LE_bytes(0x00000000), flash_LE_bytes(0x3ff175f7), flash_LE_bytes(flash_blank_ff), // 0x08001553 calibration_05_V[5]
whismanoid 55:477ba09475d7 410 0x53, 0x20, 0x00, 0x08, flash_LE_bytes(0x58000000), flash_LE_bytes(0x3fe7693a), flash_LE_bytes(flash_blank_ff), // 0x08002053 calibration_05_normValue_0_1[0]
whismanoid 55:477ba09475d7 411 0x53, 0x21, 0x00, 0x08, flash_LE_bytes(0x58000000), flash_LE_bytes(0x3fe7693a), flash_LE_bytes(flash_blank_ff), // 0x08002153 calibration_05_normValue_0_1[1]
whismanoid 55:477ba09475d7 412 0x53, 0x22, 0x00, 0x08, flash_LE_bytes(0x58000000), flash_LE_bytes(0x3fe7693a), flash_LE_bytes(flash_blank_ff), // 0x08002253 calibration_05_normValue_0_1[2]
whismanoid 55:477ba09475d7 413 0x53, 0x23, 0x00, 0x08, flash_LE_bytes(0x58000000), flash_LE_bytes(0x3fe7693a), flash_LE_bytes(flash_blank_ff), // 0x08002353 calibration_05_normValue_0_1[3]
whismanoid 55:477ba09475d7 414 0x53, 0x24, 0x00, 0x08, flash_LE_bytes(0xb0000000), flash_LE_bytes(0x3fc78ea3), flash_LE_bytes(flash_blank_ff), // 0x08002453 calibration_05_normValue_0_1[4]
whismanoid 55:477ba09475d7 415 0x53, 0x25, 0x00, 0x08, flash_LE_bytes(0xb0000000), flash_LE_bytes(0x3fc78ea3), flash_LE_bytes(flash_blank_ff), // 0x08002553 calibration_05_normValue_0_1[5]
whismanoid 55:477ba09475d7 416 0x53, 0x30, 0x00, 0x08, flash_LE_bytes(0x00000000), flash_LE_bytes(0x3ff175f7), flash_LE_bytes(flash_blank_ff), // 0x08003053 calibration_95_V[0]
whismanoid 55:477ba09475d7 417 0x53, 0x31, 0x00, 0x08, flash_LE_bytes(0x00000000), flash_LE_bytes(0x3ff175f7), flash_LE_bytes(flash_blank_ff), // 0x08003153 calibration_95_V[1]
whismanoid 55:477ba09475d7 418 0x53, 0x32, 0x00, 0x08, flash_LE_bytes(0x00000000), flash_LE_bytes(0x3ff175f7), flash_LE_bytes(flash_blank_ff), // 0x08003253 calibration_95_V[2]
whismanoid 55:477ba09475d7 419 0x53, 0x33, 0x00, 0x08, flash_LE_bytes(0x00000000), flash_LE_bytes(0x3ff175f7), flash_LE_bytes(flash_blank_ff), // 0x08003353 calibration_95_V[3]
whismanoid 55:477ba09475d7 420 0x53, 0x34, 0x00, 0x08, flash_LE_bytes(0x40000000), flash_LE_bytes(0x3ffa3333), flash_LE_bytes(flash_blank_ff), // 0x08003453 calibration_95_V[4]
whismanoid 55:477ba09475d7 421 0x53, 0x35, 0x00, 0x08, flash_LE_bytes(0x40000000), flash_LE_bytes(0x3ffa3333), flash_LE_bytes(flash_blank_ff), // 0x08003553 calibration_95_V[5]
whismanoid 55:477ba09475d7 422 0x53, 0x40, 0x00, 0x08, flash_LE_bytes(0xbbe00000), flash_LE_bytes(0x3fed22c8), flash_LE_bytes(flash_blank_ff), // 0x08004053 calibration_95_normValue_0_1[0]
whismanoid 55:477ba09475d7 423 0x53, 0x41, 0x00, 0x08, flash_LE_bytes(0xbbe00000), flash_LE_bytes(0x3fed22c8), flash_LE_bytes(flash_blank_ff), // 0x08004153 calibration_95_normValue_0_1[1]
whismanoid 55:477ba09475d7 424 0x53, 0x42, 0x00, 0x08, flash_LE_bytes(0xbbe00000), flash_LE_bytes(0x3fed22c8), flash_LE_bytes(flash_blank_ff), // 0x08004253 calibration_95_normValue_0_1[2]
whismanoid 55:477ba09475d7 425 0x53, 0x43, 0x00, 0x08, flash_LE_bytes(0xbbe00000), flash_LE_bytes(0x3fed22c8), flash_LE_bytes(flash_blank_ff), // 0x08004353 calibration_95_normValue_0_1[3]
whismanoid 55:477ba09475d7 426 0x53, 0x44, 0x00, 0x08, flash_LE_bytes(0x98000000), flash_LE_bytes(0x3fd19244), flash_LE_bytes(flash_blank_ff), // 0x08004453 calibration_95_normValue_0_1[4]
whismanoid 55:477ba09475d7 427 0x53, 0x45, 0x00, 0x08, flash_LE_bytes(0x98000000), flash_LE_bytes(0x3fd19244), flash_LE_bytes(flash_blank_ff), // 0x08004553 calibration_95_normValue_0_1[5]
whismanoid 51:a41d3fd5e441 428 // WIP #312 initial values in flash_page_configuration_back_up[]
whismanoid 55:477ba09475d7 429 //
whismanoid 55:477ba09475d7 430 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 431 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_MathOffsetA
whismanoid 55:477ba09475d7 432 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_MathGainMulA
whismanoid 55:477ba09475d7 433 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_MathGainDivA
whismanoid 55:477ba09475d7 434 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_MathUnitString
whismanoid 55:477ba09475d7 435 //
whismanoid 55:477ba09475d7 436 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 437 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathOffsetA
whismanoid 55:477ba09475d7 438 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathGainMulA
whismanoid 55:477ba09475d7 439 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathGainDivA
whismanoid 55:477ba09475d7 440 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathUnitString
whismanoid 55:477ba09475d7 441 //
whismanoid 55:477ba09475d7 442 // MAX32625 flash peek/poke support (MAX40108 demo) #312 -- more items could be added here
whismanoid 55:477ba09475d7 443 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // 0xffffffff blank space to permit saving more data
whismanoid 55:477ba09475d7 444 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000261a0
whismanoid 55:477ba09475d7 445 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000261b0
whismanoid 55:477ba09475d7 446 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000261c0
whismanoid 55:477ba09475d7 447 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000261d0
whismanoid 55:477ba09475d7 448 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000261e0
whismanoid 55:477ba09475d7 449 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000261f0
whismanoid 55:477ba09475d7 450 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026200
whismanoid 55:477ba09475d7 451 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 452 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 453 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 454 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 455 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 456 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 457 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 458 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 459 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 460 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 461 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 462 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 463 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 464 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 465 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 466 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026300
whismanoid 55:477ba09475d7 467 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 468 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 469 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 470 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 471 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 472 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 473 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 474 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 475 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 476 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 477 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 478 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 479 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 480 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 481 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 482 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026400
whismanoid 55:477ba09475d7 483 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 484 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 485 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 486 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 487 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 488 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 489 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 490 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 491 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 492 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 493 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 494 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 495 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 496 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 497 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 498 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026500
whismanoid 55:477ba09475d7 499 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 500 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 501 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 502 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 503 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 504 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 505 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 506 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 507 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 508 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 509 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 510 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 511 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 512 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 513 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 514 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026600
whismanoid 55:477ba09475d7 515 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 516 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 517 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 518 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 519 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 520 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 521 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 522 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 523 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 524 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 525 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 526 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 527 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 528 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 529 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 530 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026700
whismanoid 55:477ba09475d7 531 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 532 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 533 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 534 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 535 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 536 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 537 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 538 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 539 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 540 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 541 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 542 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 543 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 544 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 545 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 546 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026800
whismanoid 55:477ba09475d7 547 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 548 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 549 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 550 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 551 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 552 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 553 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 554 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 555 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 556 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 557 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 558 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 559 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 560 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 561 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 562 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026900
whismanoid 55:477ba09475d7 563 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 564 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 565 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 566 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 567 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 568 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 569 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 570 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 571 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 572 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 573 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 574 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 575 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 576 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 577 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000269f0
whismanoid 55:477ba09475d7 578 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026a00
whismanoid 55:477ba09475d7 579 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 580 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 581 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 582 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 583 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 584 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 585 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 586 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 587 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 588 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 589 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 590 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 591 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 592 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 593 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026af0
whismanoid 55:477ba09475d7 594 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026b00
whismanoid 55:477ba09475d7 595 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 596 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 597 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 598 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 599 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 600 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 601 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 602 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 603 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 604 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 605 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 606 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 607 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 608 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 609 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026bf0
whismanoid 55:477ba09475d7 610 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026c00
whismanoid 55:477ba09475d7 611 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 612 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 613 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 614 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 615 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 616 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 617 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 618 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 619 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 620 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 621 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 622 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 623 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 624 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 625 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026cf0
whismanoid 55:477ba09475d7 626 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026d00
whismanoid 55:477ba09475d7 627 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 628 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 629 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 630 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 631 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 632 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 633 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 634 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 635 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 636 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 637 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 638 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 639 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 640 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 641 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026df0
whismanoid 55:477ba09475d7 642 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026e00
whismanoid 55:477ba09475d7 643 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 644 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 645 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 646 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 647 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 648 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 649 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 650 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 651 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 652 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 653 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 654 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 655 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 656 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 657 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026ef0
whismanoid 55:477ba09475d7 658 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026f00
whismanoid 55:477ba09475d7 659 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 660 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 661 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 662 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 663 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 664 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 665 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 666 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 667 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 668 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 669 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 670 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 671 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 672 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 673 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00026ff0
whismanoid 55:477ba09475d7 674 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027000
whismanoid 55:477ba09475d7 675 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 676 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 677 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 678 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 679 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 680 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 681 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 682 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 683 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 684 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 685 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 686 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 687 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 688 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 689 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000270f0
whismanoid 55:477ba09475d7 690 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027100
whismanoid 55:477ba09475d7 691 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 692 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 693 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 694 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 695 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 696 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 697 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 698 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 699 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 700 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 701 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 702 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 703 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 704 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 705 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000271f0
whismanoid 55:477ba09475d7 706 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027200
whismanoid 55:477ba09475d7 707 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 708 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 709 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 710 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 711 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 712 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 713 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 714 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 715 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 716 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 717 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 718 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 719 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 720 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 721 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000272f0
whismanoid 55:477ba09475d7 722 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027300
whismanoid 55:477ba09475d7 723 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 724 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 725 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 726 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 727 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 728 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 729 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 730 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 731 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 732 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 733 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 734 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 735 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 736 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 737 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000273f0
whismanoid 55:477ba09475d7 738 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027400
whismanoid 55:477ba09475d7 739 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 740 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 741 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 742 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 743 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 744 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 745 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 746 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 747 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 748 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 749 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 750 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 751 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 752 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 753 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000274f0
whismanoid 55:477ba09475d7 754 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027500
whismanoid 55:477ba09475d7 755 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 756 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 757 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 758 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 759 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 760 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 761 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 762 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 763 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 764 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 765 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 766 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 767 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 768 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 769 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000275f0
whismanoid 55:477ba09475d7 770 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027600
whismanoid 55:477ba09475d7 771 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 772 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 773 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 774 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 775 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 776 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 777 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 778 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 779 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 780 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 781 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 782 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 783 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 784 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 785 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000276f0
whismanoid 55:477ba09475d7 786 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027700
whismanoid 55:477ba09475d7 787 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 788 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 789 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 790 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 791 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 792 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 793 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 794 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 795 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 796 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 797 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 798 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 799 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 800 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 801 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000277f0
whismanoid 55:477ba09475d7 802 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027800
whismanoid 55:477ba09475d7 803 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 804 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 805 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 806 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 807 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 808 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 809 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 810 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 811 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 812 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 813 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 814 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 815 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 816 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 817 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000278f0
whismanoid 55:477ba09475d7 818 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027900
whismanoid 55:477ba09475d7 819 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 820 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 821 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 822 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 823 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 824 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 825 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 826 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 827 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 828 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 829 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 830 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 831 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 832 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 833 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x000279f0
whismanoid 55:477ba09475d7 834 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027a00
whismanoid 55:477ba09475d7 835 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 836 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 837 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 838 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 839 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 840 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 841 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 842 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 843 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 844 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 845 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 846 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 847 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 848 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 849 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027af0
whismanoid 55:477ba09475d7 850 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027b00
whismanoid 55:477ba09475d7 851 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 852 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 853 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 854 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 855 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 856 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 857 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 858 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 859 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 860 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 861 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 862 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 863 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 864 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 865 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027bf0
whismanoid 55:477ba09475d7 866 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027c00
whismanoid 55:477ba09475d7 867 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 868 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 869 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 870 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 871 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 872 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 873 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 874 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 875 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 876 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 877 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 878 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 879 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 880 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 881 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027cf0
whismanoid 55:477ba09475d7 882 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027d00
whismanoid 55:477ba09475d7 883 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 884 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 885 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 886 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 887 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 888 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 889 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 890 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 891 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 892 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 893 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 894 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 895 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 896 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 897 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027df0
whismanoid 55:477ba09475d7 898 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027e00
whismanoid 55:477ba09475d7 899 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 900 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 901 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 902 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 903 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 904 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 905 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 906 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 907 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 908 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 909 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 910 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 911 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 912 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 913 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027ef0
whismanoid 55:477ba09475d7 914 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), // FLA19 0x00027f00
whismanoid 55:477ba09475d7 915 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 916 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 917 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 918 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 919 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 920 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 921 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 922 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 923 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 924 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 925 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 926 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 927 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 928 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff),
whismanoid 55:477ba09475d7 929 flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff), flash_LE_bytes(flash_blank_ff) // FLA19 0x00027ff0
whismanoid 47:f1a56afb4aca 930 };
whismanoid 46:469d0061df5d 931 // WIP #312 map values in flash_page_configuration_back_up[]
whismanoid 46:469d0061df5d 932 // such as board serial number, %A calibration values,
whismanoid 46:469d0061df5d 933 // business logic, button handlers, etc.
whismanoid 46:469d0061df5d 934 // Use some pattern that stands out in the hex file dump
whismanoid 46:469d0061df5d 935 // as well as in the flash dump... note the hex file is LE/LSbyte first,
whismanoid 46:469d0061df5d 936 // while the flash memory is BE/MSbyte first.
whismanoid 46:469d0061df5d 937 //
whismanoid 46:469d0061df5d 938 // I don't have control of where this ends up because "at" attribute
whismanoid 46:469d0061df5d 939 // is not supported, but at least flash_page_configuration_back_up
whismanoid 46:469d0061df5d 940 // is page-aligned and its address is printed in the help.
whismanoid 46:469d0061df5d 941 // Also use a pattern that should stand out in the hex dump.
whismanoid 46:469d0061df5d 942 // Note that in the .bin file, "32107654" is 33 32 31 30 37 36 35 34,
whismanoid 46:469d0061df5d 943 // but in the flash memory it will be 0x30313233 0x34353637
whismanoid 46:469d0061df5d 944 // Use free hex editor to find text in .bin file,
whismanoid 46:469d0061df5d 945 // then add base address 0x00010000 to get peek address.
whismanoid 46:469d0061df5d 946 // char* TestString1 = "UUUUUUUUUUUUUUUUUUUU""32107654BA98FEDC"" MAX32625 Calibration ....####@@@@""UUUUUUUUUUUUUUUUUUUU";
whismanoid 46:469d0061df5d 947 // > %F peek=0x000241f0 len=20
whismanoid 46:469d0061df5d 948 // FLASH 0x000241f0: 0x544c4f56 0x00454741 0x55555555 0x55555555
whismanoid 46:469d0061df5d 949 // FLASH 0x00024200: 0x55555555 0x55555555 0x55555555 0x30313233
whismanoid 46:469d0061df5d 950 // FLASH 0x00024210: 0x34353637 0x38394142 0x43444546 0x58414d20
whismanoid 46:469d0061df5d 951 // FLASH 0x00024220: 0x32363233 0x61432035 0x7262696c 0x6f697461
whismanoid 46:469d0061df5d 952 // FLASH 0x00024230: 0x2020206e 0x2e2e2e2e 0x23232323 0x40404040
whismanoid 46:469d0061df5d 953 // FLASH 0x00024240: 0x55555555 0x55555555 0x55555555 0x55555555
whismanoid 46:469d0061df5d 954 // FLASH 0x00024250: 0x55555555 0x00000000 0x00000000 0x00000000
whismanoid 46:469d0061df5d 955 // FLASH 0x00024260: 0x00013b1b 0x000140d1 0x00013d9f 0x00013e2d
whismanoid 46:469d0061df5d 956 //
whismanoid 46:469d0061df5d 957 // Why did it end up at that address? Here's the linker map report:
whismanoid 46:469d0061df5d 958 // .\BUILD\MAX32625PICO\GCC_ARM\Internal_DataLogger.map
whismanoid 46:469d0061df5d 959 // .text.startup._GLOBAL__sub_I_TestString1
whismanoid 46:469d0061df5d 960 // 0x0001374c 0x33c BUILD/MAX32625PICO/GCC_ARM/DataLogger_Internal.o
whismanoid 46:469d0061df5d 961 // .rodata._GLOBAL__sub_I_TestString1.str1.1
whismanoid 46:469d0061df5d 962 // 0x00022d64 0x12 BUILD/MAX32625PICO/GCC_ARM/DataLogger_Internal.o
whismanoid 46:469d0061df5d 963 // 0x19 (size before relaxing)
whismanoid 46:469d0061df5d 964 //
whismanoid 46:469d0061df5d 965 // For calibration purposes this could still be usable,
whismanoid 46:469d0061df5d 966 // as long as the firmware knows where its calibration constants live.
whismanoid 46:469d0061df5d 967 //
whismanoid 46:469d0061df5d 968 #if defined ( __GNUC__ )
whismanoid 46:469d0061df5d 969 __attribute__ ((section(".calibration_teststring")))
whismanoid 46:469d0061df5d 970 #endif
whismanoid 46:469d0061df5d 971 char* TestString1 = "UUUU" "UUUU" "UUUU" "UUUU"
whismanoid 46:469d0061df5d 972 "\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF"
whismanoid 46:469d0061df5d 973 "\x11\x22\x33\x44" "\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF"
whismanoid 46:469d0061df5d 974 "UUUUUUUUUUUUUUUUUUUU""32107654BA98FEDC"" MAX32625 Calibration ....####@@@@""UUUUUUUUUUUUUUUUUUUU";
whismanoid 46:469d0061df5d 975 //
whismanoid 46:469d0061df5d 976 // Limit the ranges where memory write operation will be allowed
whismanoid 46:469d0061df5d 977 // MAX32625 flash peek/poke support (MAX40108 demo) #312
whismanoid 46:469d0061df5d 978 // FLASH (rx) : ORIGIN = 0x00010000, LENGTH = 0x00070000
whismanoid 46:469d0061df5d 979 // RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00028000
whismanoid 46:469d0061df5d 980 typedef struct {
whismanoid 46:469d0061df5d 981 uint32_t addr_min; // lowest address of range
whismanoid 46:469d0061df5d 982 uint32_t addr_max; // highest address of range
whismanoid 46:469d0061df5d 983 char name[6]; // 5-character name, pad with spaces, null-terminated
whismanoid 46:469d0061df5d 984 char can_flash_write_read; // 8=end of list, 4=flashPoke, 2=ramPoke, 1=read
whismanoid 46:469d0061df5d 985 } poke_access_t;
whismanoid 51:a41d3fd5e441 986 const char poke_access_readOnly = 1;
whismanoid 51:a41d3fd5e441 987 const char poke_access_rw_RAM = 3;
whismanoid 51:a41d3fd5e441 988 const char poke_access_rw_FLASH = 5;
whismanoid 51:a41d3fd5e441 989 const char poke_access_EndOfList = 8;
whismanoid 46:469d0061df5d 990 poke_access_t poke_access_list[] = {
whismanoid 46:469d0061df5d 991 { 0x12345678, 0x12345678, "undef", 0 }, // first record: catch undefined ranges
whismanoid 46:469d0061df5d 992 // { 0x00000000, 0x0000FFFF, " BOOT", 1 }, // boot area is flash page 0-7, but don't allow flashPoke
whismanoid 51:a41d3fd5e441 993 { 0x00000000, 0x00001FFF, "BOOT0", poke_access_readOnly }, // flash page 0
whismanoid 51:a41d3fd5e441 994 { 0x00002000, 0x00003FFF, "BOOT1", poke_access_readOnly }, // flash page 1
whismanoid 51:a41d3fd5e441 995 { 0x00004000, 0x00005FFF, "BOOT2", poke_access_readOnly }, // flash page 2
whismanoid 51:a41d3fd5e441 996 { 0x00006000, 0x00007FFF, "BOOT3", poke_access_readOnly }, // flash page 3
whismanoid 51:a41d3fd5e441 997 { 0x00008000, 0x00009FFF, "BOOT4", poke_access_readOnly }, // flash page 4
whismanoid 51:a41d3fd5e441 998 { 0x0000A000, 0x0000BFFF, "BOOT5", poke_access_readOnly }, // flash page 5
whismanoid 51:a41d3fd5e441 999 { 0x0000C000, 0x0000DFFF, "BOOT6", poke_access_readOnly }, // flash page 6
whismanoid 51:a41d3fd5e441 1000 { 0x0000E000, 0x0000FFFF, "BOOT7", poke_access_readOnly }, // flash page 7
whismanoid 46:469d0061df5d 1001 //
whismanoid 51:a41d3fd5e441 1002 //{ 0x00010000, 0x0007FFFF, "FLASH", poke_access_rw_FLASH }, // flash pages 8-62
whismanoid 46:469d0061df5d 1003 // Future: separate FLASH pages, allow flashPoke only on the calibration page
whismanoid 51:a41d3fd5e441 1004 { 0x00010000, 0x00011FFF, "FLA08", poke_access_rw_FLASH }, // flash page 8
whismanoid 51:a41d3fd5e441 1005 { 0x00012000, 0x00013FFF, "FLA09", poke_access_rw_FLASH }, // flash page 9
whismanoid 51:a41d3fd5e441 1006 { 0x00014000, 0x00015FFF, "FLA10", poke_access_rw_FLASH }, // flash page 10
whismanoid 51:a41d3fd5e441 1007 { 0x00016000, 0x00017FFF, "FLA11", poke_access_rw_FLASH }, // flash page 11
whismanoid 51:a41d3fd5e441 1008 { 0x00018000, 0x00019FFF, "FLA12", poke_access_rw_FLASH }, // flash page 12
whismanoid 51:a41d3fd5e441 1009 { 0x0001A000, 0x0001BFFF, "FLA13", poke_access_rw_FLASH }, // flash page 13
whismanoid 51:a41d3fd5e441 1010 { 0x0001C000, 0x0001DFFF, "FLA14", poke_access_rw_FLASH }, // flash page 14
whismanoid 51:a41d3fd5e441 1011 { 0x0001E000, 0x0001FFFF, "FLA15", poke_access_rw_FLASH }, // flash page 15
whismanoid 46:469d0061df5d 1012 //
whismanoid 51:a41d3fd5e441 1013 { 0x00020000, 0x00021FFF, "FLA16", poke_access_rw_FLASH }, // flash page 16
whismanoid 51:a41d3fd5e441 1014 { 0x00022000, 0x00023FFF, "FLA17", poke_access_rw_FLASH }, // flash page 17
whismanoid 51:a41d3fd5e441 1015 { 0x00024000, 0x00025FFF, "FLA18", poke_access_rw_FLASH }, // flash page 18
whismanoid 51:a41d3fd5e441 1016 { 0x00026000, 0x00027FFF, "FLA19", poke_access_rw_FLASH }, // flash page 19
whismanoid 51:a41d3fd5e441 1017 { 0x00028000, 0x00029FFF, "FLA20", poke_access_rw_FLASH }, // flash page 20
whismanoid 51:a41d3fd5e441 1018 { 0x0002A000, 0x0002BFFF, "FLA21", poke_access_rw_FLASH }, // flash page 21
whismanoid 51:a41d3fd5e441 1019 { 0x0002C000, 0x0002DFFF, "FLA22", poke_access_rw_FLASH }, // flash page 22
whismanoid 51:a41d3fd5e441 1020 { 0x0002E000, 0x0002FFFF, "FLA23", poke_access_rw_FLASH }, // flash page 23
whismanoid 46:469d0061df5d 1021 //
whismanoid 51:a41d3fd5e441 1022 { 0x00030000, 0x00031FFF, "FLA24", poke_access_rw_FLASH }, // flash page 24
whismanoid 51:a41d3fd5e441 1023 { 0x00032000, 0x00033FFF, "FLA25", poke_access_rw_FLASH }, // flash page 25
whismanoid 51:a41d3fd5e441 1024 { 0x00034000, 0x00035FFF, "FLA26", poke_access_rw_FLASH }, // flash page 26
whismanoid 51:a41d3fd5e441 1025 { 0x00036000, 0x00037FFF, "FLA27", poke_access_rw_FLASH }, // flash page 27
whismanoid 51:a41d3fd5e441 1026 { 0x00038000, 0x00039FFF, "FLA28", poke_access_rw_FLASH }, // flash page 28
whismanoid 51:a41d3fd5e441 1027 { 0x0003A000, 0x0003BFFF, "FLA29", poke_access_rw_FLASH }, // flash page 29
whismanoid 51:a41d3fd5e441 1028 { 0x0003C000, 0x0003DFFF, "FLA30", poke_access_rw_FLASH }, // flash page 30
whismanoid 51:a41d3fd5e441 1029 { 0x0003E000, 0x0003FFFF, "FLA31", poke_access_rw_FLASH }, // flash page 31
whismanoid 46:469d0061df5d 1030 //
whismanoid 51:a41d3fd5e441 1031 { 0x00040000, 0x00041FFF, "FLA32", poke_access_rw_FLASH }, // flash page 32
whismanoid 51:a41d3fd5e441 1032 { 0x00042000, 0x00043FFF, "FLA33", poke_access_rw_FLASH }, // flash page 33
whismanoid 51:a41d3fd5e441 1033 { 0x00044000, 0x00045FFF, "FLA34", poke_access_rw_FLASH }, // flash page 34
whismanoid 51:a41d3fd5e441 1034 { 0x00046000, 0x00047FFF, "FLA35", poke_access_rw_FLASH }, // flash page 35
whismanoid 51:a41d3fd5e441 1035 { 0x00048000, 0x00049FFF, "FLA36", poke_access_rw_FLASH }, // flash page 36
whismanoid 51:a41d3fd5e441 1036 { 0x0004A000, 0x0004BFFF, "FLA37", poke_access_rw_FLASH }, // flash page 37
whismanoid 51:a41d3fd5e441 1037 { 0x0004C000, 0x0004DFFF, "FLA38", poke_access_rw_FLASH }, // flash page 38
whismanoid 51:a41d3fd5e441 1038 { 0x0004E000, 0x0004FFFF, "FLA39", poke_access_rw_FLASH }, // flash page 39
whismanoid 46:469d0061df5d 1039 //
whismanoid 51:a41d3fd5e441 1040 { 0x00050000, 0x00051FFF, "FLA40", poke_access_rw_FLASH }, // flash page 40
whismanoid 51:a41d3fd5e441 1041 { 0x00052000, 0x00053FFF, "FLA41", poke_access_rw_FLASH }, // flash page 41
whismanoid 51:a41d3fd5e441 1042 { 0x00054000, 0x00055FFF, "FLA42", poke_access_rw_FLASH }, // flash page 42
whismanoid 51:a41d3fd5e441 1043 { 0x00056000, 0x00057FFF, "FLA43", poke_access_rw_FLASH }, // flash page 43
whismanoid 51:a41d3fd5e441 1044 { 0x00058000, 0x00059FFF, "FLA44", poke_access_rw_FLASH }, // flash page 44
whismanoid 51:a41d3fd5e441 1045 { 0x0005A000, 0x0005BFFF, "FLA45", poke_access_rw_FLASH }, // flash page 45
whismanoid 51:a41d3fd5e441 1046 { 0x0005C000, 0x0005DFFF, "FLA46", poke_access_rw_FLASH }, // flash page 46
whismanoid 51:a41d3fd5e441 1047 { 0x0005E000, 0x0005FFFF, "FLA47", poke_access_rw_FLASH }, // flash page 47
whismanoid 46:469d0061df5d 1048 //
whismanoid 51:a41d3fd5e441 1049 { 0x00060000, 0x00061FFF, "FLA48", poke_access_rw_FLASH }, // flash page 48
whismanoid 51:a41d3fd5e441 1050 { 0x00062000, 0x00063FFF, "FLA49", poke_access_rw_FLASH }, // flash page 49
whismanoid 51:a41d3fd5e441 1051 { 0x00064000, 0x00065FFF, "FLA50", poke_access_rw_FLASH }, // flash page 50
whismanoid 51:a41d3fd5e441 1052 { 0x00066000, 0x00067FFF, "FLA51", poke_access_rw_FLASH }, // flash page 51
whismanoid 51:a41d3fd5e441 1053 { 0x00068000, 0x00069FFF, "FLA52", poke_access_rw_FLASH }, // flash page 52
whismanoid 51:a41d3fd5e441 1054 { 0x0006A000, 0x0006BFFF, "FLA53", poke_access_rw_FLASH }, // flash page 53
whismanoid 51:a41d3fd5e441 1055 { 0x0006C000, 0x0006DFFF, "FLA54", poke_access_rw_FLASH }, // flash page 54
whismanoid 51:a41d3fd5e441 1056 { 0x0006E000, 0x0006FFFF, "FLA55", poke_access_rw_FLASH }, // flash page 55
whismanoid 46:469d0061df5d 1057 //
whismanoid 51:a41d3fd5e441 1058 { 0x00070000, 0x00071FFF, "FLA56", poke_access_rw_FLASH }, // flash page 56
whismanoid 51:a41d3fd5e441 1059 { 0x00072000, 0x00073FFF, "FLA57", poke_access_rw_FLASH }, // flash page 57
whismanoid 51:a41d3fd5e441 1060 { 0x00074000, 0x00075FFF, "FLA58", poke_access_rw_FLASH }, // flash page 58
whismanoid 51:a41d3fd5e441 1061 { 0x00076000, 0x00077FFF, "FLA59", poke_access_rw_FLASH }, // flash page 59
whismanoid 51:a41d3fd5e441 1062 { 0x00078000, 0x00079FFF, "FLA60", poke_access_rw_FLASH }, // flash page 60
whismanoid 51:a41d3fd5e441 1063 { 0x0007A000, 0x0007BFFF, "FLA61", poke_access_rw_FLASH }, // flash page 61
whismanoid 51:a41d3fd5e441 1064 { 0x0007C000, 0x0007DFFF, "FLA62", poke_access_rw_FLASH }, // flash page 62
whismanoid 51:a41d3fd5e441 1065 { 0x0007E000, 0x0007FFFF, "FLA63", poke_access_rw_FLASH }, // flash page 63
whismanoid 46:469d0061df5d 1066 //
whismanoid 51:a41d3fd5e441 1067 { 0x20000000, 0x20027FFF, " RAM", poke_access_rw_RAM }, // ramPoke + read
whismanoid 46:469d0061df5d 1068 { 0x20028000, 0x2002FFFF, "skip ", 0 }, // don't read from this range
whismanoid 51:a41d3fd5e441 1069 { 0x40000000, 0x400003FF, " SYS", poke_access_readOnly }, // read only
whismanoid 51:a41d3fd5e441 1070 { 0x40000400, 0x400007FF, " CLK", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1071 { 0x40000800, 0x400009FF, " PWR", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1072 { 0x40000A00, 0x40000BFF, " RTC", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1073 { 0x40000C00, 0x40001FFF, "IOMAN", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1074 { 0x40002000, 0x40002FFF, " FLC", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1075 { 0x40003000, 0x40003FFF, " ICC", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1076 { 0x40004000, 0x40004FFF, " SPIX", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1077 { 0x40005000, 0x40005FFF, " PMU", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1078 { 0x40006000, 0x40006FFF, " CRC", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1079 { 0x40007000, 0x40007FFF, " TPU", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1080 { 0x40008000, 0x40008FFF, " WDT0", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1081 { 0x40009000, 0x40009FFF, " WDT1", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1082 { 0x4000A000, 0x4000AFFF, " GPIO", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1083 { 0x4000B000, 0x4000FFFF, " TMR", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1084 { 0x40011000, 0x4000FFFF, " PT", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1085 { 0x40012000, 0x4000FFFF, " UART", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1086 { 0x40016000, 0x4000FFFF, " I2CM", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1087 { 0x40019000, 0x4000FFFF, " I2CS", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1088 { 0x4001A000, 0x4000FFFF, " SPIM", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1089 { 0x4001E000, 0x4000FFFF, " OWM", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1090 { 0x4001F000, 0x4000FFFF, " ADC", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1091 { 0x40020000, 0x40000FFF, " SPIS", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1092 { 0x40100000, 0x40100FFF, " USB", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1093 { 0x40101000, 0x40101FFF, " CRC", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1094 { 0x40102000, 0x40102FFF, " TPU", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1095 { 0x40103000, 0x40103FFF, "UART0", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1096 { 0x40104000, 0x40104FFF, "UART1", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1097 { 0x40105000, 0x40105FFF, "UART2", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1098 //{ 0x40106000, 0x40106FFF, "_____", poke_access_readOnly }, // reserved
whismanoid 51:a41d3fd5e441 1099 { 0x40107000, 0x40107FFF, "I2CM0", poke_access_readOnly }, // I2CM0 FIFOs
whismanoid 51:a41d3fd5e441 1100 { 0x40108000, 0x40108FFF, "I2CM1", poke_access_readOnly }, // I2CM1 FIFOs
whismanoid 51:a41d3fd5e441 1101 //{ 0x40109000, 0x40109FFF, "_____", poke_access_readOnly }, // reserved
whismanoid 51:a41d3fd5e441 1102 { 0x4010A000, 0x4010AFFF, "SPIM0", poke_access_readOnly }, // SPIM0 FIFOs
whismanoid 51:a41d3fd5e441 1103 { 0x4010B000, 0x4010BFFF, "SPIM1", poke_access_readOnly }, // SPIM1 FIFOs
whismanoid 51:a41d3fd5e441 1104 { 0x4010C000, 0x4010CFFF, "SPIM2", poke_access_readOnly }, // SPIM2 FIFOs
whismanoid 51:a41d3fd5e441 1105 //{ 0x4010D000, 0x4010DFFF, "_____", poke_access_readOnly }, // reserved
whismanoid 51:a41d3fd5e441 1106 { 0x4010E000, 0x4010EFFF, " SPIS", poke_access_readOnly }, // SPIS FIFOs
whismanoid 51:a41d3fd5e441 1107 //{ 0x4010F000, 0x4010FFFF, "_____", poke_access_readOnly }, // reserved
whismanoid 46:469d0061df5d 1108 //
whismanoid 51:a41d3fd5e441 1109 { 0x00000000, 0xFFFFFFFF, "last?", poke_access_EndOfList }, // end of list can_flash_write_read=8, catch-all
whismanoid 46:469d0061df5d 1110 };
whismanoid 46:469d0061df5d 1111 int search_poke_access_list(uint32_t addr)
whismanoid 46:469d0061df5d 1112 {
whismanoid 46:469d0061df5d 1113 // scan poke_access_list[] for peek_addr
whismanoid 46:469d0061df5d 1114 for (int i = 0; poke_access_list[i].can_flash_write_read != 8; i++)
whismanoid 46:469d0061df5d 1115 {
whismanoid 46:469d0061df5d 1116 if ((addr >= poke_access_list[i].addr_min) && (addr <= poke_access_list[i].addr_max))
whismanoid 46:469d0061df5d 1117 {
whismanoid 46:469d0061df5d 1118 return i;
whismanoid 46:469d0061df5d 1119 }
whismanoid 46:469d0061df5d 1120 }
whismanoid 46:469d0061df5d 1121 return 0;
whismanoid 46:469d0061df5d 1122 }
whismanoid 46:469d0061df5d 1123 #endif // defined(HAS_FLASH_PEEK) || defined(HAS_FLASH_POKE)
whismanoid 46:469d0061df5d 1124
whismanoid 46:469d0061df5d 1125 //--------------------------------------------------
whismanoid 3:9055e17e181a 1126 // Option to use SPI connected ADC
whismanoid 3:9055e17e181a 1127 #ifndef SPI_ADC_DeviceName
whismanoid 9:45f98573eb6d 1128 #define SPI_ADC_DeviceName MAX11410
whismanoid 3:9055e17e181a 1129 #undef SPI_ADC_DeviceName
whismanoid 3:9055e17e181a 1130 #endif
whismanoid 3:9055e17e181a 1131 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 1132 #include "MAX11410.h"
whismanoid 3:9055e17e181a 1133 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 1134 //--------------------------------------------------
whismanoid 55:477ba09475d7 1135 // Option to Datalog SPI connected ADC analog inputs with offset/gain applied
whismanoid 55:477ba09475d7 1136 // MAX40108 Datalog Math #362 -- define compile-time option SPI_AIN_MATH
whismanoid 55:477ba09475d7 1137 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 1138 #ifndef SPI_AIN_MATH
whismanoid 55:477ba09475d7 1139 #define SPI_AIN_MATH 1
whismanoid 55:477ba09475d7 1140 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 1141 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 1142 //--------------------------------------------------
whismanoid 55:477ba09475d7 1143 // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 1144 // This could be used to identify external hardware attached to each input
whismanoid 55:477ba09475d7 1145 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 1146 #ifndef HAS_SPI_AIN_customChannelHeader
whismanoid 55:477ba09475d7 1147 #define HAS_SPI_AIN_customChannelHeader 1
whismanoid 55:477ba09475d7 1148 #endif
whismanoid 55:477ba09475d7 1149 #if HAS_SPI_AIN_customChannelHeader
whismanoid 55:477ba09475d7 1150 #define SPI_AIN_customChannelHeader_MAXLENGTH 20
whismanoid 55:477ba09475d7 1151 #endif
whismanoid 55:477ba09475d7 1152 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 1153
whismanoid 55:477ba09475d7 1154 //--------------------------------------------------
whismanoid 55:477ba09475d7 1155 // Option to Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 1156 #ifndef LOG_PLATFORM_AIN
whismanoid 55:477ba09475d7 1157 #define LOG_PLATFORM_AIN 6
whismanoid 55:477ba09475d7 1158 //~ #undef LOG_PLATFORM_AIN
whismanoid 55:477ba09475d7 1159 #endif
whismanoid 55:477ba09475d7 1160 //--------------------------------------------------
whismanoid 55:477ba09475d7 1161 // Option to Datalog Arduino platform analog inputs with offset/gain applied
whismanoid 55:477ba09475d7 1162 // MAX40108 Datalog Math #362 -- define compile-time option PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 1163 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 1164 #ifndef PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 1165 #define PLATFORM_AIN_MATH 1
whismanoid 55:477ba09475d7 1166 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 1167 #endif // defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 1168 //--------------------------------------------------
whismanoid 55:477ba09475d7 1169 // Option to customize channel names in datalog header line
whismanoid 55:477ba09475d7 1170 // This could be used to identify external hardware attached to each input
whismanoid 55:477ba09475d7 1171 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 1172 #ifndef HAS_Platform_AIN_customChannelHeader
whismanoid 55:477ba09475d7 1173 #define HAS_Platform_AIN_customChannelHeader 1
whismanoid 55:477ba09475d7 1174 #endif
whismanoid 55:477ba09475d7 1175 #if HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 1176 #define Platform_AIN_customChannelHeader_MAXLENGTH 20
whismanoid 55:477ba09475d7 1177 #endif
whismanoid 55:477ba09475d7 1178 #endif // defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 1179
whismanoid 55:477ba09475d7 1180 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1181 #if defined(TARGET)
whismanoid 0:cb44e2e9ec4c 1182 // TARGET_NAME macros from targets/TARGET_Maxim/TARGET_MAX32625/device/mxc_device.h
whismanoid 0:cb44e2e9ec4c 1183 // Create a string definition for the TARGET
whismanoid 0:cb44e2e9ec4c 1184 #define STRING_ARG(arg) #arg
whismanoid 0:cb44e2e9ec4c 1185 #define STRING_NAME(name) STRING_ARG(name)
whismanoid 0:cb44e2e9ec4c 1186 #define TARGET_NAME STRING_NAME(TARGET)
whismanoid 0:cb44e2e9ec4c 1187 #elif defined(TARGET_MAX32600)
whismanoid 0:cb44e2e9ec4c 1188 #define TARGET_NAME "MAX32600"
whismanoid 0:cb44e2e9ec4c 1189 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 1190 #define TARGET_NAME "LPC1768"
whismanoid 0:cb44e2e9ec4c 1191 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:cb44e2e9ec4c 1192 #define TARGET_NAME "NUCLEO_F446RE"
whismanoid 0:cb44e2e9ec4c 1193 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 1194 #define TARGET_NAME "NUCLEO_F401RE"
whismanoid 0:cb44e2e9ec4c 1195 #else
whismanoid 0:cb44e2e9ec4c 1196 #error TARGET NOT DEFINED
whismanoid 0:cb44e2e9ec4c 1197 #endif
whismanoid 0:cb44e2e9ec4c 1198 #if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 1199 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1200 // TARGET=MAX32630FTHR ARM Cortex-M4F 96MHz 2048kB Flash 512kB SRAM
whismanoid 0:cb44e2e9ec4c 1201 // +-------------[microUSB]-------------+
whismanoid 0:cb44e2e9ec4c 1202 // | J1 MAX32630FTHR J2 |
whismanoid 0:cb44e2e9ec4c 1203 // ______ | [ ] RST GND [ ] |
whismanoid 0:cb44e2e9ec4c 1204 // ______ | [ ] 3V3 BAT+[ ] |
whismanoid 0:cb44e2e9ec4c 1205 // ______ | [ ] 1V8 reset SW1 |
whismanoid 0:cb44e2e9ec4c 1206 // ______ | [ ] GND J4 J3 |
whismanoid 0:cb44e2e9ec4c 1207 // analogIn0/4 | [a] AIN_0 1.2Vfs (bat) SYS [ ] | switched BAT+
whismanoid 0:cb44e2e9ec4c 1208 // analogIn1/5 | [a] AIN_1 1.2Vfs PWR [ ] | external pwr btn
whismanoid 0:cb44e2e9ec4c 1209 // analogIn2 | [a] AIN_2 1.2Vfs +5V VBUS [ ] | USB +5V power
whismanoid 0:cb44e2e9ec4c 1210 // analogIn3 | [a] AIN_3 1.2Vfs 1-WIRE P4_0 [d] | D0 dig9
whismanoid 0:cb44e2e9ec4c 1211 // (I2C2.SDA) | [d] P5_7 SDA2 SRN P5_6 [d] | D1 dig8
whismanoid 0:cb44e2e9ec4c 1212 // (I2C2.SCL) | [d] P6_0 SCL2 SDIO3 P5_5 [d] | D2 dig7
whismanoid 0:cb44e2e9ec4c 1213 // D13/SCLK | [s] P5_0 SCLK SDIO2 P5_4 [d] | D3 dig6
whismanoid 0:cb44e2e9ec4c 1214 // D11/MOSI | [s] P5_1 MOSI SSEL P5_3 [d] | D4 dig5
whismanoid 0:cb44e2e9ec4c 1215 // D12/MISO | [s] P5_2 MISO RTS P3_3 [d] | D5 dig4
whismanoid 0:cb44e2e9ec4c 1216 // D10/CS | [s] P3_0 RX CTS P3_2 [d] | D6 dig3
whismanoid 0:cb44e2e9ec4c 1217 // D9 dig0 | [d] P3_1 TX SCL P3_5 [d] | D7 dig2
whismanoid 0:cb44e2e9ec4c 1218 // ______ | [ ] GND SDA P3_4 [d] | D8 dig1
whismanoid 0:cb44e2e9ec4c 1219 // | |
whismanoid 0:cb44e2e9ec4c 1220 // | XIP Flash MAX14690N |
whismanoid 0:cb44e2e9ec4c 1221 // | XIP_SCLK P1_0 SDA2 P5_7 |
whismanoid 0:cb44e2e9ec4c 1222 // | XIP_MOSI P1_1 SCL2 P6_0 |
whismanoid 0:cb44e2e9ec4c 1223 // | XIP_MISO P1_2 PMIC_INIT P3_7 |
whismanoid 0:cb44e2e9ec4c 1224 // | XIP_SSEL P1_3 MPC P2_7 |
whismanoid 0:cb44e2e9ec4c 1225 // | XIP_DIO2 P1_4 MON AIN_0 |
whismanoid 0:cb44e2e9ec4c 1226 // | XIP_DIO3 P1_5 |
whismanoid 0:cb44e2e9ec4c 1227 // | |
whismanoid 0:cb44e2e9ec4c 1228 // | PAN1326B MicroSD LED |
whismanoid 0:cb44e2e9ec4c 1229 // | BT_RX P0_0 SD_SCLK P0_4 r P2_4 |
whismanoid 0:cb44e2e9ec4c 1230 // | BT_TX P0_1 SD_MOSI P0_5 g P2_5 |
whismanoid 0:cb44e2e9ec4c 1231 // | BT_CTS P0_2 SD_MISO P0_6 b P2_6 |
whismanoid 0:cb44e2e9ec4c 1232 // | BT_RTS P0_3 SD_SSEL P0_7 |
whismanoid 0:cb44e2e9ec4c 1233 // | BT_RST P1_6 DETECT P2_2 |
whismanoid 0:cb44e2e9ec4c 1234 // | BT_CLK P1_7 SW2 P2_3 |
whismanoid 0:cb44e2e9ec4c 1235 // +------------------------------------+
whismanoid 0:cb44e2e9ec4c 1236 // MAX32630FTHR board has MAX14690 PMIC on I2C bus (P5_7 SDA, P6_0 SCL) at slave address 0101_000r 0x50 (or 0x28 for 7 MSbit address).
whismanoid 0:cb44e2e9ec4c 1237 // MAX32630FTHR board has BMI160 accelerometer on I2C bus (P5_7 SDA, P6_0 SCL) at slave address 1101_000r 0xD0 (or 0x68 for 7 MSbit address).
whismanoid 0:cb44e2e9ec4c 1238 // AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1239 // AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1240 // AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1241 // AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1242 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1243 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1244 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1245 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1246 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1247 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 1248 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 1249 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1250 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1251 //
whismanoid 0:cb44e2e9ec4c 1252 #include "max32630fthr.h"
whismanoid 0:cb44e2e9ec4c 1253 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
whismanoid 0:cb44e2e9ec4c 1254 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1255 // MAX32630FTHR board supports only internal VREF = 1.200V at bypass capacitor C15
whismanoid 0:cb44e2e9ec4c 1256 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 0:cb44e2e9ec4c 1257 // Arduino connector
whismanoid 0:cb44e2e9ec4c 1258 #ifndef A0
whismanoid 0:cb44e2e9ec4c 1259 #define A0 AIN_0
whismanoid 0:cb44e2e9ec4c 1260 #endif
whismanoid 0:cb44e2e9ec4c 1261 #ifndef A1
whismanoid 0:cb44e2e9ec4c 1262 #define A1 AIN_1
whismanoid 0:cb44e2e9ec4c 1263 #endif
whismanoid 0:cb44e2e9ec4c 1264 #ifndef A2
whismanoid 0:cb44e2e9ec4c 1265 #define A2 AIN_2
whismanoid 0:cb44e2e9ec4c 1266 #endif
whismanoid 0:cb44e2e9ec4c 1267 #ifndef A3
whismanoid 0:cb44e2e9ec4c 1268 #define A3 AIN_3
whismanoid 0:cb44e2e9ec4c 1269 #endif
whismanoid 0:cb44e2e9ec4c 1270 #ifndef D0
whismanoid 0:cb44e2e9ec4c 1271 #define D0 P4_0
whismanoid 0:cb44e2e9ec4c 1272 #endif
whismanoid 0:cb44e2e9ec4c 1273 #ifndef D1
whismanoid 0:cb44e2e9ec4c 1274 #define D1 P5_6
whismanoid 0:cb44e2e9ec4c 1275 #endif
whismanoid 0:cb44e2e9ec4c 1276 #ifndef D2
whismanoid 0:cb44e2e9ec4c 1277 #define D2 P5_5
whismanoid 0:cb44e2e9ec4c 1278 #endif
whismanoid 0:cb44e2e9ec4c 1279 #ifndef D3
whismanoid 0:cb44e2e9ec4c 1280 #define D3 P5_4
whismanoid 0:cb44e2e9ec4c 1281 #endif
whismanoid 0:cb44e2e9ec4c 1282 #ifndef D4
whismanoid 0:cb44e2e9ec4c 1283 #define D4 P5_3
whismanoid 0:cb44e2e9ec4c 1284 #endif
whismanoid 0:cb44e2e9ec4c 1285 #ifndef D5
whismanoid 0:cb44e2e9ec4c 1286 #define D5 P3_3
whismanoid 0:cb44e2e9ec4c 1287 #endif
whismanoid 0:cb44e2e9ec4c 1288 #ifndef D6
whismanoid 0:cb44e2e9ec4c 1289 #define D6 P3_2
whismanoid 0:cb44e2e9ec4c 1290 #endif
whismanoid 0:cb44e2e9ec4c 1291 #ifndef D7
whismanoid 0:cb44e2e9ec4c 1292 #define D7 P3_5
whismanoid 0:cb44e2e9ec4c 1293 #endif
whismanoid 0:cb44e2e9ec4c 1294 #ifndef D8
whismanoid 0:cb44e2e9ec4c 1295 #define D8 P3_4
whismanoid 0:cb44e2e9ec4c 1296 #endif
whismanoid 0:cb44e2e9ec4c 1297 #ifndef D9
whismanoid 0:cb44e2e9ec4c 1298 #define D9 P3_1
whismanoid 0:cb44e2e9ec4c 1299 #endif
whismanoid 0:cb44e2e9ec4c 1300 #ifndef D10
whismanoid 0:cb44e2e9ec4c 1301 #define D10 P3_0
whismanoid 0:cb44e2e9ec4c 1302 #endif
whismanoid 0:cb44e2e9ec4c 1303 #ifndef D11
whismanoid 0:cb44e2e9ec4c 1304 #define D11 P5_1
whismanoid 0:cb44e2e9ec4c 1305 #endif
whismanoid 0:cb44e2e9ec4c 1306 #ifndef D12
whismanoid 0:cb44e2e9ec4c 1307 #define D12 P5_2
whismanoid 0:cb44e2e9ec4c 1308 #endif
whismanoid 0:cb44e2e9ec4c 1309 #ifndef D13
whismanoid 0:cb44e2e9ec4c 1310 #define D13 P5_0
whismanoid 0:cb44e2e9ec4c 1311 #endif
whismanoid 0:cb44e2e9ec4c 1312 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1313 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 1314 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1315 // TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:cb44e2e9ec4c 1316 // +-------------------------------------+
whismanoid 0:cb44e2e9ec4c 1317 // | MAX32625MBED Arduino UNO header |
whismanoid 0:cb44e2e9ec4c 1318 // | |
whismanoid 0:cb44e2e9ec4c 1319 // | A5/SCL[ ] | P1_7 dig15
whismanoid 0:cb44e2e9ec4c 1320 // | A4/SDA[ ] | P1_6 dig14
whismanoid 0:cb44e2e9ec4c 1321 // | AREF=N/C[ ] |
whismanoid 0:cb44e2e9ec4c 1322 // | GND[ ] |
whismanoid 0:cb44e2e9ec4c 1323 // | [ ]N/C SCK/13[ ] | P1_0 dig13
whismanoid 0:cb44e2e9ec4c 1324 // | [ ]IOREF=3V3 MISO/12[ ] | P1_2 dig12
whismanoid 0:cb44e2e9ec4c 1325 // | [ ]RST MOSI/11[ ]~| P1_1 dig11
whismanoid 0:cb44e2e9ec4c 1326 // | [ ]3V3 CS/10[ ]~| P1_3 dig10
whismanoid 0:cb44e2e9ec4c 1327 // | [ ]5V0 9[ ]~| P1_5 dig9
whismanoid 0:cb44e2e9ec4c 1328 // | [ ]GND 8[ ] | P1_4 dig8
whismanoid 0:cb44e2e9ec4c 1329 // | [ ]GND |
whismanoid 0:cb44e2e9ec4c 1330 // | [ ]Vin 7[ ] | P0_7 dig7
whismanoid 0:cb44e2e9ec4c 1331 // | 6[ ]~| P0_6 dig6
whismanoid 0:cb44e2e9ec4c 1332 // AIN_0 | [ ]A0 5[ ]~| P0_5 dig5
whismanoid 0:cb44e2e9ec4c 1333 // AIN_1 | [ ]A1 4[ ] | P0_4 dig4
whismanoid 0:cb44e2e9ec4c 1334 // AIN_2 | [ ]A2 INT1/3[ ]~| P0_3 dig3
whismanoid 0:cb44e2e9ec4c 1335 // AIN_3 | [ ]A3 INT0/2[ ] | P0_2 dig2
whismanoid 0:cb44e2e9ec4c 1336 // dig16 P3_4 | [ ]A4/SDA RST SCK MISO TX>1[ ] | P0_1 dig1
whismanoid 0:cb44e2e9ec4c 1337 // dig17 P3_5 | [ ]A5/SCL [ ] [ ] [ ] RX<0[ ] | P0_0 dig0
whismanoid 0:cb44e2e9ec4c 1338 // | [ ] [ ] [ ] |
whismanoid 0:cb44e2e9ec4c 1339 // | UNO_R3 GND MOSI 5V ____________/
whismanoid 0:cb44e2e9ec4c 1340 // \_______________________/
whismanoid 0:cb44e2e9ec4c 1341 //
whismanoid 0:cb44e2e9ec4c 1342 // +------------------------+
whismanoid 0:cb44e2e9ec4c 1343 // | |
whismanoid 0:cb44e2e9ec4c 1344 // | MicroSD LED |
whismanoid 0:cb44e2e9ec4c 1345 // | SD_SCLK P2_4 r P3_0 |
whismanoid 0:cb44e2e9ec4c 1346 // | SD_MOSI P2_5 g P3_1 |
whismanoid 0:cb44e2e9ec4c 1347 // | SD_MISO P2_6 b P3_2 |
whismanoid 0:cb44e2e9ec4c 1348 // | SD_SSEL P2_7 y P3_3 |
whismanoid 0:cb44e2e9ec4c 1349 // | |
whismanoid 0:cb44e2e9ec4c 1350 // | DAPLINK BUTTONS |
whismanoid 0:cb44e2e9ec4c 1351 // | TX P2_1 SW3 P2_3 |
whismanoid 0:cb44e2e9ec4c 1352 // | RX P2_0 SW2 P2_2 |
whismanoid 0:cb44e2e9ec4c 1353 // +------------------------+
whismanoid 0:cb44e2e9ec4c 1354 //
whismanoid 0:cb44e2e9ec4c 1355 // AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1356 // AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1357 // AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1358 // AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1359 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1360 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1361 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1362 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1363 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1364 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 1365 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 1366 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1367 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1368 //
whismanoid 0:cb44e2e9ec4c 1369 //#include "max32625mbed.h" // ?
whismanoid 0:cb44e2e9ec4c 1370 //MAX32625MBED mbed(MAX32625MBED::VIO_3V3); // ?
whismanoid 0:cb44e2e9ec4c 1371 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1372 // MAX32630FTHR board supports only internal VREF = 1.200V at bypass capacitor C15
whismanoid 0:cb44e2e9ec4c 1373 const float ADC_FULL_SCALE_VOLTAGE = 1.200; // TODO: ADC_FULL_SCALE_VOLTAGE Pico?
whismanoid 0:cb44e2e9ec4c 1374 // Arduino connector
whismanoid 0:cb44e2e9ec4c 1375 #ifndef A0
whismanoid 0:cb44e2e9ec4c 1376 #define A0 AIN_0
whismanoid 0:cb44e2e9ec4c 1377 #endif
whismanoid 0:cb44e2e9ec4c 1378 #ifndef A1
whismanoid 0:cb44e2e9ec4c 1379 #define A1 AIN_1
whismanoid 0:cb44e2e9ec4c 1380 #endif
whismanoid 0:cb44e2e9ec4c 1381 #ifndef A2
whismanoid 0:cb44e2e9ec4c 1382 #define A2 AIN_2
whismanoid 0:cb44e2e9ec4c 1383 #endif
whismanoid 0:cb44e2e9ec4c 1384 #ifndef A3
whismanoid 0:cb44e2e9ec4c 1385 #define A3 AIN_3
whismanoid 0:cb44e2e9ec4c 1386 #endif
whismanoid 0:cb44e2e9ec4c 1387 #ifndef D0
whismanoid 0:cb44e2e9ec4c 1388 #define D0 P0_0
whismanoid 0:cb44e2e9ec4c 1389 #endif
whismanoid 0:cb44e2e9ec4c 1390 #ifndef D1
whismanoid 0:cb44e2e9ec4c 1391 #define D1 P0_1
whismanoid 0:cb44e2e9ec4c 1392 #endif
whismanoid 0:cb44e2e9ec4c 1393 #ifndef D2
whismanoid 0:cb44e2e9ec4c 1394 #define D2 P0_2
whismanoid 0:cb44e2e9ec4c 1395 #endif
whismanoid 0:cb44e2e9ec4c 1396 #ifndef D3
whismanoid 0:cb44e2e9ec4c 1397 #define D3 P0_3
whismanoid 0:cb44e2e9ec4c 1398 #endif
whismanoid 0:cb44e2e9ec4c 1399 #ifndef D4
whismanoid 0:cb44e2e9ec4c 1400 #define D4 P0_4
whismanoid 0:cb44e2e9ec4c 1401 #endif
whismanoid 0:cb44e2e9ec4c 1402 #ifndef D5
whismanoid 0:cb44e2e9ec4c 1403 #define D5 P0_5
whismanoid 0:cb44e2e9ec4c 1404 #endif
whismanoid 0:cb44e2e9ec4c 1405 #ifndef D6
whismanoid 0:cb44e2e9ec4c 1406 #define D6 P0_6
whismanoid 0:cb44e2e9ec4c 1407 #endif
whismanoid 0:cb44e2e9ec4c 1408 #ifndef D7
whismanoid 0:cb44e2e9ec4c 1409 #define D7 P0_7
whismanoid 0:cb44e2e9ec4c 1410 #endif
whismanoid 0:cb44e2e9ec4c 1411 #ifndef D8
whismanoid 0:cb44e2e9ec4c 1412 #define D8 P1_4
whismanoid 0:cb44e2e9ec4c 1413 #endif
whismanoid 0:cb44e2e9ec4c 1414 #ifndef D9
whismanoid 0:cb44e2e9ec4c 1415 #define D9 P1_5
whismanoid 0:cb44e2e9ec4c 1416 #endif
whismanoid 0:cb44e2e9ec4c 1417 #ifndef D10
whismanoid 0:cb44e2e9ec4c 1418 #define D10 P1_3
whismanoid 0:cb44e2e9ec4c 1419 #endif
whismanoid 0:cb44e2e9ec4c 1420 #ifndef D11
whismanoid 0:cb44e2e9ec4c 1421 #define D11 P1_1
whismanoid 0:cb44e2e9ec4c 1422 #endif
whismanoid 0:cb44e2e9ec4c 1423 #ifndef D12
whismanoid 0:cb44e2e9ec4c 1424 #define D12 P1_2
whismanoid 0:cb44e2e9ec4c 1425 #endif
whismanoid 0:cb44e2e9ec4c 1426 #ifndef D13
whismanoid 0:cb44e2e9ec4c 1427 #define D13 P1_0
whismanoid 0:cb44e2e9ec4c 1428 #endif
whismanoid 0:cb44e2e9ec4c 1429 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1430 #elif defined(TARGET_MAX32600)
whismanoid 0:cb44e2e9ec4c 1431 // target MAX32600
whismanoid 0:cb44e2e9ec4c 1432 //
whismanoid 0:cb44e2e9ec4c 1433 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:cb44e2e9ec4c 1434 const float ADC_FULL_SCALE_VOLTAGE = 1.500;
whismanoid 0:cb44e2e9ec4c 1435 //
whismanoid 0:cb44e2e9ec4c 1436 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1437 #elif defined(TARGET_MAX32620FTHR)
whismanoid 0:cb44e2e9ec4c 1438 #warning "TARGET_MAX32620FTHR not previously tested; need to define pins..."
whismanoid 0:cb44e2e9ec4c 1439 #include "MAX32620FTHR.h"
whismanoid 0:cb44e2e9ec4c 1440 // Initialize I/O voltages on MAX32620FTHR board
whismanoid 0:cb44e2e9ec4c 1441 MAX32620FTHR fthr(MAX32620FTHR::VIO_3V3);
whismanoid 0:cb44e2e9ec4c 1442 //#define USE_LEDS 0 ?
whismanoid 0:cb44e2e9ec4c 1443 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1444 #warning "TARGET_MAX32620FTHR not previously tested; need to verify ADC_FULL_SCALE_VOLTAGE..."
whismanoid 0:cb44e2e9ec4c 1445 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 0:cb44e2e9ec4c 1446 //
whismanoid 0:cb44e2e9ec4c 1447 //--------------------------------------------------
whismanoid 19:5ff09c8e9daf 1448 #elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 15:37c83ec50ea0 1449 // #warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
whismanoid 0:cb44e2e9ec4c 1450 #include "max32625pico.h"
whismanoid 0:cb44e2e9ec4c 1451 // configure MAX32625PICO VDDIOH mode, and I/O voltages for DIP pins and SWD pins
whismanoid 0:cb44e2e9ec4c 1452 MAX32625PICO pico(
whismanoid 13:184a08909405 1453 // Select source of higher-voltage logic high supply VDDIOH
whismanoid 0:cb44e2e9ec4c 1454 // vddioh_mode_t iohMode
whismanoid 0:cb44e2e9ec4c 1455 //~ MAX32625PICO::IOH_OFF, // No connections to VDDIOH
whismanoid 0:cb44e2e9ec4c 1456 //~ MAX32625PICO::IOH_DIP_IN, // VDDIOH input from DIP pin 1 (AIN0)
whismanoid 0:cb44e2e9ec4c 1457 //~ MAX32625PICO::IOH_SWD_IN, // VDDIOH input from SWD pin 1
whismanoid 0:cb44e2e9ec4c 1458 MAX32625PICO::IOH_3V3, // VDDIOH = 3.3V from local supply
whismanoid 0:cb44e2e9ec4c 1459 //~ MAX32625PICO::IOH_DIP_OUT, // VDDIOH = 3.3V output to DIP pin 1
whismanoid 0:cb44e2e9ec4c 1460 //~ MAX32625PICO::IOH_SWD_OUT, // VDDIOH = 3.3V output to SWD pin 1
whismanoid 0:cb44e2e9ec4c 1461 //
whismanoid 13:184a08909405 1462 // Digital I/O pin logic high voltage 1.8V or 3.3V
whismanoid 0:cb44e2e9ec4c 1463 // vio_t dipVio = MAX32625PICO::VIO_1V8 or MAX32625PICO::VIO_IOH
whismanoid 13:184a08909405 1464 MAX32625PICO::VIO_1V8, // 1.8V IO (local)
whismanoid 13:184a08909405 1465 //~ MAX32625PICO::VIO_IOH, // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V)
whismanoid 0:cb44e2e9ec4c 1466 //
whismanoid 13:184a08909405 1467 // Software Debug logic high voltage (normally use VIO_IOH)
whismanoid 0:cb44e2e9ec4c 1468 // vio_t swdVio
whismanoid 0:cb44e2e9ec4c 1469 //~ MAX32625PICO::VIO_1V8 // 1.8V IO (local)
whismanoid 0:cb44e2e9ec4c 1470 MAX32625PICO::VIO_IOH // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V)
whismanoid 0:cb44e2e9ec4c 1471 );
whismanoid 0:cb44e2e9ec4c 1472 //#define USE_LEDS 0 ?
whismanoid 0:cb44e2e9ec4c 1473 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 15:37c83ec50ea0 1474 // #warning "TARGET_MAX32625PICO not previously tested; need to verify ADC_FULL_SCALE_VOLTAGE..."
whismanoid 0:cb44e2e9ec4c 1475 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 0:cb44e2e9ec4c 1476 //
whismanoid 0:cb44e2e9ec4c 1477 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1478 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 1479 // TODO1: target NUCLEO_F446RE
whismanoid 0:cb44e2e9ec4c 1480 //
whismanoid 0:cb44e2e9ec4c 1481 // USER_BUTTON PC13
whismanoid 0:cb44e2e9ec4c 1482 // LED1 is shared with SPI_SCK on NUCLEO_F446RE PA_5, so don't use LED1.
whismanoid 0:cb44e2e9ec4c 1483 #define USE_LEDS 0
whismanoid 0:cb44e2e9ec4c 1484 // SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK);
whismanoid 0:cb44e2e9ec4c 1485 // Serial serial(SERIAL_TX, SERIAL_RX);
whismanoid 0:cb44e2e9ec4c 1486 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:cb44e2e9ec4c 1487 const float ADC_FULL_SCALE_VOLTAGE = 3.300; // TODO: ADC_FULL_SCALE_VOLTAGE Pico?
whismanoid 0:cb44e2e9ec4c 1488 //
whismanoid 0:cb44e2e9ec4c 1489 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1490 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 1491 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1492 // TARGET=LPC1768 ARM Cortex-M3 100 MHz 512kB flash 64kB SRAM
whismanoid 0:cb44e2e9ec4c 1493 // +-------------[microUSB]-------------+
whismanoid 0:cb44e2e9ec4c 1494 // ______ | [ ] GND +3.3V VOUT [ ] | ______
whismanoid 0:cb44e2e9ec4c 1495 // ______ | [ ] 4.5V<VIN<9.0V +5.0V VU [ ] | ______
whismanoid 0:cb44e2e9ec4c 1496 // ______ | [ ] VB USB.IF- [ ] | ______
whismanoid 0:cb44e2e9ec4c 1497 // ______ | [ ] nR USB.IF+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 1498 // digitalInOut0 | [ ] p5 MOSI ETHERNET.RD- [ ] | ______
whismanoid 0:cb44e2e9ec4c 1499 // digitalInOut1 | [ ] p6 MISO ETHERNET.RD+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 1500 // digitalInOut2 | [ ] p7 SCLK ETHERNET.TD- [ ] | ______
whismanoid 0:cb44e2e9ec4c 1501 // digitalInOut3 | [ ] p8 ETHERNET.TD+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 1502 // digitalInOut4 | [ ] p9 TX SDA USB.D- [ ] | ______
whismanoid 0:cb44e2e9ec4c 1503 // digitalInOut5 | [ ] p10 RX SCL USB.D+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 1504 // digitalInOut6 | [ ] p11 MOSI CAN-RD p30 [ ] | digitalInOut13
whismanoid 0:cb44e2e9ec4c 1505 // digitalInOut7 | [ ] p12 MISO CAN-TD p29 [ ] | digitalInOut12
whismanoid 0:cb44e2e9ec4c 1506 // digitalInOut8 | [ ] p13 TX SCLK SDA TX p28 [ ] | digitalInOut11
whismanoid 0:cb44e2e9ec4c 1507 // digitalInOut9 | [ ] p14 RX SCL RX p27 [ ] | digitalInOut10
whismanoid 0:cb44e2e9ec4c 1508 // analogIn0 | [ ] p15 AIN0 3.3Vfs PWM1 p26 [ ] | pwmDriver1
whismanoid 0:cb44e2e9ec4c 1509 // analogIn1 | [ ] p16 AIN1 3.3Vfs PWM2 p25 [ ] | pwmDriver2
whismanoid 0:cb44e2e9ec4c 1510 // analogIn2 | [ ] p17 AIN2 3.3Vfs PWM3 p24 [ ] | pwmDriver3
whismanoid 0:cb44e2e9ec4c 1511 // analogIn3 | [ ] p18 AIN3 AOUT PWM4 p23 [ ] | pwmDriver4
whismanoid 0:cb44e2e9ec4c 1512 // analogIn4 | [ ] p19 AIN4 3.3Vfs PWM5 p22 [ ] | pwmDriver5
whismanoid 0:cb44e2e9ec4c 1513 // analogIn5 | [ ] p20 AIN5 3.3Vfs PWM6 p21 [ ] | pwmDriver6
whismanoid 0:cb44e2e9ec4c 1514 // +------------------------------------+
whismanoid 0:cb44e2e9ec4c 1515 // AIN6 = P0.3 = TGT_SBL_RXD?
whismanoid 0:cb44e2e9ec4c 1516 // AIN7 = P0.2 = TGT_SBL_TXD?
whismanoid 0:cb44e2e9ec4c 1517 //
whismanoid 0:cb44e2e9ec4c 1518 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1519 // LPC1768 board uses VREF = 3.300V +A3,3V thru L1 to bypass capacitor C14
whismanoid 0:cb44e2e9ec4c 1520 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:cb44e2e9ec4c 1521 const float ADC_FULL_SCALE_VOLTAGE = 3.300;
whismanoid 0:cb44e2e9ec4c 1522 #else // not defined(TARGET_LPC1768 etc.)
whismanoid 0:cb44e2e9ec4c 1523 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1524 // unknown target
whismanoid 0:cb44e2e9ec4c 1525 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1526 #endif // target definition
whismanoid 0:cb44e2e9ec4c 1527
whismanoid 0:cb44e2e9ec4c 1528
whismanoid 0:cb44e2e9ec4c 1529
whismanoid 0:cb44e2e9ec4c 1530
whismanoid 18:1235c17b451e 1531 // support LEDs as digital pins 91 92 93; WIP button as digital pin 90
whismanoid 18:1235c17b451e 1532 // move definiton of USE_LEDS earlier than find_digitalInOutPin()
whismanoid 18:1235c17b451e 1533 //--------------------------------------------------
whismanoid 18:1235c17b451e 1534 // Option to use LEDs to show status
whismanoid 18:1235c17b451e 1535 #ifndef USE_LEDS
whismanoid 18:1235c17b451e 1536 #define USE_LEDS 1
whismanoid 18:1235c17b451e 1537 #endif
whismanoid 18:1235c17b451e 1538 #if USE_LEDS
whismanoid 18:1235c17b451e 1539 #if defined(TARGET_MAX32630)
whismanoid 18:1235c17b451e 1540 # define LED_ON 0
whismanoid 18:1235c17b451e 1541 # define LED_OFF 1
whismanoid 18:1235c17b451e 1542 //--------------------------------------------------
whismanoid 18:1235c17b451e 1543 #elif defined(TARGET_MAX32625MBED)
whismanoid 18:1235c17b451e 1544 # define LED_ON 0
whismanoid 18:1235c17b451e 1545 # define LED_OFF 1
whismanoid 19:5ff09c8e9daf 1546 #elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 18:1235c17b451e 1547 # define LED_ON 0
whismanoid 18:1235c17b451e 1548 # define LED_OFF 1
whismanoid 18:1235c17b451e 1549 //--------------------------------------------------
whismanoid 18:1235c17b451e 1550 // TODO1: TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 18:1235c17b451e 1551 #elif defined(TARGET_LPC1768)
whismanoid 18:1235c17b451e 1552 # define LED_ON 1
whismanoid 18:1235c17b451e 1553 # define LED_OFF 0
whismanoid 18:1235c17b451e 1554 #else // not defined(TARGET_LPC1768 etc.)
whismanoid 18:1235c17b451e 1555 // USE_LEDS with some platform other than MAX32630, MAX32625MBED, LPC1768
whismanoid 18:1235c17b451e 1556 // bugfix for MAX32600MBED LED blink pattern: check if LED_ON/LED_OFF already defined
whismanoid 18:1235c17b451e 1557 # ifndef LED_ON
whismanoid 18:1235c17b451e 1558 # define LED_ON 0
whismanoid 18:1235c17b451e 1559 # endif
whismanoid 18:1235c17b451e 1560 # ifndef LED_OFF
whismanoid 18:1235c17b451e 1561 # define LED_OFF 1
whismanoid 18:1235c17b451e 1562 # endif
whismanoid 18:1235c17b451e 1563 //# define LED_ON 1
whismanoid 18:1235c17b451e 1564 //# define LED_OFF 0
whismanoid 18:1235c17b451e 1565 #endif // target definition
whismanoid 18:1235c17b451e 1566 // support LEDs as digital pins 91 92 93; WIP button as digital pin 90
whismanoid 18:1235c17b451e 1567 // support find_digitalInOutPin(91) return DigitalInOut of led1_RFailLED
whismanoid 18:1235c17b451e 1568 // support find_digitalInOutPin(92) return DigitalInOut of led2_GPassLED
whismanoid 18:1235c17b451e 1569 // support find_digitalInOutPin(93) return DigitalInOut of led3_BBusyLED
whismanoid 18:1235c17b451e 1570 // change led1/2/3/4 from DigitalOut to DigitalInOut
whismanoid 18:1235c17b451e 1571 DigitalInOut led1(LED1, PIN_INPUT, PullUp, LED_OFF); // MAX32630FTHR: LED1 = LED_RED
whismanoid 18:1235c17b451e 1572 DigitalInOut led2(LED2, PIN_INPUT, PullUp, LED_OFF); // MAX32630FTHR: LED2 = LED_GREEN
whismanoid 18:1235c17b451e 1573 DigitalInOut led3(LED3, PIN_INPUT, PullUp, LED_OFF); // MAX32630FTHR: LED3 = LED_BLUE
whismanoid 18:1235c17b451e 1574 DigitalInOut led4(LED4, PIN_INPUT, PullUp, LED_OFF);
whismanoid 18:1235c17b451e 1575 #else // USE_LEDS=0
whismanoid 18:1235c17b451e 1576 // issue #41 support Nucleo_F446RE
whismanoid 18:1235c17b451e 1577 // there are no LED indicators on the board, LED1 interferes with SPI;
whismanoid 18:1235c17b451e 1578 // but we still need placeholders led1 led2 led3 led4.
whismanoid 18:1235c17b451e 1579 // Declare DigitalInOut led1 led2 led3 led4 targeting safe pins.
whismanoid 18:1235c17b451e 1580 // PinName NC means NOT_CONNECTED; DigitalOut::is_connected() returns false
whismanoid 18:1235c17b451e 1581 # define LED_ON 0
whismanoid 18:1235c17b451e 1582 # define LED_OFF 1
whismanoid 18:1235c17b451e 1583 // change led1/2/3/4 from DigitalOut to DigitalInOut
whismanoid 18:1235c17b451e 1584 DigitalInOut led1(NC, PIN_INPUT, PullUp, LED_OFF);
whismanoid 18:1235c17b451e 1585 DigitalInOut led2(NC, PIN_INPUT, PullUp, LED_OFF);
whismanoid 18:1235c17b451e 1586 DigitalInOut led3(NC, PIN_INPUT, PullUp, LED_OFF);
whismanoid 18:1235c17b451e 1587 DigitalInOut led4(NC, PIN_INPUT, PullUp, LED_OFF);
whismanoid 18:1235c17b451e 1588 #endif // USE_LEDS
whismanoid 18:1235c17b451e 1589 #define led1_RFailLED led1
whismanoid 18:1235c17b451e 1590 #define led2_GPassLED led2
whismanoid 18:1235c17b451e 1591 #define led3_BBusyLED led3
whismanoid 18:1235c17b451e 1592
whismanoid 21:ac062a97a71d 1593 //--------------------------------------------------
whismanoid 21:ac062a97a71d 1594 // use BUTTON1 trigger some action
whismanoid 46:469d0061df5d 1595 // support for commands %B1! .. %B9!
whismanoid 21:ac062a97a71d 1596 #if defined(TARGET_MAX32630)
whismanoid 21:ac062a97a71d 1597 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 21:ac062a97a71d 1598 #define HAS_BUTTON2_DEMO 0
whismanoid 21:ac062a97a71d 1599 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 21:ac062a97a71d 1600 #elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 25:8a61cb34191d 1601 // #warning "TARGET_MAX32625PICO not previously tested; need to define buttons..."
whismanoid 21:ac062a97a71d 1602 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 24:032f3683cb2a 1603 #if MAX40108_DEMO
whismanoid 25:8a61cb34191d 1604 #if HAS_I2C
whismanoid 25:8a61cb34191d 1605 // MAX40108DEMOP2U9 HAS_I2C: J91.1=1V8 J91.2=P1_6(SDA) J91.3=P1_7(SCL) J91.4=GND
whismanoid 25:8a61cb34191d 1606 // MAX40108DEMOP2U9 HAS_I2C: move button2/button3 to inaccessible pins P3_6 and P3_7 if we need J91 for I2C
whismanoid 24:032f3683cb2a 1607 #define BUTTON2 P3_7
whismanoid 25:8a61cb34191d 1608 #else // HAS_I2C
whismanoid 25:8a61cb34191d 1609 // MAX40108DEMOP2U9 no HAS_I2C: option using J91 for button2 and button3 instead of I2C
whismanoid 25:8a61cb34191d 1610 // MAX40108DEMOP2U9 no HAS_I2C: header J91.1=1V8 J91.2=P1_6(button3/'%B3!') J91.3=P1_7(button2/'%B2!') J91.4=GND
whismanoid 25:8a61cb34191d 1611 // MAX40108DEMOP2U9 no HAS_I2C: avoid conflict between digital pins D16 D17 and button2/button3
whismanoid 25:8a61cb34191d 1612 #define BUTTON2 P1_7
whismanoid 25:8a61cb34191d 1613 #endif // HAS_I2C
whismanoid 24:032f3683cb2a 1614 #define HAS_BUTTON2_DEMO 0
whismanoid 24:032f3683cb2a 1615 #define HAS_BUTTON2_DEMO_INTERRUPT 1
whismanoid 25:8a61cb34191d 1616 #if HAS_I2C
whismanoid 25:8a61cb34191d 1617 // MAX40108DEMOP2U9 HAS_I2C: J91.1=1V8 J91.2=P1_6(SDA) J91.3=P1_7(SCL) J91.4=GND
whismanoid 25:8a61cb34191d 1618 // MAX40108DEMOP2U9 HAS_I2C: move button2/button3 to inaccessible pins P3_6 and P3_7 if we need J91 for I2C
whismanoid 24:032f3683cb2a 1619 #define BUTTON3 P3_6
whismanoid 25:8a61cb34191d 1620 #else // HAS_I2C
whismanoid 25:8a61cb34191d 1621 // MAX40108DEMOP2U9 no HAS_I2C: option using J91 for button2 and button3 instead of I2C
whismanoid 25:8a61cb34191d 1622 // MAX40108DEMOP2U9 no HAS_I2C: header J91.1=1V8 J91.2=P1_6(button3/'%B3!') J91.3=P1_7(button2/'%B2!') J91.4=GND
whismanoid 25:8a61cb34191d 1623 // MAX40108DEMOP2U9 no HAS_I2C: avoid conflict between digital pins D16 D17 and button2/button3
whismanoid 25:8a61cb34191d 1624 #define BUTTON3 P1_6
whismanoid 25:8a61cb34191d 1625 #endif // HAS_I2C
whismanoid 24:032f3683cb2a 1626 #define HAS_BUTTON3_DEMO 0
whismanoid 24:032f3683cb2a 1627 #define HAS_BUTTON3_DEMO_INTERRUPT 1
whismanoid 29:6a9edb6e973b 1628 // additional buttons are assigned to unused/unaccessible pins to avoid conflicts
whismanoid 29:6a9edb6e973b 1629 // activate using %B4! or action_button pin=4
whismanoid 29:6a9edb6e973b 1630 #define BUTTON4 P1_5
whismanoid 29:6a9edb6e973b 1631 #define HAS_BUTTON4_DEMO_INTERRUPT 1
whismanoid 29:6a9edb6e973b 1632 #define BUTTON5 P1_4
whismanoid 29:6a9edb6e973b 1633 #define HAS_BUTTON5_DEMO_INTERRUPT 1
whismanoid 29:6a9edb6e973b 1634 #define BUTTON6 P1_3
whismanoid 29:6a9edb6e973b 1635 #define HAS_BUTTON6_DEMO_INTERRUPT 1
whismanoid 29:6a9edb6e973b 1636 #define BUTTON7 P1_2
whismanoid 29:6a9edb6e973b 1637 #define HAS_BUTTON7_DEMO_INTERRUPT 1
whismanoid 29:6a9edb6e973b 1638 #define BUTTON8 P1_1
whismanoid 29:6a9edb6e973b 1639 #define HAS_BUTTON8_DEMO_INTERRUPT 1
whismanoid 29:6a9edb6e973b 1640 #define BUTTON9 P1_0
whismanoid 29:6a9edb6e973b 1641 #define HAS_BUTTON9_DEMO_INTERRUPT 1
whismanoid 24:032f3683cb2a 1642 #else // MAX40108_DEMO
whismanoid 21:ac062a97a71d 1643 #define HAS_BUTTON2_DEMO 0
whismanoid 21:ac062a97a71d 1644 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 29:6a9edb6e973b 1645 #endif // MAX40108_DEMO ---------------------------------
whismanoid 21:ac062a97a71d 1646 #elif defined(TARGET_MAX32625)
whismanoid 21:ac062a97a71d 1647 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 21:ac062a97a71d 1648 #define HAS_BUTTON2_DEMO_INTERRUPT 1
whismanoid 21:ac062a97a71d 1649 #elif defined(TARGET_MAX32620FTHR)
whismanoid 21:ac062a97a71d 1650 #warning "TARGET_MAX32620FTHR not previously tested; need to define buttons..."
whismanoid 21:ac062a97a71d 1651 #define BUTTON1 SW1
whismanoid 21:ac062a97a71d 1652 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 21:ac062a97a71d 1653 #define HAS_BUTTON2_DEMO 0
whismanoid 21:ac062a97a71d 1654 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 21:ac062a97a71d 1655 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 21:ac062a97a71d 1656 #define HAS_BUTTON1_DEMO_INTERRUPT 0
whismanoid 21:ac062a97a71d 1657 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 21:ac062a97a71d 1658 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 21:ac062a97a71d 1659 #define HAS_BUTTON1_DEMO_INTERRUPT 0
whismanoid 21:ac062a97a71d 1660 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 21:ac062a97a71d 1661 #else
whismanoid 21:ac062a97a71d 1662 #warning "target not previously tested; need to define buttons..."
whismanoid 21:ac062a97a71d 1663 #endif
whismanoid 21:ac062a97a71d 1664 //
whismanoid 21:ac062a97a71d 1665 #ifndef HAS_BUTTON1_DEMO
whismanoid 21:ac062a97a71d 1666 #define HAS_BUTTON1_DEMO 0
whismanoid 21:ac062a97a71d 1667 #endif
whismanoid 21:ac062a97a71d 1668 #ifndef HAS_BUTTON2_DEMO
whismanoid 21:ac062a97a71d 1669 #define HAS_BUTTON2_DEMO 0
whismanoid 21:ac062a97a71d 1670 #endif
whismanoid 24:032f3683cb2a 1671 #ifndef HAS_BUTTON3_DEMO
whismanoid 24:032f3683cb2a 1672 #define HAS_BUTTON3_DEMO 0
whismanoid 24:032f3683cb2a 1673 #endif
whismanoid 21:ac062a97a71d 1674 //
whismanoid 21:ac062a97a71d 1675 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 21:ac062a97a71d 1676 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 21:ac062a97a71d 1677 #ifndef HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 21:ac062a97a71d 1678 #define HAS_BUTTON1_DEMO_INTERRUPT_POLLING 1
whismanoid 21:ac062a97a71d 1679 #endif
whismanoid 21:ac062a97a71d 1680 //
whismanoid 21:ac062a97a71d 1681 #ifndef HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 1682 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 21:ac062a97a71d 1683 #endif
whismanoid 21:ac062a97a71d 1684 #ifndef HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 1685 #define HAS_BUTTON2_DEMO_INTERRUPT 1
whismanoid 21:ac062a97a71d 1686 #endif
whismanoid 21:ac062a97a71d 1687 //
whismanoid 21:ac062a97a71d 1688 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 1689 # if HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 21:ac062a97a71d 1690 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 21:ac062a97a71d 1691 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 21:ac062a97a71d 1692 DigitalIn button1(BUTTON1);
whismanoid 21:ac062a97a71d 1693 # else
whismanoid 21:ac062a97a71d 1694 InterruptIn button1(BUTTON1);
whismanoid 21:ac062a97a71d 1695 # endif
whismanoid 21:ac062a97a71d 1696 #elif HAS_BUTTON1_DEMO
whismanoid 21:ac062a97a71d 1697 DigitalIn button1(BUTTON1);
whismanoid 21:ac062a97a71d 1698 #endif
whismanoid 21:ac062a97a71d 1699 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 1700 # if HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 21:ac062a97a71d 1701 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 21:ac062a97a71d 1702 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 21:ac062a97a71d 1703 DigitalIn button2(BUTTON2);
whismanoid 21:ac062a97a71d 1704 # else
whismanoid 21:ac062a97a71d 1705 InterruptIn button2(BUTTON2);
whismanoid 21:ac062a97a71d 1706 # endif
whismanoid 21:ac062a97a71d 1707 #elif HAS_BUTTON2_DEMO
whismanoid 21:ac062a97a71d 1708 DigitalIn button2(BUTTON2);
whismanoid 21:ac062a97a71d 1709 #endif
whismanoid 24:032f3683cb2a 1710 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 1711 # if HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 24:032f3683cb2a 1712 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 24:032f3683cb2a 1713 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 24:032f3683cb2a 1714 DigitalIn button3(BUTTON3);
whismanoid 24:032f3683cb2a 1715 # else
whismanoid 24:032f3683cb2a 1716 InterruptIn button3(BUTTON3);
whismanoid 24:032f3683cb2a 1717 # endif
whismanoid 24:032f3683cb2a 1718 #elif HAS_BUTTON3_DEMO
whismanoid 24:032f3683cb2a 1719 DigitalIn button3(BUTTON3);
whismanoid 24:032f3683cb2a 1720 #endif
whismanoid 21:ac062a97a71d 1721
whismanoid 0:cb44e2e9ec4c 1722 // uncrustify-0.66.1 *INDENT-OFF*
whismanoid 0:cb44e2e9ec4c 1723 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1724 // Declare the DigitalInOut GPIO pins
whismanoid 0:cb44e2e9ec4c 1725 // Optional digitalInOut support. If there is only one it should be digitalInOut1.
whismanoid 0:cb44e2e9ec4c 1726 // D) Digital High/Low/Input Pin
whismanoid 0:cb44e2e9ec4c 1727 #if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 1728 // +-------------[microUSB]-------------+
whismanoid 0:cb44e2e9ec4c 1729 // | J1 MAX32630FTHR J2 |
whismanoid 0:cb44e2e9ec4c 1730 // | [ ] RST GND [ ] |
whismanoid 0:cb44e2e9ec4c 1731 // | [ ] 3V3 BAT+[ ] |
whismanoid 0:cb44e2e9ec4c 1732 // | [ ] 1V8 reset SW1 |
whismanoid 0:cb44e2e9ec4c 1733 // | [ ] GND J4 J3 |
whismanoid 0:cb44e2e9ec4c 1734 // | [ ] AIN_0 1.2Vfs (bat) SYS [ ] |
whismanoid 0:cb44e2e9ec4c 1735 // | [ ] AIN_1 1.2Vfs PWR [ ] |
whismanoid 0:cb44e2e9ec4c 1736 // | [ ] AIN_2 1.2Vfs +5V VBUS [ ] |
whismanoid 0:cb44e2e9ec4c 1737 // | [ ] AIN_3 1.2Vfs 1-WIRE P4_0 [ ] | dig9
whismanoid 0:cb44e2e9ec4c 1738 // dig10 | [x] P5_7 SDA2 SRN P5_6 [ ] | dig8
whismanoid 0:cb44e2e9ec4c 1739 // dig11 | [x] P6_0 SCL2 SDIO3 P5_5 [ ] | dig7
whismanoid 0:cb44e2e9ec4c 1740 // dig12 | [x] P5_0 SCLK SDIO2 P5_4 [ ] | dig6
whismanoid 0:cb44e2e9ec4c 1741 // dig13 | [x] P5_1 MOSI SSEL P5_3 [x] | dig5
whismanoid 0:cb44e2e9ec4c 1742 // dig14 | [ ] P5_2 MISO RTS P3_3 [ ] | dig4
whismanoid 0:cb44e2e9ec4c 1743 // dig15 | [ ] P3_0 RX CTS P3_2 [ ] | dig3
whismanoid 0:cb44e2e9ec4c 1744 // dig0 | [ ] P3_1 TX SCL P3_5 [x] | dig2
whismanoid 0:cb44e2e9ec4c 1745 // | [ ] GND SDA P3_4 [x] | dig1
whismanoid 0:cb44e2e9ec4c 1746 // +------------------------------------+
whismanoid 0:cb44e2e9ec4c 1747 #define HAS_digitalInOut0 1 // P3_1 TARGET_MAX32630 J1.15
whismanoid 0:cb44e2e9ec4c 1748 #define HAS_digitalInOut1 1 // P3_4 TARGET_MAX32630 J3.12
whismanoid 0:cb44e2e9ec4c 1749 #define HAS_digitalInOut2 1 // P3_5 TARGET_MAX32630 J3.11
whismanoid 0:cb44e2e9ec4c 1750 #define HAS_digitalInOut3 1 // P3_2 TARGET_MAX32630 J3.10
whismanoid 0:cb44e2e9ec4c 1751 #define HAS_digitalInOut4 1 // P3_3 TARGET_MAX32630 J3.9
whismanoid 0:cb44e2e9ec4c 1752 #define HAS_digitalInOut5 1 // P5_3 TARGET_MAX32630 J3.8
whismanoid 0:cb44e2e9ec4c 1753 #define HAS_digitalInOut6 1 // P5_4 TARGET_MAX32630 J3.7
whismanoid 0:cb44e2e9ec4c 1754 #define HAS_digitalInOut7 1 // P5_5 TARGET_MAX32630 J3.6
whismanoid 0:cb44e2e9ec4c 1755 #define HAS_digitalInOut8 1 // P5_6 TARGET_MAX32630 J3.5
whismanoid 0:cb44e2e9ec4c 1756 #define HAS_digitalInOut9 1 // P4_0 TARGET_MAX32630 J3.4
whismanoid 0:cb44e2e9ec4c 1757 #if HAS_I2C
whismanoid 0:cb44e2e9ec4c 1758 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:cb44e2e9ec4c 1759 #define HAS_digitalInOut10 0 // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:cb44e2e9ec4c 1760 #define HAS_digitalInOut11 0 // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:cb44e2e9ec4c 1761 #else // HAS_I2C
whismanoid 0:cb44e2e9ec4c 1762 #define HAS_digitalInOut10 1 // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:cb44e2e9ec4c 1763 #define HAS_digitalInOut11 1 // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:cb44e2e9ec4c 1764 #endif // HAS_I2C
whismanoid 0:cb44e2e9ec4c 1765 #if HAS_SPI
whismanoid 0:cb44e2e9ec4c 1766 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 1767 #define HAS_digitalInOut12 0 // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:cb44e2e9ec4c 1768 #define HAS_digitalInOut13 0 // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:cb44e2e9ec4c 1769 #define HAS_digitalInOut14 0 // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:cb44e2e9ec4c 1770 #define HAS_digitalInOut15 0 // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:cb44e2e9ec4c 1771 #else // HAS_SPI
whismanoid 0:cb44e2e9ec4c 1772 #define HAS_digitalInOut12 1 // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:cb44e2e9ec4c 1773 #define HAS_digitalInOut13 1 // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:cb44e2e9ec4c 1774 #define HAS_digitalInOut14 1 // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:cb44e2e9ec4c 1775 #define HAS_digitalInOut15 1 // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:cb44e2e9ec4c 1776 #endif // HAS_SPI
whismanoid 0:cb44e2e9ec4c 1777 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 1778 DigitalInOut digitalInOut0(P3_1, PIN_INPUT, PullUp, 1); // P3_1 TARGET_MAX32630 J1.15
whismanoid 0:cb44e2e9ec4c 1779 #endif
whismanoid 0:cb44e2e9ec4c 1780 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 1781 DigitalInOut digitalInOut1(P3_4, PIN_INPUT, PullUp, 1); // P3_4 TARGET_MAX32630 J3.12
whismanoid 0:cb44e2e9ec4c 1782 #endif
whismanoid 0:cb44e2e9ec4c 1783 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 1784 DigitalInOut digitalInOut2(P3_5, PIN_INPUT, PullUp, 1); // P3_5 TARGET_MAX32630 J3.11
whismanoid 0:cb44e2e9ec4c 1785 #endif
whismanoid 0:cb44e2e9ec4c 1786 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 1787 DigitalInOut digitalInOut3(P3_2, PIN_INPUT, PullUp, 1); // P3_2 TARGET_MAX32630 J3.10
whismanoid 0:cb44e2e9ec4c 1788 #endif
whismanoid 0:cb44e2e9ec4c 1789 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 1790 DigitalInOut digitalInOut4(P3_3, PIN_INPUT, PullUp, 1); // P3_3 TARGET_MAX32630 J3.9
whismanoid 0:cb44e2e9ec4c 1791 #endif
whismanoid 0:cb44e2e9ec4c 1792 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 1793 DigitalInOut digitalInOut5(P5_3, PIN_INPUT, PullUp, 1); // P5_3 TARGET_MAX32630 J3.8
whismanoid 0:cb44e2e9ec4c 1794 #endif
whismanoid 0:cb44e2e9ec4c 1795 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 1796 DigitalInOut digitalInOut6(P5_4, PIN_INPUT, PullUp, 1); // P5_4 TARGET_MAX32630 J3.7
whismanoid 0:cb44e2e9ec4c 1797 #endif
whismanoid 0:cb44e2e9ec4c 1798 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 1799 DigitalInOut digitalInOut7(P5_5, PIN_INPUT, PullUp, 1); // P5_5 TARGET_MAX32630 J3.6
whismanoid 0:cb44e2e9ec4c 1800 #endif
whismanoid 0:cb44e2e9ec4c 1801 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 1802 DigitalInOut digitalInOut8(P5_6, PIN_INPUT, PullUp, 1); // P5_6 TARGET_MAX32630 J3.5
whismanoid 0:cb44e2e9ec4c 1803 #endif
whismanoid 0:cb44e2e9ec4c 1804 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 1805 DigitalInOut digitalInOut9(P4_0, PIN_INPUT, PullUp, 1); // P4_0 TARGET_MAX32630 J3.4
whismanoid 0:cb44e2e9ec4c 1806 #endif
whismanoid 0:cb44e2e9ec4c 1807 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 1808 DigitalInOut digitalInOut10(P5_7, PIN_INPUT, PullUp, 1); // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:cb44e2e9ec4c 1809 #endif
whismanoid 0:cb44e2e9ec4c 1810 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 1811 DigitalInOut digitalInOut11(P6_0, PIN_INPUT, PullUp, 1); // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:cb44e2e9ec4c 1812 #endif
whismanoid 0:cb44e2e9ec4c 1813 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 1814 DigitalInOut digitalInOut12(P5_0, PIN_INPUT, PullUp, 1); // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:cb44e2e9ec4c 1815 #endif
whismanoid 0:cb44e2e9ec4c 1816 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 1817 DigitalInOut digitalInOut13(P5_1, PIN_INPUT, PullUp, 1); // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:cb44e2e9ec4c 1818 #endif
whismanoid 0:cb44e2e9ec4c 1819 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 1820 DigitalInOut digitalInOut14(P5_2, PIN_INPUT, PullUp, 1); // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:cb44e2e9ec4c 1821 #endif
whismanoid 0:cb44e2e9ec4c 1822 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 1823 DigitalInOut digitalInOut15(P3_0, PIN_INPUT, PullUp, 1); // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:cb44e2e9ec4c 1824 #endif
whismanoid 0:cb44e2e9ec4c 1825 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1826 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 1827 // TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:cb44e2e9ec4c 1828 // +-------------------------------------+
whismanoid 0:cb44e2e9ec4c 1829 // | MAX32625MBED Arduino UNO header |
whismanoid 0:cb44e2e9ec4c 1830 // | |
whismanoid 0:cb44e2e9ec4c 1831 // | A5/SCL[ ] | P1_7 dig15
whismanoid 0:cb44e2e9ec4c 1832 // | A4/SDA[ ] | P1_6 dig14
whismanoid 0:cb44e2e9ec4c 1833 // | AREF=N/C[ ] |
whismanoid 0:cb44e2e9ec4c 1834 // | GND[ ] |
whismanoid 0:cb44e2e9ec4c 1835 // | [ ]N/C SCK/13[ ] | P1_0 dig13
whismanoid 0:cb44e2e9ec4c 1836 // | [ ]IOREF=3V3 MISO/12[ ] | P1_2 dig12
whismanoid 0:cb44e2e9ec4c 1837 // | [ ]RST MOSI/11[ ]~| P1_1 dig11
whismanoid 0:cb44e2e9ec4c 1838 // | [ ]3V3 CS/10[ ]~| P1_3 dig10
whismanoid 0:cb44e2e9ec4c 1839 // | [ ]5V0 9[ ]~| P1_5 dig9
whismanoid 0:cb44e2e9ec4c 1840 // | [ ]GND 8[ ] | P1_4 dig8
whismanoid 0:cb44e2e9ec4c 1841 // | [ ]GND |
whismanoid 0:cb44e2e9ec4c 1842 // | [ ]Vin 7[ ] | P0_7 dig7
whismanoid 0:cb44e2e9ec4c 1843 // | 6[ ]~| P0_6 dig6
whismanoid 0:cb44e2e9ec4c 1844 // AIN_0 | [ ]A0 5[ ]~| P0_5 dig5
whismanoid 0:cb44e2e9ec4c 1845 // AIN_1 | [ ]A1 4[ ] | P0_4 dig4
whismanoid 0:cb44e2e9ec4c 1846 // AIN_2 | [ ]A2 INT1/3[ ]~| P0_3 dig3
whismanoid 0:cb44e2e9ec4c 1847 // AIN_3 | [ ]A3 INT0/2[ ] | P0_2 dig2
whismanoid 0:cb44e2e9ec4c 1848 // dig16 P3_4 | [ ]A4/SDA RST SCK MISO TX>1[ ] | P0_1 dig1
whismanoid 0:cb44e2e9ec4c 1849 // dig17 P3_5 | [ ]A5/SCL [ ] [ ] [ ] RX<0[ ] | P0_0 dig0
whismanoid 0:cb44e2e9ec4c 1850 // | [ ] [ ] [ ] |
whismanoid 0:cb44e2e9ec4c 1851 // | UNO_R3 GND MOSI 5V ____________/
whismanoid 0:cb44e2e9ec4c 1852 // \_______________________/
whismanoid 0:cb44e2e9ec4c 1853 //
whismanoid 0:cb44e2e9ec4c 1854 #define HAS_digitalInOut0 1 // P0_0 TARGET_MAX32625MBED D0
whismanoid 0:cb44e2e9ec4c 1855 #define HAS_digitalInOut1 1 // P0_1 TARGET_MAX32625MBED D1
whismanoid 0:cb44e2e9ec4c 1856 #if APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 1857 #define HAS_digitalInOut2 0 // P0_2 TARGET_MAX32625MBED D2 -- MAX11131 EOC DigitalIn
whismanoid 0:cb44e2e9ec4c 1858 #else
whismanoid 0:cb44e2e9ec4c 1859 #define HAS_digitalInOut2 1 // P0_2 TARGET_MAX32625MBED D2
whismanoid 0:cb44e2e9ec4c 1860 #endif
whismanoid 0:cb44e2e9ec4c 1861 #define HAS_digitalInOut3 1 // P0_3 TARGET_MAX32625MBED D3
whismanoid 0:cb44e2e9ec4c 1862 #define HAS_digitalInOut4 1 // P0_4 TARGET_MAX32625MBED D4
whismanoid 0:cb44e2e9ec4c 1863 #define HAS_digitalInOut5 1 // P0_5 TARGET_MAX32625MBED D5
whismanoid 0:cb44e2e9ec4c 1864 #define HAS_digitalInOut6 1 // P0_6 TARGET_MAX32625MBED D6
whismanoid 0:cb44e2e9ec4c 1865 #define HAS_digitalInOut7 1 // P0_7 TARGET_MAX32625MBED D7
whismanoid 0:cb44e2e9ec4c 1866 #define HAS_digitalInOut8 1 // P1_4 TARGET_MAX32625MBED D8
whismanoid 0:cb44e2e9ec4c 1867 #if APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 1868 #define HAS_digitalInOut9 0 // P1_5 TARGET_MAX32625MBED D9 -- MAX11131 CNVST DigitalOut
whismanoid 0:cb44e2e9ec4c 1869 #else
whismanoid 0:cb44e2e9ec4c 1870 #define HAS_digitalInOut9 1 // P1_5 TARGET_MAX32625MBED D9
whismanoid 0:cb44e2e9ec4c 1871 #endif
whismanoid 0:cb44e2e9ec4c 1872 #if HAS_SPI
whismanoid 0:cb44e2e9ec4c 1873 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 1874 #define HAS_digitalInOut10 0 // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:cb44e2e9ec4c 1875 #define HAS_digitalInOut11 0 // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:cb44e2e9ec4c 1876 #define HAS_digitalInOut12 0 // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:cb44e2e9ec4c 1877 #define HAS_digitalInOut13 0 // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:cb44e2e9ec4c 1878 #else // HAS_SPI
whismanoid 0:cb44e2e9ec4c 1879 #define HAS_digitalInOut10 1 // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:cb44e2e9ec4c 1880 #define HAS_digitalInOut11 1 // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:cb44e2e9ec4c 1881 #define HAS_digitalInOut12 1 // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:cb44e2e9ec4c 1882 #define HAS_digitalInOut13 1 // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:cb44e2e9ec4c 1883 #endif // HAS_SPI
whismanoid 0:cb44e2e9ec4c 1884 #if HAS_I2C
whismanoid 0:cb44e2e9ec4c 1885 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:cb44e2e9ec4c 1886 #define HAS_digitalInOut14 0 // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 1887 #define HAS_digitalInOut15 0 // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 1888 #define HAS_digitalInOut16 0 // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 1889 #define HAS_digitalInOut17 0 // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 1890 #else // HAS_I2C
whismanoid 0:cb44e2e9ec4c 1891 #define HAS_digitalInOut14 1 // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 1892 #define HAS_digitalInOut15 1 // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 1893 #define HAS_digitalInOut16 1 // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 1894 #define HAS_digitalInOut17 1 // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 1895 #endif // HAS_I2C
whismanoid 0:cb44e2e9ec4c 1896 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 1897 DigitalInOut digitalInOut0(P0_0, PIN_INPUT, PullUp, 1); // P0_0 TARGET_MAX32625MBED D0
whismanoid 0:cb44e2e9ec4c 1898 #endif
whismanoid 0:cb44e2e9ec4c 1899 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 1900 DigitalInOut digitalInOut1(P0_1, PIN_INPUT, PullUp, 1); // P0_1 TARGET_MAX32625MBED D1
whismanoid 0:cb44e2e9ec4c 1901 #endif
whismanoid 0:cb44e2e9ec4c 1902 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 1903 DigitalInOut digitalInOut2(P0_2, PIN_INPUT, PullUp, 1); // P0_2 TARGET_MAX32625MBED D2
whismanoid 0:cb44e2e9ec4c 1904 #endif
whismanoid 0:cb44e2e9ec4c 1905 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 1906 DigitalInOut digitalInOut3(P0_3, PIN_INPUT, PullUp, 1); // P0_3 TARGET_MAX32625MBED D3
whismanoid 0:cb44e2e9ec4c 1907 #endif
whismanoid 0:cb44e2e9ec4c 1908 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 1909 DigitalInOut digitalInOut4(P0_4, PIN_INPUT, PullUp, 1); // P0_4 TARGET_MAX32625MBED D4
whismanoid 0:cb44e2e9ec4c 1910 #endif
whismanoid 0:cb44e2e9ec4c 1911 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 1912 DigitalInOut digitalInOut5(P0_5, PIN_INPUT, PullUp, 1); // P0_5 TARGET_MAX32625MBED D5
whismanoid 0:cb44e2e9ec4c 1913 #endif
whismanoid 0:cb44e2e9ec4c 1914 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 1915 DigitalInOut digitalInOut6(P0_6, PIN_INPUT, PullUp, 1); // P0_6 TARGET_MAX32625MBED D6
whismanoid 0:cb44e2e9ec4c 1916 #endif
whismanoid 0:cb44e2e9ec4c 1917 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 1918 DigitalInOut digitalInOut7(P0_7, PIN_INPUT, PullUp, 1); // P0_7 TARGET_MAX32625MBED D7
whismanoid 0:cb44e2e9ec4c 1919 #endif
whismanoid 0:cb44e2e9ec4c 1920 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 1921 DigitalInOut digitalInOut8(P1_4, PIN_INPUT, PullUp, 1); // P1_4 TARGET_MAX32625MBED D8
whismanoid 0:cb44e2e9ec4c 1922 #endif
whismanoid 0:cb44e2e9ec4c 1923 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 1924 DigitalInOut digitalInOut9(P1_5, PIN_INPUT, PullUp, 1); // P1_5 TARGET_MAX32625MBED D9
whismanoid 0:cb44e2e9ec4c 1925 #endif
whismanoid 0:cb44e2e9ec4c 1926 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 1927 DigitalInOut digitalInOut10(P1_3, PIN_INPUT, PullUp, 1); // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:cb44e2e9ec4c 1928 #endif
whismanoid 0:cb44e2e9ec4c 1929 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 1930 DigitalInOut digitalInOut11(P1_1, PIN_INPUT, PullUp, 1); // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:cb44e2e9ec4c 1931 #endif
whismanoid 0:cb44e2e9ec4c 1932 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 1933 DigitalInOut digitalInOut12(P1_2, PIN_INPUT, PullUp, 1); // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:cb44e2e9ec4c 1934 #endif
whismanoid 0:cb44e2e9ec4c 1935 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 1936 DigitalInOut digitalInOut13(P1_0, PIN_INPUT, PullUp, 1); // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:cb44e2e9ec4c 1937 #endif
whismanoid 0:cb44e2e9ec4c 1938 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 1939 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 1940 // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain
whismanoid 0:cb44e2e9ec4c 1941 DigitalInOut digitalInOut14(P1_6, PIN_INPUT, OpenDrain, 1); // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 1942 #endif
whismanoid 0:cb44e2e9ec4c 1943 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 1944 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 1945 DigitalInOut digitalInOut15(P1_7, PIN_INPUT, OpenDrain, 1); // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 1946 #endif
whismanoid 0:cb44e2e9ec4c 1947 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 1948 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 1949 // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain
whismanoid 0:cb44e2e9ec4c 1950 // PullUp-->3.4V, PullDown-->1.7V, PullNone-->3.5V, OpenDrain-->0.00V
whismanoid 0:cb44e2e9ec4c 1951 DigitalInOut digitalInOut16(P3_4, PIN_INPUT, OpenDrain, 0); // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 1952 #endif
whismanoid 0:cb44e2e9ec4c 1953 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 1954 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 1955 DigitalInOut digitalInOut17(P3_5, PIN_INPUT, OpenDrain, 0); // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 1956 #endif
whismanoid 0:cb44e2e9ec4c 1957 //--------------------------------------------------
whismanoid 19:5ff09c8e9daf 1958 #elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 15:37c83ec50ea0 1959 // TARGET=MAX32625PICO ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 15:37c83ec50ea0 1960 // +-------------[microUSB]-------------+
whismanoid 15:37c83ec50ea0 1961 // | [27]D+ D-[26] |
whismanoid 15:37c83ec50ea0 1962 // | |
whismanoid 15:37c83ec50ea0 1963 // | [BUTTON P2_7] |
whismanoid 15:37c83ec50ea0 1964 // | P2_4 LED_R P2_5 LED_G P2_6 LED_B |
whismanoid 15:37c83ec50ea0 1965 // | |
whismanoid 15:37c83ec50ea0 1966 // 1V8 | [11] 1.8V MAX32625PICO GND [10] | GND
whismanoid 15:37c83ec50ea0 1967 // 3V3 | [12] 3.3V +5V [09] | 5V0
whismanoid 15:37c83ec50ea0 1968 // SPI CS D7 | [13] P0_7 CS s-ssel P4_7 [08] | D15
whismanoid 15:37c83ec50ea0 1969 // SPI MISO D6 | [14] P0_6 MISO s-miso P4_6 [07] | D14
whismanoid 15:37c83ec50ea0 1970 // SPI MOSI D5 | [15] P0_5 MOSI s-mosi P4_5 [06] | D13
whismanoid 15:37c83ec50ea0 1971 // SPI SCLK D4 | [16] P0_4 SCLK s-sclk P4_4 [05] | D12
whismanoid 15:37c83ec50ea0 1972 // D3 | [17] P0_3 RTS SCL P1_7 [04] | SCL/D17
whismanoid 15:37c83ec50ea0 1973 // D2 | [18] P0_2 CTS SDA P1_6 [03] | SDA/D16
whismanoid 15:37c83ec50ea0 1974 // TX/D1 | [19] P0_1 TX0 AIN_2 [02] | A2
whismanoid 15:37c83ec50ea0 1975 // RX/D0 | [20] P0_0 RX0 AIN_0 [01] | A0/A4
whismanoid 15:37c83ec50ea0 1976 // | |
whismanoid 15:37c83ec50ea0 1977 // | DAPLINK |
whismanoid 15:37c83ec50ea0 1978 // | J3 p3_3 p3_2 p3_0 p3_1 p3_7 |
whismanoid 15:37c83ec50ea0 1979 // | DAP [ ] [ ] [RX2][TX2][ ] |
whismanoid 15:37c83ec50ea0 1980 // | TOP [ ] [ ] [ ] [ ] [ ] |
whismanoid 15:37c83ec50ea0 1981 // | AIN1/A5 gnd gnd nc AIN3 |
whismanoid 15:37c83ec50ea0 1982 // | IOH 1-wire |
whismanoid 15:37c83ec50ea0 1983 // | |
whismanoid 15:37c83ec50ea0 1984 // |NO USE RST P2_0 P2_1 |
whismanoid 15:37c83ec50ea0 1985 // |BOTTOM [ ] [ ] [RX1][ ] [TX1] |
whismanoid 15:37c83ec50ea0 1986 // | RST SWC GND SWD 1V8 |
whismanoid 15:37c83ec50ea0 1987 // |BOTTOM [21] [22] [23] [24] [25] |
whismanoid 15:37c83ec50ea0 1988 // +------------------------------------+
whismanoid 15:37c83ec50ea0 1989 #if MAX40108_DEMO
whismanoid 15:37c83ec50ea0 1990 // MAX40108 demo p2: D0..D7 = P0_0..P0_7; D8..15 = P4_0..P4_7; D16/D17=I2C
whismanoid 15:37c83ec50ea0 1991 #endif
whismanoid 15:37c83ec50ea0 1992 // AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 15:37c83ec50ea0 1993 // AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 15:37c83ec50ea0 1994 // AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 15:37c83ec50ea0 1995 // AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 15:37c83ec50ea0 1996 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 15:37c83ec50ea0 1997 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 15:37c83ec50ea0 1998 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 15:37c83ec50ea0 1999 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 15:37c83ec50ea0 2000 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 15:37c83ec50ea0 2001 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 15:37c83ec50ea0 2002 // AIN_10 = x undefined?
whismanoid 15:37c83ec50ea0 2003 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 15:37c83ec50ea0 2004 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 15:37c83ec50ea0 2005 //
whismanoid 15:37c83ec50ea0 2006 #if MAX40108_DEMO
whismanoid 15:37c83ec50ea0 2007 // avoid resource conflict D0,D1 alternate function as RX/TX
whismanoid 15:37c83ec50ea0 2008 #define HAS_digitalInOut0 0
whismanoid 15:37c83ec50ea0 2009 #define HAS_digitalInOut1 0
whismanoid 15:37c83ec50ea0 2010 #else
whismanoid 15:37c83ec50ea0 2011 #define HAS_digitalInOut0 1
whismanoid 19:5ff09c8e9daf 2012 #define HAS_digitalInOut1 1
whismanoid 19:5ff09c8e9daf 2013 // P0_1 TARGET_MAX32625PICO D1
whismanoid 15:37c83ec50ea0 2014 #endif
whismanoid 15:37c83ec50ea0 2015 #if APPLICATION_MAX11131
whismanoid 15:37c83ec50ea0 2016 // avoid resource conflict D2 alternate function as interrupt input
whismanoid 15:37c83ec50ea0 2017 #define HAS_digitalInOut2 0
whismanoid 15:37c83ec50ea0 2018 #else
whismanoid 15:37c83ec50ea0 2019 #define HAS_digitalInOut2 1
whismanoid 15:37c83ec50ea0 2020 #endif
whismanoid 15:37c83ec50ea0 2021 #define HAS_digitalInOut3 1
whismanoid 15:37c83ec50ea0 2022 #define HAS_digitalInOut4 1
whismanoid 15:37c83ec50ea0 2023 #define HAS_digitalInOut5 1
whismanoid 15:37c83ec50ea0 2024 #define HAS_digitalInOut6 1
whismanoid 15:37c83ec50ea0 2025 #define HAS_digitalInOut7 1
whismanoid 15:37c83ec50ea0 2026 //
whismanoid 15:37c83ec50ea0 2027 #define HAS_digitalInOut8 1
whismanoid 15:37c83ec50ea0 2028 #define HAS_digitalInOut9 1
whismanoid 15:37c83ec50ea0 2029 #define HAS_digitalInOut10 1
whismanoid 15:37c83ec50ea0 2030 #define HAS_digitalInOut11 1
whismanoid 15:37c83ec50ea0 2031 #define HAS_digitalInOut12 1
whismanoid 15:37c83ec50ea0 2032 #define HAS_digitalInOut13 1
whismanoid 15:37c83ec50ea0 2033 #define HAS_digitalInOut14 1
whismanoid 15:37c83ec50ea0 2034 #define HAS_digitalInOut15 1
whismanoid 15:37c83ec50ea0 2035 #if HAS_I2C
whismanoid 25:8a61cb34191d 2036 // MAX40108DEMOP2U9 HAS_I2C: J91.1=1V8 J91.2=P1_6(SDA) J91.3=P1_7(SCL) J91.4=GND
whismanoid 25:8a61cb34191d 2037 // MAX40108DEMOP2U9 HAS_I2C: move button2/button3 to inaccessible pins P3_6 and P3_7 if we need J91 for I2C
whismanoid 25:8a61cb34191d 2038 // #define BUTTON2 P3_7
whismanoid 25:8a61cb34191d 2039 // avoid resource conflict between I2C and DigitalInOut
whismanoid 25:8a61cb34191d 2040 #define HAS_digitalInOut16 0 // P1_6 TARGET_MAX40108DEMOP2U9 J91.2=P1_6(button3/'%B3!'/SDA)
whismanoid 25:8a61cb34191d 2041 #define HAS_digitalInOut17 0 // P1_7 TARGET_MAX40108DEMOP2U9 J91.3=P1_7(button2/'%B2!'/SCL)
whismanoid 15:37c83ec50ea0 2042 #else // HAS_I2C
whismanoid 25:8a61cb34191d 2043 // MAX40108DEMOP2U9 no HAS_I2C: option using J91 for button2 and button3 instead of I2C
whismanoid 25:8a61cb34191d 2044 // MAX40108DEMOP2U9 no HAS_I2C: header J91.1=1V8 J91.2=P1_6(button3/'%B3!') J91.3=P1_7(button2/'%B2!') J91.4=GND
whismanoid 25:8a61cb34191d 2045 // MAX40108DEMOP2U9 no HAS_I2C: avoid conflict between digital pins D16 D17 and button2/button3
whismanoid 25:8a61cb34191d 2046 // #define BUTTON2 P1_7
whismanoid 25:8a61cb34191d 2047 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 25:8a61cb34191d 2048 // MAX40108DEMOP2U9 avoid conflict between digital pins D16 D17 and button2/button3
whismanoid 25:8a61cb34191d 2049 #define HAS_digitalInOut16 0 // P1_6 TARGET_MAX40108DEMOP2U9 J91.2=P1_6(button3/'%B3!'/SDA)
whismanoid 25:8a61cb34191d 2050 #else // HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 25:8a61cb34191d 2051 #define HAS_digitalInOut16 1 // P1_6 TARGET_MAX40108DEMOP2U9 J91.2=P1_6(button3/'%B3!'/SDA)
whismanoid 25:8a61cb34191d 2052 #endif // HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 25:8a61cb34191d 2053 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 25:8a61cb34191d 2054 // MAX40108DEMOP2U9 avoid conflict between digital pins D16 D17 and button2/button3
whismanoid 25:8a61cb34191d 2055 #define HAS_digitalInOut17 0 // P1_7 TARGET_MAX40108DEMOP2U9 J91.3=P1_7(button2/'%B2!'/SCL)
whismanoid 25:8a61cb34191d 2056 #else // HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 25:8a61cb34191d 2057 #define HAS_digitalInOut17 1 // P1_7 TARGET_MAX40108DEMOP2U9 J91.3=P1_7(button2/'%B2!'/SCL)
whismanoid 25:8a61cb34191d 2058 #endif // HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 15:37c83ec50ea0 2059 #endif // HAS_I2C
whismanoid 15:37c83ec50ea0 2060 #if HAS_digitalInOut0
whismanoid 25:8a61cb34191d 2061 DigitalInOut digitalInOut0(P0_0, PIN_INPUT, PullUp, 1); // P0_0 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D0
whismanoid 15:37c83ec50ea0 2062 #endif
whismanoid 15:37c83ec50ea0 2063 #if HAS_digitalInOut1
whismanoid 25:8a61cb34191d 2064 DigitalInOut digitalInOut1(P0_1, PIN_INPUT, PullUp, 1); // P0_1 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D1
whismanoid 15:37c83ec50ea0 2065 #endif
whismanoid 15:37c83ec50ea0 2066 #if HAS_digitalInOut2
whismanoid 25:8a61cb34191d 2067 DigitalInOut digitalInOut2(P0_2, PIN_INPUT, PullUp, 1); // P0_2 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D2
whismanoid 15:37c83ec50ea0 2068 #endif
whismanoid 15:37c83ec50ea0 2069 #if HAS_digitalInOut3
whismanoid 25:8a61cb34191d 2070 DigitalInOut digitalInOut3(P0_3, PIN_INPUT, PullUp, 1); // P0_3 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D3
whismanoid 15:37c83ec50ea0 2071 #endif
whismanoid 15:37c83ec50ea0 2072 #if HAS_digitalInOut4
whismanoid 25:8a61cb34191d 2073 DigitalInOut digitalInOut4(P0_4, PIN_INPUT, PullUp, 1); // P0_4 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D4
whismanoid 15:37c83ec50ea0 2074 #endif
whismanoid 15:37c83ec50ea0 2075 #if HAS_digitalInOut5
whismanoid 25:8a61cb34191d 2076 DigitalInOut digitalInOut5(P0_5, PIN_INPUT, PullUp, 1); // P0_5 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D5
whismanoid 15:37c83ec50ea0 2077 #endif
whismanoid 15:37c83ec50ea0 2078 #if HAS_digitalInOut6
whismanoid 25:8a61cb34191d 2079 DigitalInOut digitalInOut6(P0_6, PIN_INPUT, PullUp, 1); // P0_6 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D6
whismanoid 15:37c83ec50ea0 2080 #endif
whismanoid 15:37c83ec50ea0 2081 #if HAS_digitalInOut7
whismanoid 25:8a61cb34191d 2082 DigitalInOut digitalInOut7(P0_7, PIN_INPUT, PullUp, 1); // P0_7 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D7
whismanoid 15:37c83ec50ea0 2083 #endif
whismanoid 15:37c83ec50ea0 2084 #if HAS_digitalInOut8
whismanoid 25:8a61cb34191d 2085 DigitalInOut digitalInOut8(P4_0, PIN_INPUT, PullUp, 1); // P4_0 TARGET_MAX40108DEMOP2U9 D8
whismanoid 15:37c83ec50ea0 2086 #endif
whismanoid 15:37c83ec50ea0 2087 #if HAS_digitalInOut9
whismanoid 25:8a61cb34191d 2088 DigitalInOut digitalInOut9(P4_1, PIN_INPUT, PullUp, 1); // P4_1 TARGET_MAX40108DEMOP2U9 D9
whismanoid 15:37c83ec50ea0 2089 #endif
whismanoid 15:37c83ec50ea0 2090 #if HAS_digitalInOut10
whismanoid 25:8a61cb34191d 2091 DigitalInOut digitalInOut10(P4_2, PIN_INPUT, PullUp, 1); // P4_2 TARGET_MAX40108DEMOP2U9 D10
whismanoid 15:37c83ec50ea0 2092 #endif
whismanoid 15:37c83ec50ea0 2093 #if HAS_digitalInOut11
whismanoid 25:8a61cb34191d 2094 DigitalInOut digitalInOut11(P4_3, PIN_INPUT, PullUp, 1); // P4_3 TARGET_MAX40108DEMOP2U9 D11
whismanoid 15:37c83ec50ea0 2095 #endif
whismanoid 15:37c83ec50ea0 2096 #if HAS_digitalInOut12
whismanoid 25:8a61cb34191d 2097 DigitalInOut digitalInOut12(P4_4, PIN_INPUT, PullUp, 1); // P4_4 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D12
whismanoid 15:37c83ec50ea0 2098 #endif
whismanoid 15:37c83ec50ea0 2099 #if HAS_digitalInOut13
whismanoid 25:8a61cb34191d 2100 DigitalInOut digitalInOut13(P4_5, PIN_INPUT, PullUp, 1); // P4_5 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D13
whismanoid 15:37c83ec50ea0 2101 #endif
whismanoid 15:37c83ec50ea0 2102 #if HAS_digitalInOut14
whismanoid 25:8a61cb34191d 2103 DigitalInOut digitalInOut14(P4_6, PIN_INPUT, PullUp, 1); // P4_6 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D14
whismanoid 15:37c83ec50ea0 2104 #endif
whismanoid 15:37c83ec50ea0 2105 #if HAS_digitalInOut15
whismanoid 25:8a61cb34191d 2106 DigitalInOut digitalInOut15(P4_7, PIN_INPUT, PullUp, 1); // P4_7 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D15
whismanoid 15:37c83ec50ea0 2107 #endif
whismanoid 15:37c83ec50ea0 2108 #if HAS_digitalInOut16
whismanoid 15:37c83ec50ea0 2109 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 15:37c83ec50ea0 2110 // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain
whismanoid 25:8a61cb34191d 2111 DigitalInOut digitalInOut16(P1_6, PIN_INPUT, OpenDrain, 1); // P1_6 TARGET_MAX40108DEMOP2U9 J91.2=P1_6(button3/'%B3!'/SDA)
whismanoid 15:37c83ec50ea0 2112 #endif
whismanoid 15:37c83ec50ea0 2113 #if HAS_digitalInOut17
whismanoid 15:37c83ec50ea0 2114 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 25:8a61cb34191d 2115 DigitalInOut digitalInOut17(P1_7, PIN_INPUT, OpenDrain, 1); // P1_7 TARGET_MAX40108DEMOP2U9 J91.3=P1_7(button2/'%B2!'/SCL)
whismanoid 15:37c83ec50ea0 2116 #endif
whismanoid 15:37c83ec50ea0 2117 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2118 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 2119 #define HAS_digitalInOut0 0
whismanoid 0:cb44e2e9ec4c 2120 #define HAS_digitalInOut1 0
whismanoid 0:cb44e2e9ec4c 2121 #if APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 2122 // D2 -- MAX11131 EOC DigitalIn
whismanoid 0:cb44e2e9ec4c 2123 #define HAS_digitalInOut2 0
whismanoid 0:cb44e2e9ec4c 2124 #else
whismanoid 0:cb44e2e9ec4c 2125 #define HAS_digitalInOut2 1
whismanoid 0:cb44e2e9ec4c 2126 #endif
whismanoid 0:cb44e2e9ec4c 2127 #define HAS_digitalInOut3 1
whismanoid 0:cb44e2e9ec4c 2128 #define HAS_digitalInOut4 1
whismanoid 0:cb44e2e9ec4c 2129 #define HAS_digitalInOut5 1
whismanoid 0:cb44e2e9ec4c 2130 #define HAS_digitalInOut6 1
whismanoid 0:cb44e2e9ec4c 2131 #define HAS_digitalInOut7 1
whismanoid 0:cb44e2e9ec4c 2132 #if APPLICATION_MAX5715
whismanoid 0:cb44e2e9ec4c 2133 // D8 -- MAX5715 CLRb DigitalOut
whismanoid 0:cb44e2e9ec4c 2134 #define HAS_digitalInOut8 0
whismanoid 0:cb44e2e9ec4c 2135 #else
whismanoid 0:cb44e2e9ec4c 2136 #define HAS_digitalInOut8 1
whismanoid 0:cb44e2e9ec4c 2137 #endif
whismanoid 0:cb44e2e9ec4c 2138 #if APPLICATION_MAX5715
whismanoid 0:cb44e2e9ec4c 2139 // D9 -- MAX5715 LDACb DigitalOut
whismanoid 0:cb44e2e9ec4c 2140 #define HAS_digitalInOut9 0
whismanoid 0:cb44e2e9ec4c 2141 #elif APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 2142 // D9 -- MAX11131 CNVST DigitalOut
whismanoid 0:cb44e2e9ec4c 2143 #define HAS_digitalInOut9 0
whismanoid 0:cb44e2e9ec4c 2144 #else
whismanoid 0:cb44e2e9ec4c 2145 #define HAS_digitalInOut9 1
whismanoid 0:cb44e2e9ec4c 2146 #endif
whismanoid 0:cb44e2e9ec4c 2147 #if HAS_SPI
whismanoid 0:cb44e2e9ec4c 2148 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 2149 // Arduino digital pin D10 SPI function is CS/10
whismanoid 0:cb44e2e9ec4c 2150 // Arduino digital pin D11 SPI function is MOSI/11
whismanoid 0:cb44e2e9ec4c 2151 // Arduino digital pin D12 SPI function is MISO/12
whismanoid 0:cb44e2e9ec4c 2152 // Arduino digital pin D13 SPI function is SCK/13
whismanoid 0:cb44e2e9ec4c 2153 #define HAS_digitalInOut10 0
whismanoid 0:cb44e2e9ec4c 2154 #define HAS_digitalInOut11 0
whismanoid 0:cb44e2e9ec4c 2155 #define HAS_digitalInOut12 0
whismanoid 0:cb44e2e9ec4c 2156 #define HAS_digitalInOut13 0
whismanoid 0:cb44e2e9ec4c 2157 #else // HAS_SPI
whismanoid 0:cb44e2e9ec4c 2158 #define HAS_digitalInOut10 1
whismanoid 0:cb44e2e9ec4c 2159 #define HAS_digitalInOut11 1
whismanoid 0:cb44e2e9ec4c 2160 #define HAS_digitalInOut12 1
whismanoid 0:cb44e2e9ec4c 2161 #define HAS_digitalInOut13 1
whismanoid 0:cb44e2e9ec4c 2162 #endif // HAS_SPI
whismanoid 0:cb44e2e9ec4c 2163 #if HAS_I2C
whismanoid 0:cb44e2e9ec4c 2164 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:cb44e2e9ec4c 2165 // Arduino digital pin D14 I2C function is A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 2166 // Arduino digital pin D15 I2C function is A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 2167 // Arduino digital pin D16 I2C function is A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 2168 // Arduino digital pin D17 I2C function is A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 2169 #define HAS_digitalInOut14 0
whismanoid 0:cb44e2e9ec4c 2170 #define HAS_digitalInOut15 0
whismanoid 0:cb44e2e9ec4c 2171 #define HAS_digitalInOut16 0
whismanoid 0:cb44e2e9ec4c 2172 #define HAS_digitalInOut17 0
whismanoid 0:cb44e2e9ec4c 2173 #else // HAS_I2C
whismanoid 0:cb44e2e9ec4c 2174 #define HAS_digitalInOut14 1
whismanoid 0:cb44e2e9ec4c 2175 #define HAS_digitalInOut15 1
whismanoid 0:cb44e2e9ec4c 2176 #define HAS_digitalInOut16 0
whismanoid 0:cb44e2e9ec4c 2177 #define HAS_digitalInOut17 0
whismanoid 0:cb44e2e9ec4c 2178 #endif // HAS_I2C
whismanoid 0:cb44e2e9ec4c 2179 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 2180 DigitalInOut digitalInOut0(D0, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2181 #endif
whismanoid 0:cb44e2e9ec4c 2182 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 2183 DigitalInOut digitalInOut1(D1, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2184 #endif
whismanoid 0:cb44e2e9ec4c 2185 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 2186 DigitalInOut digitalInOut2(D2, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2187 #endif
whismanoid 0:cb44e2e9ec4c 2188 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 2189 DigitalInOut digitalInOut3(D3, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2190 #endif
whismanoid 0:cb44e2e9ec4c 2191 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 2192 DigitalInOut digitalInOut4(D4, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2193 #endif
whismanoid 0:cb44e2e9ec4c 2194 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 2195 DigitalInOut digitalInOut5(D5, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2196 #endif
whismanoid 0:cb44e2e9ec4c 2197 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 2198 DigitalInOut digitalInOut6(D6, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2199 #endif
whismanoid 0:cb44e2e9ec4c 2200 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 2201 DigitalInOut digitalInOut7(D7, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2202 #endif
whismanoid 0:cb44e2e9ec4c 2203 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 2204 DigitalInOut digitalInOut8(D8, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2205 #endif
whismanoid 0:cb44e2e9ec4c 2206 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 2207 DigitalInOut digitalInOut9(D9, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2208 #endif
whismanoid 0:cb44e2e9ec4c 2209 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 2210 // Arduino digital pin D10 SPI function is CS/10
whismanoid 0:cb44e2e9ec4c 2211 DigitalInOut digitalInOut10(D10, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2212 #endif
whismanoid 0:cb44e2e9ec4c 2213 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 2214 // Arduino digital pin D11 SPI function is MOSI/11
whismanoid 0:cb44e2e9ec4c 2215 DigitalInOut digitalInOut11(D11, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2216 #endif
whismanoid 0:cb44e2e9ec4c 2217 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 2218 // Arduino digital pin D12 SPI function is MISO/12
whismanoid 0:cb44e2e9ec4c 2219 DigitalInOut digitalInOut12(D12, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2220 #endif
whismanoid 0:cb44e2e9ec4c 2221 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 2222 // Arduino digital pin D13 SPI function is SCK/13
whismanoid 0:cb44e2e9ec4c 2223 DigitalInOut digitalInOut13(D13, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2224 #endif
whismanoid 0:cb44e2e9ec4c 2225 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 2226 // Arduino digital pin D14 I2C function is A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 2227 DigitalInOut digitalInOut14(D14, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2228 #endif
whismanoid 0:cb44e2e9ec4c 2229 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 2230 // Arduino digital pin D15 I2C function is A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 2231 DigitalInOut digitalInOut15(D15, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2232 #endif
whismanoid 0:cb44e2e9ec4c 2233 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 2234 // Arduino digital pin D16 I2C function is A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 2235 DigitalInOut digitalInOut16(D16, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2236 #endif
whismanoid 0:cb44e2e9ec4c 2237 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 2238 // Arduino digital pin D17 I2C function is A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 2239 DigitalInOut digitalInOut17(D17, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2240 #endif
whismanoid 0:cb44e2e9ec4c 2241 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2242 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 2243 #define HAS_digitalInOut0 1
whismanoid 0:cb44e2e9ec4c 2244 #define HAS_digitalInOut1 1
whismanoid 0:cb44e2e9ec4c 2245 #define HAS_digitalInOut2 1
whismanoid 0:cb44e2e9ec4c 2246 #define HAS_digitalInOut3 1
whismanoid 0:cb44e2e9ec4c 2247 #define HAS_digitalInOut4 1
whismanoid 0:cb44e2e9ec4c 2248 #define HAS_digitalInOut5 1
whismanoid 0:cb44e2e9ec4c 2249 #define HAS_digitalInOut6 1
whismanoid 0:cb44e2e9ec4c 2250 #define HAS_digitalInOut7 1
whismanoid 0:cb44e2e9ec4c 2251 #define HAS_digitalInOut8 1
whismanoid 0:cb44e2e9ec4c 2252 #define HAS_digitalInOut9 1
whismanoid 0:cb44e2e9ec4c 2253 // #define HAS_digitalInOut10 1
whismanoid 0:cb44e2e9ec4c 2254 // #define HAS_digitalInOut11 1
whismanoid 0:cb44e2e9ec4c 2255 // #define HAS_digitalInOut12 1
whismanoid 0:cb44e2e9ec4c 2256 // #define HAS_digitalInOut13 1
whismanoid 0:cb44e2e9ec4c 2257 // #define HAS_digitalInOut14 1
whismanoid 0:cb44e2e9ec4c 2258 // #define HAS_digitalInOut15 1
whismanoid 0:cb44e2e9ec4c 2259 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 2260 DigitalInOut digitalInOut0(p5, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.9/I2STX_SDA/MOSI1/MAT2.3
whismanoid 0:cb44e2e9ec4c 2261 #endif
whismanoid 0:cb44e2e9ec4c 2262 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 2263 DigitalInOut digitalInOut1(p6, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.8/I2STX_WS/MISO1/MAT2.2
whismanoid 0:cb44e2e9ec4c 2264 #endif
whismanoid 0:cb44e2e9ec4c 2265 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 2266 DigitalInOut digitalInOut2(p7, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.7/I2STX_CLK/SCK1/MAT2.1
whismanoid 0:cb44e2e9ec4c 2267 #endif
whismanoid 0:cb44e2e9ec4c 2268 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 2269 DigitalInOut digitalInOut3(p8, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.6/I2SRX_SDA/SSEL1/MAT2.0
whismanoid 0:cb44e2e9ec4c 2270 #endif
whismanoid 0:cb44e2e9ec4c 2271 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 2272 DigitalInOut digitalInOut4(p9, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.0/CAN_RX1/TXD3/SDA1
whismanoid 0:cb44e2e9ec4c 2273 #endif
whismanoid 0:cb44e2e9ec4c 2274 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 2275 DigitalInOut digitalInOut5(p10, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.1/CAN_TX1/RXD3/SCL1
whismanoid 0:cb44e2e9ec4c 2276 #endif
whismanoid 0:cb44e2e9ec4c 2277 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 2278 DigitalInOut digitalInOut6(p11, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.18/DCD1/MOSI0/MOSI1
whismanoid 0:cb44e2e9ec4c 2279 #endif
whismanoid 0:cb44e2e9ec4c 2280 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 2281 DigitalInOut digitalInOut7(p12, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.17/CTS1/MISO0/MISO
whismanoid 0:cb44e2e9ec4c 2282 #endif
whismanoid 0:cb44e2e9ec4c 2283 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 2284 DigitalInOut digitalInOut8(p13, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.15/TXD1/SCK0/SCK
whismanoid 0:cb44e2e9ec4c 2285 #endif
whismanoid 0:cb44e2e9ec4c 2286 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 2287 DigitalInOut digitalInOut9(p14, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.16/RXD1/SSEL0/SSEL
whismanoid 0:cb44e2e9ec4c 2288 #endif
whismanoid 0:cb44e2e9ec4c 2289 //
whismanoid 0:cb44e2e9ec4c 2290 // these pins support analog input analogIn0 .. analogIn5
whismanoid 0:cb44e2e9ec4c 2291 //DigitalInOut digitalInOut_(p15, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.23/AD0.0/I2SRX_CLK/CAP3.0
whismanoid 0:cb44e2e9ec4c 2292 //DigitalInOut digitalInOut_(p16, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.24/AD0.1/I2SRX_WS/CAP3.1
whismanoid 0:cb44e2e9ec4c 2293 //DigitalInOut digitalInOut_(p17, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.25/AD0.2/I2SRX_SDA/TXD3
whismanoid 0:cb44e2e9ec4c 2294 //DigitalInOut digitalInOut_(p18, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.26/AD0.3/AOUT/RXD3
whismanoid 0:cb44e2e9ec4c 2295 //DigitalInOut digitalInOut_(p19, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P1.30/VBUS/AD0.4
whismanoid 0:cb44e2e9ec4c 2296 //DigitalInOut digitalInOut_(p20, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P1.31/SCK1/AD0.5
whismanoid 0:cb44e2e9ec4c 2297 //
whismanoid 0:cb44e2e9ec4c 2298 // these pins support PWM pwmDriver1 .. pwmDriver6
whismanoid 0:cb44e2e9ec4c 2299 //DigitalInOut digitalInOut_(p21, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.5/PWM1.6/DTR1/TRACEDATA0
whismanoid 0:cb44e2e9ec4c 2300 //DigitalInOut digitalInOut_(p22, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.4/PWM1.5/DSR1/TRACEDATA1
whismanoid 0:cb44e2e9ec4c 2301 //DigitalInOut digitalInOut_(p23, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.3/PWM1.4/DCD1/TRACEDATA2
whismanoid 0:cb44e2e9ec4c 2302 //DigitalInOut digitalInOut_(p24, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.2/PWM1.3/CTS1/TRACEDATA3
whismanoid 0:cb44e2e9ec4c 2303 //DigitalInOut digitalInOut_(p25, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.1/PWM1.2/RXD1
whismanoid 0:cb44e2e9ec4c 2304 //DigitalInOut digitalInOut_(p26, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.0/PWM1.1/TXD1/TRACECLK
whismanoid 0:cb44e2e9ec4c 2305 //
whismanoid 0:cb44e2e9ec4c 2306 // these could be additional digitalInOut pins
whismanoid 0:cb44e2e9ec4c 2307 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 2308 DigitalInOut digitalInOut10(p27, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.11/RXD2/SCL2/MAT3.1
whismanoid 0:cb44e2e9ec4c 2309 #endif
whismanoid 0:cb44e2e9ec4c 2310 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 2311 DigitalInOut digitalInOut11(p28, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.10/TXD2/SDA2/MAT3.0
whismanoid 0:cb44e2e9ec4c 2312 #endif
whismanoid 0:cb44e2e9ec4c 2313 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 2314 DigitalInOut digitalInOut12(p29, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.5/I2SRX_WS/CAN_TX2/CAP2.1
whismanoid 0:cb44e2e9ec4c 2315 #endif
whismanoid 0:cb44e2e9ec4c 2316 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 2317 DigitalInOut digitalInOut13(p30, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.4/I2SRX_CLK/CAN_RX2/CAP2.0
whismanoid 0:cb44e2e9ec4c 2318 #endif
whismanoid 0:cb44e2e9ec4c 2319 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 2320 DigitalInOut digitalInOut14(___, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2321 #endif
whismanoid 0:cb44e2e9ec4c 2322 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 2323 DigitalInOut digitalInOut15(___, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2324 #endif
whismanoid 0:cb44e2e9ec4c 2325 #else
whismanoid 0:cb44e2e9ec4c 2326 // unknown target
whismanoid 0:cb44e2e9ec4c 2327 #endif
whismanoid 0:cb44e2e9ec4c 2328 // uncrustify-0.66.1 *INDENT-ON*
whismanoid 0:cb44e2e9ec4c 2329 #if HAS_digitalInOut0 || HAS_digitalInOut1 \
whismanoid 0:cb44e2e9ec4c 2330 || HAS_digitalInOut2 || HAS_digitalInOut3 \
whismanoid 0:cb44e2e9ec4c 2331 || HAS_digitalInOut4 || HAS_digitalInOut5 \
whismanoid 0:cb44e2e9ec4c 2332 || HAS_digitalInOut6 || HAS_digitalInOut7 \
whismanoid 0:cb44e2e9ec4c 2333 || HAS_digitalInOut8 || HAS_digitalInOut9 \
whismanoid 0:cb44e2e9ec4c 2334 || HAS_digitalInOut10 || HAS_digitalInOut11 \
whismanoid 0:cb44e2e9ec4c 2335 || HAS_digitalInOut12 || HAS_digitalInOut13 \
whismanoid 0:cb44e2e9ec4c 2336 || HAS_digitalInOut14 || HAS_digitalInOut15 \
whismanoid 0:cb44e2e9ec4c 2337 || HAS_digitalInOut16 || HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 2338 #define HAS_digitalInOuts 1
whismanoid 0:cb44e2e9ec4c 2339 #else
whismanoid 0:cb44e2e9ec4c 2340 #warning "Note: There are no digitalInOut resources defined"
whismanoid 0:cb44e2e9ec4c 2341 #endif
whismanoid 0:cb44e2e9ec4c 2342
whismanoid 0:cb44e2e9ec4c 2343 // uncrustify-0.66.1 *INDENT-OFF*
whismanoid 0:cb44e2e9ec4c 2344 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2345 // Declare the AnalogIn driver
whismanoid 0:cb44e2e9ec4c 2346 // Optional analogIn support. If there is only one it should be analogIn1.
whismanoid 0:cb44e2e9ec4c 2347 // A) analog input
whismanoid 0:cb44e2e9ec4c 2348 #if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 2349 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2350 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2351 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2352 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2353 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2354 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2355 #define HAS_analogIn6 1
whismanoid 0:cb44e2e9ec4c 2356 #define HAS_analogIn7 1
whismanoid 0:cb44e2e9ec4c 2357 #define HAS_analogIn8 1
whismanoid 0:cb44e2e9ec4c 2358 #define HAS_analogIn9 1
whismanoid 0:cb44e2e9ec4c 2359 // #define HAS_analogIn10 0
whismanoid 0:cb44e2e9ec4c 2360 // #define HAS_analogIn11 0
whismanoid 0:cb44e2e9ec4c 2361 // #define HAS_analogIn12 0
whismanoid 0:cb44e2e9ec4c 2362 // #define HAS_analogIn13 0
whismanoid 0:cb44e2e9ec4c 2363 // #define HAS_analogIn14 0
whismanoid 0:cb44e2e9ec4c 2364 // #define HAS_analogIn15 0
whismanoid 0:cb44e2e9ec4c 2365 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2366 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2367 #endif
whismanoid 0:cb44e2e9ec4c 2368 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2369 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2370 #endif
whismanoid 0:cb44e2e9ec4c 2371 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2372 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2373 #endif
whismanoid 0:cb44e2e9ec4c 2374 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2375 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2376 #endif
whismanoid 0:cb44e2e9ec4c 2377 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2378 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2379 #endif
whismanoid 0:cb44e2e9ec4c 2380 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2381 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2382 #endif
whismanoid 0:cb44e2e9ec4c 2383 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 2384 AnalogIn analogIn6(AIN_6); // TARGET_MAX32630 AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2385 #endif
whismanoid 0:cb44e2e9ec4c 2386 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 2387 AnalogIn analogIn7(AIN_7); // TARGET_MAX32630 AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2388 #endif
whismanoid 0:cb44e2e9ec4c 2389 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 2390 AnalogIn analogIn8(AIN_8); // TARGET_MAX32630 AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2391 #endif
whismanoid 0:cb44e2e9ec4c 2392 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 2393 AnalogIn analogIn9(AIN_9); // TARGET_MAX32630 AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 2394 #endif
whismanoid 0:cb44e2e9ec4c 2395 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 2396 AnalogIn analogIn10(____); // TARGET_MAX32630 AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 2397 #endif
whismanoid 0:cb44e2e9ec4c 2398 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 2399 AnalogIn analogIn11(____); // TARGET_MAX32630 AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2400 #endif
whismanoid 0:cb44e2e9ec4c 2401 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 2402 AnalogIn analogIn12(____); // TARGET_MAX32630 AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2403 #endif
whismanoid 0:cb44e2e9ec4c 2404 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 2405 AnalogIn analogIn13(____);
whismanoid 0:cb44e2e9ec4c 2406 #endif
whismanoid 0:cb44e2e9ec4c 2407 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 2408 AnalogIn analogIn14(____);
whismanoid 0:cb44e2e9ec4c 2409 #endif
whismanoid 0:cb44e2e9ec4c 2410 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 2411 AnalogIn analogIn15(____);
whismanoid 0:cb44e2e9ec4c 2412 #endif
whismanoid 0:cb44e2e9ec4c 2413 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2414 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 2415 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2416 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2417 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2418 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2419 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2420 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2421 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2422 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2423 #endif
whismanoid 0:cb44e2e9ec4c 2424 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2425 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2426 #endif
whismanoid 0:cb44e2e9ec4c 2427 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2428 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2429 #endif
whismanoid 0:cb44e2e9ec4c 2430 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2431 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2432 #endif
whismanoid 0:cb44e2e9ec4c 2433 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2434 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2435 #endif
whismanoid 0:cb44e2e9ec4c 2436 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2437 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2438 #endif
whismanoid 0:cb44e2e9ec4c 2439 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2440 #elif defined(TARGET_MAX32620FTHR)
whismanoid 0:cb44e2e9ec4c 2441 #warning "TARGET_MAX32620FTHR not previously tested; need to verify analogIn0..."
whismanoid 0:cb44e2e9ec4c 2442 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2443 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2444 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2445 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2446 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2447 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2448 #define HAS_analogIn6 1
whismanoid 0:cb44e2e9ec4c 2449 #define HAS_analogIn7 1
whismanoid 0:cb44e2e9ec4c 2450 #define HAS_analogIn8 1
whismanoid 0:cb44e2e9ec4c 2451 #define HAS_analogIn9 1
whismanoid 0:cb44e2e9ec4c 2452 // #define HAS_analogIn10 0
whismanoid 0:cb44e2e9ec4c 2453 // #define HAS_analogIn11 0
whismanoid 0:cb44e2e9ec4c 2454 // #define HAS_analogIn12 0
whismanoid 0:cb44e2e9ec4c 2455 // #define HAS_analogIn13 0
whismanoid 0:cb44e2e9ec4c 2456 // #define HAS_analogIn14 0
whismanoid 0:cb44e2e9ec4c 2457 // #define HAS_analogIn15 0
whismanoid 0:cb44e2e9ec4c 2458 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2459 AnalogIn analogIn0(AIN_0); // TARGET_MAX32620FTHR J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2460 #endif
whismanoid 0:cb44e2e9ec4c 2461 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2462 AnalogIn analogIn1(AIN_1); // TARGET_MAX32620FTHR J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2463 #endif
whismanoid 0:cb44e2e9ec4c 2464 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2465 AnalogIn analogIn2(AIN_2); // TARGET_MAX32620FTHR J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2466 #endif
whismanoid 0:cb44e2e9ec4c 2467 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2468 AnalogIn analogIn3(AIN_3); // TARGET_MAX32620FTHR J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2469 #endif
whismanoid 0:cb44e2e9ec4c 2470 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2471 AnalogIn analogIn4(AIN_4); // TARGET_MAX32620FTHR J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2472 #endif
whismanoid 0:cb44e2e9ec4c 2473 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2474 AnalogIn analogIn5(AIN_5); // TARGET_MAX32620FTHR J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2475 #endif
whismanoid 0:cb44e2e9ec4c 2476 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 2477 AnalogIn analogIn6(AIN_6); // TARGET_MAX32620FTHR AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2478 #endif
whismanoid 0:cb44e2e9ec4c 2479 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 2480 AnalogIn analogIn7(AIN_7); // TARGET_MAX32620FTHR AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2481 #endif
whismanoid 0:cb44e2e9ec4c 2482 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 2483 AnalogIn analogIn8(AIN_8); // TARGET_MAX32620FTHR AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2484 #endif
whismanoid 0:cb44e2e9ec4c 2485 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 2486 AnalogIn analogIn9(AIN_9); // TARGET_MAX32620FTHR AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 2487 #endif
whismanoid 0:cb44e2e9ec4c 2488 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 2489 AnalogIn analogIn10(____); // TARGET_MAX32620FTHR AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 2490 #endif
whismanoid 0:cb44e2e9ec4c 2491 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 2492 AnalogIn analogIn11(____); // TARGET_MAX32620FTHR AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2493 #endif
whismanoid 0:cb44e2e9ec4c 2494 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 2495 AnalogIn analogIn12(____); // TARGET_MAX32620FTHR AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2496 #endif
whismanoid 0:cb44e2e9ec4c 2497 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 2498 AnalogIn analogIn13(____);
whismanoid 0:cb44e2e9ec4c 2499 #endif
whismanoid 0:cb44e2e9ec4c 2500 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 2501 AnalogIn analogIn14(____);
whismanoid 0:cb44e2e9ec4c 2502 #endif
whismanoid 0:cb44e2e9ec4c 2503 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 2504 AnalogIn analogIn15(____);
whismanoid 0:cb44e2e9ec4c 2505 #endif
whismanoid 0:cb44e2e9ec4c 2506 //--------------------------------------------------
whismanoid 19:5ff09c8e9daf 2507 #elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 37:3f369235e5bc 2508 // #warning "TARGET_MAX32625PICO not previously tested; need to verify analogIn0..."
whismanoid 0:cb44e2e9ec4c 2509 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2510 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2511 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2512 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2513 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2514 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2515 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2516 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2517 #endif
whismanoid 0:cb44e2e9ec4c 2518 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2519 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2520 #endif
whismanoid 0:cb44e2e9ec4c 2521 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2522 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2523 #endif
whismanoid 0:cb44e2e9ec4c 2524 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2525 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2526 #endif
whismanoid 0:cb44e2e9ec4c 2527 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2528 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2529 #endif
whismanoid 0:cb44e2e9ec4c 2530 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2531 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2532 #endif
whismanoid 0:cb44e2e9ec4c 2533 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2534 #elif defined(TARGET_MAX32600)
whismanoid 0:cb44e2e9ec4c 2535 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2536 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2537 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2538 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2539 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2540 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2541 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2542 AnalogIn analogIn0(A0);
whismanoid 0:cb44e2e9ec4c 2543 #endif
whismanoid 0:cb44e2e9ec4c 2544 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2545 AnalogIn analogIn1(A1);
whismanoid 0:cb44e2e9ec4c 2546 #endif
whismanoid 0:cb44e2e9ec4c 2547 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2548 AnalogIn analogIn2(A2);
whismanoid 0:cb44e2e9ec4c 2549 #endif
whismanoid 0:cb44e2e9ec4c 2550 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2551 AnalogIn analogIn3(A3);
whismanoid 0:cb44e2e9ec4c 2552 #endif
whismanoid 0:cb44e2e9ec4c 2553 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2554 AnalogIn analogIn4(A4);
whismanoid 0:cb44e2e9ec4c 2555 #endif
whismanoid 0:cb44e2e9ec4c 2556 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2557 AnalogIn analogIn5(A5);
whismanoid 0:cb44e2e9ec4c 2558 #endif
whismanoid 0:cb44e2e9ec4c 2559 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2560 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:cb44e2e9ec4c 2561 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2562 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2563 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2564 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2565 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2566 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2567 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2568 AnalogIn analogIn0(A0);
whismanoid 0:cb44e2e9ec4c 2569 #endif
whismanoid 0:cb44e2e9ec4c 2570 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2571 AnalogIn analogIn1(A1);
whismanoid 0:cb44e2e9ec4c 2572 #endif
whismanoid 0:cb44e2e9ec4c 2573 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2574 AnalogIn analogIn2(A2);
whismanoid 0:cb44e2e9ec4c 2575 #endif
whismanoid 0:cb44e2e9ec4c 2576 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2577 AnalogIn analogIn3(A3);
whismanoid 0:cb44e2e9ec4c 2578 #endif
whismanoid 0:cb44e2e9ec4c 2579 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2580 AnalogIn analogIn4(A4);
whismanoid 0:cb44e2e9ec4c 2581 #endif
whismanoid 0:cb44e2e9ec4c 2582 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2583 AnalogIn analogIn5(A5);
whismanoid 0:cb44e2e9ec4c 2584 #endif
whismanoid 0:cb44e2e9ec4c 2585 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2586 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 2587 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2588 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2589 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2590 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2591 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2592 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2593 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2594 AnalogIn analogIn0(A0);
whismanoid 0:cb44e2e9ec4c 2595 #endif
whismanoid 0:cb44e2e9ec4c 2596 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2597 AnalogIn analogIn1(A1);
whismanoid 0:cb44e2e9ec4c 2598 #endif
whismanoid 0:cb44e2e9ec4c 2599 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2600 AnalogIn analogIn2(A2);
whismanoid 0:cb44e2e9ec4c 2601 #endif
whismanoid 0:cb44e2e9ec4c 2602 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2603 AnalogIn analogIn3(A3);
whismanoid 0:cb44e2e9ec4c 2604 #endif
whismanoid 0:cb44e2e9ec4c 2605 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2606 AnalogIn analogIn4(A4);
whismanoid 0:cb44e2e9ec4c 2607 #endif
whismanoid 0:cb44e2e9ec4c 2608 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2609 AnalogIn analogIn5(A5);
whismanoid 0:cb44e2e9ec4c 2610 #endif
whismanoid 0:cb44e2e9ec4c 2611 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2612 // TODO1: TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:cb44e2e9ec4c 2613 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 2614 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2615 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2616 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2617 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2618 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2619 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2620 // #define HAS_analogIn6 1
whismanoid 0:cb44e2e9ec4c 2621 // #define HAS_analogIn7 1
whismanoid 0:cb44e2e9ec4c 2622 // #define HAS_analogIn8 1
whismanoid 0:cb44e2e9ec4c 2623 // #define HAS_analogIn9 1
whismanoid 0:cb44e2e9ec4c 2624 // #define HAS_analogIn10 1
whismanoid 0:cb44e2e9ec4c 2625 // #define HAS_analogIn11 1
whismanoid 0:cb44e2e9ec4c 2626 // #define HAS_analogIn12 1
whismanoid 0:cb44e2e9ec4c 2627 // #define HAS_analogIn13 1
whismanoid 0:cb44e2e9ec4c 2628 // #define HAS_analogIn14 1
whismanoid 0:cb44e2e9ec4c 2629 // #define HAS_analogIn15 1
whismanoid 0:cb44e2e9ec4c 2630 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2631 AnalogIn analogIn0(p15); // TARGET_LPC1768 P0.23/AD0.0/I2SRX_CLK/CAP3.0
whismanoid 0:cb44e2e9ec4c 2632 #endif
whismanoid 0:cb44e2e9ec4c 2633 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2634 AnalogIn analogIn1(p16); // TARGET_LPC1768 P0.24/AD0.1/I2SRX_WS/CAP3.1
whismanoid 0:cb44e2e9ec4c 2635 #endif
whismanoid 0:cb44e2e9ec4c 2636 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2637 AnalogIn analogIn2(p17); // TARGET_LPC1768 P0.25/AD0.2/I2SRX_SDA/TXD3
whismanoid 0:cb44e2e9ec4c 2638 #endif
whismanoid 0:cb44e2e9ec4c 2639 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2640 AnalogIn analogIn3(p18); // TARGET_LPC1768 P0.26/AD0.3/AOUT/RXD3
whismanoid 0:cb44e2e9ec4c 2641 #endif
whismanoid 0:cb44e2e9ec4c 2642 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2643 AnalogIn analogIn4(p19); // TARGET_LPC1768 P1.30/VBUS/AD0.4
whismanoid 0:cb44e2e9ec4c 2644 #endif
whismanoid 0:cb44e2e9ec4c 2645 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2646 AnalogIn analogIn5(p20); // TARGET_LPC1768 P1.31/SCK1/AD0.5
whismanoid 0:cb44e2e9ec4c 2647 #endif
whismanoid 0:cb44e2e9ec4c 2648 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 2649 AnalogIn analogIn6(____);
whismanoid 0:cb44e2e9ec4c 2650 #endif
whismanoid 0:cb44e2e9ec4c 2651 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 2652 AnalogIn analogIn7(____);
whismanoid 0:cb44e2e9ec4c 2653 #endif
whismanoid 0:cb44e2e9ec4c 2654 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 2655 AnalogIn analogIn8(____);
whismanoid 0:cb44e2e9ec4c 2656 #endif
whismanoid 0:cb44e2e9ec4c 2657 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 2658 AnalogIn analogIn9(____);
whismanoid 0:cb44e2e9ec4c 2659 #endif
whismanoid 0:cb44e2e9ec4c 2660 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 2661 AnalogIn analogIn10(____);
whismanoid 0:cb44e2e9ec4c 2662 #endif
whismanoid 0:cb44e2e9ec4c 2663 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 2664 AnalogIn analogIn11(____);
whismanoid 0:cb44e2e9ec4c 2665 #endif
whismanoid 0:cb44e2e9ec4c 2666 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 2667 AnalogIn analogIn12(____);
whismanoid 0:cb44e2e9ec4c 2668 #endif
whismanoid 0:cb44e2e9ec4c 2669 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 2670 AnalogIn analogIn13(____);
whismanoid 0:cb44e2e9ec4c 2671 #endif
whismanoid 0:cb44e2e9ec4c 2672 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 2673 AnalogIn analogIn14(____);
whismanoid 0:cb44e2e9ec4c 2674 #endif
whismanoid 0:cb44e2e9ec4c 2675 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 2676 AnalogIn analogIn15(____);
whismanoid 0:cb44e2e9ec4c 2677 #endif
whismanoid 0:cb44e2e9ec4c 2678 #else
whismanoid 0:cb44e2e9ec4c 2679 // unknown target
whismanoid 0:cb44e2e9ec4c 2680 #endif
whismanoid 0:cb44e2e9ec4c 2681 // uncrustify-0.66.1 *INDENT-ON*
whismanoid 0:cb44e2e9ec4c 2682 #if HAS_analogIn0 || HAS_analogIn1 \
whismanoid 0:cb44e2e9ec4c 2683 || HAS_analogIn2 || HAS_analogIn3 \
whismanoid 0:cb44e2e9ec4c 2684 || HAS_analogIn4 || HAS_analogIn5 \
whismanoid 0:cb44e2e9ec4c 2685 || HAS_analogIn6 || HAS_analogIn7 \
whismanoid 0:cb44e2e9ec4c 2686 || HAS_analogIn8 || HAS_analogIn9 \
whismanoid 0:cb44e2e9ec4c 2687 || HAS_analogIn10 || HAS_analogIn11 \
whismanoid 0:cb44e2e9ec4c 2688 || HAS_analogIn12 || HAS_analogIn13 \
whismanoid 0:cb44e2e9ec4c 2689 || HAS_analogIn14 || HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 2690 #define HAS_analogIns 1
whismanoid 0:cb44e2e9ec4c 2691 #else
whismanoid 0:cb44e2e9ec4c 2692 #warning "Note: There are no analogIn resources defined"
whismanoid 0:cb44e2e9ec4c 2693 #endif
whismanoid 0:cb44e2e9ec4c 2694
whismanoid 0:cb44e2e9ec4c 2695 // DigitalInOut pin resource: print the pin index names to serial
whismanoid 0:cb44e2e9ec4c 2696 #if HAS_digitalInOuts
whismanoid 0:cb44e2e9ec4c 2697 void list_digitalInOutPins(Stream& serialStream)
whismanoid 0:cb44e2e9ec4c 2698 {
whismanoid 0:cb44e2e9ec4c 2699 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 2700 serialStream.printf(" 0");
whismanoid 0:cb44e2e9ec4c 2701 #endif
whismanoid 0:cb44e2e9ec4c 2702 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 2703 serialStream.printf(" 1");
whismanoid 0:cb44e2e9ec4c 2704 #endif
whismanoid 0:cb44e2e9ec4c 2705 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 2706 serialStream.printf(" 2");
whismanoid 0:cb44e2e9ec4c 2707 #endif
whismanoid 0:cb44e2e9ec4c 2708 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 2709 serialStream.printf(" 3");
whismanoid 0:cb44e2e9ec4c 2710 #endif
whismanoid 0:cb44e2e9ec4c 2711 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 2712 serialStream.printf(" 4");
whismanoid 0:cb44e2e9ec4c 2713 #endif
whismanoid 0:cb44e2e9ec4c 2714 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 2715 serialStream.printf(" 5");
whismanoid 0:cb44e2e9ec4c 2716 #endif
whismanoid 0:cb44e2e9ec4c 2717 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 2718 serialStream.printf(" 6");
whismanoid 0:cb44e2e9ec4c 2719 #endif
whismanoid 0:cb44e2e9ec4c 2720 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 2721 serialStream.printf(" 7");
whismanoid 0:cb44e2e9ec4c 2722 #endif
whismanoid 0:cb44e2e9ec4c 2723 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 2724 serialStream.printf(" 8");
whismanoid 0:cb44e2e9ec4c 2725 #endif
whismanoid 0:cb44e2e9ec4c 2726 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 2727 serialStream.printf(" 9");
whismanoid 0:cb44e2e9ec4c 2728 #endif
whismanoid 0:cb44e2e9ec4c 2729 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 2730 serialStream.printf(" 10");
whismanoid 0:cb44e2e9ec4c 2731 #endif
whismanoid 0:cb44e2e9ec4c 2732 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 2733 serialStream.printf(" 11");
whismanoid 0:cb44e2e9ec4c 2734 #endif
whismanoid 0:cb44e2e9ec4c 2735 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 2736 serialStream.printf(" 12");
whismanoid 0:cb44e2e9ec4c 2737 #endif
whismanoid 0:cb44e2e9ec4c 2738 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 2739 serialStream.printf(" 13");
whismanoid 0:cb44e2e9ec4c 2740 #endif
whismanoid 0:cb44e2e9ec4c 2741 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 2742 serialStream.printf(" 14");
whismanoid 0:cb44e2e9ec4c 2743 #endif
whismanoid 0:cb44e2e9ec4c 2744 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 2745 serialStream.printf(" 15");
whismanoid 0:cb44e2e9ec4c 2746 #endif
whismanoid 0:cb44e2e9ec4c 2747 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 2748 serialStream.printf(" 16");
whismanoid 0:cb44e2e9ec4c 2749 #endif
whismanoid 0:cb44e2e9ec4c 2750 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 2751 serialStream.printf(" 17");
whismanoid 0:cb44e2e9ec4c 2752 #endif
whismanoid 18:1235c17b451e 2753 #if USE_LEDS
whismanoid 18:1235c17b451e 2754 // support LEDs as digital pins 91 92 93; WIP button as digital pin 90
whismanoid 18:1235c17b451e 2755 // support list_digitalInOutPins() listing buttons and leds as pin numbers 90/91/92/93
whismanoid 18:1235c17b451e 2756 // TODO: support find_digitalInOutPin(90) return DigitalInOut of switch SW1/BUTTON1
whismanoid 18:1235c17b451e 2757 //~ serialStream.printf(" 90");
whismanoid 18:1235c17b451e 2758 // support find_digitalInOutPin(91) return DigitalInOut of led1_RFailLED
whismanoid 18:1235c17b451e 2759 serialStream.printf(" 91");
whismanoid 18:1235c17b451e 2760 // support find_digitalInOutPin(92) return DigitalInOut of led2_GPassLED
whismanoid 18:1235c17b451e 2761 serialStream.printf(" 92");
whismanoid 18:1235c17b451e 2762 // support find_digitalInOutPin(93) return DigitalInOut of led3_BBusyLED
whismanoid 18:1235c17b451e 2763 serialStream.printf(" 93");
whismanoid 18:1235c17b451e 2764 #else // USE_LEDS
whismanoid 18:1235c17b451e 2765 #endif // USE_LEDS
whismanoid 0:cb44e2e9ec4c 2766 }
whismanoid 0:cb44e2e9ec4c 2767 #endif
whismanoid 0:cb44e2e9ec4c 2768
whismanoid 0:cb44e2e9ec4c 2769
whismanoid 0:cb44e2e9ec4c 2770 // DigitalInOut pin resource: search index
whismanoid 0:cb44e2e9ec4c 2771 #if HAS_digitalInOuts
whismanoid 0:cb44e2e9ec4c 2772 DigitalInOut& find_digitalInOutPin(int cPinIndex)
whismanoid 0:cb44e2e9ec4c 2773 {
whismanoid 0:cb44e2e9ec4c 2774 switch (cPinIndex)
whismanoid 0:cb44e2e9ec4c 2775 {
whismanoid 0:cb44e2e9ec4c 2776 default: // default to the first defined digitalInOut pin
whismanoid 0:cb44e2e9ec4c 2777 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 2778 case '0': case 0x00: return digitalInOut0;
whismanoid 0:cb44e2e9ec4c 2779 #endif
whismanoid 0:cb44e2e9ec4c 2780 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 2781 case '1': case 0x01: return digitalInOut1;
whismanoid 0:cb44e2e9ec4c 2782 #endif
whismanoid 0:cb44e2e9ec4c 2783 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 2784 case '2': case 0x02: return digitalInOut2;
whismanoid 0:cb44e2e9ec4c 2785 #endif
whismanoid 0:cb44e2e9ec4c 2786 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 2787 case '3': case 0x03: return digitalInOut3;
whismanoid 0:cb44e2e9ec4c 2788 #endif
whismanoid 0:cb44e2e9ec4c 2789 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 2790 case '4': case 0x04: return digitalInOut4;
whismanoid 0:cb44e2e9ec4c 2791 #endif
whismanoid 0:cb44e2e9ec4c 2792 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 2793 case '5': case 0x05: return digitalInOut5;
whismanoid 0:cb44e2e9ec4c 2794 #endif
whismanoid 0:cb44e2e9ec4c 2795 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 2796 case '6': case 0x06: return digitalInOut6;
whismanoid 0:cb44e2e9ec4c 2797 #endif
whismanoid 0:cb44e2e9ec4c 2798 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 2799 case '7': case 0x07: return digitalInOut7;
whismanoid 0:cb44e2e9ec4c 2800 #endif
whismanoid 0:cb44e2e9ec4c 2801 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 2802 case '8': case 0x08: return digitalInOut8;
whismanoid 0:cb44e2e9ec4c 2803 #endif
whismanoid 0:cb44e2e9ec4c 2804 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 2805 case '9': case 0x09: return digitalInOut9;
whismanoid 0:cb44e2e9ec4c 2806 #endif
whismanoid 0:cb44e2e9ec4c 2807 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 2808 case 'a': case 0x0a: return digitalInOut10;
whismanoid 0:cb44e2e9ec4c 2809 #endif
whismanoid 0:cb44e2e9ec4c 2810 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 2811 case 'b': case 0x0b: return digitalInOut11;
whismanoid 0:cb44e2e9ec4c 2812 #endif
whismanoid 0:cb44e2e9ec4c 2813 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 2814 case 'c': case 0x0c: return digitalInOut12;
whismanoid 0:cb44e2e9ec4c 2815 #endif
whismanoid 0:cb44e2e9ec4c 2816 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 2817 case 'd': case 0x0d: return digitalInOut13;
whismanoid 0:cb44e2e9ec4c 2818 #endif
whismanoid 0:cb44e2e9ec4c 2819 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 2820 case 'e': case 0x0e: return digitalInOut14;
whismanoid 0:cb44e2e9ec4c 2821 #endif
whismanoid 0:cb44e2e9ec4c 2822 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 2823 case 'f': case 0x0f: return digitalInOut15;
whismanoid 0:cb44e2e9ec4c 2824 #endif
whismanoid 0:cb44e2e9ec4c 2825 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 2826 case 'g': case 0x10: return digitalInOut16;
whismanoid 0:cb44e2e9ec4c 2827 #endif
whismanoid 0:cb44e2e9ec4c 2828 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 2829 case 'h': case 0x11: return digitalInOut17;
whismanoid 0:cb44e2e9ec4c 2830 #endif
whismanoid 18:1235c17b451e 2831 // support LEDs as digital pins 91 92 93; WIP button as digital pin 90
whismanoid 18:1235c17b451e 2832 // TODO: support find_digitalInOutPin(90) return DigitalInOut of switch SW1/BUTTON1
whismanoid 18:1235c17b451e 2833 //~ case 90: return button1;
whismanoid 18:1235c17b451e 2834 #if USE_LEDS
whismanoid 18:1235c17b451e 2835 // support find_digitalInOutPin(91) return DigitalInOut of led1_RFailLED
whismanoid 18:1235c17b451e 2836 case 91: return led1_RFailLED;
whismanoid 18:1235c17b451e 2837 // support find_digitalInOutPin(92) return DigitalInOut of led2_GPassLED
whismanoid 18:1235c17b451e 2838 case 92: return led2_GPassLED;
whismanoid 18:1235c17b451e 2839 // support find_digitalInOutPin(93) return DigitalInOut of led3_BBusyLED
whismanoid 18:1235c17b451e 2840 case 93: return led3_BBusyLED;
whismanoid 18:1235c17b451e 2841 #else // USE_LEDS
whismanoid 18:1235c17b451e 2842 #endif // USE_LEDS
whismanoid 0:cb44e2e9ec4c 2843 }
whismanoid 0:cb44e2e9ec4c 2844 }
whismanoid 0:cb44e2e9ec4c 2845 #endif
whismanoid 0:cb44e2e9ec4c 2846
whismanoid 0:cb44e2e9ec4c 2847
whismanoid 0:cb44e2e9ec4c 2848 // AnalogIn pin resource: search index
whismanoid 0:cb44e2e9ec4c 2849 #if HAS_analogIns
whismanoid 0:cb44e2e9ec4c 2850 AnalogIn& find_analogInPin(int cPinIndex)
whismanoid 0:cb44e2e9ec4c 2851 {
whismanoid 0:cb44e2e9ec4c 2852 switch (cPinIndex)
whismanoid 0:cb44e2e9ec4c 2853 {
whismanoid 0:cb44e2e9ec4c 2854 default: // default to the first defined analogIn pin
whismanoid 0:cb44e2e9ec4c 2855 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2856 case '0': case 0x00: return analogIn0;
whismanoid 0:cb44e2e9ec4c 2857 #endif
whismanoid 0:cb44e2e9ec4c 2858 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2859 case '1': case 0x01: return analogIn1;
whismanoid 0:cb44e2e9ec4c 2860 #endif
whismanoid 0:cb44e2e9ec4c 2861 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2862 case '2': case 0x02: return analogIn2;
whismanoid 0:cb44e2e9ec4c 2863 #endif
whismanoid 0:cb44e2e9ec4c 2864 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2865 case '3': case 0x03: return analogIn3;
whismanoid 0:cb44e2e9ec4c 2866 #endif
whismanoid 0:cb44e2e9ec4c 2867 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2868 case '4': case 0x04: return analogIn4;
whismanoid 0:cb44e2e9ec4c 2869 #endif
whismanoid 0:cb44e2e9ec4c 2870 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2871 case '5': case 0x05: return analogIn5;
whismanoid 0:cb44e2e9ec4c 2872 #endif
whismanoid 0:cb44e2e9ec4c 2873 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 2874 case '6': case 0x06: return analogIn6;
whismanoid 0:cb44e2e9ec4c 2875 #endif
whismanoid 0:cb44e2e9ec4c 2876 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 2877 case '7': case 0x07: return analogIn7;
whismanoid 0:cb44e2e9ec4c 2878 #endif
whismanoid 0:cb44e2e9ec4c 2879 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 2880 case '8': case 0x08: return analogIn8;
whismanoid 0:cb44e2e9ec4c 2881 #endif
whismanoid 0:cb44e2e9ec4c 2882 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 2883 case '9': case 0x09: return analogIn9;
whismanoid 0:cb44e2e9ec4c 2884 #endif
whismanoid 0:cb44e2e9ec4c 2885 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 2886 case 'a': case 0x0a: return analogIn10;
whismanoid 0:cb44e2e9ec4c 2887 #endif
whismanoid 0:cb44e2e9ec4c 2888 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 2889 case 'b': case 0x0b: return analogIn11;
whismanoid 0:cb44e2e9ec4c 2890 #endif
whismanoid 0:cb44e2e9ec4c 2891 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 2892 case 'c': case 0x0c: return analogIn12;
whismanoid 0:cb44e2e9ec4c 2893 #endif
whismanoid 0:cb44e2e9ec4c 2894 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 2895 case 'd': case 0x0d: return analogIn13;
whismanoid 0:cb44e2e9ec4c 2896 #endif
whismanoid 0:cb44e2e9ec4c 2897 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 2898 case 'e': case 0x0e: return analogIn14;
whismanoid 0:cb44e2e9ec4c 2899 #endif
whismanoid 0:cb44e2e9ec4c 2900 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 2901 case 'f': case 0x0f: return analogIn15;
whismanoid 0:cb44e2e9ec4c 2902 #endif
whismanoid 0:cb44e2e9ec4c 2903 }
whismanoid 0:cb44e2e9ec4c 2904 }
whismanoid 0:cb44e2e9ec4c 2905 #endif
whismanoid 0:cb44e2e9ec4c 2906
whismanoid 0:cb44e2e9ec4c 2907 #if HAS_analogIns
whismanoid 0:cb44e2e9ec4c 2908 const float analogInPin_fullScaleVoltage[] = {
whismanoid 0:cb44e2e9ec4c 2909 # if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 2910 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 2911 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 2912 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 2913 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 2914 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2915 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2916 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn6 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2917 ADC_FULL_SCALE_VOLTAGE, // analogIn7 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2918 ADC_FULL_SCALE_VOLTAGE, // analogIn8 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2919 ADC_FULL_SCALE_VOLTAGE * 2.0f, // analogIn9 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 2920 ADC_FULL_SCALE_VOLTAGE, // analogIn10 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 2921 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn11 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2922 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn12 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2923 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 2924 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 2925 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 2926 # elif defined(TARGET_MAX32620FTHR)
whismanoid 0:cb44e2e9ec4c 2927 #warning "TARGET_MAX32620FTHR not previously tested; need to verify analogIn0..."
whismanoid 0:cb44e2e9ec4c 2928 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 2929 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 2930 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 2931 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 2932 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2933 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2934 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn6 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2935 ADC_FULL_SCALE_VOLTAGE, // analogIn7 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2936 ADC_FULL_SCALE_VOLTAGE, // analogIn8 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2937 ADC_FULL_SCALE_VOLTAGE * 2.0f, // analogIn9 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 2938 ADC_FULL_SCALE_VOLTAGE, // analogIn10 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 2939 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn11 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2940 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn12 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2941 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 2942 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 2943 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 19:5ff09c8e9daf 2944 #elif defined(TARGET_MAX32625MBED) || defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 0:cb44e2e9ec4c 2945 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn0 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2946 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn1 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2947 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn2 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2948 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn3 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2949 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2950 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2951 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn6 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2952 ADC_FULL_SCALE_VOLTAGE, // analogIn7 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2953 ADC_FULL_SCALE_VOLTAGE, // analogIn8 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2954 ADC_FULL_SCALE_VOLTAGE * 2.0f, // analogIn9 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 2955 ADC_FULL_SCALE_VOLTAGE, // analogIn10 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 2956 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn11 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2957 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn12 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2958 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 2959 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 2960 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 2961 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:cb44e2e9ec4c 2962 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 2963 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 2964 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 2965 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 2966 ADC_FULL_SCALE_VOLTAGE, // analogIn4
whismanoid 0:cb44e2e9ec4c 2967 ADC_FULL_SCALE_VOLTAGE, // analogIn5
whismanoid 0:cb44e2e9ec4c 2968 ADC_FULL_SCALE_VOLTAGE, // analogIn6
whismanoid 0:cb44e2e9ec4c 2969 ADC_FULL_SCALE_VOLTAGE, // analogIn7
whismanoid 0:cb44e2e9ec4c 2970 ADC_FULL_SCALE_VOLTAGE, // analogIn8
whismanoid 0:cb44e2e9ec4c 2971 ADC_FULL_SCALE_VOLTAGE, // analogIn9
whismanoid 0:cb44e2e9ec4c 2972 ADC_FULL_SCALE_VOLTAGE, // analogIn10
whismanoid 0:cb44e2e9ec4c 2973 ADC_FULL_SCALE_VOLTAGE, // analogIn11
whismanoid 0:cb44e2e9ec4c 2974 ADC_FULL_SCALE_VOLTAGE, // analogIn12
whismanoid 0:cb44e2e9ec4c 2975 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 2976 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 2977 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 2978 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 2979 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 2980 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 2981 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 2982 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 2983 ADC_FULL_SCALE_VOLTAGE, // analogIn4
whismanoid 0:cb44e2e9ec4c 2984 ADC_FULL_SCALE_VOLTAGE, // analogIn5
whismanoid 0:cb44e2e9ec4c 2985 ADC_FULL_SCALE_VOLTAGE, // analogIn6
whismanoid 0:cb44e2e9ec4c 2986 ADC_FULL_SCALE_VOLTAGE, // analogIn7
whismanoid 0:cb44e2e9ec4c 2987 ADC_FULL_SCALE_VOLTAGE, // analogIn8
whismanoid 0:cb44e2e9ec4c 2988 ADC_FULL_SCALE_VOLTAGE, // analogIn9
whismanoid 0:cb44e2e9ec4c 2989 ADC_FULL_SCALE_VOLTAGE, // analogIn10
whismanoid 0:cb44e2e9ec4c 2990 ADC_FULL_SCALE_VOLTAGE, // analogIn11
whismanoid 0:cb44e2e9ec4c 2991 ADC_FULL_SCALE_VOLTAGE, // analogIn12
whismanoid 0:cb44e2e9ec4c 2992 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 2993 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 2994 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 2995 //#elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 2996 #else
whismanoid 0:cb44e2e9ec4c 2997 // unknown target
whismanoid 0:cb44e2e9ec4c 2998 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 2999 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 3000 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 3001 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 3002 ADC_FULL_SCALE_VOLTAGE, // analogIn4
whismanoid 0:cb44e2e9ec4c 3003 ADC_FULL_SCALE_VOLTAGE, // analogIn5
whismanoid 0:cb44e2e9ec4c 3004 ADC_FULL_SCALE_VOLTAGE, // analogIn6
whismanoid 0:cb44e2e9ec4c 3005 ADC_FULL_SCALE_VOLTAGE, // analogIn7
whismanoid 0:cb44e2e9ec4c 3006 ADC_FULL_SCALE_VOLTAGE, // analogIn8
whismanoid 0:cb44e2e9ec4c 3007 ADC_FULL_SCALE_VOLTAGE, // analogIn9
whismanoid 0:cb44e2e9ec4c 3008 ADC_FULL_SCALE_VOLTAGE, // analogIn10
whismanoid 0:cb44e2e9ec4c 3009 ADC_FULL_SCALE_VOLTAGE, // analogIn11
whismanoid 0:cb44e2e9ec4c 3010 ADC_FULL_SCALE_VOLTAGE, // analogIn12
whismanoid 0:cb44e2e9ec4c 3011 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 3012 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 3013 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 3014 # endif
whismanoid 0:cb44e2e9ec4c 3015 };
whismanoid 0:cb44e2e9ec4c 3016 #endif
whismanoid 0:cb44e2e9ec4c 3017
whismanoid 0:cb44e2e9ec4c 3018
whismanoid 0:cb44e2e9ec4c 3019
whismanoid 0:cb44e2e9ec4c 3020
whismanoid 0:cb44e2e9ec4c 3021 //--------------------------------------------------
whismanoid 45:74bf1fe021e5 3022 // support CmdLine command menus (like on Serial_Tester)
whismanoid 4:d9b05924ad4c 3023 #ifndef USE_CMDLINE_MENUS
whismanoid 4:d9b05924ad4c 3024 #define USE_CMDLINE_MENUS 1
whismanoid 4:d9b05924ad4c 3025 //~ #undef USE_CMDLINE_MENUS
whismanoid 4:d9b05924ad4c 3026 #endif
whismanoid 4:d9b05924ad4c 3027 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 3028 #include "CmdLine.h"
whismanoid 4:d9b05924ad4c 3029 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 3030 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 3031 extern CmdLine cmdLine; // declared later
whismanoid 4:d9b05924ad4c 3032 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 3033
whismanoid 4:d9b05924ad4c 3034 //--------------------------------------------------
whismanoid 39:4d285e961435 3035 // support sleep modes in Datalogger_Trigger
whismanoid 39:4d285e961435 3036 #ifndef USE_DATALOGGER_SLEEP
whismanoid 39:4d285e961435 3037 #define USE_DATALOGGER_SLEEP 1
whismanoid 39:4d285e961435 3038 //~ #undef USE_DATALOGGER_SLEEP
whismanoid 39:4d285e961435 3039 #endif
whismanoid 39:4d285e961435 3040 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 3041 // USE_DATALOGGER_SLEEP -- support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 3042 // USE_DATALOGGER_SLEEP -- #include "lp.h" -- LP_EnterLP1()
whismanoid 42:89607d5d4e6d 3043 #include "lp.h"
whismanoid 43:4c4733760d4c 3044 #include "rtc.h"
whismanoid 39:4d285e961435 3045 #endif
whismanoid 39:4d285e961435 3046 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 44:84402faa8eb9 3047 // wait until UART_Busy indicates no ongoing transactions (both ports)
whismanoid 44:84402faa8eb9 3048 #include "uart.h"
whismanoid 44:84402faa8eb9 3049 int Console_PrepForSleep(void)
whismanoid 44:84402faa8eb9 3050 {
whismanoid 44:84402faa8eb9 3051 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX40108DEMOP2U9: P0_1,P0_0 (J90.1/J90.0 to console)
whismanoid 44:84402faa8eb9 3052 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK)
whismanoid 44:84402faa8eb9 3053 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX40108DEMOP2U9: P3_1,P3_0 (unavailable)
whismanoid 44:84402faa8eb9 3054 return (
whismanoid 44:84402faa8eb9 3055 (UART_PrepForSleep(MXC_UART_GET_UART(0)) == E_NO_ERROR)
whismanoid 44:84402faa8eb9 3056 && (UART_PrepForSleep(MXC_UART_GET_UART(1)) == E_NO_ERROR)
whismanoid 44:84402faa8eb9 3057 )
whismanoid 44:84402faa8eb9 3058 ? E_NO_ERROR
whismanoid 44:84402faa8eb9 3059 : E_BUSY;
whismanoid 44:84402faa8eb9 3060 }
whismanoid 44:84402faa8eb9 3061 #endif // USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 44:84402faa8eb9 3062 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 39:4d285e961435 3063 typedef enum Datalogger_Sleep_enum_t {
whismanoid 39:4d285e961435 3064 datalogger_Sleep_LP0_Stop = 0,
whismanoid 39:4d285e961435 3065 datalogger_Sleep_LP1_DeepSleep = 1,
whismanoid 39:4d285e961435 3066 datalogger_Sleep_LP2_Sleep = 2,
whismanoid 39:4d285e961435 3067 datalogger_Sleep_LP3_Run = 3,
whismanoid 39:4d285e961435 3068 } Datalogger_Sleep_enum_t;
whismanoid 45:74bf1fe021e5 3069 // USE_DATALOGGER_SLEEP -- support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 3070 Datalogger_Sleep_enum_t g_timer_sleepmode = datalogger_Sleep_LP1_DeepSleep;
whismanoid 39:4d285e961435 3071 #endif
whismanoid 39:4d285e961435 3072
whismanoid 39:4d285e961435 3073 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 3074 // Datalog trigger types
whismanoid 4:d9b05924ad4c 3075 #ifndef USE_DATALOGGER_TRIGGER
whismanoid 4:d9b05924ad4c 3076 #define USE_DATALOGGER_TRIGGER 1
whismanoid 4:d9b05924ad4c 3077 //~ #undef USE_DATALOGGER_TRIGGER
whismanoid 4:d9b05924ad4c 3078 #endif
whismanoid 4:d9b05924ad4c 3079 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 4:d9b05924ad4c 3080 typedef enum Datalogger_Trigger_enum_t {
whismanoid 4:d9b05924ad4c 3081 trigger_Halt = 0, //!< halt
whismanoid 4:d9b05924ad4c 3082 trigger_FreeRun = 1, //!< free run as fast as possible
whismanoid 4:d9b05924ad4c 3083 trigger_Timer = 2, //!< timer (configure interval)
whismanoid 4:d9b05924ad4c 3084 trigger_PlatformDigitalInput, //!< platform digital input (configure digital input pin reference)
whismanoid 4:d9b05924ad4c 3085 trigger_SPIDeviceRegRead, //!< SPI device register read (configure regaddr, mask value, match value)
whismanoid 4:d9b05924ad4c 3086 } Datalogger_Trigger_enum_t;
whismanoid 4:d9b05924ad4c 3087 Datalogger_Trigger_enum_t Datalogger_Trigger = trigger_FreeRun;
whismanoid 17:9397ea3ea7e9 3088 //
whismanoid 17:9397ea3ea7e9 3089 // configuration for trigger_Timer
whismanoid 17:9397ea3ea7e9 3090 int g_timer_interval_msec = 500; // trigger_Timer
whismanoid 17:9397ea3ea7e9 3091 int g_timer_interval_count = 10; // trigger_Timer
whismanoid 17:9397ea3ea7e9 3092 int g_timer_interval_counter = 0; // trigger_Timer
whismanoid 17:9397ea3ea7e9 3093 //
whismanoid 17:9397ea3ea7e9 3094 // TODO: configuration for trigger_PlatformDigitalInput
whismanoid 17:9397ea3ea7e9 3095 //
whismanoid 17:9397ea3ea7e9 3096 // TODO: configuration for trigger_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 3097 //
whismanoid 4:d9b05924ad4c 3098 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 4:d9b05924ad4c 3099
whismanoid 4:d9b05924ad4c 3100 //--------------------------------------------------
whismanoid 17:9397ea3ea7e9 3101 // support trigger_SPIDeviceRegRead: Datalog when SPI read of address matches mask
whismanoid 17:9397ea3ea7e9 3102 #ifndef USE_DATALOGGER_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 3103 #define USE_DATALOGGER_SPIDeviceRegRead 0
whismanoid 17:9397ea3ea7e9 3104 #endif // USE_DATALOGGER_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 3105 #if USE_DATALOGGER_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 3106 // TODO: uint16_t regAddr;
whismanoid 17:9397ea3ea7e9 3107 // TODO: uint16_t regDataMask;
whismanoid 17:9397ea3ea7e9 3108 // TODO: uint16_t regDataTest;
whismanoid 17:9397ea3ea7e9 3109 #endif // USE_DATALOGGER_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 3110
whismanoid 17:9397ea3ea7e9 3111 //--------------------------------------------------
whismanoid 30:07197a430869 3112 // support Datalogger_PrintRow() print gstrRemarkText field from recent #remark
whismanoid 30:07197a430869 3113 #ifndef USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 3114 #define USE_DATALOGGER_REMARK_FIELD 1
whismanoid 30:07197a430869 3115 #endif // USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 3116 #if USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 3117 // Datalogger_PrintRow() print gstrRemarkText field from recent #remark
whismanoid 30:07197a430869 3118 const size_t gstrRemarkTextLASTINDEX = 40; // gstrRemarkText buffer size - 1
whismanoid 30:07197a430869 3119 char gstrRemarkText[gstrRemarkTextLASTINDEX+1] = "";
whismanoid 30:07197a430869 3120 char gstrRemarkHeader[] = "comment"; // comment or remark?
whismanoid 30:07197a430869 3121 #endif // USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 3122
whismanoid 30:07197a430869 3123 //--------------------------------------------------
whismanoid 17:9397ea3ea7e9 3124 // Datalogger_RunActionTable() supported actions
whismanoid 45:74bf1fe021e5 3125 // support command L@
whismanoid 45:74bf1fe021e5 3126 // configurable "business logic" for the data log
whismanoid 17:9397ea3ea7e9 3127 #ifndef USE_DATALOGGER_ActionTable
whismanoid 17:9397ea3ea7e9 3128 #define USE_DATALOGGER_ActionTable 1
whismanoid 17:9397ea3ea7e9 3129 //~ #undef USE_DATALOGGER_ActionTable
whismanoid 17:9397ea3ea7e9 3130 #endif
whismanoid 17:9397ea3ea7e9 3131 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 3132 //
whismanoid 17:9397ea3ea7e9 3133 // Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 3134 typedef enum action_type_enum_t {
whismanoid 17:9397ea3ea7e9 3135 action_noop = 0, // no operation
whismanoid 30:07197a430869 3136 action_digitalOutLow = 1, // pin = low if condition
whismanoid 30:07197a430869 3137 action_digitalOutHigh = 2, // pin = high if condition
whismanoid 30:07197a430869 3138 action_button = 3, // pin = button event index 1, 2, 3
whismanoid 30:07197a430869 3139 action_trigger_Halt = 4,
whismanoid 30:07197a430869 3140 action_trigger_FreeRun = 5,
whismanoid 30:07197a430869 3141 action_trigger_Timer = 6,
whismanoid 53:fdb510e3eb37 3142 action_trigger_PlatformDigitalInput = 7, // FUTURE
whismanoid 53:fdb510e3eb37 3143 action_trigger_SPIDeviceRegRead = 8, // FUTURE
whismanoid 17:9397ea3ea7e9 3144 } action_type_enum_t;
whismanoid 17:9397ea3ea7e9 3145 //
whismanoid 17:9397ea3ea7e9 3146 // Datalogger_RunActionTable() supported conditions
whismanoid 17:9397ea3ea7e9 3147 typedef enum action_condition_enum_t {
whismanoid 17:9397ea3ea7e9 3148 condition_always = 0, // ( true )
whismanoid 17:9397ea3ea7e9 3149 condition_if_An_gt_threshold, // (Platform_Voltage[channel] > threhsold)
whismanoid 17:9397ea3ea7e9 3150 condition_if_An_lt_threshold, // (Platform_Voltage[channel] < threhsold)
whismanoid 17:9397ea3ea7e9 3151 condition_if_An_eq_threshold, // (Platform_Voltage[channel] == threhsold)
whismanoid 17:9397ea3ea7e9 3152 condition_if_An_ge_threshold, // (Platform_Voltage[channel] >= threhsold)
whismanoid 17:9397ea3ea7e9 3153 condition_if_An_le_threshold, // (Platform_Voltage[channel] <= threhsold)
whismanoid 17:9397ea3ea7e9 3154 condition_if_An_ne_threshold, // (Platform_Voltage[channel] != threhsold)
whismanoid 17:9397ea3ea7e9 3155 condition_if_AINn_gt_threshold, // (SPI_AIN_Voltage[channel] > threhsold)
whismanoid 17:9397ea3ea7e9 3156 condition_if_AINn_lt_threshold, // (SPI_AIN_Voltage[channel] < threhsold)
whismanoid 17:9397ea3ea7e9 3157 condition_if_AINn_eq_threshold, // (SPI_AIN_Voltage[channel] == threhsold)
whismanoid 17:9397ea3ea7e9 3158 condition_if_AINn_ge_threshold, // (SPI_AIN_Voltage[channel] >= threhsold)
whismanoid 17:9397ea3ea7e9 3159 condition_if_AINn_le_threshold, // (SPI_AIN_Voltage[channel] <= threhsold)
whismanoid 17:9397ea3ea7e9 3160 condition_if_AINn_ne_threshold, // (SPI_AIN_Voltage[channel] != threhsold)
whismanoid 55:477ba09475d7 3161 // WIP Datalog Math -- if channel has its math enabled, compare with the math-adjusted version. Keep it simple. #362
whismanoid 17:9397ea3ea7e9 3162 } condition_enum_t;
whismanoid 17:9397ea3ea7e9 3163 //
whismanoid 17:9397ea3ea7e9 3164 // Datalogger_RunActionTable() structure
whismanoid 17:9397ea3ea7e9 3165 typedef struct action_table_row_t {
whismanoid 17:9397ea3ea7e9 3166 action_type_enum_t action;
whismanoid 17:9397ea3ea7e9 3167 int digitalOutPin;
whismanoid 17:9397ea3ea7e9 3168 action_condition_enum_t condition;
whismanoid 17:9397ea3ea7e9 3169 int condition_channel;
whismanoid 17:9397ea3ea7e9 3170 double condition_threshold;
whismanoid 17:9397ea3ea7e9 3171 } action_table_row_t;
whismanoid 17:9397ea3ea7e9 3172 #if MAX40108_DEMO
whismanoid 39:4d285e961435 3173 # ifdef BOARD_SERIAL_NUMBER
whismanoid 39:4d285e961435 3174 // data unique to certain boards based on serial number
whismanoid 39:4d285e961435 3175 // channels A0/A4(CSA*100/3.34=mA), A1/A5(1V0), A2(WE), A3(CE)
whismanoid 39:4d285e961435 3176 # if (BOARD_SERIAL_NUMBER) == 1
whismanoid 55:477ba09475d7 3177 #warning "info: (BOARD_SERIAL_NUMBER) == 1 -- logic uses A3(CE) instead of A2(WE)"
whismanoid 39:4d285e961435 3178 const int channel_WE = 3; // use channel_CE instead on proto board s/n 1 for diagnostics; easier to sweep values
whismanoid 39:4d285e961435 3179 # elif (BOARD_SERIAL_NUMBER) == 5
whismanoid 55:477ba09475d7 3180 #warning "info: (BOARD_SERIAL_NUMBER) == 5 -- logic uses A3(CE) instead of A2(WE)"
whismanoid 39:4d285e961435 3181 const int channel_WE = 3; // use channel_CE instead on proto board s/n 1 for diagnostics; easier to sweep values
whismanoid 39:4d285e961435 3182 # else // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 17:9397ea3ea7e9 3183 const int channel_WE = 2;
whismanoid 39:4d285e961435 3184 # endif
whismanoid 39:4d285e961435 3185 # endif // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 17:9397ea3ea7e9 3186 const double threshold_WE_0V5 = 0.5;
whismanoid 17:9397ea3ea7e9 3187 const double threshold_WE_0V6 = 0.6;
whismanoid 17:9397ea3ea7e9 3188 const double threshold_WE_0V7 = 0.7;
whismanoid 18:1235c17b451e 3189 const int pin_LED_1 = 91; // support find_digitalInOutPin(91) return DigitalInOut of led1_RFailLED
whismanoid 18:1235c17b451e 3190 const int pin_LED_2 = 92; // support find_digitalInOutPin(92) return DigitalInOut of led2_GPassLED
whismanoid 18:1235c17b451e 3191 const int pin_LED_3 = 93; // support find_digitalInOutPin(93) return DigitalInOut of led3_BBusyLED
whismanoid 17:9397ea3ea7e9 3192 #endif
whismanoid 17:9397ea3ea7e9 3193 const int ACTION_TABLE_ROW_MAX = 20;
whismanoid 17:9397ea3ea7e9 3194 #if MAX40108_DEMO
whismanoid 17:9397ea3ea7e9 3195 bool Datalogger_action_table_enabled = true;
whismanoid 45:74bf1fe021e5 3196 int Datalogger_action_table_row_count = 10; // assert (Datalogger_action_table_row_count <= ACTION_TABLE_ROW_MAX)
whismanoid 17:9397ea3ea7e9 3197 #else // MAX40108_DEMO
whismanoid 17:9397ea3ea7e9 3198 int Datalogger_action_table_row_count = 0;
whismanoid 17:9397ea3ea7e9 3199 #endif // MAX40108_DEMO
whismanoid 45:74bf1fe021e5 3200 // configurable "business logic" for the data log
whismanoid 17:9397ea3ea7e9 3201 action_table_row_t Datalogger_action_table[ACTION_TABLE_ROW_MAX] = {
whismanoid 17:9397ea3ea7e9 3202 #if MAX40108_DEMO
whismanoid 45:74bf1fe021e5 3203 //
whismanoid 45:74bf1fe021e5 3204 // LED1 indicator on if (WE > 0.85V)
whismanoid 57:9bc5ad707216 3205 // L@0 act=1 pin=91 if=1 ch=2 x=450.0000 -- Lpin=91 if A2 > 450.00 A2gtX=450.00 WE=0.77626
whismanoid 57:9bc5ad707216 3206 {action_digitalOutLow, pin_LED_1, condition_if_An_gt_threshold, channel_WE, 450.0000},
whismanoid 45:74bf1fe021e5 3207 //
whismanoid 45:74bf1fe021e5 3208 // LED1 indicator off if (WE < 0.80V)
whismanoid 57:9bc5ad707216 3209 // L@1 act=2 pin=91 if=2 ch=2 x=350.0000 -- Hpin=91 if A2 < 350.00 A2ltX=350.00 WE=0.76626
whismanoid 57:9bc5ad707216 3210 {action_digitalOutHigh, pin_LED_1, condition_if_An_lt_threshold, channel_WE, 350.00},
whismanoid 45:74bf1fe021e5 3211 //
whismanoid 45:74bf1fe021e5 3212 // LED2 indicator on if (WE > 0.75V)
whismanoid 57:9bc5ad707216 3213 // L@2 act=1 pin=92 if=1 ch=2 x=110.0000 -- Lpin=92 if A2 > 110.00 A2gtX=110.00 WE=0.74226
whismanoid 57:9bc5ad707216 3214 {action_digitalOutLow, pin_LED_2, condition_if_An_gt_threshold, channel_WE, 110.00},
whismanoid 17:9397ea3ea7e9 3215 //
whismanoid 45:74bf1fe021e5 3216 // LED2 indicator off if (WE < 0.70V)
whismanoid 57:9bc5ad707216 3217 // L@3 act=2 pin=92 if=2 ch=2 x=90.0000 -- Hpin=92 if A2 < 90.00 A2ltX=90.00 WE=0.74026
whismanoid 57:9bc5ad707216 3218 {action_digitalOutHigh, pin_LED_2, condition_if_An_lt_threshold, channel_WE, 90.00},
whismanoid 17:9397ea3ea7e9 3219 //
whismanoid 45:74bf1fe021e5 3220 // LED3 indicator on if (WE > 0.65V)
whismanoid 57:9bc5ad707216 3221 // L@4 act=1 pin=93 if=1 ch=2 x=45.0000 -- Lpin=93 if A2 > 45.00 A2gtX=45.00 WE=0.73576
whismanoid 57:9bc5ad707216 3222 {action_digitalOutLow, pin_LED_3, condition_if_An_gt_threshold, channel_WE, 45.00},
whismanoid 45:74bf1fe021e5 3223 //
whismanoid 45:74bf1fe021e5 3224 // LED3 indicator off if (WE < 0.60V)
whismanoid 57:9bc5ad707216 3225 // L@5 act=2 pin=93 if=2 ch=2 x=35.0000 -- Hpin=93 if A2 < 35.00 A2ltX=35.00 WE=0.73476
whismanoid 57:9bc5ad707216 3226 {action_digitalOutHigh, pin_LED_3, condition_if_An_lt_threshold, channel_WE, 35.00},
whismanoid 45:74bf1fe021e5 3227 //
whismanoid 45:74bf1fe021e5 3228 // Free run if (WE > 0.70V)
whismanoid 57:9bc5ad707216 3229 // L@6 act=5 if=1 ch=2 x=45.0000 -- run_LR if A2 > 45.00 A2gtX=45.00 WE=0.73576
whismanoid 57:9bc5ad707216 3230 {action_trigger_FreeRun, 0, condition_if_An_gt_threshold, channel_WE, 45.00},
whismanoid 17:9397ea3ea7e9 3231 //
whismanoid 45:74bf1fe021e5 3232 // Deep Sleep if (WE < 0.60V)
whismanoid 57:9bc5ad707216 3233 // L@7 act=6 if=2 ch=2 x=35.0000 -- LT count=10 base=500ms sleep=1 if A2 < 35.00 A2ltX=35.00 WE=0.73476
whismanoid 57:9bc5ad707216 3234 {action_trigger_Timer, 0, condition_if_An_lt_threshold, channel_WE, 35.00},
whismanoid 18:1235c17b451e 3235 //
whismanoid 45:74bf1fe021e5 3236 // Free run if (WE > 0.70V)
whismanoid 57:9bc5ad707216 3237 // L@8 act=3 pin=4 if=1 ch=2 x=45.0000 -- btn=4 %B4! if A2 > 45.00 A2gtX=45.00 WE=0.73576
whismanoid 57:9bc5ad707216 3238 {action_button, 4, condition_if_An_gt_threshold, channel_WE, 45.00},
whismanoid 29:6a9edb6e973b 3239 //
whismanoid 45:74bf1fe021e5 3240 // Deep Sleep if (WE < 0.60V)
whismanoid 57:9bc5ad707216 3241 // L@9 act=3 pin=5 if=2 ch=2 x=35.0000 -- btn=5 %B5! if A2 < 35.00 A2ltX=35.00 WE=0.73476
whismanoid 57:9bc5ad707216 3242 {action_button, 5, condition_if_An_lt_threshold, channel_WE, 35.00},
whismanoid 29:6a9edb6e973b 3243 //
whismanoid 17:9397ea3ea7e9 3244 #endif // MAX40108_DEMO
whismanoid 17:9397ea3ea7e9 3245 //
whismanoid 17:9397ea3ea7e9 3246 {action_noop, 0, condition_always, 0, 0},
whismanoid 17:9397ea3ea7e9 3247 };
whismanoid 17:9397ea3ea7e9 3248 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 3249
whismanoid 17:9397ea3ea7e9 3250 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 3251 // print column header banner for csv data columns
whismanoid 8:dffee7509bfb 3252 uint8_t Datalogger_Need_PrintHeader = true;
whismanoid 9:45f98573eb6d 3253 uint8_t need_reinit = true;
whismanoid 8:dffee7509bfb 3254 void Datalogger_PrintHeader(CmdLine& cmdLine);
whismanoid 5:aaf8b5f5fda1 3255 void Datalogger_AcquireRow();
whismanoid 17:9397ea3ea7e9 3256 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 3257 // TODO: Datalogger_RunActionTable() between Datalogger_AcquireRow() and Datalogger_PrintRow()
whismanoid 17:9397ea3ea7e9 3258 void Datalogger_RunActionTable();
whismanoid 17:9397ea3ea7e9 3259 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 8:dffee7509bfb 3260 void Datalogger_PrintRow(CmdLine& cmdLine);
whismanoid 4:d9b05924ad4c 3261
whismanoid 4:d9b05924ad4c 3262 //--------------------------------------------------
whismanoid 51:a41d3fd5e441 3263 // MAX32625 flash peek/poke support (MAX40108 demo) #312 - forward declarations for flash_page_configuration_back_up
whismanoid 51:a41d3fd5e441 3264 extern int Platform_AIN_Average_N; // forward declaration
whismanoid 51:a41d3fd5e441 3265 //
whismanoid 51:a41d3fd5e441 3266 extern const int COMMAND_TABLE_COL_MAX; // forward declaration
whismanoid 51:a41d3fd5e441 3267 extern char onButton1_command_table_00[];
whismanoid 51:a41d3fd5e441 3268 extern char onButton1_command_table_01[];
whismanoid 51:a41d3fd5e441 3269 extern char onButton1_command_table_02[];
whismanoid 51:a41d3fd5e441 3270 extern char onButton1_command_table_03[];
whismanoid 51:a41d3fd5e441 3271 extern char onButton1_command_table_04[];
whismanoid 51:a41d3fd5e441 3272 extern char onButton1_command_table_05[];
whismanoid 51:a41d3fd5e441 3273 extern char onButton1_command_table_06[];
whismanoid 51:a41d3fd5e441 3274 extern char onButton1_command_table_07[];
whismanoid 51:a41d3fd5e441 3275 extern char onButton1_command_table_08[];
whismanoid 51:a41d3fd5e441 3276 extern char onButton1_command_table_09[];
whismanoid 51:a41d3fd5e441 3277 //
whismanoid 51:a41d3fd5e441 3278 extern char onButton2_command_table_00[];
whismanoid 51:a41d3fd5e441 3279 extern char onButton2_command_table_01[];
whismanoid 51:a41d3fd5e441 3280 extern char onButton2_command_table_02[];
whismanoid 51:a41d3fd5e441 3281 extern char onButton2_command_table_03[];
whismanoid 51:a41d3fd5e441 3282 extern char onButton2_command_table_04[];
whismanoid 51:a41d3fd5e441 3283 extern char onButton2_command_table_05[];
whismanoid 51:a41d3fd5e441 3284 extern char onButton2_command_table_06[];
whismanoid 51:a41d3fd5e441 3285 extern char onButton2_command_table_07[];
whismanoid 51:a41d3fd5e441 3286 extern char onButton2_command_table_08[];
whismanoid 51:a41d3fd5e441 3287 extern char onButton2_command_table_09[];
whismanoid 51:a41d3fd5e441 3288 //
whismanoid 51:a41d3fd5e441 3289 extern char onButton3_command_table_00[];
whismanoid 51:a41d3fd5e441 3290 extern char onButton3_command_table_01[];
whismanoid 51:a41d3fd5e441 3291 extern char onButton3_command_table_02[];
whismanoid 51:a41d3fd5e441 3292 extern char onButton3_command_table_03[];
whismanoid 51:a41d3fd5e441 3293 extern char onButton3_command_table_04[];
whismanoid 51:a41d3fd5e441 3294 extern char onButton3_command_table_05[];
whismanoid 51:a41d3fd5e441 3295 extern char onButton3_command_table_06[];
whismanoid 51:a41d3fd5e441 3296 extern char onButton3_command_table_07[];
whismanoid 51:a41d3fd5e441 3297 extern char onButton3_command_table_08[];
whismanoid 51:a41d3fd5e441 3298 extern char onButton3_command_table_09[];
whismanoid 51:a41d3fd5e441 3299 //
whismanoid 51:a41d3fd5e441 3300 extern char onButton4_command_table_00[];
whismanoid 51:a41d3fd5e441 3301 extern char onButton4_command_table_01[];
whismanoid 51:a41d3fd5e441 3302 extern char onButton4_command_table_02[];
whismanoid 51:a41d3fd5e441 3303 extern char onButton4_command_table_03[];
whismanoid 51:a41d3fd5e441 3304 extern char onButton4_command_table_04[];
whismanoid 51:a41d3fd5e441 3305 extern char onButton4_command_table_05[];
whismanoid 51:a41d3fd5e441 3306 extern char onButton4_command_table_06[];
whismanoid 51:a41d3fd5e441 3307 extern char onButton4_command_table_07[];
whismanoid 51:a41d3fd5e441 3308 extern char onButton4_command_table_08[];
whismanoid 51:a41d3fd5e441 3309 extern char onButton4_command_table_09[];
whismanoid 51:a41d3fd5e441 3310 //
whismanoid 51:a41d3fd5e441 3311 extern char onButton5_command_table_00[];
whismanoid 51:a41d3fd5e441 3312 extern char onButton5_command_table_01[];
whismanoid 51:a41d3fd5e441 3313 extern char onButton5_command_table_02[];
whismanoid 51:a41d3fd5e441 3314 extern char onButton5_command_table_03[];
whismanoid 51:a41d3fd5e441 3315 extern char onButton5_command_table_04[];
whismanoid 51:a41d3fd5e441 3316 extern char onButton5_command_table_05[];
whismanoid 51:a41d3fd5e441 3317 extern char onButton5_command_table_06[];
whismanoid 51:a41d3fd5e441 3318 extern char onButton5_command_table_07[];
whismanoid 51:a41d3fd5e441 3319 extern char onButton5_command_table_08[];
whismanoid 51:a41d3fd5e441 3320 extern char onButton5_command_table_09[];
whismanoid 51:a41d3fd5e441 3321 //
whismanoid 51:a41d3fd5e441 3322 extern char onButton6_command_table_00[];
whismanoid 51:a41d3fd5e441 3323 extern char onButton6_command_table_01[];
whismanoid 51:a41d3fd5e441 3324 extern char onButton6_command_table_02[];
whismanoid 51:a41d3fd5e441 3325 extern char onButton6_command_table_03[];
whismanoid 51:a41d3fd5e441 3326 extern char onButton6_command_table_04[];
whismanoid 51:a41d3fd5e441 3327 extern char onButton6_command_table_05[];
whismanoid 51:a41d3fd5e441 3328 extern char onButton6_command_table_06[];
whismanoid 51:a41d3fd5e441 3329 extern char onButton6_command_table_07[];
whismanoid 51:a41d3fd5e441 3330 extern char onButton6_command_table_08[];
whismanoid 51:a41d3fd5e441 3331 extern char onButton6_command_table_09[];
whismanoid 51:a41d3fd5e441 3332 //
whismanoid 51:a41d3fd5e441 3333 extern char onButton7_command_table_00[];
whismanoid 51:a41d3fd5e441 3334 extern char onButton7_command_table_01[];
whismanoid 51:a41d3fd5e441 3335 extern char onButton7_command_table_02[];
whismanoid 51:a41d3fd5e441 3336 extern char onButton7_command_table_03[];
whismanoid 51:a41d3fd5e441 3337 extern char onButton7_command_table_04[];
whismanoid 51:a41d3fd5e441 3338 extern char onButton7_command_table_05[];
whismanoid 51:a41d3fd5e441 3339 extern char onButton7_command_table_06[];
whismanoid 51:a41d3fd5e441 3340 extern char onButton7_command_table_07[];
whismanoid 51:a41d3fd5e441 3341 extern char onButton7_command_table_08[];
whismanoid 51:a41d3fd5e441 3342 extern char onButton7_command_table_09[];
whismanoid 51:a41d3fd5e441 3343 //
whismanoid 51:a41d3fd5e441 3344 extern char onButton8_command_table_00[];
whismanoid 51:a41d3fd5e441 3345 extern char onButton8_command_table_01[];
whismanoid 51:a41d3fd5e441 3346 extern char onButton8_command_table_02[];
whismanoid 51:a41d3fd5e441 3347 extern char onButton8_command_table_03[];
whismanoid 51:a41d3fd5e441 3348 extern char onButton8_command_table_04[];
whismanoid 51:a41d3fd5e441 3349 extern char onButton8_command_table_05[];
whismanoid 51:a41d3fd5e441 3350 extern char onButton8_command_table_06[];
whismanoid 51:a41d3fd5e441 3351 extern char onButton8_command_table_07[];
whismanoid 51:a41d3fd5e441 3352 extern char onButton8_command_table_08[];
whismanoid 51:a41d3fd5e441 3353 extern char onButton8_command_table_09[];
whismanoid 51:a41d3fd5e441 3354 //
whismanoid 51:a41d3fd5e441 3355 extern char onButton9_command_table_00[];
whismanoid 51:a41d3fd5e441 3356 extern char onButton9_command_table_01[];
whismanoid 51:a41d3fd5e441 3357 extern char onButton9_command_table_02[];
whismanoid 51:a41d3fd5e441 3358 extern char onButton9_command_table_03[];
whismanoid 51:a41d3fd5e441 3359 extern char onButton9_command_table_04[];
whismanoid 51:a41d3fd5e441 3360 extern char onButton9_command_table_05[];
whismanoid 51:a41d3fd5e441 3361 extern char onButton9_command_table_06[];
whismanoid 51:a41d3fd5e441 3362 extern char onButton9_command_table_07[];
whismanoid 51:a41d3fd5e441 3363 extern char onButton9_command_table_08[];
whismanoid 51:a41d3fd5e441 3364 extern char onButton9_command_table_09[];
whismanoid 51:a41d3fd5e441 3365 //
whismanoid 58:9b1e13e0527d 3366 // need forward declaration of Platform_Enable_ch #380
whismanoid 58:9b1e13e0527d 3367 extern uint8_t Platform_Enable_ch[]; // forward declaration
whismanoid 58:9b1e13e0527d 3368 //
whismanoid 55:477ba09475d7 3369 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 3370 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_customChannelHeader_ch forward declaration
whismanoid 55:477ba09475d7 3371 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 3372 //
whismanoid 55:477ba09475d7 3373 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 3374 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_AIN_customChannelHeader_ch forward declaration
whismanoid 55:477ba09475d7 3375 extern char Platform_AIN_customChannelHeader_ch0[];
whismanoid 55:477ba09475d7 3376 extern char Platform_AIN_customChannelHeader_ch1[];
whismanoid 55:477ba09475d7 3377 extern char Platform_AIN_customChannelHeader_ch2[];
whismanoid 55:477ba09475d7 3378 extern char Platform_AIN_customChannelHeader_ch3[];
whismanoid 55:477ba09475d7 3379 extern char Platform_AIN_customChannelHeader_ch4[];
whismanoid 55:477ba09475d7 3380 extern char Platform_AIN_customChannelHeader_ch5[];
whismanoid 55:477ba09475d7 3381 extern double Platform_MathOffsetA[];
whismanoid 55:477ba09475d7 3382 extern double Platform_MathGainMulA[];
whismanoid 55:477ba09475d7 3383 extern double Platform_MathGainDivA[];
whismanoid 55:477ba09475d7 3384 extern char Platform_MathUnitString_ch0[];
whismanoid 55:477ba09475d7 3385 extern char Platform_MathUnitString_ch1[];
whismanoid 55:477ba09475d7 3386 extern char Platform_MathUnitString_ch2[];
whismanoid 55:477ba09475d7 3387 extern char Platform_MathUnitString_ch3[];
whismanoid 55:477ba09475d7 3388 extern char Platform_MathUnitString_ch4[];
whismanoid 55:477ba09475d7 3389 extern char Platform_MathUnitString_ch5[];
whismanoid 55:477ba09475d7 3390 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 3391 //
whismanoid 46:469d0061df5d 3392 // MAX32625 flash peek/poke support (MAX40108 demo) #312
whismanoid 46:469d0061df5d 3393 #if HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 3394 // WIP #312 flash_page_configuration_back_up[] records map to variables
whismanoid 46:469d0061df5d 3395 typedef struct {
whismanoid 46:469d0061df5d 3396 uint32_t recordType; // unique record type for each variable, 0 end of list, -1 blank record
whismanoid 46:469d0061df5d 3397 void* addr;
whismanoid 51:a41d3fd5e441 3398 uint32_t length_bytes; // must be multiple of 4 bytes
whismanoid 46:469d0061df5d 3399 const char* name;
whismanoid 46:469d0061df5d 3400 } configuration_back_up_t;
whismanoid 51:a41d3fd5e441 3401 // WIP #312 unique recordType key values are defined by configuration_back_up_list[]
whismanoid 46:469d0061df5d 3402 configuration_back_up_t configuration_back_up_list[] = {
whismanoid 55:477ba09475d7 3403 { flash_blank_ff, NULL, 0, "blank" }, // Ignore 0xFFFFFFFF blank records
whismanoid 47:f1a56afb4aca 3404 //
whismanoid 47:f1a56afb4aca 3405 #ifdef BOARD_SERIAL_NUMBER
whismanoid 47:f1a56afb4aca 3406 // WIP #312 flash load/save g_board_serial_number BOARD_SERIAL_NUMBER
whismanoid 55:477ba09475d7 3407 { flash_g_board_serial_number, &g_board_serial_number, sizeof(g_board_serial_number), "g_board_serial_number" },
whismanoid 47:f1a56afb4aca 3408 #endif // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 47:f1a56afb4aca 3409 // WIP #312 flash load/save board ID string message
whismanoid 47:f1a56afb4aca 3410 //
whismanoid 55:477ba09475d7 3411 { flash_calibration_05_V0, &calibration_05_V[0], sizeof(calibration_05_V[0]), "calibration_05_V[0]" },
whismanoid 55:477ba09475d7 3412 { flash_calibration_05_V1, &calibration_05_V[1], sizeof(calibration_05_V[1]), "calibration_05_V[1]" },
whismanoid 55:477ba09475d7 3413 { flash_calibration_05_V2, &calibration_05_V[2], sizeof(calibration_05_V[2]), "calibration_05_V[2]" },
whismanoid 55:477ba09475d7 3414 { flash_calibration_05_V3, &calibration_05_V[3], sizeof(calibration_05_V[3]), "calibration_05_V[3]" },
whismanoid 55:477ba09475d7 3415 { flash_calibration_05_V4, &calibration_05_V[4], sizeof(calibration_05_V[4]), "calibration_05_V[4]" },
whismanoid 55:477ba09475d7 3416 { flash_calibration_05_V5, &calibration_05_V[5], sizeof(calibration_05_V[5]), "calibration_05_V[5]" },
whismanoid 55:477ba09475d7 3417 { flash_calibration_05_normValue_0_10, &calibration_05_normValue_0_1[0], sizeof(calibration_05_normValue_0_1[0]), "calibration_05_normValue_0_1[0]" },
whismanoid 55:477ba09475d7 3418 { flash_calibration_05_normValue_0_11, &calibration_05_normValue_0_1[1], sizeof(calibration_05_normValue_0_1[1]), "calibration_05_normValue_0_1[1]" },
whismanoid 55:477ba09475d7 3419 { flash_calibration_05_normValue_0_12, &calibration_05_normValue_0_1[2], sizeof(calibration_05_normValue_0_1[2]), "calibration_05_normValue_0_1[2]" },
whismanoid 55:477ba09475d7 3420 { flash_calibration_05_normValue_0_13, &calibration_05_normValue_0_1[3], sizeof(calibration_05_normValue_0_1[3]), "calibration_05_normValue_0_1[3]" },
whismanoid 55:477ba09475d7 3421 { flash_calibration_05_normValue_0_14, &calibration_05_normValue_0_1[4], sizeof(calibration_05_normValue_0_1[4]), "calibration_05_normValue_0_1[4]" },
whismanoid 55:477ba09475d7 3422 { flash_calibration_05_normValue_0_15, &calibration_05_normValue_0_1[5], sizeof(calibration_05_normValue_0_1[5]), "calibration_05_normValue_0_1[5]" },
whismanoid 55:477ba09475d7 3423 { flash_calibration_95_V0, &calibration_95_V[0], sizeof(calibration_95_V[0]), "calibration_95_V[0]" },
whismanoid 55:477ba09475d7 3424 { flash_calibration_95_V1, &calibration_95_V[1], sizeof(calibration_95_V[1]), "calibration_95_V[1]" },
whismanoid 55:477ba09475d7 3425 { flash_calibration_95_V2, &calibration_95_V[2], sizeof(calibration_95_V[2]), "calibration_95_V[2]" },
whismanoid 55:477ba09475d7 3426 { flash_calibration_95_V3, &calibration_95_V[3], sizeof(calibration_95_V[3]), "calibration_95_V[3]" },
whismanoid 55:477ba09475d7 3427 { flash_calibration_95_V4, &calibration_95_V[4], sizeof(calibration_95_V[4]), "calibration_95_V[4]" },
whismanoid 55:477ba09475d7 3428 { flash_calibration_95_V5, &calibration_95_V[5], sizeof(calibration_95_V[5]), "calibration_95_V[5]" },
whismanoid 55:477ba09475d7 3429 { flash_calibration_95_normValue_0_10, &calibration_95_normValue_0_1[0], sizeof(calibration_95_normValue_0_1[0]), "calibration_95_normValue_0_1[0]" },
whismanoid 55:477ba09475d7 3430 { flash_calibration_95_normValue_0_11, &calibration_95_normValue_0_1[1], sizeof(calibration_95_normValue_0_1[1]), "calibration_95_normValue_0_1[1]" },
whismanoid 55:477ba09475d7 3431 { flash_calibration_95_normValue_0_12, &calibration_95_normValue_0_1[2], sizeof(calibration_95_normValue_0_1[2]), "calibration_95_normValue_0_1[2]" },
whismanoid 55:477ba09475d7 3432 { flash_calibration_95_normValue_0_13, &calibration_95_normValue_0_1[3], sizeof(calibration_95_normValue_0_1[3]), "calibration_95_normValue_0_1[3]" },
whismanoid 55:477ba09475d7 3433 { flash_calibration_95_normValue_0_14, &calibration_95_normValue_0_1[4], sizeof(calibration_95_normValue_0_1[4]), "calibration_95_normValue_0_1[4]" },
whismanoid 55:477ba09475d7 3434 { flash_calibration_95_normValue_0_15, &calibration_95_normValue_0_1[5], sizeof(calibration_95_normValue_0_1[5]), "calibration_95_normValue_0_1[5]" },
whismanoid 47:f1a56afb4aca 3435 //
whismanoid 51:a41d3fd5e441 3436 // forward declaration
whismanoid 55:477ba09475d7 3437 { flash_Platform_AIN_Average_N, &Platform_AIN_Average_N, sizeof(Platform_AIN_Average_N), "Platform_AIN_Average_N" },
whismanoid 51:a41d3fd5e441 3438 //
whismanoid 46:469d0061df5d 3439 // WIP #312 @L Datalogger_action_table_row_count
whismanoid 55:477ba09475d7 3440 { flash_Datalogger_action_table_row_count, &Datalogger_action_table_row_count, sizeof(Datalogger_action_table_row_count), "Datalogger_action_table_row_count" },
whismanoid 51:a41d3fd5e441 3441 // WIP #312 @L Datalogger_action_table_enabled - only 1 byte, write will fail
whismanoid 55:477ba09475d7 3442 // { 0x01000353, &Datalogger_action_table_enabled, sizeof(Datalogger_action_table_enabled), "Datalogger_action_table_enabled" },
whismanoid 46:469d0061df5d 3443 // WIP #312 @L Datalogger_action_table[0] __ bytes
whismanoid 55:477ba09475d7 3444 { flash_Datalogger_action_table, &Datalogger_action_table, sizeof(Datalogger_action_table), "Datalogger_action_table" },
whismanoid 55:477ba09475d7 3445 //{ 0x08____53, &Datalogger_action_table[1], sizeof(Datalogger_action_table[1]), "Datalogger_action_table[1]" },
whismanoid 47:f1a56afb4aca 3446 //
whismanoid 51:a41d3fd5e441 3447 // forward declaration
whismanoid 51:a41d3fd5e441 3448 // WIP #312 %B onButton1_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3449 { flash_onButton1_command_table_00, &onButton1_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_00" },
whismanoid 55:477ba09475d7 3450 { flash_onButton1_command_table_01, &onButton1_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_01" },
whismanoid 55:477ba09475d7 3451 { flash_onButton1_command_table_02, &onButton1_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_02" },
whismanoid 55:477ba09475d7 3452 { flash_onButton1_command_table_03, &onButton1_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_03" },
whismanoid 55:477ba09475d7 3453 { flash_onButton1_command_table_04, &onButton1_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_04" },
whismanoid 55:477ba09475d7 3454 { flash_onButton1_command_table_05, &onButton1_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_05" },
whismanoid 55:477ba09475d7 3455 { flash_onButton1_command_table_06, &onButton1_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_06" },
whismanoid 55:477ba09475d7 3456 { flash_onButton1_command_table_07, &onButton1_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_07" },
whismanoid 55:477ba09475d7 3457 { flash_onButton1_command_table_08, &onButton1_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_08" },
whismanoid 55:477ba09475d7 3458 { flash_onButton1_command_table_09, &onButton1_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_09" },
whismanoid 51:a41d3fd5e441 3459 // WIP #312 %B onButton2_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3460 { flash_onButton2_command_table_00, &onButton2_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_00" },
whismanoid 55:477ba09475d7 3461 { flash_onButton2_command_table_01, &onButton2_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_01" },
whismanoid 55:477ba09475d7 3462 { flash_onButton2_command_table_02, &onButton2_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_02" },
whismanoid 55:477ba09475d7 3463 { flash_onButton2_command_table_03, &onButton2_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_03" },
whismanoid 55:477ba09475d7 3464 { flash_onButton2_command_table_04, &onButton2_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_04" },
whismanoid 55:477ba09475d7 3465 { flash_onButton2_command_table_05, &onButton2_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_05" },
whismanoid 55:477ba09475d7 3466 { flash_onButton2_command_table_06, &onButton2_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_06" },
whismanoid 55:477ba09475d7 3467 { flash_onButton2_command_table_07, &onButton2_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_07" },
whismanoid 55:477ba09475d7 3468 { flash_onButton2_command_table_08, &onButton2_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_08" },
whismanoid 55:477ba09475d7 3469 { flash_onButton2_command_table_09, &onButton2_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_09" },
whismanoid 51:a41d3fd5e441 3470 // WIP #312 %B onButton3_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3471 { flash_onButton3_command_table_00, &onButton3_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_00" },
whismanoid 55:477ba09475d7 3472 { flash_onButton3_command_table_01, &onButton3_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_01" },
whismanoid 55:477ba09475d7 3473 { flash_onButton3_command_table_02, &onButton3_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_02" },
whismanoid 55:477ba09475d7 3474 { flash_onButton3_command_table_03, &onButton3_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_03" },
whismanoid 55:477ba09475d7 3475 { flash_onButton3_command_table_04, &onButton3_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_04" },
whismanoid 55:477ba09475d7 3476 { flash_onButton3_command_table_05, &onButton3_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_05" },
whismanoid 55:477ba09475d7 3477 { flash_onButton3_command_table_06, &onButton3_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_06" },
whismanoid 55:477ba09475d7 3478 { flash_onButton3_command_table_07, &onButton3_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_07" },
whismanoid 55:477ba09475d7 3479 { flash_onButton3_command_table_08, &onButton3_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_08" },
whismanoid 55:477ba09475d7 3480 { flash_onButton3_command_table_09, &onButton3_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_09" },
whismanoid 51:a41d3fd5e441 3481 // WIP #312 %B onButton4_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3482 { flash_onButton4_command_table_00, &onButton4_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_00" },
whismanoid 55:477ba09475d7 3483 { flash_onButton4_command_table_01, &onButton4_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_01" },
whismanoid 55:477ba09475d7 3484 { flash_onButton4_command_table_02, &onButton4_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_02" },
whismanoid 55:477ba09475d7 3485 { flash_onButton4_command_table_03, &onButton4_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_03" },
whismanoid 55:477ba09475d7 3486 { flash_onButton4_command_table_04, &onButton4_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_04" },
whismanoid 55:477ba09475d7 3487 { flash_onButton4_command_table_05, &onButton4_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_05" },
whismanoid 55:477ba09475d7 3488 { flash_onButton4_command_table_06, &onButton4_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_06" },
whismanoid 55:477ba09475d7 3489 { flash_onButton4_command_table_07, &onButton4_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_07" },
whismanoid 55:477ba09475d7 3490 { flash_onButton4_command_table_08, &onButton4_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_08" },
whismanoid 55:477ba09475d7 3491 { flash_onButton4_command_table_09, &onButton4_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_09" },
whismanoid 51:a41d3fd5e441 3492 // WIP #312 %B onButton5_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3493 { flash_onButton5_command_table_00, &onButton5_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_00" },
whismanoid 55:477ba09475d7 3494 { flash_onButton5_command_table_01, &onButton5_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_01" },
whismanoid 55:477ba09475d7 3495 { flash_onButton5_command_table_02, &onButton5_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_02" },
whismanoid 55:477ba09475d7 3496 { flash_onButton5_command_table_03, &onButton5_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_03" },
whismanoid 55:477ba09475d7 3497 { flash_onButton5_command_table_04, &onButton5_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_04" },
whismanoid 55:477ba09475d7 3498 { flash_onButton5_command_table_05, &onButton5_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_05" },
whismanoid 55:477ba09475d7 3499 { flash_onButton5_command_table_06, &onButton5_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_06" },
whismanoid 55:477ba09475d7 3500 { flash_onButton5_command_table_07, &onButton5_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_07" },
whismanoid 55:477ba09475d7 3501 { flash_onButton5_command_table_08, &onButton5_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_08" },
whismanoid 55:477ba09475d7 3502 { flash_onButton5_command_table_09, &onButton5_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_09" },
whismanoid 51:a41d3fd5e441 3503 // WIP #312 %B onButton6_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3504 { flash_onButton6_command_table_00, &onButton6_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_00" },
whismanoid 55:477ba09475d7 3505 { flash_onButton6_command_table_01, &onButton6_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_01" },
whismanoid 55:477ba09475d7 3506 { flash_onButton6_command_table_02, &onButton6_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_02" },
whismanoid 55:477ba09475d7 3507 { flash_onButton6_command_table_03, &onButton6_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_03" },
whismanoid 55:477ba09475d7 3508 { flash_onButton6_command_table_04, &onButton6_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_04" },
whismanoid 55:477ba09475d7 3509 { flash_onButton6_command_table_05, &onButton6_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_05" },
whismanoid 55:477ba09475d7 3510 { flash_onButton6_command_table_06, &onButton6_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_06" },
whismanoid 55:477ba09475d7 3511 { flash_onButton6_command_table_07, &onButton6_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_07" },
whismanoid 55:477ba09475d7 3512 { flash_onButton6_command_table_08, &onButton6_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_08" },
whismanoid 55:477ba09475d7 3513 { flash_onButton6_command_table_09, &onButton6_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_09" },
whismanoid 51:a41d3fd5e441 3514 // WIP #312 %B onButton7_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3515 { flash_onButton7_command_table_00, &onButton7_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_00" },
whismanoid 55:477ba09475d7 3516 { flash_onButton7_command_table_01, &onButton7_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_01" },
whismanoid 55:477ba09475d7 3517 { flash_onButton7_command_table_02, &onButton7_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_02" },
whismanoid 55:477ba09475d7 3518 { flash_onButton7_command_table_03, &onButton7_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_03" },
whismanoid 55:477ba09475d7 3519 { flash_onButton7_command_table_04, &onButton7_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_04" },
whismanoid 55:477ba09475d7 3520 { flash_onButton7_command_table_05, &onButton7_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_05" },
whismanoid 55:477ba09475d7 3521 { flash_onButton7_command_table_06, &onButton7_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_06" },
whismanoid 55:477ba09475d7 3522 { flash_onButton7_command_table_07, &onButton7_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_07" },
whismanoid 55:477ba09475d7 3523 { flash_onButton7_command_table_08, &onButton7_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_08" },
whismanoid 55:477ba09475d7 3524 { flash_onButton7_command_table_09, &onButton7_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_09" },
whismanoid 51:a41d3fd5e441 3525 // WIP #312 %B onButton8_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3526 { flash_onButton8_command_table_00, &onButton8_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_00" },
whismanoid 55:477ba09475d7 3527 { flash_onButton8_command_table_01, &onButton8_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_01" },
whismanoid 55:477ba09475d7 3528 { flash_onButton8_command_table_02, &onButton8_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_02" },
whismanoid 55:477ba09475d7 3529 { flash_onButton8_command_table_03, &onButton8_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_03" },
whismanoid 55:477ba09475d7 3530 { flash_onButton8_command_table_04, &onButton8_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_04" },
whismanoid 55:477ba09475d7 3531 { flash_onButton8_command_table_05, &onButton8_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_05" },
whismanoid 55:477ba09475d7 3532 { flash_onButton8_command_table_06, &onButton8_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_06" },
whismanoid 55:477ba09475d7 3533 { flash_onButton8_command_table_07, &onButton8_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_07" },
whismanoid 55:477ba09475d7 3534 { flash_onButton8_command_table_08, &onButton8_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_08" },
whismanoid 55:477ba09475d7 3535 { flash_onButton8_command_table_09, &onButton8_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_09" },
whismanoid 51:a41d3fd5e441 3536 // WIP #312 %B onButton9_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3537 { flash_onButton9_command_table_00, &onButton9_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_00" },
whismanoid 55:477ba09475d7 3538 { flash_onButton9_command_table_01, &onButton9_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_01" },
whismanoid 55:477ba09475d7 3539 { flash_onButton9_command_table_02, &onButton9_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_02" },
whismanoid 55:477ba09475d7 3540 { flash_onButton9_command_table_03, &onButton9_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_03" },
whismanoid 55:477ba09475d7 3541 { flash_onButton9_command_table_04, &onButton9_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_04" },
whismanoid 55:477ba09475d7 3542 { flash_onButton9_command_table_05, &onButton9_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_05" },
whismanoid 55:477ba09475d7 3543 { flash_onButton9_command_table_06, &onButton9_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_06" },
whismanoid 55:477ba09475d7 3544 { flash_onButton9_command_table_07, &onButton9_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_07" },
whismanoid 55:477ba09475d7 3545 { flash_onButton9_command_table_08, &onButton9_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_08" },
whismanoid 55:477ba09475d7 3546 { flash_onButton9_command_table_09, &onButton9_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_09" },
whismanoid 46:469d0061df5d 3547 // WIP #312 %B onButton9_command_table[0] __ bytes
whismanoid 47:f1a56afb4aca 3548 //
whismanoid 55:477ba09475d7 3549 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 3550 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_MathOffsetA
whismanoid 55:477ba09475d7 3551 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_MathGainMulA
whismanoid 55:477ba09475d7 3552 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_MathGainDivA
whismanoid 55:477ba09475d7 3553 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_MathUnitString
whismanoid 55:477ba09475d7 3554 //
whismanoid 55:477ba09475d7 3555 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 3556 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 3557 // { 0x08070053, &Platform_AIN_customChannelHeader_ch, sizeof(Platform_AIN_customChannelHeader_ch), "Platform_AIN_customChannelHeader_ch" },
whismanoid 55:477ba09475d7 3558 { flash_Platform_AIN_customChannelHeader_ch0, &Platform_AIN_customChannelHeader_ch0, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_AIN_customChannelHeader_ch0" },
whismanoid 55:477ba09475d7 3559 //
whismanoid 55:477ba09475d7 3560 { flash_Platform_AIN_customChannelHeader_ch1, &Platform_AIN_customChannelHeader_ch1, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_AIN_customChannelHeader_ch1" },
whismanoid 55:477ba09475d7 3561 { flash_Platform_AIN_customChannelHeader_ch2, &Platform_AIN_customChannelHeader_ch2, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_AIN_customChannelHeader_ch2" },
whismanoid 55:477ba09475d7 3562 { flash_Platform_AIN_customChannelHeader_ch3, &Platform_AIN_customChannelHeader_ch3, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_AIN_customChannelHeader_ch3" },
whismanoid 55:477ba09475d7 3563 { flash_Platform_AIN_customChannelHeader_ch4, &Platform_AIN_customChannelHeader_ch4, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_AIN_customChannelHeader_ch4" },
whismanoid 55:477ba09475d7 3564 { flash_Platform_AIN_customChannelHeader_ch5, &Platform_AIN_customChannelHeader_ch5, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_AIN_customChannelHeader_ch5" },
whismanoid 58:9b1e13e0527d 3565 //
whismanoid 58:9b1e13e0527d 3566 // flash header flash_Platform_Enable_ch012345 for `Platform_Enable_ch[0..5]` array #380
whismanoid 58:9b1e13e0527d 3567 // [Error] DataLogger_Internal.cpp@3526,40: 'Platform_Enable_ch' was not declared in this scope
whismanoid 58:9b1e13e0527d 3568 // need forward declaration of Platform_Enable_ch #380
whismanoid 58:9b1e13e0527d 3569 { flash_Platform_Enable_ch012345, &Platform_Enable_ch, 8, "Platform_Enable_ch[0..5]" },
whismanoid 58:9b1e13e0527d 3570 //
whismanoid 55:477ba09475d7 3571 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathOffsetA
whismanoid 55:477ba09475d7 3572 { flash_Platform_MathOffsetA0, &Platform_MathOffsetA[0], sizeof(Platform_MathOffsetA[0]), "Platform_MathOffsetA[0]" },
whismanoid 55:477ba09475d7 3573 { flash_Platform_MathOffsetA1, &Platform_MathOffsetA[1], sizeof(Platform_MathOffsetA[1]), "Platform_MathOffsetA[1]" },
whismanoid 55:477ba09475d7 3574 { flash_Platform_MathOffsetA2, &Platform_MathOffsetA[2], sizeof(Platform_MathOffsetA[2]), "Platform_MathOffsetA[2]" },
whismanoid 55:477ba09475d7 3575 { flash_Platform_MathOffsetA3, &Platform_MathOffsetA[3], sizeof(Platform_MathOffsetA[3]), "Platform_MathOffsetA[3]" },
whismanoid 55:477ba09475d7 3576 { flash_Platform_MathOffsetA4, &Platform_MathOffsetA[4], sizeof(Platform_MathOffsetA[4]), "Platform_MathOffsetA[4]" },
whismanoid 55:477ba09475d7 3577 { flash_Platform_MathOffsetA5, &Platform_MathOffsetA[5], sizeof(Platform_MathOffsetA[5]), "Platform_MathOffsetA[5]" },
whismanoid 55:477ba09475d7 3578 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathGainMulA
whismanoid 55:477ba09475d7 3579 { flash_Platform_MathGainMulA0, &Platform_MathGainMulA[0], sizeof(Platform_MathGainMulA[0]), "Platform_MathGainMulA[0]" },
whismanoid 55:477ba09475d7 3580 { flash_Platform_MathGainMulA1, &Platform_MathGainMulA[1], sizeof(Platform_MathGainMulA[1]), "Platform_MathGainMulA[1]" },
whismanoid 55:477ba09475d7 3581 { flash_Platform_MathGainMulA2, &Platform_MathGainMulA[2], sizeof(Platform_MathGainMulA[2]), "Platform_MathGainMulA[2]" },
whismanoid 55:477ba09475d7 3582 { flash_Platform_MathGainMulA3, &Platform_MathGainMulA[3], sizeof(Platform_MathGainMulA[3]), "Platform_MathGainMulA[3]" },
whismanoid 55:477ba09475d7 3583 { flash_Platform_MathGainMulA4, &Platform_MathGainMulA[4], sizeof(Platform_MathGainMulA[4]), "Platform_MathGainMulA[4]" },
whismanoid 55:477ba09475d7 3584 { flash_Platform_MathGainMulA5, &Platform_MathGainMulA[5], sizeof(Platform_MathGainMulA[5]), "Platform_MathGainMulA[5]" },
whismanoid 55:477ba09475d7 3585 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathGainDivA
whismanoid 55:477ba09475d7 3586 { flash_Platform_MathGainDivA0, &Platform_MathGainDivA[0], sizeof(Platform_MathGainDivA[0]), "Platform_MathGainDivA[0]" },
whismanoid 55:477ba09475d7 3587 { flash_Platform_MathGainDivA1, &Platform_MathGainDivA[1], sizeof(Platform_MathGainDivA[1]), "Platform_MathGainDivA[1]" },
whismanoid 55:477ba09475d7 3588 { flash_Platform_MathGainDivA2, &Platform_MathGainDivA[2], sizeof(Platform_MathGainDivA[2]), "Platform_MathGainDivA[2]" },
whismanoid 55:477ba09475d7 3589 { flash_Platform_MathGainDivA3, &Platform_MathGainDivA[3], sizeof(Platform_MathGainDivA[3]), "Platform_MathGainDivA[3]" },
whismanoid 55:477ba09475d7 3590 { flash_Platform_MathGainDivA4, &Platform_MathGainDivA[4], sizeof(Platform_MathGainDivA[4]), "Platform_MathGainDivA[4]" },
whismanoid 55:477ba09475d7 3591 { flash_Platform_MathGainDivA5, &Platform_MathGainDivA[5], sizeof(Platform_MathGainDivA[5]), "Platform_MathGainDivA[5]" },
whismanoid 55:477ba09475d7 3592 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathUnitString
whismanoid 55:477ba09475d7 3593 // { 0x08070453, &Platform_MathUnitString, sizeof(Platform_MathUnitString), "Platform_MathUnitString" },
whismanoid 55:477ba09475d7 3594 { flash_Platform_MathUnitString_ch0, &Platform_MathUnitString_ch0, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_MathUnitString_ch0" },
whismanoid 55:477ba09475d7 3595 { flash_Platform_MathUnitString_ch1, &Platform_MathUnitString_ch1, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_MathUnitString_ch1" },
whismanoid 55:477ba09475d7 3596 { flash_Platform_MathUnitString_ch2, &Platform_MathUnitString_ch2, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_MathUnitString_ch2" },
whismanoid 55:477ba09475d7 3597 { flash_Platform_MathUnitString_ch3, &Platform_MathUnitString_ch3, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_MathUnitString_ch3" },
whismanoid 55:477ba09475d7 3598 { flash_Platform_MathUnitString_ch4, &Platform_MathUnitString_ch4, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_MathUnitString_ch4" },
whismanoid 55:477ba09475d7 3599 { flash_Platform_MathUnitString_ch5, &Platform_MathUnitString_ch5, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_MathUnitString_ch5" },
whismanoid 55:477ba09475d7 3600 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 3601 //
whismanoid 55:477ba09475d7 3602 // MAX32625 flash peek/poke support (MAX40108 demo) #312 -- more items could be added here
whismanoid 55:477ba09475d7 3603 { flash_wiped_00, NULL, 0, "wiped" }, // Ignore 0x00000000 wiped records; end of table
whismanoid 46:469d0061df5d 3604 };
whismanoid 48:18647e0516f2 3605 const uint32_t save_arg_01_pageErase = 0x00000001; // page erase and rewrite
whismanoid 48:18647e0516f2 3606 const uint32_t load_arg_01_brief = 0x00000001; // brief list loaded values
whismanoid 48:18647e0516f2 3607 const uint32_t save_arg_02_verbose = 0x00000002; // verbose diagnostic messages
whismanoid 48:18647e0516f2 3608 const uint32_t save_arg_04_reserved = 0x00000004; // reserved
whismanoid 48:18647e0516f2 3609 const uint32_t save_arg_08_reserved = 0x00000008; // reserved
whismanoid 48:18647e0516f2 3610 const uint32_t save_arg_10_calibration = 0x00000010; // save board ID and calibration
whismanoid 48:18647e0516f2 3611 const uint32_t save_arg_20_action_table = 0x00000020; // save Datalogger_action_table
whismanoid 48:18647e0516f2 3612 const uint32_t save_arg_40_command_table = 0x00000040; // save onButtonX_command_table
whismanoid 48:18647e0516f2 3613 const uint32_t save_arg_80_reserved = 0x00000080; // reserved
whismanoid 55:477ba09475d7 3614 const uint32_t save_arg_100_reserved = 0x00000100; // reserved
whismanoid 55:477ba09475d7 3615 const uint32_t save_arg_200_reserved = 0x00000200; // reserved
whismanoid 55:477ba09475d7 3616 const uint32_t save_arg_400_reserved = 0x00000400; // reserved
whismanoid 55:477ba09475d7 3617 const uint32_t save_arg_800_reserved = 0x00000800; // reserved
whismanoid 55:477ba09475d7 3618 const uint32_t save_arg_1000_reserved = 0x000001000; // reserved
whismanoid 55:477ba09475d7 3619 const uint32_t save_arg_2000_reserved = 0x000002000; // reserved
whismanoid 55:477ba09475d7 3620 const uint32_t save_arg_4000_reserved = 0x000004000; // reserved
whismanoid 55:477ba09475d7 3621 const uint32_t save_arg_8000_reserved = 0x000008000; // reserved
whismanoid 48:18647e0516f2 3622 const uint32_t save_arg_default = 0
whismanoid 48:18647e0516f2 3623 | save_arg_01_pageErase
whismanoid 48:18647e0516f2 3624 // | save_arg_02_verbose
whismanoid 48:18647e0516f2 3625 // | save_arg_04_reserved
whismanoid 48:18647e0516f2 3626 // | save_arg_08_reserved
whismanoid 48:18647e0516f2 3627 | save_arg_10_calibration
whismanoid 48:18647e0516f2 3628 | save_arg_20_action_table
whismanoid 48:18647e0516f2 3629 | save_arg_40_command_table
whismanoid 48:18647e0516f2 3630 // | save_arg_80_reserved
whismanoid 55:477ba09475d7 3631 // | save_arg_100_reserved
whismanoid 55:477ba09475d7 3632 // | save_arg_200_reserved
whismanoid 55:477ba09475d7 3633 // | save_arg_400_reserved
whismanoid 55:477ba09475d7 3634 // | save_arg_800_reserved
whismanoid 55:477ba09475d7 3635 // | save_arg_1000_reserved
whismanoid 55:477ba09475d7 3636 // | save_arg_2000_reserved
whismanoid 55:477ba09475d7 3637 // | save_arg_4000_reserved
whismanoid 55:477ba09475d7 3638 // | save_arg_8000_reserved
whismanoid 48:18647e0516f2 3639 ;
whismanoid 48:18647e0516f2 3640 const uint32_t load_arg_default = 0
whismanoid 48:18647e0516f2 3641 | load_arg_01_brief
whismanoid 48:18647e0516f2 3642 | save_arg_02_verbose
whismanoid 48:18647e0516f2 3643 // | save_arg_04_reserved
whismanoid 48:18647e0516f2 3644 // | save_arg_08_reserved
whismanoid 48:18647e0516f2 3645 | save_arg_10_calibration
whismanoid 48:18647e0516f2 3646 | save_arg_20_action_table
whismanoid 48:18647e0516f2 3647 | save_arg_40_command_table
whismanoid 48:18647e0516f2 3648 // | save_arg_80_reserved
whismanoid 55:477ba09475d7 3649 // | save_arg_100_reserved
whismanoid 55:477ba09475d7 3650 // | save_arg_200_reserved
whismanoid 55:477ba09475d7 3651 // | save_arg_400_reserved
whismanoid 55:477ba09475d7 3652 // | save_arg_800_reserved
whismanoid 55:477ba09475d7 3653 // | save_arg_1000_reserved
whismanoid 55:477ba09475d7 3654 // | save_arg_2000_reserved
whismanoid 55:477ba09475d7 3655 // | save_arg_4000_reserved
whismanoid 55:477ba09475d7 3656 // | save_arg_8000_reserved
whismanoid 48:18647e0516f2 3657 ;
whismanoid 48:18647e0516f2 3658 const uint32_t load_arg_startup = 0
whismanoid 54:ba36cb18504f 3659 // | load_arg_01_brief
whismanoid 48:18647e0516f2 3660 // | save_arg_02_verbose
whismanoid 48:18647e0516f2 3661 // | save_arg_04_reserved
whismanoid 48:18647e0516f2 3662 // | save_arg_08_reserved
whismanoid 48:18647e0516f2 3663 | save_arg_10_calibration
whismanoid 48:18647e0516f2 3664 | save_arg_20_action_table
whismanoid 48:18647e0516f2 3665 | save_arg_40_command_table
whismanoid 48:18647e0516f2 3666 // | save_arg_80_reserved
whismanoid 55:477ba09475d7 3667 // | save_arg_100_reserved
whismanoid 55:477ba09475d7 3668 // | save_arg_200_reserved
whismanoid 55:477ba09475d7 3669 // | save_arg_400_reserved
whismanoid 55:477ba09475d7 3670 // | save_arg_800_reserved
whismanoid 55:477ba09475d7 3671 // | save_arg_1000_reserved
whismanoid 55:477ba09475d7 3672 // | save_arg_2000_reserved
whismanoid 55:477ba09475d7 3673 // | save_arg_4000_reserved
whismanoid 55:477ba09475d7 3674 // | save_arg_8000_reserved
whismanoid 48:18647e0516f2 3675 ;
whismanoid 46:469d0061df5d 3676 // WIP #312 store values into flash_page_configuration_back_up[] from calibration_05_V[] etc. Default save everything.
whismanoid 48:18647e0516f2 3677 // @param[in] save_arg %F save=0x00000001 = page erase and rewrite, else append in next available blank space within page
whismanoid 48:18647e0516f2 3678 // @param[in] save_arg %F save=0x00000002 = verbose diagnostic messages
whismanoid 48:18647e0516f2 3679 // @param[in] save_arg %F save=0x00000004 = reserved
whismanoid 48:18647e0516f2 3680 // @param[in] save_arg %F save=0x00000008 = reserved
whismanoid 48:18647e0516f2 3681 // @param[in] save_arg %F save=0x00000010 = save board ID and calibration
whismanoid 48:18647e0516f2 3682 // @param[in] save_arg %F save=0x00000020 = save Datalogger_action_table
whismanoid 48:18647e0516f2 3683 // @param[in] save_arg %F save=0x00000040 = save onButtonX_command_table
whismanoid 48:18647e0516f2 3684 // @param[in] save_arg %F save=0x00000080 = reserved
whismanoid 46:469d0061df5d 3685 int Save_flash_page_configuration_back_up(CmdLine& cmdLine, uint32_t save_arg)
whismanoid 46:469d0061df5d 3686 {
whismanoid 48:18647e0516f2 3687 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3688 {
whismanoid 48:18647e0516f2 3689 cmdLine.serial().printf("\r\nSave_flash_page_configuration_back_up(0x%8.8lx)...", save_arg);
whismanoid 48:18647e0516f2 3690 }
whismanoid 48:18647e0516f2 3691 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3692 {
whismanoid 48:18647e0516f2 3693 // @param[in] save_arg %F save=0x00000002 = verbose diagnostic messages
whismanoid 52:bb09c0f452ec 3694 if ((save_arg & save_arg_01_pageErase) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_01_pageErase", save_arg_01_pageErase); } else { cmdLine.serial().printf("\r\n ~0x%lx: no pageErase; append", save_arg_01_pageErase); }
whismanoid 49:359a6b9df7c1 3695 if ((save_arg & save_arg_02_verbose) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_02_verbose", save_arg_02_verbose); }
whismanoid 49:359a6b9df7c1 3696 if ((save_arg & save_arg_04_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_04_reserved", save_arg_04_reserved); }
whismanoid 49:359a6b9df7c1 3697 if ((save_arg & save_arg_08_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_08_reserved", save_arg_08_reserved); }
whismanoid 49:359a6b9df7c1 3698 if ((save_arg & save_arg_10_calibration) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_10_calibration", save_arg_10_calibration); }
whismanoid 49:359a6b9df7c1 3699 if ((save_arg & save_arg_20_action_table) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_20_action_table", save_arg_20_action_table); }
whismanoid 49:359a6b9df7c1 3700 if ((save_arg & save_arg_40_command_table) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_40_command_table", save_arg_40_command_table); }
whismanoid 49:359a6b9df7c1 3701 if ((save_arg & save_arg_80_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_80_reserved", save_arg_80_reserved); }
whismanoid 55:477ba09475d7 3702 if ((save_arg & save_arg_100_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_100_reserved", save_arg_100_reserved); }
whismanoid 55:477ba09475d7 3703 if ((save_arg & save_arg_200_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_200_reserved", save_arg_200_reserved); }
whismanoid 55:477ba09475d7 3704 if ((save_arg & save_arg_400_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_400_reserved", save_arg_400_reserved); }
whismanoid 55:477ba09475d7 3705 if ((save_arg & save_arg_800_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_800_reserved", save_arg_800_reserved); }
whismanoid 55:477ba09475d7 3706 if ((save_arg & save_arg_1000_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_1000_reserved", save_arg_1000_reserved); }
whismanoid 55:477ba09475d7 3707 if ((save_arg & save_arg_2000_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_2000_reserved", save_arg_2000_reserved); }
whismanoid 55:477ba09475d7 3708 if ((save_arg & save_arg_4000_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_4000_reserved", save_arg_4000_reserved); }
whismanoid 55:477ba09475d7 3709 if ((save_arg & save_arg_8000_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_8000_reserved", save_arg_8000_reserved); }
whismanoid 48:18647e0516f2 3710 }
whismanoid 46:469d0061df5d 3711 // WIP #312 %F save=save_arg could filter which items to append to flash file
whismanoid 46:469d0061df5d 3712 // initialize flash memory interface
whismanoid 46:469d0061df5d 3713 // FlashIAP: FlashIAP flash; flash.init();
whismanoid 46:469d0061df5d 3714 // int FLC_Init(void);
whismanoid 46:469d0061df5d 3715 // returns E_NO_ERROR or E_BUSY or E_UNKNOWN
whismanoid 48:18647e0516f2 3716 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3717 {
whismanoid 48:18647e0516f2 3718 cmdLine.serial().printf("FLC_Init ");
whismanoid 48:18647e0516f2 3719 }
whismanoid 46:469d0061df5d 3720 if (FLC_Init() != E_NO_ERROR)
whismanoid 46:469d0061df5d 3721 {
whismanoid 48:18647e0516f2 3722 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3723 {
whismanoid 48:18647e0516f2 3724 cmdLine.serial().printf("FAIL ");
whismanoid 48:18647e0516f2 3725 }
whismanoid 46:469d0061df5d 3726 return 1; // can't perform the command
whismanoid 46:469d0061df5d 3727 }
whismanoid 48:18647e0516f2 3728 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3729 {
whismanoid 48:18647e0516f2 3730 cmdLine.serial().printf("PASS ");
whismanoid 48:18647e0516f2 3731 }
whismanoid 46:469d0061df5d 3732 //
whismanoid 46:469d0061df5d 3733
whismanoid 52:bb09c0f452ec 3734 const uint32_t file_addr_start = (uint32_t)&flash_page_configuration_back_up[0];
whismanoid 52:bb09c0f452ec 3735 const uint32_t file_addr_end = file_addr_start + 8192 - 4; // last record at 0x00027ff0
whismanoid 52:bb09c0f452ec 3736 // uint32_t file_addr_end = file_addr_start + 256 - 4; // development: reduce listing size
whismanoid 52:bb09c0f452ec 3737 uint32_t file_addr = file_addr_start;
whismanoid 46:469d0061df5d 3738
whismanoid 46:469d0061df5d 3739 int poke_access_list_index = search_poke_access_list(file_addr);
whismanoid 48:18647e0516f2 3740 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3741 {
whismanoid 48:18647e0516f2 3742 cmdLine.serial().printf("\r\npoke_access_list[%d] %5s 0x%8.8lx - 0x%8.8lx access %x ",
whismanoid 48:18647e0516f2 3743 poke_access_list_index,
whismanoid 48:18647e0516f2 3744 poke_access_list[poke_access_list_index].name,
whismanoid 48:18647e0516f2 3745 poke_access_list[poke_access_list_index].addr_min,
whismanoid 48:18647e0516f2 3746 poke_access_list[poke_access_list_index].addr_max,
whismanoid 48:18647e0516f2 3747 poke_access_list[poke_access_list_index].can_flash_write_read);
whismanoid 48:18647e0516f2 3748 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, file_addr);
whismanoid 48:18647e0516f2 3749 }
whismanoid 46:469d0061df5d 3750
whismanoid 48:18647e0516f2 3751 if ((save_arg & save_arg_01_pageErase) != 0)
whismanoid 46:469d0061df5d 3752 {
whismanoid 48:18647e0516f2 3753 // @param[in] save_arg %F save=0x00000001 = page erase and rewrite, else append in next available blank space within page
whismanoid 46:469d0061df5d 3754 // erase flash file before saving configuration
whismanoid 46:469d0061df5d 3755 //
whismanoid 46:469d0061df5d 3756 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: erase page ...",
whismanoid 46:469d0061df5d 3757 poke_access_list[poke_access_list_index].name, file_addr);
whismanoid 46:469d0061df5d 3758 // page erase using flash.erase(addr, flash.get_sector_size(addr));
whismanoid 46:469d0061df5d 3759 // int FLC_PageErase(uint32_t address, MXC_V_FLC_ERASE_CODE_PAGE_ERASE, MXC_V_FLC_FLSH_UNLOCK_KEY);
whismanoid 46:469d0061df5d 3760 // @param address Address of the page to be erased.
whismanoid 46:469d0061df5d 3761 // @param erase_code Flash erase code; defined as
whismanoid 46:469d0061df5d 3762 // #MXC_V_FLC_ERASE_CODE_PAGE_ERASE for page erase
whismanoid 46:469d0061df5d 3763 // @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY.
whismanoid 46:469d0061df5d 3764 // returns E_NO_ERROR or else
whismanoid 46:469d0061df5d 3765 if (FLC_PageErase(file_addr, MXC_V_FLC_ERASE_CODE_PAGE_ERASE,
whismanoid 46:469d0061df5d 3766 MXC_V_FLC_FLSH_UNLOCK_KEY) != E_NO_ERROR)
whismanoid 46:469d0061df5d 3767 {
whismanoid 46:469d0061df5d 3768 cmdLine.serial().printf("FAIL ");
whismanoid 46:469d0061df5d 3769 return 1; // can't perform the command
whismanoid 46:469d0061df5d 3770 }
whismanoid 46:469d0061df5d 3771 cmdLine.serial().printf("PASS ");
whismanoid 46:469d0061df5d 3772 }
whismanoid 48:18647e0516f2 3773 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3774 {
whismanoid 48:18647e0516f2 3775 // @param[in] save_arg %F save=0x00000002 = verbose diagnostic messages
whismanoid 48:18647e0516f2 3776 }
whismanoid 48:18647e0516f2 3777 if ((save_arg & save_arg_04_reserved) != 0)
whismanoid 48:18647e0516f2 3778 {
whismanoid 48:18647e0516f2 3779 // @param[in] save_arg %F save=0x00000004 = reserved
whismanoid 48:18647e0516f2 3780 }
whismanoid 48:18647e0516f2 3781 if ((save_arg & save_arg_08_reserved) != 0)
whismanoid 48:18647e0516f2 3782 {
whismanoid 48:18647e0516f2 3783 // @param[in] save_arg %F save=0x00000008 = reserved
whismanoid 48:18647e0516f2 3784 }
whismanoid 48:18647e0516f2 3785 if ((save_arg & save_arg_10_calibration) != 0)
whismanoid 48:18647e0516f2 3786 {
whismanoid 48:18647e0516f2 3787 // @param[in] save_arg %F save=0x00000010 = save board ID and calibration
whismanoid 48:18647e0516f2 3788 }
whismanoid 48:18647e0516f2 3789 if ((save_arg & save_arg_20_action_table) != 0)
whismanoid 48:18647e0516f2 3790 {
whismanoid 48:18647e0516f2 3791 // @param[in] save_arg %F save=0x00000020 = save Datalogger_action_table
whismanoid 48:18647e0516f2 3792 }
whismanoid 48:18647e0516f2 3793 if ((save_arg & save_arg_40_command_table) != 0)
whismanoid 48:18647e0516f2 3794 {
whismanoid 48:18647e0516f2 3795 // @param[in] save_arg %F save=0x00000040 = save onButtonX_command_table
whismanoid 48:18647e0516f2 3796 }
whismanoid 48:18647e0516f2 3797 if ((save_arg & save_arg_80_reserved) != 0)
whismanoid 48:18647e0516f2 3798 {
whismanoid 48:18647e0516f2 3799 // @param[in] save_arg %F save=0x00000080 = reserved
whismanoid 48:18647e0516f2 3800 }
whismanoid 55:477ba09475d7 3801 if ((save_arg & save_arg_100_reserved) != 0)
whismanoid 55:477ba09475d7 3802 {
whismanoid 55:477ba09475d7 3803 }
whismanoid 55:477ba09475d7 3804 if ((save_arg & save_arg_200_reserved) != 0)
whismanoid 55:477ba09475d7 3805 {
whismanoid 55:477ba09475d7 3806 }
whismanoid 55:477ba09475d7 3807 if ((save_arg & save_arg_400_reserved) != 0)
whismanoid 55:477ba09475d7 3808 {
whismanoid 55:477ba09475d7 3809 }
whismanoid 55:477ba09475d7 3810 if ((save_arg & save_arg_800_reserved) != 0)
whismanoid 55:477ba09475d7 3811 {
whismanoid 55:477ba09475d7 3812 }
whismanoid 55:477ba09475d7 3813 if ((save_arg & save_arg_1000_reserved) != 0)
whismanoid 55:477ba09475d7 3814 {
whismanoid 55:477ba09475d7 3815 }
whismanoid 55:477ba09475d7 3816 if ((save_arg & save_arg_2000_reserved) != 0)
whismanoid 55:477ba09475d7 3817 {
whismanoid 55:477ba09475d7 3818 }
whismanoid 55:477ba09475d7 3819 if ((save_arg & save_arg_4000_reserved) != 0)
whismanoid 55:477ba09475d7 3820 {
whismanoid 55:477ba09475d7 3821 }
whismanoid 55:477ba09475d7 3822 if ((save_arg & save_arg_8000_reserved) != 0)
whismanoid 55:477ba09475d7 3823 {
whismanoid 55:477ba09475d7 3824 }
whismanoid 48:18647e0516f2 3825
whismanoid 48:18647e0516f2 3826 // address of next 16-byte-aligned record start address
whismanoid 48:18647e0516f2 3827 uint32_t file_addr_next = (file_addr + 16) &~ 0x0000000F;
whismanoid 46:469d0061df5d 3828
whismanoid 46:469d0061df5d 3829 // scan configuration_back_up_list[] for recordType
whismanoid 46:469d0061df5d 3830 for (int i = 0; configuration_back_up_list[i].recordType != 0x00000000; i++)
whismanoid 46:469d0061df5d 3831 {
whismanoid 48:18647e0516f2 3832 file_addr_next = (file_addr + 16) &~ 0x0000000F;
whismanoid 46:469d0061df5d 3833 if (configuration_back_up_list[i].recordType == 0xFFFFFFFF) continue;
whismanoid 46:469d0061df5d 3834 //
whismanoid 46:469d0061df5d 3835 // configuration_back_up_list[i].recordType
whismanoid 46:469d0061df5d 3836 // configuration_back_up_list[i].addr
whismanoid 46:469d0061df5d 3837 // configuration_back_up_list[i].length_bytes
whismanoid 46:469d0061df5d 3838 // configuration_back_up_list[i].name
whismanoid 46:469d0061df5d 3839 // WIP #312 %F save=save_arg could filter which items to append to flash file
whismanoid 46:469d0061df5d 3840 //
whismanoid 48:18647e0516f2 3841 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3842 {
whismanoid 48:18647e0516f2 3843 cmdLine.serial().printf("\r\n save 0x%8.8lx %s address 0x%8.8lx length 0x%lx bytes",
whismanoid 48:18647e0516f2 3844 configuration_back_up_list[i].recordType,
whismanoid 48:18647e0516f2 3845 configuration_back_up_list[i].name,
whismanoid 48:18647e0516f2 3846 (uint32_t)configuration_back_up_list[i].addr,
whismanoid 48:18647e0516f2 3847 configuration_back_up_list[i].length_bytes);
whismanoid 48:18647e0516f2 3848 }
whismanoid 46:469d0061df5d 3849 //
whismanoid 52:bb09c0f452ec 3850 if ((save_arg & save_arg_10_calibration) != 0)
whismanoid 52:bb09c0f452ec 3851 {
whismanoid 52:bb09c0f452ec 3852 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 52:bb09c0f452ec 3853 // @param[in] save_arg %F save=0x00000010 = save board ID and calibration
whismanoid 52:bb09c0f452ec 3854 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 52:bb09c0f452ec 3855 // print " skip";
whismanoid 52:bb09c0f452ec 3856 // }
whismanoid 52:bb09c0f452ec 3857 }
whismanoid 52:bb09c0f452ec 3858 if ((save_arg & save_arg_20_action_table) != 0)
whismanoid 52:bb09c0f452ec 3859 {
whismanoid 52:bb09c0f452ec 3860 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 52:bb09c0f452ec 3861 // @param[in] save_arg %F save=0x00000020 = save Datalogger_action_table
whismanoid 52:bb09c0f452ec 3862 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 52:bb09c0f452ec 3863 // print " skip";
whismanoid 52:bb09c0f452ec 3864 // }
whismanoid 52:bb09c0f452ec 3865 }
whismanoid 52:bb09c0f452ec 3866 if ((save_arg & save_arg_40_command_table) != 0)
whismanoid 52:bb09c0f452ec 3867 {
whismanoid 52:bb09c0f452ec 3868 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 52:bb09c0f452ec 3869 // @param[in] save_arg %F save=0x00000040 = save onButtonX_command_table
whismanoid 52:bb09c0f452ec 3870 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 52:bb09c0f452ec 3871 // print " skip";
whismanoid 52:bb09c0f452ec 3872 // }
whismanoid 52:bb09c0f452ec 3873 }
whismanoid 52:bb09c0f452ec 3874 if ((save_arg & save_arg_80_reserved) != 0)
whismanoid 52:bb09c0f452ec 3875 {
whismanoid 52:bb09c0f452ec 3876 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 52:bb09c0f452ec 3877 // @param[in] save_arg %F save=0x00000080 = reserved
whismanoid 52:bb09c0f452ec 3878 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 52:bb09c0f452ec 3879 // print " skip";
whismanoid 52:bb09c0f452ec 3880 // }
whismanoid 52:bb09c0f452ec 3881 }
whismanoid 55:477ba09475d7 3882 if ((save_arg & save_arg_100_reserved) != 0)
whismanoid 55:477ba09475d7 3883 {
whismanoid 55:477ba09475d7 3884 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3885 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3886 // print " skip";
whismanoid 55:477ba09475d7 3887 // }
whismanoid 55:477ba09475d7 3888 }
whismanoid 55:477ba09475d7 3889 if ((save_arg & save_arg_200_reserved) != 0)
whismanoid 55:477ba09475d7 3890 {
whismanoid 55:477ba09475d7 3891 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3892 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3893 // print " skip";
whismanoid 55:477ba09475d7 3894 // }
whismanoid 55:477ba09475d7 3895 }
whismanoid 55:477ba09475d7 3896 if ((save_arg & save_arg_400_reserved) != 0)
whismanoid 55:477ba09475d7 3897 {
whismanoid 55:477ba09475d7 3898 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3899 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3900 // print " skip";
whismanoid 55:477ba09475d7 3901 // }
whismanoid 55:477ba09475d7 3902 }
whismanoid 55:477ba09475d7 3903 if ((save_arg & save_arg_800_reserved) != 0)
whismanoid 55:477ba09475d7 3904 {
whismanoid 55:477ba09475d7 3905 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3906 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3907 // print " skip";
whismanoid 55:477ba09475d7 3908 // }
whismanoid 55:477ba09475d7 3909 }
whismanoid 55:477ba09475d7 3910 if ((save_arg & save_arg_1000_reserved) != 0)
whismanoid 55:477ba09475d7 3911 {
whismanoid 55:477ba09475d7 3912 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3913 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3914 // print " skip";
whismanoid 55:477ba09475d7 3915 // }
whismanoid 55:477ba09475d7 3916 }
whismanoid 55:477ba09475d7 3917 if ((save_arg & save_arg_2000_reserved) != 0)
whismanoid 55:477ba09475d7 3918 {
whismanoid 55:477ba09475d7 3919 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3920 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3921 // print " skip";
whismanoid 55:477ba09475d7 3922 // }
whismanoid 55:477ba09475d7 3923 }
whismanoid 55:477ba09475d7 3924 if ((save_arg & save_arg_4000_reserved) != 0)
whismanoid 55:477ba09475d7 3925 {
whismanoid 55:477ba09475d7 3926 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3927 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3928 // print " skip";
whismanoid 55:477ba09475d7 3929 // }
whismanoid 55:477ba09475d7 3930 }
whismanoid 55:477ba09475d7 3931 if ((save_arg & save_arg_8000_reserved) != 0)
whismanoid 55:477ba09475d7 3932 {
whismanoid 55:477ba09475d7 3933 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3934 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3935 // print " skip";
whismanoid 55:477ba09475d7 3936 // }
whismanoid 55:477ba09475d7 3937 }
whismanoid 52:bb09c0f452ec 3938 //
whismanoid 52:bb09c0f452ec 3939 if ((save_arg & save_arg_01_pageErase) == 0)
whismanoid 52:bb09c0f452ec 3940 {
whismanoid 52:bb09c0f452ec 3941 // WIP %F save=(even) save incremental: append only changed values #353
whismanoid 52:bb09c0f452ec 3942 // If the record we're about to append (or have just appended)
whismanoid 52:bb09c0f452ec 3943 // matches the previous record of that type, then skip this record
whismanoid 52:bb09c0f452ec 3944 // and blank out 0xffffffff the duplicate.
whismanoid 52:bb09c0f452ec 3945 //
whismanoid 52:bb09c0f452ec 3946 // scan from file_addr_start, find latest record match configuration_back_up_list[i].recordType
whismanoid 52:bb09c0f452ec 3947 uint32_t file_addr_previous_record = file_addr_start;
whismanoid 52:bb09c0f452ec 3948 for (uint32_t file_addr_scan = file_addr_start;
whismanoid 52:bb09c0f452ec 3949 file_addr_scan < file_addr_end;
whismanoid 52:bb09c0f452ec 3950 file_addr_scan = (file_addr_scan + 16) &~ 0x0000000F)
whismanoid 52:bb09c0f452ec 3951 {
whismanoid 52:bb09c0f452ec 3952 if (*((uint32_t*)file_addr_scan) == configuration_back_up_list[i].recordType)
whismanoid 52:bb09c0f452ec 3953 {
whismanoid 52:bb09c0f452ec 3954 // previous record of this type is at file_addr_previous_record
whismanoid 52:bb09c0f452ec 3955 file_addr_previous_record = file_addr_scan;
whismanoid 52:bb09c0f452ec 3956 }
whismanoid 52:bb09c0f452ec 3957 }
whismanoid 52:bb09c0f452ec 3958 if (*((uint32_t*)file_addr_previous_record) == configuration_back_up_list[i].recordType)
whismanoid 52:bb09c0f452ec 3959 {
whismanoid 52:bb09c0f452ec 3960 // last record of this type is at file_addr_previous_record
whismanoid 52:bb09c0f452ec 3961 // does the stored value match the value we intend to store?
whismanoid 52:bb09c0f452ec 3962 //
whismanoid 52:bb09c0f452ec 3963 // WIP %F save=(even) save incremental: append only changed values #353
whismanoid 52:bb09c0f452ec 3964 // ((uint32_t*)file_addr_previous_record+1) is the previous 32-bit value
whismanoid 52:bb09c0f452ec 3965 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 52:bb09c0f452ec 3966 {
whismanoid 52:bb09c0f452ec 3967 // print " previous value 0x%8.8lx";
whismanoid 52:bb09c0f452ec 3968 cmdLine.serial().printf("\r\n save 0x%8.8lx %s address 0x%8.8lx length 0x%lx bytes",
whismanoid 52:bb09c0f452ec 3969 configuration_back_up_list[i].recordType,
whismanoid 52:bb09c0f452ec 3970 configuration_back_up_list[i].name,
whismanoid 52:bb09c0f452ec 3971 (uint32_t)configuration_back_up_list[i].addr,
whismanoid 52:bb09c0f452ec 3972 configuration_back_up_list[i].length_bytes);
whismanoid 52:bb09c0f452ec 3973 }
whismanoid 52:bb09c0f452ec 3974 // compare with the 32-bit value we intend to store
whismanoid 52:bb09c0f452ec 3975 int is_record_a_duplicate = true;
whismanoid 55:477ba09475d7 3976 for (unsigned int compareOffset = 0; compareOffset*4 < configuration_back_up_list[i].length_bytes; compareOffset++)
whismanoid 52:bb09c0f452ec 3977 {
whismanoid 52:bb09c0f452ec 3978 uint32_t saved_data_word = *((uint32_t*)file_addr_previous_record+1+compareOffset);
whismanoid 52:bb09c0f452ec 3979 uint32_t new_data_word = *((uint32_t*)configuration_back_up_list[i].addr+compareOffset);
whismanoid 52:bb09c0f452ec 3980 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 52:bb09c0f452ec 3981 {
whismanoid 52:bb09c0f452ec 3982 cmdLine.serial().printf("\r\n saved 0x%8.8lx vs new 0x%8.8lx",
whismanoid 52:bb09c0f452ec 3983 saved_data_word,
whismanoid 52:bb09c0f452ec 3984 new_data_word);
whismanoid 52:bb09c0f452ec 3985 }
whismanoid 52:bb09c0f452ec 3986 if (saved_data_word != new_data_word)
whismanoid 52:bb09c0f452ec 3987 {
whismanoid 52:bb09c0f452ec 3988 // new data is different
whismanoid 52:bb09c0f452ec 3989 is_record_a_duplicate = false;
whismanoid 52:bb09c0f452ec 3990 }
whismanoid 52:bb09c0f452ec 3991 }
whismanoid 52:bb09c0f452ec 3992 if (is_record_a_duplicate)
whismanoid 52:bb09c0f452ec 3993 {
whismanoid 52:bb09c0f452ec 3994 // print " skip duplicate";
whismanoid 52:bb09c0f452ec 3995 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 52:bb09c0f452ec 3996 {
whismanoid 52:bb09c0f452ec 3997 cmdLine.serial().printf("\r\n skip duplicate");
whismanoid 52:bb09c0f452ec 3998 }
whismanoid 52:bb09c0f452ec 3999 continue; // skip to the next item in configuration_back_up_list
whismanoid 52:bb09c0f452ec 4000 }
whismanoid 52:bb09c0f452ec 4001 else
whismanoid 52:bb09c0f452ec 4002 {
whismanoid 52:bb09c0f452ec 4003 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 52:bb09c0f452ec 4004 {
whismanoid 52:bb09c0f452ec 4005 cmdLine.serial().printf("\r\n append updated record");
whismanoid 52:bb09c0f452ec 4006 }
whismanoid 52:bb09c0f452ec 4007 }
whismanoid 52:bb09c0f452ec 4008 }
whismanoid 52:bb09c0f452ec 4009 }
whismanoid 52:bb09c0f452ec 4010 else
whismanoid 52:bb09c0f452ec 4011 {
whismanoid 52:bb09c0f452ec 4012 // page was erased so value should be saved
whismanoid 52:bb09c0f452ec 4013 }
whismanoid 52:bb09c0f452ec 4014 //
whismanoid 46:469d0061df5d 4015 // find next free space to store record in flash file
whismanoid 46:469d0061df5d 4016 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, file_addr);
whismanoid 46:469d0061df5d 4017 cmdLine.serial().printf("0x%8.8lx ", *((uint32_t*)file_addr));
whismanoid 46:469d0061df5d 4018 while (*((uint32_t*)file_addr) != 0xFFFFFFFF)
whismanoid 46:469d0061df5d 4019 {
whismanoid 46:469d0061df5d 4020 if (file_addr >= file_addr_end)
whismanoid 46:469d0061df5d 4021 {
whismanoid 46:469d0061df5d 4022 return 1; // fail: no room to write file
whismanoid 46:469d0061df5d 4023 }
whismanoid 48:18647e0516f2 4024 file_addr_next = (file_addr + 16) &~ 0x0000000F;
whismanoid 48:18647e0516f2 4025 file_addr = file_addr_next;
whismanoid 46:469d0061df5d 4026 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: 0x%8.8lx ",
whismanoid 46:469d0061df5d 4027 poke_access_list[poke_access_list_index].name,
whismanoid 46:469d0061df5d 4028 file_addr,
whismanoid 46:469d0061df5d 4029 *((uint32_t*)file_addr)
whismanoid 46:469d0061df5d 4030 );
whismanoid 46:469d0061df5d 4031 }
whismanoid 48:18647e0516f2 4032 file_addr_next = (file_addr + configuration_back_up_list[i].length_bytes + 16) &~ 0x0000000F;
whismanoid 46:469d0061df5d 4033 //
whismanoid 46:469d0061df5d 4034 // copy data from RAM into flash file
whismanoid 46:469d0061df5d 4035 // not_memcpy(file_addr + 4, configuration_back_up_list[i].addr, configuration_back_up_list[i].length_bytes);
whismanoid 46:469d0061df5d 4036 // pageBuf[0..3] = configuration_back_up_list[i].recordType;
whismanoid 46:469d0061df5d 4037 // pageBuf[4...] = configuration_back_up_list[i].addr, configuration_back_up_list[i].length_bytes
whismanoid 46:469d0061df5d 4038 // WIP #312: FLC_Write(...) in Save_flash_page_configuration_back_up
whismanoid 48:18647e0516f2 4039 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4040 {
whismanoid 48:18647e0516f2 4041 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: write page buffer ...",
whismanoid 48:18647e0516f2 4042 poke_access_list[poke_access_list_index].name, file_addr);
whismanoid 48:18647e0516f2 4043 }
whismanoid 46:469d0061df5d 4044 // page write using flash.program(page_buffer, addr, page_size);
whismanoid 46:469d0061df5d 4045 // int FLC_Write(uint32_t address, const void *data, uint32_t length, MXC_V_FLC_FLSH_UNLOCK_KEY);
whismanoid 46:469d0061df5d 4046 // @param address Start address for desired write. @note This address
whismanoid 46:469d0061df5d 4047 // must be 32-bit word aligned
whismanoid 46:469d0061df5d 4048 // @param data A pointer to the buffer containing the data to write.
whismanoid 46:469d0061df5d 4049 // @param length Size of the data to write in bytes. @note The length
whismanoid 46:469d0061df5d 4050 // must be in 32-bit multiples.
whismanoid 46:469d0061df5d 4051 // @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY.
whismanoid 46:469d0061df5d 4052 // returns E_NO_ERROR or else
whismanoid 46:469d0061df5d 4053 if (FLC_Write(file_addr,
whismanoid 46:469d0061df5d 4054 (uint32_t*)(&configuration_back_up_list[i].recordType),
whismanoid 46:469d0061df5d 4055 sizeof(uint32_t),
whismanoid 46:469d0061df5d 4056 MXC_V_FLC_FLSH_UNLOCK_KEY) != E_NO_ERROR)
whismanoid 46:469d0061df5d 4057 {
whismanoid 48:18647e0516f2 4058 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4059 {
whismanoid 48:18647e0516f2 4060 cmdLine.serial().printf("FAIL ");
whismanoid 48:18647e0516f2 4061 }
whismanoid 46:469d0061df5d 4062 break; // can't perform the command
whismanoid 46:469d0061df5d 4063 }
whismanoid 48:18647e0516f2 4064 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4065 {
whismanoid 48:18647e0516f2 4066 cmdLine.serial().printf("PASS ");
whismanoid 48:18647e0516f2 4067 }
whismanoid 46:469d0061df5d 4068 if (FLC_Write(file_addr + 4,
whismanoid 46:469d0061df5d 4069 (uint32_t*)(configuration_back_up_list[i].addr),
whismanoid 46:469d0061df5d 4070 configuration_back_up_list[i].length_bytes,
whismanoid 46:469d0061df5d 4071 MXC_V_FLC_FLSH_UNLOCK_KEY) != E_NO_ERROR)
whismanoid 46:469d0061df5d 4072 {
whismanoid 48:18647e0516f2 4073 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4074 {
whismanoid 48:18647e0516f2 4075 cmdLine.serial().printf("FAIL ");
whismanoid 48:18647e0516f2 4076 }
whismanoid 46:469d0061df5d 4077 break; // can't perform the command
whismanoid 46:469d0061df5d 4078 }
whismanoid 48:18647e0516f2 4079 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4080 {
whismanoid 48:18647e0516f2 4081 cmdLine.serial().printf("PASS ");
whismanoid 48:18647e0516f2 4082 }
whismanoid 46:469d0061df5d 4083 // advance to next 16-byte-aligned record start address
whismanoid 48:18647e0516f2 4084 file_addr = file_addr_next;
whismanoid 46:469d0061df5d 4085 } // end for each configuration_back_up_list[...]
whismanoid 46:469d0061df5d 4086 return 0;
whismanoid 46:469d0061df5d 4087 } // end Save_flash_page_configuration_back_up
whismanoid 46:469d0061df5d 4088 // WIP #312 load values from flash_page_configuration_back_up[] into calibration_05_V[] etc. Default load everything.
whismanoid 46:469d0061df5d 4089 int Load_flash_page_configuration_back_up(CmdLine& cmdLine, uint32_t load_arg)
whismanoid 46:469d0061df5d 4090 {
whismanoid 48:18647e0516f2 4091 if ((load_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4092 {
whismanoid 48:18647e0516f2 4093 cmdLine.serial().printf("\r\nLoad_flash_page_configuration_back_up(0x%8.8lx)...", load_arg);
whismanoid 48:18647e0516f2 4094 }
whismanoid 48:18647e0516f2 4095 if ((load_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4096 {
whismanoid 48:18647e0516f2 4097 // @param[in] save_arg %F save=0x00000002 = verbose diagnostic messages
whismanoid 49:359a6b9df7c1 4098 if ((load_arg & load_arg_01_brief) != 0) { cmdLine.serial().printf("\r\n 0x%lx: load_arg_01_brief", load_arg_01_brief); }
whismanoid 49:359a6b9df7c1 4099 if ((load_arg & save_arg_02_verbose) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_02_verbose", save_arg_02_verbose); }
whismanoid 49:359a6b9df7c1 4100 if ((load_arg & save_arg_04_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_04_reserved", save_arg_04_reserved); }
whismanoid 49:359a6b9df7c1 4101 if ((load_arg & save_arg_08_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_08_reserved", save_arg_08_reserved); }
whismanoid 49:359a6b9df7c1 4102 if ((load_arg & save_arg_10_calibration) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_10_calibration", save_arg_10_calibration); }
whismanoid 49:359a6b9df7c1 4103 if ((load_arg & save_arg_20_action_table) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_20_action_table", save_arg_20_action_table); }
whismanoid 49:359a6b9df7c1 4104 if ((load_arg & save_arg_40_command_table) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_40_command_table", save_arg_40_command_table); }
whismanoid 49:359a6b9df7c1 4105 if ((load_arg & save_arg_80_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_80_reserved", save_arg_80_reserved); }
whismanoid 55:477ba09475d7 4106 if ((load_arg & save_arg_100_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_100_reserved", save_arg_100_reserved); }
whismanoid 55:477ba09475d7 4107 if ((load_arg & save_arg_200_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_200_reserved", save_arg_200_reserved); }
whismanoid 55:477ba09475d7 4108 if ((load_arg & save_arg_400_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_400_reserved", save_arg_400_reserved); }
whismanoid 55:477ba09475d7 4109 if ((load_arg & save_arg_800_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_800_reserved", save_arg_800_reserved); }
whismanoid 55:477ba09475d7 4110 if ((load_arg & save_arg_1000_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_1000_reserved", save_arg_1000_reserved); }
whismanoid 55:477ba09475d7 4111 if ((load_arg & save_arg_2000_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_2000_reserved", save_arg_2000_reserved); }
whismanoid 55:477ba09475d7 4112 if ((load_arg & save_arg_4000_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_4000_reserved", save_arg_4000_reserved); }
whismanoid 55:477ba09475d7 4113 if ((load_arg & save_arg_8000_reserved) != 0) { cmdLine.serial().printf("\r\n 0x%lx: save_arg_8000_reserved", save_arg_8000_reserved); }
whismanoid 48:18647e0516f2 4114 }
whismanoid 46:469d0061df5d 4115 // WIP #312 %F load=load_arg could filter which items to accept from flash file
whismanoid 46:469d0061df5d 4116
whismanoid 46:469d0061df5d 4117 uint32_t file_addr = (uint32_t)&flash_page_configuration_back_up[0];
whismanoid 52:bb09c0f452ec 4118 uint32_t file_addr_end = file_addr + 8192 - 4; // last record at 0x00027ff0
whismanoid 46:469d0061df5d 4119 // uint32_t file_addr_end = file_addr + 256 - 4; // development: reduce listing size -- last record at 0x000260f0
whismanoid 52:bb09c0f452ec 4120 // uint32_t file_addr_end = file_addr + 512 - 4; // development: reduce listing size -- last record at 0x000261f0
whismanoid 46:469d0061df5d 4121
whismanoid 46:469d0061df5d 4122 // diagnostic print
whismanoid 46:469d0061df5d 4123 int poke_access_list_index = search_poke_access_list(file_addr);
whismanoid 48:18647e0516f2 4124 if ((load_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4125 {
whismanoid 48:18647e0516f2 4126 cmdLine.serial().printf("\r\npoke_access_list[%d] %5s 0x%8.8lx - 0x%8.8lx access %x ",
whismanoid 48:18647e0516f2 4127 poke_access_list_index,
whismanoid 48:18647e0516f2 4128 poke_access_list[poke_access_list_index].name,
whismanoid 48:18647e0516f2 4129 poke_access_list[poke_access_list_index].addr_min,
whismanoid 48:18647e0516f2 4130 poke_access_list[poke_access_list_index].addr_max,
whismanoid 48:18647e0516f2 4131 poke_access_list[poke_access_list_index].can_flash_write_read);
whismanoid 48:18647e0516f2 4132 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, file_addr);
whismanoid 48:18647e0516f2 4133 }
whismanoid 46:469d0061df5d 4134
whismanoid 46:469d0061df5d 4135 // Scan backup configuration file
whismanoid 46:469d0061df5d 4136 while (file_addr < file_addr_end)
whismanoid 46:469d0061df5d 4137 {
whismanoid 48:18647e0516f2 4138 if ((load_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4139 {
whismanoid 48:18647e0516f2 4140 // diagnostic print
whismanoid 48:18647e0516f2 4141 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: 0x%8.8lx ",
whismanoid 48:18647e0516f2 4142 poke_access_list[poke_access_list_index].name,
whismanoid 48:18647e0516f2 4143 file_addr,
whismanoid 48:18647e0516f2 4144 *((uint32_t*)file_addr));
whismanoid 48:18647e0516f2 4145 }
whismanoid 46:469d0061df5d 4146
whismanoid 46:469d0061df5d 4147 // address of next 16-byte-aligned record start address
whismanoid 46:469d0061df5d 4148 uint32_t file_addr_next = (file_addr + 16) &~ 0x0000000F;
whismanoid 46:469d0061df5d 4149
whismanoid 46:469d0061df5d 4150 // scan configuration_back_up_list[] to decode recordType
whismanoid 46:469d0061df5d 4151 for (int i = 0; configuration_back_up_list[i].recordType != 0x00000000; i++)
whismanoid 46:469d0061df5d 4152 {
whismanoid 46:469d0061df5d 4153 // configuration_back_up_list[i].recordType
whismanoid 46:469d0061df5d 4154 // configuration_back_up_list[i].addr
whismanoid 46:469d0061df5d 4155 // configuration_back_up_list[i].length_bytes
whismanoid 46:469d0061df5d 4156 // configuration_back_up_list[i].name
whismanoid 46:469d0061df5d 4157 //
whismanoid 46:469d0061df5d 4158 uint32_t file_addr_recordType = file_addr;
whismanoid 52:bb09c0f452ec 4159 // uint32_t file_addr_recordData = file_addr + 1;
whismanoid 46:469d0061df5d 4160 // uint32_t file_addr_recordNext = (file_addr + configuration_back_up_list[i].length_bytes) & ______;
whismanoid 46:469d0061df5d 4161 if (configuration_back_up_list[i].recordType == *((uint32_t*)file_addr_recordType))
whismanoid 46:469d0061df5d 4162 {
whismanoid 46:469d0061df5d 4163 if ((configuration_back_up_list[i].addr == 0) ||
whismanoid 46:469d0061df5d 4164 (configuration_back_up_list[i].length_bytes==0))
whismanoid 46:469d0061df5d 4165 {
whismanoid 46:469d0061df5d 4166 break; // Ignore blank record, stop searching
whismanoid 46:469d0061df5d 4167 }
whismanoid 46:469d0061df5d 4168 // found a matching recordHeader
whismanoid 48:18647e0516f2 4169 if ((load_arg & load_arg_01_brief) != 0)
whismanoid 46:469d0061df5d 4170 {
whismanoid 48:18647e0516f2 4171 // diagnostic print
whismanoid 48:18647e0516f2 4172 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: 0x%8.8lx load %s",
whismanoid 46:469d0061df5d 4173 poke_access_list[poke_access_list_index].name,
whismanoid 48:18647e0516f2 4174 file_addr,
whismanoid 48:18647e0516f2 4175 *((uint32_t*)file_addr),
whismanoid 48:18647e0516f2 4176 configuration_back_up_list[i].name
whismanoid 46:469d0061df5d 4177 );
whismanoid 46:469d0061df5d 4178 }
whismanoid 48:18647e0516f2 4179 if ((load_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4180 {
whismanoid 55:477ba09475d7 4181 for (unsigned int j = 0; j <= configuration_back_up_list[i].length_bytes; j += 4)
whismanoid 48:18647e0516f2 4182 {
whismanoid 48:18647e0516f2 4183 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: 0x%8.8lx",
whismanoid 48:18647e0516f2 4184 poke_access_list[poke_access_list_index].name,
whismanoid 48:18647e0516f2 4185 (file_addr + 4 + j),
whismanoid 48:18647e0516f2 4186 *((uint32_t*)(file_addr + 4 + j))
whismanoid 48:18647e0516f2 4187 );
whismanoid 48:18647e0516f2 4188 }
whismanoid 48:18647e0516f2 4189 }
whismanoid 46:469d0061df5d 4190 // cmdLine.serial().printf("\r\n load %s 0x%8.8lx length 0x%lx address 0x%8.8lx",
whismanoid 46:469d0061df5d 4191 // configuration_back_up_list[i].name,
whismanoid 46:469d0061df5d 4192 // configuration_back_up_list[i].recordType,
whismanoid 46:469d0061df5d 4193 // configuration_back_up_list[i].length_bytes,
whismanoid 46:469d0061df5d 4194 // (uint32_t)configuration_back_up_list[i].addr,
whismanoid 46:469d0061df5d 4195 // );
whismanoid 46:469d0061df5d 4196 // cmdLine.serial().printf("\r\n load %s 0x%8.8lx length 0x%lx address 0x%8.8lx",
whismanoid 46:469d0061df5d 4197 // configuration_back_up_list[i].name,
whismanoid 46:469d0061df5d 4198 // configuration_back_up_list[i].recordType,
whismanoid 46:469d0061df5d 4199 // configuration_back_up_list[i].length_bytes,
whismanoid 46:469d0061df5d 4200 // (uint32_t)configuration_back_up_list[i].addr,
whismanoid 46:469d0061df5d 4201 // );
whismanoid 46:469d0061df5d 4202 //
whismanoid 46:469d0061df5d 4203 // WIP #312: copy data from flash file into RAM in Load_flash_page_configuration_back_up
whismanoid 46:469d0061df5d 4204 memcpy(configuration_back_up_list[i].addr,
whismanoid 46:469d0061df5d 4205 (const void *)(file_addr + 4),
whismanoid 46:469d0061df5d 4206 configuration_back_up_list[i].length_bytes);
whismanoid 46:469d0061df5d 4207 //
whismanoid 46:469d0061df5d 4208 // advance to next 16-byte-aligned record start address
whismanoid 46:469d0061df5d 4209 file_addr_next = (file_addr + configuration_back_up_list[i].length_bytes + 16) &~ 0x0000000F;
whismanoid 46:469d0061df5d 4210 break; // stop searching
whismanoid 46:469d0061df5d 4211 } // end if match recordType
whismanoid 46:469d0061df5d 4212 } // end for each configuration_back_up_list[...]
whismanoid 46:469d0061df5d 4213 // advance to next 16-byte-aligned record start address
whismanoid 46:469d0061df5d 4214 file_addr = file_addr_next;
whismanoid 46:469d0061df5d 4215 } // end while (file_addr < file_addr_end)
whismanoid 46:469d0061df5d 4216 return 0;
whismanoid 46:469d0061df5d 4217 } // end Load_flash_page_configuration_back_up
whismanoid 46:469d0061df5d 4218 #endif // HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 4219
whismanoid 46:469d0061df5d 4220 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 4221 // Option to validate SPI link by reading PART_ID register
whismanoid 0:cb44e2e9ec4c 4222 #ifndef VERIFY_PART_ID_IN_LOOP
whismanoid 3:9055e17e181a 4223 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 4224 #define VERIFY_PART_ID_IN_LOOP 1
whismanoid 3:9055e17e181a 4225 #else
whismanoid 0:cb44e2e9ec4c 4226 #define VERIFY_PART_ID_IN_LOOP 0
whismanoid 3:9055e17e181a 4227 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 4228 #endif
whismanoid 0:cb44e2e9ec4c 4229
whismanoid 3:9055e17e181a 4230 //--------------------------------------------------
whismanoid 3:9055e17e181a 4231 #define NUM_DUT_ANALOG_IN_CHANNELS 10
whismanoid 3:9055e17e181a 4232
whismanoid 3:9055e17e181a 4233 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 4234 // MAX11410 individual channels 1=LSB, 2=Volt, 0=Disabled
whismanoid 3:9055e17e181a 4235 typedef enum SPI_AIN_Enable_t {
whismanoid 10:04022a61b527 4236 SPI_AIN_Disable = 0,
whismanoid 10:04022a61b527 4237 SPI_AIN_Enable_LSB = 1,
whismanoid 10:04022a61b527 4238 SPI_AIN_Enable_Volt = 2,
whismanoid 3:9055e17e181a 4239 } SPI_AIN_Enable_t;
whismanoid 3:9055e17e181a 4240 uint8_t SPI_AIN_Enable_ch[NUM_DUT_ANALOG_IN_CHANNELS] = {
whismanoid 10:04022a61b527 4241 SPI_AIN_Enable_LSB, // AIN0 1=LSB
whismanoid 10:04022a61b527 4242 SPI_AIN_Enable_LSB, // AIN1 1=LSB
whismanoid 10:04022a61b527 4243 SPI_AIN_Enable_LSB, // AIN2 1=LSB
whismanoid 10:04022a61b527 4244 SPI_AIN_Enable_LSB, // AIN3 1=LSB
whismanoid 10:04022a61b527 4245 SPI_AIN_Enable_LSB, // AIN4 1=LSB
whismanoid 10:04022a61b527 4246 SPI_AIN_Enable_LSB, // AIN5 1=LSB
whismanoid 10:04022a61b527 4247 SPI_AIN_Enable_LSB, // AIN6 1=LSB
whismanoid 10:04022a61b527 4248 SPI_AIN_Enable_LSB, // AIN7 1=LSB
whismanoid 10:04022a61b527 4249 SPI_AIN_Enable_LSB, // AIN8 1=LSB
whismanoid 10:04022a61b527 4250 SPI_AIN_Enable_LSB, // AIN9 1=LSB
whismanoid 3:9055e17e181a 4251 };
whismanoid 3:9055e17e181a 4252 //
whismanoid 10:04022a61b527 4253 double SPI_AIN_Voltage[NUM_DUT_ANALOG_IN_CHANNELS];
whismanoid 13:184a08909405 4254 // Optional custom per-channel header suffix
whismanoid 45:74bf1fe021e5 4255 // This could be used to identify external hardware attached to each input
whismanoid 13:184a08909405 4256 #if HAS_SPI_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 4257 // WIP Editable customChannelHeader strings #363 - SPI_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 4258 char SPI_AIN_customChannelHeader_ch0[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4259 char SPI_AIN_customChannelHeader_ch1[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4260 char SPI_AIN_customChannelHeader_ch2[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4261 char SPI_AIN_customChannelHeader_ch3[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4262 char SPI_AIN_customChannelHeader_ch4[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4263 char SPI_AIN_customChannelHeader_ch5[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4264 char SPI_AIN_customChannelHeader_ch6[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4265 char SPI_AIN_customChannelHeader_ch7[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4266 char SPI_AIN_customChannelHeader_ch8[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4267 char SPI_AIN_customChannelHeader_ch9[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4268 static char* SPI_AIN_customChannelHeader_ch[NUM_SPI_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4269 SPI_AIN_customChannelHeader_ch0,
whismanoid 55:477ba09475d7 4270 SPI_AIN_customChannelHeader_ch1,
whismanoid 55:477ba09475d7 4271 SPI_AIN_customChannelHeader_ch2,
whismanoid 55:477ba09475d7 4272 SPI_AIN_customChannelHeader_ch3,
whismanoid 55:477ba09475d7 4273 SPI_AIN_customChannelHeader_ch4,
whismanoid 55:477ba09475d7 4274 SPI_AIN_customChannelHeader_ch5,
whismanoid 55:477ba09475d7 4275 SPI_AIN_customChannelHeader_ch6,
whismanoid 55:477ba09475d7 4276 SPI_AIN_customChannelHeader_ch7,
whismanoid 55:477ba09475d7 4277 SPI_AIN_customChannelHeader_ch8,
whismanoid 55:477ba09475d7 4278 SPI_AIN_customChannelHeader_ch9,
whismanoid 13:184a08909405 4279 };
whismanoid 13:184a08909405 4280 #endif // HAS_SPI_AIN_customChannelHeader
whismanoid 55:477ba09475d7 4281 //
whismanoid 55:477ba09475d7 4282 // MAX40108 Datalog Math #362 -- SPI_AIN_Enable_Math_ch[] SPI_AIN_MATH
whismanoid 55:477ba09475d7 4283 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 4284 uint8_t SPI_AIN_Enable_Math_ch[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4285 Platform_AIN_Disable,
whismanoid 55:477ba09475d7 4286 };
whismanoid 55:477ba09475d7 4287 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 4288 //
whismanoid 55:477ba09475d7 4289 // MAX40108 Datalog Math #362 -- SPI_AIN_MathOffsetA[] SPI_AIN_MATH
whismanoid 55:477ba09475d7 4290 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 4291 double SPI_AIN_MathOffsetA[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4292 1.0,
whismanoid 55:477ba09475d7 4293 };
whismanoid 55:477ba09475d7 4294 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 4295 //
whismanoid 55:477ba09475d7 4296 // MAX40108 Datalog Math #362 -- SPI_AIN_MathGainMulA[] SPI_AIN_MATH
whismanoid 55:477ba09475d7 4297 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 4298 double SPI_AIN_MathGainMulA[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4299 1.0,
whismanoid 55:477ba09475d7 4300 };
whismanoid 55:477ba09475d7 4301 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 4302 //
whismanoid 55:477ba09475d7 4303 // MAX40108 Datalog Math #362 -- SPI_AIN_MathGainDivA[] SPI_AIN_MATH
whismanoid 55:477ba09475d7 4304 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 4305 double SPI_AIN_MathGainDivA[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4306 1.0,
whismanoid 55:477ba09475d7 4307 };
whismanoid 55:477ba09475d7 4308 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 4309 //
whismanoid 55:477ba09475d7 4310 // MAX40108 Datalog Math #362 -- SPI_AIN_MathUnitString[] SPI_AIN_MATH
whismanoid 55:477ba09475d7 4311 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 4312 // WIP Editable customChannelHeader strings #363 - SPI_AIN_MathUnitString
whismanoid 55:477ba09475d7 4313 #define SPI_AIN_MathUnitString_MAXLENGTH 20
whismanoid 55:477ba09475d7 4314 char SPI_AIN_MathUnitString_ch0[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4315 char SPI_AIN_MathUnitString_ch1[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4316 char SPI_AIN_MathUnitString_ch2[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4317 char SPI_AIN_MathUnitString_ch3[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4318 char SPI_AIN_MathUnitString_ch4[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4319 char SPI_AIN_MathUnitString_ch5[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4320 char SPI_AIN_MathUnitString_ch6[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4321 char SPI_AIN_MathUnitString_ch7[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4322 char SPI_AIN_MathUnitString_ch8[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4323 char SPI_AIN_MathUnitString_ch9[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4324 static char* SPI_AIN_MathUnitString[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4325 SPI_AIN_MathUnitString_ch0,
whismanoid 55:477ba09475d7 4326 SPI_AIN_MathUnitString_ch1,
whismanoid 55:477ba09475d7 4327 SPI_AIN_MathUnitString_ch2,
whismanoid 55:477ba09475d7 4328 SPI_AIN_MathUnitString_ch3,
whismanoid 55:477ba09475d7 4329 SPI_AIN_MathUnitString_ch4,
whismanoid 55:477ba09475d7 4330 SPI_AIN_MathUnitString_ch5,
whismanoid 55:477ba09475d7 4331 SPI_AIN_MathUnitString_ch6,
whismanoid 55:477ba09475d7 4332 SPI_AIN_MathUnitString_ch7,
whismanoid 55:477ba09475d7 4333 SPI_AIN_MathUnitString_ch8,
whismanoid 55:477ba09475d7 4334 SPI_AIN_MathUnitString_ch9,
whismanoid 55:477ba09475d7 4335 };
whismanoid 55:477ba09475d7 4336 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 4337 //
whismanoid 3:9055e17e181a 4338 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 4339 // ---------- Measure_Voltage_custom_props in Measure_Voltage @pre and in class properties ----------
whismanoid 3:9055e17e181a 4340 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 4:d9b05924ad4c 4341 // MAX11410 specific per-channel config register v_filter
whismanoid 3:9055e17e181a 4342 uint8_t SPI_AIN_Cfg_v_filter_ch[NUM_DUT_ANALOG_IN_CHANNELS] = {
whismanoid 3:9055e17e181a 4343 0x34, // AIN0 @ v_filter=0x34
whismanoid 3:9055e17e181a 4344 0x34, // AIN1 @ v_filter=0x34
whismanoid 3:9055e17e181a 4345 0x34, // AIN2 @ v_filter=0x34
whismanoid 3:9055e17e181a 4346 0x34, // AIN3 @ v_filter=0x34
whismanoid 3:9055e17e181a 4347 0x34, // AIN4 @ v_filter=0x34
whismanoid 3:9055e17e181a 4348 0x34, // AIN5 @ v_filter=0x34
whismanoid 3:9055e17e181a 4349 0x34, // AIN6 @ v_filter=0x34
whismanoid 3:9055e17e181a 4350 0x34, // AIN7 @ v_filter=0x34
whismanoid 3:9055e17e181a 4351 0x34, // AIN8 @ v_filter=0x34
whismanoid 3:9055e17e181a 4352 0x34, // AIN9 @ v_filter=0x34
whismanoid 3:9055e17e181a 4353 };
whismanoid 3:9055e17e181a 4354 //
whismanoid 4:d9b05924ad4c 4355 // MAX11410 specific per-channel config register v_ctrl
whismanoid 3:9055e17e181a 4356 uint8_t SPI_AIN_Cfg_v_ctrl_ch[NUM_DUT_ANALOG_IN_CHANNELS] = {
whismanoid 3:9055e17e181a 4357 0x42, // AIN0 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4358 0x42, // AIN1 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4359 0x42, // AIN2 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4360 0x42, // AIN3 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4361 0x42, // AIN4 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4362 0x42, // AIN5 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4363 0x42, // AIN6 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4364 0x42, // AIN7 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4365 0x42, // AIN8 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4366 0x42, // AIN9 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4367 };
whismanoid 3:9055e17e181a 4368 //
whismanoid 4:d9b05924ad4c 4369 // MAX11410 specific per-channel config register v_pga
whismanoid 3:9055e17e181a 4370 uint8_t SPI_AIN_Cfg_v_pga_ch[NUM_DUT_ANALOG_IN_CHANNELS] = {
whismanoid 3:9055e17e181a 4371 0x00, // AIN0 @ v_pga=0x00
whismanoid 3:9055e17e181a 4372 0x00, // AIN1 @ v_pga=0x00
whismanoid 3:9055e17e181a 4373 0x00, // AIN2 @ v_pga=0x00
whismanoid 3:9055e17e181a 4374 0x00, // AIN3 @ v_pga=0x00
whismanoid 3:9055e17e181a 4375 0x00, // AIN4 @ v_pga=0x00
whismanoid 3:9055e17e181a 4376 0x00, // AIN5 @ v_pga=0x00
whismanoid 3:9055e17e181a 4377 0x00, // AIN6 @ v_pga=0x00
whismanoid 3:9055e17e181a 4378 0x00, // AIN7 @ v_pga=0x00
whismanoid 3:9055e17e181a 4379 0x00, // AIN8 @ v_pga=0x00
whismanoid 3:9055e17e181a 4380 0x00, // AIN9 @ v_pga=0x00
whismanoid 3:9055e17e181a 4381 };
whismanoid 3:9055e17e181a 4382 //
whismanoid 3:9055e17e181a 4383 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 4384 // ---------- Measure_Voltage_custom_props ----------
whismanoid 0:cb44e2e9ec4c 4385 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 4386 // filter register configuration in Measure_Voltage and Read_All_Voltages CONV_TYPE_01_Continuous
whismanoid 0:cb44e2e9ec4c 4387 //~ const uint8_t custom_v_filter = 0x34; // @ v_filter=0x34 --*LINEF_11_SINC4 RATE_0100 | 60SPS
whismanoid 0:cb44e2e9ec4c 4388 //~ const uint8_t custom_v_filter = 0x00; // @ v_filter=0x00 -- LINEF_00_50Hz_60Hz_FIR RATE_0000 | 1.1SPS
whismanoid 0:cb44e2e9ec4c 4389 //~ const uint8_t custom_v_filter = 0x01; // @ v_filter=0x01 -- LINEF_00_50Hz_60Hz_FIR RATE_0001 | 2.1SPS
whismanoid 0:cb44e2e9ec4c 4390 //~ const uint8_t custom_v_filter = 0x02; // @ v_filter=0x02 -- LINEF_00_50Hz_60Hz_FIR RATE_0010 | 4.2SPS
whismanoid 0:cb44e2e9ec4c 4391 //~ const uint8_t custom_v_filter = 0x03; // @ v_filter=0x03 -- LINEF_00_50Hz_60Hz_FIR RATE_0011 | 8.4SPS
whismanoid 0:cb44e2e9ec4c 4392 //~ const uint8_t custom_v_filter = 0x04; // @ v_filter=0x04 -- LINEF_00_50Hz_60Hz_FIR RATE_0100 | 16.8SPS
whismanoid 0:cb44e2e9ec4c 4393 //~ const uint8_t custom_v_filter = 0x10; // @ v_filter=0x10 -- LINEF_01_50Hz_FIR RATE_0000 | 1.3SPS
whismanoid 0:cb44e2e9ec4c 4394 //~ const uint8_t custom_v_filter = 0x11; // @ v_filter=0x11 -- LINEF_01_50Hz_FIR RATE_0001 | 2.7SPS
whismanoid 0:cb44e2e9ec4c 4395 //~ const uint8_t custom_v_filter = 0x12; // @ v_filter=0x12 -- LINEF_01_50Hz_FIR RATE_0010 | 5.3SPS
whismanoid 0:cb44e2e9ec4c 4396 //~ const uint8_t custom_v_filter = 0x13; // @ v_filter=0x13 -- LINEF_01_50Hz_FIR RATE_0011 | 10.7SPS
whismanoid 0:cb44e2e9ec4c 4397 //~ const uint8_t custom_v_filter = 0x14; // @ v_filter=0x14 -- LINEF_01_50Hz_FIR RATE_0100 | 21.3SPS
whismanoid 0:cb44e2e9ec4c 4398 //~ const uint8_t custom_v_filter = 0x15; // @ v_filter=0x15 -- LINEF_01_50Hz_FIR RATE_0101 | 40.0SPS
whismanoid 0:cb44e2e9ec4c 4399 //~ const uint8_t custom_v_filter = 0x20; // @ v_filter=0x20 -- LINEF_10_60Hz_FIR RATE_0000 | 1.3SPS
whismanoid 0:cb44e2e9ec4c 4400 //~ const uint8_t custom_v_filter = 0x21; // @ v_filter=0x21 -- LINEF_10_60Hz_FIR RATE_0001 | 2.7SPS
whismanoid 0:cb44e2e9ec4c 4401 //~ const uint8_t custom_v_filter = 0x22; // @ v_filter=0x22 -- LINEF_10_60Hz_FIR RATE_0010 | 5.3SPS
whismanoid 0:cb44e2e9ec4c 4402 //~ const uint8_t custom_v_filter = 0x23; // @ v_filter=0x23 -- LINEF_10_60Hz_FIR RATE_0011 | 10.7SPS
whismanoid 0:cb44e2e9ec4c 4403 //~ const uint8_t custom_v_filter = 0x24; // @ v_filter=0x24 -- LINEF_10_60Hz_FIR RATE_0100 | 21.3SPS
whismanoid 0:cb44e2e9ec4c 4404 //~ const uint8_t custom_v_filter = 0x25; // @ v_filter=0x25 -- LINEF_10_60Hz_FIR RATE_0101 | 40.0SPS
whismanoid 0:cb44e2e9ec4c 4405 //~ const uint8_t custom_v_filter = 0x30; // @ v_filter=0x30 -- LINEF_11_SINC4 RATE_0000 | 4SPS
whismanoid 0:cb44e2e9ec4c 4406 //~ const uint8_t custom_v_filter = 0x31; // @ v_filter=0x31 -- LINEF_11_SINC4 RATE_0001 | 10SPS
whismanoid 0:cb44e2e9ec4c 4407 //~ const uint8_t custom_v_filter = 0x32; // @ v_filter=0x32 -- LINEF_11_SINC4 RATE_0010 | 20SPS
whismanoid 0:cb44e2e9ec4c 4408 //~ const uint8_t custom_v_filter = 0x33; // @ v_filter=0x33 -- LINEF_11_SINC4 RATE_0011 | 40SPS
whismanoid 0:cb44e2e9ec4c 4409 //~ const uint8_t custom_v_filter = 0x34; // @ v_filter=0x34 --*LINEF_11_SINC4 RATE_0100 | 60SPS
whismanoid 0:cb44e2e9ec4c 4410 //~ const uint8_t custom_v_filter = 0x35; // @ v_filter=0x35 -- LINEF_11_SINC4 RATE_0101 | 120SPS
whismanoid 0:cb44e2e9ec4c 4411 //~ const uint8_t custom_v_filter = 0x36; // @ v_filter=0x36 -- LINEF_11_SINC4 RATE_0110 | 240SPS
whismanoid 0:cb44e2e9ec4c 4412 //~ const uint8_t custom_v_filter = 0x37; // @ v_filter=0x37 -- LINEF_11_SINC4 RATE_0111 | 480SPS
whismanoid 0:cb44e2e9ec4c 4413 //~ const uint8_t custom_v_filter = 0x38; // @ v_filter=0x38 -- LINEF_11_SINC4 RATE_1000 | 960SPS
whismanoid 0:cb44e2e9ec4c 4414 //~ const uint8_t custom_v_filter = 0x39; // @ v_filter=0x39 -- LINEF_11_SINC4 RATE_1001 | 1920SPS
whismanoid 0:cb44e2e9ec4c 4415 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 4416 //
whismanoid 0:cb44e2e9ec4c 4417 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 4418 // pga register configuration in Measure_Voltage and Read_All_Voltages
whismanoid 0:cb44e2e9ec4c 4419 //~ const uint8_t custom_v_pga = 0x00; // @ v_pga=0x00 -- 0x00 SIG_PATH_00_BUFFERED
whismanoid 0:cb44e2e9ec4c 4420 //~ const uint8_t custom_v_pga = 0x00; // @ v_pga=0x00 -- 0x00 SIG_PATH_00_BUFFERED
whismanoid 0:cb44e2e9ec4c 4421 //~ const uint8_t custom_v_pga = 0x10; // @ v_pga=0x10 -- 0x10 SIG_PATH_01_BYPASS
whismanoid 0:cb44e2e9ec4c 4422 //~ const uint8_t custom_v_pga = 0x20; // @ v_pga=0x20 -- 0x20 SIG_PATH_10_PGA GAIN_000_1
whismanoid 0:cb44e2e9ec4c 4423 //~ const uint8_t custom_v_pga = 0x21; // @ v_pga=0x21 --*0x21 SIG_PATH_10_PGA GAIN_001_2
whismanoid 0:cb44e2e9ec4c 4424 //~ const uint8_t custom_v_pga = 0x22; // @ v_pga=0x22 -- 0x22 SIG_PATH_10_PGA GAIN_010_4
whismanoid 0:cb44e2e9ec4c 4425 //~ const uint8_t custom_v_pga = 0x23; // @ v_pga=0x23 -- 0x23 SIG_PATH_10_PGA GAIN_011_8
whismanoid 0:cb44e2e9ec4c 4426 //~ const uint8_t custom_v_pga = 0x24; // @ v_pga=0x24 -- 0x24 SIG_PATH_10_PGA GAIN_100_16
whismanoid 0:cb44e2e9ec4c 4427 //~ const uint8_t custom_v_pga = 0x25; // @ v_pga=0x25 -- 0x25 SIG_PATH_10_PGA GAIN_101_32
whismanoid 0:cb44e2e9ec4c 4428 //~ const uint8_t custom_v_pga = 0x26; // @ v_pga=0x26 -- 0x26 SIG_PATH_10_PGA GAIN_110_64
whismanoid 0:cb44e2e9ec4c 4429 //~ const uint8_t custom_v_pga = 0x27; // @ v_pga=0x27 -- 0x27 SIG_PATH_10_PGA GAIN_111_128
whismanoid 0:cb44e2e9ec4c 4430 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 4431 //
whismanoid 0:cb44e2e9ec4c 4432 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 4433 // ctrl register configuration in Measure_Voltage and Read_All_Voltages
whismanoid 3:9055e17e181a 4434 //~ const uint8_t custom_v_ctrl = 0x42; // @ v_ctrl=0x42 -- 0x40 unipolar, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 4435 //~ const uint8_t custom_v_ctrl = 0x40; // @ v_ctrl=0x40 -- 0x40 unipolar, 0x00 REF_SEL_000_AIN0_AIN1
whismanoid 0:cb44e2e9ec4c 4436 //~ const uint8_t custom_v_ctrl = 0x44; // @ v_ctrl=0x44 -- 0x40 unipolar, 0x04 REF_SEL_100_AIN0_AGND
whismanoid 0:cb44e2e9ec4c 4437 //~ const uint8_t custom_v_ctrl = 0x58; // @ v_ctrl=0x58 -- 0x40 unipolar, 0x00 REF_SEL_000_AIN0_AIN1, 0x18 refbuf
whismanoid 0:cb44e2e9ec4c 4438 //
whismanoid 0:cb44e2e9ec4c 4439 //~ const uint8_t custom_v_ctrl = 0x41; // @ v_ctrl=0x41 -- 0x40 unipolar, 0x01 REF_SEL_001_REF1P_REF1N
whismanoid 0:cb44e2e9ec4c 4440 //~ const uint8_t custom_v_ctrl = 0x45; // @ v_ctrl=0x45 -- 0x40 unipolar, 0x05 REF_SEL_101_REF1P_AGND
whismanoid 0:cb44e2e9ec4c 4441 //~ const uint8_t custom_v_ctrl = 0x59; // @ v_ctrl=0x59 -- 0x40 unipolar, 0x01 REF_SEL_001_REF1P_REF1N, 0x18 refbuf
whismanoid 0:cb44e2e9ec4c 4442 //
whismanoid 0:cb44e2e9ec4c 4443 //~ const uint8_t custom_v_ctrl = 0x42; // @ v_ctrl=0x42 -- 0x40 unipolar, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 4444 //~ const uint8_t custom_v_ctrl = 0x46; // @ v_ctrl=0x46 -- 0x40 unipolar, 0x06 REF_SEL_110_REF2P_AGND
whismanoid 0:cb44e2e9ec4c 4445 //~ const uint8_t custom_v_ctrl = 0x22; // @ v_ctrl=0x22 -- 0x20 bipolar offset binary, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 4446 //~ const uint8_t custom_v_ctrl = 0x02; // @ v_ctrl=0x02 -- 0x00 bipolar 2's complement, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 4447 //
whismanoid 0:cb44e2e9ec4c 4448 //~ const uint8_t custom_v_ctrl = 0x44; // @ v_ctrl=0x44 -- 0x40 unipolar, 0x04 REF_SEL_100_AIN0_AGND
whismanoid 0:cb44e2e9ec4c 4449 //~ const uint8_t custom_v_ctrl = 0x47; // @ v_ctrl=0x47 -- 0x40 unipolar, 0x07 REF_SEL_111_AVDD_AGND
whismanoid 0:cb44e2e9ec4c 4450 //~ const uint8_t custom_v_ctrl = 0x27; // @ v_ctrl=0x27 -- 0x20 bipolar offset binary, 0x07 REF_SEL_111_AVDD_AGND
whismanoid 0:cb44e2e9ec4c 4451 //~ const uint8_t custom_v_ctrl = 0x07; // @ v_ctrl=0x07 -- 0x00 bipolar 2's complement, 0x07 REF_SEL_111_AVDD_AGND
whismanoid 0:cb44e2e9ec4c 4452 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 4453
whismanoid 3:9055e17e181a 4454 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 4455 // example code declare SPI interface (GPIO controlled CS)
whismanoid 0:cb44e2e9ec4c 4456 #if defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 4457 SPI spi(SPI1_MOSI, SPI1_MISO, SPI1_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625MBED: P1_1 P1_2 P1_0 Arduino 10-pin header D11 D12 D13
whismanoid 0:cb44e2e9ec4c 4458 DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32625MBED: P1_3 Arduino 10-pin header D10
whismanoid 19:5ff09c8e9daf 4459 #elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 0:cb44e2e9ec4c 4460 #warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
whismanoid 0:cb44e2e9ec4c 4461 SPI spi(SPI0_MOSI, SPI0_MISO, SPI0_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625PICO: pin P0_5 P0_6 P0_4
whismanoid 0:cb44e2e9ec4c 4462 DigitalOut spi_cs(SPI0_SS); // TARGET_MAX32625PICO: pin P0_7
whismanoid 0:cb44e2e9ec4c 4463 #elif defined(TARGET_MAX32600MBED)
whismanoid 0:cb44e2e9ec4c 4464 SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
whismanoid 0:cb44e2e9ec4c 4465 DigitalOut spi_cs(SPI2_SS); // Generic: Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 4466 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 4467 // TODO1: avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 4468 // void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
whismanoid 0:cb44e2e9ec4c 4469 //
whismanoid 0:cb44e2e9ec4c 4470 // TODO1: NUCLEO_F446RE SPI not working; CS and MOSI data looks OK but no SCLK clock pulses.
whismanoid 0:cb44e2e9ec4c 4471 SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK); // mosi, miso, sclk spi1 TARGET_NUCLEO_F446RE: Arduino 10-pin header D11 D12 D13
whismanoid 0:cb44e2e9ec4c 4472 DigitalOut spi_cs(SPI_CS); // TARGET_NUCLEO_F446RE: PB_6 Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 4473 //
whismanoid 0:cb44e2e9ec4c 4474 #else
whismanoid 3:9055e17e181a 4475 SPI spi(D11, D12, D13); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
whismanoid 3:9055e17e181a 4476 DigitalOut spi_cs(D10); // Generic: Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 4477 #endif
whismanoid 0:cb44e2e9ec4c 4478
whismanoid 0:cb44e2e9ec4c 4479 // example code declare GPIO interface pins
whismanoid 0:cb44e2e9ec4c 4480 // example code declare device instance
whismanoid 3:9055e17e181a 4481 MAX11410 g_MAX11410_device(spi, spi_cs, MAX11410::MAX11410_IC);
whismanoid 3:9055e17e181a 4482 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 4483
whismanoid 1:747f1602abfc 4484 //--------------------------------------------------
whismanoid 3:9055e17e181a 4485 // Option to Datalog Arduino platform analog inputs
whismanoid 3:9055e17e181a 4486 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 1:747f1602abfc 4487 //#ifndef NUM_PLATFORM_ANALOG_IN_CHANNELS
whismanoid 1:747f1602abfc 4488 //#define NUM_PLATFORM_ANALOG_IN_CHANNELS 6
whismanoid 1:747f1602abfc 4489 //#endif
whismanoid 1:747f1602abfc 4490 const int NUM_PLATFORM_ANALOG_IN_CHANNELS = 6;
whismanoid 55:477ba09475d7 4491 //
whismanoid 55:477ba09475d7 4492 // Option to Datalog Arduino platform analog inputs
whismanoid 1:747f1602abfc 4493 const double adc_full_scale_voltage[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 10:04022a61b527 4494 analogInPin_fullScaleVoltage[0], // 1.2,
whismanoid 10:04022a61b527 4495 analogInPin_fullScaleVoltage[1], // 1.2,
whismanoid 10:04022a61b527 4496 analogInPin_fullScaleVoltage[2], // 1.2,
whismanoid 10:04022a61b527 4497 analogInPin_fullScaleVoltage[3], // 1.2,
whismanoid 10:04022a61b527 4498 analogInPin_fullScaleVoltage[4], // 6.0
whismanoid 10:04022a61b527 4499 analogInPin_fullScaleVoltage[5], // 6.0
whismanoid 0:cb44e2e9ec4c 4500 };
whismanoid 9:45f98573eb6d 4501 // Platform ADC individual channels 1=LSB, 2=Volt, 0=Disabled
whismanoid 9:45f98573eb6d 4502 typedef enum Platform_AIN_Enable_t {
whismanoid 9:45f98573eb6d 4503 Platform_AIN_Disable = 0,
whismanoid 9:45f98573eb6d 4504 Platform_AIN_Enable_LSB = 1,
whismanoid 9:45f98573eb6d 4505 Platform_AIN_Enable_Volt = 2,
whismanoid 55:477ba09475d7 4506 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_LSB - display math result instead of LSB in channel# position
whismanoid 55:477ba09475d7 4507 Platform_AIN_Enable_Math_LSB = 3,
whismanoid 55:477ba09475d7 4508 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_Volt - display math result instead of volts in channel# position
whismanoid 55:477ba09475d7 4509 Platform_AIN_Enable_Math_Volt = 4,
whismanoid 9:45f98573eb6d 4510 } Platform_AIN_Enable_t;
whismanoid 58:9b1e13e0527d 4511 // flash header flash_Platform_Enable_ch012345 for `Platform_Enable_ch[0..5]` array #380
whismanoid 13:184a08909405 4512 uint8_t Platform_Enable_ch[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 9:45f98573eb6d 4513 Platform_AIN_Enable_Volt, // AIN0 2=Volt
whismanoid 9:45f98573eb6d 4514 Platform_AIN_Enable_Volt, // AIN1 2=Volt
whismanoid 55:477ba09475d7 4515 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4516 Platform_AIN_Enable_Math_Volt, // Math ch2 Volt enable, offset 0.74, gainMul R206=10000, gainDiv 1, units nA
whismanoid 55:477ba09475d7 4517 #else // PLATFORM_AIN_MATH
whismanoid 9:45f98573eb6d 4518 Platform_AIN_Enable_Volt, // AIN2 2=Volt
whismanoid 55:477ba09475d7 4519 #endif // PLATFORM_AIN_MATH
whismanoid 9:45f98573eb6d 4520 Platform_AIN_Enable_Volt, // AIN3 2=Volt
whismanoid 55:477ba09475d7 4521 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4522 Platform_AIN_Enable_Math_Volt, // Math ch4 Volt enable, offset 0, gainMul 100, gainDiv 3.34, units mA
whismanoid 55:477ba09475d7 4523 #else // PLATFORM_AIN_MATH
whismanoid 9:45f98573eb6d 4524 Platform_AIN_Enable_Volt, // AIN4 2=Volt
whismanoid 55:477ba09475d7 4525 #endif // PLATFORM_AIN_MATH
whismanoid 9:45f98573eb6d 4526 Platform_AIN_Enable_Volt, // AIN5 2=Volt
whismanoid 9:45f98573eb6d 4527 };
whismanoid 55:477ba09475d7 4528 // MAX40108 Datalog Math #362 -- Platform_Enable_Math_ch[] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4529 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4530 uint8_t Platform_Enable_Math_ch[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4531 Platform_AIN_Disable,
whismanoid 55:477ba09475d7 4532 Platform_AIN_Disable,
whismanoid 55:477ba09475d7 4533 Platform_AIN_Disable, // Math ch2 Volt enable, offset 0.74, gainMul R206=10000, gainDiv 1, units nA
whismanoid 55:477ba09475d7 4534 Platform_AIN_Disable,
whismanoid 55:477ba09475d7 4535 Platform_AIN_Disable, // Math ch4 Volt enable, offset 0, gainMul 100, gainDiv 3.34, units mA
whismanoid 55:477ba09475d7 4536 Platform_AIN_Disable,
whismanoid 55:477ba09475d7 4537 };
whismanoid 55:477ba09475d7 4538 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4539 //
whismanoid 37:3f369235e5bc 4540 // Option to report average value of Arduino platform analog inputs
whismanoid 37:3f369235e5bc 4541 #ifndef USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 4542 #define USE_Platform_AIN_Average 1
whismanoid 37:3f369235e5bc 4543 //~ #undef USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 4544 #endif
whismanoid 37:3f369235e5bc 4545 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 4546 #endif // USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 4547 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 4548 int Platform_AIN_Average_N = 16;
whismanoid 37:3f369235e5bc 4549 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 4550 // Option to apply calibration to Arduino platform analog inputs
whismanoid 34:a1993a1ee904 4551 #ifndef HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 4552 #define HAS_Platform_AIN_Calibration 1
whismanoid 34:a1993a1ee904 4553 //~ #undef HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 4554 #endif
whismanoid 34:a1993a1ee904 4555 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 4556 double CalibratedNormValue(int channel_0_5, double raw_normValue_0_1);
whismanoid 34:a1993a1ee904 4557 // Calibration is between two points for each channel, defined by
whismanoid 34:a1993a1ee904 4558 // a normalized value between 0% and 100%, and the corresponding voltage.
whismanoid 34:a1993a1ee904 4559 // nominal 5% fullscale point; normValue_0_1 < 0.5
whismanoid 34:a1993a1ee904 4560 // calibration_05_normValue_0_1, calibration_05_V should be around 5% or 25%
whismanoid 42:89607d5d4e6d 4561 extern double calibration_05_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 42:89607d5d4e6d 4562 extern double calibration_05_V [NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 34:a1993a1ee904 4563 // nominal 95% fullscale point; normValue_0_1 > 0.5
whismanoid 34:a1993a1ee904 4564 // calibration_95_normValue_0_1, calibration_95_V should be around 95% or 75%
whismanoid 42:89607d5d4e6d 4565 extern double calibration_95_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 42:89607d5d4e6d 4566 extern double calibration_95_V [NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 34:a1993a1ee904 4567 #endif // HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 4568 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 4569 double CalibratedNormValue(int channel_0_5, double raw_normValue_0_1)
whismanoid 34:a1993a1ee904 4570 {
whismanoid 34:a1993a1ee904 4571 // TODO: return corrected normValue_0_1 using two-point linear calibration
whismanoid 34:a1993a1ee904 4572 // point 1: calibration_05_normValue_0_1[ch], calibration_05_V[ch]
whismanoid 34:a1993a1ee904 4573 // point 2: calibration_95_normValue_0_1[ch], calibration_95_V[ch]
whismanoid 34:a1993a1ee904 4574 // validate that there is enough span to get sensible results
whismanoid 34:a1993a1ee904 4575 //
whismanoid 34:a1993a1ee904 4576 int ch = channel_0_5;
whismanoid 34:a1993a1ee904 4577 // cmdLine.serial().printf(" %%A cal%dn=%1.9f cal%dv=%1.9fV cal%dn=%1.9f cal%dv=%1.9fV\r\n",
whismanoid 34:a1993a1ee904 4578 // ch, calibration_05_normValue_0_1[ch],
whismanoid 34:a1993a1ee904 4579 // ch, calibration_05_V[ch],
whismanoid 34:a1993a1ee904 4580 // ch, calibration_95_normValue_0_1[ch],
whismanoid 34:a1993a1ee904 4581 // ch, calibration_95_V[ch]
whismanoid 34:a1993a1ee904 4582 // );
whismanoid 34:a1993a1ee904 4583 // cmdLine.serial().printf("\r\n adc_full_scale_voltage[%d] = %1.6fV",
whismanoid 34:a1993a1ee904 4584 // ch,
whismanoid 34:a1993a1ee904 4585 // adc_full_scale_voltage[ch]
whismanoid 34:a1993a1ee904 4586 // );
whismanoid 34:a1993a1ee904 4587 // raw normValue nominal 5% and 95% points
whismanoid 34:a1993a1ee904 4588 double raw_05_normValue = calibration_05_normValue_0_1[ch];
whismanoid 34:a1993a1ee904 4589 double raw_95_normValue = calibration_95_normValue_0_1[ch];
whismanoid 34:a1993a1ee904 4590 // calibrated normValue nominal 5% and 95% points
whismanoid 34:a1993a1ee904 4591 // divide V/adc_full_scale_voltage[0] to get normValue_0_1
whismanoid 34:a1993a1ee904 4592 double cal_05_normValue = calibration_05_V[ch] / adc_full_scale_voltage[ch];
whismanoid 34:a1993a1ee904 4593 double cal_95_normValue = calibration_95_V[ch] / adc_full_scale_voltage[ch];
whismanoid 34:a1993a1ee904 4594 // cmdLine.serial().printf("\r\n CalibratedNormValue(%d, %1.6f) cal_05_normValue = %1.6f",
whismanoid 34:a1993a1ee904 4595 // ch,
whismanoid 34:a1993a1ee904 4596 // raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4597 // cal_05_normValue
whismanoid 34:a1993a1ee904 4598 // );
whismanoid 34:a1993a1ee904 4599 // cmdLine.serial().printf("\r\n CalibratedNormValue(%d, %1.6f) cal_95_normValue = %1.6f",
whismanoid 34:a1993a1ee904 4600 // ch,
whismanoid 34:a1993a1ee904 4601 // raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4602 // cal_95_normValue
whismanoid 34:a1993a1ee904 4603 // );
whismanoid 34:a1993a1ee904 4604 //
whismanoid 34:a1993a1ee904 4605 double span_raw = raw_95_normValue - raw_05_normValue;
whismanoid 34:a1993a1ee904 4606 double span_cal = cal_95_normValue - cal_05_normValue;
whismanoid 34:a1993a1ee904 4607 // cmdLine.serial().printf("\r\n CalibratedNormValue(%d, %1.6f) span_raw = %1.6f",
whismanoid 34:a1993a1ee904 4608 // ch,
whismanoid 34:a1993a1ee904 4609 // raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4610 // span_raw
whismanoid 34:a1993a1ee904 4611 // );
whismanoid 34:a1993a1ee904 4612 // cmdLine.serial().printf("\r\n CalibratedNormValue(%d, %1.6f) span_cal = %1.6f",
whismanoid 34:a1993a1ee904 4613 // ch,
whismanoid 34:a1993a1ee904 4614 // raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4615 // span_cal
whismanoid 34:a1993a1ee904 4616 // );
whismanoid 34:a1993a1ee904 4617 // if calibration is not valid, return unmodified normValue_0_1 and print a warning
whismanoid 34:a1993a1ee904 4618 if (span_raw < 0.001) {
whismanoid 34:a1993a1ee904 4619 cmdLine.serial().printf("\r\n! CalibratedNormValue(%d, %1.6f) ERRRRRR span_raw = %1.6f",
whismanoid 34:a1993a1ee904 4620 ch,
whismanoid 34:a1993a1ee904 4621 raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4622 span_raw
whismanoid 34:a1993a1ee904 4623 );
whismanoid 34:a1993a1ee904 4624 return raw_normValue_0_1;
whismanoid 34:a1993a1ee904 4625 }
whismanoid 34:a1993a1ee904 4626 if (span_cal < 0.001) {
whismanoid 34:a1993a1ee904 4627 cmdLine.serial().printf("\r\n! CalibratedNormValue(%d, %1.6f) ERRRRRR span_cal = %1.6f",
whismanoid 34:a1993a1ee904 4628 ch,
whismanoid 34:a1993a1ee904 4629 raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4630 span_cal
whismanoid 34:a1993a1ee904 4631 );
whismanoid 34:a1993a1ee904 4632 return raw_normValue_0_1;
whismanoid 34:a1993a1ee904 4633 }
whismanoid 34:a1993a1ee904 4634 double slope_correction = span_cal / span_raw;
whismanoid 34:a1993a1ee904 4635 double corrected_normValue_0_1 = cal_05_normValue + ((raw_normValue_0_1 - raw_05_normValue) * slope_correction);
whismanoid 34:a1993a1ee904 4636 // cmdLine.serial().printf("\r\n CalibratedNormValue(%d, %1.6f) slope_correction = %1.6f",
whismanoid 34:a1993a1ee904 4637 // ch,
whismanoid 34:a1993a1ee904 4638 // raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4639 // slope_correction
whismanoid 34:a1993a1ee904 4640 // );
whismanoid 34:a1993a1ee904 4641 // cmdLine.serial().printf("\r\n CalibratedNormValue(%d, %1.6f) corrected_normValue_0_1 = %1.6f\r\n",
whismanoid 34:a1993a1ee904 4642 // ch,
whismanoid 34:a1993a1ee904 4643 // raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4644 // corrected_normValue_0_1
whismanoid 34:a1993a1ee904 4645 // );
whismanoid 34:a1993a1ee904 4646 return corrected_normValue_0_1;
whismanoid 34:a1993a1ee904 4647 }
whismanoid 34:a1993a1ee904 4648 #endif // HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 4649 // Option to customize channel names in datalog header line
whismanoid 45:74bf1fe021e5 4650 // This could be used to identify external hardware attached to each input
whismanoid 13:184a08909405 4651 #if HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 4652 // WIP Editable customChannelHeader strings #363 - Platform_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 4653 #if MAX40108_DEMO
whismanoid 55:477ba09475d7 4654 char Platform_AIN_customChannelHeader_ch0[Platform_AIN_customChannelHeader_MAXLENGTH] = "=AIN4"; // MAX40108: AIN0_1V0_current_ 0.591202*100/3.34 = 17.70065868263473mA
whismanoid 55:477ba09475d7 4655 char Platform_AIN_customChannelHeader_ch1[Platform_AIN_customChannelHeader_MAXLENGTH] = "=AIN5"; // MAX40108: AIN1_1V0_voltage
whismanoid 55:477ba09475d7 4656 char Platform_AIN_customChannelHeader_ch2[Platform_AIN_customChannelHeader_MAXLENGTH] = "WE"; // MAX40108: AIN2_WE
whismanoid 55:477ba09475d7 4657 char Platform_AIN_customChannelHeader_ch3[Platform_AIN_customChannelHeader_MAXLENGTH] = "CE"; // MAX40108: AIN3_CE
whismanoid 55:477ba09475d7 4658 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4659 char Platform_AIN_customChannelHeader_ch4[Platform_AIN_customChannelHeader_MAXLENGTH] = "BATTmA"; // MAX40108: AIN4_*100/3.34=mA
whismanoid 55:477ba09475d7 4660 #else // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4661 char Platform_AIN_customChannelHeader_ch4[Platform_AIN_customChannelHeader_MAXLENGTH] = "*100/3.34=mA"; // MAX40108: AIN4_*100/3.34=mA
whismanoid 55:477ba09475d7 4662 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4663 char Platform_AIN_customChannelHeader_ch5[Platform_AIN_customChannelHeader_MAXLENGTH] = "BATTV"; // MAX40108: AIN5_CELL_VOLTAGE
whismanoid 55:477ba09475d7 4664 #else // MAX40108_DEMO ----------
whismanoid 55:477ba09475d7 4665 char Platform_AIN_customChannelHeader_ch0[Platform_AIN_customChannelHeader_MAXLENGTH] = "=AIN4";
whismanoid 55:477ba09475d7 4666 char Platform_AIN_customChannelHeader_ch1[Platform_AIN_customChannelHeader_MAXLENGTH] = "=AIN5";
whismanoid 55:477ba09475d7 4667 char Platform_AIN_customChannelHeader_ch2[Platform_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4668 char Platform_AIN_customChannelHeader_ch3[Platform_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4669 char Platform_AIN_customChannelHeader_ch4[Platform_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4670 char Platform_AIN_customChannelHeader_ch5[Platform_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4671 #endif // MAX40108_DEMO ----------
whismanoid 55:477ba09475d7 4672 static char* Platform_AIN_customChannelHeader_ch[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4673 Platform_AIN_customChannelHeader_ch0,
whismanoid 55:477ba09475d7 4674 Platform_AIN_customChannelHeader_ch1,
whismanoid 55:477ba09475d7 4675 Platform_AIN_customChannelHeader_ch2,
whismanoid 55:477ba09475d7 4676 Platform_AIN_customChannelHeader_ch3,
whismanoid 55:477ba09475d7 4677 Platform_AIN_customChannelHeader_ch4,
whismanoid 55:477ba09475d7 4678 Platform_AIN_customChannelHeader_ch5,
whismanoid 13:184a08909405 4679 };
whismanoid 13:184a08909405 4680 #endif // HAS_Platform_AIN_customChannelHeader
whismanoid 55:477ba09475d7 4681 // MAX40108 Datalog Math #362 -- Platform_MathOffsetA[] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4682 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4683 double Platform_MathOffsetA[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4684 0,
whismanoid 55:477ba09475d7 4685 0,
whismanoid 55:477ba09475d7 4686 0.74, // Math ch2 Volt enable, offset 0.74, gainMul R206=10000, gainDiv 1, units nA
whismanoid 55:477ba09475d7 4687 0,
whismanoid 55:477ba09475d7 4688 0, // Math ch4 Volt enable, offset 0, gainMul 100, gainDiv 3.34, units mA
whismanoid 55:477ba09475d7 4689 0,
whismanoid 55:477ba09475d7 4690 };
whismanoid 55:477ba09475d7 4691 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4692 //
whismanoid 55:477ba09475d7 4693 // MAX40108 Datalog Math #362 -- Platform_MathGainMulA[] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4694 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4695 double Platform_MathGainMulA[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4696 1.0,
whismanoid 55:477ba09475d7 4697 1.0,
whismanoid 55:477ba09475d7 4698 10000.0, // Math ch2 Volt enable, offset 0.74, gainMul R206=10000, gainDiv 1, units nA
whismanoid 55:477ba09475d7 4699 1.0,
whismanoid 55:477ba09475d7 4700 100.0, // Math ch4 Volt enable, offset 0, gainMul 100, gainDiv 3.34, units mA
whismanoid 55:477ba09475d7 4701 1.0,
whismanoid 55:477ba09475d7 4702 };
whismanoid 55:477ba09475d7 4703 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4704 //
whismanoid 55:477ba09475d7 4705 // MAX40108 Datalog Math #362 -- Platform_MathGainDivA[] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4706 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4707 double Platform_MathGainDivA[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4708 1.0,
whismanoid 55:477ba09475d7 4709 1.0,
whismanoid 55:477ba09475d7 4710 1.0, // Math ch2 Volt enable, offset 0.74, gainMul R206=10000, gainDiv 1, units nA
whismanoid 55:477ba09475d7 4711 1.0,
whismanoid 55:477ba09475d7 4712 3.34, // Math ch4 Volt enable, offset 0, gainMul 100, gainDiv 3.34, units mA
whismanoid 55:477ba09475d7 4713 1.0,
whismanoid 55:477ba09475d7 4714 };
whismanoid 55:477ba09475d7 4715 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4716 //
whismanoid 55:477ba09475d7 4717 // MAX40108 Datalog Math #362 -- Platform_MathUnitString[] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4718 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4719 // WIP Editable customChannelHeader strings #363 - Platform_MathUnitString
whismanoid 55:477ba09475d7 4720 #define Platform_MathUnitString_MAXLENGTH 20
whismanoid 55:477ba09475d7 4721 #if MAX40108_DEMO
whismanoid 55:477ba09475d7 4722 char Platform_MathUnitString_ch0[Platform_MathUnitString_MAXLENGTH] = "mA"; // MAX40108: AIN0_1V0_current_ 0.591202*100/3.34 = 17.70065868263473mA
whismanoid 55:477ba09475d7 4723 char Platform_MathUnitString_ch1[Platform_MathUnitString_MAXLENGTH] = "V"; // MAX40108: AIN1_1V0_voltage
whismanoid 55:477ba09475d7 4724 char Platform_MathUnitString_ch2[Platform_MathUnitString_MAXLENGTH] = "nA"; // MAX40108: AIN2_WE // Math ch2 Volt enable, offset 0.74, gainMul R206=10000, gainDiv 1, units nA
whismanoid 55:477ba09475d7 4725 char Platform_MathUnitString_ch3[Platform_MathUnitString_MAXLENGTH] = "V"; // MAX40108: AIN3_CE
whismanoid 55:477ba09475d7 4726 char Platform_MathUnitString_ch4[Platform_MathUnitString_MAXLENGTH] = "mA"; // MAX40108: AIN4_*100/3.34=mA // Math ch4 Volt enable, offset 0, gainMul 100, gainDiv 3.34, units mA
whismanoid 55:477ba09475d7 4727 char Platform_MathUnitString_ch5[Platform_MathUnitString_MAXLENGTH] = "V"; // MAX40108: AIN5_CELL_VOLTAGE
whismanoid 55:477ba09475d7 4728 #else // MAX40108_DEMO ----------
whismanoid 55:477ba09475d7 4729 char Platform_MathUnitString_ch0[Platform_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4730 char Platform_MathUnitString_ch1[Platform_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4731 char Platform_MathUnitString_ch2[Platform_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4732 char Platform_MathUnitString_ch3[Platform_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4733 char Platform_MathUnitString_ch4[Platform_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4734 char Platform_MathUnitString_ch5[Platform_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4735 #endif // MAX40108_DEMO ----------
whismanoid 55:477ba09475d7 4736 static char* Platform_MathUnitString[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4737 Platform_MathUnitString_ch0,
whismanoid 55:477ba09475d7 4738 Platform_MathUnitString_ch1,
whismanoid 55:477ba09475d7 4739 Platform_MathUnitString_ch2,
whismanoid 55:477ba09475d7 4740 Platform_MathUnitString_ch3,
whismanoid 55:477ba09475d7 4741 Platform_MathUnitString_ch4,
whismanoid 55:477ba09475d7 4742 Platform_MathUnitString_ch5,
whismanoid 55:477ba09475d7 4743 };
whismanoid 55:477ba09475d7 4744 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4745 //
whismanoid 1:747f1602abfc 4746 //--------------------------------------------------
whismanoid 1:747f1602abfc 4747 // Option to log platform analog inputs as raw LSB code
whismanoid 1:747f1602abfc 4748 #ifndef LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 1:747f1602abfc 4749 #define LOG_PLATFORM_ANALOG_IN_LSB 0
whismanoid 1:747f1602abfc 4750 #endif
whismanoid 1:747f1602abfc 4751 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 1:747f1602abfc 4752 int Platform_LSB[NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 1:747f1602abfc 4753 #endif
whismanoid 1:747f1602abfc 4754
whismanoid 1:747f1602abfc 4755 //--------------------------------------------------
whismanoid 1:747f1602abfc 4756 // Option to use platform analog inputs as Voltage
whismanoid 1:747f1602abfc 4757 #ifndef LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 1:747f1602abfc 4758 #define LOG_PLATFORM_ANALOG_IN_VOLTS 1
whismanoid 1:747f1602abfc 4759 #endif
whismanoid 1:747f1602abfc 4760 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 1:747f1602abfc 4761 double Platform_Voltage[NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 1:747f1602abfc 4762 #endif
whismanoid 3:9055e17e181a 4763 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 0:cb44e2e9ec4c 4764
whismanoid 10:04022a61b527 4765 //--------------------------------------------------
whismanoid 10:04022a61b527 4766 // Option to use Command forwarding to Auxiliary serial port
whismanoid 10:04022a61b527 4767 // Command forwarding to Auxiliary serial port TX/RX
whismanoid 10:04022a61b527 4768 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial
whismanoid 10:04022a61b527 4769 // Command forwarding to DAPLINK serial TX/RX cmdLine_DAPLINKserial
whismanoid 10:04022a61b527 4770 // prefer cmdLine_AUXserial if available, else cmdLine_DAPLINKserial; else we don't have this feature
whismanoid 10:04022a61b527 4771 #ifndef USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4772 #define USE_AUX_SERIAL_CMD_FORWARDING 1
whismanoid 10:04022a61b527 4773 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4774 #if USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4775 // Command forwarding to Auxiliary serial port TX/RX #257 -- global parameters
whismanoid 49:359a6b9df7c1 4776 const size_t RX_STRING_BUF_SIZE = 5000;
whismanoid 10:04022a61b527 4777 int g_auxSerialCom_baud = 9600; //!< baud rate Auxiliary serial port
whismanoid 10:04022a61b527 4778 // transmit command string by AUX TX
whismanoid 10:04022a61b527 4779 #if 0
whismanoid 10:04022a61b527 4780 int g_auxSerialCom_tx_wait_echo = 0; //!< TX wait for each character echo?
whismanoid 10:04022a61b527 4781 int g_auxSerialCom_tx_char_delay_ms = 0; //!< TX delay after each char?
whismanoid 10:04022a61b527 4782 int g_auxSerialCom_tx_line_delay_ms = 0; //!< TX delay after each CR/LF?
whismanoid 10:04022a61b527 4783 #endif
whismanoid 10:04022a61b527 4784 // capture received string from AUX RX
whismanoid 10:04022a61b527 4785 Timer g_auxSerialCom_Timer;
whismanoid 10:04022a61b527 4786 int g_auxSerialCom_Timer_begin_message_ms = 0; //!< start of message
whismanoid 10:04022a61b527 4787 int g_auxSerialCom_Timer_begin_rx_idle_ms = 0; //!< recent RX character timestamp
whismanoid 10:04022a61b527 4788 int g_auxSerialCom_message_ms = 10000; //!< maximum RX message total response time
whismanoid 10:04022a61b527 4789 int g_auxSerialCom_rx_idle_ms = 500; //!< maximum RX message idle time between characters
whismanoid 10:04022a61b527 4790 int g_auxSerialCom_rx_max_count = RX_STRING_BUF_SIZE-1; //!< maximum RX message total length
whismanoid 10:04022a61b527 4791 const int aux_serial_cmd_forwarding_rx_eot_not_used = 'x';
whismanoid 10:04022a61b527 4792 int g_auxSerialCom_rx_eot = aux_serial_cmd_forwarding_rx_eot_not_used; //!< capture RX until match end of text char
whismanoid 10:04022a61b527 4793 //~ int g_auxSerialCom_rx_eot = 0; //!< capture RX until match end of text string?
whismanoid 10:04022a61b527 4794 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4795 #if USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4796 // TODO WIP Command forwarding to Auxiliary serial port TX/RX #257
whismanoid 10:04022a61b527 4797 // prefer cmdLine_AUXserial if available, else cmdLine_DAPLINKserial; else we don't have this feature
whismanoid 10:04022a61b527 4798 # if HAS_AUX_SERIAL
whismanoid 10:04022a61b527 4799 // TODO WIP Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257
whismanoid 10:04022a61b527 4800 # elif HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 4801 // TODO WIP Command forwarding to DAPLINK serial TX/RX cmdLine_DAPLINKserial #257
whismanoid 10:04022a61b527 4802 # else // neither HAS_AUX_SERIAL HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 4803 #warning "info: USE_AUX_SERIAL_CMD_FORWARDING should not be enabled without HAS_AUX_SERIAL or HAS_DAPLINK_SERIAL"
whismanoid 10:04022a61b527 4804 # endif // HAS_AUX_SERIAL HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 4805 # if HAS_AUX_SERIAL
whismanoid 10:04022a61b527 4806 // TODO WIP Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257
whismanoid 10:04022a61b527 4807 # endif // HAS_AUX_SERIAL
whismanoid 10:04022a61b527 4808 # if HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 4809 // TODO WIP Command forwarding to DAPLINK serial TX/RX cmdLine_DAPLINKserial #257
whismanoid 10:04022a61b527 4810 # endif // HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 4811 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4812
whismanoid 8:dffee7509bfb 4813 // CODE GENERATOR: example code for ADC: serial port declaration
whismanoid 8:dffee7509bfb 4814 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4815 // Declare the Serial driver
whismanoid 8:dffee7509bfb 4816 // default baud rate settings are 9600 8N1
whismanoid 8:dffee7509bfb 4817 // install device driver from http://developer.mbed.org/media/downloads/drivers/mbedWinSerial_16466.exe
whismanoid 8:dffee7509bfb 4818 // see docs https://docs.mbed.com/docs/mbed-os-handbook/en/5.5/getting_started/what_need/
whismanoid 8:dffee7509bfb 4819 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4820 #if defined(TARGET_MAX32630)
whismanoid 8:dffee7509bfb 4821 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32630FTHR: P0_1,P0_0 (Bluetooth PAN1326B)
whismanoid 8:dffee7509bfb 4822 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX32630FTHR: P2_1,P2_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4823 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32630FTHR: P3_1,P3_0 (J1.15,J1.14)
whismanoid 8:dffee7509bfb 4824 //Serial UART3serial(UART3_TX,UART3_RX); // tx,rx UART3 MAX32630FTHR: P5_4,P5_3 (J3.7,J3.8)
whismanoid 8:dffee7509bfb 4825 //
whismanoid 8:dffee7509bfb 4826 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial
whismanoid 8:dffee7509bfb 4827 Serial AUXserial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32630FTHR: P3_1,P3_0 (J1.15,J1.14)
whismanoid 8:dffee7509bfb 4828 //Serial J3AUXserial(UART3_TX,UART3_RX); // tx,rx UART3 MAX32630FTHR: P5_4,P5_3 (J3.7,J3.8)
whismanoid 8:dffee7509bfb 4829 //Serial BTAUXserial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32630FTHR: P0_1,P0_0 (Bluetooth PAN1326B)
whismanoid 8:dffee7509bfb 4830 #define HAS_AUX_SERIAL 1
whismanoid 8:dffee7509bfb 4831 //
whismanoid 8:dffee7509bfb 4832 // Hardware serial port over DAPLink
whismanoid 8:dffee7509bfb 4833 // The default baud rate for the DapLink UART is 9600
whismanoid 8:dffee7509bfb 4834 Serial DAPLINKserial(P2_1,P2_0); // tx,rx UART1 MAX32630FTHR: P2_1,P2_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4835 #define HAS_DAPLINK_SERIAL 1
whismanoid 8:dffee7509bfb 4836 //
whismanoid 8:dffee7509bfb 4837 // Virtual serial port over USB
whismanoid 8:dffee7509bfb 4838 #include "USBSerial.h"
whismanoid 8:dffee7509bfb 4839 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 8:dffee7509bfb 4840 USBSerial serial;
whismanoid 8:dffee7509bfb 4841 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4842 #elif defined(TARGET_MAX32625MBED)
whismanoid 8:dffee7509bfb 4843 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32625MBED: P0_1,P0_0 (Arduino D1,D0)
whismanoid 8:dffee7509bfb 4844 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX32625MBED: P2_1,P2_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4845 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32625MBED: P3_1,P3_0 (J15-LEDgreen,LEDred)
whismanoid 8:dffee7509bfb 4846 //
whismanoid 8:dffee7509bfb 4847 // Hardware serial port over DAPLink
whismanoid 8:dffee7509bfb 4848 // The default baud rate for the DapLink UART is 9600
whismanoid 8:dffee7509bfb 4849 Serial DAPLINKserial(P2_1,P2_0); // tx,rx UART1 MAX32625MBED: P2_1,P2_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4850 #define HAS_DAPLINK_SERIAL 1
whismanoid 8:dffee7509bfb 4851 //
whismanoid 8:dffee7509bfb 4852 // Virtual serial port over USB
whismanoid 8:dffee7509bfb 4853 #include "USBSerial.h"
whismanoid 8:dffee7509bfb 4854 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 8:dffee7509bfb 4855 USBSerial serial;
whismanoid 8:dffee7509bfb 4856 //--------------------------------------------------
whismanoid 22:d6dc8a85f435 4857 #elif defined(TARGET_MAX32625PICO)
whismanoid 8:dffee7509bfb 4858 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32625PICO: P0_1,P0_0 (pin 19/20)
whismanoid 8:dffee7509bfb 4859 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX32625PICO: P2_1,P2_0 (underside?)
whismanoid 8:dffee7509bfb 4860 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32625PICO: P3_1,P3_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4861 //
whismanoid 8:dffee7509bfb 4862 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial
whismanoid 8:dffee7509bfb 4863 Serial AUXserial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32625PICO: P0_1,P0_0 (pin 19/20)
whismanoid 8:dffee7509bfb 4864 #define HAS_AUX_SERIAL 1
whismanoid 8:dffee7509bfb 4865 //
whismanoid 8:dffee7509bfb 4866 // Hardware serial port over DAPLink
whismanoid 8:dffee7509bfb 4867 Serial DAPLINKserial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32625PICO: P3_1,P3_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4868 #define HAS_DAPLINK_SERIAL 1
whismanoid 8:dffee7509bfb 4869 //
whismanoid 8:dffee7509bfb 4870 // Virtual serial port over USB
whismanoid 8:dffee7509bfb 4871 #include "USBSerial.h"
whismanoid 8:dffee7509bfb 4872 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 8:dffee7509bfb 4873 USBSerial serial;
whismanoid 22:d6dc8a85f435 4874 //--------------------------------------------------
whismanoid 22:d6dc8a85f435 4875 #elif defined(TARGET_MAX40108DEMOP2U9)
whismanoid 22:d6dc8a85f435 4876 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX40108DEMOP2U9: P0_1,P0_0 (J90.1/J90.0 to console)
whismanoid 22:d6dc8a85f435 4877 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK)
whismanoid 22:d6dc8a85f435 4878 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX40108DEMOP2U9: P3_1,P3_0 (unavailable)
whismanoid 22:d6dc8a85f435 4879 //
whismanoid 22:d6dc8a85f435 4880 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial is used as main serial port in MAX40108 Demo board
whismanoid 22:d6dc8a85f435 4881 Serial serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX40108DEMOP2U9: P0_1,P0_0 (J90.1/J90.0 to console)
whismanoid 22:d6dc8a85f435 4882 // #define HAS_AUX_SERIAL 1
whismanoid 22:d6dc8a85f435 4883 //
whismanoid 22:d6dc8a85f435 4884 // Hardware serial port over DAPLink
whismanoid 22:d6dc8a85f435 4885 // connection to external MAX32625PICO(DAPLINK) needed TX/RX swap in firmware.
whismanoid 22:d6dc8a85f435 4886 // MAX32625PICO(DAPLINK) drives DAPLINK.8, listens on DAPLINK.6.
whismanoid 22:d6dc8a85f435 4887 // See AN6350 MAX32625 Users Guide 7.5.2.3.1 TX and RX Pin Mapping for UART 1 -- Mapping Option B
whismanoid 39:4d285e961435 4888 #ifdef BOARD_SERIAL_NUMBER
whismanoid 39:4d285e961435 4889 // data unique to certain boards based on serial number
whismanoid 39:4d285e961435 4890 # if (BOARD_SERIAL_NUMBER) == 0
whismanoid 39:4d285e961435 4891 #warning "(BOARD_SERIAL_NUMBER) == 0"
whismanoid 39:4d285e961435 4892 // s/n 0 is not really a MAX40108 board, it's actually a MAX32625PICO used for early development. So no swap.
whismanoid 39:4d285e961435 4893 Serial DAPLINKserial(UART1_TX,UART1_RX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option A (normal)
whismanoid 39:4d285e961435 4894 //Serial DAPLINKserial(UART1_RX,UART1_TX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option B (TX/RX-swap)
whismanoid 39:4d285e961435 4895 #define HAS_DAPLINK_SERIAL 1
whismanoid 39:4d285e961435 4896 //
whismanoid 39:4d285e961435 4897 // # elif (BOARD_SERIAL_NUMBER) == 1
whismanoid 39:4d285e961435 4898 // #warning "(BOARD_SERIAL_NUMBER) == 1"
whismanoid 39:4d285e961435 4899 // //
whismanoid 39:4d285e961435 4900 // # elif (BOARD_SERIAL_NUMBER) == 2
whismanoid 39:4d285e961435 4901 // #warning "(BOARD_SERIAL_NUMBER) == 2"
whismanoid 39:4d285e961435 4902 // //
whismanoid 39:4d285e961435 4903 // # elif (BOARD_SERIAL_NUMBER) == 3
whismanoid 39:4d285e961435 4904 // #warning "(BOARD_SERIAL_NUMBER) == 3"
whismanoid 39:4d285e961435 4905 // //
whismanoid 39:4d285e961435 4906 // # elif (BOARD_SERIAL_NUMBER) == 4
whismanoid 39:4d285e961435 4907 // #warning "(BOARD_SERIAL_NUMBER) == 4"
whismanoid 39:4d285e961435 4908 // //
whismanoid 39:4d285e961435 4909 // # elif (BOARD_SERIAL_NUMBER) == 5
whismanoid 39:4d285e961435 4910 // #warning "(BOARD_SERIAL_NUMBER) == 5"
whismanoid 39:4d285e961435 4911 // //
whismanoid 39:4d285e961435 4912 // # elif (BOARD_SERIAL_NUMBER) == 6
whismanoid 39:4d285e961435 4913 // #warning "(BOARD_SERIAL_NUMBER) == 6"
whismanoid 39:4d285e961435 4914 // //
whismanoid 39:4d285e961435 4915 # else
whismanoid 39:4d285e961435 4916 // #warning "BOARD_SERIAL_NUMBER defined but not recognized"
whismanoid 22:d6dc8a85f435 4917 //Serial DAPLINKserial(UART1_TX,UART1_RX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option A (normal)
whismanoid 22:d6dc8a85f435 4918 Serial DAPLINKserial(UART1_RX,UART1_TX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option B (TX/RX-swap)
whismanoid 22:d6dc8a85f435 4919 #define HAS_DAPLINK_SERIAL 1
whismanoid 39:4d285e961435 4920 # endif
whismanoid 39:4d285e961435 4921 #else // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 39:4d285e961435 4922 #warning "BOARD_SERIAL_NUMBER not defined; using default values"
whismanoid 39:4d285e961435 4923 //Serial DAPLINKserial(UART1_TX,UART1_RX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option A (normal)
whismanoid 39:4d285e961435 4924 Serial DAPLINKserial(UART1_RX,UART1_TX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option B (TX/RX-swap)
whismanoid 39:4d285e961435 4925 #define HAS_DAPLINK_SERIAL 1
whismanoid 39:4d285e961435 4926 //
whismanoid 39:4d285e961435 4927 #endif // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 22:d6dc8a85f435 4928 //
whismanoid 22:d6dc8a85f435 4929 // Serial AUXserial(UART1_TX,UART1_RX); // tx,rx UART2 MAX40108DEMOP2U9: P3_1,P3_0 (unavailable)
whismanoid 22:d6dc8a85f435 4930 // #define HAS_AUX_SERIAL 1
whismanoid 22:d6dc8a85f435 4931 //
whismanoid 22:d6dc8a85f435 4932 // Virtual serial port over USB
whismanoid 22:d6dc8a85f435 4933 // #include "USBSerial.h"
whismanoid 22:d6dc8a85f435 4934 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 22:d6dc8a85f435 4935 //USBSerial serial;
whismanoid 8:dffee7509bfb 4936 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4937 #elif defined(TARGET_MAX32620FTHR)
whismanoid 8:dffee7509bfb 4938 #warning "TARGET_MAX32620FTHR not previously tested; need to define serial pins..."
whismanoid 8:dffee7509bfb 4939 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32620FTHR: P0_1,P0_0 (PMOD0.2,PMOD0.3)
whismanoid 8:dffee7509bfb 4940 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX32620FTHR: P2_1,P2_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4941 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32620FTHR: P3_1,P3_0 (J1.15,J1.14)
whismanoid 8:dffee7509bfb 4942 //Serial UART3serial(UART3_TX,UART3_RX); // tx,rx UART3 MAX32620FTHR: P5_4,P5_3 (J2.7,J2.8)
whismanoid 8:dffee7509bfb 4943 //
whismanoid 8:dffee7509bfb 4944 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial
whismanoid 8:dffee7509bfb 4945 Serial serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32620FTHR: P3_1,P3_0 (J1.15,J1.14)
whismanoid 8:dffee7509bfb 4946 //Serial AUXserial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32620FTHR: P3_1,P3_0 (J1.15,J1.14)
whismanoid 8:dffee7509bfb 4947 Serial AUXserial(UART3_TX,UART3_RX); // tx,rx UART3 MAX32620FTHR: P5_4,P5_3 (J2.7,J2.8)
whismanoid 8:dffee7509bfb 4948 //Serial PMOD0AUXserial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32620FTHR: P0_1,P0_0 (PMOD0.2,PMOD0.3)
whismanoid 8:dffee7509bfb 4949 #define HAS_AUX_SERIAL 1
whismanoid 8:dffee7509bfb 4950 //
whismanoid 8:dffee7509bfb 4951 // Hardware serial port over DAPLink
whismanoid 8:dffee7509bfb 4952 // The default baud rate for the DapLink UART is 9600
whismanoid 8:dffee7509bfb 4953 Serial DAPLINKserial(USBTX, USBRX); // tx,rx MAX32620FTHR: P2_1,P2_0
whismanoid 8:dffee7509bfb 4954 //Serial DAPLINKserial(STDIO_UART_TX, STDIO_UART_RX); // tx, rx
whismanoid 8:dffee7509bfb 4955 #define HAS_DAPLINK_SERIAL 1
whismanoid 8:dffee7509bfb 4956 //
whismanoid 8:dffee7509bfb 4957 // Virtual serial port over USB
whismanoid 8:dffee7509bfb 4958 // #include "USBSerial.h"
whismanoid 8:dffee7509bfb 4959 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 8:dffee7509bfb 4960 //USBSerial serial; // MAX32620FTHR: USBSerial crash??
whismanoid 8:dffee7509bfb 4961 #warning "TARGET_MAX32620FTHR not previously tested; USBSerial crash?"
whismanoid 8:dffee7509bfb 4962 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4963 #elif defined(TARGET_MAX32600)
whismanoid 8:dffee7509bfb 4964 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32600MBED: P1_1,P1_0 (Arduino D1,D0)(DAPLINK)
whismanoid 8:dffee7509bfb 4965 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART2 MAX32625MBED: P1_3,P1_2 (Arduino D3,D2)
whismanoid 8:dffee7509bfb 4966 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART1 MAX32625MBED: P7_3,P7_2 ( ?? )
whismanoid 8:dffee7509bfb 4967 //
whismanoid 8:dffee7509bfb 4968 // Hardware serial port over DAPLink
whismanoid 8:dffee7509bfb 4969 // The default baud rate for the DapLink UART is 9600
whismanoid 8:dffee7509bfb 4970 Serial DAPLINKserial(P1_1,P1_0); // tx,rx UART0 MAX32600MBED: P1_1,P1_0 (Arduino D1,D0)(DAPLINK)
whismanoid 8:dffee7509bfb 4971 #define HAS_DAPLINK_SERIAL 1
whismanoid 8:dffee7509bfb 4972 //
whismanoid 8:dffee7509bfb 4973 // Virtual serial port over USB
whismanoid 8:dffee7509bfb 4974 #include "USBSerial.h"
whismanoid 8:dffee7509bfb 4975 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 8:dffee7509bfb 4976 USBSerial serial;
whismanoid 8:dffee7509bfb 4977 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4978 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 8:dffee7509bfb 4979 Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx
whismanoid 8:dffee7509bfb 4980 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4981 #else
whismanoid 8:dffee7509bfb 4982 #if defined(SERIAL_TX)
whismanoid 8:dffee7509bfb 4983 #warning "target not previously tested; guess serial pins are SERIAL_TX, SERIAL_RX..."
whismanoid 8:dffee7509bfb 4984 Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx
whismanoid 8:dffee7509bfb 4985 #elif defined(USBTX)
whismanoid 8:dffee7509bfb 4986 #warning "target not previously tested; guess serial pins are USBTX, USBRX..."
whismanoid 8:dffee7509bfb 4987 Serial serial(USBTX, USBRX); // tx, rx
whismanoid 8:dffee7509bfb 4988 #elif defined(UART_TX)
whismanoid 8:dffee7509bfb 4989 #warning "target not previously tested; guess serial pins are UART_TX, UART_RX..."
whismanoid 8:dffee7509bfb 4990 Serial serial(UART_TX, UART_RX); // tx, rx
whismanoid 8:dffee7509bfb 4991 #else
whismanoid 8:dffee7509bfb 4992 #warning "target not previously tested; need to define serial pins..."
whismanoid 8:dffee7509bfb 4993 #endif
whismanoid 8:dffee7509bfb 4994 #endif
whismanoid 8:dffee7509bfb 4995 //
whismanoid 8:dffee7509bfb 4996 #include "CmdLine.h"
whismanoid 8:dffee7509bfb 4997
whismanoid 8:dffee7509bfb 4998 # if HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 4999 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial
whismanoid 8:dffee7509bfb 5000 CmdLine cmdLine_AUXserial(AUXserial, "AUXserial");
whismanoid 10:04022a61b527 5001 uint8_t Datalogger_enable_AUXserial = {
whismanoid 10:04022a61b527 5002 #if USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 5003 // Command forwarding to Auxiliary serial port;
whismanoid 10:04022a61b527 5004 // don't accept commands from Auxiliary serial port
whismanoid 10:04022a61b527 5005 false
whismanoid 10:04022a61b527 5006 #else // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 5007 true
whismanoid 10:04022a61b527 5008 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 5009 };
whismanoid 8:dffee7509bfb 5010 # endif // HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 5011 # if HAS_DAPLINK_SERIAL
whismanoid 8:dffee7509bfb 5012 CmdLine cmdLine_DAPLINKserial(DAPLINKserial, "DAPLINK");
whismanoid 8:dffee7509bfb 5013 uint8_t Datalogger_enable_DAPLINKserial = true;
whismanoid 8:dffee7509bfb 5014 # endif // HAS_DAPLINK_SERIAL
whismanoid 8:dffee7509bfb 5015 CmdLine cmdLine(serial, "serial");
whismanoid 8:dffee7509bfb 5016 uint8_t Datalogger_enable_serial = true;
whismanoid 8:dffee7509bfb 5017 // CODE GENERATOR: example code for ADC: serial port declaration (end)
whismanoid 8:dffee7509bfb 5018
whismanoid 21:ac062a97a71d 5019
whismanoid 21:ac062a97a71d 5020 //--------------------------------------------------
whismanoid 23:c6c652bef4b9 5021 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5022 // support for commands %B1! .. %B9!
whismanoid 23:c6c652bef4b9 5023 #ifndef USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5024 #define USE_DATALOGGER_CommandTable 1
whismanoid 23:c6c652bef4b9 5025 //~ #undef USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5026 #endif
whismanoid 23:c6c652bef4b9 5027 #if USE_DATALOGGER_CommandTable // Run_command_table(onButton1_command_table)
whismanoid 23:c6c652bef4b9 5028 const int COMMAND_TABLE_ROW_MAX = 10;
whismanoid 23:c6c652bef4b9 5029 const int COMMAND_TABLE_COL_MAX = 40;
whismanoid 23:c6c652bef4b9 5030 #endif // USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5031 //
whismanoid 23:c6c652bef4b9 5032 #if USE_DATALOGGER_CommandTable // Run_command_table(onButton1_command_table)
whismanoid 23:c6c652bef4b9 5033 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 23:c6c652bef4b9 5034 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5035 // onButton1_command_table[] supports command %B1! -- run, %B1@ -- edit
whismanoid 45:74bf1fe021e5 5036 // MAX40108p2 hardware pin P2_7 button SW1 active low
whismanoid 45:74bf1fe021e5 5037 //........................................................12345678901234567890
whismanoid 45:74bf1fe021e5 5038 char onButton1_command_table_00[COMMAND_TABLE_COL_MAX] = "# SW1 event";
whismanoid 45:74bf1fe021e5 5039 char onButton1_command_table_01[COMMAND_TABLE_COL_MAX] = ">>SW1=LP1 deep sleep 10 sec";
whismanoid 45:74bf1fe021e5 5040 char onButton1_command_table_02[COMMAND_TABLE_COL_MAX] = "%H91"; // LED off
whismanoid 45:74bf1fe021e5 5041 char onButton1_command_table_03[COMMAND_TABLE_COL_MAX] = "%H92"; // LED off
whismanoid 45:74bf1fe021e5 5042 char onButton1_command_table_04[COMMAND_TABLE_COL_MAX] = "%H93"; // LED off
whismanoid 45:74bf1fe021e5 5043 char onButton1_command_table_05[COMMAND_TABLE_COL_MAX] = "%H9"; // diagnostic pulse D9
whismanoid 45:74bf1fe021e5 5044 char onButton1_command_table_06[COMMAND_TABLE_COL_MAX] = "LT count=10 base=1000 sleep=1";
whismanoid 45:74bf1fe021e5 5045 char onButton1_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5046 char onButton1_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5047 char onButton1_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5048 static char* onButton1_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 23:c6c652bef4b9 5049 onButton1_command_table_00,
whismanoid 23:c6c652bef4b9 5050 onButton1_command_table_01,
whismanoid 23:c6c652bef4b9 5051 onButton1_command_table_02,
whismanoid 23:c6c652bef4b9 5052 onButton1_command_table_03,
whismanoid 23:c6c652bef4b9 5053 onButton1_command_table_04,
whismanoid 23:c6c652bef4b9 5054 onButton1_command_table_05,
whismanoid 23:c6c652bef4b9 5055 onButton1_command_table_06,
whismanoid 23:c6c652bef4b9 5056 onButton1_command_table_07,
whismanoid 23:c6c652bef4b9 5057 onButton1_command_table_08,
whismanoid 23:c6c652bef4b9 5058 onButton1_command_table_09,
whismanoid 23:c6c652bef4b9 5059 };
whismanoid 23:c6c652bef4b9 5060 #endif // HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 23:c6c652bef4b9 5061 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 23:c6c652bef4b9 5062 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5063 // onButton2_command_table[] supports command %B2! -- run, %B2@ -- edit
whismanoid 45:74bf1fe021e5 5064 // MAX40108p2 hardware pin P1_7 connector J91.3 active low
whismanoid 45:74bf1fe021e5 5065 //........................................................12345678901234567890
whismanoid 45:74bf1fe021e5 5066 char onButton2_command_table_00[COMMAND_TABLE_COL_MAX] = "# J91.3=Halt"; // remark
whismanoid 45:74bf1fe021e5 5067 char onButton2_command_table_01[COMMAND_TABLE_COL_MAX] = "%L91"; // LED on
whismanoid 45:74bf1fe021e5 5068 char onButton2_command_table_02[COMMAND_TABLE_COL_MAX] = "L"; // halts data logging
whismanoid 45:74bf1fe021e5 5069 char onButton2_command_table_03[COMMAND_TABLE_COL_MAX] = "%H92"; // LED off
whismanoid 45:74bf1fe021e5 5070 char onButton2_command_table_04[COMMAND_TABLE_COL_MAX] = "%L93"; // LED on
whismanoid 45:74bf1fe021e5 5071 char onButton2_command_table_05[COMMAND_TABLE_COL_MAX] = ">>J91.2=Halt"; // to DAPLINK comms
whismanoid 23:c6c652bef4b9 5072 char onButton2_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5073 char onButton2_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5074 char onButton2_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5075 char onButton2_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5076 static char* onButton2_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 23:c6c652bef4b9 5077 onButton2_command_table_00,
whismanoid 23:c6c652bef4b9 5078 onButton2_command_table_01,
whismanoid 23:c6c652bef4b9 5079 onButton2_command_table_02,
whismanoid 23:c6c652bef4b9 5080 onButton2_command_table_03,
whismanoid 23:c6c652bef4b9 5081 onButton2_command_table_04,
whismanoid 23:c6c652bef4b9 5082 onButton2_command_table_05,
whismanoid 23:c6c652bef4b9 5083 onButton2_command_table_06,
whismanoid 23:c6c652bef4b9 5084 onButton2_command_table_07,
whismanoid 23:c6c652bef4b9 5085 onButton2_command_table_08,
whismanoid 23:c6c652bef4b9 5086 onButton2_command_table_09,
whismanoid 23:c6c652bef4b9 5087 };
whismanoid 23:c6c652bef4b9 5088 #endif // HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 5089 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 5090 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5091 // onButton3_command_table[] supports command %B3! -- run, %B3@ -- edit
whismanoid 45:74bf1fe021e5 5092 // MAX40108p2 hardware pin P1_6 connector J91.2 active low
whismanoid 45:74bf1fe021e5 5093 //........................................................12345678901234567890
whismanoid 45:74bf1fe021e5 5094 char onButton3_command_table_00[COMMAND_TABLE_COL_MAX] = "# J91.2 event";
whismanoid 45:74bf1fe021e5 5095 char onButton3_command_table_01[COMMAND_TABLE_COL_MAX] = ">>J91.2 event";
whismanoid 45:74bf1fe021e5 5096 char onButton3_command_table_02[COMMAND_TABLE_COL_MAX] = "%L91";
whismanoid 45:74bf1fe021e5 5097 char onButton3_command_table_03[COMMAND_TABLE_COL_MAX] = "%H92";
whismanoid 45:74bf1fe021e5 5098 char onButton3_command_table_04[COMMAND_TABLE_COL_MAX] = "%L93";
whismanoid 45:74bf1fe021e5 5099 char onButton3_command_table_05[COMMAND_TABLE_COL_MAX] = "%H91";
whismanoid 45:74bf1fe021e5 5100 char onButton3_command_table_06[COMMAND_TABLE_COL_MAX] = "%L92";
whismanoid 45:74bf1fe021e5 5101 char onButton3_command_table_07[COMMAND_TABLE_COL_MAX] = "%H93";
whismanoid 45:74bf1fe021e5 5102 char onButton3_command_table_08[COMMAND_TABLE_COL_MAX] = ">>LR -- run full speed";
whismanoid 45:74bf1fe021e5 5103 char onButton3_command_table_09[COMMAND_TABLE_COL_MAX] = "LR";
whismanoid 24:032f3683cb2a 5104 static char* onButton3_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 24:032f3683cb2a 5105 onButton3_command_table_00,
whismanoid 24:032f3683cb2a 5106 onButton3_command_table_01,
whismanoid 24:032f3683cb2a 5107 onButton3_command_table_02,
whismanoid 24:032f3683cb2a 5108 onButton3_command_table_03,
whismanoid 24:032f3683cb2a 5109 onButton3_command_table_04,
whismanoid 24:032f3683cb2a 5110 onButton3_command_table_05,
whismanoid 24:032f3683cb2a 5111 onButton3_command_table_06,
whismanoid 24:032f3683cb2a 5112 onButton3_command_table_07,
whismanoid 24:032f3683cb2a 5113 onButton3_command_table_08,
whismanoid 24:032f3683cb2a 5114 onButton3_command_table_09,
whismanoid 24:032f3683cb2a 5115 };
whismanoid 24:032f3683cb2a 5116 #endif // HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5117 #if HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5118 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5119 // onButton4_command_table[] supports command %B4! -- run, %B4@ -- edit
whismanoid 45:74bf1fe021e5 5120 // no hardware pin available, but useful for containing "# remark" labels for action table
whismanoid 45:74bf1fe021e5 5121 //........................................................12345678901234567890
whismanoid 29:6a9edb6e973b 5122 char onButton4_command_table_00[COMMAND_TABLE_COL_MAX] = "# Button4 event";
whismanoid 62:a618b70c4f22 5123 char onButton4_command_table_01[COMMAND_TABLE_COL_MAX] = "# signal-active";
whismanoid 29:6a9edb6e973b 5124 char onButton4_command_table_02[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5125 char onButton4_command_table_03[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5126 char onButton4_command_table_04[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5127 char onButton4_command_table_05[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5128 char onButton4_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5129 char onButton4_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5130 char onButton4_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5131 char onButton4_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5132 static char* onButton4_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 29:6a9edb6e973b 5133 onButton4_command_table_00,
whismanoid 29:6a9edb6e973b 5134 onButton4_command_table_01,
whismanoid 29:6a9edb6e973b 5135 onButton4_command_table_02,
whismanoid 29:6a9edb6e973b 5136 onButton4_command_table_03,
whismanoid 29:6a9edb6e973b 5137 onButton4_command_table_04,
whismanoid 29:6a9edb6e973b 5138 onButton4_command_table_05,
whismanoid 29:6a9edb6e973b 5139 onButton4_command_table_06,
whismanoid 29:6a9edb6e973b 5140 onButton4_command_table_07,
whismanoid 29:6a9edb6e973b 5141 onButton4_command_table_08,
whismanoid 29:6a9edb6e973b 5142 onButton4_command_table_09,
whismanoid 29:6a9edb6e973b 5143 };
whismanoid 29:6a9edb6e973b 5144 #endif // HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5145 #if HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5146 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5147 // onButton5_command_table[] supports command %B5! -- run, %B5@ -- edit
whismanoid 45:74bf1fe021e5 5148 // no hardware pin available, but useful for containing "# remark" labels for action table
whismanoid 45:74bf1fe021e5 5149 //........................................................12345678901234567890
whismanoid 29:6a9edb6e973b 5150 char onButton5_command_table_00[COMMAND_TABLE_COL_MAX] = "# Button5 event";
whismanoid 62:a618b70c4f22 5151 char onButton5_command_table_01[COMMAND_TABLE_COL_MAX] = "# idle-no-signal";
whismanoid 29:6a9edb6e973b 5152 char onButton5_command_table_02[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5153 char onButton5_command_table_03[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5154 char onButton5_command_table_04[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5155 char onButton5_command_table_05[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5156 char onButton5_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5157 char onButton5_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5158 char onButton5_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5159 char onButton5_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5160 static char* onButton5_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 29:6a9edb6e973b 5161 onButton5_command_table_00,
whismanoid 29:6a9edb6e973b 5162 onButton5_command_table_01,
whismanoid 29:6a9edb6e973b 5163 onButton5_command_table_02,
whismanoid 29:6a9edb6e973b 5164 onButton5_command_table_03,
whismanoid 29:6a9edb6e973b 5165 onButton5_command_table_04,
whismanoid 29:6a9edb6e973b 5166 onButton5_command_table_05,
whismanoid 29:6a9edb6e973b 5167 onButton5_command_table_06,
whismanoid 29:6a9edb6e973b 5168 onButton5_command_table_07,
whismanoid 29:6a9edb6e973b 5169 onButton5_command_table_08,
whismanoid 29:6a9edb6e973b 5170 onButton5_command_table_09,
whismanoid 29:6a9edb6e973b 5171 };
whismanoid 29:6a9edb6e973b 5172 #endif // HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5173 #if HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5174 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5175 // onButton6_command_table[] supports command %B6! -- run, %B6@ -- edit
whismanoid 45:74bf1fe021e5 5176 // no hardware pin available, but useful for containing "# remark" labels for action table
whismanoid 45:74bf1fe021e5 5177 //........................................................12345678901234567890
whismanoid 29:6a9edb6e973b 5178 char onButton6_command_table_00[COMMAND_TABLE_COL_MAX] = "# Button6 event";
whismanoid 29:6a9edb6e973b 5179 char onButton6_command_table_01[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5180 char onButton6_command_table_02[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5181 char onButton6_command_table_03[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5182 char onButton6_command_table_04[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5183 char onButton6_command_table_05[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5184 char onButton6_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5185 char onButton6_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5186 char onButton6_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5187 char onButton6_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5188 static char* onButton6_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 29:6a9edb6e973b 5189 onButton6_command_table_00,
whismanoid 29:6a9edb6e973b 5190 onButton6_command_table_01,
whismanoid 29:6a9edb6e973b 5191 onButton6_command_table_02,
whismanoid 29:6a9edb6e973b 5192 onButton6_command_table_03,
whismanoid 29:6a9edb6e973b 5193 onButton6_command_table_04,
whismanoid 29:6a9edb6e973b 5194 onButton6_command_table_05,
whismanoid 29:6a9edb6e973b 5195 onButton6_command_table_06,
whismanoid 29:6a9edb6e973b 5196 onButton6_command_table_07,
whismanoid 29:6a9edb6e973b 5197 onButton6_command_table_08,
whismanoid 29:6a9edb6e973b 5198 onButton6_command_table_09,
whismanoid 29:6a9edb6e973b 5199 };
whismanoid 29:6a9edb6e973b 5200 #endif // HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5201 #if HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5202 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5203 // onButton7_command_table[] supports command %B7! -- run, %B7@ -- edit
whismanoid 45:74bf1fe021e5 5204 // no hardware pin available, but useful for containing "# remark" labels for action table
whismanoid 45:74bf1fe021e5 5205 //........................................................12345678901234567890
whismanoid 29:6a9edb6e973b 5206 char onButton7_command_table_00[COMMAND_TABLE_COL_MAX] = "# Button7 event";
whismanoid 29:6a9edb6e973b 5207 char onButton7_command_table_01[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5208 char onButton7_command_table_02[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5209 char onButton7_command_table_03[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5210 char onButton7_command_table_04[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5211 char onButton7_command_table_05[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5212 char onButton7_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5213 char onButton7_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5214 char onButton7_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5215 char onButton7_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5216 static char* onButton7_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 29:6a9edb6e973b 5217 onButton7_command_table_00,
whismanoid 29:6a9edb6e973b 5218 onButton7_command_table_01,
whismanoid 29:6a9edb6e973b 5219 onButton7_command_table_02,
whismanoid 29:6a9edb6e973b 5220 onButton7_command_table_03,
whismanoid 29:6a9edb6e973b 5221 onButton7_command_table_04,
whismanoid 29:6a9edb6e973b 5222 onButton7_command_table_05,
whismanoid 29:6a9edb6e973b 5223 onButton7_command_table_06,
whismanoid 29:6a9edb6e973b 5224 onButton7_command_table_07,
whismanoid 29:6a9edb6e973b 5225 onButton7_command_table_08,
whismanoid 29:6a9edb6e973b 5226 onButton7_command_table_09,
whismanoid 29:6a9edb6e973b 5227 };
whismanoid 29:6a9edb6e973b 5228 #endif // HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5229 #if HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5230 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5231 // onButton8_command_table[] supports command %B8! -- run, %B8@ -- edit
whismanoid 45:74bf1fe021e5 5232 // no hardware pin available, but useful for containing "# remark" labels for action table
whismanoid 45:74bf1fe021e5 5233 //........................................................12345678901234567890
whismanoid 29:6a9edb6e973b 5234 char onButton8_command_table_00[COMMAND_TABLE_COL_MAX] = "# Button8 event";
whismanoid 29:6a9edb6e973b 5235 char onButton8_command_table_01[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5236 char onButton8_command_table_02[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5237 char onButton8_command_table_03[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5238 char onButton8_command_table_04[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5239 char onButton8_command_table_05[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5240 char onButton8_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5241 char onButton8_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5242 char onButton8_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5243 char onButton8_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5244 static char* onButton8_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 29:6a9edb6e973b 5245 onButton8_command_table_00,
whismanoid 29:6a9edb6e973b 5246 onButton8_command_table_01,
whismanoid 29:6a9edb6e973b 5247 onButton8_command_table_02,
whismanoid 29:6a9edb6e973b 5248 onButton8_command_table_03,
whismanoid 29:6a9edb6e973b 5249 onButton8_command_table_04,
whismanoid 29:6a9edb6e973b 5250 onButton8_command_table_05,
whismanoid 29:6a9edb6e973b 5251 onButton8_command_table_06,
whismanoid 29:6a9edb6e973b 5252 onButton8_command_table_07,
whismanoid 29:6a9edb6e973b 5253 onButton8_command_table_08,
whismanoid 29:6a9edb6e973b 5254 onButton8_command_table_09,
whismanoid 29:6a9edb6e973b 5255 };
whismanoid 29:6a9edb6e973b 5256 #endif // HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5257 #if HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5258 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5259 // onButton9_command_table[] supports command %B9! -- run, %B9@ -- edit
whismanoid 45:74bf1fe021e5 5260 // no hardware pin available, but useful for containing "# remark" labels for action table
whismanoid 45:74bf1fe021e5 5261 //........................................................12345678901234567890
whismanoid 29:6a9edb6e973b 5262 char onButton9_command_table_00[COMMAND_TABLE_COL_MAX] = "# Button9 event";
whismanoid 29:6a9edb6e973b 5263 char onButton9_command_table_01[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5264 char onButton9_command_table_02[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5265 char onButton9_command_table_03[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5266 char onButton9_command_table_04[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5267 char onButton9_command_table_05[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5268 char onButton9_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5269 char onButton9_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5270 char onButton9_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5271 char onButton9_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5272 static char* onButton9_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 29:6a9edb6e973b 5273 onButton9_command_table_00,
whismanoid 29:6a9edb6e973b 5274 onButton9_command_table_01,
whismanoid 29:6a9edb6e973b 5275 onButton9_command_table_02,
whismanoid 29:6a9edb6e973b 5276 onButton9_command_table_03,
whismanoid 29:6a9edb6e973b 5277 onButton9_command_table_04,
whismanoid 29:6a9edb6e973b 5278 onButton9_command_table_05,
whismanoid 29:6a9edb6e973b 5279 onButton9_command_table_06,
whismanoid 29:6a9edb6e973b 5280 onButton9_command_table_07,
whismanoid 29:6a9edb6e973b 5281 onButton9_command_table_08,
whismanoid 29:6a9edb6e973b 5282 onButton9_command_table_09,
whismanoid 29:6a9edb6e973b 5283 };
whismanoid 29:6a9edb6e973b 5284 #endif // HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 23:c6c652bef4b9 5285 #endif // USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5286 //--------------------------------------------------
whismanoid 23:c6c652bef4b9 5287 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 5288 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 31:47eee7e0cc2d 5289 bool g_Run_command_table_running = false;
whismanoid 23:c6c652bef4b9 5290 void Run_command_table(char* command_table[])
whismanoid 23:c6c652bef4b9 5291 {
whismanoid 23:c6c652bef4b9 5292 // command_table: perform list of commands
whismanoid 31:47eee7e0cc2d 5293 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 31:47eee7e0cc2d 5294 if (g_Run_command_table_running) {
whismanoid 31:47eee7e0cc2d 5295 // TODO: button event chaining is not supported at this time
whismanoid 31:47eee7e0cc2d 5296 } // if (g_Run_command_table_running)
whismanoid 31:47eee7e0cc2d 5297 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 31:47eee7e0cc2d 5298 g_Run_command_table_running = true;
whismanoid 23:c6c652bef4b9 5299 for (int lineIndex = 0; lineIndex < COMMAND_TABLE_ROW_MAX; lineIndex++) {
whismanoid 23:c6c652bef4b9 5300 if (command_table[lineIndex] == NULL) { break; }
whismanoid 23:c6c652bef4b9 5301 if (command_table[lineIndex][0] == '\0') { break; }
whismanoid 23:c6c652bef4b9 5302 cmdLine.clear();
whismanoid 31:47eee7e0cc2d 5303 cmdLine.quiet = g_Run_command_table_running;
whismanoid 23:c6c652bef4b9 5304 //~ char* strIndex = command_table[lineIndex];
whismanoid 23:c6c652bef4b9 5305 for (char* strIndex = command_table[lineIndex]; *strIndex != '\0'; strIndex++)
whismanoid 23:c6c652bef4b9 5306 {
whismanoid 23:c6c652bef4b9 5307 cmdLine.append(*strIndex);
whismanoid 23:c6c652bef4b9 5308 }
whismanoid 23:c6c652bef4b9 5309 cmdLine.append('\r'); // append \r invokes onEOLcommandParser to handle command
whismanoid 23:c6c652bef4b9 5310 }
whismanoid 31:47eee7e0cc2d 5311 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 31:47eee7e0cc2d 5312 g_Run_command_table_running = false;
whismanoid 31:47eee7e0cc2d 5313 cmdLine.quiet = g_Run_command_table_running;
whismanoid 23:c6c652bef4b9 5314 }
whismanoid 23:c6c652bef4b9 5315 #endif // USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5316 //--------------------------------------------------
whismanoid 21:ac062a97a71d 5317 // When user presses button BUTTON1, perform actions
whismanoid 21:ac062a97a71d 5318 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 5319 void onButton1FallingEdge(void)
whismanoid 21:ac062a97a71d 5320 {
whismanoid 21:ac062a97a71d 5321 //~ void SelfTest(CmdLine & cmdLine);
whismanoid 21:ac062a97a71d 5322 //~ SelfTest(cmdLine_serial);
whismanoid 22:d6dc8a85f435 5323 //
whismanoid 23:c6c652bef4b9 5324 #if USE_DATALOGGER_CommandTable // Run_command_table(onButton1_command_table)
whismanoid 22:d6dc8a85f435 5325 // command_table: list of commands to perform on button press
whismanoid 22:d6dc8a85f435 5326 // command_table: perform list of commands
whismanoid 23:c6c652bef4b9 5327 Run_command_table(onButton1_command_table);
whismanoid 23:c6c652bef4b9 5328 #endif // USE_DATALOGGER_CommandTable
whismanoid 21:ac062a97a71d 5329 }
whismanoid 21:ac062a97a71d 5330 #endif // HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 5331
whismanoid 21:ac062a97a71d 5332 //--------------------------------------------------
whismanoid 21:ac062a97a71d 5333 // When user presses button BUTTON2, perform actions
whismanoid 21:ac062a97a71d 5334 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 5335 void onButton2FallingEdge(void)
whismanoid 21:ac062a97a71d 5336 {
whismanoid 21:ac062a97a71d 5337 // TBD demo configuration
whismanoid 21:ac062a97a71d 5338 // TODO diagnostic LED
whismanoid 21:ac062a97a71d 5339 // led1 = LED_OFF; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led BLUE
whismanoid 22:d6dc8a85f435 5340 //
whismanoid 23:c6c652bef4b9 5341 #if USE_DATALOGGER_CommandTable // Run_command_table(onButton1_command_table)
whismanoid 22:d6dc8a85f435 5342 // command_table: list of commands to perform on button press
whismanoid 22:d6dc8a85f435 5343 // command_table: perform list of commands
whismanoid 23:c6c652bef4b9 5344 Run_command_table(onButton2_command_table);
whismanoid 23:c6c652bef4b9 5345 #endif // USE_DATALOGGER_CommandTable
whismanoid 21:ac062a97a71d 5346 }
whismanoid 21:ac062a97a71d 5347 #endif // HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 5348
whismanoid 24:032f3683cb2a 5349 //--------------------------------------------------
whismanoid 29:6a9edb6e973b 5350 // When user presses button BUTTON3, perform actions
whismanoid 24:032f3683cb2a 5351 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 5352 void onButton3FallingEdge(void)
whismanoid 24:032f3683cb2a 5353 {
whismanoid 24:032f3683cb2a 5354 #if USE_DATALOGGER_CommandTable // Run_command_table(onButton1_command_table)
whismanoid 24:032f3683cb2a 5355 // command_table: list of commands to perform on button press
whismanoid 24:032f3683cb2a 5356 // command_table: perform list of commands
whismanoid 24:032f3683cb2a 5357 Run_command_table(onButton3_command_table);
whismanoid 24:032f3683cb2a 5358 #endif // USE_DATALOGGER_CommandTable
whismanoid 24:032f3683cb2a 5359 }
whismanoid 24:032f3683cb2a 5360 #endif // HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5361 #if HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5362 void onButton4FallingEdge(void)
whismanoid 29:6a9edb6e973b 5363 {
whismanoid 29:6a9edb6e973b 5364 #if USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5365 Run_command_table(onButton4_command_table);
whismanoid 29:6a9edb6e973b 5366 #endif // USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5367 }
whismanoid 29:6a9edb6e973b 5368 #endif // HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5369 #if HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5370 void onButton5FallingEdge(void)
whismanoid 29:6a9edb6e973b 5371 {
whismanoid 29:6a9edb6e973b 5372 #if USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5373 Run_command_table(onButton5_command_table);
whismanoid 29:6a9edb6e973b 5374 #endif // USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5375 }
whismanoid 29:6a9edb6e973b 5376 #endif // HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5377 #if HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5378 void onButton6FallingEdge(void)
whismanoid 29:6a9edb6e973b 5379 {
whismanoid 29:6a9edb6e973b 5380 #if USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5381 Run_command_table(onButton6_command_table);
whismanoid 29:6a9edb6e973b 5382 #endif // USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5383 }
whismanoid 29:6a9edb6e973b 5384 #endif // HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5385 #if HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5386 void onButton7FallingEdge(void)
whismanoid 29:6a9edb6e973b 5387 {
whismanoid 29:6a9edb6e973b 5388 #if USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5389 Run_command_table(onButton7_command_table);
whismanoid 29:6a9edb6e973b 5390 #endif // USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5391 }
whismanoid 29:6a9edb6e973b 5392 #endif // HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5393 #if HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5394 void onButton8FallingEdge(void)
whismanoid 29:6a9edb6e973b 5395 {
whismanoid 29:6a9edb6e973b 5396 #if USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5397 Run_command_table(onButton8_command_table);
whismanoid 29:6a9edb6e973b 5398 #endif // USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5399 }
whismanoid 29:6a9edb6e973b 5400 #endif // HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5401 #if HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5402 void onButton9FallingEdge(void)
whismanoid 29:6a9edb6e973b 5403 {
whismanoid 29:6a9edb6e973b 5404 #if USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5405 Run_command_table(onButton9_command_table);
whismanoid 29:6a9edb6e973b 5406 #endif // USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5407 }
whismanoid 29:6a9edb6e973b 5408 #endif // HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 5409
whismanoid 4:d9b05924ad4c 5410 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 5411 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 5412 inline void print_command_prompt()
whismanoid 4:d9b05924ad4c 5413 {
whismanoid 4:d9b05924ad4c 5414 //~ Serial.println(F(">"));
whismanoid 4:d9b05924ad4c 5415 cmdLine.serial().printf("\r\n> ");
whismanoid 4:d9b05924ad4c 5416 }
whismanoid 4:d9b05924ad4c 5417 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 5418
whismanoid 4:d9b05924ad4c 5419 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 5420 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 5421 void main_menu_status(CmdLine & cmdLine)
whismanoid 4:d9b05924ad4c 5422 {
whismanoid 4:d9b05924ad4c 5423 cmdLine.serial().printf("\r\nMain menu");
whismanoid 4:d9b05924ad4c 5424 #if APPLICATION_MAX5715 // main_menu_status banner
whismanoid 4:d9b05924ad4c 5425 cmdLine.serial().printf(" MAX5715 12-bit 4-ch SPI VOUT DAC");
whismanoid 4:d9b05924ad4c 5426 #elif APPLICATION_MAX11131 // main_menu_status banner
whismanoid 4:d9b05924ad4c 5427 cmdLine.serial().printf(" MAX11131 12-bit 3MSps 16-ch ADC");
whismanoid 4:d9b05924ad4c 5428 #elif APPLICATION_MAX5171 // main_menu_status banner
whismanoid 4:d9b05924ad4c 5429 cmdLine.serial().printf(" MAX5171 14-bit Force/Sense VOUT DAC");
whismanoid 4:d9b05924ad4c 5430 #elif APPLICATION_MAX11410 // main_menu_status banner
whismanoid 4:d9b05924ad4c 5431 cmdLine.serial().printf(" MAX11410 24-bit 1.9ksps Delta-Sigma ADC");
whismanoid 4:d9b05924ad4c 5432 #elif APPLICATION_MAX12345 // main_menu_status banner
whismanoid 4:d9b05924ad4c 5433 cmdLine.serial().printf(" MAX12345");
whismanoid 16:819c5aaf5271 5434 #elif MAX40108_DEMO // main_menu_status banner
whismanoid 17:9397ea3ea7e9 5435 cmdLine.serial().printf(" MAX40108_U%d", MAX40108_DEMO);
whismanoid 36:e7aac874b8be 5436 #ifdef BOARD_SERIAL_NUMBER
whismanoid 36:e7aac874b8be 5437 // data unique to certain boards based on serial number
whismanoid 49:359a6b9df7c1 5438 cmdLine.serial().printf(" [s/n %ld]", g_board_serial_number);
whismanoid 36:e7aac874b8be 5439 #else // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 36:e7aac874b8be 5440 #warning "BOARD_SERIAL_NUMBER not defined; using default values"
whismanoid 36:e7aac874b8be 5441 //
whismanoid 36:e7aac874b8be 5442 #endif // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 37:3f369235e5bc 5443 #ifdef FW_REV
whismanoid 37:3f369235e5bc 5444 cmdLine.serial().printf(" [FW_REV %d]", FW_REV);
whismanoid 37:3f369235e5bc 5445 #endif // FW_REV
whismanoid 4:d9b05924ad4c 5446 #else
whismanoid 4:d9b05924ad4c 5447 //cmdLine.serial().printf(" ");
whismanoid 4:d9b05924ad4c 5448 #endif
whismanoid 4:d9b05924ad4c 5449 //cmdLine.serial().printf(" %s", TARGET_NAME);
whismanoid 4:d9b05924ad4c 5450 if (cmdLine.nameStr())
whismanoid 4:d9b05924ad4c 5451 {
whismanoid 4:d9b05924ad4c 5452 cmdLine.serial().printf(" [%s]", cmdLine.nameStr());
whismanoid 4:d9b05924ad4c 5453 }
whismanoid 4:d9b05924ad4c 5454 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5455 cmdLine.serial().printf(" [Button1");
whismanoid 4:d9b05924ad4c 5456 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5457 cmdLine.serial().printf("2");
whismanoid 24:032f3683cb2a 5458 #endif
whismanoid 24:032f3683cb2a 5459 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5460 cmdLine.serial().printf("3");
whismanoid 29:6a9edb6e973b 5461 #endif
whismanoid 29:6a9edb6e973b 5462 #if HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5463 cmdLine.serial().printf("4");
whismanoid 29:6a9edb6e973b 5464 #endif
whismanoid 29:6a9edb6e973b 5465 #if HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5466 cmdLine.serial().printf("5");
whismanoid 29:6a9edb6e973b 5467 #endif
whismanoid 29:6a9edb6e973b 5468 #if HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5469 cmdLine.serial().printf("6");
whismanoid 29:6a9edb6e973b 5470 #endif
whismanoid 29:6a9edb6e973b 5471 #if HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5472 cmdLine.serial().printf("7");
whismanoid 29:6a9edb6e973b 5473 #endif
whismanoid 29:6a9edb6e973b 5474 #if HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5475 cmdLine.serial().printf("8");
whismanoid 29:6a9edb6e973b 5476 #endif
whismanoid 29:6a9edb6e973b 5477 #if HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5478 cmdLine.serial().printf("9");
whismanoid 29:6a9edb6e973b 5479 #endif
whismanoid 29:6a9edb6e973b 5480 cmdLine.serial().printf("]");
whismanoid 29:6a9edb6e973b 5481 #endif // HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 4:d9b05924ad4c 5482 #if HAS_BUTTON1_DEMO
whismanoid 4:d9b05924ad4c 5483 // print BUTTON1 status
whismanoid 4:d9b05924ad4c 5484 cmdLine.serial().printf("\r\n BUTTON1 = %d", button1.read());
whismanoid 4:d9b05924ad4c 5485 #endif
whismanoid 4:d9b05924ad4c 5486 #if HAS_BUTTON2_DEMO
whismanoid 24:032f3683cb2a 5487 // print BUTTON2 status
whismanoid 4:d9b05924ad4c 5488 cmdLine.serial().printf("\r\n BUTTON2 = %d", button2.read());
whismanoid 4:d9b05924ad4c 5489 #endif
whismanoid 24:032f3683cb2a 5490 #if HAS_BUTTON3_DEMO
whismanoid 24:032f3683cb2a 5491 // print BUTTON3 status
whismanoid 24:032f3683cb2a 5492 cmdLine.serial().printf("\r\n BUTTON3 = %d", button3.read());
whismanoid 24:032f3683cb2a 5493 #endif
whismanoid 4:d9b05924ad4c 5494 cmdLine.serial().printf("\r\n ? -- help");
whismanoid 4:d9b05924ad4c 5495 }
whismanoid 4:d9b05924ad4c 5496 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 5497
whismanoid 28:a9a3a9db592b 5498 //--------------------------------------------------
whismanoid 28:a9a3a9db592b 5499 #ifndef USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 5500 #define USE_DATALOGGER_TRIGGER_HELP_BRIEF 1
whismanoid 28:a9a3a9db592b 5501 //~ #undef USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 5502 #endif // USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 5503
whismanoid 4:d9b05924ad4c 5504 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 5505 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 5506 void main_menu_help(CmdLine & cmdLine)
whismanoid 4:d9b05924ad4c 5507 {
whismanoid 4:d9b05924ad4c 5508 // ? -- help
whismanoid 4:d9b05924ad4c 5509 //~ cmdLine.serial().printf("\r\nMenu:");
whismanoid 10:04022a61b527 5510 //
whismanoid 4:d9b05924ad4c 5511 cmdLine.serial().printf("\r\n # -- lines beginning with # are comments");
whismanoid 10:04022a61b527 5512 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 10:04022a61b527 5513 cmdLine.serial().printf("\r\n ! -- Init");
whismanoid 10:04022a61b527 5514 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 4:d9b05924ad4c 5515 #if USE_SELFTEST
whismanoid 4:d9b05924ad4c 5516 cmdLine.serial().printf("\r\n . -- SelfTest");
whismanoid 4:d9b05924ad4c 5517 #endif // USE_SELFTEST
whismanoid 9:45f98573eb6d 5518 #if USE_STAR_REG_READWRITE // * command read/write reg *reg? *reg=value
whismanoid 9:45f98573eb6d 5519 // CODE GENERATOR: help menu if has_register_write_command: *regname? -- read register; *regname=regvalue -- write register
whismanoid 9:45f98573eb6d 5520 cmdLine.serial().printf("\r\n * -- read core registers\r\n *regname? -- read register\r\n *regname=regvalue -- write register");
whismanoid 9:45f98573eb6d 5521 // cmdLine.serial().printf("\r\n 01 23 45 67 89 ab cd ef -- write and read raw hex codes");
whismanoid 10:04022a61b527 5522 #endif // USE_STAR_REG_READWRITE
whismanoid 10:04022a61b527 5523 //
whismanoid 10:04022a61b527 5524 #if USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 5525 // Command forwarding to Auxiliary serial port TX/RX #257 -- main_menu_help
whismanoid 10:04022a61b527 5526 //~ cmdLine.serial().printf("\r\n > -- auxiliary UART port");
whismanoid 10:04022a61b527 5527 // prefer cmdLine_AUXserial if available, else cmdLine_DAPLINKserial; else we don't have this feature
whismanoid 10:04022a61b527 5528 # if HAS_AUX_SERIAL
whismanoid 10:04022a61b527 5529 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257
whismanoid 10:04022a61b527 5530 if (cmdLine_AUXserial.nameStr())
whismanoid 10:04022a61b527 5531 {
whismanoid 10:04022a61b527 5532 cmdLine.serial().printf("\r\n > -- auxiliary UART port [%s]", cmdLine_AUXserial.nameStr());
whismanoid 10:04022a61b527 5533 }
whismanoid 10:04022a61b527 5534 # elif HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 5535 // Command forwarding to DAPLINK serial TX/RX cmdLine_DAPLINKserial #257
whismanoid 10:04022a61b527 5536 if (cmdLine_DAPLINKserial.nameStr())
whismanoid 10:04022a61b527 5537 {
whismanoid 10:04022a61b527 5538 cmdLine.serial().printf("\r\n > -- auxiliary UART port [%s]", cmdLine_DAPLINKserial.nameStr());
whismanoid 10:04022a61b527 5539 }
whismanoid 10:04022a61b527 5540 # endif // HAS_AUX_SERIAL HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 5541 # if HAS_AUX_SERIAL || HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 5542 // WIP Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257
whismanoid 10:04022a61b527 5543 cmdLine.serial().printf("\r\n >xyzzy -- Forward command/data 'xyzzy' to aux TX/RX");
whismanoid 10:04022a61b527 5544 cmdLine.serial().printf("\r\n >>xyzzy -- Forward 'xyzzy' to aux TX/RX, no key=value parsing");
whismanoid 10:04022a61b527 5545 cmdLine.serial().printf("\r\n >>>xyzzy -- Forward '>xyzzy' to aux TX/RX, no key=value parsing");
whismanoid 10:04022a61b527 5546 #if 0
whismanoid 10:04022a61b527 5547 cmdLine.serial().printf("\r\n >tx_wait_echo=%d -- configure TX wait for each character echo", g_auxSerialCom_tx_wait_echo);
whismanoid 10:04022a61b527 5548 cmdLine.serial().printf("\r\n >tx_char_delay_ms=%d -- configure TX delay after each char", g_auxSerialCom_tx_char_delay_ms);
whismanoid 10:04022a61b527 5549 cmdLine.serial().printf("\r\n >tx_line_delay_ms=%d -- configure TX delay after each CR/LF", g_auxSerialCom_tx_line_delay_ms);
whismanoid 10:04022a61b527 5550 #endif
whismanoid 20:78ef670955d4 5551 #if 1 // HAS_AUX_SERIAL_HELP_BRIEF
whismanoid 20:78ef670955d4 5552 cmdLine.serial().printf("\r\n >baud=%d message_ms=%d rx_idle_ms=%d rx_max_count=%d rx_eot=%d",
whismanoid 20:78ef670955d4 5553 g_auxSerialCom_baud,
whismanoid 20:78ef670955d4 5554 g_auxSerialCom_message_ms,
whismanoid 20:78ef670955d4 5555 g_auxSerialCom_rx_idle_ms,
whismanoid 20:78ef670955d4 5556 g_auxSerialCom_rx_max_count,
whismanoid 20:78ef670955d4 5557 g_auxSerialCom_rx_eot);
whismanoid 20:78ef670955d4 5558 #else // HAS_AUX_SERIAL_HELP_BRIEF
whismanoid 20:78ef670955d4 5559 cmdLine.serial().printf("\r\n >baud=%d -- configure aux TX/RX port", g_auxSerialCom_baud);
whismanoid 10:04022a61b527 5560 cmdLine.serial().printf("\r\n >message_ms=%d -- maximum RX message total response time", g_auxSerialCom_message_ms);
whismanoid 10:04022a61b527 5561 cmdLine.serial().printf("\r\n >rx_idle_ms=%d -- maximum RX message idle time between characters", g_auxSerialCom_rx_idle_ms);
whismanoid 10:04022a61b527 5562 cmdLine.serial().printf("\r\n >rx_max_count=%d -- maximum RX message total length", g_auxSerialCom_rx_max_count);
whismanoid 10:04022a61b527 5563 cmdLine.serial().printf("\r\n >rx_eot=%d -- capture RX until match end of text char (unless %d)", g_auxSerialCom_rx_eot, aux_serial_cmd_forwarding_rx_eot_not_used);
whismanoid 20:78ef670955d4 5564 #endif // HAS_AUX_SERIAL_HELP_BRIEF
whismanoid 10:04022a61b527 5565 # endif // HAS_AUX_SERIAL
whismanoid 10:04022a61b527 5566 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 5567 //
whismanoid 4:d9b05924ad4c 5568 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 28:a9a3a9db592b 5569 #if USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 5570 // Datalog trigger menu
whismanoid 28:a9a3a9db592b 5571 // brief toplevel heading for datalog help L
whismanoid 28:a9a3a9db592b 5572 // L -- detailed help for datalog commands
whismanoid 28:a9a3a9db592b 5573 cmdLine.serial().printf("\r\n L -- halt the datalogger; show more commands");
whismanoid 28:a9a3a9db592b 5574 // set Datalogger_Trigger to trigger_Halt or trigger_FreeRun
whismanoid 28:a9a3a9db592b 5575 // Datalogger_Trigger = trigger_Halt // halt the datalogger; continue accepting commands
whismanoid 28:a9a3a9db592b 5576 // cmdLine.serial().print(F("\r\n L -- halt the datalogger; continue accepting commands"));
whismanoid 28:a9a3a9db592b 5577 //
whismanoid 28:a9a3a9db592b 5578 // Datalogger_Trigger = trigger_FreeRun // free run as fast as possible "always-on mode"
whismanoid 28:a9a3a9db592b 5579 cmdLine.serial().printf("\r\n LR -- Datalog free run as fast as possible");
whismanoid 28:a9a3a9db592b 5580 //
whismanoid 39:4d285e961435 5581 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 5582 // USE_DATALOGGER_SLEEP -- support sleep modes in Datalogger_Trigger
whismanoid 39:4d285e961435 5583 cmdLine.serial().printf("\r\n LT count=%d base=%dms sleep=%d -- Datalog timer",
whismanoid 39:4d285e961435 5584 g_timer_interval_count,
whismanoid 39:4d285e961435 5585 g_timer_interval_msec,
whismanoid 39:4d285e961435 5586 (int)g_timer_sleepmode
whismanoid 39:4d285e961435 5587 ); // trigger_Timer
whismanoid 39:4d285e961435 5588 #else // USE_DATALOGGER_SLEEP
whismanoid 28:a9a3a9db592b 5589 cmdLine.serial().printf("\r\n LT count=%d base=%dms -- Datalog timer", g_timer_interval_count, g_timer_interval_msec); // trigger_Timer
whismanoid 39:4d285e961435 5590 #endif // USE_DATALOGGER_SLEEP
whismanoid 28:a9a3a9db592b 5591 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 28:a9a3a9db592b 5592 //~ cmdLine.serial().printf("\r\n L@ -- configures Datalogger_action_table; show more commands");
whismanoid 28:a9a3a9db592b 5593 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 28:a9a3a9db592b 5594 #else // USE_DATALOGGER_TRIGGER_HELP_BRIEF -----------------------------------------------
whismanoid 4:d9b05924ad4c 5595 // TODO Datalog trigger menu
whismanoid 4:d9b05924ad4c 5596 // set Datalogger_Trigger to trigger_Halt or trigger_FreeRun
whismanoid 4:d9b05924ad4c 5597 // Datalogger_Trigger = trigger_Halt // halt the datalogger; continue accepting commands
whismanoid 9:45f98573eb6d 5598 // cmdLine.serial().print(F("\r\n L -- halt the datalogger; continue accepting commands"));
whismanoid 9:45f98573eb6d 5599 //
whismanoid 17:9397ea3ea7e9 5600 // Datalogger_Trigger = trigger_FreeRun // free run as fast as possible "always-on mode"
whismanoid 4:d9b05924ad4c 5601 cmdLine.serial().printf("\r\n LR -- Datalog free run as fast as possible");
whismanoid 9:45f98573eb6d 5602 //
whismanoid 17:9397ea3ea7e9 5603 // Datalogger_Trigger = trigger_Timer // timer (configure interval) "intermittent-sleep-mode"
whismanoid 17:9397ea3ea7e9 5604 //~ cmdLine.serial().printf("\r\n LT -- Datalog timer"); // trigger_Timer
whismanoid 17:9397ea3ea7e9 5605 cmdLine.serial().printf("\r\n LT count=%d base=%dms -- Datalog timer", g_timer_interval_count, g_timer_interval_msec); // trigger_Timer
whismanoid 9:45f98573eb6d 5606 //
whismanoid 9:45f98573eb6d 5607 // TODO: Datalogger_Trigger = trigger_PlatformDigitalInput // platform digital input (configure digital input pin reference)
whismanoid 17:9397ea3ea7e9 5608 //~ cmdLine.serial().printf("\r\n LI -- Datalog _______"); // trigger_PlatformDigitalInput
whismanoid 17:9397ea3ea7e9 5609 // TODO: cmdLine.serial().printf("\r\n LIH3 -- Datalog when input high D3"); // trigger_PlatformDigitalInput
whismanoid 17:9397ea3ea7e9 5610 // TODO: cmdLine.serial().printf("\r\n LIL6 -- Datalog when input low D6"); // trigger_PlatformDigitalInput
whismanoid 9:45f98573eb6d 5611 //
whismanoid 17:9397ea3ea7e9 5612 #if USE_DATALOGGER_SPIDeviceRegRead
whismanoid 9:45f98573eb6d 5613 // TODO: Datalogger_Trigger = trigger_SPIDeviceRegRead // SPI device register read (configure regaddr, mask value, match value)
whismanoid 17:9397ea3ea7e9 5614 //~ cmdLine.serial().printf("\r\n L$ -- Datalog _______"); // trigger_SPIDeviceRegRead
whismanoid 27:b4ac095b83b3 5615 cmdLine.serial().printf("\r\n L$ count=10 base=500ms addr=xxx data=xxx mask=xxx -- Datalog when SPI read of address matches mask"); // trigger_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 5616 #endif // USE_DATALOGGER_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 5617 //
whismanoid 17:9397ea3ea7e9 5618 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 28:a9a3a9db592b 5619 cmdLine.serial().printf("\r\n L@ -- configures Datalogger_action_table; show more commands");
whismanoid 17:9397ea3ea7e9 5620 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 9:45f98573eb6d 5621 //
whismanoid 9:45f98573eb6d 5622 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 5623 // LS<channel ID><verb>: Configure SPI_AIN channels
whismanoid 9:45f98573eb6d 5624 // channel ID: 0,1,2,... or - for all channels
whismanoid 9:45f98573eb6d 5625 // verb: D for disable, V for Voltage, L for LSB
whismanoid 9:45f98573eb6d 5626 cmdLine.serial().printf("\r\n LS-D -- Datalog SPI ADC channel '-'(all) Disable");
whismanoid 9:45f98573eb6d 5627 cmdLine.serial().printf("\r\n LS-V -- Datalog SPI ADC channel '-'(all) Volt");
whismanoid 9:45f98573eb6d 5628 cmdLine.serial().printf("\r\n LS-L -- Datalog SPI ADC channel '-'(all) LSB");
whismanoid 9:45f98573eb6d 5629 cmdLine.serial().printf("\r\n LS2D -- Datalog SPI ADC channel channel 2 Disable");
whismanoid 9:45f98573eb6d 5630 cmdLine.serial().printf("\r\n LS3V -- Datalog SPI ADC channel channel 3 Volt");
whismanoid 9:45f98573eb6d 5631 cmdLine.serial().printf("\r\n LS4L -- Datalog SPI ADC channel channel 4 LSB");
whismanoid 9:45f98573eb6d 5632 //
whismanoid 9:45f98573eb6d 5633 // MAX11410 verb for configuring SPI_AIN_Cfg_v_filter_ch[channel_index]
whismanoid 9:45f98573eb6d 5634 // cmdLine.serial().print(F("\r\n LS-CF34 -- Datalog SPI ADC channel channel 5 v_filter 0x34"));
whismanoid 9:45f98573eb6d 5635 cmdLine.serial().printf("\r\n LS-CF34 -- Datalog SPI ADC channel '-'(all) v_filter 0x34");
whismanoid 9:45f98573eb6d 5636 //
whismanoid 9:45f98573eb6d 5637 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 9:45f98573eb6d 5638 // cmdLine.serial().print(F("\r\n LS-CC42 -- Datalog SPI ADC channel '-'(all) v_ctrl 0x42"));
whismanoid 9:45f98573eb6d 5639 cmdLine.serial().printf("\r\n LS-CC42 -- Datalog SPI ADC channel '-'(all) v_ctrl 0x42");
whismanoid 9:45f98573eb6d 5640 //
whismanoid 9:45f98573eb6d 5641 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 9:45f98573eb6d 5642 // cmdLine.serial().print(F("\r\n LS5___ -- Datalog SPI ADC channel channel 5 v_ctrl"));
whismanoid 9:45f98573eb6d 5643 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 9:45f98573eb6d 5644 cmdLine.serial().printf("\r\n LS5CU -- Datalog SPI ADC channel channel 5 v_ctrl Unipolar");
whismanoid 9:45f98573eb6d 5645 // ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) ? "BIPOLAR" : "Unipolar"
whismanoid 9:45f98573eb6d 5646 cmdLine.serial().printf("\r\n LS5CB -- Datalog SPI ADC channel channel 5 v_ctrl Bipolar");
whismanoid 9:45f98573eb6d 5647 // ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) ? "BIPOLAR" : "Unipolar"
whismanoid 9:45f98573eb6d 5648 //
whismanoid 9:45f98573eb6d 5649 // MAX11410 verb for configuring SPI_AIN_Cfg_v_pga_ch[channel_index]
whismanoid 9:45f98573eb6d 5650 // cmdLine.serial().print(F("\r\n LS5CP00 -- Datalog SPI ADC channel channel 5 v_pga 0x00"));
whismanoid 9:45f98573eb6d 5651 cmdLine.serial().printf("\r\n LS-CP00 -- Datalog SPI ADC channel '-'(all) v_pga 0x00");
whismanoid 9:45f98573eb6d 5652 //
whismanoid 9:45f98573eb6d 5653 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 5654 //
whismanoid 9:45f98573eb6d 5655 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 9:45f98573eb6d 5656 // LA<channel ID><verb>: Configure Platform_AIN channels
whismanoid 9:45f98573eb6d 5657 // channel ID: 0,1,2,... or - for all channels
whismanoid 9:45f98573eb6d 5658 // verb: D for disable, V for Voltage, L for LSB
whismanoid 9:45f98573eb6d 5659 cmdLine.serial().printf("\r\n LA-D -- Datalog Platform-AIN all-channel Disable");
whismanoid 9:45f98573eb6d 5660 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 9:45f98573eb6d 5661 cmdLine.serial().printf("\r\n LA-V -- Datalog Platform-AIN all-channel Volt");
whismanoid 9:45f98573eb6d 5662 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 9:45f98573eb6d 5663 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 5664 cmdLine.serial().printf("\r\n LA-L -- Datalog Platform-AIN all-channel LSB");
whismanoid 9:45f98573eb6d 5665 #endif // LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 5666 cmdLine.serial().printf("\r\n LA2D -- Datalog Platform-AIN channel 2 Disable");
whismanoid 9:45f98573eb6d 5667 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 9:45f98573eb6d 5668 cmdLine.serial().printf("\r\n LA3V -- Datalog Platform-AIN channel 3 Volt");
whismanoid 9:45f98573eb6d 5669 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 9:45f98573eb6d 5670 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 5671 cmdLine.serial().printf("\r\n LA4L -- Datalog Platform-AIN channel 4 LSB");
whismanoid 9:45f98573eb6d 5672 #endif // LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 5673 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 28:a9a3a9db592b 5674 #endif // USE_DATALOGGER_TRIGGER_HELP_BRIEF -----------------------------------------------
whismanoid 4:d9b05924ad4c 5675 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 28:a9a3a9db592b 5676 #if USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 5677 #else // USE_DATALOGGER_TRIGGER_HELP_BRIEF -----------------------------------------------
whismanoid 8:dffee7509bfb 5678 # if HAS_AUX_SERIAL
whismanoid 9:45f98573eb6d 5679 cmdLine.serial().printf("\r\n L>A -- Datalogger_enable_AUXserial %s", (Datalogger_enable_AUXserial?"disable":"enable"));
whismanoid 8:dffee7509bfb 5680 # endif // HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 5681 # if HAS_DAPLINK_SERIAL
whismanoid 9:45f98573eb6d 5682 cmdLine.serial().printf("\r\n L>D -- Datalogger_enable_DAPLINKserial %s", (Datalogger_enable_DAPLINKserial?"disable":"enable"));
whismanoid 8:dffee7509bfb 5683 # endif // HAS_DAPLINK_SERIAL
whismanoid 9:45f98573eb6d 5684 cmdLine.serial().printf("\r\n L>S -- Datalogger_enable_serial %s", (Datalogger_enable_serial?"disable":"enable"));
whismanoid 28:a9a3a9db592b 5685 #endif // USE_DATALOGGER_TRIGGER_HELP_BRIEF -----------------------------------------------
whismanoid 8:dffee7509bfb 5686 //
whismanoid 4:d9b05924ad4c 5687 //cmdLine.serial().print(F("\r\n ! -- Initial Configuration"));
whismanoid 4:d9b05924ad4c 5688 //
whismanoid 4:d9b05924ad4c 5689 // % standardize diagnostic commands
whismanoid 4:d9b05924ad4c 5690 // %Hpin -- digital output high
whismanoid 4:d9b05924ad4c 5691 // %Lpin -- digital output low
whismanoid 4:d9b05924ad4c 5692 // %?pin -- digital input
whismanoid 4:d9b05924ad4c 5693 // %A %Apin -- analog input
whismanoid 4:d9b05924ad4c 5694 // %Ppin df=xx -- pwm output
whismanoid 4:d9b05924ad4c 5695 // %Wpin -- measure high pulsewidth input in usec
whismanoid 4:d9b05924ad4c 5696 // %wpin -- measure low pulsewidth input in usec
whismanoid 4:d9b05924ad4c 5697 // %I... -- I2C diagnostics
whismanoid 4:d9b05924ad4c 5698 // %IP -- I2C probe
whismanoid 4:d9b05924ad4c 5699 // %IC scl=100khz ADDR=? -- I2C configure
whismanoid 4:d9b05924ad4c 5700 // %IW ADDR=? cmd=? data,data,data -- write
whismanoid 4:d9b05924ad4c 5701 // %IR ADDR=? RD=? -- read
whismanoid 4:d9b05924ad4c 5702 // %I^ cmd=? -- i2c_smbus_read_word_data
whismanoid 4:d9b05924ad4c 5703 // %S... -- SPI diagnostics
whismanoid 4:d9b05924ad4c 5704 // %SC sclk=1Mhz -- SPI configure
whismanoid 4:d9b05924ad4c 5705 // %SW -- write (write and read)
whismanoid 4:d9b05924ad4c 5706 // %SR -- read (alias for %SW because SPI always write and read)
whismanoid 4:d9b05924ad4c 5707 // A-Z,a-z,0-9 reserved for application use
whismanoid 4:d9b05924ad4c 5708 //
whismanoid 23:c6c652bef4b9 5709 //--------------------------------------------------
whismanoid 23:c6c652bef4b9 5710 #if USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5711 // command_table: list of commands to perform on button press
whismanoid 23:c6c652bef4b9 5712 // TODO: %B1 submenu for Button1
whismanoid 23:c6c652bef4b9 5713 // TODO: future: %B2 submenu for Button2
whismanoid 23:c6c652bef4b9 5714 // TODO: future: %B3 submenu for Button3
whismanoid 23:c6c652bef4b9 5715 // TODO: %B1@ view command table, similar to L@ for action table
whismanoid 23:c6c652bef4b9 5716 // TODO: %B1@+ command add new row (if there is room to add) (ignore one space before command)
whismanoid 23:c6c652bef4b9 5717 // TODO: %B1@-nnn delete row number nnn (if list is not empty)
whismanoid 23:c6c652bef4b9 5718 // TODO: %B1@-~~~ clear entire command table
whismanoid 23:c6c652bef4b9 5719 // TODO: %B1@nnn command replace row number nnn (ignore one space before command)
whismanoid 23:c6c652bef4b9 5720 // TODO: %B1@! disable button response but keep command table contents
whismanoid 23:c6c652bef4b9 5721 // TODO: %B1@@ enable button response
whismanoid 23:c6c652bef4b9 5722 // TODO: %B1! trigger onButton1FallingEdge() immediately (for test development)
whismanoid 45:74bf1fe021e5 5723 // cmdLine.serial().printf("\r\n %%B1! trigger Button1 event; %%B1@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5724 cmdLine.serial().printf("\r\n %%B1! trigger Button1 event;");
whismanoid 45:74bf1fe021e5 5725 // print maximum index for %B1 submenu
whismanoid 45:74bf1fe021e5 5726 #if HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5727 cmdLine.serial().printf(" %%B9@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5728 #elif HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5729 cmdLine.serial().printf(" %%B8@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5730 #elif HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5731 cmdLine.serial().printf(" %%B7@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5732 #elif HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5733 cmdLine.serial().printf(" %%B6@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5734 #elif HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5735 cmdLine.serial().printf(" %%B5@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5736 #elif HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5737 cmdLine.serial().printf(" %%B4@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5738 #elif HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5739 cmdLine.serial().printf(" %%B3@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5740 #elif HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5741 cmdLine.serial().printf(" %%B2@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5742 #elif HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5743 cmdLine.serial().printf(" %%B1@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5744 #endif // HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5745
whismanoid 45:74bf1fe021e5 5746
whismanoid 23:c6c652bef4b9 5747 #endif // USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5748 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 5749 #if HAS_digitalInOuts
whismanoid 4:d9b05924ad4c 5750 // %Hpin -- digital output high
whismanoid 4:d9b05924ad4c 5751 // %Lpin -- digital output low
whismanoid 4:d9b05924ad4c 5752 // %?pin -- digital input
whismanoid 4:d9b05924ad4c 5753 cmdLine.serial().printf("\r\n %%Hn {pin:");
whismanoid 4:d9b05924ad4c 5754 list_digitalInOutPins(cmdLine.serial());
whismanoid 4:d9b05924ad4c 5755 cmdLine.serial().printf("} -- High Output");
whismanoid 4:d9b05924ad4c 5756 cmdLine.serial().printf("\r\n %%Ln {pin:");
whismanoid 4:d9b05924ad4c 5757 list_digitalInOutPins(cmdLine.serial());
whismanoid 4:d9b05924ad4c 5758 cmdLine.serial().printf("} -- Low Output");
whismanoid 4:d9b05924ad4c 5759 cmdLine.serial().printf("\r\n %%?n {pin:");
whismanoid 4:d9b05924ad4c 5760 list_digitalInOutPins(cmdLine.serial());
whismanoid 4:d9b05924ad4c 5761 cmdLine.serial().printf("} -- Input");
whismanoid 4:d9b05924ad4c 5762 #endif
whismanoid 4:d9b05924ad4c 5763
whismanoid 4:d9b05924ad4c 5764 #if HAS_analogIns
whismanoid 4:d9b05924ad4c 5765 // Menu A) analogRead A0..7
whismanoid 4:d9b05924ad4c 5766 // %A %Apin -- analog input
whismanoid 4:d9b05924ad4c 5767 // analogRead(pinIndex) // analog input pins A0, A1, A2, A3, A4, A5; float voltage = analogRead(A0) * (5.0 / 1023.0)
whismanoid 37:3f369235e5bc 5768 cmdLine.serial().printf("\r\n %%A -- analogRead");
whismanoid 37:3f369235e5bc 5769 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 5770 // %A avg=%d -- help string display Platform_AIN_Average_N
whismanoid 37:3f369235e5bc 5771 cmdLine.serial().printf("; %%A avg=%d -- average", Platform_AIN_Average_N);
whismanoid 37:3f369235e5bc 5772 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 5773 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 5774 // %A cal? view/export raw calibration values for all channels
whismanoid 37:3f369235e5bc 5775 cmdLine.serial().printf("; %%A cal? -- calibration");
whismanoid 34:a1993a1ee904 5776 #endif // HAS_Platform_AIN_Calibration
whismanoid 4:d9b05924ad4c 5777 #endif
whismanoid 4:d9b05924ad4c 5778
whismanoid 4:d9b05924ad4c 5779 #if HAS_SPI2_MAX541
whismanoid 4:d9b05924ad4c 5780 // TODO1: MAX541 max541(spi2_max541, spi2_max541_cs);
whismanoid 4:d9b05924ad4c 5781 cmdLine.serial().printf("\r\n %%D -- DAC output MAX541 (SPI2)");
whismanoid 4:d9b05924ad4c 5782 #endif
whismanoid 4:d9b05924ad4c 5783
whismanoid 46:469d0061df5d 5784 //--------------------------------------------------
whismanoid 46:469d0061df5d 5785 #if defined(HAS_FLASH_PEEK) || defined(HAS_FLASH_POKE)
whismanoid 46:469d0061df5d 5786 // MAX32625 flash peek/poke support (MAX40108 demo) #312
whismanoid 46:469d0061df5d 5787 // cmdLine.serial().printf("\r\n %%F -- flash support");
whismanoid 46:469d0061df5d 5788 # if HAS_FLASH_PEEK
whismanoid 46:469d0061df5d 5789 // flash peek memory %F peek=0x0007ff00 len=0x0100 -- hex dump
whismanoid 46:469d0061df5d 5790 cmdLine.serial().printf("\r\n %%F peek=0x%8.8lx len=0x2000 -- hex dump", (uint32_t)&flash_page_configuration_back_up[0]);
whismanoid 46:469d0061df5d 5791 # endif // HAS_FLASH_PEEK
whismanoid 46:469d0061df5d 5792 # if HAS_FLASH_POKE
whismanoid 46:469d0061df5d 5793 // flash poke memory %F poke=0x0007ff00 0xab 0xcd 0xef 0x27 0x18 0x28 -- erase/write flash page
whismanoid 48:18647e0516f2 5794 cmdLine.serial().printf("\r\n %%F poke=0x%8.8lx 12 34 56 78 -- erase/write flash page", (uint32_t)&flash_page_configuration_back_up[0]);
whismanoid 46:469d0061df5d 5795 # endif // HAS_FLASH_POKE
whismanoid 46:469d0061df5d 5796 # if HAS_FLASH_LOAD_SAVE
whismanoid 48:18647e0516f2 5797 // cmdLine.serial().printf("\r\n %%F save=0xFF -- erase config; %%F save=0 -- save all config");
whismanoid 48:18647e0516f2 5798 // const uint32_t save_arg_01_pageErase = 0x00000001; // page erase and rewrite
whismanoid 48:18647e0516f2 5799 // const uint32_t save_arg_02_verbose = 0x00000002; // verbose diagnostic messages
whismanoid 48:18647e0516f2 5800 // const uint32_t save_arg_04_reserved = 0x00000004; // reserved
whismanoid 48:18647e0516f2 5801 // const uint32_t save_arg_08_reserved = 0x00000008; // reserved
whismanoid 48:18647e0516f2 5802 // const uint32_t save_arg_10_calibration = 0x00000010; // save board ID and calibration
whismanoid 48:18647e0516f2 5803 // const uint32_t save_arg_20_action_table = 0x00000020; // save Datalogger_action_table
whismanoid 48:18647e0516f2 5804 // const uint32_t save_arg_40_command_table = 0x00000040; // save onButtonX_command_table
whismanoid 48:18647e0516f2 5805 // const uint32_t save_arg_80_reserved = 0x00000080; // reserved
whismanoid 49:359a6b9df7c1 5806 cmdLine.serial().printf("\r\n %%F load=0x%lx ; %%F save=0x%lx -- calibration",
whismanoid 48:18647e0516f2 5807 (load_arg_default | save_arg_02_verbose), (save_arg_default | save_arg_02_verbose));
whismanoid 48:18647e0516f2 5808 //~ cmdLine.serial().printf("\r\n %%F save=0x11 -- erase; config; %%F save=0 -- save all config");
whismanoid 48:18647e0516f2 5809 //~ cmdLine.serial().printf("\r\n %%F load -- load all config");
whismanoid 46:469d0061df5d 5810 # endif // HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 5811 #endif
whismanoid 46:469d0061df5d 5812
whismanoid 4:d9b05924ad4c 5813 #if HAS_I2C // SUPPORT_I2C
whismanoid 4:d9b05924ad4c 5814 // TODO: support I2C HAS_I2C // SUPPORT_I2C
whismanoid 4:d9b05924ad4c 5815 // VERIFY: I2C utility commands SUPPORT_I2C
whismanoid 4:d9b05924ad4c 5816 // VERIFY: report g_I2C_SCL_Hz = (F_CPU / ((TWBR * 2) + 16)) from last Wire_Sr.setClock(I2C_SCL_Hz);
whismanoid 4:d9b05924ad4c 5817 // %I... -- I2C diagnostics
whismanoid 4:d9b05924ad4c 5818 // %IP -- I2C probe
whismanoid 4:d9b05924ad4c 5819 // %IC scl=100khz ADDR=? -- I2C configure
whismanoid 4:d9b05924ad4c 5820 // %IW byte byte ... byte RD=? ADDR=0x -- write
whismanoid 4:d9b05924ad4c 5821 // %IR ADDR=? RD=? -- read
whismanoid 4:d9b05924ad4c 5822 // %I^ cmd=? -- i2c_smbus_read_word_data
whismanoid 4:d9b05924ad4c 5823 //g_I2C_SCL_Hz = (F_CPU / ((TWBR * 2) + 16)); // 'F_CPU' 'TWBR' not declared in this scope
whismanoid 4:d9b05924ad4c 5824 cmdLine.serial().printf("\r\n %%IC ADDR=0x%2.2x=(0x%2.2x>>1) SCL=%d=%1.3fkHz -- I2C config",
whismanoid 4:d9b05924ad4c 5825 g_I2C_deviceAddress7, (g_I2C_deviceAddress7 << 1), g_I2C_SCL_Hz,
whismanoid 4:d9b05924ad4c 5826 (g_I2C_SCL_Hz / 1000.));
whismanoid 4:d9b05924ad4c 5827 cmdLine.serial().printf("\r\n %%IW byte byte ... byte RD=? ADDR=0x%2.2x -- I2C write/read",
whismanoid 4:d9b05924ad4c 5828 g_I2C_deviceAddress7);
whismanoid 4:d9b05924ad4c 5829 //
whismanoid 4:d9b05924ad4c 5830 #if SUPPORT_I2C
whismanoid 4:d9b05924ad4c 5831 // Menu ^ cmd=?) i2c_smbus_read_word_data
whismanoid 4:d9b05924ad4c 5832 cmdLine.serial().printf("\r\n %%I^ cmd=? -- i2c_smbus_read_word_data");
whismanoid 4:d9b05924ad4c 5833 // test low-level I2C i2c_smbus_read_word_data
whismanoid 4:d9b05924ad4c 5834 #endif // SUPPORT_I2C
whismanoid 4:d9b05924ad4c 5835 //cmdLine.serial().printf(" H) Hunt for attached I2C devices");
whismanoid 4:d9b05924ad4c 5836 cmdLine.serial().printf("\r\n %%IP -- I2C Probe for attached devices");
whismanoid 4:d9b05924ad4c 5837 // cmdLine.serial().printf(" s) search i2c address");
whismanoid 4:d9b05924ad4c 5838 #endif // SUPPORT_I2C
whismanoid 4:d9b05924ad4c 5839
whismanoid 4:d9b05924ad4c 5840 #if HAS_SPI // SUPPORT_SPI
whismanoid 4:d9b05924ad4c 5841 // TODO: support SPI HAS_SPI // SUPPORT_SPI
whismanoid 4:d9b05924ad4c 5842 // SPI test command S (mosiData)+
whismanoid 4:d9b05924ad4c 5843 // %S... -- SPI diagnostics
whismanoid 4:d9b05924ad4c 5844 // %SC sclk=1Mhz -- SPI configure
whismanoid 4:d9b05924ad4c 5845 // %SW -- write (write and read)
whismanoid 4:d9b05924ad4c 5846 // %SR -- read (alias for %SW because SPI always write and read)
whismanoid 4:d9b05924ad4c 5847 // spi.format(8,0); // int bits_must_be_8, int mode=0_3 CPOL=0,CPHA=0 rising edge (initial default)
whismanoid 4:d9b05924ad4c 5848 // spi.format(8,1); // int bits_must_be_8, int mode=0_3 CPOL=0,CPHA=1 falling edge (initial default)
whismanoid 4:d9b05924ad4c 5849 // spi.format(8,2); // int bits_must_be_8, int mode=0_3 CPOL=1,CPHA=0 falling edge (initial default)
whismanoid 4:d9b05924ad4c 5850 // spi.format(8,3); // int bits_must_be_8, int mode=0_3 CPOL=1,CPHA=1 rising edge (initial default)
whismanoid 4:d9b05924ad4c 5851 // spi.frequency(1000000); // int SCLK_Hz=1000000 = 1MHz (initial default)
whismanoid 4:d9b05924ad4c 5852 // mode | POL PHA
whismanoid 4:d9b05924ad4c 5853 // -----+--------
whismanoid 4:d9b05924ad4c 5854 // 0 | 0 0
whismanoid 4:d9b05924ad4c 5855 // 1 | 0 1
whismanoid 4:d9b05924ad4c 5856 // 2 | 1 0
whismanoid 4:d9b05924ad4c 5857 // 3 | 1 1
whismanoid 4:d9b05924ad4c 5858 //cmdLine.serial().printf(" S) SPI mosi,mosi,...mosi hex bytes SCLK=1000000 CPOL=0 CPHA=0");
whismanoid 4:d9b05924ad4c 5859 // fixed: mbed-os-5.11: [Warning] format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
whismanoid 4:d9b05924ad4c 5860 cmdLine.serial().printf("\r\n %%SC SCLK=%ld=%1.3fMHz CPOL=%d CPHA=%d -- SPI config",
whismanoid 4:d9b05924ad4c 5861 g_SPI_SCLK_Hz, (g_SPI_SCLK_Hz / 1000000.),
whismanoid 4:d9b05924ad4c 5862 ((g_SPI_dataMode & SPI_MODE2) ? 1 : 0),
whismanoid 4:d9b05924ad4c 5863 ((g_SPI_dataMode & SPI_MODE1) ? 1 : 0));
whismanoid 4:d9b05924ad4c 5864 cmdLine.serial().printf("\r\n %%SD -- SPI diagnostic messages ");
whismanoid 4:d9b05924ad4c 5865 if (g_MAX11410_device.onSPIprint) {
whismanoid 4:d9b05924ad4c 5866 cmdLine.serial().printf("hide");
whismanoid 4:d9b05924ad4c 5867 }
whismanoid 4:d9b05924ad4c 5868 else {
whismanoid 4:d9b05924ad4c 5869 cmdLine.serial().printf("show");
whismanoid 4:d9b05924ad4c 5870 }
whismanoid 4:d9b05924ad4c 5871 cmdLine.serial().printf("\r\n %%SW mosi,mosi,...mosi -- SPI write hex bytes");
whismanoid 4:d9b05924ad4c 5872 // VERIFY: parse new SPI settings parse_strCommandArgs() SCLK=1000000 CPOL=0 CPHA=0
whismanoid 4:d9b05924ad4c 5873 #endif // SUPPORT_SPI
whismanoid 4:d9b05924ad4c 5874 //
whismanoid 4:d9b05924ad4c 5875 // Application-specific commands (help text) here
whismanoid 4:d9b05924ad4c 5876 //
whismanoid 4:d9b05924ad4c 5877 #if APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 5878 cmdLine.serial().printf("\r\n A-Z,a-z,0-9 -- reserved for application use"); // ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 5879 #endif // APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 5880 //
whismanoid 4:d9b05924ad4c 5881
whismanoid 4:d9b05924ad4c 5882 //~ extern void MAX11410_menu_help(CmdLine & cmdLine); // defined in Test_Menu_MAX11410.cpp\n
whismanoid 4:d9b05924ad4c 5883 //~ MAX11410_menu_help(cmdLine);
whismanoid 4:d9b05924ad4c 5884 }
whismanoid 4:d9b05924ad4c 5885 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 5886
whismanoid 4:d9b05924ad4c 5887 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 15:37c83ec50ea0 5888
whismanoid 15:37c83ec50ea0 5889 //--------------------------------------------------
whismanoid 15:37c83ec50ea0 5890 void pinsMonitor_submenu_onEOLcommandParser(CmdLine& cmdLine)
whismanoid 15:37c83ec50ea0 5891 {
whismanoid 15:37c83ec50ea0 5892 // % diagnostic commands submenu
whismanoid 15:37c83ec50ea0 5893 // %Hpin -- digital output high
whismanoid 15:37c83ec50ea0 5894 // %Lpin -- digital output low
whismanoid 15:37c83ec50ea0 5895 // %?pin -- digital input
whismanoid 15:37c83ec50ea0 5896 // %A %Apin -- analog input
whismanoid 15:37c83ec50ea0 5897 // %Ppin df=xx -- pwm output
whismanoid 15:37c83ec50ea0 5898 // %Wpin -- measure high pulsewidth input in usec
whismanoid 15:37c83ec50ea0 5899 // %wpin -- measure low pulsewidth input in usec
whismanoid 15:37c83ec50ea0 5900 // %I... -- I2C diagnostics
whismanoid 15:37c83ec50ea0 5901 // %IP -- I2C probe
whismanoid 15:37c83ec50ea0 5902 // %IC scl=100khz ADDR=? -- I2C configure
whismanoid 15:37c83ec50ea0 5903 // %IW byte byte ... byte RD=? ADDR=0x -- write
whismanoid 15:37c83ec50ea0 5904 // %IR ADDR=? RD=? -- read
whismanoid 15:37c83ec50ea0 5905 // %I^ cmd=? -- i2c_smbus_read_word_data
whismanoid 15:37c83ec50ea0 5906 // %S... -- SPI diagnostics
whismanoid 15:37c83ec50ea0 5907 // %SC sclk=1Mhz -- SPI configure
whismanoid 15:37c83ec50ea0 5908 // %SW -- write (write and read)
whismanoid 15:37c83ec50ea0 5909 // %SR -- read (alias for %SW because SPI always write and read)
whismanoid 15:37c83ec50ea0 5910 // A-Z,a-z,0-9 reserved for application use
whismanoid 15:37c83ec50ea0 5911 //
whismanoid 15:37c83ec50ea0 5912 char strPinIndex[3];
whismanoid 15:37c83ec50ea0 5913 strPinIndex[0] = cmdLine[2];
whismanoid 15:37c83ec50ea0 5914 strPinIndex[1] = cmdLine[3];
whismanoid 15:37c83ec50ea0 5915 strPinIndex[2] = '\0';
whismanoid 15:37c83ec50ea0 5916 int pinIndex = strtoul(strPinIndex, NULL, 10); // strtol(str, NULL, 10): get decimal value
whismanoid 15:37c83ec50ea0 5917 //cmdLine.serial().printf(" pinIndex=%d ", pinIndex);
whismanoid 15:37c83ec50ea0 5918 //
whismanoid 15:37c83ec50ea0 5919 // get next character
whismanoid 15:37c83ec50ea0 5920 switch (cmdLine[1])
whismanoid 15:37c83ec50ea0 5921 {
whismanoid 23:c6c652bef4b9 5922 //--------------------------------------------------
whismanoid 46:469d0061df5d 5923 #if defined(HAS_FLASH_PEEK) || defined(HAS_FLASH_POKE)
whismanoid 46:469d0061df5d 5924 // MAX32625 flash peek/poke support (MAX40108 demo) #312
whismanoid 46:469d0061df5d 5925 case 'F': case 'f':
whismanoid 46:469d0061df5d 5926 {
whismanoid 46:469d0061df5d 5927 # if HAS_FLASH_PEEK
whismanoid 46:469d0061df5d 5928 // Limit the ranges where memory write operation will be allowed
whismanoid 46:469d0061df5d 5929 // FLASH (rx) : ORIGIN = 0x00010000, LENGTH = 0x00070000
whismanoid 46:469d0061df5d 5930 //~ const uint32_t poke_flash_min = 0x00010000;
whismanoid 46:469d0061df5d 5931 //~ const uint32_t poke_flash_max = 0x0007FFFF;
whismanoid 46:469d0061df5d 5932 // RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00028000
whismanoid 46:469d0061df5d 5933 //~ const uint32_t poke_ram_min = 0x20000000;
whismanoid 46:469d0061df5d 5934 //~ const uint32_t poke_ram_max = 0x20027FFF;
whismanoid 46:469d0061df5d 5935 //
whismanoid 46:469d0061df5d 5936 // flash peek memory %F peek=0x0007ff00 len=0x0100 -- hex dump
whismanoid 46:469d0061df5d 5937 // get "len" keyword, default 1
whismanoid 46:469d0061df5d 5938 uint32_t peek_len = 1;
whismanoid 46:469d0061df5d 5939 if (cmdLine.parse_uint32_hex("len", peek_len))
whismanoid 46:469d0061df5d 5940 {
whismanoid 46:469d0061df5d 5941 }
whismanoid 46:469d0061df5d 5942 // get "peek" keyword, do peek operation if keyword is present
whismanoid 46:469d0061df5d 5943 uint32_t peek_addr = 0x00010000;
whismanoid 46:469d0061df5d 5944 if (cmdLine.parse_uint32_hex("peek", peek_addr))
whismanoid 46:469d0061df5d 5945 {
whismanoid 46:469d0061df5d 5946 // #312 hex dump memory from peek_addr length peek_len
whismanoid 46:469d0061df5d 5947 peek_addr = peek_addr &~ 0x00000003; // 32-bit word align
whismanoid 46:469d0061df5d 5948 //
whismanoid 46:469d0061df5d 5949 // scan poke_access_list[] for peek_addr
whismanoid 46:469d0061df5d 5950 int poke_access_list_index = search_poke_access_list(peek_addr);
whismanoid 46:469d0061df5d 5951 // post: poke_access_list[poke_access_list_index].addr_min is lowest address of range
whismanoid 46:469d0061df5d 5952 // post: poke_access_list[poke_access_list_index].addr_max is highest address of range
whismanoid 46:469d0061df5d 5953 // post: poke_access_list[poke_access_list_index].name
whismanoid 46:469d0061df5d 5954 // post: poke_access_list[poke_access_list_index].can_flash_write_read 8=end of list, 4=flashPoke, 2=ramPoke, 1=read
whismanoid 46:469d0061df5d 5955 cmdLine.serial().printf("\r\npoke_access_list[%d] %5s 0x%8.8lx - 0x%8.8lx access %x ",
whismanoid 46:469d0061df5d 5956 poke_access_list_index,
whismanoid 46:469d0061df5d 5957 poke_access_list[poke_access_list_index].name,
whismanoid 46:469d0061df5d 5958 poke_access_list[poke_access_list_index].addr_min,
whismanoid 46:469d0061df5d 5959 poke_access_list[poke_access_list_index].addr_max,
whismanoid 46:469d0061df5d 5960 poke_access_list[poke_access_list_index].can_flash_write_read);
whismanoid 46:469d0061df5d 5961 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x04)
whismanoid 46:469d0061df5d 5962 {
whismanoid 46:469d0061df5d 5963 cmdLine.serial().printf("flashPoke ");
whismanoid 46:469d0061df5d 5964 }
whismanoid 46:469d0061df5d 5965 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x02)
whismanoid 46:469d0061df5d 5966 {
whismanoid 46:469d0061df5d 5967 cmdLine.serial().printf("ramPoke ");
whismanoid 46:469d0061df5d 5968 }
whismanoid 46:469d0061df5d 5969 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x01)
whismanoid 46:469d0061df5d 5970 {
whismanoid 46:469d0061df5d 5971 cmdLine.serial().printf("read ");
whismanoid 46:469d0061df5d 5972 }
whismanoid 46:469d0061df5d 5973 //
whismanoid 46:469d0061df5d 5974 //~ cmdLine.serial().printf("\r\n0x%8.8lx: ", peek_addr);
whismanoid 46:469d0061df5d 5975 if ((peek_addr & 0x0F) != 0)
whismanoid 46:469d0061df5d 5976 {
whismanoid 46:469d0061df5d 5977 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, peek_addr);
whismanoid 46:469d0061df5d 5978 }
whismanoid 46:469d0061df5d 5979 while (peek_len > 0)
whismanoid 46:469d0061df5d 5980 {
whismanoid 46:469d0061df5d 5981 if ((peek_addr & 0x0F) == 0)
whismanoid 46:469d0061df5d 5982 {
whismanoid 46:469d0061df5d 5983 poke_access_list_index = search_poke_access_list(peek_addr);
whismanoid 46:469d0061df5d 5984 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, peek_addr);
whismanoid 46:469d0061df5d 5985 }
whismanoid 46:469d0061df5d 5986 if (poke_access_list[poke_access_list_index].can_flash_write_read & 1)
whismanoid 46:469d0061df5d 5987 {
whismanoid 46:469d0061df5d 5988 // read memory by using peek_addr as a uint32_t pointer
whismanoid 46:469d0061df5d 5989 cmdLine.serial().printf("0x%8.8lx ", *((uint32_t*)peek_addr));
whismanoid 46:469d0061df5d 5990 }
whismanoid 46:469d0061df5d 5991 else
whismanoid 46:469d0061df5d 5992 {
whismanoid 46:469d0061df5d 5993 // read operation is forbidden in this address range
whismanoid 46:469d0061df5d 5994 cmdLine.serial().printf("__________ ");
whismanoid 46:469d0061df5d 5995 }
whismanoid 46:469d0061df5d 5996 peek_addr += 4;
whismanoid 46:469d0061df5d 5997 peek_len--;
whismanoid 46:469d0061df5d 5998 }
whismanoid 46:469d0061df5d 5999 }
whismanoid 46:469d0061df5d 6000 # endif // HAS_FLASH_PEEK
whismanoid 46:469d0061df5d 6001 # if HAS_FLASH_POKE
whismanoid 46:469d0061df5d 6002 // flash poke memory %F poke=0x0007ff00 0xab 0xcd 0xef 0x27 0x18 0x28 -- erase/write flash page
whismanoid 46:469d0061df5d 6003 // get "poke" keyword, do poke operation if keyword is present
whismanoid 46:469d0061df5d 6004 uint32_t poke_addr = 0x20000000;
whismanoid 46:469d0061df5d 6005 if (cmdLine.parse_uint32_hex("poke", poke_addr))
whismanoid 46:469d0061df5d 6006 {
whismanoid 46:469d0061df5d 6007 size_t byteCount = 0;
whismanoid 46:469d0061df5d 6008 uint8_t pokeDataBuf[16];
whismanoid 46:469d0061df5d 6009 // get list of bytes after processing keywords
whismanoid 46:469d0061df5d 6010 // bool parse_byteCount_byteList_hex(size_t& byteCount, char *mosiDataBuf, size_t mosiDataBufSize);
whismanoid 46:469d0061df5d 6011 if (cmdLine.parse_byteCount_byteList_hex(byteCount, ((char *)pokeDataBuf), sizeof(pokeDataBuf)))
whismanoid 46:469d0061df5d 6012 {
whismanoid 46:469d0061df5d 6013 // #312 write memory at poke_addr
whismanoid 46:469d0061df5d 6014 poke_addr = poke_addr &~ 0x00000003; // 32-bit word align
whismanoid 46:469d0061df5d 6015 //
whismanoid 46:469d0061df5d 6016 // scan poke_access_list[] for poke_addr
whismanoid 46:469d0061df5d 6017 int poke_access_list_index = search_poke_access_list(poke_addr);
whismanoid 46:469d0061df5d 6018 // post: poke_access_list[poke_access_list_index].addr_min is lowest address of range
whismanoid 46:469d0061df5d 6019 // post: poke_access_list[poke_access_list_index].addr_max is highest address of range
whismanoid 46:469d0061df5d 6020 // post: poke_access_list[poke_access_list_index].name
whismanoid 46:469d0061df5d 6021 // post: poke_access_list[poke_access_list_index].can_flash_write_read 8=end of list, 4=flashPoke, 2=ramPoke, 1=read
whismanoid 46:469d0061df5d 6022 cmdLine.serial().printf("\r\npoke_access_list[%d] %5s 0x%8.8lx - 0x%8.8lx access %x ",
whismanoid 46:469d0061df5d 6023 poke_access_list_index,
whismanoid 46:469d0061df5d 6024 poke_access_list[poke_access_list_index].name,
whismanoid 46:469d0061df5d 6025 poke_access_list[poke_access_list_index].addr_min,
whismanoid 46:469d0061df5d 6026 poke_access_list[poke_access_list_index].addr_max,
whismanoid 46:469d0061df5d 6027 poke_access_list[poke_access_list_index].can_flash_write_read);
whismanoid 46:469d0061df5d 6028 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x04)
whismanoid 46:469d0061df5d 6029 {
whismanoid 46:469d0061df5d 6030 cmdLine.serial().printf("flashPoke ");
whismanoid 46:469d0061df5d 6031 }
whismanoid 46:469d0061df5d 6032 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x02)
whismanoid 46:469d0061df5d 6033 {
whismanoid 46:469d0061df5d 6034 cmdLine.serial().printf("ramPoke ");
whismanoid 46:469d0061df5d 6035 }
whismanoid 46:469d0061df5d 6036 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x01)
whismanoid 46:469d0061df5d 6037 {
whismanoid 46:469d0061df5d 6038 cmdLine.serial().printf("read ");
whismanoid 46:469d0061df5d 6039 }
whismanoid 46:469d0061df5d 6040 //
whismanoid 46:469d0061df5d 6041 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x0004)
whismanoid 46:469d0061df5d 6042 {
whismanoid 46:469d0061df5d 6043 //------------------------------
whismanoid 46:469d0061df5d 6044 // mbed interface to on-chip Flash
whismanoid 46:469d0061df5d 6045 // FlashIAP flash;
whismanoid 46:469d0061df5d 6046 // Maxim MAX32625 flash interface flc.h not .\mbed-os\drivers\FlashIAP.h
whismanoid 46:469d0061df5d 6047 // .\mbed-os\targets\TARGET_Maxim\TARGET_MAX32625\mxc\flc.h
whismanoid 46:469d0061df5d 6048 // .\mbed-os\targets\TARGET_Maxim\TARGET_MAX32625\mxc\flc.c
whismanoid 46:469d0061df5d 6049 //
whismanoid 46:469d0061df5d 6050 // MAX32625IWY+ Flash 512Kbyte in 64 pages of 8Kbyte per page
whismanoid 46:469d0061df5d 6051 static uint8_t pageBuf[8192];
whismanoid 46:469d0061df5d 6052 uint32_t pageBuf_addr = poke_addr &~ 0x1FFF; // 32-bit word align, 8Kbyte page boundary
whismanoid 46:469d0061df5d 6053 //
whismanoid 46:469d0061df5d 6054 // poke_addr is in FLASH address range, there's more steps
whismanoid 46:469d0061df5d 6055 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: flashPoke ...",
whismanoid 46:469d0061df5d 6056 poke_access_list[poke_access_list_index].name, poke_addr);
whismanoid 46:469d0061df5d 6057 // initialize flash memory interface
whismanoid 46:469d0061df5d 6058 // FlashIAP: FlashIAP flash; flash.init();
whismanoid 46:469d0061df5d 6059 // int FLC_Init(void);
whismanoid 46:469d0061df5d 6060 // returns E_NO_ERROR or E_BUSY or E_UNKNOWN
whismanoid 46:469d0061df5d 6061 cmdLine.serial().printf("FLC_Init ");
whismanoid 46:469d0061df5d 6062 if (FLC_Init() != E_NO_ERROR)
whismanoid 46:469d0061df5d 6063 {
whismanoid 46:469d0061df5d 6064 cmdLine.serial().printf("FAIL ");
whismanoid 46:469d0061df5d 6065 break; // can't perform the command
whismanoid 46:469d0061df5d 6066 }
whismanoid 46:469d0061df5d 6067 cmdLine.serial().printf("PASS ");
whismanoid 46:469d0061df5d 6068 //
whismanoid 46:469d0061df5d 6069 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: start of 8KByte page containing 0x%8.8lx...",
whismanoid 46:469d0061df5d 6070 poke_access_list[poke_access_list_index].name, pageBuf_addr, poke_addr);
whismanoid 46:469d0061df5d 6071 //
whismanoid 46:469d0061df5d 6072 // page read, update buffer from command line bytes, page erase, page write
whismanoid 46:469d0061df5d 6073 cmdLine.serial().printf("\r\nPgBuf 0x%8.8lx: copy page buffer, len=0x%x words = 0x%x bytes...",
whismanoid 46:469d0061df5d 6074 pageBuf_addr, sizeof(pageBuf)/4, sizeof(pageBuf));
whismanoid 46:469d0061df5d 6075 // memcpy(uint32_t *out, uint32_t *in, unsigned int count)
whismanoid 46:469d0061df5d 6076 memcpy(&pageBuf[0], (uint32_t*)pageBuf_addr, sizeof(pageBuf));
whismanoid 46:469d0061df5d 6077 //
whismanoid 46:469d0061df5d 6078 cmdLine.serial().printf("\r\nPgBuf 0x%8.8lx: udpate page buffer ...", poke_addr);
whismanoid 46:469d0061df5d 6079 // update buffer from command line bytes using my cmdline lib
whismanoid 46:469d0061df5d 6080 // ignore pokeDataBuf[0], its 0x0F because this is command F. :(
whismanoid 46:469d0061df5d 6081 for (size_t byteIndex = 1; byteIndex < byteCount; byteIndex += 4)
whismanoid 46:469d0061df5d 6082 {
whismanoid 46:469d0061df5d 6083 // How to handle big-endian vs little-endian?
whismanoid 46:469d0061df5d 6084 pageBuf[(poke_addr - pageBuf_addr + byteIndex-1) + 0] = pokeDataBuf[byteIndex + 3];
whismanoid 46:469d0061df5d 6085 pageBuf[(poke_addr - pageBuf_addr + byteIndex-1) + 1] = pokeDataBuf[byteIndex + 2];
whismanoid 46:469d0061df5d 6086 pageBuf[(poke_addr - pageBuf_addr + byteIndex-1) + 2] = pokeDataBuf[byteIndex + 1];
whismanoid 46:469d0061df5d 6087 pageBuf[(poke_addr - pageBuf_addr + byteIndex-1) + 3] = pokeDataBuf[byteIndex + 0];
whismanoid 46:469d0061df5d 6088 // seems 0x12 0x34 0x56 0x78 becomes 0x78563412
whismanoid 46:469d0061df5d 6089 uint32_t wordbuf = 0
whismanoid 46:469d0061df5d 6090 | ((uint32_t)pokeDataBuf[byteIndex + 0] << 24)
whismanoid 46:469d0061df5d 6091 | ((uint32_t)pokeDataBuf[byteIndex + 1] << 16)
whismanoid 46:469d0061df5d 6092 | ((uint32_t)pokeDataBuf[byteIndex + 2] << 8)
whismanoid 46:469d0061df5d 6093 | ((uint32_t)pokeDataBuf[byteIndex + 3] << 0)
whismanoid 46:469d0061df5d 6094 ;
whismanoid 46:469d0061df5d 6095 cmdLine.serial().printf("\r\nPgBuf[0x%8.8lx] = FLASH 0x%8.8lx: ",
whismanoid 46:469d0061df5d 6096 (poke_addr - pageBuf_addr + byteIndex-1), (poke_addr + byteIndex-1));
whismanoid 46:469d0061df5d 6097 cmdLine.serial().printf("0x%8.8lx ", wordbuf);
whismanoid 46:469d0061df5d 6098 // poke_addr += 4;
whismanoid 46:469d0061df5d 6099 }
whismanoid 46:469d0061df5d 6100 //
whismanoid 46:469d0061df5d 6101 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: erase page ...",
whismanoid 46:469d0061df5d 6102 poke_access_list[poke_access_list_index].name, pageBuf_addr);
whismanoid 46:469d0061df5d 6103 // page erase using flash.erase(addr, flash.get_sector_size(addr));
whismanoid 46:469d0061df5d 6104 // int FLC_PageErase(uint32_t address, MXC_V_FLC_ERASE_CODE_PAGE_ERASE, MXC_V_FLC_FLSH_UNLOCK_KEY);
whismanoid 46:469d0061df5d 6105 // @param address Address of the page to be erased.
whismanoid 46:469d0061df5d 6106 // @param erase_code Flash erase code; defined as
whismanoid 46:469d0061df5d 6107 // #MXC_V_FLC_ERASE_CODE_PAGE_ERASE for page erase
whismanoid 46:469d0061df5d 6108 // @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY.
whismanoid 46:469d0061df5d 6109 // returns E_NO_ERROR or else
whismanoid 46:469d0061df5d 6110 if (FLC_PageErase(pageBuf_addr, MXC_V_FLC_ERASE_CODE_PAGE_ERASE,
whismanoid 46:469d0061df5d 6111 MXC_V_FLC_FLSH_UNLOCK_KEY) != E_NO_ERROR)
whismanoid 46:469d0061df5d 6112 {
whismanoid 46:469d0061df5d 6113 cmdLine.serial().printf("FAIL ");
whismanoid 46:469d0061df5d 6114 break; // can't perform the command
whismanoid 46:469d0061df5d 6115 }
whismanoid 46:469d0061df5d 6116 cmdLine.serial().printf("PASS ");
whismanoid 46:469d0061df5d 6117 //
whismanoid 46:469d0061df5d 6118 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: write page buffer ...",
whismanoid 46:469d0061df5d 6119 poke_access_list[poke_access_list_index].name, pageBuf_addr);
whismanoid 46:469d0061df5d 6120 // page write using flash.program(page_buffer, addr, page_size);
whismanoid 46:469d0061df5d 6121 // int FLC_Write(uint32_t address, const void *data, uint32_t length, MXC_V_FLC_FLSH_UNLOCK_KEY);
whismanoid 46:469d0061df5d 6122 // @param address Start address for desired write. @note This address
whismanoid 46:469d0061df5d 6123 // must be 32-bit word aligned
whismanoid 46:469d0061df5d 6124 // @param data A pointer to the buffer containing the data to write.
whismanoid 46:469d0061df5d 6125 // @param length Size of the data to write in bytes. @note The length
whismanoid 46:469d0061df5d 6126 // must be in 32-bit multiples.
whismanoid 46:469d0061df5d 6127 // @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY.
whismanoid 46:469d0061df5d 6128 // returns E_NO_ERROR or else
whismanoid 46:469d0061df5d 6129 if (FLC_Write(pageBuf_addr, (uint32_t*)&pageBuf[0], sizeof(pageBuf),
whismanoid 46:469d0061df5d 6130 MXC_V_FLC_FLSH_UNLOCK_KEY) != E_NO_ERROR)
whismanoid 46:469d0061df5d 6131 {
whismanoid 46:469d0061df5d 6132 cmdLine.serial().printf("FAIL ");
whismanoid 46:469d0061df5d 6133 break; // can't perform the command
whismanoid 46:469d0061df5d 6134 }
whismanoid 46:469d0061df5d 6135 cmdLine.serial().printf("PASS ");
whismanoid 46:469d0061df5d 6136 //
whismanoid 46:469d0061df5d 6137 // FlashIAP: close flash memory interface flash.deinit();
whismanoid 46:469d0061df5d 6138 //
whismanoid 46:469d0061df5d 6139 // verify buffer matches flash page, or fail
whismanoid 46:469d0061df5d 6140 // for verification, perform %F peek=(poke_addr) len=(from byteCount)
whismanoid 46:469d0061df5d 6141 // hex dump memory from peek_addr length peek_len
whismanoid 46:469d0061df5d 6142 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: verify page buffer ...",
whismanoid 46:469d0061df5d 6143 poke_access_list[poke_access_list_index].name, pageBuf_addr);
whismanoid 46:469d0061df5d 6144 int verify_failed = 0;
whismanoid 46:469d0061df5d 6145 peek_addr = poke_addr;
whismanoid 46:469d0061df5d 6146 peek_len = (byteCount - 1)/4;
whismanoid 46:469d0061df5d 6147 //~ cmdLine.serial().printf("\r\n0x%8.8lx: ", peek_addr);
whismanoid 46:469d0061df5d 6148 if ((peek_addr & 0x0F) != 0)
whismanoid 46:469d0061df5d 6149 {
whismanoid 46:469d0061df5d 6150 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, peek_addr);
whismanoid 46:469d0061df5d 6151 }
whismanoid 46:469d0061df5d 6152 while (peek_len > 0)
whismanoid 46:469d0061df5d 6153 {
whismanoid 46:469d0061df5d 6154 if ((peek_addr & 0x0F) == 0)
whismanoid 46:469d0061df5d 6155 {
whismanoid 46:469d0061df5d 6156 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, peek_addr);
whismanoid 46:469d0061df5d 6157 }
whismanoid 46:469d0061df5d 6158 // read memory by using peek_addr as a uint32_t pointer
whismanoid 46:469d0061df5d 6159 // cmdLine.serial().printf("0x%8.8lx ", *((uint32_t*)peek_addr));
whismanoid 46:469d0061df5d 6160 // #312 %F peek verify, report fail if mismatch page buffer
whismanoid 46:469d0061df5d 6161 uint32_t expect_data = 0
whismanoid 46:469d0061df5d 6162 | ((uint32_t)pageBuf[peek_addr - pageBuf_addr + 3] << 24)
whismanoid 46:469d0061df5d 6163 | ((uint32_t)pageBuf[peek_addr - pageBuf_addr + 2] << 16)
whismanoid 46:469d0061df5d 6164 | ((uint32_t)pageBuf[peek_addr - pageBuf_addr + 1] << 8)
whismanoid 46:469d0061df5d 6165 | ((uint32_t)pageBuf[peek_addr - pageBuf_addr + 0] << 0)
whismanoid 46:469d0061df5d 6166 ;
whismanoid 46:469d0061df5d 6167 uint32_t actual_data = *((uint32_t*)peek_addr);
whismanoid 46:469d0061df5d 6168 if (actual_data == expect_data)
whismanoid 46:469d0061df5d 6169 {
whismanoid 46:469d0061df5d 6170 // this word matches
whismanoid 46:469d0061df5d 6171 cmdLine.serial().printf("=0x%8.8lx ", actual_data);
whismanoid 46:469d0061df5d 6172 }
whismanoid 46:469d0061df5d 6173 else
whismanoid 46:469d0061df5d 6174 {
whismanoid 46:469d0061df5d 6175 // mismatch, verification failed
whismanoid 46:469d0061df5d 6176 cmdLine.serial().printf("#0x%8.8lx(expected 0x%8.8lx)\r\n%5s 0x%8.8lx: ",
whismanoid 46:469d0061df5d 6177 actual_data, expect_data,
whismanoid 46:469d0061df5d 6178 poke_access_list[poke_access_list_index].name, peek_addr);
whismanoid 46:469d0061df5d 6179 verify_failed++;
whismanoid 46:469d0061df5d 6180 }
whismanoid 46:469d0061df5d 6181 //
whismanoid 46:469d0061df5d 6182 peek_addr += 4;
whismanoid 46:469d0061df5d 6183 peek_len--;
whismanoid 46:469d0061df5d 6184 }
whismanoid 46:469d0061df5d 6185 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: verify page buffer ",
whismanoid 46:469d0061df5d 6186 poke_access_list[poke_access_list_index].name, pageBuf_addr);
whismanoid 46:469d0061df5d 6187 if (verify_failed)
whismanoid 46:469d0061df5d 6188 {
whismanoid 46:469d0061df5d 6189 cmdLine.serial().printf("FAIL ");
whismanoid 46:469d0061df5d 6190 break; // can't perform the command
whismanoid 46:469d0061df5d 6191 }
whismanoid 46:469d0061df5d 6192 cmdLine.serial().printf("PASS ");
whismanoid 46:469d0061df5d 6193 //
whismanoid 46:469d0061df5d 6194 } // end of flashPoke operation
whismanoid 46:469d0061df5d 6195 else if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x0002)
whismanoid 46:469d0061df5d 6196 {
whismanoid 46:469d0061df5d 6197 // poke_addr is in RAM address range, write directly
whismanoid 46:469d0061df5d 6198 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ramPoke ", poke_access_list[poke_access_list_index].name, poke_addr);
whismanoid 46:469d0061df5d 6199 // ignore pokeDataBuf[0], its 0x0F because this is command F. :(
whismanoid 46:469d0061df5d 6200 for (size_t byteIndex = 1; byteIndex < byteCount; byteIndex += 4)
whismanoid 46:469d0061df5d 6201 {
whismanoid 46:469d0061df5d 6202 // How to handle big-endian vs little-endian?
whismanoid 46:469d0061df5d 6203 // seems 0x12 0x34 0x56 0x78 becomes 0x78563412
whismanoid 46:469d0061df5d 6204 poke_addr += 4;
whismanoid 46:469d0061df5d 6205 uint32_t wordbuf = 0
whismanoid 46:469d0061df5d 6206 | ((uint32_t)pokeDataBuf[byteIndex + 0] << 24)
whismanoid 46:469d0061df5d 6207 | ((uint32_t)pokeDataBuf[byteIndex + 1] << 16)
whismanoid 46:469d0061df5d 6208 | ((uint32_t)pokeDataBuf[byteIndex + 2] << 8)
whismanoid 46:469d0061df5d 6209 | ((uint32_t)pokeDataBuf[byteIndex + 3] << 0)
whismanoid 46:469d0061df5d 6210 ;
whismanoid 46:469d0061df5d 6211 cmdLine.serial().printf("0x%8.8lx ", wordbuf);
whismanoid 46:469d0061df5d 6212 //
whismanoid 46:469d0061df5d 6213 // write RAM by using poke_addr as a uint32_t pointer
whismanoid 46:469d0061df5d 6214 *((uint32_t*)poke_addr) = wordbuf;
whismanoid 46:469d0061df5d 6215 //
whismanoid 46:469d0061df5d 6216 // verify?
whismanoid 46:469d0061df5d 6217 if (*((uint32_t*)poke_addr) == wordbuf)
whismanoid 46:469d0061df5d 6218 {
whismanoid 46:469d0061df5d 6219 cmdLine.serial().printf("PASS ");
whismanoid 46:469d0061df5d 6220 }
whismanoid 46:469d0061df5d 6221 else
whismanoid 46:469d0061df5d 6222 {
whismanoid 46:469d0061df5d 6223 cmdLine.serial().printf("FAIL ");
whismanoid 46:469d0061df5d 6224 }
whismanoid 46:469d0061df5d 6225 }
whismanoid 46:469d0061df5d 6226 } // end of ramPoke operation
whismanoid 46:469d0061df5d 6227 else
whismanoid 46:469d0061df5d 6228 {
whismanoid 46:469d0061df5d 6229 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: no write here ", poke_access_list[poke_access_list_index].name, poke_addr);
whismanoid 46:469d0061df5d 6230 }
whismanoid 46:469d0061df5d 6231 }
whismanoid 46:469d0061df5d 6232 }
whismanoid 46:469d0061df5d 6233 # endif // HAS_FLASH_POKE
whismanoid 46:469d0061df5d 6234 # if HAS_FLASH_LOAD_SAVE
whismanoid 48:18647e0516f2 6235 uint32_t save_arg = save_arg_default;
whismanoid 46:469d0061df5d 6236 if (cmdLine.parse_uint32_hex("save", save_arg))
whismanoid 46:469d0061df5d 6237 {
whismanoid 46:469d0061df5d 6238 Save_flash_page_configuration_back_up(cmdLine, save_arg);
whismanoid 46:469d0061df5d 6239 }
whismanoid 48:18647e0516f2 6240 uint32_t load_arg = load_arg_default;
whismanoid 46:469d0061df5d 6241 if (cmdLine.parse_uint32_hex("load", load_arg))
whismanoid 46:469d0061df5d 6242 {
whismanoid 46:469d0061df5d 6243 Load_flash_page_configuration_back_up(cmdLine, load_arg);
whismanoid 46:469d0061df5d 6244 }
whismanoid 46:469d0061df5d 6245 # endif // HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 6246 }
whismanoid 46:469d0061df5d 6247 break;
whismanoid 46:469d0061df5d 6248 #endif // defined(HAS_FLASH_PEEK) || defined(HAS_FLASH_POKE)
whismanoid 46:469d0061df5d 6249 //--------------------------------------------------
whismanoid 23:c6c652bef4b9 6250 #if USE_DATALOGGER_CommandTable // Run_command_table(onButton1_command_table)
whismanoid 23:c6c652bef4b9 6251 // command_table: list of commands to perform on button press
whismanoid 23:c6c652bef4b9 6252 case 'B': case 'b':
whismanoid 23:c6c652bef4b9 6253 {
whismanoid 24:032f3683cb2a 6254 int command_table_button_index = 1;
whismanoid 23:c6c652bef4b9 6255 // %B1 submenu for Button1
whismanoid 23:c6c652bef4b9 6256 // future: %B2 submenu for Button2
whismanoid 23:c6c652bef4b9 6257 // future: %B3 submenu for Button3
whismanoid 23:c6c652bef4b9 6258 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 23:c6c652bef4b9 6259 // cmdLine[2] == '1' selects onButton1_command_table
whismanoid 23:c6c652bef4b9 6260 char** command_table = onButton1_command_table;
whismanoid 23:c6c652bef4b9 6261 #endif
whismanoid 24:032f3683cb2a 6262 switch(cmdLine[2])
whismanoid 24:032f3683cb2a 6263 {
whismanoid 24:032f3683cb2a 6264 default:
whismanoid 24:032f3683cb2a 6265 case '1': case 'A': case 'a': case '!':
whismanoid 24:032f3683cb2a 6266 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 6267 command_table_button_index = 1;
whismanoid 24:032f3683cb2a 6268 command_table = onButton1_command_table;
whismanoid 24:032f3683cb2a 6269 #endif
whismanoid 24:032f3683cb2a 6270 break;
whismanoid 24:032f3683cb2a 6271 case '2': case 'B': case 'b': case '@':
whismanoid 23:c6c652bef4b9 6272 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 6273 command_table_button_index = 2;
whismanoid 24:032f3683cb2a 6274 command_table = onButton2_command_table;
whismanoid 24:032f3683cb2a 6275 #endif
whismanoid 24:032f3683cb2a 6276 break;
whismanoid 24:032f3683cb2a 6277 case '3': case 'C': case 'c': case '#':
whismanoid 23:c6c652bef4b9 6278 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 6279 command_table_button_index = 3;
whismanoid 24:032f3683cb2a 6280 command_table = onButton3_command_table;
whismanoid 24:032f3683cb2a 6281 #endif
whismanoid 24:032f3683cb2a 6282 break;
whismanoid 29:6a9edb6e973b 6283 case '4':
whismanoid 29:6a9edb6e973b 6284 #if HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 6285 command_table_button_index = 4;
whismanoid 29:6a9edb6e973b 6286 command_table = onButton4_command_table;
whismanoid 29:6a9edb6e973b 6287 #endif
whismanoid 29:6a9edb6e973b 6288 break;
whismanoid 29:6a9edb6e973b 6289 case '5':
whismanoid 29:6a9edb6e973b 6290 #if HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 6291 command_table_button_index = 5;
whismanoid 29:6a9edb6e973b 6292 command_table = onButton5_command_table;
whismanoid 29:6a9edb6e973b 6293 #endif
whismanoid 29:6a9edb6e973b 6294 break;
whismanoid 29:6a9edb6e973b 6295 case '6':
whismanoid 29:6a9edb6e973b 6296 #if HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 6297 command_table_button_index = 6;
whismanoid 29:6a9edb6e973b 6298 command_table = onButton6_command_table;
whismanoid 29:6a9edb6e973b 6299 #endif
whismanoid 29:6a9edb6e973b 6300 break;
whismanoid 29:6a9edb6e973b 6301 case '7':
whismanoid 29:6a9edb6e973b 6302 #if HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 6303 command_table_button_index = 7;
whismanoid 29:6a9edb6e973b 6304 command_table = onButton7_command_table;
whismanoid 29:6a9edb6e973b 6305 #endif
whismanoid 29:6a9edb6e973b 6306 break;
whismanoid 29:6a9edb6e973b 6307 case '8':
whismanoid 29:6a9edb6e973b 6308 #if HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 6309 command_table_button_index = 8;
whismanoid 29:6a9edb6e973b 6310 command_table = onButton8_command_table;
whismanoid 29:6a9edb6e973b 6311 #endif
whismanoid 29:6a9edb6e973b 6312 break;
whismanoid 29:6a9edb6e973b 6313 case '9':
whismanoid 29:6a9edb6e973b 6314 #if HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 6315 command_table_button_index = 9;
whismanoid 29:6a9edb6e973b 6316 command_table = onButton9_command_table;
whismanoid 29:6a9edb6e973b 6317 #endif
whismanoid 29:6a9edb6e973b 6318 break;
whismanoid 24:032f3683cb2a 6319 }
whismanoid 24:032f3683cb2a 6320 //
whismanoid 23:c6c652bef4b9 6321 switch(cmdLine[3])
whismanoid 23:c6c652bef4b9 6322 {
whismanoid 23:c6c652bef4b9 6323 case '@':
whismanoid 23:c6c652bef4b9 6324 {
whismanoid 23:c6c652bef4b9 6325 // %B1@ view/edit command table, similar to L@ for action table
whismanoid 23:c6c652bef4b9 6326 int editRowIndex = 0;
whismanoid 23:c6c652bef4b9 6327 int command_table_row_count = 0;
whismanoid 23:c6c652bef4b9 6328 for (int lineIndex = 0; lineIndex < COMMAND_TABLE_ROW_MAX; lineIndex++) {
whismanoid 23:c6c652bef4b9 6329 if (command_table[lineIndex] == NULL) { break; }
whismanoid 23:c6c652bef4b9 6330 if (command_table[lineIndex][0] == '\0') { break; }
whismanoid 24:032f3683cb2a 6331 command_table_row_count = lineIndex+1;
whismanoid 24:032f3683cb2a 6332 }
whismanoid 24:032f3683cb2a 6333 //
whismanoid 24:032f3683cb2a 6334 // ignore extra spaces before the command
whismanoid 24:032f3683cb2a 6335 // find argIndex such that cmdLine[argIndex] is the start of the second word
whismanoid 24:032f3683cb2a 6336 int argIndex;
whismanoid 24:032f3683cb2a 6337 for (argIndex = 5; cmdLine[argIndex] != '\0'; argIndex++)
whismanoid 24:032f3683cb2a 6338 {
whismanoid 24:032f3683cb2a 6339 if (cmdLine[argIndex] == ' ') break;
whismanoid 24:032f3683cb2a 6340 }
whismanoid 24:032f3683cb2a 6341 for (; cmdLine[argIndex] != '\0'; argIndex++)
whismanoid 24:032f3683cb2a 6342 {
whismanoid 24:032f3683cb2a 6343 if (cmdLine[argIndex] != ' ') break;
whismanoid 23:c6c652bef4b9 6344 }
whismanoid 23:c6c652bef4b9 6345 //
whismanoid 23:c6c652bef4b9 6346 // Edit the contents of command_table
whismanoid 23:c6c652bef4b9 6347 switch (cmdLine[4]) // %B1@... -- Edit the contents of command_table
whismanoid 23:c6c652bef4b9 6348 {
whismanoid 23:c6c652bef4b9 6349 case '0': case '1': case '2': case '3': case '4':
whismanoid 23:c6c652bef4b9 6350 case '5': case '6': case '7': case '8': case '9':
whismanoid 24:032f3683cb2a 6351 // %B1@nnn command replace row number nnn
whismanoid 23:c6c652bef4b9 6352 // edit row data
whismanoid 33:70a28cfe9e01 6353 // get row number to edit from cmdLine[4]
whismanoid 33:70a28cfe9e01 6354 editRowIndex = atoi(cmdLine.str()+4);
whismanoid 23:c6c652bef4b9 6355 if (command_table_row_count > 0) {
whismanoid 23:c6c652bef4b9 6356 // if Datalogger_action_table_row_count == 0 then the table is empty
whismanoid 24:032f3683cb2a 6357 if ((editRowIndex >= 0) && (editRowIndex < command_table_row_count)) {
whismanoid 28:a9a3a9db592b 6358 // avoid replacing with null because that would truncate the table
whismanoid 28:a9a3a9db592b 6359 if (*(cmdLine.str()+argIndex)=='\0') {
whismanoid 28:a9a3a9db592b 6360 cmdLine.serial().printf("\r\n cannot replace row %d with nothing",
whismanoid 28:a9a3a9db592b 6361 editRowIndex);
whismanoid 28:a9a3a9db592b 6362 }
whismanoid 28:a9a3a9db592b 6363 else
whismanoid 28:a9a3a9db592b 6364 {
whismanoid 28:a9a3a9db592b 6365 // update row
whismanoid 28:a9a3a9db592b 6366 cmdLine.serial().printf("\r\n replace row %d with \"%s\"",
whismanoid 28:a9a3a9db592b 6367 editRowIndex, cmdLine.str()+argIndex);
whismanoid 28:a9a3a9db592b 6368 strncpy(command_table[editRowIndex], cmdLine.str()+argIndex, COMMAND_TABLE_COL_MAX-1);
whismanoid 28:a9a3a9db592b 6369 command_table[editRowIndex][COMMAND_TABLE_COL_MAX-1]='\0'; // null character at end of line
whismanoid 28:a9a3a9db592b 6370 }
whismanoid 24:032f3683cb2a 6371 }
whismanoid 33:70a28cfe9e01 6372 } // end if (command_table_row_count > 0)
whismanoid 33:70a28cfe9e01 6373 if ((editRowIndex == command_table_row_count) && (command_table_row_count < COMMAND_TABLE_ROW_MAX)) {
whismanoid 33:70a28cfe9e01 6374 // %B1@nnn command add new row (even though this looks like a replace command) if and only if nnn==next new unassigned line number
whismanoid 33:70a28cfe9e01 6375 //
whismanoid 33:70a28cfe9e01 6376 command_table_row_count++;
whismanoid 33:70a28cfe9e01 6377 cmdLine.serial().printf("\r\n add next row %d containing \"%s\"",
whismanoid 33:70a28cfe9e01 6378 editRowIndex, cmdLine.str()+argIndex);
whismanoid 33:70a28cfe9e01 6379 strncpy(command_table[editRowIndex], cmdLine.str()+argIndex, COMMAND_TABLE_COL_MAX-1);
whismanoid 33:70a28cfe9e01 6380 command_table[editRowIndex][COMMAND_TABLE_COL_MAX-1]='\0'; // null character at end of line
whismanoid 33:70a28cfe9e01 6381 command_table[command_table_row_count][0]='\0'; // empty string marks end of command_table
whismanoid 33:70a28cfe9e01 6382 //
whismanoid 23:c6c652bef4b9 6383 }
whismanoid 33:70a28cfe9e01 6384 //
whismanoid 23:c6c652bef4b9 6385 break;
whismanoid 23:c6c652bef4b9 6386 case '+':
whismanoid 24:032f3683cb2a 6387 // %B1@+ command add new row (if there is room to add)
whismanoid 23:c6c652bef4b9 6388 // add a new row at end of table
whismanoid 23:c6c652bef4b9 6389 if (command_table_row_count < COMMAND_TABLE_ROW_MAX) {
whismanoid 23:c6c652bef4b9 6390 // if command_table_row_count => COMMAND_TABLE_ROW_MAX then the table is full
whismanoid 23:c6c652bef4b9 6391 editRowIndex = command_table_row_count;
whismanoid 28:a9a3a9db592b 6392 // avoid replacing with null because that would truncate the table
whismanoid 28:a9a3a9db592b 6393 if (*(cmdLine.str()+argIndex)=='\0') {
whismanoid 28:a9a3a9db592b 6394 cmdLine.serial().printf("\r\n cannot add new row %d containing nothing",
whismanoid 28:a9a3a9db592b 6395 editRowIndex);
whismanoid 28:a9a3a9db592b 6396 }
whismanoid 28:a9a3a9db592b 6397 else
whismanoid 28:a9a3a9db592b 6398 {
whismanoid 28:a9a3a9db592b 6399 command_table_row_count++;
whismanoid 28:a9a3a9db592b 6400 cmdLine.serial().printf("\r\n add new row %d containing \"%s\"",
whismanoid 28:a9a3a9db592b 6401 editRowIndex, cmdLine.str()+argIndex);
whismanoid 28:a9a3a9db592b 6402 strncpy(command_table[editRowIndex], cmdLine.str()+argIndex, COMMAND_TABLE_COL_MAX-1);
whismanoid 28:a9a3a9db592b 6403 command_table[editRowIndex][COMMAND_TABLE_COL_MAX-1]='\0'; // null character at end of line
whismanoid 28:a9a3a9db592b 6404 command_table[command_table_row_count][0]='\0'; // empty string marks end of command_table
whismanoid 28:a9a3a9db592b 6405 }
whismanoid 23:c6c652bef4b9 6406 }
whismanoid 23:c6c652bef4b9 6407 break;
whismanoid 23:c6c652bef4b9 6408 case '-':
whismanoid 24:032f3683cb2a 6409 // %B1@-nnn delete row number nnn (if list is not empty)
whismanoid 23:c6c652bef4b9 6410 // delete row from table
whismanoid 23:c6c652bef4b9 6411 if (command_table_row_count > 0) {
whismanoid 23:c6c652bef4b9 6412 // if command_table_row_count == 0 then the table is empty
whismanoid 23:c6c652bef4b9 6413 if ((cmdLine[5] == '~') && (cmdLine[6] == '~') && (cmdLine[7] == '~')) {
whismanoid 23:c6c652bef4b9 6414 // %B1@-~~~ clear entire command table
whismanoid 24:032f3683cb2a 6415 cmdLine.serial().printf("\r\n clear entire command table");
whismanoid 23:c6c652bef4b9 6416 command_table_row_count = 0;
whismanoid 28:a9a3a9db592b 6417 command_table[command_table_row_count][0]='\0'; // empty string marks end of command_table
whismanoid 23:c6c652bef4b9 6418 break;
whismanoid 23:c6c652bef4b9 6419 }
whismanoid 24:032f3683cb2a 6420 else
whismanoid 23:c6c652bef4b9 6421 {
whismanoid 24:032f3683cb2a 6422 // %B1@-nnn delete row number nnn (if list is not empty)
whismanoid 24:032f3683cb2a 6423 editRowIndex = atoi(cmdLine.str()+5);
whismanoid 24:032f3683cb2a 6424 if ((editRowIndex >= 0) && (editRowIndex < command_table_row_count)) {
whismanoid 24:032f3683cb2a 6425 cmdLine.serial().printf("\r\n delete row %d", editRowIndex);
whismanoid 24:032f3683cb2a 6426 // delete row editRowIndex from Datalogger_action_table
whismanoid 24:032f3683cb2a 6427 for (int i = editRowIndex; i < (command_table_row_count-1); i++)
whismanoid 24:032f3683cb2a 6428 {
whismanoid 24:032f3683cb2a 6429 // copy row i+1 into row i
whismanoid 24:032f3683cb2a 6430 cmdLine.serial().printf("\r\n copy row %d into row %d: \"%s\"",
whismanoid 24:032f3683cb2a 6431 i+1, i, command_table[i+1]);
whismanoid 24:032f3683cb2a 6432 strncpy(command_table[i], command_table[i+1], COMMAND_TABLE_COL_MAX-1);
whismanoid 28:a9a3a9db592b 6433 command_table[i][COMMAND_TABLE_COL_MAX-1]='\0'; // null character at end of line
whismanoid 24:032f3683cb2a 6434 }
whismanoid 24:032f3683cb2a 6435 command_table_row_count--;
whismanoid 28:a9a3a9db592b 6436 command_table[command_table_row_count][0]='\0'; // empty string marks end of command_table
whismanoid 24:032f3683cb2a 6437 }
whismanoid 23:c6c652bef4b9 6438 }
whismanoid 23:c6c652bef4b9 6439 }
whismanoid 23:c6c652bef4b9 6440 break;
whismanoid 30:07197a430869 6441 case '.': // something other than ! because %B1! means trigger event
whismanoid 30:07197a430869 6442 // pause the button event
whismanoid 30:07197a430869 6443 // TODO: %B1@. disable button response but keep command table contents
whismanoid 23:c6c652bef4b9 6444 //~ Datalogger_action_table_enabled = false;
whismanoid 23:c6c652bef4b9 6445 break;
whismanoid 23:c6c652bef4b9 6446 case '@':
whismanoid 30:07197a430869 6447 // enable the button event
whismanoid 23:c6c652bef4b9 6448 // TODO: %B1@@ enable button response
whismanoid 23:c6c652bef4b9 6449 //~ Datalogger_action_table_enabled = true;
whismanoid 23:c6c652bef4b9 6450 break;
whismanoid 23:c6c652bef4b9 6451 }
whismanoid 23:c6c652bef4b9 6452 //
whismanoid 23:c6c652bef4b9 6453 // Print the contents of command_table
whismanoid 23:c6c652bef4b9 6454 for (int lineIndex = 0; lineIndex < COMMAND_TABLE_ROW_MAX; lineIndex++) {
whismanoid 23:c6c652bef4b9 6455 if (command_table[lineIndex] == NULL) { break; }
whismanoid 23:c6c652bef4b9 6456 if (command_table[lineIndex][0] == '\0') { break; }
whismanoid 24:032f3683cb2a 6457 command_table_row_count = lineIndex+1;
whismanoid 24:032f3683cb2a 6458 cmdLine.serial().printf("\r\n %%B%1d@%d %s",
whismanoid 24:032f3683cb2a 6459 command_table_button_index,
whismanoid 24:032f3683cb2a 6460 lineIndex,
whismanoid 24:032f3683cb2a 6461 command_table[lineIndex]);
whismanoid 23:c6c652bef4b9 6462 }
whismanoid 30:07197a430869 6463 //~ cmdLine.serial().printf("\r\n command_table_row_count = %d/%d",
whismanoid 30:07197a430869 6464 //~ command_table_row_count, COMMAND_TABLE_ROW_MAX);
whismanoid 30:07197a430869 6465 cmdLine.serial().printf("\r\n\r\nEdit Button%d event (used %d/%d, %d free):",
whismanoid 30:07197a430869 6466 command_table_button_index,
whismanoid 30:07197a430869 6467 command_table_row_count,
whismanoid 30:07197a430869 6468 COMMAND_TABLE_ROW_MAX,
whismanoid 30:07197a430869 6469 (COMMAND_TABLE_ROW_MAX - command_table_row_count)
whismanoid 30:07197a430869 6470 );
whismanoid 23:c6c652bef4b9 6471 if (command_table_row_count < COMMAND_TABLE_ROW_MAX) {
whismanoid 23:c6c652bef4b9 6472 // if command_table_row_count => COMMAND_TABLE_ROW_MAX then the table is full
whismanoid 24:032f3683cb2a 6473 cmdLine.serial().printf("\r\n %%B%1d@+ command -- add new row %d at end of table",
whismanoid 24:032f3683cb2a 6474 command_table_button_index,
whismanoid 24:032f3683cb2a 6475 command_table_row_count);
whismanoid 23:c6c652bef4b9 6476 }
whismanoid 23:c6c652bef4b9 6477 if (command_table_row_count > 0) {
whismanoid 23:c6c652bef4b9 6478 // if command_table_row_count == 0 then the table is empty
whismanoid 24:032f3683cb2a 6479 cmdLine.serial().printf("\r\n %%B%1d@%d command -- replace row %d",
whismanoid 24:032f3683cb2a 6480 command_table_button_index,
whismanoid 23:c6c652bef4b9 6481 command_table_row_count-1,
whismanoid 23:c6c652bef4b9 6482 command_table_row_count-1);
whismanoid 24:032f3683cb2a 6483 cmdLine.serial().printf("\r\n %%B%1d@-%d -- delete row %d",
whismanoid 24:032f3683cb2a 6484 command_table_button_index,
whismanoid 24:032f3683cb2a 6485 command_table_row_count-1,
whismanoid 24:032f3683cb2a 6486 command_table_row_count-1);
whismanoid 24:032f3683cb2a 6487 cmdLine.serial().printf("\r\n %%B%1d@-~~~ -- delete all rows",
whismanoid 24:032f3683cb2a 6488 command_table_button_index);
whismanoid 30:07197a430869 6489 //~ cmdLine.serial().printf("\r\n %%B%1d@. -- pause entire command table",
whismanoid 30:07197a430869 6490 //~ command_table_button_index);
whismanoid 30:07197a430869 6491 //~ cmdLine.serial().printf("\r\n %%B%1d@@ -- enable command table",
whismanoid 30:07197a430869 6492 //~ command_table_button_index);
whismanoid 30:07197a430869 6493 cmdLine.serial().printf("\r\n %%B%1d! -- trigger Button%d event",
whismanoid 30:07197a430869 6494 command_table_button_index,
whismanoid 24:032f3683cb2a 6495 command_table_button_index);
whismanoid 23:c6c652bef4b9 6496 }
whismanoid 23:c6c652bef4b9 6497 //
whismanoid 23:c6c652bef4b9 6498 } // case '@' -- %B1@ view/edit command table
whismanoid 23:c6c652bef4b9 6499 break;
whismanoid 23:c6c652bef4b9 6500 case '!':
whismanoid 23:c6c652bef4b9 6501 // TODO: %B1! trigger onButton1FallingEdge() immediately (for test development)
whismanoid 23:c6c652bef4b9 6502 Run_command_table(command_table);
whismanoid 23:c6c652bef4b9 6503 break;
whismanoid 23:c6c652bef4b9 6504 }
whismanoid 23:c6c652bef4b9 6505 }
whismanoid 23:c6c652bef4b9 6506 break;
whismanoid 23:c6c652bef4b9 6507 #endif // USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 6508 //--------------------------------------------------
whismanoid 15:37c83ec50ea0 6509 #if HAS_digitalInOuts
whismanoid 15:37c83ec50ea0 6510 case 'H': case 'h':
whismanoid 15:37c83ec50ea0 6511 {
whismanoid 15:37c83ec50ea0 6512 // %Hpin -- digital output high
whismanoid 15:37c83ec50ea0 6513 #if ARDUINO_STYLE
whismanoid 15:37c83ec50ea0 6514 pinMode(pinIndex, OUTPUT); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 15:37c83ec50ea0 6515 digitalWrite(pinIndex, HIGH); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 15:37c83ec50ea0 6516 #else
whismanoid 15:37c83ec50ea0 6517 DigitalInOut& digitalInOutPin = find_digitalInOutPin(pinIndex);
whismanoid 15:37c83ec50ea0 6518 digitalInOutPin.output();
whismanoid 15:37c83ec50ea0 6519 digitalInOutPin.write(1);
whismanoid 15:37c83ec50ea0 6520 #endif
whismanoid 15:37c83ec50ea0 6521 cmdLine.serial().printf(" digitalInOutPin %d Output High ", pinIndex);
whismanoid 15:37c83ec50ea0 6522 }
whismanoid 15:37c83ec50ea0 6523 break;
whismanoid 15:37c83ec50ea0 6524 case 'L': case 'l':
whismanoid 15:37c83ec50ea0 6525 {
whismanoid 15:37c83ec50ea0 6526 // %Lpin -- digital output low
whismanoid 15:37c83ec50ea0 6527 #if ARDUINO_STYLE
whismanoid 15:37c83ec50ea0 6528 pinMode(pinIndex, OUTPUT); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 15:37c83ec50ea0 6529 digitalWrite(pinIndex, LOW); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 15:37c83ec50ea0 6530 #else
whismanoid 15:37c83ec50ea0 6531 DigitalInOut& digitalInOutPin = find_digitalInOutPin(pinIndex);
whismanoid 15:37c83ec50ea0 6532 digitalInOutPin.output();
whismanoid 15:37c83ec50ea0 6533 digitalInOutPin.write(0);
whismanoid 15:37c83ec50ea0 6534 #endif
whismanoid 15:37c83ec50ea0 6535 cmdLine.serial().printf(" digitalInOutPin %d Output Low ", pinIndex);
whismanoid 15:37c83ec50ea0 6536 }
whismanoid 15:37c83ec50ea0 6537 break;
whismanoid 15:37c83ec50ea0 6538 case '?':
whismanoid 15:37c83ec50ea0 6539 {
whismanoid 15:37c83ec50ea0 6540 // %?pin -- digital input
whismanoid 15:37c83ec50ea0 6541 #if ARDUINO_STYLE
whismanoid 15:37c83ec50ea0 6542 pinMode(pinIndex, INPUT); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 15:37c83ec50ea0 6543 #else
whismanoid 15:37c83ec50ea0 6544 DigitalInOut& digitalInOutPin = find_digitalInOutPin(pinIndex);
whismanoid 15:37c83ec50ea0 6545 digitalInOutPin.input();
whismanoid 15:37c83ec50ea0 6546 #endif
whismanoid 15:37c83ec50ea0 6547 serial.printf(" digitalInOutPin %d Input ", pinIndex);
whismanoid 15:37c83ec50ea0 6548 #if ARDUINO_STYLE
whismanoid 15:37c83ec50ea0 6549 int value = digitalRead(pinIndex);
whismanoid 15:37c83ec50ea0 6550 #else
whismanoid 15:37c83ec50ea0 6551 int value = digitalInOutPin.read();
whismanoid 15:37c83ec50ea0 6552 #endif
whismanoid 15:37c83ec50ea0 6553 cmdLine.serial().printf("%d ", value);
whismanoid 15:37c83ec50ea0 6554 }
whismanoid 15:37c83ec50ea0 6555 break;
whismanoid 15:37c83ec50ea0 6556 #endif
whismanoid 15:37c83ec50ea0 6557 //
whismanoid 15:37c83ec50ea0 6558 #if HAS_analogIns
whismanoid 15:37c83ec50ea0 6559 case 'A': case 'a':
whismanoid 15:37c83ec50ea0 6560 {
whismanoid 15:37c83ec50ea0 6561 // %A %Apin -- analog input
whismanoid 37:3f369235e5bc 6562 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 6563 // %A avg= -- set Platform_AIN_Average_N
whismanoid 37:3f369235e5bc 6564 if (cmdLine.parse_int_dec("avg", Platform_AIN_Average_N))
whismanoid 37:3f369235e5bc 6565 {
whismanoid 37:3f369235e5bc 6566 // Platform_AIN_Average_N was updated
whismanoid 37:3f369235e5bc 6567 }
whismanoid 37:3f369235e5bc 6568 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 6569 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6570 // %A cal? view/export raw calibration values for all channels
whismanoid 34:a1993a1ee904 6571 // double calibration_05_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6572 // double calibration_05_V [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6573 // double calibration_95_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6574 // double calibration_95_V [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6575 {
whismanoid 34:a1993a1ee904 6576 char valueBuf[16];
whismanoid 34:a1993a1ee904 6577 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 34:a1993a1ee904 6578 if (cmdLine.parse_and_remove_key("cal?", valueBuf, sizeof(valueBuf)))
whismanoid 34:a1993a1ee904 6579 {
whismanoid 34:a1993a1ee904 6580 for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6581 {
whismanoid 52:bb09c0f452ec 6582 // %A cl0n= cl0v= ch0n= ch0v= -- unambiguous low and high cal points alternative to cal0n= cal0v= cal0n= cal0v= #354
whismanoid 52:bb09c0f452ec 6583 //cmdLine.serial().printf(" %%A cal%dn=%1.9f cal%dv=%1.9fV cal%dn=%1.9f cal%dv=%1.9fV\r\n",
whismanoid 52:bb09c0f452ec 6584 cmdLine.serial().printf(" %%A cl%dn=%1.9f cl%dv=%1.9fV ch%dn=%1.9f ch%dv=%1.9fV\r\n",
whismanoid 34:a1993a1ee904 6585 ch, calibration_05_normValue_0_1[ch],
whismanoid 34:a1993a1ee904 6586 ch, calibration_05_V[ch],
whismanoid 34:a1993a1ee904 6587 ch, calibration_95_normValue_0_1[ch],
whismanoid 34:a1993a1ee904 6588 ch, calibration_95_V[ch]
whismanoid 34:a1993a1ee904 6589 );
whismanoid 34:a1993a1ee904 6590 }
whismanoid 34:a1993a1ee904 6591 //
whismanoid 34:a1993a1ee904 6592 // print extended help for %A
whismanoid 34:a1993a1ee904 6593 // %A cal0n=0.02 cal0v=0.123 cal0n=0.938 cal0v=1.132 edit/import raw calibration values for any/all channels
whismanoid 34:a1993a1ee904 6594 //~ cmdLine.serial().printf("\r\n %%A cal0n=0.02 cal0v=0.123 cal0n=0.938 cal0v=1.132 -- update calibration");
whismanoid 34:a1993a1ee904 6595 // %A cal0test=0.5 test calibration functions by calculating the calibrated voltage of specified normValue_0_1
whismanoid 34:a1993a1ee904 6596 cmdLine.serial().printf(" %%A cal0test=0.5 -- calculate voltage at 50%% of full scale");
whismanoid 49:359a6b9df7c1 6597 // #350 MAX40108 %A vl#cal / vh#cal / v#copy=
whismanoid 49:359a6b9df7c1 6598 // cmdLine.serial().printf("\r\n %%A v0cal=1.000V -- calibrate channel against a known input voltage");
whismanoid 49:359a6b9df7c1 6599 cmdLine.serial().printf("\r\n %%A v0cal=1.000V | vl5cal=0.800V | vh5cal=1.600V -- calibrate input voltage");
whismanoid 49:359a6b9df7c1 6600 cmdLine.serial().printf("\r\n %%A v4copy=5 -- copy calibration from other channel");
whismanoid 34:a1993a1ee904 6601 // %A calreset -- reset all calibration data
whismanoid 34:a1993a1ee904 6602 cmdLine.serial().printf("\r\n %%A calreset -- reset all calibration data");
whismanoid 37:3f369235e5bc 6603 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 6604 // %A avg=%d -- help string display Platform_AIN_Average_N
whismanoid 37:3f369235e5bc 6605 cmdLine.serial().printf("\r\n %%A avg=%d -- average", Platform_AIN_Average_N);
whismanoid 37:3f369235e5bc 6606 #endif // USE_Platform_AIN_Average
whismanoid 48:18647e0516f2 6607 #ifdef BOARD_SERIAL_NUMBER
whismanoid 48:18647e0516f2 6608 // %A sn= set g_board_serial_number ; use with %F save during calibration #312
whismanoid 49:359a6b9df7c1 6609 cmdLine.serial().printf("\r\n %%A sn=%ld -- serial number", g_board_serial_number);
whismanoid 48:18647e0516f2 6610 #endif // BOARD_SERIAL_NUMBER
whismanoid 34:a1993a1ee904 6611 cmdLine.serial().printf("\r\n\r\n");
whismanoid 34:a1993a1ee904 6612 //
whismanoid 34:a1993a1ee904 6613 } // end if (cmdLine.parse_and_remove_key("cal?", valueBuf, sizeof(valueBuf)))
whismanoid 34:a1993a1ee904 6614 }
whismanoid 34:a1993a1ee904 6615 #endif // HAS_Platform_AIN_Calibration
whismanoid 48:18647e0516f2 6616 #ifdef BOARD_SERIAL_NUMBER
whismanoid 48:18647e0516f2 6617 {
whismanoid 48:18647e0516f2 6618 // %A sn= set g_board_serial_number ; use with %F save during calibration #312
whismanoid 48:18647e0516f2 6619 if (cmdLine.parse_uint32_dec("sn", g_board_serial_number))
whismanoid 48:18647e0516f2 6620 {
whismanoid 48:18647e0516f2 6621 }
whismanoid 48:18647e0516f2 6622 }
whismanoid 48:18647e0516f2 6623 #endif // BOARD_SERIAL_NUMBER
whismanoid 34:a1993a1ee904 6624 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6625 {
whismanoid 34:a1993a1ee904 6626 // %A calreset -- reset all calibration data
whismanoid 34:a1993a1ee904 6627 char valueBuf[16];
whismanoid 34:a1993a1ee904 6628 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 34:a1993a1ee904 6629 if (cmdLine.parse_and_remove_key("calreset", valueBuf, sizeof(valueBuf)))
whismanoid 34:a1993a1ee904 6630 {
whismanoid 34:a1993a1ee904 6631 // nominal 5% fullscale point; normValue_0_1 < 0.5
whismanoid 34:a1993a1ee904 6632 calibration_05_normValue_0_1[0] = 0.25; calibration_05_V[0] = 0.3;
whismanoid 34:a1993a1ee904 6633 calibration_05_normValue_0_1[1] = 0.25; calibration_05_V[1] = 0.3;
whismanoid 34:a1993a1ee904 6634 calibration_05_normValue_0_1[2] = 0.25; calibration_05_V[2] = 0.3;
whismanoid 34:a1993a1ee904 6635 calibration_05_normValue_0_1[3] = 0.25; calibration_05_V[3] = 0.3;
whismanoid 34:a1993a1ee904 6636 calibration_05_normValue_0_1[4] = 0.25; calibration_05_V[4] = 1.5;
whismanoid 34:a1993a1ee904 6637 calibration_05_normValue_0_1[5] = 0.25; calibration_05_V[5] = 1.5;
whismanoid 34:a1993a1ee904 6638 //
whismanoid 34:a1993a1ee904 6639 // nominal 95% fullscale point; normValue_0_1 > 0.5
whismanoid 34:a1993a1ee904 6640 calibration_95_normValue_0_1[0] = 0.75; calibration_95_V[0] = 0.9;
whismanoid 34:a1993a1ee904 6641 calibration_95_normValue_0_1[1] = 0.75; calibration_95_V[1] = 0.9;
whismanoid 34:a1993a1ee904 6642 calibration_95_normValue_0_1[2] = 0.75; calibration_95_V[2] = 0.9;
whismanoid 34:a1993a1ee904 6643 calibration_95_normValue_0_1[3] = 0.75; calibration_95_V[3] = 0.9;
whismanoid 34:a1993a1ee904 6644 calibration_95_normValue_0_1[4] = 0.75; calibration_95_V[4] = 4.5;
whismanoid 34:a1993a1ee904 6645 calibration_95_normValue_0_1[5] = 0.75; calibration_95_V[5] = 4.5;
whismanoid 34:a1993a1ee904 6646 //
whismanoid 34:a1993a1ee904 6647 }
whismanoid 34:a1993a1ee904 6648 }
whismanoid 34:a1993a1ee904 6649 #endif // HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6650 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6651 // %A cal0n=0.02 cal0v=0.123 cal0n=0.938 cal0v=1.132 edit/import raw calibration values for any/all channels
whismanoid 35:c9549b5c01de 6652 // %A cal4n=0.135874882 cal4v=0.800000012V cal4n=0.286168128 cal4v=1.700000048V
whismanoid 34:a1993a1ee904 6653 // double calibration_05_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6654 // double calibration_05_V [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6655 // double calibration_95_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6656 // double calibration_95_V [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6657 {
whismanoid 34:a1993a1ee904 6658 double normValue_0_1, V;
whismanoid 34:a1993a1ee904 6659 for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6660 {
whismanoid 52:bb09c0f452ec 6661 // %A cl0n= cl0v= ch0n= ch0v= -- unambiguous low and high cal points alternative to cal0n= cal0v= cal0n= cal0v= #354
whismanoid 52:bb09c0f452ec 6662 static char key_call0n[8] = "call0n_";
whismanoid 52:bb09c0f452ec 6663 sprintf(key_call0n, "cl%1dn", ch);
whismanoid 52:bb09c0f452ec 6664 static char key_call0v[8] = "call0v_";
whismanoid 52:bb09c0f452ec 6665 sprintf(key_call0v, "cl%1dv", ch);
whismanoid 52:bb09c0f452ec 6666 static char key_calh0n[8] = "calh0n_";
whismanoid 52:bb09c0f452ec 6667 sprintf(key_calh0n, "ch%1dn", ch);
whismanoid 52:bb09c0f452ec 6668 static char key_calh0v[8] = "calh0v_";
whismanoid 52:bb09c0f452ec 6669 sprintf(key_calh0v, "ch%1dv", ch);
whismanoid 52:bb09c0f452ec 6670 if (cmdLine.parse_double(key_call0n, normValue_0_1))
whismanoid 52:bb09c0f452ec 6671 {
whismanoid 52:bb09c0f452ec 6672 if (cmdLine.parse_double(key_call0v, V))
whismanoid 52:bb09c0f452ec 6673 {
whismanoid 52:bb09c0f452ec 6674 // store first calibration point in the 5% slot
whismanoid 52:bb09c0f452ec 6675 calibration_05_normValue_0_1[ch] = normValue_0_1;
whismanoid 52:bb09c0f452ec 6676 calibration_05_V[ch] = V;
whismanoid 52:bb09c0f452ec 6677 }
whismanoid 52:bb09c0f452ec 6678 }
whismanoid 52:bb09c0f452ec 6679 if (cmdLine.parse_double(key_calh0n, normValue_0_1))
whismanoid 52:bb09c0f452ec 6680 {
whismanoid 52:bb09c0f452ec 6681 if (cmdLine.parse_double(key_calh0v, V))
whismanoid 52:bb09c0f452ec 6682 {
whismanoid 52:bb09c0f452ec 6683 calibration_95_normValue_0_1[ch] = normValue_0_1;
whismanoid 52:bb09c0f452ec 6684 calibration_95_V[ch] = V;
whismanoid 52:bb09c0f452ec 6685 }
whismanoid 52:bb09c0f452ec 6686 }
whismanoid 52:bb09c0f452ec 6687 // auto select low or high cal points: cal0n= cal0v= cal0n= cal0v=
whismanoid 34:a1993a1ee904 6688 static char key_can0n[8] = "cal0n__";
whismanoid 34:a1993a1ee904 6689 sprintf(key_can0n, "cal%1dn", ch);
whismanoid 34:a1993a1ee904 6690 static char key_cal0v[8] = "cal0v__";
whismanoid 34:a1993a1ee904 6691 sprintf(key_cal0v, "cal%1dv", ch);
whismanoid 35:c9549b5c01de 6692 // first point could be the 5% point or the 95% point
whismanoid 35:c9549b5c01de 6693 double norm_threshold = (calibration_05_normValue_0_1[ch] + calibration_95_normValue_0_1[ch]) / 2.0;
whismanoid 35:c9549b5c01de 6694 bool updated_05 = false;
whismanoid 35:c9549b5c01de 6695 //~ bool updated_95 = false;
whismanoid 35:c9549b5c01de 6696 if (cmdLine.parse_double(key_can0n, normValue_0_1)) {
whismanoid 34:a1993a1ee904 6697 if (cmdLine.parse_double(key_cal0v, V))
whismanoid 34:a1993a1ee904 6698 {
whismanoid 35:c9549b5c01de 6699 if (normValue_0_1 < norm_threshold) {
whismanoid 35:c9549b5c01de 6700 // store first calibration point in the 5% slot
whismanoid 35:c9549b5c01de 6701 calibration_05_normValue_0_1[ch] = normValue_0_1;
whismanoid 34:a1993a1ee904 6702 calibration_05_V[ch] = V;
whismanoid 35:c9549b5c01de 6703 updated_05 = true;
whismanoid 34:a1993a1ee904 6704 }
whismanoid 34:a1993a1ee904 6705 else {
whismanoid 35:c9549b5c01de 6706 // store first calibration point in the 95% slot
whismanoid 35:c9549b5c01de 6707 calibration_95_normValue_0_1[ch] = normValue_0_1;
whismanoid 34:a1993a1ee904 6708 calibration_95_V[ch] = V;
whismanoid 35:c9549b5c01de 6709 //~ updated_95 = true;
whismanoid 34:a1993a1ee904 6710 }
whismanoid 34:a1993a1ee904 6711 }
whismanoid 35:c9549b5c01de 6712 }
whismanoid 35:c9549b5c01de 6713 // handle the optional second calibration point
whismanoid 35:c9549b5c01de 6714 if (cmdLine.parse_double(key_can0n, normValue_0_1))
whismanoid 35:c9549b5c01de 6715 {
whismanoid 35:c9549b5c01de 6716 if (cmdLine.parse_double(key_cal0v, V))
whismanoid 35:c9549b5c01de 6717 {
whismanoid 35:c9549b5c01de 6718 if (updated_05) {
whismanoid 35:c9549b5c01de 6719 // we already stored the first point here
whismanoid 35:c9549b5c01de 6720 // calibration_05_normValue_0_1[ch] = normValue_0_1;
whismanoid 35:c9549b5c01de 6721 // calibration_05_V[ch] = V;
whismanoid 35:c9549b5c01de 6722 // store the second point in the other slot
whismanoid 35:c9549b5c01de 6723 calibration_95_normValue_0_1[ch] = normValue_0_1;
whismanoid 35:c9549b5c01de 6724 calibration_95_V[ch] = V;
whismanoid 35:c9549b5c01de 6725 }
whismanoid 35:c9549b5c01de 6726 else {
whismanoid 35:c9549b5c01de 6727 // we already stored the first point here
whismanoid 35:c9549b5c01de 6728 // calibration_95_normValue_0_1[ch] = normValue_0_1;
whismanoid 35:c9549b5c01de 6729 // calibration_95_V[ch] = V;
whismanoid 35:c9549b5c01de 6730 // store the second point in the other slot
whismanoid 35:c9549b5c01de 6731 calibration_05_normValue_0_1[ch] = normValue_0_1;
whismanoid 35:c9549b5c01de 6732 calibration_05_V[ch] = V;
whismanoid 35:c9549b5c01de 6733 }
whismanoid 35:c9549b5c01de 6734 }
whismanoid 35:c9549b5c01de 6735 }
whismanoid 38:fda80a0020d1 6736 // make sure calibration_05_normValue_0_1[ch] < calibration_95_normValue_0_1[ch]
whismanoid 38:fda80a0020d1 6737 if (calibration_05_normValue_0_1[ch] > calibration_95_normValue_0_1[ch])
whismanoid 38:fda80a0020d1 6738 {
whismanoid 38:fda80a0020d1 6739 // swap to make sure calibration_05_normValue_0_1[ch] < calibration_95_normValue_0_1[ch]
whismanoid 38:fda80a0020d1 6740 double n05 = calibration_95_normValue_0_1[ch];
whismanoid 38:fda80a0020d1 6741 double V05 = calibration_95_V[ch];
whismanoid 38:fda80a0020d1 6742 double n95 = calibration_05_normValue_0_1[ch];
whismanoid 38:fda80a0020d1 6743 double V95 = calibration_05_V[ch];
whismanoid 38:fda80a0020d1 6744 calibration_05_normValue_0_1[ch] = n05;
whismanoid 38:fda80a0020d1 6745 calibration_05_V[ch] = V05;
whismanoid 38:fda80a0020d1 6746 calibration_95_normValue_0_1[ch] = n95;
whismanoid 38:fda80a0020d1 6747 calibration_95_V[ch] = V95;
whismanoid 38:fda80a0020d1 6748 }
whismanoid 34:a1993a1ee904 6749 } // end for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6750 }
whismanoid 34:a1993a1ee904 6751 #endif // HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6752 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6753 // %A cal0test=0.5 test calibration functions by calculating the calibrated voltage of specified normValue_0_1
whismanoid 34:a1993a1ee904 6754 // double CalibratedNormValue(int channel_0_5, double raw_normValue_0_1);
whismanoid 34:a1993a1ee904 6755 for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6756 {
whismanoid 34:a1993a1ee904 6757 static char key_cal0test[12] = "cal0test__";
whismanoid 34:a1993a1ee904 6758 sprintf(key_cal0test, "cal%1dtest", ch);
whismanoid 34:a1993a1ee904 6759 double normValue_0_1, Vtest;
whismanoid 34:a1993a1ee904 6760 if (cmdLine.parse_double(key_cal0test, Vtest))
whismanoid 34:a1993a1ee904 6761 {
whismanoid 34:a1993a1ee904 6762 // divide Vtest/adc_full_scale_voltage[0] to get normValue_0_1
whismanoid 34:a1993a1ee904 6763 normValue_0_1 = Vtest/adc_full_scale_voltage[ch];
whismanoid 34:a1993a1ee904 6764 //
whismanoid 34:a1993a1ee904 6765 cmdLine.serial().printf(" CalibratedNormValue(%d, %1.6f) = %1.6f = %1.6fV\r\n",
whismanoid 34:a1993a1ee904 6766 ch,
whismanoid 34:a1993a1ee904 6767 normValue_0_1,
whismanoid 34:a1993a1ee904 6768 CalibratedNormValue(ch, normValue_0_1),
whismanoid 34:a1993a1ee904 6769 (CalibratedNormValue(ch, normValue_0_1) * adc_full_scale_voltage[ch])
whismanoid 34:a1993a1ee904 6770 );
whismanoid 34:a1993a1ee904 6771 //
whismanoid 34:a1993a1ee904 6772 // sweep CalibratedNormValue argument
whismanoid 34:a1993a1ee904 6773 double normValue_0_1_start = -0.05;
whismanoid 34:a1993a1ee904 6774 double normValue_0_1_step = 0.05;
whismanoid 34:a1993a1ee904 6775 double normValue_0_1_end = 1.07;
whismanoid 34:a1993a1ee904 6776 for (normValue_0_1 = normValue_0_1_start;
whismanoid 34:a1993a1ee904 6777 normValue_0_1 <= normValue_0_1_end;
whismanoid 34:a1993a1ee904 6778 normValue_0_1 = normValue_0_1 + normValue_0_1_step)
whismanoid 34:a1993a1ee904 6779 {
whismanoid 34:a1993a1ee904 6780 cmdLine.serial().printf(" CalibratedNormValue(%d, %1.6f) = %1.6f = %1.6fV\r\n",
whismanoid 34:a1993a1ee904 6781 ch,
whismanoid 34:a1993a1ee904 6782 normValue_0_1,
whismanoid 34:a1993a1ee904 6783 CalibratedNormValue(ch, normValue_0_1),
whismanoid 34:a1993a1ee904 6784 (CalibratedNormValue(ch, normValue_0_1) * adc_full_scale_voltage[ch])
whismanoid 34:a1993a1ee904 6785 );
whismanoid 34:a1993a1ee904 6786 }
whismanoid 34:a1993a1ee904 6787 }
whismanoid 34:a1993a1ee904 6788 } // end for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6789 #endif // HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6790 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6791 // %A v0cal=1.000V -- calibrate channel against a known input voltage
whismanoid 34:a1993a1ee904 6792 // double calibration_05_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6793 // double calibration_05_V [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6794 // double calibration_95_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6795 // double calibration_95_V [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6796 for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6797 {
whismanoid 49:359a6b9df7c1 6798 // #350 MAX40108 %A vl#cal / vh#cal / v#copy=
whismanoid 49:359a6b9df7c1 6799 static char key_v0cal[10] = "v0cal__"; // v#cal=Vtest
whismanoid 49:359a6b9df7c1 6800 sprintf(key_v0cal, "v%1dcal", ch); // v#cal=Vtest
whismanoid 49:359a6b9df7c1 6801 static char key_vl0cal[10] = "vl0cal__"; // vl#cal=Vtest
whismanoid 49:359a6b9df7c1 6802 sprintf(key_vl0cal, "vl%1dcal", ch); // vl#cal=Vtest
whismanoid 49:359a6b9df7c1 6803 static char key_vh0cal[10] = "vh0cal__"; // vh#cal=Vtest
whismanoid 49:359a6b9df7c1 6804 sprintf(key_vh0cal, "vh%1dcal", ch); // vh#cal=Vtest
whismanoid 49:359a6b9df7c1 6805 static char key_v0copy[10] = "v0copy__"; // v#copy=srcChannel
whismanoid 49:359a6b9df7c1 6806 sprintf(key_v0copy, "v%1dcopy", ch); // v#copy=srcChannel
whismanoid 34:a1993a1ee904 6807 double Vtest;
whismanoid 49:359a6b9df7c1 6808 int srcChannel = 0;
whismanoid 49:359a6b9df7c1 6809 char calibration_command = '\0';
whismanoid 34:a1993a1ee904 6810 if (cmdLine.parse_double(key_v0cal, Vtest))
whismanoid 34:a1993a1ee904 6811 {
whismanoid 49:359a6b9df7c1 6812 // v#cal=Vtest: update calibration_05 or calibration_95
whismanoid 49:359a6b9df7c1 6813 calibration_command = 'V';
whismanoid 49:359a6b9df7c1 6814 }
whismanoid 49:359a6b9df7c1 6815 else if (cmdLine.parse_double(key_vl0cal, Vtest))
whismanoid 49:359a6b9df7c1 6816 {
whismanoid 49:359a6b9df7c1 6817 // vl#cal=Vtest: update calibration_05
whismanoid 49:359a6b9df7c1 6818 calibration_command = 'L';
whismanoid 49:359a6b9df7c1 6819 }
whismanoid 49:359a6b9df7c1 6820 else if (cmdLine.parse_double(key_vh0cal, Vtest))
whismanoid 49:359a6b9df7c1 6821 {
whismanoid 49:359a6b9df7c1 6822 // vh#cal=Vtest: update calibration_95
whismanoid 49:359a6b9df7c1 6823 calibration_command = 'H';
whismanoid 49:359a6b9df7c1 6824 }
whismanoid 49:359a6b9df7c1 6825 else if (cmdLine.parse_int_dec(key_v0copy, srcChannel))
whismanoid 49:359a6b9df7c1 6826 {
whismanoid 49:359a6b9df7c1 6827 // v#copy=srcChannel
whismanoid 49:359a6b9df7c1 6828 // update calibration_05 and calibration_95 from other channel
whismanoid 49:359a6b9df7c1 6829 calibration_command = '\0';
whismanoid 49:359a6b9df7c1 6830 calibration_05_normValue_0_1[ch] = calibration_05_normValue_0_1[srcChannel];
whismanoid 49:359a6b9df7c1 6831 calibration_05_V[ch] = calibration_05_V[srcChannel];
whismanoid 49:359a6b9df7c1 6832 calibration_95_normValue_0_1[ch] = calibration_95_normValue_0_1[srcChannel];
whismanoid 49:359a6b9df7c1 6833 calibration_95_V[ch] = calibration_95_V[srcChannel];
whismanoid 49:359a6b9df7c1 6834 // print updated calibration values
whismanoid 49:359a6b9df7c1 6835 cmdLine.serial().printf("\r\n");
whismanoid 52:bb09c0f452ec 6836 // %A cl0n= cl0v= ch0n= ch0v= -- unambiguous low and high cal points alternative to cal0n= cal0v= cal0n= cal0v= #354
whismanoid 52:bb09c0f452ec 6837 //cmdLine.serial().printf(" %%A cal%dn=%1.9f cal%dv=%1.9fV cal%dn=%1.9f cal%dv=%1.9fV\r\n",
whismanoid 52:bb09c0f452ec 6838 cmdLine.serial().printf(" %%A cl%dn=%1.9f cl%dv=%1.9fV ch%dn=%1.9f ch%dv=%1.9fV\r\n",
whismanoid 49:359a6b9df7c1 6839 ch, calibration_05_normValue_0_1[ch],
whismanoid 49:359a6b9df7c1 6840 ch, calibration_05_V[ch],
whismanoid 49:359a6b9df7c1 6841 ch, calibration_95_normValue_0_1[ch],
whismanoid 49:359a6b9df7c1 6842 ch, calibration_95_V[ch]
whismanoid 49:359a6b9df7c1 6843 );
whismanoid 49:359a6b9df7c1 6844 }
whismanoid 49:359a6b9df7c1 6845 if (calibration_command != '\0')
whismanoid 49:359a6b9df7c1 6846 {
whismanoid 34:a1993a1ee904 6847 // divide Vtest/adc_full_scale_voltage[0] to get normValue_0_1
whismanoid 34:a1993a1ee904 6848 double Vtest_normValue_0_1 = Vtest/adc_full_scale_voltage[ch];
whismanoid 34:a1993a1ee904 6849 //
whismanoid 34:a1993a1ee904 6850 // %A v0cal=1.000 calibrate one channel by measuring against a known input voltage
whismanoid 34:a1993a1ee904 6851 //
whismanoid 34:a1993a1ee904 6852 cmdLine.serial().printf("\r\n Measuring against input voltage of %1.6fV...", Vtest);
whismanoid 37:3f369235e5bc 6853 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 6854 const int numberOfMeasurements = 16 * Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 6855 #else // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 6856 const int numberOfMeasurements = 16;
whismanoid 37:3f369235e5bc 6857 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 6858 double Sx_measure_normValue_0_1 = 0; // sum of values
whismanoid 34:a1993a1ee904 6859 double Sxx_measure_normValue_0_1 = 0; // sum of the squares of the values
whismanoid 34:a1993a1ee904 6860 for (int count = 0; count < numberOfMeasurements; count++)
whismanoid 34:a1993a1ee904 6861 {
whismanoid 34:a1993a1ee904 6862 double measure_normValue_0_1;
whismanoid 34:a1993a1ee904 6863 switch(ch)
whismanoid 34:a1993a1ee904 6864 {
whismanoid 34:a1993a1ee904 6865 case 0: measure_normValue_0_1 = analogIn0.read(); break;
whismanoid 34:a1993a1ee904 6866 case 1: measure_normValue_0_1 = analogIn1.read(); break;
whismanoid 34:a1993a1ee904 6867 case 2: measure_normValue_0_1 = analogIn2.read(); break;
whismanoid 34:a1993a1ee904 6868 case 3: measure_normValue_0_1 = analogIn3.read(); break;
whismanoid 34:a1993a1ee904 6869 case 4: measure_normValue_0_1 = analogIn4.read(); break;
whismanoid 34:a1993a1ee904 6870 case 5: measure_normValue_0_1 = analogIn5.read(); break;
whismanoid 34:a1993a1ee904 6871 }
whismanoid 34:a1993a1ee904 6872 Sx_measure_normValue_0_1 = Sx_measure_normValue_0_1 + measure_normValue_0_1;
whismanoid 34:a1993a1ee904 6873 Sxx_measure_normValue_0_1 = Sxx_measure_normValue_0_1 + (measure_normValue_0_1 * measure_normValue_0_1);
whismanoid 38:fda80a0020d1 6874 if ((count < 3) || (count >= numberOfMeasurements - 3)) {
whismanoid 38:fda80a0020d1 6875 cmdLine.serial().printf("\r\n raw: %7.6f%% = %1.6fV",
whismanoid 38:fda80a0020d1 6876 measure_normValue_0_1 * 100.0,
whismanoid 38:fda80a0020d1 6877 (measure_normValue_0_1 * adc_full_scale_voltage[ch])
whismanoid 38:fda80a0020d1 6878 );
whismanoid 38:fda80a0020d1 6879 }
whismanoid 34:a1993a1ee904 6880 }
whismanoid 34:a1993a1ee904 6881 cmdLine.serial().printf("\r\n numberOfMeasurements = %d", numberOfMeasurements);
whismanoid 34:a1993a1ee904 6882 cmdLine.serial().printf("\r\n Sx_measure_normValue_0_1 = %1.6f", Sx_measure_normValue_0_1);
whismanoid 34:a1993a1ee904 6883 cmdLine.serial().printf("\r\n Sxx_measure_normValue_0_1 = %1.6f", Sxx_measure_normValue_0_1);
whismanoid 34:a1993a1ee904 6884 //
whismanoid 34:a1993a1ee904 6885 // calculate mean_measure_normValue_0_1 from
whismanoid 34:a1993a1ee904 6886 // Sxx_measure_normValue_0_1, Sx_measure_normValue_0_1, numberOfMeasurements
whismanoid 34:a1993a1ee904 6887 double mean_measure_normValue_0_1 = Sx_measure_normValue_0_1 / numberOfMeasurements;
whismanoid 34:a1993a1ee904 6888 cmdLine.serial().printf("\r\n mean = %7.6f%% = %1.6fV",
whismanoid 34:a1993a1ee904 6889 mean_measure_normValue_0_1 * 100.0,
whismanoid 34:a1993a1ee904 6890 (mean_measure_normValue_0_1 * adc_full_scale_voltage[ch])
whismanoid 34:a1993a1ee904 6891 );
whismanoid 34:a1993a1ee904 6892 //
whismanoid 34:a1993a1ee904 6893 // TODO: calculate sample variance_measure_normValue_0_1 from
whismanoid 34:a1993a1ee904 6894 // Sxx_measure_normValue_0_1, Sx_measure_normValue_0_1, numberOfMeasurements
whismanoid 34:a1993a1ee904 6895 // variance_measure_normValue_0_1 = (Sxx - ( Sx * Sx / nWords) ) / (nWords - 1);
whismanoid 34:a1993a1ee904 6896 double variance_measure_normValue_0_1 = (Sxx_measure_normValue_0_1 - ( Sx_measure_normValue_0_1 * Sx_measure_normValue_0_1 / numberOfMeasurements) ) / (numberOfMeasurements - 1);
whismanoid 34:a1993a1ee904 6897 cmdLine.serial().printf("\r\n variance = %7.6f%% = %1.6fV",
whismanoid 34:a1993a1ee904 6898 variance_measure_normValue_0_1 * 100.0,
whismanoid 34:a1993a1ee904 6899 (variance_measure_normValue_0_1 * adc_full_scale_voltage[ch])
whismanoid 34:a1993a1ee904 6900 );
whismanoid 34:a1993a1ee904 6901 //
whismanoid 34:a1993a1ee904 6902 // calculate sample stddev_measure_normValue_0_1 from
whismanoid 34:a1993a1ee904 6903 // Sxx_measure_normValue_0_1, Sx_measure_normValue_0_1, numberOfMeasurements
whismanoid 34:a1993a1ee904 6904 double stddev_measure_normValue_0_1 = sqrt(variance_measure_normValue_0_1);
whismanoid 34:a1993a1ee904 6905 cmdLine.serial().printf("\r\n stddev = %7.6f%% = %1.6fV",
whismanoid 34:a1993a1ee904 6906 stddev_measure_normValue_0_1 * 100.0,
whismanoid 34:a1993a1ee904 6907 (stddev_measure_normValue_0_1 * adc_full_scale_voltage[ch])
whismanoid 34:a1993a1ee904 6908 );
whismanoid 34:a1993a1ee904 6909 //
whismanoid 34:a1993a1ee904 6910 // Validate the measurements:
whismanoid 34:a1993a1ee904 6911 // is the mean near the expected value?
whismanoid 34:a1993a1ee904 6912 // is the standard deviation not too high?
whismanoid 34:a1993a1ee904 6913 bool isCalibrationValid = true;
whismanoid 34:a1993a1ee904 6914 if ((Vtest_normValue_0_1 - mean_measure_normValue_0_1) > 0.1) {
whismanoid 34:a1993a1ee904 6915 isCalibrationValid = false;
whismanoid 34:a1993a1ee904 6916 cmdLine.serial().printf(" mean value too far from expected.\r\n");
whismanoid 34:a1993a1ee904 6917 }
whismanoid 34:a1993a1ee904 6918 if ((Vtest_normValue_0_1 - mean_measure_normValue_0_1) < -0.1) {
whismanoid 34:a1993a1ee904 6919 isCalibrationValid = false;
whismanoid 34:a1993a1ee904 6920 cmdLine.serial().printf(" mean value too far from expected.\r\n");
whismanoid 34:a1993a1ee904 6921 }
whismanoid 34:a1993a1ee904 6922 if ((stddev_measure_normValue_0_1) > 10) {
whismanoid 34:a1993a1ee904 6923 isCalibrationValid = false;
whismanoid 34:a1993a1ee904 6924 cmdLine.serial().printf(" stddev too high.\r\n");
whismanoid 34:a1993a1ee904 6925 }
whismanoid 34:a1993a1ee904 6926 if (isCalibrationValid)
whismanoid 34:a1993a1ee904 6927 {
whismanoid 34:a1993a1ee904 6928 // update calibration point (mean_measure_normValue_0_1, Vtest)
whismanoid 49:359a6b9df7c1 6929 // #350 MAX40108 %A vl#cal / vh#cal / v#copy=
whismanoid 49:359a6b9df7c1 6930 switch(calibration_command)
whismanoid 49:359a6b9df7c1 6931 {
whismanoid 49:359a6b9df7c1 6932 case 'V': // v#cal=Vtest: update calibration_05 or calibration_95
whismanoid 49:359a6b9df7c1 6933 if (Vtest_normValue_0_1 < 0.5) {
whismanoid 49:359a6b9df7c1 6934 calibration_05_normValue_0_1[ch] = mean_measure_normValue_0_1;
whismanoid 49:359a6b9df7c1 6935 calibration_05_V[ch] = Vtest;
whismanoid 49:359a6b9df7c1 6936 } else {
whismanoid 49:359a6b9df7c1 6937 calibration_95_normValue_0_1[ch] = mean_measure_normValue_0_1;
whismanoid 49:359a6b9df7c1 6938 calibration_95_V[ch] = Vtest;
whismanoid 49:359a6b9df7c1 6939 }
whismanoid 49:359a6b9df7c1 6940 break;
whismanoid 49:359a6b9df7c1 6941 case 'L': // vl#cal=Vtest: update calibration_05
whismanoid 49:359a6b9df7c1 6942 calibration_05_normValue_0_1[ch] = mean_measure_normValue_0_1;
whismanoid 49:359a6b9df7c1 6943 calibration_05_V[ch] = Vtest;
whismanoid 49:359a6b9df7c1 6944 break;
whismanoid 49:359a6b9df7c1 6945 case 'H': // vh#cal=Vtest: update calibration_95
whismanoid 49:359a6b9df7c1 6946 calibration_95_normValue_0_1[ch] = mean_measure_normValue_0_1;
whismanoid 49:359a6b9df7c1 6947 calibration_95_V[ch] = Vtest;
whismanoid 49:359a6b9df7c1 6948 break;
whismanoid 34:a1993a1ee904 6949 }
whismanoid 34:a1993a1ee904 6950 //
whismanoid 34:a1993a1ee904 6951 // print updated calibration values
whismanoid 34:a1993a1ee904 6952 cmdLine.serial().printf("\r\n");
whismanoid 52:bb09c0f452ec 6953 // %A cl0n= cl0v= ch0n= ch0v= -- unambiguous low and high cal points alternative to cal0n= cal0v= cal0n= cal0v= #354
whismanoid 52:bb09c0f452ec 6954 //cmdLine.serial().printf(" %%A cal%dn=%1.9f cal%dv=%1.9fV cal%dn=%1.9f cal%dv=%1.9fV\r\n",
whismanoid 52:bb09c0f452ec 6955 cmdLine.serial().printf(" %%A cl%dn=%1.9f cl%dv=%1.9fV ch%dn=%1.9f ch%dv=%1.9fV\r\n",
whismanoid 34:a1993a1ee904 6956 ch, calibration_05_normValue_0_1[ch],
whismanoid 34:a1993a1ee904 6957 ch, calibration_05_V[ch],
whismanoid 34:a1993a1ee904 6958 ch, calibration_95_normValue_0_1[ch],
whismanoid 34:a1993a1ee904 6959 ch, calibration_95_V[ch]
whismanoid 34:a1993a1ee904 6960 );
whismanoid 34:a1993a1ee904 6961 // print corrected value of mean of measurements (should be close to Vtest)
whismanoid 34:a1993a1ee904 6962 cmdLine.serial().printf(" CalibratedNormValue(%d, %1.6f) = %1.6f = %1.6fV vs %1.6fV\r\n",
whismanoid 34:a1993a1ee904 6963 ch,
whismanoid 34:a1993a1ee904 6964 mean_measure_normValue_0_1,
whismanoid 34:a1993a1ee904 6965 CalibratedNormValue(ch, mean_measure_normValue_0_1),
whismanoid 34:a1993a1ee904 6966 (CalibratedNormValue(ch, mean_measure_normValue_0_1) * adc_full_scale_voltage[ch]),
whismanoid 34:a1993a1ee904 6967 Vtest
whismanoid 34:a1993a1ee904 6968 );
whismanoid 34:a1993a1ee904 6969 } // end if (isCalibrationValid)
whismanoid 34:a1993a1ee904 6970 else {
whismanoid 34:a1993a1ee904 6971 cmdLine.serial().printf("\r\n");
whismanoid 34:a1993a1ee904 6972 cmdLine.serial().printf(" Measurement Error: Calibration will not be updated.\r\n");
whismanoid 34:a1993a1ee904 6973 } // end if (isCalibrationValid)
whismanoid 34:a1993a1ee904 6974 } // end if key_v0cal
whismanoid 34:a1993a1ee904 6975 } // end for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6976 #endif // HAS_Platform_AIN_Calibration
whismanoid 37:3f369235e5bc 6977 // %A -- report analog input voltages
whismanoid 37:3f369235e5bc 6978 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 6979 // #if USE_Platform_AIN_Average -- for (i=0; i<Platform_AIN_Average_N; i++) -- analogInPin.read()
whismanoid 37:3f369235e5bc 6980 #endif // USE_Platform_AIN_Average
whismanoid 15:37c83ec50ea0 6981 #if analogIn4_IS_HIGH_RANGE_OF_analogIn0
whismanoid 15:37c83ec50ea0 6982 // Platform board uses AIN4,AIN5,.. as high range of AIN0,AIN1,..
whismanoid 15:37c83ec50ea0 6983 for (int pinIndex = 0; pinIndex < 2; pinIndex++)
whismanoid 15:37c83ec50ea0 6984 {
whismanoid 15:37c83ec50ea0 6985 int cPinIndex = '0' + pinIndex;
whismanoid 15:37c83ec50ea0 6986 AnalogIn& analogInPin = find_analogInPin(cPinIndex);
whismanoid 15:37c83ec50ea0 6987 float adc_full_scale_voltage = analogInPin_fullScaleVoltage[pinIndex];
whismanoid 37:3f369235e5bc 6988 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 6989 // #if USE_Platform_AIN_Average -- for (i=0; i<Platform_AIN_Average_N; i++) -- analogInPin.read()
whismanoid 37:3f369235e5bc 6990 // float normValue_0_1 = analogInPin.read(); but mean of Platform_AIN_Average_N samples
whismanoid 37:3f369235e5bc 6991 float normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 6992 for (int i = 0; i < Platform_AIN_Average_N; i++) {
whismanoid 37:3f369235e5bc 6993 normValue_0_1 = normValue_0_1 + analogInPin.read();
whismanoid 37:3f369235e5bc 6994 }
whismanoid 37:3f369235e5bc 6995 normValue_0_1 = normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 6996 #else // USE_Platform_AIN_Average
whismanoid 15:37c83ec50ea0 6997 float normValue_0_1 = analogInPin.read();
whismanoid 37:3f369235e5bc 6998 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 6999 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 7000 // apply calibration to normValue_0_1 value
whismanoid 34:a1993a1ee904 7001 normValue_0_1 = CalibratedNormValue(pinIndex, normValue_0_1);
whismanoid 34:a1993a1ee904 7002 #endif // HAS_Platform_AIN_Calibration
whismanoid 15:37c83ec50ea0 7003 //
whismanoid 15:37c83ec50ea0 7004 int pinIndexH = pinIndex + 4;
whismanoid 15:37c83ec50ea0 7005 int cPinIndexH = '0' + pinIndexH;
whismanoid 15:37c83ec50ea0 7006 AnalogIn& analogInPinH = find_analogInPin(cPinIndexH);
whismanoid 15:37c83ec50ea0 7007 float adc_full_scale_voltageH = analogInPin_fullScaleVoltage[pinIndexH];
whismanoid 37:3f369235e5bc 7008 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 7009 // #if USE_Platform_AIN_Average -- for (i=0; i<Platform_AIN_Average_N; i++) -- analogInPin.read()
whismanoid 37:3f369235e5bc 7010 // float normValueH_0_1 = analogInPinH.read(); but mean of Platform_AIN_Average_N samples
whismanoid 37:3f369235e5bc 7011 float normValueH_0_1 = 0;
whismanoid 37:3f369235e5bc 7012 for (int i = 0; i < Platform_AIN_Average_N; i++) {
whismanoid 37:3f369235e5bc 7013 normValueH_0_1 = normValueH_0_1 + analogInPinH.read();
whismanoid 37:3f369235e5bc 7014 }
whismanoid 37:3f369235e5bc 7015 normValueH_0_1 = normValueH_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 7016 #else // USE_Platform_AIN_Average
whismanoid 15:37c83ec50ea0 7017 float normValueH_0_1 = analogInPinH.read();
whismanoid 37:3f369235e5bc 7018 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 7019 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 7020 // apply calibration to normValue_0_1 value
whismanoid 34:a1993a1ee904 7021 normValueH_0_1 = CalibratedNormValue(pinIndex, normValueH_0_1);
whismanoid 34:a1993a1ee904 7022 #endif // HAS_Platform_AIN_Calibration
whismanoid 15:37c83ec50ea0 7023 //
whismanoid 37:3f369235e5bc 7024 cmdLine.serial().printf("A%c = %7.3f%% = %1.3fV high range A%c = %7.3f%% = %1.3fV \r\n",
whismanoid 15:37c83ec50ea0 7025 cPinIndex,
whismanoid 15:37c83ec50ea0 7026 normValue_0_1 * 100.0,
whismanoid 15:37c83ec50ea0 7027 normValue_0_1 * adc_full_scale_voltage,
whismanoid 15:37c83ec50ea0 7028 cPinIndexH,
whismanoid 15:37c83ec50ea0 7029 normValueH_0_1 * 100.0,
whismanoid 15:37c83ec50ea0 7030 normValueH_0_1 * adc_full_scale_voltageH
whismanoid 15:37c83ec50ea0 7031 );
whismanoid 15:37c83ec50ea0 7032 }
whismanoid 15:37c83ec50ea0 7033 for (int pinIndex = 2; pinIndex < 4; pinIndex++)
whismanoid 15:37c83ec50ea0 7034 {
whismanoid 15:37c83ec50ea0 7035 int cPinIndex = '0' + pinIndex;
whismanoid 15:37c83ec50ea0 7036 AnalogIn& analogInPin = find_analogInPin(cPinIndex);
whismanoid 15:37c83ec50ea0 7037 float adc_full_scale_voltage = analogInPin_fullScaleVoltage[pinIndex];
whismanoid 37:3f369235e5bc 7038 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 7039 // #if USE_Platform_AIN_Average -- for (i=0; i<Platform_AIN_Average_N; i++) -- analogInPin.read()
whismanoid 37:3f369235e5bc 7040 // float normValue_0_1 = analogInPin.read(); but mean of Platform_AIN_Average_N samples
whismanoid 37:3f369235e5bc 7041 float normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 7042 for (int i = 0; i < Platform_AIN_Average_N; i++) {
whismanoid 37:3f369235e5bc 7043 normValue_0_1 = normValue_0_1 + analogInPin.read();
whismanoid 37:3f369235e5bc 7044 }
whismanoid 37:3f369235e5bc 7045 normValue_0_1 = normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 7046 #else // USE_Platform_AIN_Average
whismanoid 15:37c83ec50ea0 7047 float normValue_0_1 = analogInPin.read();
whismanoid 37:3f369235e5bc 7048 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 7049 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 7050 // apply calibration to normValue_0_1 value
whismanoid 34:a1993a1ee904 7051 normValue_0_1 = CalibratedNormValue(pinIndex, normValue_0_1);
whismanoid 34:a1993a1ee904 7052 #endif // HAS_Platform_AIN_Calibration
whismanoid 15:37c83ec50ea0 7053 //
whismanoid 37:3f369235e5bc 7054 cmdLine.serial().printf("A%c = %7.3f%% = %1.3fV\r\n",
whismanoid 15:37c83ec50ea0 7055 cPinIndex,
whismanoid 15:37c83ec50ea0 7056 normValue_0_1 * 100.0,
whismanoid 15:37c83ec50ea0 7057 normValue_0_1 * adc_full_scale_voltage
whismanoid 15:37c83ec50ea0 7058 );
whismanoid 15:37c83ec50ea0 7059 }
whismanoid 15:37c83ec50ea0 7060 #else // analogIn4_IS_HIGH_RANGE_OF_analogIn0
whismanoid 15:37c83ec50ea0 7061 // Platform board uses simple analog inputs
whismanoid 15:37c83ec50ea0 7062 // assume standard Arduino analog inputs A0-A5
whismanoid 15:37c83ec50ea0 7063 for (int pinIndex = 0; pinIndex < 6; pinIndex++)
whismanoid 15:37c83ec50ea0 7064 {
whismanoid 15:37c83ec50ea0 7065 int cPinIndex = '0' + pinIndex;
whismanoid 15:37c83ec50ea0 7066 AnalogIn& analogInPin = find_analogInPin(cPinIndex);
whismanoid 15:37c83ec50ea0 7067 float adc_full_scale_voltage = analogInPin_fullScaleVoltage[pinIndex];
whismanoid 37:3f369235e5bc 7068 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 7069 // #if USE_Platform_AIN_Average -- for (i=0; i<Platform_AIN_Average_N; i++) -- analogInPin.read()
whismanoid 37:3f369235e5bc 7070 // float normValue_0_1 = analogInPin.read(); but mean of Platform_AIN_Average_N samples
whismanoid 37:3f369235e5bc 7071 float normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 7072 for (int i = 0; i < Platform_AIN_Average_N; i++) {
whismanoid 37:3f369235e5bc 7073 normValue_0_1 = normValue_0_1 + analogInPin.read();
whismanoid 37:3f369235e5bc 7074 }
whismanoid 37:3f369235e5bc 7075 normValue_0_1 = normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 7076 #else // USE_Platform_AIN_Average
whismanoid 15:37c83ec50ea0 7077 float normValue_0_1 = analogInPin.read();
whismanoid 37:3f369235e5bc 7078 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 7079 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 7080 // apply calibration to normValue_0_1 value
whismanoid 34:a1993a1ee904 7081 normValue_0_1 = CalibratedNormValue(pinIndex, normValue_0_1);
whismanoid 34:a1993a1ee904 7082 #endif // HAS_Platform_AIN_Calibration
whismanoid 15:37c83ec50ea0 7083 //
whismanoid 37:3f369235e5bc 7084 cmdLine.serial().printf("A%c = %7.3f%% = %1.3fV\r\n",
whismanoid 15:37c83ec50ea0 7085 cPinIndex,
whismanoid 15:37c83ec50ea0 7086 normValue_0_1 * 100.0,
whismanoid 15:37c83ec50ea0 7087 normValue_0_1 * adc_full_scale_voltage
whismanoid 15:37c83ec50ea0 7088 );
whismanoid 15:37c83ec50ea0 7089 }
whismanoid 15:37c83ec50ea0 7090 #endif // analogIn4_IS_HIGH_RANGE_OF_analogIn0
whismanoid 15:37c83ec50ea0 7091 }
whismanoid 15:37c83ec50ea0 7092 break;
whismanoid 15:37c83ec50ea0 7093 #endif
whismanoid 15:37c83ec50ea0 7094 //
whismanoid 15:37c83ec50ea0 7095 #if HAS_SPI2_MAX541
whismanoid 15:37c83ec50ea0 7096 case 'D': case 'd':
whismanoid 15:37c83ec50ea0 7097 {
whismanoid 15:37c83ec50ea0 7098 // %D -- DAC output MAX541 (SPI2) -- need cmdLine.parse_float(voltageV)
whismanoid 15:37c83ec50ea0 7099 // MAX541 max541(spi2_max541, spi2_max541_cs);
whismanoid 15:37c83ec50ea0 7100 float voltageV = max541.Get_Voltage();
whismanoid 15:37c83ec50ea0 7101 // if (cmdLine[2] == '+') {
whismanoid 15:37c83ec50ea0 7102 // // %D+
whismanoid 15:37c83ec50ea0 7103 // voltageV = voltageV * 1.25f;
whismanoid 15:37c83ec50ea0 7104 // if (voltageV >= max541.VRef) voltageV = max541.VRef;
whismanoid 15:37c83ec50ea0 7105 // SelfTest_MAX541_Voltage(cmdLine, max541, voltageV);
whismanoid 15:37c83ec50ea0 7106 // }
whismanoid 15:37c83ec50ea0 7107 // else if (cmdLine[2] == '-') {
whismanoid 15:37c83ec50ea0 7108 // // %D-
whismanoid 15:37c83ec50ea0 7109 // voltageV = voltageV * 0.75f;
whismanoid 15:37c83ec50ea0 7110 // if (voltageV < 0.1f) voltageV = 0.1f;
whismanoid 15:37c83ec50ea0 7111 // SelfTest_MAX541_Voltage(cmdLine, max541, voltageV);
whismanoid 15:37c83ec50ea0 7112 // }
whismanoid 15:37c83ec50ea0 7113 if (cmdLine.parse_float("V", voltageV))
whismanoid 15:37c83ec50ea0 7114 {
whismanoid 15:37c83ec50ea0 7115 // %D V=1.234 -- set voltage
whismanoid 15:37c83ec50ea0 7116 max541.Set_Voltage(voltageV);
whismanoid 15:37c83ec50ea0 7117 }
whismanoid 15:37c83ec50ea0 7118 else if (cmdLine.parse_float("TEST", voltageV))
whismanoid 15:37c83ec50ea0 7119 {
whismanoid 15:37c83ec50ea0 7120 // %D TEST=1.234 -- set voltage and compare with AIN0
whismanoid 15:37c83ec50ea0 7121 SelfTest_MAX541_Voltage(cmdLine, max541, voltageV);
whismanoid 15:37c83ec50ea0 7122 }
whismanoid 15:37c83ec50ea0 7123 else if (cmdLine.parse_float("CAL", voltageV))
whismanoid 15:37c83ec50ea0 7124 {
whismanoid 15:37c83ec50ea0 7125 // %D CAL=1.234 -- calibrate VRef and compare with AIN0
whismanoid 15:37c83ec50ea0 7126
whismanoid 15:37c83ec50ea0 7127 max541.Set_Code(0x8000); // we don't know the fullscale voltage yet, so set code to midscale
whismanoid 15:37c83ec50ea0 7128 double max541_midscale_V = analogInPin_fullScaleVoltage[4] * analogIn4.read(); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 15:37c83ec50ea0 7129 const int average_count = 100;
whismanoid 15:37c83ec50ea0 7130 const double average_K = 0.25;
whismanoid 15:37c83ec50ea0 7131 for (int count = 0; count < average_count; count++) {
whismanoid 15:37c83ec50ea0 7132 double measurement_V = analogInPin_fullScaleVoltage[4] * analogIn4.read(); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 15:37c83ec50ea0 7133 max541_midscale_V = ((1 - average_K) * max541_midscale_V) + (average_K * measurement_V);
whismanoid 15:37c83ec50ea0 7134 }
whismanoid 15:37c83ec50ea0 7135 max541.VRef = 2.0 * max541_midscale_V;
whismanoid 15:37c83ec50ea0 7136 cmdLine.serial().printf(
whismanoid 15:37c83ec50ea0 7137 "\r\n MAX541 midscale = %1.3fV, so fullscale = %1.3fV",
whismanoid 15:37c83ec50ea0 7138 max541_midscale_V, max541.VRef);
whismanoid 15:37c83ec50ea0 7139 // Detect whether MAX541 is really connected to MAX32625MBED.AIN0/AIN4
whismanoid 15:37c83ec50ea0 7140 voltageV = 1.0f;
whismanoid 15:37c83ec50ea0 7141 SelfTest_MAX541_Voltage(cmdLine, max541, voltageV);
whismanoid 15:37c83ec50ea0 7142 }
whismanoid 15:37c83ec50ea0 7143 else {
whismanoid 15:37c83ec50ea0 7144 // %D -- print MAX541 DAC status
whismanoid 15:37c83ec50ea0 7145 cmdLine.serial().printf("MAX541 code=0x%4.4x = %1.3fV VRef=%1.3fV\r\n",
whismanoid 15:37c83ec50ea0 7146 max541.Get_Code(), max541.Get_Voltage(), max541.VRef);
whismanoid 15:37c83ec50ea0 7147 }
whismanoid 15:37c83ec50ea0 7148 }
whismanoid 15:37c83ec50ea0 7149 break;
whismanoid 15:37c83ec50ea0 7150 #endif
whismanoid 15:37c83ec50ea0 7151
whismanoid 15:37c83ec50ea0 7152 //
whismanoid 15:37c83ec50ea0 7153 #if HAS_I2C // SUPPORT_I2C
whismanoid 15:37c83ec50ea0 7154 case 'I': case 'i':
whismanoid 15:37c83ec50ea0 7155 // %I... -- I2C diagnostics
whismanoid 15:37c83ec50ea0 7156 // %IP -- I2C probe
whismanoid 15:37c83ec50ea0 7157 // %IC scl=100khz ADDR=? -- I2C configure
whismanoid 15:37c83ec50ea0 7158 // %IW byte byte ... byte RD=? ADDR=0x -- write
whismanoid 15:37c83ec50ea0 7159 // %IR ADDR=? RD=? -- read
whismanoid 15:37c83ec50ea0 7160 // %I^ cmd=? -- i2c_smbus_read_word_data
whismanoid 15:37c83ec50ea0 7161 // get next character
whismanoid 15:37c83ec50ea0 7162 // TODO: parse cmdLine arg (ADDR=\d+)? --> g_I2C_deviceAddress7
whismanoid 15:37c83ec50ea0 7163 cmdLine.parse_byte_hex("ADDR", g_I2C_deviceAddress7);
whismanoid 15:37c83ec50ea0 7164 // TODO: parse cmdLine arg (RD=\d)? --> g_I2C_read_count
whismanoid 15:37c83ec50ea0 7165 g_I2C_read_count = 0; // read count must be reset every command
whismanoid 15:37c83ec50ea0 7166 cmdLine.parse_byte_dec("RD", g_I2C_read_count);
whismanoid 15:37c83ec50ea0 7167 // TODO: parse cmdLine arg (CMD=\d)? --> g_I2C_command_regAddress
whismanoid 15:37c83ec50ea0 7168 cmdLine.parse_byte_hex("CMD", g_I2C_command_regAddress);
whismanoid 15:37c83ec50ea0 7169 switch (cmdLine[2])
whismanoid 15:37c83ec50ea0 7170 {
whismanoid 15:37c83ec50ea0 7171 case 'P': case 'p':
whismanoid 15:37c83ec50ea0 7172 {
whismanoid 15:37c83ec50ea0 7173 // %IP -- I2C probe
whismanoid 15:37c83ec50ea0 7174 HuntAttachedI2CDevices(cmdLine, 0x03, 0x77);
whismanoid 15:37c83ec50ea0 7175 }
whismanoid 15:37c83ec50ea0 7176 break;
whismanoid 15:37c83ec50ea0 7177 case 'C': case 'c':
whismanoid 15:37c83ec50ea0 7178 {
whismanoid 15:37c83ec50ea0 7179 bool isUpdatedI2CConfig = false;
whismanoid 15:37c83ec50ea0 7180 // %IC scl=100khz ADDR=? -- I2C configure
whismanoid 15:37c83ec50ea0 7181 // parse cmdLine arg (SCL=\d+(kHZ|MHZ)?)? --> g_I2C_SCL_Hz
whismanoid 15:37c83ec50ea0 7182 if (cmdLine.parse_frequency_Hz("SCL", g_I2C_SCL_Hz))
whismanoid 15:37c83ec50ea0 7183 {
whismanoid 15:37c83ec50ea0 7184 isUpdatedI2CConfig = true;
whismanoid 15:37c83ec50ea0 7185 // TODO1: validate g_I2C_SCL_Hz against system clock frequency F_CPU
whismanoid 15:37c83ec50ea0 7186 if (g_I2C_SCL_Hz > limit_max_I2C_SCL_Hz)
whismanoid 15:37c83ec50ea0 7187 {
whismanoid 15:37c83ec50ea0 7188 g_I2C_SCL_Hz = limit_max_I2C_SCL_Hz;
whismanoid 15:37c83ec50ea0 7189 }
whismanoid 15:37c83ec50ea0 7190 if (g_I2C_SCL_Hz < limit_min_I2C_SCL_Hz)
whismanoid 15:37c83ec50ea0 7191 {
whismanoid 15:37c83ec50ea0 7192 g_I2C_SCL_Hz = limit_min_I2C_SCL_Hz;
whismanoid 15:37c83ec50ea0 7193 }
whismanoid 15:37c83ec50ea0 7194 }
whismanoid 15:37c83ec50ea0 7195 if (isUpdatedI2CConfig)
whismanoid 15:37c83ec50ea0 7196 {
whismanoid 15:37c83ec50ea0 7197 // declare in narrower scope: MAX32625MBED I2C i2cMaster(...)
whismanoid 15:37c83ec50ea0 7198 I2C i2cMaster(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 15:37c83ec50ea0 7199 i2cMaster.frequency(g_I2C_SCL_Hz);
whismanoid 15:37c83ec50ea0 7200 i2cMaster.start();
whismanoid 15:37c83ec50ea0 7201 i2cMaster.stop();
whismanoid 15:37c83ec50ea0 7202 i2cMaster.frequency(g_I2C_SCL_Hz);
whismanoid 15:37c83ec50ea0 7203 cmdLine.serial().printf(
whismanoid 15:37c83ec50ea0 7204 "\r\n %%IC ADDR=0x%2.2x=(0x%2.2x>>1) SCL=%d=%1.3fkHz -- I2C config",
whismanoid 15:37c83ec50ea0 7205 g_I2C_deviceAddress7, (g_I2C_deviceAddress7 << 1), g_I2C_SCL_Hz,
whismanoid 15:37c83ec50ea0 7206 (g_I2C_SCL_Hz / 1000.));
whismanoid 15:37c83ec50ea0 7207 i2cMaster.start();
whismanoid 15:37c83ec50ea0 7208 i2cMaster.stop();
whismanoid 15:37c83ec50ea0 7209 }
whismanoid 15:37c83ec50ea0 7210 }
whismanoid 15:37c83ec50ea0 7211 break;
whismanoid 15:37c83ec50ea0 7212 case 'W': case 'w':
whismanoid 15:37c83ec50ea0 7213 {
whismanoid 15:37c83ec50ea0 7214 // declare in narrower scope: MAX32625MBED I2C i2cMaster(...)
whismanoid 15:37c83ec50ea0 7215 I2C i2cMaster(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 15:37c83ec50ea0 7216 i2cMaster.frequency(g_I2C_SCL_Hz);
whismanoid 15:37c83ec50ea0 7217 // %IW byte byte ... byte RD=? ADDR=0x -- write
whismanoid 15:37c83ec50ea0 7218 // parse cmdLine byte list --> int byteCount; int mosiData[MAX_SPI_BYTE_COUNT];
whismanoid 15:37c83ec50ea0 7219 #define MAX_I2C_BYTE_COUNT 32
whismanoid 15:37c83ec50ea0 7220 size_t byteCount = byteCount;
whismanoid 15:37c83ec50ea0 7221 static char mosiData[MAX_I2C_BYTE_COUNT];
whismanoid 15:37c83ec50ea0 7222 static char misoData[MAX_I2C_BYTE_COUNT];
whismanoid 15:37c83ec50ea0 7223 if (cmdLine.parse_byteCount_byteList_hex(byteCount, mosiData,
whismanoid 15:37c83ec50ea0 7224 MAX_I2C_BYTE_COUNT))
whismanoid 15:37c83ec50ea0 7225 {
whismanoid 15:37c83ec50ea0 7226 // hex dump mosiData[0..byteCount-1]
whismanoid 15:37c83ec50ea0 7227 cmdLine.serial().printf(
whismanoid 15:37c83ec50ea0 7228 "\r\nADDR=0x%2.2x=(0x%2.2x>>1) byteCount:%d RD=%d\r\nI2C MOSI->",
whismanoid 15:37c83ec50ea0 7229 g_I2C_deviceAddress7,
whismanoid 15:37c83ec50ea0 7230 (g_I2C_deviceAddress7 << 1), byteCount, g_I2C_read_count);
whismanoid 15:37c83ec50ea0 7231 for (unsigned int byteIndex = 0; byteIndex < byteCount; byteIndex++)
whismanoid 15:37c83ec50ea0 7232 {
whismanoid 15:37c83ec50ea0 7233 cmdLine.serial().printf(" 0x%2.2X", mosiData[byteIndex]);
whismanoid 15:37c83ec50ea0 7234 }
whismanoid 15:37c83ec50ea0 7235 //
whismanoid 15:37c83ec50ea0 7236 // TODO: i2c transfer
whismanoid 15:37c83ec50ea0 7237 //const int addr7bit = 0x48; // 7 bit I2C address
whismanoid 15:37c83ec50ea0 7238 //const int addr8bit = 0x48 << 1; // 8bit I2C address, 0x90
whismanoid 15:37c83ec50ea0 7239 // /* int */ i2cMaster.read (int addr8bit, char *data, int length, bool repeated=false) // Read from an I2C slave.
whismanoid 15:37c83ec50ea0 7240 // /* int */ i2cMaster.read (int ack) // Read a single byte from the I2C bus.
whismanoid 15:37c83ec50ea0 7241 // /* int */ i2cMaster.write (int addr8bit, const char *data, int length, bool repeated=false) // Write to an I2C slave.
whismanoid 15:37c83ec50ea0 7242 // /* int */ i2cMaster.write (int data) // Write single byte out on the I2C bus.
whismanoid 15:37c83ec50ea0 7243 // /* void */ i2cMaster.start (void) // Creates a start condition on the I2C bus.
whismanoid 15:37c83ec50ea0 7244 // /* void */ i2cMaster.stop (void) // Creates a stop condition on the I2C bus.
whismanoid 15:37c83ec50ea0 7245 // /* int */ i2cMaster.transfer (int addr8bit, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t &callback, int event=I2C_EVENT_TRANSFER_COMPLETE, bool repeated=false) // Start nonblocking I2C transfer. More...
whismanoid 15:37c83ec50ea0 7246 // /* void */ i2cMaster.abort_transfer () // Abort the ongoing I2C transfer. More...
whismanoid 15:37c83ec50ea0 7247 const int addr8bit = g_I2C_deviceAddress7 << 1; // 8bit I2C address, 0x90
whismanoid 15:37c83ec50ea0 7248 unsigned int misoLength = 0;
whismanoid 15:37c83ec50ea0 7249 bool repeated = (g_I2C_read_count > 0);
whismanoid 15:37c83ec50ea0 7250 //
whismanoid 15:37c83ec50ea0 7251 int writeStatus = i2cMaster.write (addr8bit, mosiData, byteCount, repeated);
whismanoid 15:37c83ec50ea0 7252 switch (writeStatus)
whismanoid 15:37c83ec50ea0 7253 {
whismanoid 15:37c83ec50ea0 7254 case 0: cmdLine.serial().printf(" ack "); break;
whismanoid 15:37c83ec50ea0 7255 case 1: cmdLine.serial().printf(" nack "); break;
whismanoid 15:37c83ec50ea0 7256 default: cmdLine.serial().printf(" {writeStatus 0x%2.2X} ",
whismanoid 15:37c83ec50ea0 7257 writeStatus);
whismanoid 15:37c83ec50ea0 7258 }
whismanoid 15:37c83ec50ea0 7259 if (repeated)
whismanoid 15:37c83ec50ea0 7260 {
whismanoid 15:37c83ec50ea0 7261 int readStatus =
whismanoid 15:37c83ec50ea0 7262 i2cMaster.read (addr8bit, misoData, g_I2C_read_count, false);
whismanoid 15:37c83ec50ea0 7263 switch (readStatus)
whismanoid 15:37c83ec50ea0 7264 {
whismanoid 15:37c83ec50ea0 7265 case 1: cmdLine.serial().printf(" nack "); break;
whismanoid 15:37c83ec50ea0 7266 case 0: cmdLine.serial().printf(" ack "); break;
whismanoid 15:37c83ec50ea0 7267 default: cmdLine.serial().printf(" {readStatus 0x%2.2X} ",
whismanoid 15:37c83ec50ea0 7268 readStatus);
whismanoid 15:37c83ec50ea0 7269 }
whismanoid 15:37c83ec50ea0 7270 }
whismanoid 15:37c83ec50ea0 7271 //
whismanoid 15:37c83ec50ea0 7272 if (misoLength > 0)
whismanoid 15:37c83ec50ea0 7273 {
whismanoid 15:37c83ec50ea0 7274 // hex dump misoData[0..byteCount-1]
whismanoid 15:37c83ec50ea0 7275 cmdLine.serial().printf(" MISO<-");
whismanoid 15:37c83ec50ea0 7276 for (unsigned int byteIndex = 0; byteIndex < g_I2C_read_count;
whismanoid 15:37c83ec50ea0 7277 byteIndex++)
whismanoid 15:37c83ec50ea0 7278 {
whismanoid 15:37c83ec50ea0 7279 cmdLine.serial().printf(" 0x%2.2X", misoData[byteIndex]);
whismanoid 15:37c83ec50ea0 7280 }
whismanoid 15:37c83ec50ea0 7281 }
whismanoid 15:37c83ec50ea0 7282 cmdLine.serial().printf(" ");
whismanoid 15:37c83ec50ea0 7283 }
whismanoid 15:37c83ec50ea0 7284 }
whismanoid 15:37c83ec50ea0 7285 break;
whismanoid 15:37c83ec50ea0 7286 case 'R': case 'r':
whismanoid 15:37c83ec50ea0 7287 {
whismanoid 15:37c83ec50ea0 7288 // declare in narrower scope: MAX32625MBED I2C i2cMaster(...)
whismanoid 15:37c83ec50ea0 7289 I2C i2cMaster(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 15:37c83ec50ea0 7290 i2cMaster.frequency(g_I2C_SCL_Hz);
whismanoid 15:37c83ec50ea0 7291 // %IR ADDR=? RD=? -- read
whismanoid 15:37c83ec50ea0 7292 // TODO: i2c transfer
whismanoid 15:37c83ec50ea0 7293 //const int addr7bit = 0x48; // 7 bit I2C address
whismanoid 15:37c83ec50ea0 7294 //const int addr8bit = 0x48 << 1; // 8bit I2C address, 0x90
whismanoid 15:37c83ec50ea0 7295 // /* int */ i2cMaster.read (int addr8bit, char *data, int length, bool repeated=false) // Read from an I2C slave.
whismanoid 15:37c83ec50ea0 7296 // /* int */ i2cMaster.read (int ack) // Read a single byte from the I2C bus.
whismanoid 15:37c83ec50ea0 7297 // /* int */ i2cMaster.write (int addr8bit, const char *data, int length, bool repeated=false) // Write to an I2C slave.
whismanoid 15:37c83ec50ea0 7298 // /* int */ i2cMaster.write (int data) // Write single byte out on the I2C bus.
whismanoid 15:37c83ec50ea0 7299 // /* void */ i2cMaster.start (void) // Creates a start condition on the I2C bus.
whismanoid 15:37c83ec50ea0 7300 // /* void */ i2cMaster.stop (void) // Creates a stop condition on the I2C bus.
whismanoid 15:37c83ec50ea0 7301 // /* int */ i2cMaster.transfer (int addr8bit, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t &callback, int event=I2C_EVENT_TRANSFER_COMPLETE, bool repeated=false) // Start nonblocking I2C transfer. More...
whismanoid 15:37c83ec50ea0 7302 // /* void */ i2cMaster.abort_transfer () // Abort the ongoing I2C transfer. More...
whismanoid 15:37c83ec50ea0 7303 }
whismanoid 15:37c83ec50ea0 7304 break;
whismanoid 15:37c83ec50ea0 7305 case '^':
whismanoid 15:37c83ec50ea0 7306 {
whismanoid 15:37c83ec50ea0 7307 // declare in narrower scope: MAX32625MBED I2C i2cMaster(...)
whismanoid 15:37c83ec50ea0 7308 I2C i2cMaster(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 15:37c83ec50ea0 7309 i2cMaster.frequency(g_I2C_SCL_Hz);
whismanoid 15:37c83ec50ea0 7310 // %I^ cmd=? -- i2c_smbus_read_word_data
whismanoid 15:37c83ec50ea0 7311 // TODO: i2c transfer
whismanoid 15:37c83ec50ea0 7312 //const int addr7bit = 0x48; // 7 bit I2C address
whismanoid 15:37c83ec50ea0 7313 //const int addr8bit = 0x48 << 1; // 8bit I2C address, 0x90
whismanoid 15:37c83ec50ea0 7314 // /* int */ i2cMaster.read (int addr8bit, char *data, int length, bool repeated=false) // Read from an I2C slave.
whismanoid 15:37c83ec50ea0 7315 // /* int */ i2cMaster.read (int ack) // Read a single byte from the I2C bus.
whismanoid 15:37c83ec50ea0 7316 // /* int */ i2cMaster.write (int addr8bit, const char *data, int length, bool repeated=false) // Write to an I2C slave.
whismanoid 15:37c83ec50ea0 7317 // /* int */ i2cMaster.write (int data) // Write single byte out on the I2C bus.
whismanoid 15:37c83ec50ea0 7318 // /* void */ i2cMaster.start (void) // Creates a start condition on the I2C bus.
whismanoid 15:37c83ec50ea0 7319 // /* void */ i2cMaster.stop (void) // Creates a stop condition on the I2C bus.
whismanoid 15:37c83ec50ea0 7320 // /* int */ i2cMaster.transfer (int addr8bit, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t &callback, int event=I2C_EVENT_TRANSFER_COMPLETE, bool repeated=false) // Start nonblocking I2C transfer. More...
whismanoid 15:37c83ec50ea0 7321 // /* void */ i2cMaster.abort_transfer () // Abort the ongoing I2C transfer. More...
whismanoid 15:37c83ec50ea0 7322 }
whismanoid 15:37c83ec50ea0 7323 break;
whismanoid 15:37c83ec50ea0 7324 } // switch(cmdLine[2])
whismanoid 15:37c83ec50ea0 7325 break;
whismanoid 15:37c83ec50ea0 7326 #endif
whismanoid 15:37c83ec50ea0 7327 //
whismanoid 15:37c83ec50ea0 7328 #if HAS_SPI // SUPPORT_SPI
whismanoid 15:37c83ec50ea0 7329 case 'S': case 's':
whismanoid 15:37c83ec50ea0 7330 {
whismanoid 15:37c83ec50ea0 7331 // %S... -- SPI diagnostics
whismanoid 15:37c83ec50ea0 7332 // %SC sclk=1Mhz -- SPI configure
whismanoid 15:37c83ec50ea0 7333 // %SW -- write (write and read)
whismanoid 15:37c83ec50ea0 7334 // %SR -- read (alias for %SW because SPI always write and read)
whismanoid 15:37c83ec50ea0 7335 //
whismanoid 15:37c83ec50ea0 7336 // Process arguments SCLK=\d+(kHZ|MHZ) CPOL=\d CPHA=\d
whismanoid 15:37c83ec50ea0 7337 bool isUpdatedSPIConfig = false;
whismanoid 15:37c83ec50ea0 7338 // parse cmdLine arg (CPOL=\d)? --> g_SPI_dataMode | SPI_MODE2
whismanoid 15:37c83ec50ea0 7339 // parse cmdLine arg (CPHA=\d)? --> g_SPI_dataMode | SPI_MODE1
whismanoid 15:37c83ec50ea0 7340 if (cmdLine.parse_flag("CPOL", g_SPI_dataMode, SPI_MODE2))
whismanoid 15:37c83ec50ea0 7341 {
whismanoid 15:37c83ec50ea0 7342 isUpdatedSPIConfig = true;
whismanoid 15:37c83ec50ea0 7343 }
whismanoid 15:37c83ec50ea0 7344 if (cmdLine.parse_flag("CPHA", g_SPI_dataMode, SPI_MODE1))
whismanoid 15:37c83ec50ea0 7345 {
whismanoid 15:37c83ec50ea0 7346 isUpdatedSPIConfig = true;
whismanoid 15:37c83ec50ea0 7347 }
whismanoid 15:37c83ec50ea0 7348 if (cmdLine.parse_flag("CS", g_SPI_cs_state, 1))
whismanoid 15:37c83ec50ea0 7349 {
whismanoid 15:37c83ec50ea0 7350 isUpdatedSPIConfig = true;
whismanoid 15:37c83ec50ea0 7351 }
whismanoid 15:37c83ec50ea0 7352 // parse cmdLine arg (SCLK=\d+(kHZ|MHZ)?)? --> g_SPI_SCLK_Hz
whismanoid 15:37c83ec50ea0 7353 if (cmdLine.parse_frequency_Hz("SCLK", g_SPI_SCLK_Hz))
whismanoid 15:37c83ec50ea0 7354 {
whismanoid 15:37c83ec50ea0 7355 isUpdatedSPIConfig = true;
whismanoid 15:37c83ec50ea0 7356 // TODO1: validate g_SPI_SCLK_Hz against system clock frequency F_CPU
whismanoid 15:37c83ec50ea0 7357 if (g_SPI_SCLK_Hz > limit_max_SPI_SCLK_Hz)
whismanoid 15:37c83ec50ea0 7358 {
whismanoid 15:37c83ec50ea0 7359 g_SPI_SCLK_Hz = limit_max_SPI_SCLK_Hz;
whismanoid 15:37c83ec50ea0 7360 }
whismanoid 15:37c83ec50ea0 7361 if (g_SPI_SCLK_Hz < limit_min_SPI_SCLK_Hz)
whismanoid 15:37c83ec50ea0 7362 {
whismanoid 15:37c83ec50ea0 7363 g_SPI_SCLK_Hz = limit_min_SPI_SCLK_Hz;
whismanoid 15:37c83ec50ea0 7364 }
whismanoid 15:37c83ec50ea0 7365 }
whismanoid 15:37c83ec50ea0 7366 // Update SPI configuration
whismanoid 15:37c83ec50ea0 7367 if (isUpdatedSPIConfig)
whismanoid 15:37c83ec50ea0 7368 {
whismanoid 15:37c83ec50ea0 7369 // %SC sclk=1Mhz -- SPI configure
whismanoid 15:37c83ec50ea0 7370 spi_cs = g_SPI_cs_state;
whismanoid 15:37c83ec50ea0 7371 spi.format(8,g_SPI_dataMode); // int bits_must_be_8, int mode=0_3 CPOL=0,CPHA=0
whismanoid 15:37c83ec50ea0 7372 #if APPLICATION_MAX5715
whismanoid 15:37c83ec50ea0 7373 g_MAX5715_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 15:37c83ec50ea0 7374 #elif APPLICATION_MAX11131
whismanoid 15:37c83ec50ea0 7375 g_MAX11131_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 15:37c83ec50ea0 7376 #elif APPLICATION_MAX5171
whismanoid 15:37c83ec50ea0 7377 g_MAX5171_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 15:37c83ec50ea0 7378 #elif APPLICATION_MAX11410
whismanoid 15:37c83ec50ea0 7379 g_MAX11410_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 15:37c83ec50ea0 7380 #elif APPLICATION_MAX12345
whismanoid 15:37c83ec50ea0 7381 g_MAX12345_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 15:37c83ec50ea0 7382 #else
whismanoid 15:37c83ec50ea0 7383 spi.frequency(g_SPI_SCLK_Hz); // int SCLK_Hz=1000000 = 1MHz (initial default)
whismanoid 15:37c83ec50ea0 7384 #endif
whismanoid 15:37c83ec50ea0 7385 //
whismanoid 15:37c83ec50ea0 7386 double ideal_divisor = ((double)SystemCoreClock) / g_SPI_SCLK_Hz;
whismanoid 15:37c83ec50ea0 7387 int actual_divisor = (int)(ideal_divisor + 0.0); // frequency divisor truncate
whismanoid 15:37c83ec50ea0 7388 double actual_SCLK_Hz = SystemCoreClock / actual_divisor;
whismanoid 15:37c83ec50ea0 7389 //
whismanoid 15:37c83ec50ea0 7390 // fixed: mbed-os-5.11: [Warning] format '%d' expects argument of type 'int', but argument 6 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
whismanoid 15:37c83ec50ea0 7391 cmdLine.serial().printf(
whismanoid 15:37c83ec50ea0 7392 "\r\n %%SC CPOL=%d CPHA=%d CS=%d SCLK=%ld=%1.3fMHz (%1.1fMHz/%1.2f = actual %1.3fMHz) -- SPI config",
whismanoid 15:37c83ec50ea0 7393 ((g_SPI_dataMode & SPI_MODE2) ? 1 : 0),
whismanoid 15:37c83ec50ea0 7394 ((g_SPI_dataMode & SPI_MODE1) ? 1 : 0),
whismanoid 15:37c83ec50ea0 7395 g_SPI_cs_state,
whismanoid 15:37c83ec50ea0 7396 g_SPI_SCLK_Hz,
whismanoid 15:37c83ec50ea0 7397 (g_SPI_SCLK_Hz / 1000000.),
whismanoid 15:37c83ec50ea0 7398 ((double)(SystemCoreClock / 1000000.)),
whismanoid 15:37c83ec50ea0 7399 ideal_divisor,
whismanoid 15:37c83ec50ea0 7400 (actual_SCLK_Hz / 1000000.)
whismanoid 15:37c83ec50ea0 7401 );
whismanoid 15:37c83ec50ea0 7402 }
whismanoid 15:37c83ec50ea0 7403 // get next character
whismanoid 15:37c83ec50ea0 7404 switch (cmdLine[2])
whismanoid 15:37c83ec50ea0 7405 {
whismanoid 15:37c83ec50ea0 7406 case 'C': case 's':
whismanoid 15:37c83ec50ea0 7407 // %SC sclk=1Mhz -- SPI configure
whismanoid 15:37c83ec50ea0 7408 break;
whismanoid 15:37c83ec50ea0 7409 case 'D': case 'd':
whismanoid 15:37c83ec50ea0 7410 // %SD -- SPI diagnostic messages enable
whismanoid 15:37c83ec50ea0 7411 if (g_MAX5719_device.onSPIprint) {
whismanoid 15:37c83ec50ea0 7412 g_MAX5719_device.onSPIprint = NULL;
whismanoid 15:37c83ec50ea0 7413 // no g_MAX5719_device.loop_limit property; device_has_property(Device, 'loop_limit') != None is false
whismanoid 15:37c83ec50ea0 7414 }
whismanoid 15:37c83ec50ea0 7415 else {
whismanoid 15:37c83ec50ea0 7416 void onSPIprint_handler(size_t byteCount, uint8_t mosiData[], uint8_t misoData[]);
whismanoid 15:37c83ec50ea0 7417 g_MAX5719_device.onSPIprint = onSPIprint_handler;
whismanoid 15:37c83ec50ea0 7418 // no g_MAX5719_device.loop_limit property; device_has_property(Device, 'loop_limit') is false
whismanoid 15:37c83ec50ea0 7419 }
whismanoid 15:37c83ec50ea0 7420 break;
whismanoid 15:37c83ec50ea0 7421 case 'W': case 'R': case 'w': case 'r':
whismanoid 15:37c83ec50ea0 7422 {
whismanoid 15:37c83ec50ea0 7423 // %SW -- write (write and read)
whismanoid 15:37c83ec50ea0 7424 // %SR -- read (alias for %SW because SPI always write and read)
whismanoid 15:37c83ec50ea0 7425 // parse cmdLine byte list --> int byteCount; int mosiData[MAX_SPI_BYTE_COUNT];
whismanoid 15:37c83ec50ea0 7426 #define MAX_SPI_BYTE_COUNT 32
whismanoid 15:37c83ec50ea0 7427 size_t byteCount = byteCount;
whismanoid 15:37c83ec50ea0 7428 static char mosiData[MAX_SPI_BYTE_COUNT];
whismanoid 15:37c83ec50ea0 7429 static char misoData[MAX_SPI_BYTE_COUNT];
whismanoid 15:37c83ec50ea0 7430 if (cmdLine.parse_byteCount_byteList_hex(byteCount, mosiData,
whismanoid 15:37c83ec50ea0 7431 MAX_SPI_BYTE_COUNT))
whismanoid 15:37c83ec50ea0 7432 {
whismanoid 15:37c83ec50ea0 7433 // hex dump mosiData[0..byteCount-1]
whismanoid 15:37c83ec50ea0 7434 cmdLine.serial().printf("\r\nSPI");
whismanoid 15:37c83ec50ea0 7435 if (byteCount > 7) {
whismanoid 15:37c83ec50ea0 7436 cmdLine.serial().printf(" byteCount:%d", byteCount);
whismanoid 15:37c83ec50ea0 7437 }
whismanoid 15:37c83ec50ea0 7438 cmdLine.serial().printf(" MOSI->");
whismanoid 15:37c83ec50ea0 7439 for (unsigned int byteIndex = 0; byteIndex < byteCount; byteIndex++)
whismanoid 15:37c83ec50ea0 7440 {
whismanoid 15:37c83ec50ea0 7441 cmdLine.serial().printf(" 0x%2.2X", mosiData[byteIndex]);
whismanoid 15:37c83ec50ea0 7442 }
whismanoid 15:37c83ec50ea0 7443 spi_cs = 0;
whismanoid 15:37c83ec50ea0 7444 unsigned int numBytesTransferred =
whismanoid 15:37c83ec50ea0 7445 spi.write(mosiData, byteCount, misoData, byteCount);
whismanoid 15:37c83ec50ea0 7446 spi_cs = 1;
whismanoid 15:37c83ec50ea0 7447 // hex dump misoData[0..byteCount-1]
whismanoid 15:37c83ec50ea0 7448 cmdLine.serial().printf(" MISO<-");
whismanoid 15:37c83ec50ea0 7449 for (unsigned int byteIndex = 0; byteIndex < numBytesTransferred;
whismanoid 15:37c83ec50ea0 7450 byteIndex++)
whismanoid 15:37c83ec50ea0 7451 {
whismanoid 15:37c83ec50ea0 7452 cmdLine.serial().printf(" 0x%2.2X", misoData[byteIndex]);
whismanoid 15:37c83ec50ea0 7453 }
whismanoid 15:37c83ec50ea0 7454 cmdLine.serial().printf(" ");
whismanoid 15:37c83ec50ea0 7455 }
whismanoid 15:37c83ec50ea0 7456 }
whismanoid 15:37c83ec50ea0 7457 break;
whismanoid 15:37c83ec50ea0 7458 } // switch(cmdLine[2])
whismanoid 15:37c83ec50ea0 7459 } // case 'S': // %S... -- SPI diagnostics
whismanoid 15:37c83ec50ea0 7460 break;
whismanoid 15:37c83ec50ea0 7461 #endif
whismanoid 15:37c83ec50ea0 7462 //
whismanoid 15:37c83ec50ea0 7463 // A-Z,a-z,0-9 reserved for application use
whismanoid 15:37c83ec50ea0 7464 } // switch(cmdLine[1])
whismanoid 15:37c83ec50ea0 7465 } // end void pinsMonitor_submenu_onEOLcommandParser(CmdLine & cmdLine)
whismanoid 15:37c83ec50ea0 7466 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 15:37c83ec50ea0 7467
whismanoid 53:fdb510e3eb37 7468 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 53:fdb510e3eb37 7469 //--------------------------------------------------
whismanoid 53:fdb510e3eb37 7470 // argument parsing for L@ Datalogger_action_table
whismanoid 53:fdb510e3eb37 7471 int edit_action = (int)action_noop;
whismanoid 53:fdb510e3eb37 7472 int edit_digitalOutPin = 0;
whismanoid 53:fdb510e3eb37 7473 int edit_condition = (int)condition_always;
whismanoid 53:fdb510e3eb37 7474 int edit_condition_channel = 0;
whismanoid 53:fdb510e3eb37 7475 double edit_condition_threshold = 0;
whismanoid 53:fdb510e3eb37 7476 // argument parsing for L@ Datalogger_action_table
whismanoid 53:fdb510e3eb37 7477 void parse_action_table_args(CmdLine& cmdLine)
whismanoid 53:fdb510e3eb37 7478 {
whismanoid 53:fdb510e3eb37 7479 // parse_and_remove_key() aliases to make editing easier
whismanoid 53:fdb510e3eb37 7480 char valueBuf[16];
whismanoid 53:fdb510e3eb37 7481 //
whismanoid 53:fdb510e3eb37 7482 // "nop" key alias for act=0 -- action_noop = 0 // no operation
whismanoid 53:fdb510e3eb37 7483 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 53:fdb510e3eb37 7484 if (cmdLine.parse_and_remove_key("nop", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7485 {
whismanoid 53:fdb510e3eb37 7486 edit_action = (int)action_noop;
whismanoid 53:fdb510e3eb37 7487 }
whismanoid 53:fdb510e3eb37 7488 //
whismanoid 53:fdb510e3eb37 7489 // "always" key alias if=0 -- condition_always
whismanoid 53:fdb510e3eb37 7490 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 53:fdb510e3eb37 7491 if (cmdLine.parse_and_remove_key("always", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7492 {
whismanoid 53:fdb510e3eb37 7493 edit_condition = (int)condition_always;
whismanoid 53:fdb510e3eb37 7494 }
whismanoid 53:fdb510e3eb37 7495 //
whismanoid 53:fdb510e3eb37 7496 // "pinL=" alias for act=1 pin=_ -- action_digitalOutLow = 1 // pin = low if condition
whismanoid 53:fdb510e3eb37 7497 // note: this should be after "pin" argument
whismanoid 53:fdb510e3eb37 7498 if (cmdLine.parse_int_dec("pinL", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7499 {
whismanoid 53:fdb510e3eb37 7500 edit_action = (int)action_digitalOutLow;
whismanoid 53:fdb510e3eb37 7501 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7502 }
whismanoid 53:fdb510e3eb37 7503 if (cmdLine.parse_int_dec("Lpin", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7504 {
whismanoid 53:fdb510e3eb37 7505 edit_action = (int)action_digitalOutLow;
whismanoid 53:fdb510e3eb37 7506 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7507 }
whismanoid 53:fdb510e3eb37 7508 //
whismanoid 53:fdb510e3eb37 7509 // "pinH=" alias for act=2 pin=_ -- action_digitalOutHigh = 2 // pin = high if condition
whismanoid 53:fdb510e3eb37 7510 if (cmdLine.parse_int_dec("pinH", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7511 {
whismanoid 53:fdb510e3eb37 7512 edit_action = (int)action_digitalOutHigh;
whismanoid 53:fdb510e3eb37 7513 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7514 }
whismanoid 53:fdb510e3eb37 7515 if (cmdLine.parse_int_dec("Hpin", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7516 {
whismanoid 53:fdb510e3eb37 7517 edit_action = (int)action_digitalOutHigh;
whismanoid 53:fdb510e3eb37 7518 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7519 }
whismanoid 53:fdb510e3eb37 7520 //
whismanoid 53:fdb510e3eb37 7521 // "button=" alias for act=3 pin=_ -- action_button = 3 // pin = button event index 1, 2, 3
whismanoid 53:fdb510e3eb37 7522 if (cmdLine.parse_int_dec("button", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7523 {
whismanoid 53:fdb510e3eb37 7524 edit_action = (int)action_button;
whismanoid 53:fdb510e3eb37 7525 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7526 }
whismanoid 53:fdb510e3eb37 7527 if (cmdLine.parse_int_dec("btn", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7528 {
whismanoid 53:fdb510e3eb37 7529 edit_action = (int)action_button;
whismanoid 53:fdb510e3eb37 7530 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7531 }
whismanoid 53:fdb510e3eb37 7532 //
whismanoid 53:fdb510e3eb37 7533 // "LR" key alias for act=5 -- action_trigger_FreeRun = 5
whismanoid 53:fdb510e3eb37 7534 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 53:fdb510e3eb37 7535 if (cmdLine.parse_and_remove_key("run_LR", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7536 {
whismanoid 53:fdb510e3eb37 7537 edit_action = (int)action_trigger_FreeRun;
whismanoid 53:fdb510e3eb37 7538 }
whismanoid 53:fdb510e3eb37 7539 //
whismanoid 53:fdb510e3eb37 7540 // "LT" key alias for act=6 -- action_trigger_Timer = 6
whismanoid 53:fdb510e3eb37 7541 // this may conflict with lt as "less than"...
whismanoid 53:fdb510e3eb37 7542 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 53:fdb510e3eb37 7543 if (cmdLine.parse_and_remove_key("timer_LT", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7544 {
whismanoid 53:fdb510e3eb37 7545 edit_action = (int)action_trigger_Timer;
whismanoid 53:fdb510e3eb37 7546 }
whismanoid 53:fdb510e3eb37 7547 // "halt" key alias for act=4 -- action_trigger_Halt = 4
whismanoid 53:fdb510e3eb37 7548 // needs to be after key "LT"
whismanoid 53:fdb510e3eb37 7549 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 53:fdb510e3eb37 7550 if (cmdLine.parse_and_remove_key("Halt", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7551 {
whismanoid 53:fdb510e3eb37 7552 edit_action = (int)action_trigger_Halt;
whismanoid 53:fdb510e3eb37 7553 }
whismanoid 53:fdb510e3eb37 7554 if (cmdLine.parse_and_remove_key("halt", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7555 {
whismanoid 53:fdb510e3eb37 7556 edit_action = (int)action_trigger_Halt;
whismanoid 53:fdb510e3eb37 7557 }
whismanoid 53:fdb510e3eb37 7558 //
whismanoid 53:fdb510e3eb37 7559 // FUTURE: "__TBD__" alias for act=7 -- action_trigger_PlatformDigitalInput = 7
whismanoid 53:fdb510e3eb37 7560 if (cmdLine.parse_int_dec("pinIN", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7561 {
whismanoid 53:fdb510e3eb37 7562 edit_action = (int)action_trigger_PlatformDigitalInput;
whismanoid 53:fdb510e3eb37 7563 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7564 }
whismanoid 53:fdb510e3eb37 7565 //
whismanoid 53:fdb510e3eb37 7566 // FUTURE: "__TBD__" alias for act=8 -- action_trigger_SPIDeviceRegRead = 8
whismanoid 53:fdb510e3eb37 7567 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 53:fdb510e3eb37 7568 if (cmdLine.parse_and_remove_key("SPI", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7569 {
whismanoid 53:fdb510e3eb37 7570 edit_action = (int)action_trigger_SPIDeviceRegRead;
whismanoid 53:fdb510e3eb37 7571 }
whismanoid 53:fdb510e3eb37 7572 //
whismanoid 53:fdb510e3eb37 7573 // aliases for Platform_Voltage[channel] thresholds
whismanoid 53:fdb510e3eb37 7574 // loop through ch=$ 0..limit
whismanoid 53:fdb510e3eb37 7575 // "A0gtx=" alias for if=1 ch=$ x=_ -- condition_if_An_gt_threshold, // (Platform_Voltage[channel] > threhsold)
whismanoid 53:fdb510e3eb37 7576 // "A0ltx=" alias for if=2 ch=$ x=_ -- condition_if_An_lt_threshold, // (Platform_Voltage[channel] < threhsold)
whismanoid 53:fdb510e3eb37 7577 // "A0eqx=" alias for if=3 ch=$ x=_ -- condition_if_An_eq_threshold, // (Platform_Voltage[channel] == threhsold)
whismanoid 53:fdb510e3eb37 7578 // "A0gex=" alias for if=4 ch=$ x=_ -- condition_if_An_ge_threshold, // (Platform_Voltage[channel] >= threhsold)
whismanoid 53:fdb510e3eb37 7579 // "A0lex=" alias for if=5 ch=$ x=_ -- condition_if_An_le_threshold, // (Platform_Voltage[channel] <= threhsold)
whismanoid 53:fdb510e3eb37 7580 // "A0nex=" alias for if=6 ch=$ x=_ -- condition_if_An_ne_threshold, // (Platform_Voltage[channel] != threhsold)
whismanoid 53:fdb510e3eb37 7581 // "AIN0gtx=" alias for if=7 ch=$ x=_ -- condition_if_AINn_gt_threshold, // (SPI_AIN_Voltage[channel] > threhsold)
whismanoid 53:fdb510e3eb37 7582 // "AIN0ltx=" alias for if=8 ch=$ x=_ -- condition_if_AINn_lt_threshold, // (SPI_AIN_Voltage[channel] < threhsold)
whismanoid 53:fdb510e3eb37 7583 // "AIN0eqx=" alias for if=9 ch=$ x=_ -- condition_if_AINn_eq_threshold, // (SPI_AIN_Voltage[channel] == threhsold)
whismanoid 53:fdb510e3eb37 7584 // "AIN0gex=" alias for if=10 ch=$ x=_ -- condition_if_AINn_ge_threshold, // (SPI_AIN_Voltage[channel] >= threhsold)
whismanoid 53:fdb510e3eb37 7585 // "AIN0lex=" alias for if=11 ch=$ x=_ -- condition_if_AINn_le_threshold, // (SPI_AIN_Voltage[channel] <= threhsold)
whismanoid 53:fdb510e3eb37 7586 // "AIN0nex=" alias for if=12 ch=$ x=_ -- condition_if_AINn_ne_threshold, // (SPI_AIN_Voltage[channel] != threhsold)
whismanoid 53:fdb510e3eb37 7587 for (int channel_index = 0; (
whismanoid 53:fdb510e3eb37 7588 (channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS)
whismanoid 60:129bc521f88c 7589 || (channel_index < NUM_DUT_ANALOG_IN_CHANNELS));
whismanoid 53:fdb510e3eb37 7590 channel_index++)
whismanoid 53:fdb510e3eb37 7591 {
whismanoid 53:fdb510e3eb37 7592 char key[16];
whismanoid 53:fdb510e3eb37 7593 //
whismanoid 53:fdb510e3eb37 7594 sprintf(key, "A%dgtx", channel_index);
whismanoid 53:fdb510e3eb37 7595 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7596 {
whismanoid 53:fdb510e3eb37 7597 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7598 edit_condition = (int)condition_if_An_gt_threshold;
whismanoid 53:fdb510e3eb37 7599 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7600 }
whismanoid 53:fdb510e3eb37 7601 //
whismanoid 53:fdb510e3eb37 7602 sprintf(key, "A%dltx", channel_index);
whismanoid 53:fdb510e3eb37 7603 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7604 {
whismanoid 53:fdb510e3eb37 7605 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7606 edit_condition = (int)condition_if_An_lt_threshold;
whismanoid 53:fdb510e3eb37 7607 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7608 }
whismanoid 53:fdb510e3eb37 7609 //
whismanoid 53:fdb510e3eb37 7610 sprintf(key, "A%deqx", channel_index);
whismanoid 53:fdb510e3eb37 7611 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7612 {
whismanoid 53:fdb510e3eb37 7613 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7614 edit_condition = (int)condition_if_An_eq_threshold;
whismanoid 53:fdb510e3eb37 7615 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7616 }
whismanoid 53:fdb510e3eb37 7617 //
whismanoid 53:fdb510e3eb37 7618 sprintf(key, "A%dgex", channel_index);
whismanoid 53:fdb510e3eb37 7619 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7620 {
whismanoid 53:fdb510e3eb37 7621 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7622 edit_condition = (int)condition_if_An_ge_threshold;
whismanoid 53:fdb510e3eb37 7623 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7624 }
whismanoid 53:fdb510e3eb37 7625 //
whismanoid 53:fdb510e3eb37 7626 sprintf(key, "A%dlex", channel_index);
whismanoid 53:fdb510e3eb37 7627 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7628 {
whismanoid 53:fdb510e3eb37 7629 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7630 edit_condition = (int)condition_if_An_le_threshold;
whismanoid 53:fdb510e3eb37 7631 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7632 }
whismanoid 53:fdb510e3eb37 7633 //
whismanoid 53:fdb510e3eb37 7634 sprintf(key, "A%dnex", channel_index);
whismanoid 53:fdb510e3eb37 7635 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7636 {
whismanoid 53:fdb510e3eb37 7637 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7638 edit_condition = (int)condition_if_An_ne_threshold;
whismanoid 53:fdb510e3eb37 7639 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7640 }
whismanoid 53:fdb510e3eb37 7641 //
whismanoid 53:fdb510e3eb37 7642 sprintf(key, "AIN%dgtx", channel_index);
whismanoid 53:fdb510e3eb37 7643 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7644 {
whismanoid 53:fdb510e3eb37 7645 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7646 edit_condition = (int)condition_if_AINn_gt_threshold;
whismanoid 53:fdb510e3eb37 7647 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7648 }
whismanoid 53:fdb510e3eb37 7649 //
whismanoid 53:fdb510e3eb37 7650 sprintf(key, "AIN%dltx", channel_index);
whismanoid 53:fdb510e3eb37 7651 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7652 {
whismanoid 53:fdb510e3eb37 7653 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7654 edit_condition = (int)condition_if_AINn_lt_threshold;
whismanoid 53:fdb510e3eb37 7655 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7656 }
whismanoid 53:fdb510e3eb37 7657 //
whismanoid 53:fdb510e3eb37 7658 sprintf(key, "AIN%deqx", channel_index);
whismanoid 53:fdb510e3eb37 7659 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7660 {
whismanoid 53:fdb510e3eb37 7661 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7662 edit_condition = (int)condition_if_AINn_eq_threshold;
whismanoid 53:fdb510e3eb37 7663 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7664 }
whismanoid 53:fdb510e3eb37 7665 //
whismanoid 53:fdb510e3eb37 7666 sprintf(key, "AIN%dgex", channel_index);
whismanoid 53:fdb510e3eb37 7667 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7668 {
whismanoid 53:fdb510e3eb37 7669 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7670 edit_condition = (int)condition_if_AINn_ge_threshold;
whismanoid 53:fdb510e3eb37 7671 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7672 }
whismanoid 53:fdb510e3eb37 7673 //
whismanoid 53:fdb510e3eb37 7674 sprintf(key, "AIN%dlex", channel_index);
whismanoid 53:fdb510e3eb37 7675 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7676 {
whismanoid 53:fdb510e3eb37 7677 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7678 edit_condition = (int)condition_if_AINn_le_threshold;
whismanoid 53:fdb510e3eb37 7679 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7680 }
whismanoid 53:fdb510e3eb37 7681 //
whismanoid 53:fdb510e3eb37 7682 sprintf(key, "AIN%dnex", channel_index);
whismanoid 53:fdb510e3eb37 7683 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7684 {
whismanoid 53:fdb510e3eb37 7685 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7686 edit_condition = (int)condition_if_AINn_ne_threshold;
whismanoid 53:fdb510e3eb37 7687 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7688 }
whismanoid 53:fdb510e3eb37 7689 //
whismanoid 55:477ba09475d7 7690 // MAX40108 Datalog Math #362 -- parse_action_table_args() support condition_if_MathAn_gt_threshold gt lt eq ne etc.
whismanoid 55:477ba09475d7 7691 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 7692 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 7693 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 7694 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 7695 //
whismanoid 55:477ba09475d7 7696 //
whismanoid 53:fdb510e3eb37 7697 } // end for (channel_index...)
whismanoid 53:fdb510e3eb37 7698 //
whismanoid 60:129bc521f88c 7699
whismanoid 60:129bc521f88c 7700 //
whismanoid 60:129bc521f88c 7701 if (cmdLine.parse_int_dec("act", edit_action))
whismanoid 60:129bc521f88c 7702 {
whismanoid 60:129bc521f88c 7703 //~ cmdLine.serial().printf("\r\n act=%d", edit_action);
whismanoid 60:129bc521f88c 7704 }
whismanoid 60:129bc521f88c 7705 if (cmdLine.parse_int_dec("pin", edit_digitalOutPin))
whismanoid 60:129bc521f88c 7706 {
whismanoid 60:129bc521f88c 7707 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 60:129bc521f88c 7708 }
whismanoid 60:129bc521f88c 7709 if (cmdLine.parse_int_dec("if", edit_condition))
whismanoid 60:129bc521f88c 7710 {
whismanoid 60:129bc521f88c 7711 //~ cmdLine.serial().printf("\r\n if=%d", edit_condition);
whismanoid 60:129bc521f88c 7712 }
whismanoid 60:129bc521f88c 7713 if (cmdLine.parse_int_dec("ch", edit_condition_channel))
whismanoid 60:129bc521f88c 7714 {
whismanoid 60:129bc521f88c 7715 //~ cmdLine.serial().printf("\r\n ch=%d", edit_condition_channel);
whismanoid 60:129bc521f88c 7716 }
whismanoid 60:129bc521f88c 7717 // the shortest key "x" must be tested last, to avoid interfering with keys where it's a substring
whismanoid 60:129bc521f88c 7718 if (cmdLine.parse_double("x", edit_condition_threshold))
whismanoid 60:129bc521f88c 7719 {
whismanoid 60:129bc521f88c 7720 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 60:129bc521f88c 7721 }
whismanoid 60:129bc521f88c 7722 // DIAGNOSTIC
whismanoid 60:129bc521f88c 7723 //~ cmdLine.serial().printf("\r\n parse_action_table_args() edit_action=%d edit_condition=%d edit_condition_channel=%d edit_condition_threshold=%1.3f \r\n", edit_action, edit_condition, edit_condition_channel, edit_condition_threshold);
whismanoid 60:129bc521f88c 7724
whismanoid 53:fdb510e3eb37 7725 }
whismanoid 53:fdb510e3eb37 7726 #endif // USE_DATALOGGER_ActionTable
whismanoid 53:fdb510e3eb37 7727
whismanoid 15:37c83ec50ea0 7728 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 7729 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 7730 void main_menu_onEOLcommandParser(CmdLine& cmdLine)
whismanoid 4:d9b05924ad4c 7731 {
whismanoid 9:45f98573eb6d 7732 // process command line
whismanoid 31:47eee7e0cc2d 7733 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 45:74bf1fe021e5 7734 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7735 if (g_Run_command_table_running == false) {
whismanoid 45:74bf1fe021e5 7736 #endif // USE_DATALOGGER_CommandTable
whismanoid 48:18647e0516f2 7737 //~ cmdLine.serial().printf("\r\nCmdLine buf:\"%s\"\r\n", cmdLine.str());
whismanoid 45:74bf1fe021e5 7738 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7739 } // if (g_Run_command_table_running)
whismanoid 45:74bf1fe021e5 7740 #endif // USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7741 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 45:74bf1fe021e5 7742 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7743 if (g_Run_command_table_running == false) {
whismanoid 45:74bf1fe021e5 7744 #endif // USE_DATALOGGER_CommandTable
whismanoid 45:74bf1fe021e5 7745 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7746 } // if (g_Run_command_table_running)
whismanoid 45:74bf1fe021e5 7747 #endif // USE_DATALOGGER_CommandTable
whismanoid 4:d9b05924ad4c 7748
whismanoid 4:d9b05924ad4c 7749 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 31:47eee7e0cc2d 7750 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 45:74bf1fe021e5 7751 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7752 if (g_Run_command_table_running == false) {
whismanoid 45:74bf1fe021e5 7753 #endif // USE_DATALOGGER_CommandTable
whismanoid 4:d9b05924ad4c 7754 // If datalog is free running, halt on any possible received command
whismanoid 17:9397ea3ea7e9 7755 if (Datalogger_Trigger != trigger_Halt) {
whismanoid 4:d9b05924ad4c 7756 Datalogger_Trigger = trigger_Halt;
whismanoid 9:45f98573eb6d 7757 cmdLine.serial().printf("Datalog stopped by USB command input\r\n");
whismanoid 9:45f98573eb6d 7758 cmdLine.serial().printf("Restart datalog by sending LR\r\n");
whismanoid 4:d9b05924ad4c 7759 }
whismanoid 45:74bf1fe021e5 7760 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7761 } // if (g_Run_command_table_running)
whismanoid 45:74bf1fe021e5 7762 #endif // USE_DATALOGGER_CommandTable
whismanoid 4:d9b05924ad4c 7763 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 4:d9b05924ad4c 7764
whismanoid 4:d9b05924ad4c 7765 // DIAGNOSTIC: print line buffer
whismanoid 4:d9b05924ad4c 7766 //~ cmdLine.serial().printf("\r\nmain_menu_onEOLcommandParser: ~%s~\r\n", cmdLine.str());
whismanoid 4:d9b05924ad4c 7767 //
whismanoid 4:d9b05924ad4c 7768 switch (cmdLine[0])
whismanoid 4:d9b05924ad4c 7769 {
whismanoid 4:d9b05924ad4c 7770 case '?':
whismanoid 4:d9b05924ad4c 7771 main_menu_status(cmdLine);
whismanoid 4:d9b05924ad4c 7772 main_menu_help(cmdLine);
whismanoid 4:d9b05924ad4c 7773 // print command prompt
whismanoid 4:d9b05924ad4c 7774 //cmdLine.serial().printf("\r\n>");
whismanoid 4:d9b05924ad4c 7775 break;
whismanoid 4:d9b05924ad4c 7776 case '\r': case '\n': // ignore blank line
whismanoid 4:d9b05924ad4c 7777 case '\0': // ignore empty line
whismanoid 30:07197a430869 7778 main_menu_status(cmdLine);
whismanoid 30:07197a430869 7779 //~ main_menu_help(cmdLine);
whismanoid 30:07197a430869 7780 // print command prompt
whismanoid 30:07197a430869 7781 //cmdLine.serial().printf("\r\n>");
whismanoid 30:07197a430869 7782 break;
whismanoid 4:d9b05924ad4c 7783 case '#': // ignore comment line
whismanoid 4:d9b05924ad4c 7784 // # -- lines beginning with # are comments
whismanoid 30:07197a430869 7785 //
whismanoid 30:07197a430869 7786 #if USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 7787 // Datalogger_PrintRow() print gstrRemarkText field from recent #remark -- in main_menu_onEOLcommandParser
whismanoid 30:07197a430869 7788 // # command handler update gstrRemarkText buffer instead of just ignoring the remark
whismanoid 30:07197a430869 7789 //
whismanoid 30:07197a430869 7790 // ignore extra spaces before the remark
whismanoid 30:07197a430869 7791 // find argIndex such that cmdLine[argIndex] is the start of the second word
whismanoid 30:07197a430869 7792 int argIndex;
whismanoid 30:07197a430869 7793 for (argIndex = 1; cmdLine[argIndex] != '\0'; argIndex++)
whismanoid 30:07197a430869 7794 {
whismanoid 30:07197a430869 7795 if (cmdLine[argIndex] == ' ') break;
whismanoid 30:07197a430869 7796 }
whismanoid 30:07197a430869 7797 for (; cmdLine[argIndex] != '\0'; argIndex++)
whismanoid 30:07197a430869 7798 {
whismanoid 30:07197a430869 7799 if (cmdLine[argIndex] != ' ') break;
whismanoid 30:07197a430869 7800 }
whismanoid 30:07197a430869 7801 //
whismanoid 30:07197a430869 7802 strncpy(gstrRemarkText, cmdLine.str()+argIndex, gstrRemarkTextLASTINDEX+1);
whismanoid 30:07197a430869 7803 // do not exceed string buffer limit; keep sentinel null character at end of buffer
whismanoid 30:07197a430869 7804 gstrRemarkText[gstrRemarkTextLASTINDEX] = '\0';
whismanoid 41:13a6a097502c 7805 for (unsigned int index = 0; index < gstrRemarkTextLASTINDEX; index++)
whismanoid 30:07197a430869 7806 {
whismanoid 30:07197a430869 7807 if ((gstrRemarkText[index]) == '\0') break; // null character at end of string
whismanoid 30:07197a430869 7808 if ((gstrRemarkText[index]) < 0x20) {
whismanoid 30:07197a430869 7809 // replace non-printing characters with _
whismanoid 30:07197a430869 7810 gstrRemarkText[index] = '_';
whismanoid 30:07197a430869 7811 continue;
whismanoid 30:07197a430869 7812 }
whismanoid 30:07197a430869 7813 if ((gstrRemarkText[index]) >= 0x7F) {
whismanoid 30:07197a430869 7814 // replace non-printing characters with _
whismanoid 30:07197a430869 7815 gstrRemarkText[index] = '_';
whismanoid 30:07197a430869 7816 continue;
whismanoid 30:07197a430869 7817 }
whismanoid 30:07197a430869 7818 switch(gstrRemarkText[index])
whismanoid 30:07197a430869 7819 {
whismanoid 30:07197a430869 7820 case ',':
whismanoid 30:07197a430869 7821 // replace , with ;
whismanoid 30:07197a430869 7822 gstrRemarkText[index] = ';';
whismanoid 30:07197a430869 7823 break;
whismanoid 30:07197a430869 7824 case '"':
whismanoid 30:07197a430869 7825 // replace " with '
whismanoid 30:07197a430869 7826 gstrRemarkText[index] = '\'';
whismanoid 30:07197a430869 7827 break;
whismanoid 30:07197a430869 7828 case '\\':
whismanoid 30:07197a430869 7829 // replace \ with /
whismanoid 30:07197a430869 7830 gstrRemarkText[index] = '/';
whismanoid 30:07197a430869 7831 break;
whismanoid 30:07197a430869 7832 }
whismanoid 30:07197a430869 7833 }
whismanoid 30:07197a430869 7834 #endif // USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 7835 //
whismanoid 31:47eee7e0cc2d 7836 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 45:74bf1fe021e5 7837 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7838 if (g_Run_command_table_running == false) {
whismanoid 45:74bf1fe021e5 7839 #endif // USE_DATALOGGER_CommandTable
whismanoid 4:d9b05924ad4c 7840 main_menu_status(cmdLine);
whismanoid 45:74bf1fe021e5 7841 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7842 } // if (g_Run_command_table_running)
whismanoid 45:74bf1fe021e5 7843 #endif // USE_DATALOGGER_CommandTable
whismanoid 4:d9b05924ad4c 7844 //~ main_menu_help(cmdLine);
whismanoid 4:d9b05924ad4c 7845 // print command prompt
whismanoid 4:d9b05924ad4c 7846 //cmdLine.serial().printf("\r\n>");
whismanoid 4:d9b05924ad4c 7847 break;
whismanoid 4:d9b05924ad4c 7848 #if ECHO_EOF_ON_EOL
whismanoid 4:d9b05924ad4c 7849 case '\x04': // Unicode (U+0004) EOT END OF TRANSMISSION = CTRL+D as EOF end of file
whismanoid 4:d9b05924ad4c 7850 cmdLine.serial().printf("\x04"); // immediately echo EOF for test scripting
whismanoid 4:d9b05924ad4c 7851 diagnostic_led_EOF();
whismanoid 4:d9b05924ad4c 7852 break;
whismanoid 4:d9b05924ad4c 7853 case '\x1a': // Unicode (U+001A) SUB SUBSTITUTE = CTRL+Z as EOF end of file
whismanoid 4:d9b05924ad4c 7854 cmdLine.serial().printf("\x1a"); // immediately echo EOF for test scripting
whismanoid 4:d9b05924ad4c 7855 diagnostic_led_EOF();
whismanoid 4:d9b05924ad4c 7856 break;
whismanoid 4:d9b05924ad4c 7857 #endif
whismanoid 10:04022a61b527 7858 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 10:04022a61b527 7859 case '!': // device init
whismanoid 10:04022a61b527 7860 {
whismanoid 10:04022a61b527 7861 cmdLine.serial().printf("Init");
whismanoid 10:04022a61b527 7862 // call function Init
whismanoid 10:04022a61b527 7863 uint8_t result = g_MAX11410_device.Init();
whismanoid 10:04022a61b527 7864 // cmdLine.serial().printf(" =%d\r\n", result);
whismanoid 10:04022a61b527 7865 cmdLine.serial().printf(" =%d\r\n", result);
whismanoid 10:04022a61b527 7866 #if USE_CUSTOM_REG_INIT // custom_reg_init_addr[], custom_reg_init_data[], custom_reg_init_count
whismanoid 10:04022a61b527 7867 // in command '!' device init, apply list of custom register writes after init
whismanoid 10:04022a61b527 7868 // custom_reg_init_addr[], custom_reg_init_data[], custom_reg_init_count
whismanoid 10:04022a61b527 7869 for (unsigned int index = 0; index < custom_reg_init_count; index++) {
whismanoid 10:04022a61b527 7870 uint8_t regAddress = custom_reg_init_addr[index];
whismanoid 10:04022a61b527 7871 uint32_t regData = custom_reg_init_data[index];
whismanoid 10:04022a61b527 7872 cmdLine.serial().printf("*%s=0x%06.6x",
whismanoid 10:04022a61b527 7873 g_MAX11410_device.RegName((MAX11410::MAX11410_CMD_enum_t)regAddress),
whismanoid 10:04022a61b527 7874 regData
whismanoid 10:04022a61b527 7875 );
whismanoid 10:04022a61b527 7876 g_MAX11410_device.RegWrite((MAX11410::MAX11410_CMD_enum_t)regAddress, regData);
whismanoid 10:04022a61b527 7877 }
whismanoid 10:04022a61b527 7878 #endif // USE_CUSTOM_REG_INIT
whismanoid 10:04022a61b527 7879 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[0];
whismanoid 10:04022a61b527 7880 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[0];
whismanoid 10:04022a61b527 7881 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[0];
whismanoid 10:04022a61b527 7882 }
whismanoid 10:04022a61b527 7883 break;
whismanoid 10:04022a61b527 7884 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 4:d9b05924ad4c 7885 #if USE_SELFTEST
whismanoid 4:d9b05924ad4c 7886 case '.':
whismanoid 4:d9b05924ad4c 7887 {
whismanoid 4:d9b05924ad4c 7888 // . -- SelfTest
whismanoid 4:d9b05924ad4c 7889 cmdLine.serial().printf("SelfTest()");
whismanoid 4:d9b05924ad4c 7890 SelfTest(cmdLine);
whismanoid 4:d9b05924ad4c 7891 }
whismanoid 4:d9b05924ad4c 7892 break;
whismanoid 4:d9b05924ad4c 7893 #endif // USE_SELFTEST
whismanoid 15:37c83ec50ea0 7894 #if 1 // APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 7895 case '%':
whismanoid 4:d9b05924ad4c 7896 {
whismanoid 4:d9b05924ad4c 7897 pinsMonitor_submenu_onEOLcommandParser(cmdLine);
whismanoid 4:d9b05924ad4c 7898 }
whismanoid 4:d9b05924ad4c 7899 break; // case '%'
whismanoid 4:d9b05924ad4c 7900 #endif // APPLICATION_ArduinoPinsMonitor
whismanoid 9:45f98573eb6d 7901 #if USE_STAR_REG_READWRITE // * command read/write reg *reg? *reg=value
whismanoid 10:04022a61b527 7902 // reuse the Serial_Tester command *regName=regValue
whismanoid 10:04022a61b527 7903 // CODE GENERATOR: generate * command read/write reg *reg? *reg=value
whismanoid 10:04022a61b527 7904 case '*':
whismanoid 10:04022a61b527 7905 {
whismanoid 10:04022a61b527 7906 // if buffer starts with a regName:
whismanoid 10:04022a61b527 7907 // for each reg value (0..n) if(cmdLine.has_keyword(device.regName(r))):
whismanoid 10:04022a61b527 7908 // cmdLine.serial().printf(" scan RegName...\r\n");
whismanoid 10:04022a61b527 7909 }
whismanoid 10:04022a61b527 7910 break;
whismanoid 9:45f98573eb6d 7911 #endif // USE_STAR_REG_READWRITE // * command read/write reg *reg? *reg=value
whismanoid 10:04022a61b527 7912 //
whismanoid 10:04022a61b527 7913 #if 1 // USE_AUX_SERIAL_CMD_FORWARDING && (HAS_AUX_SERIAL || HAS_DAPLINK_SERIAL)
whismanoid 10:04022a61b527 7914 // TODO WIP Command forwarding to Auxiliary serial port TX/RX #257 -- main_menu_onEOLcommandParser
whismanoid 40:330b28116178 7915 case '>': case '<': // > send and receive; < receive without sending anything
whismanoid 10:04022a61b527 7916 {
whismanoid 10:04022a61b527 7917 // prefer cmdLine_AUXserial if available, else cmdLine_DAPLINKserial; else we don't have this feature
whismanoid 10:04022a61b527 7918 # if HAS_AUX_SERIAL
whismanoid 10:04022a61b527 7919 // TODO WIP Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257
whismanoid 10:04022a61b527 7920 CmdLine& cmdLine_AuxSerial = cmdLine_AUXserial;
whismanoid 10:04022a61b527 7921 Serial& AuxSerial = AUXserial;
whismanoid 10:04022a61b527 7922 # elif HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 7923 // TODO WIP Command forwarding to DAPLINK serial TX/RX cmdLine_DAPLINKserial #257
whismanoid 10:04022a61b527 7924 CmdLine& cmdLine_AuxSerial = cmdLine_DAPLINKserial;
whismanoid 10:04022a61b527 7925 Serial& AuxSerial = DAPLINKserial;
whismanoid 10:04022a61b527 7926 # else // neither HAS_AUX_SERIAL HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 7927 #warning "USE_AUX_SERIAL_CMD_FORWARDING should not be enabled without HAS_AUX_SERIAL or HAS_DAPLINK_SERIAL"
whismanoid 10:04022a61b527 7928 # endif // HAS_AUX_SERIAL HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 7929 //
whismanoid 40:330b28116178 7930 int g_auxSerialCom_outgoing_string_cr = 1; // option to send CR after outgoing_string
whismanoid 40:330b28116178 7931 int g_auxSerialCom_outgoing_string_lf = 0; // option to send LF after outgoing_string (breaks remote datalogger LR!)
whismanoid 40:330b28116178 7932 int g_auxSerialCom_rx_string_verbose_crlf = 0; // option to display \r\n as "\\r\\n" in rx_string_buf
whismanoid 40:330b28116178 7933 int g_auxSerialCom_rx_string_verbose_ctrl = 1; // option to display control codes as \xXX
whismanoid 40:330b28116178 7934 const char* g_auxSerialCom_display_tx_prefix = "\r\n->|"; // "\r\n >";
whismanoid 40:330b28116178 7935 const char* g_auxSerialCom_display_rx_prefix = "\r\n<-|"; // "\r\n< ";
whismanoid 40:330b28116178 7936 //
whismanoid 40:330b28116178 7937 bool need_g_auxSerialCom_display_rx_prefix = 1; // temp
whismanoid 40:330b28116178 7938 //
whismanoid 10:04022a61b527 7939 // >> suppress key=value parsing
whismanoid 10:04022a61b527 7940 bool suppress_parsing = (cmdLine[1] == '>');
whismanoid 10:04022a61b527 7941 if (suppress_parsing == false) {
whismanoid 10:04022a61b527 7942 // int g_auxSerialCom_baud = 9600; //!< baud rate Auxiliary serial port
whismanoid 10:04022a61b527 7943 if (cmdLine.parse_int_dec("baud", g_auxSerialCom_baud))
whismanoid 10:04022a61b527 7944 {
whismanoid 10:04022a61b527 7945 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- baud rate
whismanoid 10:04022a61b527 7946 cmdLine_AuxSerial.serial().printf("\r\n*** New Baud Rate %d ***\r\n", g_auxSerialCom_baud);
whismanoid 10:04022a61b527 7947 AuxSerial.baud(g_auxSerialCom_baud);
whismanoid 10:04022a61b527 7948 cmdLine_AuxSerial.serial().printf("\r\n*** Baud Rate was set to %d ***\r\n", g_auxSerialCom_baud);
whismanoid 10:04022a61b527 7949 }
whismanoid 10:04022a61b527 7950 #if 0
whismanoid 10:04022a61b527 7951 // int g_auxSerialCom_tx_wait_echo = 0; //!< TX wait for each character echo?
whismanoid 10:04022a61b527 7952 if (cmdLine.parse_int_dec("tx_wait_echo", g_auxSerialCom_tx_wait_echo))
whismanoid 10:04022a61b527 7953 {
whismanoid 10:04022a61b527 7954 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- tx_wait_echo
whismanoid 10:04022a61b527 7955 //~ cmdLine_AuxSerial.serial().printf("\r\n*** tx_wait_echo was set to %d ***\r\n", g_auxSerialCom_tx_wait_echo);
whismanoid 10:04022a61b527 7956 cmdLine.serial().printf("\r\n tx_wait_echo=%d", g_auxSerialCom_tx_wait_echo);
whismanoid 10:04022a61b527 7957 }
whismanoid 10:04022a61b527 7958 // int g_auxSerialCom_tx_char_delay_ms = 0; //!< TX delay after each char?
whismanoid 10:04022a61b527 7959 if (cmdLine.parse_int_dec("tx_char_delay_ms", g_auxSerialCom_tx_char_delay_ms))
whismanoid 10:04022a61b527 7960 {
whismanoid 10:04022a61b527 7961 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- tx_char_delay_ms
whismanoid 10:04022a61b527 7962 //~ cmdLine_AuxSerial.serial().printf("\r\n*** tx_char_delay_ms was set to %d ***\r\n", g_auxSerialCom_tx_char_delay_ms);
whismanoid 10:04022a61b527 7963 cmdLine.serial().printf("\r\n tx_char_delay_ms=%dms", g_auxSerialCom_tx_char_delay_ms);
whismanoid 10:04022a61b527 7964 }
whismanoid 10:04022a61b527 7965 // int g_auxSerialCom_tx_line_delay_ms = 0; //!< TX delay after each CR/LF?
whismanoid 10:04022a61b527 7966 if (cmdLine.parse_int_dec("tx_line_delay_ms", g_auxSerialCom_tx_line_delay_ms))
whismanoid 10:04022a61b527 7967 {
whismanoid 10:04022a61b527 7968 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- tx_line_delay_ms
whismanoid 10:04022a61b527 7969 //~ cmdLine_AuxSerial.serial().printf("\r\n*** tx_line_delay_ms was set to %d ***\r\n", g_auxSerialCom_tx_line_delay_ms);
whismanoid 10:04022a61b527 7970 cmdLine.serial().printf("\r\n tx_line_delay_ms=%dms", g_auxSerialCom_tx_line_delay_ms);
whismanoid 10:04022a61b527 7971 }
whismanoid 10:04022a61b527 7972 #endif
whismanoid 10:04022a61b527 7973 // int g_auxSerialCom_message_ms = 0; //!< capture RX until response timeout?
whismanoid 10:04022a61b527 7974 if (cmdLine.parse_int_dec("message_ms", g_auxSerialCom_message_ms))
whismanoid 10:04022a61b527 7975 {
whismanoid 10:04022a61b527 7976 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- message_ms
whismanoid 10:04022a61b527 7977 //~ cmdLine_AuxSerial.serial().printf("\r\n*** message_ms was set to %d ***\r\n", g_auxSerialCom_message_ms);
whismanoid 10:04022a61b527 7978 cmdLine.serial().printf("\r\n message_ms timeout %dms", g_auxSerialCom_message_ms);
whismanoid 10:04022a61b527 7979 }
whismanoid 10:04022a61b527 7980 // int g_auxSerialCom_rx_idle_ms = 0; //!< capture RX until idle timeout?
whismanoid 10:04022a61b527 7981 if (cmdLine.parse_int_dec("rx_idle_ms", g_auxSerialCom_rx_idle_ms))
whismanoid 10:04022a61b527 7982 {
whismanoid 10:04022a61b527 7983 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- rx_idle_ms
whismanoid 10:04022a61b527 7984 //~ cmdLine_AuxSerial.serial().printf("\r\n*** rx_idle_ms was set to %d ***\r\n", g_auxSerialCom_rx_idle_ms);
whismanoid 10:04022a61b527 7985 cmdLine.serial().printf("\r\n rx_idle_ms timeout %dms", g_auxSerialCom_rx_idle_ms);
whismanoid 10:04022a61b527 7986 }
whismanoid 10:04022a61b527 7987 // int g_auxSerialCom_rx_max_count = 0; //!< capture RX until max character count?
whismanoid 10:04022a61b527 7988 if (cmdLine.parse_int_dec("rx_max_count", g_auxSerialCom_rx_max_count))
whismanoid 10:04022a61b527 7989 {
whismanoid 10:04022a61b527 7990 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- rx_max_count
whismanoid 10:04022a61b527 7991 //~ cmdLine_AuxSerial.serial().printf("\r\n*** rx_max_count was set to %d ***\r\n", g_auxSerialCom_rx_max_count);
whismanoid 10:04022a61b527 7992 cmdLine.serial().printf("\r\n rx_max_count %d bytes", g_auxSerialCom_rx_max_count);
whismanoid 10:04022a61b527 7993 }
whismanoid 10:04022a61b527 7994 // int g_auxSerialCom_rx_eot = 0; //!< capture RX until match end of text char?
whismanoid 10:04022a61b527 7995 if (cmdLine.parse_int_dec("rx_eot", g_auxSerialCom_rx_eot))
whismanoid 10:04022a61b527 7996 {
whismanoid 10:04022a61b527 7997 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- rx_eot
whismanoid 10:04022a61b527 7998 //~ cmdLine_AUXserial.serial().printf("\r\n*** rx_eot was set to %d ***\r\n", g_auxSerialCom_rx_eot);
whismanoid 10:04022a61b527 7999 cmdLine.serial().printf("\r\n rx_eot %d", g_auxSerialCom_rx_eot);
whismanoid 10:04022a61b527 8000 }
whismanoid 10:04022a61b527 8001 }
whismanoid 10:04022a61b527 8002 // Command forwarding to AUX serial TX/RX cmdLine_AuxSerial #257 -- send outgoing_string
whismanoid 41:13a6a097502c 8003 char* outgoing_string = ""; // warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
whismanoid 40:330b28116178 8004 if (cmdLine[0] == '>') {
whismanoid 40:330b28116178 8005 outgoing_string = (char*)cmdLine.str();
whismanoid 40:330b28116178 8006 // > use key=value parsing
whismanoid 40:330b28116178 8007 // >> suppress key=value parsing
whismanoid 40:330b28116178 8008 if (suppress_parsing) {
whismanoid 40:330b28116178 8009 cmdLine.serial().printf("\r\n suppress_parsing outgoing_string=\"%s\"", outgoing_string);
whismanoid 40:330b28116178 8010 outgoing_string++; // skip the first '>'
whismanoid 40:330b28116178 8011 outgoing_string++; // skip the second '>'
whismanoid 40:330b28116178 8012 } else {
whismanoid 40:330b28116178 8013 // TODO: after parsing, key=value pairs should be deleted, but outgoing_string=">xyzzy abc=def"
whismanoid 40:330b28116178 8014 cmdLine.serial().printf("\r\n after parsing, outgoing_string=\"%s\"", outgoing_string);
whismanoid 40:330b28116178 8015 outgoing_string++; // skip the first '>'
whismanoid 40:330b28116178 8016 }
whismanoid 40:330b28116178 8017 } // if (cmdLine[0] == '>')
whismanoid 10:04022a61b527 8018 static char rx_string_buf[RX_STRING_BUF_SIZE];
whismanoid 10:04022a61b527 8019 unsigned int rx_string_length = 0;
whismanoid 40:330b28116178 8020 //cmdLine.serial().printf("\r\n >%s\r\n <", outgoing_string);
whismanoid 40:330b28116178 8021 //char* g_auxSerialCom_display_tx_prefix = "\r\n >";
whismanoid 40:330b28116178 8022 //char* g_auxSerialCom_display_rx_prefix = "\r\n< ";
whismanoid 40:330b28116178 8023 cmdLine.serial().printf("%s%s%s",
whismanoid 40:330b28116178 8024 g_auxSerialCom_display_tx_prefix, // "\r\n >"
whismanoid 40:330b28116178 8025 outgoing_string,
whismanoid 40:330b28116178 8026 g_auxSerialCom_display_rx_prefix // "\r\n <"
whismanoid 40:330b28116178 8027 );
whismanoid 10:04022a61b527 8028 rx_string_buf[0] = '\0';
whismanoid 10:04022a61b527 8029 rx_string_length = 0;
whismanoid 10:04022a61b527 8030 //
whismanoid 10:04022a61b527 8031 // int g_auxSerialCom_tx_wait_echo = 0; //!< TX wait for each character echo?
whismanoid 10:04022a61b527 8032 // int g_auxSerialCom_tx_char_delay_ms = 0; //!< TX delay after each char?
whismanoid 10:04022a61b527 8033 // int g_auxSerialCom_tx_line_delay_ms = 0; //!< TX delay after each CR/LF?
whismanoid 10:04022a61b527 8034 //
whismanoid 10:04022a61b527 8035 // int g_auxSerialCom_Timer_begin_message_ms = 0; //!< start of message
whismanoid 10:04022a61b527 8036 // int g_auxSerialCom_Timer_begin_rx_idle_ms = 0; //!< recent RX character timestamp
whismanoid 10:04022a61b527 8037 // int g_auxSerialCom_message_ms = 10000; //!< maximum RX message total response time
whismanoid 10:04022a61b527 8038 // int g_auxSerialCom_rx_idle_ms = 2000; //!< maximum RX message idle time between characters
whismanoid 10:04022a61b527 8039 // int g_auxSerialCom_rx_max_count = RX_STRING_BUF_SIZE-1; //!< maximum RX message total length
whismanoid 10:04022a61b527 8040 // int g_auxSerialCom_rx_eot = '\r'; //!< capture RX until match end of text char
whismanoid 10:04022a61b527 8041 //~ cmdLine_AuxSerial.serial().printf("\r\n*** TODO forward %s ***\r\n", outgoing_string);
whismanoid 10:04022a61b527 8042 //
whismanoid 10:04022a61b527 8043 // TODO: send whole string or send character-by-character?
whismanoid 40:330b28116178 8044 if (cmdLine[0] == '>') {
whismanoid 40:330b28116178 8045 cmdLine_AuxSerial.serial().printf("%s", outgoing_string);
whismanoid 40:330b28116178 8046 //
whismanoid 40:330b28116178 8047 // TODO: send CRLF or just send CR line end?
whismanoid 40:330b28116178 8048 if (g_auxSerialCom_outgoing_string_cr) { cmdLine_AuxSerial.serial().printf("\r"); }
whismanoid 40:330b28116178 8049 if (g_auxSerialCom_outgoing_string_lf) { cmdLine_AuxSerial.serial().printf("\n"); }
whismanoid 40:330b28116178 8050 // cmdLine_AuxSerial.serial().printf("\r\n");
whismanoid 40:330b28116178 8051 } // if (cmdLine[0] == '>')
whismanoid 40:330b28116178 8052 //
whismanoid 10:04022a61b527 8053 g_auxSerialCom_Timer.start();
whismanoid 10:04022a61b527 8054 g_auxSerialCom_Timer_begin_message_ms = g_auxSerialCom_Timer.read_ms(); // start of message
whismanoid 10:04022a61b527 8055 g_auxSerialCom_Timer_begin_rx_idle_ms = g_auxSerialCom_Timer.read_ms(); // recent RX character timestamp
whismanoid 10:04022a61b527 8056 while (rx_string_length < (RX_STRING_BUF_SIZE-1)) {
whismanoid 10:04022a61b527 8057 if ((g_auxSerialCom_Timer.read_ms() - g_auxSerialCom_Timer_begin_message_ms) > g_auxSerialCom_message_ms) {
whismanoid 10:04022a61b527 8058 cmdLine.serial().printf("\r\n message_ms timeout %dms", g_auxSerialCom_message_ms);
whismanoid 10:04022a61b527 8059 break;
whismanoid 10:04022a61b527 8060 }
whismanoid 10:04022a61b527 8061 if ((g_auxSerialCom_Timer.read_ms() - g_auxSerialCom_Timer_begin_rx_idle_ms) > g_auxSerialCom_rx_idle_ms) {
whismanoid 10:04022a61b527 8062 cmdLine.serial().printf("\r\n rx_idle_ms timeout %dms", g_auxSerialCom_rx_idle_ms);
whismanoid 10:04022a61b527 8063 break;
whismanoid 10:04022a61b527 8064 }
whismanoid 41:13a6a097502c 8065 if ((int)rx_string_length >= g_auxSerialCom_rx_max_count) {
whismanoid 10:04022a61b527 8066 cmdLine.serial().printf("\r\n rx_max_count %d bytes", g_auxSerialCom_rx_max_count);
whismanoid 10:04022a61b527 8067 break;
whismanoid 10:04022a61b527 8068 }
whismanoid 10:04022a61b527 8069 if (AuxSerial.readable()) {
whismanoid 10:04022a61b527 8070 g_auxSerialCom_Timer_begin_rx_idle_ms = g_auxSerialCom_Timer.read_ms(); // recent RX character timestamp
whismanoid 10:04022a61b527 8071 char ch = AuxSerial.getc();
whismanoid 10:04022a61b527 8072 rx_string_buf[rx_string_length++] = ch;
whismanoid 10:04022a61b527 8073 rx_string_buf[rx_string_length] = '\0'; // null terminate buffer
whismanoid 40:330b28116178 8074 //
whismanoid 40:330b28116178 8075 #if 1
whismanoid 40:330b28116178 8076 // immediate character echo
whismanoid 40:330b28116178 8077 for (char* cp = &(rx_string_buf[rx_string_length-1]); *cp != '\0'; cp++)
whismanoid 40:330b28116178 8078 {
whismanoid 40:330b28116178 8079 //cmdLine.serial().printf("\r\n <%s\r\n", rx_string_buf);
whismanoid 40:330b28116178 8080 if (need_g_auxSerialCom_display_rx_prefix) {
whismanoid 40:330b28116178 8081 cmdLine.serial().printf(g_auxSerialCom_display_rx_prefix); // "\r\n< " g_auxSerialCom_rx_string display prefix
whismanoid 40:330b28116178 8082 need_g_auxSerialCom_display_rx_prefix = 0;
whismanoid 40:330b28116178 8083 }
whismanoid 40:330b28116178 8084 if ((*cp) == '\r') {
whismanoid 40:330b28116178 8085 if (g_auxSerialCom_rx_string_verbose_crlf) { cmdLine.serial().printf("\\r"); }
whismanoid 40:330b28116178 8086 // if (*(cp+1) != '\n') { need_g_auxSerialCom_display_rx_prefix = 1; }
whismanoid 40:330b28116178 8087 } else if ((*cp) == '\n') {
whismanoid 40:330b28116178 8088 if (g_auxSerialCom_rx_string_verbose_crlf) { cmdLine.serial().printf("\\n"); }
whismanoid 40:330b28116178 8089 need_g_auxSerialCom_display_rx_prefix = 1;
whismanoid 40:330b28116178 8090 if (*(cp-1) != '\r') { need_g_auxSerialCom_display_rx_prefix = 1; }
whismanoid 40:330b28116178 8091 } else if ((*cp) < 0x20) {
whismanoid 40:330b28116178 8092 if (g_auxSerialCom_rx_string_verbose_ctrl) { cmdLine.serial().printf("\\x%2.2x", *cp); }
whismanoid 40:330b28116178 8093 } else if ((*cp) >= 0x7f) {
whismanoid 40:330b28116178 8094 if (g_auxSerialCom_rx_string_verbose_ctrl) { cmdLine.serial().printf("\\x%2.2x", *cp); }
whismanoid 40:330b28116178 8095 } else {
whismanoid 40:330b28116178 8096 cmdLine.serial().printf("%c", *cp);
whismanoid 40:330b28116178 8097 }
whismanoid 40:330b28116178 8098 }
whismanoid 40:330b28116178 8099 #else
whismanoid 40:330b28116178 8100 // immediate character echo
whismanoid 40:330b28116178 8101 cmdLine.serial().printf("%s", &(rx_string_buf[rx_string_length-1]) );
whismanoid 40:330b28116178 8102 #endif
whismanoid 40:330b28116178 8103 //
whismanoid 10:04022a61b527 8104 if (g_auxSerialCom_rx_eot != aux_serial_cmd_forwarding_rx_eot_not_used) {
whismanoid 10:04022a61b527 8105 if (ch == g_auxSerialCom_rx_eot) {
whismanoid 10:04022a61b527 8106 cmdLine.serial().printf("\r\n rx_eot %d", g_auxSerialCom_rx_eot);
whismanoid 10:04022a61b527 8107 break;
whismanoid 10:04022a61b527 8108 }
whismanoid 10:04022a61b527 8109 }
whismanoid 10:04022a61b527 8110 }
whismanoid 10:04022a61b527 8111 } // end while (rx_string_length < (RX_STRING_BUF_SIZE-1))
whismanoid 40:330b28116178 8112 #if 0
whismanoid 10:04022a61b527 8113 // print summary. is this needed? we already print aux rx as it is received.
whismanoid 10:04022a61b527 8114 rx_string_buf[rx_string_length] = '\0'; // null terminate buffer
whismanoid 40:330b28116178 8115 # if 1 // support multi-line rx_string_buf response
whismanoid 40:330b28116178 8116 if (cmdLine[0] == '>') {
whismanoid 40:330b28116178 8117 cmdLine.serial().printf("%s%s", g_auxSerialCom_display_tx_prefix, outgoing_string);
whismanoid 40:330b28116178 8118 } // if (cmdLine[0] == '>')
whismanoid 40:330b28116178 8119 // cmdLine.serial().printf("\r\n <"); // prefix
whismanoid 40:330b28116178 8120 need_g_auxSerialCom_display_rx_prefix = 1;
whismanoid 40:330b28116178 8121 for (char* cp = rx_string_buf; *cp != '\0'; cp++)
whismanoid 40:330b28116178 8122 {
whismanoid 40:330b28116178 8123 //cmdLine.serial().printf("\r\n <%s\r\n", rx_string_buf);
whismanoid 40:330b28116178 8124 if (need_g_auxSerialCom_display_rx_prefix) {
whismanoid 40:330b28116178 8125 cmdLine.serial().printf(g_auxSerialCom_display_rx_prefix); // "\r\n< " g_auxSerialCom_rx_string display prefix
whismanoid 40:330b28116178 8126 need_g_auxSerialCom_display_rx_prefix = 0;
whismanoid 40:330b28116178 8127 }
whismanoid 40:330b28116178 8128 if ((*cp) == '\r') {
whismanoid 40:330b28116178 8129 if (g_auxSerialCom_rx_string_verbose_crlf) { cmdLine.serial().printf("\\r"); }
whismanoid 40:330b28116178 8130 if (*(cp+1) != '\n') { need_g_auxSerialCom_display_rx_prefix = 1; }
whismanoid 40:330b28116178 8131 } else if ((*cp) == '\n') {
whismanoid 40:330b28116178 8132 if (g_auxSerialCom_rx_string_verbose_crlf) { cmdLine.serial().printf("\\n"); }
whismanoid 40:330b28116178 8133 need_g_auxSerialCom_display_rx_prefix = 1;
whismanoid 40:330b28116178 8134 } else if ((*cp) < 0x20) {
whismanoid 40:330b28116178 8135 if (g_auxSerialCom_rx_string_verbose_ctrl) { cmdLine.serial().printf("\\x%2.2x", *cp); }
whismanoid 40:330b28116178 8136 } else if ((*cp) >= 0x7f) {
whismanoid 40:330b28116178 8137 if (g_auxSerialCom_rx_string_verbose_ctrl) { cmdLine.serial().printf("\\x%2.2x", *cp); }
whismanoid 40:330b28116178 8138 } else {
whismanoid 40:330b28116178 8139 cmdLine.serial().printf("%c", *cp);
whismanoid 40:330b28116178 8140 }
whismanoid 40:330b28116178 8141 }
whismanoid 40:330b28116178 8142 cmdLine.serial().printf("\r\n");
whismanoid 40:330b28116178 8143 # else
whismanoid 10:04022a61b527 8144 cmdLine.serial().printf("\r\n >%s", outgoing_string);
whismanoid 10:04022a61b527 8145 cmdLine.serial().printf("\r\n <%s\r\n", rx_string_buf);
whismanoid 40:330b28116178 8146 # endif
whismanoid 10:04022a61b527 8147 #endif
whismanoid 10:04022a61b527 8148 //
whismanoid 10:04022a61b527 8149 }
whismanoid 10:04022a61b527 8150 break; // case '>'
whismanoid 10:04022a61b527 8151 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 8152 //
whismanoid 4:d9b05924ad4c 8153 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 4:d9b05924ad4c 8154 // TODO Datalog trigger menu
whismanoid 4:d9b05924ad4c 8155 // set Datalogger_Trigger to trigger_Halt or trigger_FreeRun
whismanoid 4:d9b05924ad4c 8156 // Datalogger_Trigger = trigger_Halt // halt the datalogger; continue accepting commands
whismanoid 4:d9b05924ad4c 8157 // Datalogger_Trigger = trigger_FreeRun // free run as fast as possible
whismanoid 9:45f98573eb6d 8158 case 'L': case 'l':
whismanoid 4:d9b05924ad4c 8159 {
whismanoid 4:d9b05924ad4c 8160 // halt the datalogger; continue accepting commands
whismanoid 4:d9b05924ad4c 8161 Datalogger_Trigger = trigger_Halt;
whismanoid 4:d9b05924ad4c 8162 switch (cmdLine[1])
whismanoid 4:d9b05924ad4c 8163 {
whismanoid 17:9397ea3ea7e9 8164 // LT%1.0fs -- Datalog timer sleep=%1.3f seconds g_timer_interval_msec
whismanoid 17:9397ea3ea7e9 8165 case 'T': case 't':
whismanoid 17:9397ea3ea7e9 8166 {
whismanoid 17:9397ea3ea7e9 8167 // timer (configure interval) "intermittent-sleep-mode"
whismanoid 17:9397ea3ea7e9 8168 Datalogger_Trigger = trigger_Timer;
whismanoid 17:9397ea3ea7e9 8169 Datalogger_Need_PrintHeader = true;
whismanoid 17:9397ea3ea7e9 8170 g_timer_interval_counter = 0;
whismanoid 39:4d285e961435 8171 // get g_timer_interval_msec from cmdLine
whismanoid 17:9397ea3ea7e9 8172 // g_timer_interval_msec = 500;
whismanoid 17:9397ea3ea7e9 8173 // g_timer_interval_count = 10;
whismanoid 17:9397ea3ea7e9 8174 if (cmdLine.parse_int_dec("count", g_timer_interval_count))
whismanoid 17:9397ea3ea7e9 8175 {
whismanoid 32:80f3e5eb77d4 8176 if (g_timer_interval_count < 1) { g_timer_interval_count = 1; }
whismanoid 17:9397ea3ea7e9 8177 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- message_ms
whismanoid 17:9397ea3ea7e9 8178 //~ cmdLine_AuxSerial.serial().printf("\r\n*** message_ms was set to %d ***\r\n", g_auxSerialCom_message_ms);
whismanoid 17:9397ea3ea7e9 8179 cmdLine.serial().printf("\r\n g_timer_interval_count=%d", g_timer_interval_count);
whismanoid 17:9397ea3ea7e9 8180 }
whismanoid 17:9397ea3ea7e9 8181 if (cmdLine.parse_int_dec("base", g_timer_interval_msec))
whismanoid 17:9397ea3ea7e9 8182 {
whismanoid 17:9397ea3ea7e9 8183 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- message_ms
whismanoid 17:9397ea3ea7e9 8184 //~ cmdLine_AuxSerial.serial().printf("\r\n*** message_ms was set to %d ***\r\n", g_auxSerialCom_message_ms);
whismanoid 17:9397ea3ea7e9 8185 cmdLine.serial().printf("\r\n g_timer_interval_msec=%d", g_timer_interval_msec);
whismanoid 17:9397ea3ea7e9 8186 }
whismanoid 39:4d285e961435 8187 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 8188 // USE_DATALOGGER_SLEEP -- support sleep modes in Datalogger_Trigger
whismanoid 39:4d285e961435 8189 int int_timer_sleepmode = g_timer_sleepmode;
whismanoid 39:4d285e961435 8190 if (cmdLine.parse_int_dec("sleep", int_timer_sleepmode))
whismanoid 39:4d285e961435 8191 {
whismanoid 39:4d285e961435 8192 g_timer_sleepmode = (Datalogger_Sleep_enum_t)int_timer_sleepmode;
whismanoid 39:4d285e961435 8193 //~ if (g_timer_interval_count < 1) { g_timer_interval_count = 1; }
whismanoid 39:4d285e961435 8194 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- message_ms
whismanoid 39:4d285e961435 8195 //~ cmdLine_AuxSerial.serial().printf("\r\n*** message_ms was set to %d ***\r\n", g_auxSerialCom_message_ms);
whismanoid 39:4d285e961435 8196 cmdLine.serial().printf("\r\n g_timer_sleepmode=%d", (int)g_timer_sleepmode);
whismanoid 39:4d285e961435 8197 }
whismanoid 39:4d285e961435 8198 #else // USE_DATALOGGER_SLEEP
whismanoid 39:4d285e961435 8199 #endif // USE_DATALOGGER_SLEEP
whismanoid 17:9397ea3ea7e9 8200 return; // instead of break; avoid falling through to print_command_prompt();
whismanoid 17:9397ea3ea7e9 8201 }
whismanoid 17:9397ea3ea7e9 8202 break;
whismanoid 17:9397ea3ea7e9 8203 // LIH3 -- Datalog when input high D3
whismanoid 17:9397ea3ea7e9 8204 // LIL6 -- Datalog when input low D6
whismanoid 17:9397ea3ea7e9 8205 case 'I': case 'i':
whismanoid 17:9397ea3ea7e9 8206 {
whismanoid 17:9397ea3ea7e9 8207 // TODO: switch cmdLine[2] configure High or Low, configure input pin
whismanoid 17:9397ea3ea7e9 8208 }
whismanoid 17:9397ea3ea7e9 8209 break;
whismanoid 17:9397ea3ea7e9 8210 #if USE_DATALOGGER_SPIDeviceRegRead
whismanoid 27:b4ac095b83b3 8211 // L$ count=10 base=500ms addr=xxx data=xxx mask=xxx -- Datalog when SPI read of address matches mask
whismanoid 17:9397ea3ea7e9 8212 case '$':
whismanoid 17:9397ea3ea7e9 8213 {
whismanoid 17:9397ea3ea7e9 8214 // TODO: scan cmdLine for regAddr, dataMask, testValue
whismanoid 17:9397ea3ea7e9 8215 }
whismanoid 17:9397ea3ea7e9 8216 break;
whismanoid 17:9397ea3ea7e9 8217 #endif // USE_DATALOGGER_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 8218 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 8219 // L@ -- configures Datalogger_action_table
whismanoid 17:9397ea3ea7e9 8220 case '@':
whismanoid 17:9397ea3ea7e9 8221 {
whismanoid 17:9397ea3ea7e9 8222 // L@ -- configures Datalogger_action_table
whismanoid 17:9397ea3ea7e9 8223 int editRowIndex = 0;
whismanoid 56:8469ffda6119 8224 // parse_action_table_args(cmdLine);
whismanoid 17:9397ea3ea7e9 8225 //
whismanoid 17:9397ea3ea7e9 8226 // Edit the contents of Datalogger_action_table
whismanoid 17:9397ea3ea7e9 8227 switch (cmdLine[2]) // L@... -- Edit the contents of Datalogger_action_table
whismanoid 17:9397ea3ea7e9 8228 {
whismanoid 17:9397ea3ea7e9 8229 // LT%1.0fs -- Datalog timer sleep=%1.3f seconds g_timer_interval_msec
whismanoid 17:9397ea3ea7e9 8230 case '0': case '1': case '2': case '3': case '4':
whismanoid 17:9397ea3ea7e9 8231 case '5': case '6': case '7': case '8': case '9':
whismanoid 17:9397ea3ea7e9 8232 // edit row data
whismanoid 30:07197a430869 8233 if (1) { // removed Datalogger_action_table_row_count > 0 -- support %L@nnn command add new row (even though this looks like a replace command) if and only if nnn==next new unassigned line number
whismanoid 17:9397ea3ea7e9 8234 // if Datalogger_action_table_row_count == 0 then the table is empty
whismanoid 17:9397ea3ea7e9 8235 // get row number to edit from cmdLine[2]
whismanoid 17:9397ea3ea7e9 8236 editRowIndex = atoi(cmdLine.str()+2);
whismanoid 30:07197a430869 8237 if ((editRowIndex >= 0) && (editRowIndex < Datalogger_action_table_row_count)) {
whismanoid 30:07197a430869 8238 // update row
whismanoid 30:07197a430869 8239 cmdLine.serial().printf("\r\n replace row %d", editRowIndex);
whismanoid 30:07197a430869 8240 // rescan cmdLine[2] for key=value of what fields to change (now that we have got defaults from the existing line
whismanoid 30:07197a430869 8241 edit_action = Datalogger_action_table[editRowIndex].action;
whismanoid 30:07197a430869 8242 edit_digitalOutPin = Datalogger_action_table[editRowIndex].digitalOutPin;
whismanoid 30:07197a430869 8243 edit_condition = Datalogger_action_table[editRowIndex].condition;
whismanoid 30:07197a430869 8244 edit_condition_channel = Datalogger_action_table[editRowIndex].condition_channel;
whismanoid 30:07197a430869 8245 edit_condition_threshold = Datalogger_action_table[editRowIndex].condition_threshold;
whismanoid 30:07197a430869 8246 // rescan cmdLine[2] for key=value of what fields to change (now that we have got defaults from the existing line
whismanoid 53:fdb510e3eb37 8247 parse_action_table_args(cmdLine);
whismanoid 30:07197a430869 8248 Datalogger_action_table[editRowIndex].action = (action_type_enum_t)edit_action;
whismanoid 30:07197a430869 8249 Datalogger_action_table[editRowIndex].digitalOutPin = edit_digitalOutPin;
whismanoid 30:07197a430869 8250 Datalogger_action_table[editRowIndex].condition = (action_condition_enum_t)edit_condition;
whismanoid 30:07197a430869 8251 Datalogger_action_table[editRowIndex].condition_channel = edit_condition_channel;
whismanoid 30:07197a430869 8252 Datalogger_action_table[editRowIndex].condition_threshold = edit_condition_threshold;
whismanoid 17:9397ea3ea7e9 8253 }
whismanoid 30:07197a430869 8254 else if ((editRowIndex == Datalogger_action_table_row_count) && (Datalogger_action_table_row_count < ACTION_TABLE_ROW_MAX)) {
whismanoid 30:07197a430869 8255 // %L@nnn command add new row (even though this looks like a replace command) if and only if nnn==next new unassigned line number
whismanoid 56:8469ffda6119 8256 parse_action_table_args(cmdLine);
whismanoid 30:07197a430869 8257 Datalogger_action_table_row_count++;
whismanoid 30:07197a430869 8258 cmdLine.serial().printf("\r\n add next row %d", editRowIndex);
whismanoid 30:07197a430869 8259 Datalogger_action_table[editRowIndex].action = (action_type_enum_t)edit_action;
whismanoid 30:07197a430869 8260 Datalogger_action_table[editRowIndex].digitalOutPin = edit_digitalOutPin;
whismanoid 30:07197a430869 8261 Datalogger_action_table[editRowIndex].condition = (action_condition_enum_t)edit_condition;
whismanoid 30:07197a430869 8262 Datalogger_action_table[editRowIndex].condition_channel = edit_condition_channel;
whismanoid 30:07197a430869 8263 Datalogger_action_table[editRowIndex].condition_threshold = edit_condition_threshold;
whismanoid 30:07197a430869 8264 //
whismanoid 17:9397ea3ea7e9 8265 }
whismanoid 17:9397ea3ea7e9 8266 }
whismanoid 17:9397ea3ea7e9 8267 break;
whismanoid 17:9397ea3ea7e9 8268 case '+':
whismanoid 17:9397ea3ea7e9 8269 // add a new row at end of table
whismanoid 17:9397ea3ea7e9 8270 if (Datalogger_action_table_row_count < ACTION_TABLE_ROW_MAX) {
whismanoid 17:9397ea3ea7e9 8271 // if Datalogger_action_table_row_count => ACTION_TABLE_ROW_MAX then the table is full
whismanoid 56:8469ffda6119 8272 parse_action_table_args(cmdLine);
whismanoid 17:9397ea3ea7e9 8273 editRowIndex = Datalogger_action_table_row_count;
whismanoid 17:9397ea3ea7e9 8274 Datalogger_action_table_row_count++;
whismanoid 30:07197a430869 8275 cmdLine.serial().printf("\r\n add new row %d", editRowIndex);
whismanoid 17:9397ea3ea7e9 8276 Datalogger_action_table[editRowIndex].action = (action_type_enum_t)edit_action;
whismanoid 17:9397ea3ea7e9 8277 Datalogger_action_table[editRowIndex].digitalOutPin = edit_digitalOutPin;
whismanoid 17:9397ea3ea7e9 8278 Datalogger_action_table[editRowIndex].condition = (action_condition_enum_t)edit_condition;
whismanoid 17:9397ea3ea7e9 8279 Datalogger_action_table[editRowIndex].condition_channel = edit_condition_channel;
whismanoid 17:9397ea3ea7e9 8280 Datalogger_action_table[editRowIndex].condition_threshold = edit_condition_threshold;
whismanoid 17:9397ea3ea7e9 8281 }
whismanoid 17:9397ea3ea7e9 8282 break;
whismanoid 17:9397ea3ea7e9 8283 case '-':
whismanoid 17:9397ea3ea7e9 8284 // delete row from table
whismanoid 17:9397ea3ea7e9 8285 if (Datalogger_action_table_row_count > 0) {
whismanoid 17:9397ea3ea7e9 8286 // if Datalogger_action_table_row_count == 0 then the table is empty
whismanoid 17:9397ea3ea7e9 8287 if ((cmdLine[3] == '~') && (cmdLine[4] == '~') && (cmdLine[5] == '~')) {
whismanoid 17:9397ea3ea7e9 8288 // L@-~~~ -- delete all rows from table
whismanoid 30:07197a430869 8289 cmdLine.serial().printf("\r\n delete all rows");
whismanoid 17:9397ea3ea7e9 8290 Datalogger_action_table_row_count = 0;
whismanoid 17:9397ea3ea7e9 8291 break;
whismanoid 17:9397ea3ea7e9 8292 }
whismanoid 30:07197a430869 8293 else {
whismanoid 30:07197a430869 8294 editRowIndex = atoi(cmdLine.str()+3);
whismanoid 30:07197a430869 8295 cmdLine.serial().printf("\r\n delete row %d", editRowIndex);
whismanoid 30:07197a430869 8296 // delete row editRowIndex from Datalogger_action_table
whismanoid 30:07197a430869 8297 for (int i = editRowIndex; i < (Datalogger_action_table_row_count-1); i++)
whismanoid 30:07197a430869 8298 {
whismanoid 30:07197a430869 8299 // copy row i+1 into row i
whismanoid 30:07197a430869 8300 Datalogger_action_table[i].action = Datalogger_action_table[i+1].action;
whismanoid 30:07197a430869 8301 Datalogger_action_table[i].digitalOutPin = Datalogger_action_table[i+1].digitalOutPin;
whismanoid 30:07197a430869 8302 Datalogger_action_table[i].condition = Datalogger_action_table[i+1].condition;
whismanoid 30:07197a430869 8303 Datalogger_action_table[i].condition_channel = Datalogger_action_table[i+1].condition_channel;
whismanoid 30:07197a430869 8304 Datalogger_action_table[i].condition_threshold = Datalogger_action_table[i+1].condition_threshold;
whismanoid 30:07197a430869 8305 }
whismanoid 30:07197a430869 8306 Datalogger_action_table_row_count--;
whismanoid 17:9397ea3ea7e9 8307 }
whismanoid 17:9397ea3ea7e9 8308 }
whismanoid 17:9397ea3ea7e9 8309 break;
whismanoid 30:07197a430869 8310 case '.':
whismanoid 30:07197a430869 8311 // L@. pause the entire Log action table
whismanoid 30:07197a430869 8312 cmdLine.serial().printf("\r\n pause the entire Log action table");
whismanoid 17:9397ea3ea7e9 8313 Datalogger_action_table_enabled = false;
whismanoid 17:9397ea3ea7e9 8314 break;
whismanoid 17:9397ea3ea7e9 8315 case '@':
whismanoid 30:07197a430869 8316 // L@@ enable the entire Log action table
whismanoid 30:07197a430869 8317 cmdLine.serial().printf("\r\n enable the entire Log action table");
whismanoid 17:9397ea3ea7e9 8318 Datalogger_action_table_enabled = true;
whismanoid 17:9397ea3ea7e9 8319 break;
whismanoid 53:fdb510e3eb37 8320 } // end switch (cmdLine[2]) // L@... -- Edit the contents of Datalogger_action_table
whismanoid 17:9397ea3ea7e9 8321 //
whismanoid 17:9397ea3ea7e9 8322 // Print the contents of Datalogger_action_table
whismanoid 53:fdb510e3eb37 8323 cmdLine.serial().printf("sequence performed on each datalog row:");
whismanoid 17:9397ea3ea7e9 8324 if (Datalogger_action_table_enabled) {
whismanoid 30:07197a430869 8325 // cmdLine.serial().printf("Log action table enabled; L@. to pause");
whismanoid 17:9397ea3ea7e9 8326 }
whismanoid 17:9397ea3ea7e9 8327 else {
whismanoid 30:07197a430869 8328 cmdLine.serial().printf("Log action table paused; L@@ to enable");
whismanoid 17:9397ea3ea7e9 8329 }
whismanoid 17:9397ea3ea7e9 8330 //~ cmdLine.serial().printf("\r\n Datalogger_action_table_row_count=%d", Datalogger_action_table_row_count);
whismanoid 17:9397ea3ea7e9 8331 for (int i = 0; i < Datalogger_action_table_row_count; i++)
whismanoid 17:9397ea3ea7e9 8332 {
whismanoid 17:9397ea3ea7e9 8333 cmdLine.serial().printf("\r\n L@%d", i);
whismanoid 17:9397ea3ea7e9 8334 cmdLine.serial().printf(" act=%d", Datalogger_action_table[i].action);
whismanoid 17:9397ea3ea7e9 8335 switch(Datalogger_action_table[i].action)
whismanoid 17:9397ea3ea7e9 8336 {
whismanoid 17:9397ea3ea7e9 8337 case action_digitalOutLow:
whismanoid 17:9397ea3ea7e9 8338 case action_digitalOutHigh:
whismanoid 17:9397ea3ea7e9 8339 cmdLine.serial().printf(" pin=%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 17:9397ea3ea7e9 8340 break;
whismanoid 29:6a9edb6e973b 8341 case action_button: // pin = button index 1, 2, 3
whismanoid 29:6a9edb6e973b 8342 cmdLine.serial().printf(" pin=%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 29:6a9edb6e973b 8343 break;
whismanoid 17:9397ea3ea7e9 8344 default:
whismanoid 17:9397ea3ea7e9 8345 case action_noop:
whismanoid 17:9397ea3ea7e9 8346 case action_trigger_Halt:
whismanoid 17:9397ea3ea7e9 8347 case action_trigger_FreeRun:
whismanoid 17:9397ea3ea7e9 8348 case action_trigger_Timer:
whismanoid 17:9397ea3ea7e9 8349 case action_trigger_PlatformDigitalInput:
whismanoid 17:9397ea3ea7e9 8350 case action_trigger_SPIDeviceRegRead:
whismanoid 17:9397ea3ea7e9 8351 break;
whismanoid 17:9397ea3ea7e9 8352 }
whismanoid 17:9397ea3ea7e9 8353 switch(Datalogger_action_table[i].condition)
whismanoid 17:9397ea3ea7e9 8354 {
whismanoid 17:9397ea3ea7e9 8355 case condition_always:
whismanoid 17:9397ea3ea7e9 8356 break;
whismanoid 17:9397ea3ea7e9 8357 default:
whismanoid 17:9397ea3ea7e9 8358 case condition_if_An_gt_threshold:
whismanoid 17:9397ea3ea7e9 8359 case condition_if_An_lt_threshold:
whismanoid 17:9397ea3ea7e9 8360 case condition_if_An_eq_threshold:
whismanoid 17:9397ea3ea7e9 8361 case condition_if_An_ge_threshold:
whismanoid 17:9397ea3ea7e9 8362 case condition_if_An_le_threshold:
whismanoid 17:9397ea3ea7e9 8363 case condition_if_An_ne_threshold:
whismanoid 17:9397ea3ea7e9 8364 case condition_if_AINn_gt_threshold:
whismanoid 17:9397ea3ea7e9 8365 case condition_if_AINn_lt_threshold:
whismanoid 17:9397ea3ea7e9 8366 case condition_if_AINn_eq_threshold:
whismanoid 17:9397ea3ea7e9 8367 case condition_if_AINn_ge_threshold:
whismanoid 17:9397ea3ea7e9 8368 case condition_if_AINn_le_threshold:
whismanoid 17:9397ea3ea7e9 8369 case condition_if_AINn_ne_threshold:
whismanoid 17:9397ea3ea7e9 8370 cmdLine.serial().printf(" if=%d", Datalogger_action_table[i].condition);
whismanoid 17:9397ea3ea7e9 8371 cmdLine.serial().printf(" ch=%d", Datalogger_action_table[i].condition_channel);
whismanoid 40:330b28116178 8372 // our voltage measurement is around 1mV at best
whismanoid 40:330b28116178 8373 cmdLine.serial().printf(" x=%1.4f", Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8374 break;
whismanoid 17:9397ea3ea7e9 8375 }
whismanoid 17:9397ea3ea7e9 8376 cmdLine.serial().printf(" -- ");
whismanoid 17:9397ea3ea7e9 8377 switch(Datalogger_action_table[i].action)
whismanoid 17:9397ea3ea7e9 8378 {
whismanoid 17:9397ea3ea7e9 8379 case action_noop:
whismanoid 53:fdb510e3eb37 8380 //~ cmdLine.serial().printf("No_Operation");
whismanoid 53:fdb510e3eb37 8381 cmdLine.serial().printf("nop");
whismanoid 17:9397ea3ea7e9 8382 break;
whismanoid 17:9397ea3ea7e9 8383 case action_digitalOutLow:
whismanoid 53:fdb510e3eb37 8384 //~ cmdLine.serial().printf("digitalOutLow");
whismanoid 53:fdb510e3eb37 8385 //~ cmdLine.serial().printf(" D%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 53:fdb510e3eb37 8386 cmdLine.serial().printf("Lpin=%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 17:9397ea3ea7e9 8387 break;
whismanoid 17:9397ea3ea7e9 8388 case action_digitalOutHigh:
whismanoid 53:fdb510e3eb37 8389 //~ cmdLine.serial().printf("digitalOutHigh");
whismanoid 53:fdb510e3eb37 8390 //~ cmdLine.serial().printf(" D%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 53:fdb510e3eb37 8391 cmdLine.serial().printf("Hpin=%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 17:9397ea3ea7e9 8392 break;
whismanoid 29:6a9edb6e973b 8393 case action_button: // pin = button index 1, 2, 3
whismanoid 53:fdb510e3eb37 8394 //~ cmdLine.serial().printf("button %%B%d!", Datalogger_action_table[i].digitalOutPin);
whismanoid 53:fdb510e3eb37 8395 cmdLine.serial().printf("btn=%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 53:fdb510e3eb37 8396 cmdLine.serial().printf(" %%B%d!", Datalogger_action_table[i].digitalOutPin);
whismanoid 29:6a9edb6e973b 8397 break;
whismanoid 17:9397ea3ea7e9 8398 case action_trigger_Halt:
whismanoid 53:fdb510e3eb37 8399 //~ cmdLine.serial().printf("Halt");
whismanoid 40:330b28116178 8400 cmdLine.serial().printf("Halt");
whismanoid 17:9397ea3ea7e9 8401 break;
whismanoid 17:9397ea3ea7e9 8402 case action_trigger_FreeRun:
whismanoid 53:fdb510e3eb37 8403 //~ cmdLine.serial().printf("LR");
whismanoid 53:fdb510e3eb37 8404 cmdLine.serial().printf("run_LR");
whismanoid 17:9397ea3ea7e9 8405 break;
whismanoid 17:9397ea3ea7e9 8406 case action_trigger_Timer:
whismanoid 53:fdb510e3eb37 8407 //~ cmdLine.serial().printf("LT count=%d base=%dms", g_timer_interval_count, g_timer_interval_msec);
whismanoid 53:fdb510e3eb37 8408 cmdLine.serial().printf("timer_LT count=%d base=%dms", g_timer_interval_count, g_timer_interval_msec);
whismanoid 45:74bf1fe021e5 8409 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 8410 cmdLine.serial().printf(" sleep=%d", g_timer_sleepmode);
whismanoid 45:74bf1fe021e5 8411 #endif // USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 17:9397ea3ea7e9 8412 break;
whismanoid 17:9397ea3ea7e9 8413 case action_trigger_PlatformDigitalInput:
whismanoid 53:fdb510e3eb37 8414 //~ cmdLine.serial().printf("trigger_PlatformDigitalInput");
whismanoid 53:fdb510e3eb37 8415 cmdLine.serial().printf("pinIN=%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 17:9397ea3ea7e9 8416 // TODO: print configuration for trigger_PlatformDigitalInput
whismanoid 17:9397ea3ea7e9 8417 //~ cmdLine.serial().printf("(%d)", g_config_PlatformDigitalInput);
whismanoid 17:9397ea3ea7e9 8418 break;
whismanoid 17:9397ea3ea7e9 8419 case action_trigger_SPIDeviceRegRead:
whismanoid 53:fdb510e3eb37 8420 //~ cmdLine.serial().printf("trigger_SPIDeviceRegRead");
whismanoid 53:fdb510e3eb37 8421 cmdLine.serial().printf("SPI");
whismanoid 17:9397ea3ea7e9 8422 // TODO: print configuration for trigger_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 8423 //~ cmdLine.serial().printf("(%d)", g_config_SPIDeviceRegRead);
whismanoid 17:9397ea3ea7e9 8424 break;
whismanoid 17:9397ea3ea7e9 8425 } // switch(Datalogger_action_table[i].action)
whismanoid 17:9397ea3ea7e9 8426 //~ cmdLine.serial().printf(" condition %d", Datalogger_action_table[i].condition);
whismanoid 55:477ba09475d7 8427 // WIP Datalog Math -- if channel has its math enabled, compare with the math-adjusted version. Keep it simple. #362
whismanoid 17:9397ea3ea7e9 8428 switch(Datalogger_action_table[i].condition)
whismanoid 17:9397ea3ea7e9 8429 {
whismanoid 17:9397ea3ea7e9 8430 case condition_always:
whismanoid 17:9397ea3ea7e9 8431 cmdLine.serial().printf(" always");
whismanoid 17:9397ea3ea7e9 8432 break;
whismanoid 17:9397ea3ea7e9 8433 case condition_if_An_gt_threshold:
whismanoid 59:89713c92669f 8434 cmdLine.serial().printf(" A%dgtX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 40:330b28116178 8435 cmdLine.serial().printf(" if A%d > %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8436 break;
whismanoid 17:9397ea3ea7e9 8437 case condition_if_An_lt_threshold:
whismanoid 59:89713c92669f 8438 cmdLine.serial().printf(" A%dltX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 40:330b28116178 8439 cmdLine.serial().printf(" if A%d < %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8440 break;
whismanoid 17:9397ea3ea7e9 8441 case condition_if_An_eq_threshold:
whismanoid 59:89713c92669f 8442 cmdLine.serial().printf(" A%deqX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 40:330b28116178 8443 cmdLine.serial().printf(" if A%d == %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8444 break;
whismanoid 17:9397ea3ea7e9 8445 case condition_if_An_ge_threshold:
whismanoid 59:89713c92669f 8446 cmdLine.serial().printf(" A%dgeX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 40:330b28116178 8447 cmdLine.serial().printf(" if A%d >= %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8448 break;
whismanoid 17:9397ea3ea7e9 8449 case condition_if_An_le_threshold:
whismanoid 59:89713c92669f 8450 cmdLine.serial().printf(" A%dleX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 40:330b28116178 8451 cmdLine.serial().printf(" if A%d <= %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8452 break;
whismanoid 17:9397ea3ea7e9 8453 case condition_if_An_ne_threshold:
whismanoid 59:89713c92669f 8454 cmdLine.serial().printf(" A%dneX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 40:330b28116178 8455 cmdLine.serial().printf(" if A%d != %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8456 break;
whismanoid 17:9397ea3ea7e9 8457 case condition_if_AINn_gt_threshold:
whismanoid 59:89713c92669f 8458 cmdLine.serial().printf(" AIN%dgtX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 40:330b28116178 8459 cmdLine.serial().printf(" if AIN%d > %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8460 break;
whismanoid 17:9397ea3ea7e9 8461 case condition_if_AINn_lt_threshold:
whismanoid 59:89713c92669f 8462 cmdLine.serial().printf(" AIN%dleX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 40:330b28116178 8463 cmdLine.serial().printf(" if AIN%d < %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8464 break;
whismanoid 17:9397ea3ea7e9 8465 case condition_if_AINn_eq_threshold:
whismanoid 59:89713c92669f 8466 cmdLine.serial().printf(" AIN%deqX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 40:330b28116178 8467 cmdLine.serial().printf(" if AIN%d == %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8468 break;
whismanoid 17:9397ea3ea7e9 8469 case condition_if_AINn_ge_threshold:
whismanoid 59:89713c92669f 8470 cmdLine.serial().printf(" AIN%dgeX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 40:330b28116178 8471 cmdLine.serial().printf(" if AIN%d >= %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8472 break;
whismanoid 17:9397ea3ea7e9 8473 case condition_if_AINn_le_threshold:
whismanoid 59:89713c92669f 8474 cmdLine.serial().printf(" AIN%dleX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 40:330b28116178 8475 cmdLine.serial().printf(" if AIN%d <= %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8476 break;
whismanoid 17:9397ea3ea7e9 8477 case condition_if_AINn_ne_threshold:
whismanoid 59:89713c92669f 8478 cmdLine.serial().printf(" AIN%dneX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 40:330b28116178 8479 cmdLine.serial().printf(" if AIN%d != %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8480 break;
whismanoid 17:9397ea3ea7e9 8481 } // switch(Datalogger_action_table[i].condition)
whismanoid 17:9397ea3ea7e9 8482 } // for ...Datalogger_action_table_row_count // Print the contents of Datalogger_action_table
whismanoid 30:07197a430869 8483 cmdLine.serial().printf("\r\n\r\nEdit Log action table (used %d/%d, %d free):",
whismanoid 30:07197a430869 8484 Datalogger_action_table_row_count,
whismanoid 30:07197a430869 8485 ACTION_TABLE_ROW_MAX,
whismanoid 30:07197a430869 8486 (ACTION_TABLE_ROW_MAX - Datalogger_action_table_row_count)
whismanoid 30:07197a430869 8487 );
whismanoid 17:9397ea3ea7e9 8488 if (Datalogger_action_table_row_count < ACTION_TABLE_ROW_MAX) {
whismanoid 17:9397ea3ea7e9 8489 // if Datalogger_action_table_row_count => ACTION_TABLE_ROW_MAX then the table is full
whismanoid 60:129bc521f88c 8490 cmdLine.serial().printf("\r\n L@+ Hpin=92 always -- add new entry at end of table");
whismanoid 17:9397ea3ea7e9 8491 }
whismanoid 17:9397ea3ea7e9 8492 if (Datalogger_action_table_row_count > 0) {
whismanoid 17:9397ea3ea7e9 8493 // if Datalogger_action_table_row_count == 0 then the table is empty
whismanoid 60:129bc521f88c 8494 cmdLine.serial().printf("\r\n L@%d Lpin=92 A5gtx=12345 -- edit row %d",
whismanoid 17:9397ea3ea7e9 8495 Datalogger_action_table_row_count-1,
whismanoid 17:9397ea3ea7e9 8496 Datalogger_action_table_row_count-1);
whismanoid 17:9397ea3ea7e9 8497 cmdLine.serial().printf("\r\n L@-%d -- delete row %d",
whismanoid 17:9397ea3ea7e9 8498 Datalogger_action_table_row_count-1,
whismanoid 17:9397ea3ea7e9 8499 Datalogger_action_table_row_count-1);
whismanoid 17:9397ea3ea7e9 8500 cmdLine.serial().printf("\r\n L@-~~~ -- delete all rows");
whismanoid 30:07197a430869 8501 if (Datalogger_action_table_enabled) cmdLine.serial().printf("\r\n L@. -- pause entire Log action table");
whismanoid 30:07197a430869 8502 if (!Datalogger_action_table_enabled) cmdLine.serial().printf("\r\n L@@ -- enable Log action table");
whismanoid 17:9397ea3ea7e9 8503 }
whismanoid 17:9397ea3ea7e9 8504 //
whismanoid 17:9397ea3ea7e9 8505 } // case L@ -- configures Datalogger_action_table
whismanoid 17:9397ea3ea7e9 8506 break;
whismanoid 17:9397ea3ea7e9 8507 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 8508 // LR -- Datalog free run as fast as possible
whismanoid 4:d9b05924ad4c 8509 case 'R': case 'r':
whismanoid 4:d9b05924ad4c 8510 // free run as fast as possible
whismanoid 8:dffee7509bfb 8511 Datalogger_Trigger = trigger_FreeRun;
whismanoid 8:dffee7509bfb 8512 Datalogger_Need_PrintHeader = true;
whismanoid 4:d9b05924ad4c 8513 return; // instead of break; avoid falling through to print_command_prompt();
whismanoid 9:45f98573eb6d 8514 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 8515 // LS<channel ID><verb>: Configure SPI_AIN channels
whismanoid 9:45f98573eb6d 8516 // channel ID: 0,1,2,... or - for all channels
whismanoid 9:45f98573eb6d 8517 // verb: D for disable, V for Voltage, L for LSB
whismanoid 9:45f98573eb6d 8518 case 'S': case 's':
whismanoid 9:45f98573eb6d 8519 {
whismanoid 9:45f98573eb6d 8520 for (int channel_index = 0; channel_index < NUM_DUT_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 9:45f98573eb6d 8521 if ((cmdLine[2] == '-' /* all channels */)
whismanoid 9:45f98573eb6d 8522 || (cmdLine[2] == '0'+channel_index)
whismanoid 9:45f98573eb6d 8523 )
whismanoid 9:45f98573eb6d 8524 {
whismanoid 9:45f98573eb6d 8525 // it's me
whismanoid 55:477ba09475d7 8526 #if HAS_SPI_AIN_customChannelHeader
whismanoid 55:477ba09475d7 8527 // WIP Editable customChannelHeader strings #363 - LS__ header= -- update SPI_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 8528 // menu LS__ header=xyzzy -- custom channel header
whismanoid 55:477ba09475d7 8529 if (cmdLine.parse_and_remove_key("header",
whismanoid 55:477ba09475d7 8530 SPI_AIN_customChannelHeader_ch[channel_index],
whismanoid 55:477ba09475d7 8531 SPI_AIN_customChannelHeader_ch_MAXLENGTH))
whismanoid 55:477ba09475d7 8532 {
whismanoid 55:477ba09475d7 8533 cmdLine.serial().printf("\r\n LS%d%c header=%s", channel_index, cmdLine[3], SPI_AIN_customChannelHeader_ch[channel_index]);
whismanoid 55:477ba09475d7 8534 // SPI_AIN_customChannelHeader_ch[channel_index] was updated
whismanoid 55:477ba09475d7 8535 if (cmdLine[2] == '-' /* all channels */)
whismanoid 55:477ba09475d7 8536 { // LS-_ header= -- all channels custom header
whismanoid 55:477ba09475d7 8537 cmdLine.serial().printf("\r\n LS%c%c -- all channels", cmdLine[2], cmdLine[3]);
whismanoid 55:477ba09475d7 8538 for (int cx = 0; cx < NUM_DUT_ANALOG_IN_CHANNELS; cx++)
whismanoid 55:477ba09475d7 8539 {
whismanoid 55:477ba09475d7 8540 if (cx != channel_index)
whismanoid 55:477ba09475d7 8541 {
whismanoid 55:477ba09475d7 8542 // strncpy(char* dst, const char* src, size_t n)
whismanoid 55:477ba09475d7 8543 strncpy(SPI_AIN_customChannelHeader_ch[cx],
whismanoid 55:477ba09475d7 8544 SPI_AIN_customChannelHeader_ch[channel_index],
whismanoid 55:477ba09475d7 8545 SPI_AIN_customChannelHeader_MAXLENGTH);
whismanoid 55:477ba09475d7 8546 cmdLine.serial().printf("\r\n LS%d%c header=%s", cx, cmdLine[3], SPI_AIN_customChannelHeader_ch[cx]);
whismanoid 55:477ba09475d7 8547 }
whismanoid 55:477ba09475d7 8548 }
whismanoid 55:477ba09475d7 8549 }
whismanoid 55:477ba09475d7 8550 else
whismanoid 55:477ba09475d7 8551 {
whismanoid 55:477ba09475d7 8552 cmdLine.serial().printf("\r\n LS%c%c -- single channel", cmdLine[2], cmdLine[3]);
whismanoid 55:477ba09475d7 8553 }
whismanoid 55:477ba09475d7 8554 }
whismanoid 55:477ba09475d7 8555 #endif // HAS_SPI_AIN_customChannelHeader
whismanoid 9:45f98573eb6d 8556 // test cmdLine[3] to determine action
whismanoid 9:45f98573eb6d 8557 // Platform_Enable_ch[channel_index] = Platform_AIN_xxxxx;
whismanoid 9:45f98573eb6d 8558 switch (cmdLine[3])
whismanoid 9:45f98573eb6d 8559 {
whismanoid 9:45f98573eb6d 8560 case 'D': case 'd':
whismanoid 9:45f98573eb6d 8561 SPI_AIN_Enable_ch[channel_index] = SPI_AIN_Disable;
whismanoid 9:45f98573eb6d 8562 break;
whismanoid 9:45f98573eb6d 8563 case 'L': case 'l':
whismanoid 9:45f98573eb6d 8564 SPI_AIN_Enable_ch[channel_index] = SPI_AIN_Enable_LSB;
whismanoid 9:45f98573eb6d 8565 break;
whismanoid 9:45f98573eb6d 8566 case 'V': case 'v':
whismanoid 9:45f98573eb6d 8567 SPI_AIN_Enable_ch[channel_index] = SPI_AIN_Enable_Volt;
whismanoid 9:45f98573eb6d 8568 break;
whismanoid 9:45f98573eb6d 8569 //
whismanoid 55:477ba09475d7 8570 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 8571 // MAX40108 Datalog Math #362 -- menu LS_M_ SPI_AIN Math channels configuration SPI_AIN_MATH
whismanoid 55:477ba09475d7 8572 case 'M': case 'm':
whismanoid 55:477ba09475d7 8573 switch (cmdLine[4])
whismanoid 55:477ba09475d7 8574 {
whismanoid 55:477ba09475d7 8575 case 'D': case 'd':
whismanoid 55:477ba09475d7 8576 SPI_AIN_Enable_Math_ch[channel_index] = Platform_AIN_Disable;
whismanoid 55:477ba09475d7 8577 break;
whismanoid 55:477ba09475d7 8578 case 'L': case 'l':
whismanoid 55:477ba09475d7 8579 SPI_AIN_Enable_Math_ch[channel_index] = Platform_AIN_Enable_LSB;
whismanoid 55:477ba09475d7 8580 break;
whismanoid 55:477ba09475d7 8581 case 'V': case 'v':
whismanoid 55:477ba09475d7 8582 SPI_AIN_Enable_Math_ch[channel_index] = Platform_AIN_Enable_Volt;
whismanoid 55:477ba09475d7 8583 break;
whismanoid 55:477ba09475d7 8584 default:
whismanoid 55:477ba09475d7 8585 SPI_AIN_Enable_ch[channel_index] = Platform_AIN_Enable_Math_Volt;
whismanoid 55:477ba09475d7 8586 break;
whismanoid 55:477ba09475d7 8587 }
whismanoid 55:477ba09475d7 8588 //
whismanoid 55:477ba09475d7 8589 // MAX40108 Datalog Math #362 -- menu LS_M_ parse mul=? update SPI_AIN_MathGainMulA[ch] SPI_AIN_MATH
whismanoid 55:477ba09475d7 8590 cmdLine.parse_double("mul", SPI_AIN_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 8591 //
whismanoid 55:477ba09475d7 8592 // MAX40108 Datalog Math #362 -- menu LS_M_ parse div=? update SPI_AIN_MathGainDivA[ch] SPI_AIN_MATH
whismanoid 55:477ba09475d7 8593 cmdLine.parse_double("div", SPI_AIN_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 8594 //
whismanoid 55:477ba09475d7 8595 // MAX40108 Datalog Math #362 -- menu LS_M_ parse unit=nA update SPI_AIN_MathUnitString[ch] SPI_AIN_MATH
whismanoid 55:477ba09475d7 8596 // cmdLine.parse_key("unit", SPI_AIN_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 8597 // WIP Editable customChannelHeader strings #363 - LS_M unit= -- update SPI_AIN_MathUnitString
whismanoid 55:477ba09475d7 8598 if (cmdLine.parse_and_remove_key("unit",
whismanoid 55:477ba09475d7 8599 SPI_AIN_MathUnitString[channel_index],
whismanoid 55:477ba09475d7 8600 SPI_AIN_MathUnitString_MAXLENGTH))
whismanoid 55:477ba09475d7 8601 {
whismanoid 55:477ba09475d7 8602 // SPI_AIN_MathUnitString[channel_index] was updated
whismanoid 55:477ba09475d7 8603 }
whismanoid 55:477ba09475d7 8604 //
whismanoid 55:477ba09475d7 8605 // MAX40108 Datalog Math #362 -- menu LS_M_ parse o=? update SPI_AIN_MathOffsetA[ch] SPI_AIN_MATH
whismanoid 55:477ba09475d7 8606 // parse o=? last, otherwise can't have unit string with letter "o" in it due to conflict...
whismanoid 55:477ba09475d7 8607 cmdLine.parse_double("o", SPI_AIN_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 8608 //
whismanoid 55:477ba09475d7 8609 // MAX40108 Datalog Math #362 -- menu LS_M_ always print the values of o=? mul=? div=? unit=nA SPI_AIN_MATH
whismanoid 55:477ba09475d7 8610 cmdLine.serial().printf("\r\n", channel_index);
whismanoid 55:477ba09475d7 8611 // if (cmdLine[2] == '-' /* all channels */) {
whismanoid 55:477ba09475d7 8612 cmdLine.serial().printf("LS%dM", channel_index);
whismanoid 55:477ba09475d7 8613 // }
whismanoid 55:477ba09475d7 8614 cmdLine.serial().printf(" o=%6.6f", SPI_AIN_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 8615 cmdLine.serial().printf(" mul=%6.6f", SPI_AIN_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 8616 cmdLine.serial().printf(" div=%6.6f", SPI_AIN_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 8617 cmdLine.serial().printf(" unit=%s", SPI_AIN_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 8618 //
whismanoid 55:477ba09475d7 8619 break;
whismanoid 55:477ba09475d7 8620 // MAX40108 Datalog Math #362 -- menu LS_M_ SPI_AIN Math channels configuration SPI_AIN_MATH
whismanoid 55:477ba09475d7 8621 #endif // SPI_AIN_MATH
whismanoid 9:45f98573eb6d 8622 //
whismanoid 9:45f98573eb6d 8623 // TODO: MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 9:45f98573eb6d 8624 case 'C': case 'c':
whismanoid 9:45f98573eb6d 8625 {
whismanoid 9:45f98573eb6d 8626 uint8_t hexValue = 0;
whismanoid 9:45f98573eb6d 8627 hexValue = hexValueOfChar(cmdLine[5]) * 0x10 + hexValueOfChar(cmdLine[6]);
whismanoid 9:45f98573eb6d 8628 switch (cmdLine[4])
whismanoid 9:45f98573eb6d 8629 {
whismanoid 9:45f98573eb6d 8630 //
whismanoid 9:45f98573eb6d 8631 // MAX11410 verb for configuring SPI_AIN_Cfg_v_filter_ch[channel_index]
whismanoid 9:45f98573eb6d 8632 // cmdLine.serial().print(F("\r\n LS-CF34 -- Datalog SPI ADC channel '-'(all) v_filter 0x34"));
whismanoid 9:45f98573eb6d 8633 case 'F': case 'f':
whismanoid 9:45f98573eb6d 8634 SPI_AIN_Cfg_v_filter_ch[channel_index] = hexValue;
whismanoid 9:45f98573eb6d 8635 break;
whismanoid 9:45f98573eb6d 8636 //
whismanoid 9:45f98573eb6d 8637 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 9:45f98573eb6d 8638 // cmdLine.serial().print(F("\r\n LS-CC42 -- Datalog SPI ADC channel '-'(all) v_ctrl 0x42"));
whismanoid 9:45f98573eb6d 8639 case 'C': case 'c':
whismanoid 9:45f98573eb6d 8640 SPI_AIN_Cfg_v_ctrl_ch[channel_index] = hexValue;
whismanoid 9:45f98573eb6d 8641 break;
whismanoid 9:45f98573eb6d 8642 //
whismanoid 9:45f98573eb6d 8643 // MAX11410 verb for configuring SPI_AIN_Cfg_v_pga_ch[channel_index]
whismanoid 9:45f98573eb6d 8644 // cmdLine.serial().print(F("\r\n LS-CP00 -- Datalog SPI ADC channel '-'(all) v_pga 0x00"));
whismanoid 9:45f98573eb6d 8645 case 'P': case 'p':
whismanoid 9:45f98573eb6d 8646 SPI_AIN_Cfg_v_pga_ch[channel_index] = hexValue;
whismanoid 9:45f98573eb6d 8647 break;
whismanoid 9:45f98573eb6d 8648 //
whismanoid 9:45f98573eb6d 8649 // cmdLine.serial().print(F("\r\n LS5CU -- Datalog SPI ADC channel channel 5 v_ctrl Unipolar"));
whismanoid 9:45f98573eb6d 8650 // ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) ? "BIPOLAR" : "Unipolar"
whismanoid 9:45f98573eb6d 8651 case 'U': case 'u':
whismanoid 9:45f98573eb6d 8652 SPI_AIN_Cfg_v_ctrl_ch[channel_index] = SPI_AIN_Cfg_v_ctrl_ch[channel_index] | 0x40;
whismanoid 9:45f98573eb6d 8653 break;
whismanoid 9:45f98573eb6d 8654 //
whismanoid 9:45f98573eb6d 8655 // cmdLine.serial().print(F("\r\n LS5CB -- Datalog SPI ADC channel channel 5 v_ctrl Bipolar"));
whismanoid 9:45f98573eb6d 8656 // ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) ? "BIPOLAR" : "Unipolar"
whismanoid 9:45f98573eb6d 8657 case 'B': case 'b':
whismanoid 9:45f98573eb6d 8658 SPI_AIN_Cfg_v_ctrl_ch[channel_index] = SPI_AIN_Cfg_v_ctrl_ch[channel_index] &~ 0x40;
whismanoid 9:45f98573eb6d 8659 break;
whismanoid 9:45f98573eb6d 8660 }
whismanoid 9:45f98573eb6d 8661 break;
whismanoid 9:45f98573eb6d 8662 }
whismanoid 9:45f98573eb6d 8663 //
whismanoid 9:45f98573eb6d 8664 //
whismanoid 9:45f98573eb6d 8665 }
whismanoid 9:45f98573eb6d 8666 } // end if cmdLine[2] channel_index
whismanoid 9:45f98573eb6d 8667 } // end for channel_index
whismanoid 9:45f98573eb6d 8668 Datalogger_PrintHeader();
whismanoid 9:45f98573eb6d 8669 Datalogger_Need_PrintHeader = true;
whismanoid 9:45f98573eb6d 8670 }
whismanoid 9:45f98573eb6d 8671 break;
whismanoid 9:45f98573eb6d 8672 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 8673 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 9:45f98573eb6d 8674 // LA<channel ID><verb>: Configure Platform_AIN channels
whismanoid 9:45f98573eb6d 8675 // channel ID: 0,1,2,... or - for all channels
whismanoid 9:45f98573eb6d 8676 // verb: D for disable, V for Voltage, L for LSB
whismanoid 8:dffee7509bfb 8677 case 'A': case 'a':
whismanoid 9:45f98573eb6d 8678 {
whismanoid 9:45f98573eb6d 8679 // all-channel: loop through all valid channel_index, test cmdLine[2] 'is it me'?
whismanoid 9:45f98573eb6d 8680 // for channel_index loop through 0..NUM_DUT_ANALOG_IN_CHANNELS
whismanoid 9:45f98573eb6d 8681 // if ((cmdLine[2] == '-' /* all channels */)
whismanoid 9:45f98573eb6d 8682 // || (cmdLine[2] == '0'+channel_index)
whismanoid 9:45f98573eb6d 8683 // ) {
whismanoid 9:45f98573eb6d 8684 // // it's me
whismanoid 9:45f98573eb6d 8685 // // test cmdLine[3] to determine action
whismanoid 9:45f98573eb6d 8686 // // Platform_Enable_ch[channel_index] = Platform_AIN_xxxxx;
whismanoid 9:45f98573eb6d 8687 // } end if cmdLine[2] channel_index
whismanoid 9:45f98573eb6d 8688 // } end for channel_index
whismanoid 9:45f98573eb6d 8689 for (int channel_index = 0; channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 9:45f98573eb6d 8690 if ((cmdLine[2] == '-' /* all channels */)
whismanoid 9:45f98573eb6d 8691 || (cmdLine[2] == '0'+channel_index)
whismanoid 9:45f98573eb6d 8692 )
whismanoid 9:45f98573eb6d 8693 {
whismanoid 9:45f98573eb6d 8694 // it's me
whismanoid 55:477ba09475d7 8695 #if HAS_Platform_AIN_customChannelHeader
whismanoid 55:477ba09475d7 8696 // WIP Editable customChannelHeader strings #363 - LA__ header= -- update Platform_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 8697 // menu LA__ header=xyzzy -- custom channel header
whismanoid 55:477ba09475d7 8698 if (cmdLine.parse_and_remove_key("header",
whismanoid 55:477ba09475d7 8699 Platform_AIN_customChannelHeader_ch[channel_index],
whismanoid 55:477ba09475d7 8700 Platform_AIN_customChannelHeader_MAXLENGTH))
whismanoid 55:477ba09475d7 8701 {
whismanoid 55:477ba09475d7 8702 cmdLine.serial().printf("\r\n LA%d%c header=%s", channel_index, cmdLine[3], Platform_AIN_customChannelHeader_ch[channel_index]);
whismanoid 55:477ba09475d7 8703 // Platform_AIN_customChannelHeader_ch[channel_index] was updated
whismanoid 55:477ba09475d7 8704 if (cmdLine[2] == '-' /* all channels */)
whismanoid 55:477ba09475d7 8705 { // LA-_ header= -- all channels custom header
whismanoid 55:477ba09475d7 8706 cmdLine.serial().printf("\r\n LA%c%c -- all channels", cmdLine[2], cmdLine[3]);
whismanoid 55:477ba09475d7 8707 for (int cx = 0; cx < NUM_PLATFORM_ANALOG_IN_CHANNELS; cx++)
whismanoid 55:477ba09475d7 8708 {
whismanoid 55:477ba09475d7 8709 if (cx != channel_index)
whismanoid 55:477ba09475d7 8710 {
whismanoid 55:477ba09475d7 8711 // strncpy(char* dst, const char* src, size_t n)
whismanoid 55:477ba09475d7 8712 strncpy(Platform_AIN_customChannelHeader_ch[cx],
whismanoid 55:477ba09475d7 8713 Platform_AIN_customChannelHeader_ch[channel_index],
whismanoid 55:477ba09475d7 8714 Platform_AIN_customChannelHeader_MAXLENGTH);
whismanoid 55:477ba09475d7 8715 cmdLine.serial().printf("\r\n LA%d%c header=%s", cx, cmdLine[3], Platform_AIN_customChannelHeader_ch[cx]);
whismanoid 55:477ba09475d7 8716 }
whismanoid 55:477ba09475d7 8717 }
whismanoid 55:477ba09475d7 8718 }
whismanoid 55:477ba09475d7 8719 else
whismanoid 55:477ba09475d7 8720 {
whismanoid 55:477ba09475d7 8721 cmdLine.serial().printf("\r\n LA%c%c -- single channel", cmdLine[2], cmdLine[3]);
whismanoid 55:477ba09475d7 8722 }
whismanoid 55:477ba09475d7 8723 }
whismanoid 55:477ba09475d7 8724 #endif // HAS_Platform_AIN_customChannelHeader
whismanoid 9:45f98573eb6d 8725 // test cmdLine[3] to determine action
whismanoid 9:45f98573eb6d 8726 // Platform_Enable_ch[channel_index] = Platform_AIN_xxxxx;
whismanoid 9:45f98573eb6d 8727 switch (cmdLine[3])
whismanoid 9:45f98573eb6d 8728 {
whismanoid 9:45f98573eb6d 8729 case 'D': case 'd':
whismanoid 9:45f98573eb6d 8730 Platform_Enable_ch[channel_index] = Platform_AIN_Disable;
whismanoid 9:45f98573eb6d 8731 break;
whismanoid 9:45f98573eb6d 8732 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 8733 case 'L': case 'l':
whismanoid 9:45f98573eb6d 8734 Platform_Enable_ch[channel_index] = Platform_AIN_Enable_LSB;
whismanoid 9:45f98573eb6d 8735 break;
whismanoid 9:45f98573eb6d 8736 #endif // LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 8737 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 9:45f98573eb6d 8738 case 'V': case 'v':
whismanoid 9:45f98573eb6d 8739 Platform_Enable_ch[channel_index] = Platform_AIN_Enable_Volt;
whismanoid 9:45f98573eb6d 8740 break;
whismanoid 9:45f98573eb6d 8741 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 55:477ba09475d7 8742 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8743 // MAX40108 Datalog Math #362 -- menu LA_M_ Platform_AIN Math channels configuration PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8744 case 'M': case 'm':
whismanoid 55:477ba09475d7 8745 switch (cmdLine[4])
whismanoid 55:477ba09475d7 8746 {
whismanoid 55:477ba09475d7 8747 case 'D': case 'd':
whismanoid 55:477ba09475d7 8748 Platform_Enable_Math_ch[channel_index] = Platform_AIN_Disable;
whismanoid 55:477ba09475d7 8749 break;
whismanoid 55:477ba09475d7 8750 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 55:477ba09475d7 8751 case 'L': case 'l':
whismanoid 55:477ba09475d7 8752 Platform_Enable_Math_ch[channel_index] = Platform_AIN_Enable_LSB;
whismanoid 55:477ba09475d7 8753 break;
whismanoid 55:477ba09475d7 8754 #endif // LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 55:477ba09475d7 8755 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 55:477ba09475d7 8756 case 'V': case 'v':
whismanoid 55:477ba09475d7 8757 Platform_Enable_Math_ch[channel_index] = Platform_AIN_Enable_Volt;
whismanoid 55:477ba09475d7 8758 break;
whismanoid 55:477ba09475d7 8759 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 55:477ba09475d7 8760 default:
whismanoid 55:477ba09475d7 8761 Platform_Enable_ch[channel_index] = Platform_AIN_Enable_Math_Volt;
whismanoid 55:477ba09475d7 8762 break;
whismanoid 55:477ba09475d7 8763 }
whismanoid 55:477ba09475d7 8764 //
whismanoid 55:477ba09475d7 8765 // MAX40108 Datalog Math #362 -- menu LA_M_ parse mul=? update Platform_MathGainMulA[ch] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8766 cmdLine.parse_double("mul", Platform_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 8767 //
whismanoid 55:477ba09475d7 8768 // MAX40108 Datalog Math #362 -- menu LA_M_ parse div=? update Platform_MathGainDivA[ch] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8769 cmdLine.parse_double("div", Platform_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 8770 //
whismanoid 55:477ba09475d7 8771 // MAX40108 Datalog Math #362 -- menu LA_M_ parse unit=nA update Platform_MathUnitString[ch] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8772 // WIP Editable customChannelHeader strings #363 - LA_M unit= -- update Platform_MathUnitString
whismanoid 55:477ba09475d7 8773 if (cmdLine.parse_and_remove_key("unit",
whismanoid 55:477ba09475d7 8774 Platform_MathUnitString[channel_index],
whismanoid 55:477ba09475d7 8775 Platform_MathUnitString_MAXLENGTH))
whismanoid 55:477ba09475d7 8776 {
whismanoid 55:477ba09475d7 8777 // Platform_MathUnitString[channel_index] was updated
whismanoid 55:477ba09475d7 8778 }
whismanoid 55:477ba09475d7 8779 //
whismanoid 55:477ba09475d7 8780 // MAX40108 Datalog Math #362 -- menu LA_M_ parse o=? update Platform_MathOffsetA[ch] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8781 // parse o=? last, otherwise can't have unit string with letter "o" in it due to conflict...
whismanoid 55:477ba09475d7 8782 cmdLine.parse_double("o", Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 8783 //
whismanoid 55:477ba09475d7 8784 // MAX40108 Datalog Math #362 -- menu LA_M_ always print the values of o=? mul=? div=? unit=nA PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8785 cmdLine.serial().printf("\r\n");
whismanoid 55:477ba09475d7 8786 // if (cmdLine[2] == '-' /* all channels */) {
whismanoid 55:477ba09475d7 8787 cmdLine.serial().printf("LA%dM", channel_index);
whismanoid 55:477ba09475d7 8788 // }
whismanoid 55:477ba09475d7 8789 cmdLine.serial().printf(" o=%6.6f", Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 8790 cmdLine.serial().printf(" mul=%6.6f", Platform_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 8791 cmdLine.serial().printf(" div=%6.6f", Platform_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 8792 cmdLine.serial().printf(" unit=%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 8793 #if HAS_Platform_AIN_customChannelHeader
whismanoid 55:477ba09475d7 8794 cmdLine.serial().printf(" header=%s", Platform_AIN_customChannelHeader_ch[channel_index]);
whismanoid 55:477ba09475d7 8795 #endif // HAS_Platform_AIN_customChannelHeader
whismanoid 55:477ba09475d7 8796 //
whismanoid 55:477ba09475d7 8797 break;
whismanoid 55:477ba09475d7 8798 // MAX40108 Datalog Math #362 -- menu LA_M_ Platform_AIN Math channels configuration PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8799 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8800 //
whismanoid 9:45f98573eb6d 8801 }
whismanoid 9:45f98573eb6d 8802 } // end if cmdLine[2] channel_index
whismanoid 9:45f98573eb6d 8803 } // end for channel_index
whismanoid 10:04022a61b527 8804 // Datalogger_PrintHeader(cmdLine);
whismanoid 9:45f98573eb6d 8805 if (Datalogger_enable_serial) {
whismanoid 9:45f98573eb6d 8806 Datalogger_PrintHeader(cmdLine);
whismanoid 9:45f98573eb6d 8807 }
whismanoid 9:45f98573eb6d 8808 # if HAS_AUX_SERIAL
whismanoid 9:45f98573eb6d 8809 if (Datalogger_enable_AUXserial) {
whismanoid 9:45f98573eb6d 8810 Datalogger_PrintHeader(cmdLine_AUXserial);
whismanoid 9:45f98573eb6d 8811 }
whismanoid 9:45f98573eb6d 8812 # endif // HAS_AUX_SERIAL
whismanoid 9:45f98573eb6d 8813 # if HAS_DAPLINK_SERIAL
whismanoid 9:45f98573eb6d 8814 if (Datalogger_enable_DAPLINKserial) {
whismanoid 9:45f98573eb6d 8815 Datalogger_PrintHeader(cmdLine_DAPLINKserial);
whismanoid 9:45f98573eb6d 8816 }
whismanoid 9:45f98573eb6d 8817 # endif // HAS_DAPLINK_SERIAL
whismanoid 9:45f98573eb6d 8818 Datalogger_Need_PrintHeader = true;
whismanoid 9:45f98573eb6d 8819 }
whismanoid 8:dffee7509bfb 8820 break;
whismanoid 9:45f98573eb6d 8821 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 9:45f98573eb6d 8822 case '>':
whismanoid 9:45f98573eb6d 8823 // L>A -- Datalogger_enable_AUXserial
whismanoid 9:45f98573eb6d 8824 // L>D -- Datalogger_enable_DAPLINKserial
whismanoid 9:45f98573eb6d 8825 // L>S -- Datalogger_enable_serial
whismanoid 9:45f98573eb6d 8826 switch (cmdLine[2])
whismanoid 9:45f98573eb6d 8827 {
whismanoid 9:45f98573eb6d 8828 # if HAS_AUX_SERIAL
whismanoid 9:45f98573eb6d 8829 case 'A': case 'a':
whismanoid 9:45f98573eb6d 8830 Datalogger_enable_AUXserial = !Datalogger_enable_AUXserial;
whismanoid 9:45f98573eb6d 8831 Datalogger_Need_PrintHeader = true;
whismanoid 9:45f98573eb6d 8832 break;
whismanoid 8:dffee7509bfb 8833 # endif // HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 8834 # if HAS_DAPLINK_SERIAL
whismanoid 9:45f98573eb6d 8835 case 'D': case 'd':
whismanoid 9:45f98573eb6d 8836 Datalogger_enable_DAPLINKserial = !Datalogger_enable_DAPLINKserial;
whismanoid 9:45f98573eb6d 8837 Datalogger_Need_PrintHeader = true;
whismanoid 9:45f98573eb6d 8838 break;
whismanoid 8:dffee7509bfb 8839 # endif // HAS_DAPLINK_SERIAL
whismanoid 9:45f98573eb6d 8840 case 'S': case 's':
whismanoid 9:45f98573eb6d 8841 Datalogger_enable_serial = !Datalogger_enable_serial;
whismanoid 9:45f98573eb6d 8842 Datalogger_Need_PrintHeader = true;
whismanoid 9:45f98573eb6d 8843 break;
whismanoid 9:45f98573eb6d 8844 }
whismanoid 9:45f98573eb6d 8845 break; // case '>' L>S serial enable toggle
whismanoid 28:a9a3a9db592b 8846 default:
whismanoid 28:a9a3a9db592b 8847 // TODO: L -- detailed help for datalog commands
whismanoid 28:a9a3a9db592b 8848 //
whismanoid 28:a9a3a9db592b 8849 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 28:a9a3a9db592b 8850 #if 1 // USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 8851 // Datalogger_Trigger = trigger_FreeRun // free run as fast as possible "always-on mode"
whismanoid 28:a9a3a9db592b 8852 cmdLine.serial().printf("\r\n LR -- Datalog free run as fast as possible");
whismanoid 28:a9a3a9db592b 8853 //
whismanoid 28:a9a3a9db592b 8854 // Datalogger_Trigger = trigger_Timer // timer (configure interval) "intermittent-sleep-mode"
whismanoid 28:a9a3a9db592b 8855 //~ cmdLine.serial().printf("\r\n LT -- Datalog timer"); // trigger_Timer
whismanoid 39:4d285e961435 8856 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 8857 // USE_DATALOGGER_SLEEP -- support sleep modes in Datalogger_Trigger
whismanoid 39:4d285e961435 8858 cmdLine.serial().printf("\r\n LT count=%d base=%dms sleep=%d -- Datalog timer",
whismanoid 39:4d285e961435 8859 g_timer_interval_count,
whismanoid 39:4d285e961435 8860 g_timer_interval_msec,
whismanoid 39:4d285e961435 8861 (int)g_timer_sleepmode
whismanoid 39:4d285e961435 8862 ); // trigger_Timer
whismanoid 39:4d285e961435 8863 #else // USE_DATALOGGER_SLEEP
whismanoid 28:a9a3a9db592b 8864 cmdLine.serial().printf("\r\n LT count=%d base=%dms -- Datalog timer", g_timer_interval_count, g_timer_interval_msec); // trigger_Timer
whismanoid 39:4d285e961435 8865 #endif // USE_DATALOGGER_SLEEP
whismanoid 28:a9a3a9db592b 8866 //
whismanoid 28:a9a3a9db592b 8867 // TODO: Datalogger_Trigger = trigger_PlatformDigitalInput // platform digital input (configure digital input pin reference)
whismanoid 28:a9a3a9db592b 8868 //~ cmdLine.serial().printf("\r\n LI -- Datalog _______"); // trigger_PlatformDigitalInput
whismanoid 28:a9a3a9db592b 8869 // TODO: cmdLine.serial().printf("\r\n LIH3 -- Datalog when input high D3"); // trigger_PlatformDigitalInput
whismanoid 28:a9a3a9db592b 8870 // TODO: cmdLine.serial().printf("\r\n LIL6 -- Datalog when input low D6"); // trigger_PlatformDigitalInput
whismanoid 28:a9a3a9db592b 8871 //
whismanoid 28:a9a3a9db592b 8872 #if USE_DATALOGGER_SPIDeviceRegRead
whismanoid 28:a9a3a9db592b 8873 // TODO: Datalogger_Trigger = trigger_SPIDeviceRegRead // SPI device register read (configure regaddr, mask value, match value)
whismanoid 28:a9a3a9db592b 8874 //~ cmdLine.serial().printf("\r\n L$ -- Datalog _______"); // trigger_SPIDeviceRegRead
whismanoid 28:a9a3a9db592b 8875 cmdLine.serial().printf("\r\n L$ count=10 base=500ms addr=xxx data=xxx mask=xxx -- Datalog when SPI read of address matches mask"); // trigger_SPIDeviceRegRead
whismanoid 28:a9a3a9db592b 8876 #endif // USE_DATALOGGER_SPIDeviceRegRead
whismanoid 28:a9a3a9db592b 8877 //
whismanoid 28:a9a3a9db592b 8878 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 28:a9a3a9db592b 8879 cmdLine.serial().printf("\r\n L@ -- configures Datalogger_action_table; show more commands");
whismanoid 28:a9a3a9db592b 8880 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 28:a9a3a9db592b 8881 //
whismanoid 28:a9a3a9db592b 8882 //
whismanoid 28:a9a3a9db592b 8883 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 28:a9a3a9db592b 8884 // LS<channel ID><verb>: Configure SPI_AIN channels
whismanoid 28:a9a3a9db592b 8885 // channel ID: 0,1,2,... or - for all channels
whismanoid 28:a9a3a9db592b 8886 // verb: D for disable, V for Voltage, L for LSB
whismanoid 28:a9a3a9db592b 8887 cmdLine.serial().printf("\r\n LS-D -- Datalog SPI ADC channel '-'(all) Disable");
whismanoid 28:a9a3a9db592b 8888 cmdLine.serial().printf("\r\n LS-V -- Datalog SPI ADC channel '-'(all) Volt");
whismanoid 28:a9a3a9db592b 8889 cmdLine.serial().printf("\r\n LS-L -- Datalog SPI ADC channel '-'(all) LSB");
whismanoid 28:a9a3a9db592b 8890 cmdLine.serial().printf("\r\n LS2D -- Datalog SPI ADC channel channel 2 Disable");
whismanoid 28:a9a3a9db592b 8891 cmdLine.serial().printf("\r\n LS3V -- Datalog SPI ADC channel channel 3 Volt");
whismanoid 28:a9a3a9db592b 8892 cmdLine.serial().printf("\r\n LS4L -- Datalog SPI ADC channel channel 4 LSB");
whismanoid 28:a9a3a9db592b 8893 //
whismanoid 55:477ba09475d7 8894 // MAX40108 Datalog Math #362 -- menu L expanded help menu: LS_CD ; LS_CL ; LS_CV o=? mul=? div=? unit=nA SPI_AIN_MATH
whismanoid 55:477ba09475d7 8895 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 8896 cmdLine.serial().printf("\r\n LS2M o=? mul=? div=? unit=nA -- math (AIN2V+o)*mul/div");
whismanoid 55:477ba09475d7 8897 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 8898 // WIP Editable customChannelHeader strings #363 -- menu L expanded help menu LA__ header=xyzzy
whismanoid 55:477ba09475d7 8899 #if HAS_SPI_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 8900 cmdLine.serial().printf("\r\n LS- header=xyzzy -- custom per-channel header suffix");
whismanoid 55:477ba09475d7 8901 #endif // HAS_SPI_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 8902 //
whismanoid 28:a9a3a9db592b 8903 // MAX11410 verb for configuring SPI_AIN_Cfg_v_filter_ch[channel_index]
whismanoid 28:a9a3a9db592b 8904 // cmdLine.serial().print(F("\r\n LS-CF34 -- Datalog SPI ADC channel channel 5 v_filter 0x34"));
whismanoid 28:a9a3a9db592b 8905 cmdLine.serial().printf("\r\n LS-CF34 -- Datalog SPI ADC channel '-'(all) v_filter 0x34");
whismanoid 28:a9a3a9db592b 8906 //
whismanoid 28:a9a3a9db592b 8907 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 28:a9a3a9db592b 8908 // cmdLine.serial().print(F("\r\n LS-CC42 -- Datalog SPI ADC channel '-'(all) v_ctrl 0x42"));
whismanoid 28:a9a3a9db592b 8909 cmdLine.serial().printf("\r\n LS-CC42 -- Datalog SPI ADC channel '-'(all) v_ctrl 0x42");
whismanoid 28:a9a3a9db592b 8910 //
whismanoid 28:a9a3a9db592b 8911 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 28:a9a3a9db592b 8912 // cmdLine.serial().print(F("\r\n LS5___ -- Datalog SPI ADC channel channel 5 v_ctrl"));
whismanoid 28:a9a3a9db592b 8913 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 28:a9a3a9db592b 8914 cmdLine.serial().printf("\r\n LS5CU -- Datalog SPI ADC channel channel 5 v_ctrl Unipolar");
whismanoid 28:a9a3a9db592b 8915 // ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) ? "BIPOLAR" : "Unipolar"
whismanoid 28:a9a3a9db592b 8916 cmdLine.serial().printf("\r\n LS5CB -- Datalog SPI ADC channel channel 5 v_ctrl Bipolar");
whismanoid 28:a9a3a9db592b 8917 // ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) ? "BIPOLAR" : "Unipolar"
whismanoid 28:a9a3a9db592b 8918 //
whismanoid 28:a9a3a9db592b 8919 // MAX11410 verb for configuring SPI_AIN_Cfg_v_pga_ch[channel_index]
whismanoid 28:a9a3a9db592b 8920 // cmdLine.serial().print(F("\r\n LS5CP00 -- Datalog SPI ADC channel channel 5 v_pga 0x00"));
whismanoid 28:a9a3a9db592b 8921 cmdLine.serial().printf("\r\n LS-CP00 -- Datalog SPI ADC channel '-'(all) v_pga 0x00");
whismanoid 28:a9a3a9db592b 8922 //
whismanoid 55:477ba09475d7 8923 //
whismanoid 28:a9a3a9db592b 8924 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 28:a9a3a9db592b 8925 //
whismanoid 28:a9a3a9db592b 8926 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 28:a9a3a9db592b 8927 // LA<channel ID><verb>: Configure Platform_AIN channels
whismanoid 28:a9a3a9db592b 8928 // channel ID: 0,1,2,... or - for all channels
whismanoid 28:a9a3a9db592b 8929 // verb: D for disable, V for Voltage, L for LSB
whismanoid 28:a9a3a9db592b 8930 cmdLine.serial().printf("\r\n LA-D -- Datalog Platform-AIN all-channel Disable");
whismanoid 28:a9a3a9db592b 8931 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 28:a9a3a9db592b 8932 cmdLine.serial().printf("\r\n LA-V -- Datalog Platform-AIN all-channel Volt");
whismanoid 28:a9a3a9db592b 8933 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 28:a9a3a9db592b 8934 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 28:a9a3a9db592b 8935 cmdLine.serial().printf("\r\n LA-L -- Datalog Platform-AIN all-channel LSB");
whismanoid 28:a9a3a9db592b 8936 #endif // LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 28:a9a3a9db592b 8937 cmdLine.serial().printf("\r\n LA2D -- Datalog Platform-AIN channel 2 Disable");
whismanoid 28:a9a3a9db592b 8938 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 28:a9a3a9db592b 8939 cmdLine.serial().printf("\r\n LA3V -- Datalog Platform-AIN channel 3 Volt");
whismanoid 28:a9a3a9db592b 8940 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 28:a9a3a9db592b 8941 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 28:a9a3a9db592b 8942 cmdLine.serial().printf("\r\n LA4L -- Datalog Platform-AIN channel 4 LSB");
whismanoid 28:a9a3a9db592b 8943 #endif // LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 55:477ba09475d7 8944 // MAX40108 Datalog Math #362 -- menu L expanded help menu: LA_CD ; LA_CL ; LA_CV o=? mul=? div=? unit=nA PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8945 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8946 cmdLine.serial().printf("\r\n LA2M o=? mul=? div=? unit=nA -- math (AIN2V+o)*mul/div");
whismanoid 55:477ba09475d7 8947 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8948 // WIP Editable customChannelHeader strings #363 -- menu L expanded help menu LA__ header=xyzzy
whismanoid 55:477ba09475d7 8949 #if HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 8950 cmdLine.serial().printf("\r\n LA- header=xyzzy -- custom per-channel header suffix");
whismanoid 55:477ba09475d7 8951 #endif // HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 8952 //
whismanoid 28:a9a3a9db592b 8953 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 28:a9a3a9db592b 8954 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 28:a9a3a9db592b 8955 # if HAS_AUX_SERIAL
whismanoid 28:a9a3a9db592b 8956 cmdLine.serial().printf("\r\n L>A -- Datalogger_enable_AUXserial %s", (Datalogger_enable_AUXserial?"disable":"enable"));
whismanoid 28:a9a3a9db592b 8957 # endif // HAS_AUX_SERIAL
whismanoid 28:a9a3a9db592b 8958 # if HAS_DAPLINK_SERIAL
whismanoid 28:a9a3a9db592b 8959 cmdLine.serial().printf("\r\n L>D -- Datalogger_enable_DAPLINKserial %s", (Datalogger_enable_DAPLINKserial?"disable":"enable"));
whismanoid 28:a9a3a9db592b 8960 # endif // HAS_DAPLINK_SERIAL
whismanoid 28:a9a3a9db592b 8961 cmdLine.serial().printf("\r\n L>S -- Datalogger_enable_serial %s", (Datalogger_enable_serial?"disable":"enable"));
whismanoid 28:a9a3a9db592b 8962 //
whismanoid 28:a9a3a9db592b 8963 #else // USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 8964 #endif // USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 8965 break;
whismanoid 17:9397ea3ea7e9 8966 } // switch (cmdLine[1]) inside case 'L'
whismanoid 4:d9b05924ad4c 8967 }
whismanoid 4:d9b05924ad4c 8968 break; // case 'L'
whismanoid 4:d9b05924ad4c 8969 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 4:d9b05924ad4c 8970 //
whismanoid 4:d9b05924ad4c 8971 // Application-specific commands here
whismanoid 4:d9b05924ad4c 8972 // alphanumeric command codes A-Z,a-z,0-9 reserved for application use
whismanoid 4:d9b05924ad4c 8973 //
whismanoid 4:d9b05924ad4c 8974 #if APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 8975 #endif // APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 8976
whismanoid 4:d9b05924ad4c 8977 //
whismanoid 4:d9b05924ad4c 8978 // TODO1: add new commands here
whismanoid 4:d9b05924ad4c 8979 //
whismanoid 4:d9b05924ad4c 8980 default:
whismanoid 4:d9b05924ad4c 8981 #if APPLICATION_MAX5715 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 8982 extern bool MAX5715_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX5715.cpp
whismanoid 4:d9b05924ad4c 8983 if (!MAX5715_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 8984 #elif APPLICATION_MAX11131 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 8985 extern bool MAX11131_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX11131.cpp
whismanoid 4:d9b05924ad4c 8986 if (!MAX11131_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 8987 #elif APPLICATION_MAX5171 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 8988 extern bool MAX5171_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX5171.cpp
whismanoid 4:d9b05924ad4c 8989 if (!MAX5171_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 8990 #elif APPLICATION_MAX11410 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 8991 extern bool MAX11410_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX11410.cpp
whismanoid 4:d9b05924ad4c 8992 if (!MAX11410_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 8993 #elif APPLICATION_MAX12345 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 8994 extern bool MAX12345_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX12345.cpp
whismanoid 4:d9b05924ad4c 8995 if (!MAX12345_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 8996 #else
whismanoid 4:d9b05924ad4c 8997 if (0) // not_handled_by_device_submenu
whismanoid 4:d9b05924ad4c 8998 #endif
whismanoid 4:d9b05924ad4c 8999 {
whismanoid 4:d9b05924ad4c 9000 cmdLine.serial().printf("\r\n unknown command ");
whismanoid 4:d9b05924ad4c 9001 //~ cmdLine.serial().printf("\r\n unknown command 0x%2.2x \"%s\"\r\n", cmdLine.str()[0], cmdLine.str());
whismanoid 4:d9b05924ad4c 9002 # if HAS_DAPLINK_SERIAL
whismanoid 8:dffee7509bfb 9003 cmdLine_DAPLINKserial.serial().printf("\r\n unknown command 0x%2.2x \"%s\"\r\n",
whismanoid 4:d9b05924ad4c 9004 cmdLine.str()[0], cmdLine.str());
whismanoid 4:d9b05924ad4c 9005 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9006 }
whismanoid 4:d9b05924ad4c 9007 } // switch (cmdLine[0])
whismanoid 4:d9b05924ad4c 9008 //
whismanoid 31:47eee7e0cc2d 9009 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 31:47eee7e0cc2d 9010 if (g_Run_command_table_running == false) {
whismanoid 4:d9b05924ad4c 9011 // print command prompt
whismanoid 8:dffee7509bfb 9012 // print_command_prompt();
whismanoid 8:dffee7509bfb 9013 cmdLine.serial().printf("\r\n> ");
whismanoid 31:47eee7e0cc2d 9014 } // if (g_Run_command_table_running)
whismanoid 4:d9b05924ad4c 9015 }
whismanoid 4:d9b05924ad4c 9016 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 9017
whismanoid 4:d9b05924ad4c 9018 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 9019 // print column header banner for csv data columns
whismanoid 8:dffee7509bfb 9020 void Datalogger_PrintHeader(CmdLine& cmdLine)
whismanoid 4:d9b05924ad4c 9021 {
whismanoid 37:3f369235e5bc 9022 #if MAX40108_DEMO // main_menu_status banner
whismanoid 37:3f369235e5bc 9023 cmdLine.serial().printf("\r\n\r\n\"MAX40108_U%d", MAX40108_DEMO);
whismanoid 37:3f369235e5bc 9024 #ifdef BOARD_SERIAL_NUMBER
whismanoid 37:3f369235e5bc 9025 // data unique to certain boards based on serial number
whismanoid 49:359a6b9df7c1 9026 cmdLine.serial().printf(" [s/n %ld]", g_board_serial_number);
whismanoid 37:3f369235e5bc 9027 #endif // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 37:3f369235e5bc 9028 #ifdef FW_REV
whismanoid 37:3f369235e5bc 9029 cmdLine.serial().printf(" [FW_REV %d]", FW_REV);
whismanoid 37:3f369235e5bc 9030 #endif // FW_REV
whismanoid 37:3f369235e5bc 9031 cmdLine.serial().printf("\"\r\n");
whismanoid 37:3f369235e5bc 9032 #endif // MAX40108_DEMO
whismanoid 37:3f369235e5bc 9033
whismanoid 4:d9b05924ad4c 9034 // column header banner for csv data columns
whismanoid 4:d9b05924ad4c 9035 int field_index = 0;
whismanoid 4:d9b05924ad4c 9036 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 10:04022a61b527 9037 for (int channel_index = 0; channel_index < NUM_DUT_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 10:04022a61b527 9038 if (SPI_AIN_Enable_ch[channel_index] == SPI_AIN_Disable) {
whismanoid 4:d9b05924ad4c 9039 continue;
whismanoid 4:d9b05924ad4c 9040 }
whismanoid 4:d9b05924ad4c 9041 // comma between fields
whismanoid 4:d9b05924ad4c 9042 if (field_index > 0) {
whismanoid 4:d9b05924ad4c 9043 cmdLine.serial().printf(",");
whismanoid 4:d9b05924ad4c 9044 }
whismanoid 10:04022a61b527 9045 field_index++;
whismanoid 4:d9b05924ad4c 9046 // AIN_index column header prefix
whismanoid 4:d9b05924ad4c 9047 #if SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 4:d9b05924ad4c 9048 // MAX11410 v_ctrl bipolar configuration or unipolar?
whismanoid 4:d9b05924ad4c 9049 if ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) {
whismanoid 4:d9b05924ad4c 9050 cmdLine.serial().printf("\"AIN%d-%d_BIP", channel_index, channel_index+1);
whismanoid 4:d9b05924ad4c 9051 }
whismanoid 4:d9b05924ad4c 9052 else {
whismanoid 4:d9b05924ad4c 9053 cmdLine.serial().printf("\"AIN%d", channel_index);
whismanoid 4:d9b05924ad4c 9054 }
whismanoid 4:d9b05924ad4c 9055 #else // SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 4:d9b05924ad4c 9056 cmdLine.serial().printf("\"AIN%d", channel_index);
whismanoid 4:d9b05924ad4c 9057 #endif // SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 10:04022a61b527 9058 if (SPI_AIN_Enable_ch[channel_index] == SPI_AIN_Enable_LSB) {
whismanoid 4:d9b05924ad4c 9059 // _LSB column header suffix
whismanoid 13:184a08909405 9060 cmdLine.serial().printf("_LSB");
whismanoid 4:d9b05924ad4c 9061 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9062 cmdLine_DAPLINKserial.serial().printf("_LSB");
whismanoid 4:d9b05924ad4c 9063 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9064 }
whismanoid 10:04022a61b527 9065 else if (SPI_AIN_Enable_ch[channel_index] == SPI_AIN_Enable_Volt) {
whismanoid 4:d9b05924ad4c 9066 // _V column header suffix
whismanoid 13:184a08909405 9067 cmdLine.serial().printf("_V");
whismanoid 4:d9b05924ad4c 9068 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9069 cmdLine_DAPLINKserial.serial().printf("_V");
whismanoid 4:d9b05924ad4c 9070 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9071 }
whismanoid 13:184a08909405 9072 #if HAS_SPI_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 13:184a08909405 9073 // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 9074 // WIP Editable customChannelHeader strings #363 - Datalogger_PrintHeader SPI_AIN_customChannelHeader_ch
whismanoid 13:184a08909405 9075 if (SPI_AIN_customChannelHeader_ch[channel_index] && SPI_AIN_customChannelHeader_ch[channel_index][0]) {
whismanoid 13:184a08909405 9076 // not a null pointer, and not an empty string
whismanoid 13:184a08909405 9077 cmdLine.serial().printf("_%s", SPI_AIN_customChannelHeader_ch[channel_index]);
whismanoid 13:184a08909405 9078 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9079 cmdLine_DAPLINKserial.serial().printf("_%s", SPI_AIN_customChannelHeader_ch[channel_index]);
whismanoid 13:184a08909405 9080 # endif // HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9081 } else {
whismanoid 13:184a08909405 9082 // no custom channel name for this channel
whismanoid 13:184a08909405 9083 //~ cmdLine.serial().printf("~");
whismanoid 13:184a08909405 9084 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9085 //~ cmdLine_DAPLINKserial.serial().printf("~");
whismanoid 13:184a08909405 9086 # endif // HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9087 }
whismanoid 13:184a08909405 9088 #endif // HAS_SPI_AIN_customChannelHeader
whismanoid 13:184a08909405 9089 // close quote
whismanoid 13:184a08909405 9090 cmdLine.serial().printf("\"");
whismanoid 13:184a08909405 9091 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9092 cmdLine_DAPLINKserial.serial().printf("\"");
whismanoid 13:184a08909405 9093 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9094 }
whismanoid 4:d9b05924ad4c 9095
whismanoid 4:d9b05924ad4c 9096 #if VERIFY_PART_ID_IN_LOOP
whismanoid 4:d9b05924ad4c 9097 // PART_ID field: Device ID Validation
whismanoid 4:d9b05924ad4c 9098 cmdLine.serial().printf(",\"PART_ID\"");
whismanoid 4:d9b05924ad4c 9099 # if HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9100 cmdLine_DAPLINKserial.serial().printf(",\"PART_ID\"");
whismanoid 4:d9b05924ad4c 9101 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9102 #endif // VERIFY_PART_ID_IN_LOOP
whismanoid 55:477ba09475d7 9103 // MAX40108 Datalog Math #362 -- Datalogger_PrintHeader() SPI_AIN_MATH
whismanoid 55:477ba09475d7 9104 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 9105 // SPI_AIN_Enable_Math_ch[] option to report math
whismanoid 55:477ba09475d7 9106 // based on g_MAX11410_device.AINcode[] or SPI_AIN_Voltage[]
whismanoid 55:477ba09475d7 9107 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9108 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9109 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9110 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9111 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 9112 //
whismanoid 4:d9b05924ad4c 9113 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 4:d9b05924ad4c 9114 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 9:45f98573eb6d 9115 for (int channel_index = 0; channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 9:45f98573eb6d 9116 if (Platform_Enable_ch[channel_index] == Platform_AIN_Disable) {
whismanoid 9:45f98573eb6d 9117 continue;
whismanoid 9:45f98573eb6d 9118 }
whismanoid 4:d9b05924ad4c 9119 // comma between fields
whismanoid 4:d9b05924ad4c 9120 if (field_index > 0) {
whismanoid 4:d9b05924ad4c 9121 cmdLine.serial().printf(",");
whismanoid 4:d9b05924ad4c 9122 }
whismanoid 9:45f98573eb6d 9123 field_index++;
whismanoid 4:d9b05924ad4c 9124 // AIN_index column header prefix
whismanoid 4:d9b05924ad4c 9125 cmdLine.serial().printf("\"A%d", channel_index);
whismanoid 9:45f98573eb6d 9126 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_LSB) {
whismanoid 9:45f98573eb6d 9127 // _LSB column header suffix
whismanoid 13:184a08909405 9128 cmdLine.serial().printf("_LSB");
whismanoid 9:45f98573eb6d 9129 }
whismanoid 9:45f98573eb6d 9130 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Volt) {
whismanoid 9:45f98573eb6d 9131 // _V column header suffix
whismanoid 13:184a08909405 9132 cmdLine.serial().printf("_V");
whismanoid 9:45f98573eb6d 9133 }
whismanoid 55:477ba09475d7 9134 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_LSB - display math result instead of LSB in channel# position
whismanoid 55:477ba09475d7 9135 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9136 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Math_LSB) {
whismanoid 55:477ba09475d7 9137 // _LSB column header suffix
whismanoid 55:477ba09475d7 9138 cmdLine.serial().printf("_LSB");
whismanoid 55:477ba09475d7 9139 if (Platform_MathOffsetA[channel_index] > 0) {
whismanoid 55:477ba09475d7 9140 cmdLine.serial().printf("-%4.2f", Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9141 }
whismanoid 55:477ba09475d7 9142 else if (Platform_MathOffsetA[channel_index] < 0) {
whismanoid 55:477ba09475d7 9143 cmdLine.serial().printf("+%4.2f", -Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9144 }
whismanoid 55:477ba09475d7 9145 if (Platform_MathGainMulA[channel_index] != 1.0) {
whismanoid 55:477ba09475d7 9146 cmdLine.serial().printf("*%4.2f", Platform_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 9147 }
whismanoid 55:477ba09475d7 9148 if (Platform_MathGainDivA[channel_index] != 1.0) {
whismanoid 55:477ba09475d7 9149 cmdLine.serial().printf("/%4.2f", Platform_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 9150 }
whismanoid 55:477ba09475d7 9151 if (Platform_MathUnitString[channel_index][0] != '\0') {
whismanoid 55:477ba09475d7 9152 cmdLine.serial().printf("_%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9153 }
whismanoid 55:477ba09475d7 9154 }
whismanoid 55:477ba09475d7 9155 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9156 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_Volt - display math result instead of volts in channel# position
whismanoid 55:477ba09475d7 9157 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9158 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Math_Volt) {
whismanoid 55:477ba09475d7 9159 // _V column header suffix
whismanoid 55:477ba09475d7 9160 cmdLine.serial().printf("_V");
whismanoid 55:477ba09475d7 9161 if (Platform_MathOffsetA[channel_index] > 0) {
whismanoid 55:477ba09475d7 9162 cmdLine.serial().printf("-%4.2f", Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9163 }
whismanoid 55:477ba09475d7 9164 else if (Platform_MathOffsetA[channel_index] < 0) {
whismanoid 55:477ba09475d7 9165 cmdLine.serial().printf("+%4.2f", -Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9166 }
whismanoid 55:477ba09475d7 9167 if (Platform_MathGainMulA[channel_index] != 1.0) {
whismanoid 55:477ba09475d7 9168 cmdLine.serial().printf("*%4.2f", Platform_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 9169 }
whismanoid 55:477ba09475d7 9170 if (Platform_MathGainDivA[channel_index] != 1.0) {
whismanoid 55:477ba09475d7 9171 cmdLine.serial().printf("/%4.2f", Platform_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 9172 }
whismanoid 55:477ba09475d7 9173 if (Platform_MathUnitString[channel_index][0] != '\0') {
whismanoid 55:477ba09475d7 9174 cmdLine.serial().printf("_%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9175 }
whismanoid 55:477ba09475d7 9176 }
whismanoid 55:477ba09475d7 9177 #endif // PLATFORM_AIN_MATH
whismanoid 13:184a08909405 9178 #if HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 13:184a08909405 9179 // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 9180 // WIP Editable customChannelHeader strings #363 - Datalogger_PrintHeader Platform_AIN_customChannelHeader_ch
whismanoid 13:184a08909405 9181 if (Platform_AIN_customChannelHeader_ch[channel_index] && Platform_AIN_customChannelHeader_ch[channel_index][0]) {
whismanoid 13:184a08909405 9182 // not a null pointer, and not an empty string
whismanoid 13:184a08909405 9183 cmdLine.serial().printf("_%s", Platform_AIN_customChannelHeader_ch[channel_index]);
whismanoid 13:184a08909405 9184 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9185 cmdLine_DAPLINKserial.serial().printf("_%s", Platform_AIN_customChannelHeader_ch[channel_index]);
whismanoid 13:184a08909405 9186 # endif // HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9187 } else {
whismanoid 13:184a08909405 9188 // no custom channel name for this channel
whismanoid 13:184a08909405 9189 //~ cmdLine.serial().printf("~");
whismanoid 13:184a08909405 9190 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9191 //~ cmdLine_DAPLINKserial.serial().printf("~");
whismanoid 13:184a08909405 9192 # endif // HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9193 }
whismanoid 13:184a08909405 9194 #endif // HAS_Platform_AIN_customChannelHeader
whismanoid 13:184a08909405 9195 // close quote
whismanoid 13:184a08909405 9196 cmdLine.serial().printf("\"");
whismanoid 13:184a08909405 9197 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9198 cmdLine_DAPLINKserial.serial().printf("\"");
whismanoid 13:184a08909405 9199 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9200 }
whismanoid 4:d9b05924ad4c 9201 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 55:477ba09475d7 9202 // MAX40108 Datalog Math #362 -- Datalogger_PrintHeader() PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9203 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9204 // Platform_Enable_Math_ch[] option to report math
whismanoid 55:477ba09475d7 9205 // based on Platform_LSB[] or Platform_Voltage[]
whismanoid 55:477ba09475d7 9206 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9207 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9208 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9209 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9210 for (int channel_index = 0; channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 55:477ba09475d7 9211 if (Platform_Enable_Math_ch[channel_index] == Platform_AIN_Disable) {
whismanoid 55:477ba09475d7 9212 continue;
whismanoid 55:477ba09475d7 9213 }
whismanoid 55:477ba09475d7 9214 // comma between fields
whismanoid 55:477ba09475d7 9215 if (field_index > 0) {
whismanoid 55:477ba09475d7 9216 cmdLine.serial().printf(",");
whismanoid 55:477ba09475d7 9217 }
whismanoid 55:477ba09475d7 9218 field_index++;
whismanoid 55:477ba09475d7 9219 // AIN_index column header prefix
whismanoid 55:477ba09475d7 9220 cmdLine.serial().printf("\"MATH:");
whismanoid 55:477ba09475d7 9221 // if (Platform_MathOffsetA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9222 // cmdLine.serial().printf("");
whismanoid 55:477ba09475d7 9223 // }
whismanoid 55:477ba09475d7 9224 cmdLine.serial().printf("A%d", channel_index);
whismanoid 55:477ba09475d7 9225 if (Platform_Enable_Math_ch[channel_index] == Platform_AIN_Enable_LSB) {
whismanoid 55:477ba09475d7 9226 // _LSB column header suffix
whismanoid 55:477ba09475d7 9227 cmdLine.serial().printf("_LSB");
whismanoid 55:477ba09475d7 9228 }
whismanoid 55:477ba09475d7 9229 if (Platform_Enable_Math_ch[channel_index] == Platform_AIN_Enable_Volt) {
whismanoid 55:477ba09475d7 9230 // _V column header suffix
whismanoid 55:477ba09475d7 9231 cmdLine.serial().printf("_V");
whismanoid 55:477ba09475d7 9232 }
whismanoid 55:477ba09475d7 9233 if (Platform_MathOffsetA[channel_index] > 0) {
whismanoid 55:477ba09475d7 9234 cmdLine.serial().printf("-%4.2f", Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9235 }
whismanoid 55:477ba09475d7 9236 if (Platform_MathOffsetA[channel_index] < 0) {
whismanoid 55:477ba09475d7 9237 cmdLine.serial().printf("+%4.2f", -Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9238 }
whismanoid 55:477ba09475d7 9239 if (Platform_MathGainMulA[channel_index] != 1.0) {
whismanoid 55:477ba09475d7 9240 cmdLine.serial().printf("*%4.2f", Platform_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 9241 }
whismanoid 55:477ba09475d7 9242 if (Platform_MathGainDivA[channel_index] != 1.0) {
whismanoid 55:477ba09475d7 9243 cmdLine.serial().printf("/%4.2f", Platform_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 9244 }
whismanoid 55:477ba09475d7 9245 if (Platform_MathUnitString[channel_index][0] != '\0') {
whismanoid 55:477ba09475d7 9246 cmdLine.serial().printf("_%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9247 }
whismanoid 55:477ba09475d7 9248 #if HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 9249 // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 9250 // WIP Editable customChannelHeader strings #363 - Datalogger_PrintHeader Platform_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 9251 if (Platform_AIN_customChannelHeader_ch[channel_index] && Platform_AIN_customChannelHeader_ch[channel_index][0]) {
whismanoid 55:477ba09475d7 9252 // not a null pointer, and not an empty string
whismanoid 55:477ba09475d7 9253 cmdLine.serial().printf("_%s", Platform_AIN_customChannelHeader_ch[channel_index]);
whismanoid 55:477ba09475d7 9254 # if HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 9255 cmdLine_DAPLINKserial.serial().printf("_%s", Platform_AIN_customChannelHeader_ch[channel_index]);
whismanoid 55:477ba09475d7 9256 # endif // HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 9257 } else {
whismanoid 55:477ba09475d7 9258 // no custom channel name for this channel
whismanoid 55:477ba09475d7 9259 //~ cmdLine.serial().printf("~");
whismanoid 55:477ba09475d7 9260 # if HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 9261 //~ cmdLine_DAPLINKserial.serial().printf("~");
whismanoid 55:477ba09475d7 9262 # endif // HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 9263 }
whismanoid 55:477ba09475d7 9264 #endif // HAS_Platform_AIN_customChannelHeader
whismanoid 55:477ba09475d7 9265 // close quote
whismanoid 55:477ba09475d7 9266 cmdLine.serial().printf("\"");
whismanoid 55:477ba09475d7 9267 # if HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 9268 cmdLine_DAPLINKserial.serial().printf("\"");
whismanoid 55:477ba09475d7 9269 # endif // HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 9270 }
whismanoid 55:477ba09475d7 9271 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9272 //
whismanoid 30:07197a430869 9273 #if USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 9274 // Datalogger_PrintRow() print gstrRemarkText field from recent #remark -- in Datalogger_PrintHeader
whismanoid 30:07197a430869 9275 cmdLine.serial().printf(",\"%s\"", gstrRemarkHeader);
whismanoid 30:07197a430869 9276 #endif // USE_DATALOGGER_REMARK_FIELD
whismanoid 4:d9b05924ad4c 9277 // end of column header line
whismanoid 4:d9b05924ad4c 9278 cmdLine.serial().printf("\r\n");
whismanoid 4:d9b05924ad4c 9279 # if HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9280 cmdLine_DAPLINKserial.serial().printf("\r\n");
whismanoid 4:d9b05924ad4c 9281 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9282 } // void Datalogger_PrintHeader()
whismanoid 4:d9b05924ad4c 9283
whismanoid 5:aaf8b5f5fda1 9284 //--------------------------------------------------
whismanoid 5:aaf8b5f5fda1 9285 void Datalogger_AcquireRow()
whismanoid 5:aaf8b5f5fda1 9286 {
whismanoid 5:aaf8b5f5fda1 9287 // CODE GENERATOR: example code: has no member function ScanStandardExternalClock
whismanoid 5:aaf8b5f5fda1 9288 // CODE GENERATOR: example code: has no member function ReadAINcode
whismanoid 5:aaf8b5f5fda1 9289 // CODE GENERATOR: example code: member function Read_All_Voltages
whismanoid 5:aaf8b5f5fda1 9290 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 5:aaf8b5f5fda1 9291 // Measure ADC channels in sequence from AIN0 to channelNumber_0_9.
whismanoid 5:aaf8b5f5fda1 9292 // @param[in] g_MAX11410_device.channelNumber_0_15: AIN Channel Number
whismanoid 5:aaf8b5f5fda1 9293 // @param[in] g_MAX11410_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
whismanoid 5:aaf8b5f5fda1 9294 // @param[in] g_MAX11410_device.chan_id_0_1: ADC_MODE_CONTROL.CHAN_ID
whismanoid 10:04022a61b527 9295 //~ int channelId_0_9 = NUM_DUT_ANALOG_IN_CHANNELS-1+1;
whismanoid 5:aaf8b5f5fda1 9296 //g_MAX11410_device.channelNumber_0_15 = channelId_0_9;
whismanoid 5:aaf8b5f5fda1 9297 //g_MAX11410_device.PowerManagement_0_2 = 0;
whismanoid 5:aaf8b5f5fda1 9298 //g_MAX11410_device.chan_id_0_1 = 1;
whismanoid 5:aaf8b5f5fda1 9299 //----------------------------------------
whismanoid 5:aaf8b5f5fda1 9300 // scan AIN0..AIN9
whismanoid 5:aaf8b5f5fda1 9301 //
whismanoid 10:04022a61b527 9302 #if 1
whismanoid 10:04022a61b527 9303 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[0];
whismanoid 10:04022a61b527 9304 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[0];
whismanoid 10:04022a61b527 9305 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[0];
whismanoid 10:04022a61b527 9306 //
whismanoid 10:04022a61b527 9307 // diagnostic GPIO pulse on MAX11410 GP1 pin (0xc3 = logic 0, 0xc4 = logic 1)
whismanoid 10:04022a61b527 9308 g_MAX11410_device.RegWrite(MAX11410::CMD_r000_0101_dddd_xddd_GP1_CTRL, 0xc3); // GP1 = 0
whismanoid 10:04022a61b527 9309 //
whismanoid 10:04022a61b527 9310 int field_index = 0;
whismanoid 10:04022a61b527 9311 for (int channel_index = 0; channel_index < NUM_DUT_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 10:04022a61b527 9312 if (SPI_AIN_Enable_ch[channel_index] == SPI_AIN_Disable) {
whismanoid 10:04022a61b527 9313 continue;
whismanoid 10:04022a61b527 9314 }
whismanoid 10:04022a61b527 9315 field_index++;
whismanoid 10:04022a61b527 9316 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[channel_index];
whismanoid 10:04022a61b527 9317 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[channel_index];
whismanoid 10:04022a61b527 9318 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[channel_index];
whismanoid 10:04022a61b527 9319 //
whismanoid 10:04022a61b527 9320 // WIP SampleRate_of_FILTER_CONV_START() MAX11410EMC-FW slow ODR 10Sps #262
whismanoid 10:04022a61b527 9321 // adjust the MAX11410.loop_limit value if the sample rate is set to a value slower than 20sps
whismanoid 10:04022a61b527 9322 // SampleRate_of_FILTER_CONV_START(uint8_t FILTER_RegValue, uint8_t CONV_START_RegValue)
whismanoid 10:04022a61b527 9323 double SampleRate = g_MAX11410_device.SampleRate_of_FILTER_CONV_START(g_MAX11410_device.v_filter, MAX11410::MAX11410_CONV_TYPE_enum_t::CONV_TYPE_01_Continuous);
whismanoid 10:04022a61b527 9324 if (SampleRate < 20.0) {
whismanoid 10:04022a61b527 9325 g_MAX11410_device.loop_limit = 32767; // TODO: is this timeout long enough for the slow output data rates?
whismanoid 10:04022a61b527 9326 }
whismanoid 10:04022a61b527 9327 //
whismanoid 10:04022a61b527 9328 // diagnostic GPIO pulse on MAX11410 GP0 pin (0xc3 = logic 0, 0xc4 = logic 1)
whismanoid 10:04022a61b527 9329 g_MAX11410_device.RegWrite(MAX11410::CMD_r000_0100_dddd_xddd_GP0_CTRL, 0xc3); // GP0 = 0
whismanoid 10:04022a61b527 9330 //
whismanoid 10:04022a61b527 9331 #if SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 10:04022a61b527 9332 // MAX11410 v_ctrl bipolar configuration or unipolar?
whismanoid 10:04022a61b527 9333 if ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) {
whismanoid 10:04022a61b527 9334 const MAX11410::MAX11410_AINP_SEL_enum_t ainp = (MAX11410::MAX11410_AINP_SEL_enum_t)(channel_index);
whismanoid 10:04022a61b527 9335 const MAX11410::MAX11410_AINN_SEL_enum_t ainn = (MAX11410::MAX11410_AINN_SEL_enum_t)(channel_index^1);
whismanoid 10:04022a61b527 9336 SPI_AIN_Voltage[channel_index] = g_MAX11410_device.Measure_Voltage(ainp, ainn);
whismanoid 10:04022a61b527 9337 // @post AINcode[ainp]: measurement result LSB code
whismanoid 10:04022a61b527 9338 }
whismanoid 10:04022a61b527 9339 else {
whismanoid 10:04022a61b527 9340 const MAX11410::MAX11410_AINP_SEL_enum_t ainp = (MAX11410::MAX11410_AINP_SEL_enum_t)(channel_index);
whismanoid 10:04022a61b527 9341 const MAX11410::MAX11410_AINN_SEL_enum_t ainn = MAX11410::AINN_SEL_1010_GND;
whismanoid 10:04022a61b527 9342 SPI_AIN_Voltage[channel_index] = g_MAX11410_device.Measure_Voltage(ainp, ainn);
whismanoid 10:04022a61b527 9343 // @post AINcode[ainp]: measurement result LSB code
whismanoid 10:04022a61b527 9344 }
whismanoid 10:04022a61b527 9345 #endif // SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 10:04022a61b527 9346 //
whismanoid 10:04022a61b527 9347 // diagnostic GPIO pulse on MAX11410 GP0 pin (0xc3 = logic 0, 0xc4 = logic 1)
whismanoid 10:04022a61b527 9348 g_MAX11410_device.RegWrite(MAX11410::CMD_r000_0100_dddd_xddd_GP0_CTRL, 0xc4); // GP0 = 1
whismanoid 10:04022a61b527 9349 //
whismanoid 10:04022a61b527 9350 }
whismanoid 10:04022a61b527 9351 // diagnostic GPIO pulse on MAX11410 GP1 pin (0xc3 = logic 0, 0xc4 = logic 1)
whismanoid 10:04022a61b527 9352 g_MAX11410_device.RegWrite(MAX11410::CMD_r000_0101_dddd_xddd_GP1_CTRL, 0xc4); // GP1 = 1
whismanoid 10:04022a61b527 9353 #else
whismanoid 5:aaf8b5f5fda1 9354 g_MAX11410_device.Read_All_Voltages();
whismanoid 10:04022a61b527 9355 #endif
whismanoid 10:04022a61b527 9356 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 5:aaf8b5f5fda1 9357 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 5:aaf8b5f5fda1 9358 // mbed
whismanoid 5:aaf8b5f5fda1 9359 // Platform board uses simple analog inputs
whismanoid 5:aaf8b5f5fda1 9360 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 5:aaf8b5f5fda1 9361 Platform_LSB[0] = analogIn0.read();
whismanoid 5:aaf8b5f5fda1 9362 Platform_LSB[1] = analogIn1.read();
whismanoid 5:aaf8b5f5fda1 9363 Platform_LSB[2] = analogIn2.read();
whismanoid 5:aaf8b5f5fda1 9364 Platform_LSB[3] = analogIn3.read();
whismanoid 5:aaf8b5f5fda1 9365 Platform_LSB[4] = analogIn4.read();
whismanoid 5:aaf8b5f5fda1 9366 Platform_LSB[5] = analogIn5.read();
whismanoid 10:04022a61b527 9367 #endif
whismanoid 10:04022a61b527 9368 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 37:3f369235e5bc 9369 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 9370 // #if USE_Platform_AIN_Average -- for (i=0; i<Platform_AIN_Average_N; i++) -- analogIn012345.read()
whismanoid 37:3f369235e5bc 9371 // float normValue_0_1 = analogInPin.read(); but mean of Platform_AIN_Average_N samples
whismanoid 37:3f369235e5bc 9372 float analogIn0_normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 9373 float analogIn1_normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 9374 float analogIn2_normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 9375 float analogIn3_normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 9376 float analogIn4_normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 9377 float analogIn5_normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 9378 for (int i = 0; i < Platform_AIN_Average_N; i++) {
whismanoid 37:3f369235e5bc 9379 analogIn0_normValue_0_1 = analogIn0_normValue_0_1 + analogIn0.read();
whismanoid 37:3f369235e5bc 9380 analogIn1_normValue_0_1 = analogIn1_normValue_0_1 + analogIn1.read();
whismanoid 37:3f369235e5bc 9381 analogIn2_normValue_0_1 = analogIn2_normValue_0_1 + analogIn2.read();
whismanoid 37:3f369235e5bc 9382 analogIn3_normValue_0_1 = analogIn3_normValue_0_1 + analogIn3.read();
whismanoid 37:3f369235e5bc 9383 analogIn4_normValue_0_1 = analogIn4_normValue_0_1 + analogIn4.read();
whismanoid 37:3f369235e5bc 9384 analogIn5_normValue_0_1 = analogIn5_normValue_0_1 + analogIn5.read();
whismanoid 37:3f369235e5bc 9385 }
whismanoid 37:3f369235e5bc 9386 analogIn0_normValue_0_1 = analogIn0_normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 9387 analogIn1_normValue_0_1 = analogIn1_normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 9388 analogIn2_normValue_0_1 = analogIn2_normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 9389 analogIn3_normValue_0_1 = analogIn3_normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 9390 analogIn4_normValue_0_1 = analogIn4_normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 9391 analogIn5_normValue_0_1 = analogIn5_normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 9392 #else // USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 9393 float analogIn0_normValue_0_1 = analogIn0.read();
whismanoid 37:3f369235e5bc 9394 float analogIn1_normValue_0_1 = analogIn1.read();
whismanoid 37:3f369235e5bc 9395 float analogIn2_normValue_0_1 = analogIn2.read();
whismanoid 37:3f369235e5bc 9396 float analogIn3_normValue_0_1 = analogIn3.read();
whismanoid 37:3f369235e5bc 9397 float analogIn4_normValue_0_1 = analogIn4.read();
whismanoid 37:3f369235e5bc 9398 float analogIn5_normValue_0_1 = analogIn5.read();
whismanoid 37:3f369235e5bc 9399 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 9400 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 9401 // apply calibration to normValue_0_1 value
whismanoid 37:3f369235e5bc 9402 Platform_Voltage[0] = CalibratedNormValue(0, analogIn0_normValue_0_1) * adc_full_scale_voltage[0];
whismanoid 37:3f369235e5bc 9403 Platform_Voltage[1] = CalibratedNormValue(1, analogIn1_normValue_0_1) * adc_full_scale_voltage[1];
whismanoid 37:3f369235e5bc 9404 Platform_Voltage[2] = CalibratedNormValue(2, analogIn2_normValue_0_1) * adc_full_scale_voltage[2];
whismanoid 37:3f369235e5bc 9405 Platform_Voltage[3] = CalibratedNormValue(3, analogIn3_normValue_0_1) * adc_full_scale_voltage[3];
whismanoid 37:3f369235e5bc 9406 Platform_Voltage[4] = CalibratedNormValue(4, analogIn4_normValue_0_1) * adc_full_scale_voltage[4];
whismanoid 37:3f369235e5bc 9407 Platform_Voltage[5] = CalibratedNormValue(5, analogIn5_normValue_0_1) * adc_full_scale_voltage[5];
whismanoid 34:a1993a1ee904 9408 #else // HAS_Platform_AIN_Calibration
whismanoid 37:3f369235e5bc 9409 Platform_Voltage[0] = analogIn0_normValue_0_1 * adc_full_scale_voltage[0];
whismanoid 37:3f369235e5bc 9410 Platform_Voltage[1] = analogIn1_normValue_0_1 * adc_full_scale_voltage[1];
whismanoid 37:3f369235e5bc 9411 Platform_Voltage[2] = analogIn2_normValue_0_1 * adc_full_scale_voltage[2];
whismanoid 37:3f369235e5bc 9412 Platform_Voltage[3] = analogIn3_normValue_0_1 * adc_full_scale_voltage[3];
whismanoid 37:3f369235e5bc 9413 Platform_Voltage[4] = analogIn4_normValue_0_1 * adc_full_scale_voltage[4];
whismanoid 37:3f369235e5bc 9414 Platform_Voltage[5] = analogIn5_normValue_0_1 * adc_full_scale_voltage[5];
whismanoid 34:a1993a1ee904 9415 #endif // HAS_Platform_AIN_Calibration
whismanoid 37:3f369235e5bc 9416 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 5:aaf8b5f5fda1 9417 #endif // defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 5:aaf8b5f5fda1 9418
whismanoid 5:aaf8b5f5fda1 9419 #if VERIFY_PART_ID_IN_LOOP
whismanoid 5:aaf8b5f5fda1 9420 // PART_ID field: Device ID Validation
whismanoid 5:aaf8b5f5fda1 9421 const uint32_t part_id_expect = 0x000F02;
whismanoid 5:aaf8b5f5fda1 9422 uint32_t part_id_readback;
whismanoid 5:aaf8b5f5fda1 9423 g_MAX11410_device.RegRead(MAX11410::CMD_r001_0001_xxxx_xxxx_xxxx_xxxx_xxxx_xddd_PART_ID, &part_id_readback);
whismanoid 5:aaf8b5f5fda1 9424 #endif // VERIFY_PART_ID_IN_LOOP
whismanoid 5:aaf8b5f5fda1 9425 } // void Datalogger_AcquireRow()
whismanoid 5:aaf8b5f5fda1 9426
whismanoid 17:9397ea3ea7e9 9427 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 9428 //--------------------------------------------------
whismanoid 17:9397ea3ea7e9 9429 // TODO: Datalogger_RunActionTable() between Datalogger_AcquireRow() and Datalogger_PrintRow()
whismanoid 17:9397ea3ea7e9 9430 void Datalogger_RunActionTable()
whismanoid 17:9397ea3ea7e9 9431 {
whismanoid 17:9397ea3ea7e9 9432 if (Datalogger_action_table_enabled == false) {
whismanoid 17:9397ea3ea7e9 9433 return;
whismanoid 17:9397ea3ea7e9 9434 }
whismanoid 17:9397ea3ea7e9 9435 // TODO: verbose Datalogger_RunActionTable() emit a csv column ,"Action"
whismanoid 17:9397ea3ea7e9 9436 // TODO: assert Datalogger_action_table_row_count < ACTION_TABLE_ROW_MAX
whismanoid 17:9397ea3ea7e9 9437 // for Datalogger_action_table[0..Datalogger_action_table_row_count]
whismanoid 17:9397ea3ea7e9 9438 for (int i = 0; i < Datalogger_action_table_row_count; i++)
whismanoid 17:9397ea3ea7e9 9439 {
whismanoid 17:9397ea3ea7e9 9440 // skip if Datalogger_action_table[i].action == action_noop
whismanoid 17:9397ea3ea7e9 9441 if (Datalogger_action_table[i].action == action_noop) {
whismanoid 17:9397ea3ea7e9 9442 continue;
whismanoid 17:9397ea3ea7e9 9443 }
whismanoid 17:9397ea3ea7e9 9444 // TODO: test Datalogger_action_table[i].condition "if="
whismanoid 17:9397ea3ea7e9 9445 // TODO: Could the .condition field also distinguish Platform ADC from SPI ADC?
whismanoid 17:9397ea3ea7e9 9446 // That way we keep both sets of ADC channels in separate lists
whismanoid 17:9397ea3ea7e9 9447 // if=0 -- always
whismanoid 17:9397ea3ea7e9 9448 // if=1,2,3,4,5,6 -- Platform_Voltage[ch] > < == >= <= != threshold
whismanoid 17:9397ea3ea7e9 9449 // if=7,8,9,10,11,12 -- SPI_AIN_Voltage[ch] > < == >= <= != threshold
whismanoid 17:9397ea3ea7e9 9450 // also, are we comparing code or voltage?
whismanoid 17:9397ea3ea7e9 9451 // TODO: selected Datalogger_action_table[i].condition_channel
whismanoid 17:9397ea3ea7e9 9452 // Datalogger could have both platform ADC and external SPI ADC channels
whismanoid 17:9397ea3ea7e9 9453 // if SPI_ADC_DeviceName
whismanoid 17:9397ea3ea7e9 9454 // NUM_DUT_ANALOG_IN_CHANNELS
whismanoid 17:9397ea3ea7e9 9455 // SPI_AIN_Enable_ch[]
whismanoid 17:9397ea3ea7e9 9456 // SPI_AIN_customChannelHeader_ch[]
whismanoid 17:9397ea3ea7e9 9457 // SPI_AIN_Voltage[]
whismanoid 17:9397ea3ea7e9 9458 // if LOG_PLATFORM_AIN
whismanoid 17:9397ea3ea7e9 9459 // NUM_PLATFORM_ANALOG_IN_CHANNELS
whismanoid 17:9397ea3ea7e9 9460 // analogInPin_fullScaleVoltage[]
whismanoid 17:9397ea3ea7e9 9461 // Platform_Enable_ch[]
whismanoid 17:9397ea3ea7e9 9462 // Platform_AIN_customChannelHeader_ch[]
whismanoid 17:9397ea3ea7e9 9463 // Platform_Voltage[]
whismanoid 55:477ba09475d7 9464 // selected Datalogger_action_table[i].condition_threshold
whismanoid 55:477ba09475d7 9465 // WIP Datalog Math -- if channel has its math enabled, compare with the math-adjusted version. Keep it simple. #362
whismanoid 55:477ba09475d7 9466 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 9467 // WIP Datalog Math -- if channel has its math enabled, compare with the math-adjusted version. Keep it simple. #362
whismanoid 55:477ba09475d7 9468 // SPI_AIN_Voltage_test default value SPI_AIN_Voltage[Datalogger_action_table[i].condition_channel]
whismanoid 55:477ba09475d7 9469 double SPI_AIN_Voltage_test = SPI_AIN_Voltage[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9470 // SPI_AIN_Enable_Math_ch[] option to use math, update test_threshold
whismanoid 55:477ba09475d7 9471 // based on g_MAX11410_device.AINcode[] or SPI_AIN_Voltage[]
whismanoid 55:477ba09475d7 9472 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9473 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9474 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9475 // display unit string Platform_MathUnitString[]
whismanoid 57:9bc5ad707216 9476 if (SPI_AIN_Enable_Math_ch[Datalogger_action_table[i].condition_channel] == Platform_AIN_Enable_Math_LSB) {
whismanoid 55:477ba09475d7 9477 // Perform calculations based on g_MAX11410_device.AINcode[Datalogger_action_table[i].condition_channel]
whismanoid 55:477ba09475d7 9478 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9479 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9480 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9481 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9482 SPI_AIN_Voltage_test = (Platform_LSB[Datalogger_action_table[i].condition_channel] - SPI_AIN_MathOffsetA[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9483 SPI_AIN_Voltage_test = SPI_AIN_Voltage_test * SPI_AIN_MathGainMulA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9484 if (SPI_AIN_MathGainDivA[Datalogger_action_table[i].condition_channel] != 0) {
whismanoid 55:477ba09475d7 9485 SPI_AIN_Voltage_test = SPI_AIN_Voltage_test / SPI_AIN_MathGainDivA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9486 }
whismanoid 55:477ba09475d7 9487 //
whismanoid 55:477ba09475d7 9488 cmdLine.serial().printf("%d", SPI_AIN_Voltage_test);
whismanoid 55:477ba09475d7 9489 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9490 // cmdLine.serial().printf("%s", SPI_AIN_MathUnitString[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9491 }
whismanoid 57:9bc5ad707216 9492 if (SPI_AIN_Enable_Math_ch[Datalogger_action_table[i].condition_channel] == Platform_AIN_Enable_Math_Volt) {
whismanoid 55:477ba09475d7 9493 // Perform calculations based on SPI_AIN_Voltage[Datalogger_action_table[i].condition_channel]
whismanoid 55:477ba09475d7 9494 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9495 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9496 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9497 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9498 SPI_AIN_Voltage_test = (SPI_AIN_Voltage[Datalogger_action_table[i].condition_channel] - SPI_AIN_MathOffsetA[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9499 SPI_AIN_Voltage_test = SPI_AIN_Voltage_test * SPI_AIN_MathGainMulA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9500 if (SPI_AIN_MathGainDivA[Datalogger_action_table[i].condition_channel] != 0) {
whismanoid 55:477ba09475d7 9501 SPI_AIN_Voltage_test = SPI_AIN_Voltage_test / SPI_AIN_MathGainDivA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9502 }
whismanoid 55:477ba09475d7 9503 //
whismanoid 55:477ba09475d7 9504 cmdLine.serial().printf("%6.6f", SPI_AIN_Voltage_test);
whismanoid 55:477ba09475d7 9505 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9506 // cmdLine.serial().printf("%s", SPI_AIN_MathUnitString[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9507 }
whismanoid 55:477ba09475d7 9508 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 9509 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9510 // WIP Datalog Math -- if channel has its math enabled, compare with the math-adjusted version. Keep it simple. #362
whismanoid 55:477ba09475d7 9511 // Platform_Voltage_test default value Platform_Voltage[Datalogger_action_table[i].condition_channel]
whismanoid 55:477ba09475d7 9512 double Platform_Voltage_test = Platform_Voltage[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9513 // Platform_Enable_Math_ch[] option to use math, update test_threshold
whismanoid 55:477ba09475d7 9514 // based on Platform_LSB[] or Platform_Voltage[]
whismanoid 55:477ba09475d7 9515 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9516 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9517 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9518 // display unit string Platform_MathUnitString[]
whismanoid 57:9bc5ad707216 9519 if (Platform_Enable_Math_ch[Datalogger_action_table[i].condition_channel] == Platform_AIN_Enable_Math_LSB) {
whismanoid 55:477ba09475d7 9520 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 55:477ba09475d7 9521 // Perform calculations based on Platform_LSB[Datalogger_action_table[i].condition_channel]
whismanoid 55:477ba09475d7 9522 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9523 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9524 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9525 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9526 Platform_Voltage_test = (Platform_LSB[Datalogger_action_table[i].condition_channel] - Platform_MathOffsetA[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9527 Platform_Voltage_test = Platform_Voltage_test * Platform_MathGainMulA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9528 if (Platform_MathGainDivA[Datalogger_action_table[i].condition_channel] != 0) {
whismanoid 55:477ba09475d7 9529 Platform_Voltage_test = Platform_Voltage_test / Platform_MathGainDivA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9530 }
whismanoid 55:477ba09475d7 9531 //
whismanoid 55:477ba09475d7 9532 // cmdLine.serial().printf("%u", Platform_Voltage_test);
whismanoid 55:477ba09475d7 9533 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9534 // cmdLine.serial().printf("%s", Platform_MathUnitString[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9535 #endif
whismanoid 55:477ba09475d7 9536 }
whismanoid 57:9bc5ad707216 9537 if (Platform_Enable_Math_ch[Datalogger_action_table[i].condition_channel] == Platform_AIN_Enable_Math_Volt) {
whismanoid 55:477ba09475d7 9538 // Perform calculations based on Platform_Voltage[Datalogger_action_table[i].condition_channel]
whismanoid 55:477ba09475d7 9539 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9540 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9541 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9542 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9543 Platform_Voltage_test = (Platform_Voltage[Datalogger_action_table[i].condition_channel] - Platform_MathOffsetA[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9544 Platform_Voltage_test = Platform_Voltage_test * Platform_MathGainMulA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9545 if (Platform_MathGainDivA[Datalogger_action_table[i].condition_channel] != 0) {
whismanoid 55:477ba09475d7 9546 Platform_Voltage_test = Platform_Voltage_test / Platform_MathGainDivA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9547 }
whismanoid 55:477ba09475d7 9548 //
whismanoid 55:477ba09475d7 9549 // cmdLine.serial().printf("%6.6f", Platform_Voltage_test);
whismanoid 55:477ba09475d7 9550 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9551 // cmdLine.serial().printf("%s", Platform_MathUnitString[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9552 }
whismanoid 61:52456e705fa8 9553 if (Platform_Enable_ch[Datalogger_action_table[i].condition_channel] == Platform_AIN_Enable_Math_Volt) {
whismanoid 61:52456e705fa8 9554 // Perform calculations based on Platform_Voltage[Datalogger_action_table[i].condition_channel]
whismanoid 61:52456e705fa8 9555 // apply offset Platform_MathOffsetA[]
whismanoid 61:52456e705fa8 9556 // apply gain Platform_MathGainMulA[]
whismanoid 61:52456e705fa8 9557 // apply 1/gain Platform_MathGainDivA[]
whismanoid 61:52456e705fa8 9558 // display unit string Platform_MathUnitString[]
whismanoid 61:52456e705fa8 9559 Platform_Voltage_test = (Platform_Voltage[Datalogger_action_table[i].condition_channel] - Platform_MathOffsetA[Datalogger_action_table[i].condition_channel]);
whismanoid 61:52456e705fa8 9560 Platform_Voltage_test = Platform_Voltage_test * Platform_MathGainMulA[Datalogger_action_table[i].condition_channel];
whismanoid 61:52456e705fa8 9561 if (Platform_MathGainDivA[Datalogger_action_table[i].condition_channel] != 0) {
whismanoid 61:52456e705fa8 9562 Platform_Voltage_test = Platform_Voltage_test / Platform_MathGainDivA[Datalogger_action_table[i].condition_channel];
whismanoid 61:52456e705fa8 9563 }
whismanoid 61:52456e705fa8 9564 //
whismanoid 61:52456e705fa8 9565 // cmdLine.serial().printf("%6.6f", Platform_Voltage_test);
whismanoid 61:52456e705fa8 9566 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 61:52456e705fa8 9567 // cmdLine.serial().printf("%s", Platform_MathUnitString[Datalogger_action_table[i].condition_channel]);
whismanoid 61:52456e705fa8 9568 }
whismanoid 55:477ba09475d7 9569 #endif // PLATFORM_AIN_MATH
whismanoid 17:9397ea3ea7e9 9570 switch(Datalogger_action_table[i].condition)
whismanoid 17:9397ea3ea7e9 9571 {
whismanoid 17:9397ea3ea7e9 9572 case condition_always:
whismanoid 17:9397ea3ea7e9 9573 //~ cmdLine.serial().printf(" always");
whismanoid 17:9397ea3ea7e9 9574 break;
whismanoid 17:9397ea3ea7e9 9575 case condition_if_An_gt_threshold:
whismanoid 17:9397ea3ea7e9 9576 //~ cmdLine.serial().printf(" if A%d > %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9577 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 9578 if (!(Platform_Voltage_test > Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9579 continue;
whismanoid 17:9397ea3ea7e9 9580 }
whismanoid 17:9397ea3ea7e9 9581 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 17:9397ea3ea7e9 9582 break;
whismanoid 17:9397ea3ea7e9 9583 case condition_if_An_lt_threshold:
whismanoid 17:9397ea3ea7e9 9584 //~ cmdLine.serial().printf(" if A%d < %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9585 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 9586 if (!(Platform_Voltage_test < Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9587 continue;
whismanoid 17:9397ea3ea7e9 9588 }
whismanoid 17:9397ea3ea7e9 9589 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 17:9397ea3ea7e9 9590 break;
whismanoid 17:9397ea3ea7e9 9591 case condition_if_An_eq_threshold:
whismanoid 17:9397ea3ea7e9 9592 //~ cmdLine.serial().printf(" if A%d == %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9593 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 9594 if (!(Platform_Voltage_test == Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9595 continue;
whismanoid 17:9397ea3ea7e9 9596 }
whismanoid 17:9397ea3ea7e9 9597 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 17:9397ea3ea7e9 9598 break;
whismanoid 17:9397ea3ea7e9 9599 case condition_if_An_ge_threshold:
whismanoid 17:9397ea3ea7e9 9600 //~ cmdLine.serial().printf(" if A%d >= %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9601 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 9602 if (!(Platform_Voltage_test >= Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9603 continue;
whismanoid 17:9397ea3ea7e9 9604 }
whismanoid 17:9397ea3ea7e9 9605 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 17:9397ea3ea7e9 9606 break;
whismanoid 17:9397ea3ea7e9 9607 case condition_if_An_le_threshold:
whismanoid 17:9397ea3ea7e9 9608 //~ cmdLine.serial().printf(" if A%d <= %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9609 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 9610 if (!(Platform_Voltage_test <= Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9611 continue;
whismanoid 17:9397ea3ea7e9 9612 }
whismanoid 17:9397ea3ea7e9 9613 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 17:9397ea3ea7e9 9614 break;
whismanoid 17:9397ea3ea7e9 9615 case condition_if_An_ne_threshold:
whismanoid 17:9397ea3ea7e9 9616 //~ cmdLine.serial().printf(" if A%d != %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9617 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 17:9397ea3ea7e9 9618 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 55:477ba09475d7 9619 if (!(Platform_Voltage_test != Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9620 continue;
whismanoid 17:9397ea3ea7e9 9621 }
whismanoid 17:9397ea3ea7e9 9622 break;
whismanoid 17:9397ea3ea7e9 9623 case condition_if_AINn_gt_threshold:
whismanoid 17:9397ea3ea7e9 9624 //~ cmdLine.serial().printf(" if AIN%d > %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9625 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 9626 if (!(SPI_AIN_Voltage_test > Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9627 continue;
whismanoid 17:9397ea3ea7e9 9628 }
whismanoid 17:9397ea3ea7e9 9629 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 17:9397ea3ea7e9 9630 break;
whismanoid 17:9397ea3ea7e9 9631 case condition_if_AINn_lt_threshold:
whismanoid 17:9397ea3ea7e9 9632 //~ cmdLine.serial().printf(" if AIN%d < %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9633 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 9634 if (!(SPI_AIN_Voltage_test < Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9635 continue;
whismanoid 17:9397ea3ea7e9 9636 }
whismanoid 17:9397ea3ea7e9 9637 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 17:9397ea3ea7e9 9638 break;
whismanoid 17:9397ea3ea7e9 9639 case condition_if_AINn_eq_threshold:
whismanoid 17:9397ea3ea7e9 9640 //~ cmdLine.serial().printf(" if AIN%d == %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9641 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 9642 if (!(SPI_AIN_Voltage_test == Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9643 continue;
whismanoid 17:9397ea3ea7e9 9644 }
whismanoid 17:9397ea3ea7e9 9645 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 17:9397ea3ea7e9 9646 break;
whismanoid 17:9397ea3ea7e9 9647 case condition_if_AINn_ge_threshold:
whismanoid 17:9397ea3ea7e9 9648 //~ cmdLine.serial().printf(" if AIN%d >= %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9649 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 9650 if (!(SPI_AIN_Voltage_test >= Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9651 continue;
whismanoid 17:9397ea3ea7e9 9652 }
whismanoid 17:9397ea3ea7e9 9653 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 17:9397ea3ea7e9 9654 break;
whismanoid 17:9397ea3ea7e9 9655 case condition_if_AINn_le_threshold:
whismanoid 17:9397ea3ea7e9 9656 //~ cmdLine.serial().printf(" if AIN%d <= %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9657 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 9658 if (!(SPI_AIN_Voltage_test <= Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9659 continue;
whismanoid 17:9397ea3ea7e9 9660 }
whismanoid 17:9397ea3ea7e9 9661 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 17:9397ea3ea7e9 9662 break;
whismanoid 17:9397ea3ea7e9 9663 case condition_if_AINn_ne_threshold:
whismanoid 17:9397ea3ea7e9 9664 //~ cmdLine.serial().printf(" if AIN%d != %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9665 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 9666 if (!(SPI_AIN_Voltage_test != Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9667 continue;
whismanoid 17:9397ea3ea7e9 9668 }
whismanoid 17:9397ea3ea7e9 9669 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 17:9397ea3ea7e9 9670 break;
whismanoid 17:9397ea3ea7e9 9671 } // switch(Datalogger_action_table[i].condition)
whismanoid 17:9397ea3ea7e9 9672 // selected Datalogger_action_table[i].digitalOutPin
whismanoid 17:9397ea3ea7e9 9673 // perform selected Datalogger_action_table[i].action
whismanoid 17:9397ea3ea7e9 9674 switch(Datalogger_action_table[i].action)
whismanoid 17:9397ea3ea7e9 9675 {
whismanoid 17:9397ea3ea7e9 9676 case action_noop:
whismanoid 17:9397ea3ea7e9 9677 //~ cmdLine.serial().printf("No_Operation");
whismanoid 17:9397ea3ea7e9 9678 break;
whismanoid 17:9397ea3ea7e9 9679 case action_digitalOutLow:
whismanoid 17:9397ea3ea7e9 9680 {
whismanoid 17:9397ea3ea7e9 9681 //~ cmdLine.serial().printf("digitalOutLow");
whismanoid 17:9397ea3ea7e9 9682 //~ cmdLine.serial().printf(" D%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 17:9397ea3ea7e9 9683 // perform action digitalOutLow
whismanoid 17:9397ea3ea7e9 9684 int pinIndex = Datalogger_action_table[i].digitalOutPin;
whismanoid 17:9397ea3ea7e9 9685 #if ARDUINO_STYLE
whismanoid 17:9397ea3ea7e9 9686 pinMode(pinIndex, OUTPUT); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 17:9397ea3ea7e9 9687 digitalWrite(pinIndex, LOW); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 17:9397ea3ea7e9 9688 #else
whismanoid 17:9397ea3ea7e9 9689 DigitalInOut& digitalInOutPin = find_digitalInOutPin(pinIndex);
whismanoid 17:9397ea3ea7e9 9690 digitalInOutPin.output();
whismanoid 17:9397ea3ea7e9 9691 digitalInOutPin.write(0);
whismanoid 17:9397ea3ea7e9 9692 #endif
whismanoid 17:9397ea3ea7e9 9693 }
whismanoid 17:9397ea3ea7e9 9694 break;
whismanoid 17:9397ea3ea7e9 9695 case action_digitalOutHigh:
whismanoid 17:9397ea3ea7e9 9696 {
whismanoid 17:9397ea3ea7e9 9697 //~ cmdLine.serial().printf("digitalOutHigh");
whismanoid 17:9397ea3ea7e9 9698 //~ cmdLine.serial().printf(" D%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 17:9397ea3ea7e9 9699 // perform action digitalOutHigh
whismanoid 17:9397ea3ea7e9 9700 int pinIndex = Datalogger_action_table[i].digitalOutPin;
whismanoid 17:9397ea3ea7e9 9701 #if ARDUINO_STYLE
whismanoid 17:9397ea3ea7e9 9702 pinMode(pinIndex, OUTPUT); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 17:9397ea3ea7e9 9703 digitalWrite(pinIndex, HIGH); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 17:9397ea3ea7e9 9704 #else
whismanoid 17:9397ea3ea7e9 9705 DigitalInOut& digitalInOutPin = find_digitalInOutPin(pinIndex);
whismanoid 17:9397ea3ea7e9 9706 digitalInOutPin.output();
whismanoid 17:9397ea3ea7e9 9707 digitalInOutPin.write(1);
whismanoid 17:9397ea3ea7e9 9708 #endif
whismanoid 17:9397ea3ea7e9 9709 }
whismanoid 17:9397ea3ea7e9 9710 break;
whismanoid 29:6a9edb6e973b 9711 case action_button: // pin = button index 1, 2, 3
whismanoid 29:6a9edb6e973b 9712 {
whismanoid 30:07197a430869 9713 // don't allow onButton1FallingEdge() command processing to halt the datalog
whismanoid 30:07197a430869 9714 Datalogger_Trigger_enum_t saved_Datalogger_Trigger = Datalogger_Trigger;
whismanoid 29:6a9edb6e973b 9715 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9716 switch (Datalogger_action_table[i].digitalOutPin) // pin = button index 1, 2, 3
whismanoid 29:6a9edb6e973b 9717 {
whismanoid 29:6a9edb6e973b 9718 case 1:
whismanoid 29:6a9edb6e973b 9719 onButton1FallingEdge();
whismanoid 29:6a9edb6e973b 9720 break;
whismanoid 29:6a9edb6e973b 9721 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9722 case 2:
whismanoid 29:6a9edb6e973b 9723 onButton2FallingEdge();
whismanoid 29:6a9edb6e973b 9724 break;
whismanoid 29:6a9edb6e973b 9725 #endif // HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9726 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9727 case 3:
whismanoid 29:6a9edb6e973b 9728 onButton3FallingEdge();
whismanoid 29:6a9edb6e973b 9729 break;
whismanoid 29:6a9edb6e973b 9730 #endif // HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9731 #if HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9732 case 4:
whismanoid 29:6a9edb6e973b 9733 onButton4FallingEdge();
whismanoid 29:6a9edb6e973b 9734 break;
whismanoid 29:6a9edb6e973b 9735 #endif // HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9736 #if HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9737 case 5:
whismanoid 29:6a9edb6e973b 9738 onButton5FallingEdge();
whismanoid 29:6a9edb6e973b 9739 break;
whismanoid 29:6a9edb6e973b 9740 #endif // HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9741 #if HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9742 case 6:
whismanoid 29:6a9edb6e973b 9743 onButton6FallingEdge();
whismanoid 29:6a9edb6e973b 9744 break;
whismanoid 29:6a9edb6e973b 9745 #endif // HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9746 #if HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9747 case 7:
whismanoid 29:6a9edb6e973b 9748 onButton7FallingEdge();
whismanoid 29:6a9edb6e973b 9749 break;
whismanoid 29:6a9edb6e973b 9750 #endif // HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9751 #if HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9752 case 8:
whismanoid 29:6a9edb6e973b 9753 onButton8FallingEdge();
whismanoid 29:6a9edb6e973b 9754 break;
whismanoid 29:6a9edb6e973b 9755 #endif // HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9756 #if HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9757 case 9:
whismanoid 29:6a9edb6e973b 9758 onButton9FallingEdge();
whismanoid 29:6a9edb6e973b 9759 break;
whismanoid 29:6a9edb6e973b 9760 #endif // HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9761 } // switch (Datalogger_action_table[i].digitalOutPin) // pin = button index 1, 2, 3
whismanoid 29:6a9edb6e973b 9762 #endif // HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 30:07197a430869 9763 // don't allow onButton1FallingEdge() command processing to halt the datalog
whismanoid 30:07197a430869 9764 Datalogger_Trigger = saved_Datalogger_Trigger;
whismanoid 29:6a9edb6e973b 9765 } // case action_button
whismanoid 29:6a9edb6e973b 9766 break;
whismanoid 17:9397ea3ea7e9 9767 case action_trigger_Halt:
whismanoid 17:9397ea3ea7e9 9768 //~ cmdLine.serial().printf("trigger_Halt");
whismanoid 17:9397ea3ea7e9 9769 // perform action trigger_Halt
whismanoid 17:9397ea3ea7e9 9770 Datalogger_Trigger = trigger_Halt;
whismanoid 17:9397ea3ea7e9 9771 //~ Datalogger_Need_PrintHeader = true;
whismanoid 17:9397ea3ea7e9 9772 break;
whismanoid 17:9397ea3ea7e9 9773 case action_trigger_FreeRun:
whismanoid 17:9397ea3ea7e9 9774 //~ cmdLine.serial().printf("trigger_FreeRun");
whismanoid 17:9397ea3ea7e9 9775 // perform action trigger_FreeRun
whismanoid 17:9397ea3ea7e9 9776 Datalogger_Trigger = trigger_FreeRun;
whismanoid 17:9397ea3ea7e9 9777 //~ Datalogger_Need_PrintHeader = true;
whismanoid 17:9397ea3ea7e9 9778 break;
whismanoid 17:9397ea3ea7e9 9779 case action_trigger_Timer:
whismanoid 17:9397ea3ea7e9 9780 //~ cmdLine.serial().printf("trigger_Timer");
whismanoid 17:9397ea3ea7e9 9781 //~ // print configuration for trigger_Timer
whismanoid 17:9397ea3ea7e9 9782 //~ cmdLine.serial().printf("(%d x %dmsec)", g_timer_interval_count, g_timer_interval_msec);
whismanoid 17:9397ea3ea7e9 9783 // perform action trigger_Timer
whismanoid 17:9397ea3ea7e9 9784 Datalogger_Trigger = trigger_Timer;
whismanoid 17:9397ea3ea7e9 9785 //~ Datalogger_Need_PrintHeader = true;
whismanoid 17:9397ea3ea7e9 9786 break;
whismanoid 17:9397ea3ea7e9 9787 case action_trigger_PlatformDigitalInput:
whismanoid 17:9397ea3ea7e9 9788 //~ cmdLine.serial().printf("trigger_PlatformDigitalInput");
whismanoid 17:9397ea3ea7e9 9789 //~ // TODO: print configuration for trigger_PlatformDigitalInput
whismanoid 17:9397ea3ea7e9 9790 //~ cmdLine.serial().printf("(%d)", g_config_PlatformDigitalInput);
whismanoid 17:9397ea3ea7e9 9791 // TODO: perform action action_trigger_PlatformDigitalInput
whismanoid 17:9397ea3ea7e9 9792 Datalogger_Trigger = trigger_PlatformDigitalInput;
whismanoid 17:9397ea3ea7e9 9793 //~ Datalogger_Need_PrintHeader = true;
whismanoid 17:9397ea3ea7e9 9794 break;
whismanoid 17:9397ea3ea7e9 9795 case action_trigger_SPIDeviceRegRead:
whismanoid 17:9397ea3ea7e9 9796 //~ cmdLine.serial().printf("trigger_SPIDeviceRegRead");
whismanoid 17:9397ea3ea7e9 9797 //~ // TODO: print configuration for trigger_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 9798 //~ cmdLine.serial().printf("(%d)", g_config_SPIDeviceRegRead);
whismanoid 17:9397ea3ea7e9 9799 // TODO: perform action action_trigger_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 9800 Datalogger_Trigger = trigger_SPIDeviceRegRead;
whismanoid 17:9397ea3ea7e9 9801 //~ Datalogger_Need_PrintHeader = true;
whismanoid 17:9397ea3ea7e9 9802 break;
whismanoid 17:9397ea3ea7e9 9803 } // switch(Datalogger_action_table[i].action)
whismanoid 17:9397ea3ea7e9 9804 // consider next row of action table
whismanoid 17:9397ea3ea7e9 9805 } // for ...Datalogger_action_table_row_count
whismanoid 17:9397ea3ea7e9 9806 }
whismanoid 17:9397ea3ea7e9 9807 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 9808
whismanoid 5:aaf8b5f5fda1 9809 //--------------------------------------------------
whismanoid 8:dffee7509bfb 9810 void Datalogger_PrintRow(CmdLine& cmdLine)
whismanoid 5:aaf8b5f5fda1 9811 {
whismanoid 5:aaf8b5f5fda1 9812 int field_index = 0;
whismanoid 5:aaf8b5f5fda1 9813 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 10:04022a61b527 9814 for (int channel_index = 0; channel_index < NUM_DUT_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 10:04022a61b527 9815 if (SPI_AIN_Enable_ch[channel_index] == SPI_AIN_Disable) {
whismanoid 5:aaf8b5f5fda1 9816 continue;
whismanoid 5:aaf8b5f5fda1 9817 }
whismanoid 5:aaf8b5f5fda1 9818 // comma between fields
whismanoid 5:aaf8b5f5fda1 9819 if (field_index > 0) {
whismanoid 5:aaf8b5f5fda1 9820 cmdLine.serial().printf(",");
whismanoid 5:aaf8b5f5fda1 9821 }
whismanoid 10:04022a61b527 9822 field_index++;
whismanoid 10:04022a61b527 9823 if (SPI_AIN_Enable_ch[channel_index] == Platform_AIN_Enable_LSB) {
whismanoid 10:04022a61b527 9824 cmdLine.serial().printf("%d", g_MAX11410_device.AINcode[channel_index]);
whismanoid 10:04022a61b527 9825 }
whismanoid 10:04022a61b527 9826 if (SPI_AIN_Enable_ch[channel_index] == Platform_AIN_Enable_Volt) {
whismanoid 10:04022a61b527 9827 // TODO: report Voltage instead of LSB
whismanoid 10:04022a61b527 9828 // Serial.print(SPI_AIN_Voltage[channel_index]);
whismanoid 10:04022a61b527 9829 static char strOutLineBuffer[16];
whismanoid 10:04022a61b527 9830 cmdLine.serial().printf("%6.6f", SPI_AIN_Voltage[channel_index]);
whismanoid 10:04022a61b527 9831 }
whismanoid 55:477ba09475d7 9832 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_LSB - display math result instead of LSB in channel# position
whismanoid 55:477ba09475d7 9833 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 9834 if (SPI_AIN_Enable_ch[channel_index] == Platform_AIN_Enable_Math_LSB) {
whismanoid 55:477ba09475d7 9835 // Perform calculations based on g_MAX11410_device.AINcode[channel_index]
whismanoid 55:477ba09475d7 9836 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9837 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9838 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9839 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9840 double x = (Platform_LSB[channel_index] - SPI_AIN_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9841 x = x * SPI_AIN_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 9842 if (SPI_AIN_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9843 x = x / SPI_AIN_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 9844 }
whismanoid 55:477ba09475d7 9845 //
whismanoid 55:477ba09475d7 9846 cmdLine.serial().printf("%d", x);
whismanoid 55:477ba09475d7 9847 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9848 // cmdLine.serial().printf("%s", SPI_AIN_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9849 }
whismanoid 55:477ba09475d7 9850 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 9851 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_Volt - display math result instead of volts in channel# position
whismanoid 55:477ba09475d7 9852 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 9853 if (SPI_AIN_Enable_ch[channel_index] == Platform_AIN_Enable_Math_Volt) {
whismanoid 55:477ba09475d7 9854 // Perform calculations based on SPI_AIN_Voltage[channel_index]
whismanoid 55:477ba09475d7 9855 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9856 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9857 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9858 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9859 double x = (SPI_AIN_Voltage[channel_index] - SPI_AIN_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9860 x = x * SPI_AIN_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 9861 if (SPI_AIN_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9862 x = x / SPI_AIN_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 9863 }
whismanoid 55:477ba09475d7 9864 //
whismanoid 55:477ba09475d7 9865 cmdLine.serial().printf("%6.6f", x);
whismanoid 55:477ba09475d7 9866 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9867 // cmdLine.serial().printf("%s", SPI_AIN_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9868 }
whismanoid 55:477ba09475d7 9869 #endif // SPI_AIN_MATH
whismanoid 5:aaf8b5f5fda1 9870 }
whismanoid 5:aaf8b5f5fda1 9871 #if VERIFY_PART_ID_IN_LOOP
whismanoid 5:aaf8b5f5fda1 9872 // PART_ID field: Device ID Validation
whismanoid 5:aaf8b5f5fda1 9873 if (part_id_readback != part_id_expect) {
whismanoid 5:aaf8b5f5fda1 9874 cmdLine.serial().printf(",\"FAIL\"");
whismanoid 9:45f98573eb6d 9875 need_reinit = true;
whismanoid 5:aaf8b5f5fda1 9876 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 5:aaf8b5f5fda1 9877 g_MAX11410_device.Init();
whismanoid 5:aaf8b5f5fda1 9878 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[0];
whismanoid 5:aaf8b5f5fda1 9879 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[0];
whismanoid 5:aaf8b5f5fda1 9880 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[0];
whismanoid 5:aaf8b5f5fda1 9881 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 5:aaf8b5f5fda1 9882 }
whismanoid 5:aaf8b5f5fda1 9883 else {
whismanoid 5:aaf8b5f5fda1 9884 cmdLine.serial().printf(",\"OK\"");
whismanoid 5:aaf8b5f5fda1 9885 }
whismanoid 5:aaf8b5f5fda1 9886 #endif // VERIFY_PART_ID_IN_LOOP
whismanoid 55:477ba09475d7 9887 // MAX40108 Datalog Math #362 -- Datalogger_PrintRow() SPI_AIN_MATH
whismanoid 55:477ba09475d7 9888 // SPI_AIN_Enable_Math_ch[] option to report calculations
whismanoid 55:477ba09475d7 9889 // based on g_MAX11410_device.AINcode[] or SPI_AIN_Voltage[]
whismanoid 55:477ba09475d7 9890 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9891 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9892 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9893 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9894 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 9895 for (int channel_index = 0; channel_index < NUM_DUT_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 55:477ba09475d7 9896 if (SPI_AIN_Enable_Math_ch[channel_index] == SPI_AIN_Disable) {
whismanoid 55:477ba09475d7 9897 continue;
whismanoid 55:477ba09475d7 9898 }
whismanoid 55:477ba09475d7 9899 // comma between fields
whismanoid 55:477ba09475d7 9900 if (field_index > 0) {
whismanoid 55:477ba09475d7 9901 cmdLine.serial().printf(",");
whismanoid 55:477ba09475d7 9902 }
whismanoid 55:477ba09475d7 9903 field_index++;
whismanoid 55:477ba09475d7 9904 if (SPI_AIN_Enable_Math_ch[channel_index] == Platform_AIN_Enable_LSB) {
whismanoid 55:477ba09475d7 9905 // Perform calculations based on g_MAX11410_device.AINcode[channel_index]
whismanoid 55:477ba09475d7 9906 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9907 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9908 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9909 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9910 double x = (Platform_LSB[channel_index] - SPI_AIN_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9911 x = x * SPI_AIN_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 9912 if (SPI_AIN_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9913 x = x / SPI_AIN_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 9914 }
whismanoid 55:477ba09475d7 9915 //
whismanoid 55:477ba09475d7 9916 cmdLine.serial().printf("%d", x);
whismanoid 55:477ba09475d7 9917 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9918 // cmdLine.serial().printf("%s", SPI_AIN_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9919 }
whismanoid 55:477ba09475d7 9920 if (SPI_AIN_Enable_Math_ch[channel_index] == Platform_AIN_Enable_Volt) {
whismanoid 55:477ba09475d7 9921 // Perform calculations based on SPI_AIN_Voltage[channel_index]
whismanoid 55:477ba09475d7 9922 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9923 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9924 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9925 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9926 double x = (SPI_AIN_Voltage[channel_index] - SPI_AIN_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9927 x = x * SPI_AIN_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 9928 if (SPI_AIN_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9929 x = x / SPI_AIN_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 9930 }
whismanoid 55:477ba09475d7 9931 //
whismanoid 55:477ba09475d7 9932 cmdLine.serial().printf("%6.6f", x);
whismanoid 55:477ba09475d7 9933 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9934 // cmdLine.serial().printf("%s", SPI_AIN_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9935 }
whismanoid 55:477ba09475d7 9936 }
whismanoid 55:477ba09475d7 9937 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 9938 //
whismanoid 5:aaf8b5f5fda1 9939 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 5:aaf8b5f5fda1 9940 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 9:45f98573eb6d 9941 for (int channel_index = 0; channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 9:45f98573eb6d 9942 if (Platform_Enable_ch[channel_index] == Platform_AIN_Disable) {
whismanoid 9:45f98573eb6d 9943 continue;
whismanoid 9:45f98573eb6d 9944 }
whismanoid 5:aaf8b5f5fda1 9945 // comma between fields
whismanoid 5:aaf8b5f5fda1 9946 if (field_index > 0) {
whismanoid 5:aaf8b5f5fda1 9947 cmdLine.serial().printf(",");
whismanoid 5:aaf8b5f5fda1 9948 }
whismanoid 9:45f98573eb6d 9949 field_index++;
whismanoid 9:45f98573eb6d 9950 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_LSB) {
whismanoid 5:aaf8b5f5fda1 9951 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 9952 cmdLine.serial().printf("%u", Platform_LSB[channel_index]);
whismanoid 9:45f98573eb6d 9953 #endif
whismanoid 9:45f98573eb6d 9954 }
whismanoid 9:45f98573eb6d 9955 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Volt) {
whismanoid 9:45f98573eb6d 9956 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 11:2b8adc78618a 9957 // Datalog Volts omit V suffix from numbers #275
whismanoid 11:2b8adc78618a 9958 // because Excel graphs can't handle numbers that have a suffix.
whismanoid 11:2b8adc78618a 9959 cmdLine.serial().printf("%6.6f", Platform_Voltage[channel_index]);
whismanoid 55:477ba09475d7 9960 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9961 // cmdLine.serial().printf("V");
whismanoid 55:477ba09475d7 9962 #endif
whismanoid 55:477ba09475d7 9963 }
whismanoid 55:477ba09475d7 9964 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_LSB - display math result instead of LSB in channel# position
whismanoid 55:477ba09475d7 9965 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Math_LSB) {
whismanoid 55:477ba09475d7 9966 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9967 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 55:477ba09475d7 9968 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 55:477ba09475d7 9969 // Perform calculations based on Platform_LSB[channel_index]
whismanoid 55:477ba09475d7 9970 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9971 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9972 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9973 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9974 double x = (Platform_LSB[channel_index] - Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9975 x = x * Platform_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 9976 if (Platform_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9977 x = x / Platform_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 9978 }
whismanoid 55:477ba09475d7 9979 //
whismanoid 55:477ba09475d7 9980 cmdLine.serial().printf("%u", x);
whismanoid 55:477ba09475d7 9981 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9982 // cmdLine.serial().printf("%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9983 #endif
whismanoid 55:477ba09475d7 9984 #endif
whismanoid 55:477ba09475d7 9985 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9986 }
whismanoid 55:477ba09475d7 9987 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_Volt - display math result instead of volts in channel# position
whismanoid 55:477ba09475d7 9988 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Math_Volt) {
whismanoid 55:477ba09475d7 9989 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9990 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 55:477ba09475d7 9991 // Perform calculations based on Platform_Voltage[channel_index]
whismanoid 55:477ba09475d7 9992 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9993 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9994 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9995 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9996 double x = (Platform_Voltage[channel_index] - Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9997 x = x * Platform_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 9998 if (Platform_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9999 x = x / Platform_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 10000 }
whismanoid 55:477ba09475d7 10001 //
whismanoid 55:477ba09475d7 10002 cmdLine.serial().printf("%6.6f", x);
whismanoid 55:477ba09475d7 10003 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 10004 // cmdLine.serial().printf("%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 10005 #endif
whismanoid 55:477ba09475d7 10006 #endif // PLATFORM_AIN_MATH
whismanoid 9:45f98573eb6d 10007 }
whismanoid 5:aaf8b5f5fda1 10008 }
whismanoid 55:477ba09475d7 10009 // MAX40108 Datalog Math #362 -- Datalogger_PrintRow() PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 10010 // Platform_Enable_Math_ch[] option to report calculations
whismanoid 55:477ba09475d7 10011 // based on Platform_LSB[] or Platform_Voltage[]
whismanoid 55:477ba09475d7 10012 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 10013 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 10014 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 10015 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 10016 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 10017 for (int channel_index = 0; channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 55:477ba09475d7 10018 if (Platform_Enable_Math_ch[channel_index] == Platform_AIN_Disable) {
whismanoid 55:477ba09475d7 10019 continue;
whismanoid 55:477ba09475d7 10020 }
whismanoid 55:477ba09475d7 10021 // comma between fields
whismanoid 55:477ba09475d7 10022 if (field_index > 0) {
whismanoid 55:477ba09475d7 10023 cmdLine.serial().printf(",");
whismanoid 55:477ba09475d7 10024 }
whismanoid 55:477ba09475d7 10025 field_index++;
whismanoid 55:477ba09475d7 10026 if (Platform_Enable_Math_ch[channel_index] == Platform_AIN_Enable_LSB) {
whismanoid 55:477ba09475d7 10027 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 55:477ba09475d7 10028 // Perform calculations based on Platform_LSB[channel_index]
whismanoid 55:477ba09475d7 10029 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 10030 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 10031 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 10032 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 10033 double x = (Platform_LSB[channel_index] - Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 10034 x = x * Platform_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 10035 if (Platform_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 10036 x = x / Platform_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 10037 }
whismanoid 55:477ba09475d7 10038 //
whismanoid 55:477ba09475d7 10039 cmdLine.serial().printf("%u", x);
whismanoid 55:477ba09475d7 10040 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 10041 // cmdLine.serial().printf("%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 10042 #endif
whismanoid 55:477ba09475d7 10043 }
whismanoid 55:477ba09475d7 10044 if (Platform_Enable_Math_ch[channel_index] == Platform_AIN_Enable_Volt) {
whismanoid 55:477ba09475d7 10045 // Perform calculations based on Platform_Voltage[channel_index]
whismanoid 55:477ba09475d7 10046 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 10047 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 10048 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 10049 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 10050 double x = (Platform_Voltage[channel_index] - Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 10051 x = x * Platform_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 10052 if (Platform_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 10053 x = x / Platform_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 10054 }
whismanoid 55:477ba09475d7 10055 //
whismanoid 55:477ba09475d7 10056 cmdLine.serial().printf("%6.6f", x);
whismanoid 55:477ba09475d7 10057 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 10058 // cmdLine.serial().printf("%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 10059 }
whismanoid 55:477ba09475d7 10060 }
whismanoid 55:477ba09475d7 10061 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 10062 //
whismanoid 5:aaf8b5f5fda1 10063 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 9:45f98573eb6d 10064 if (need_reinit) {
whismanoid 9:45f98573eb6d 10065 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 10066 if (g_MAX11410_device.Init() == 0) {
whismanoid 9:45f98573eb6d 10067 //~ cmdLine.serial().printf(",\"Init() failed\"");
whismanoid 9:45f98573eb6d 10068 } else {
whismanoid 9:45f98573eb6d 10069 //~ cmdLine.serial().printf(",\"Init() success\"");
whismanoid 9:45f98573eb6d 10070 #if USE_CUSTOM_REG_INIT // custom_reg_init_addr[], custom_reg_init_data[], custom_reg_init_count
whismanoid 9:45f98573eb6d 10071 // in Datalogger_PrintRow(), when part_id test fails,
whismanoid 9:45f98573eb6d 10072 // apply list of custom register writes after re-init
whismanoid 9:45f98573eb6d 10073 // custom_reg_init_addr[], custom_reg_init_data[], custom_reg_init_count
whismanoid 9:45f98573eb6d 10074 for (unsigned int index = 0; index < custom_reg_init_count; index++) {
whismanoid 9:45f98573eb6d 10075 uint8_t regAddress = custom_reg_init_addr[index];
whismanoid 9:45f98573eb6d 10076 uint32_t regData = custom_reg_init_data[index];
whismanoid 9:45f98573eb6d 10077 cmdLine.serial().printf("*%s=0x%06.6x", g_MAX11410_device.RegName(regAddress), regData);
whismanoid 9:45f98573eb6d 10078 g_MAX11410_device.RegWrite((MAX11410::MAX11410_CMD_enum_t)regAddress, regData);
whismanoid 9:45f98573eb6d 10079 }
whismanoid 9:45f98573eb6d 10080 #endif // USE_CUSTOM_REG_INIT
whismanoid 9:45f98573eb6d 10081 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[0];
whismanoid 9:45f98573eb6d 10082 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[0];
whismanoid 9:45f98573eb6d 10083 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[0];
whismanoid 9:45f98573eb6d 10084 need_reinit = false;
whismanoid 9:45f98573eb6d 10085 }
whismanoid 9:45f98573eb6d 10086 #else // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 10087 need_reinit = false;
whismanoid 9:45f98573eb6d 10088 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 10089 }
whismanoid 30:07197a430869 10090 #if USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 10091 // Datalogger_PrintRow() print gstrRemarkText field from recent #remark -- in void Datalogger_PrintRow()
whismanoid 30:07197a430869 10092 cmdLine.serial().printf(",\"%s\"", gstrRemarkText);
whismanoid 30:07197a430869 10093 #endif // USE_DATALOGGER_REMARK_FIELD
whismanoid 5:aaf8b5f5fda1 10094 cmdLine.serial().printf("\r\n");
whismanoid 9:45f98573eb6d 10095 if (need_reinit) {
whismanoid 9:45f98573eb6d 10096 //~ delay(500); // platform_delay_ms 500ms timing delay function
whismanoid 9:45f98573eb6d 10097 }
whismanoid 5:aaf8b5f5fda1 10098 } // void Datalogger_PrintRow()
whismanoid 5:aaf8b5f5fda1 10099
whismanoid 0:cb44e2e9ec4c 10100 // example code main function
whismanoid 0:cb44e2e9ec4c 10101 int main()
whismanoid 0:cb44e2e9ec4c 10102 {
whismanoid 0:cb44e2e9ec4c 10103 // setup: put your setup code here, to run once
whismanoid 4:d9b05924ad4c 10104 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 10105 // Configure serial ports
whismanoid 4:d9b05924ad4c 10106 cmdLine.clear();
whismanoid 4:d9b05924ad4c 10107 //~ cmdLine.serial().printf("\r\n cmdLine.serial().printf test\r\n");
whismanoid 4:d9b05924ad4c 10108 cmdLine.onEOLcommandParser = main_menu_onEOLcommandParser;
whismanoid 4:d9b05924ad4c 10109 //~ cmdLine.diagnostic_led_EOF = diagnostic_led_EOF;
whismanoid 4:d9b05924ad4c 10110 /// CmdLine::set_immediate_handler(char, functionPointer_void_void_on_immediate_0x21);
whismanoid 4:d9b05924ad4c 10111 //~ cmdLine.on_immediate_0x21 = on_immediate_0x21;
whismanoid 4:d9b05924ad4c 10112 //~ cmdLine.on_immediate_0x7b = on_immediate_0x7b;
whismanoid 4:d9b05924ad4c 10113 //~ cmdLine.on_immediate_0x7d = on_immediate_0x7d;
whismanoid 4:d9b05924ad4c 10114 # if HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 10115 #if 0 // HARD CRASH -- USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 10116 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- init aux baud rate g_auxSerialCom_baud
whismanoid 10:04022a61b527 10117 // TODO: if g_auxSerialCom_baud is other than the default 9600 baud,
whismanoid 10:04022a61b527 10118 // then the auxiliary serial port baud rate should be updated.
whismanoid 10:04022a61b527 10119 # if HAS_AUX_SERIAL
whismanoid 10:04022a61b527 10120 # else
whismanoid 10:04022a61b527 10121 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- init aux baud rate g_auxSerialCom_baud
whismanoid 10:04022a61b527 10122 DAPLINKserial.baud(g_auxSerialCom_baud);
whismanoid 10:04022a61b527 10123 # endif
whismanoid 10:04022a61b527 10124 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 4:d9b05924ad4c 10125 cmdLine_DAPLINKserial.clear();
whismanoid 4:d9b05924ad4c 10126 //~ cmdLine_DAPLINKserial.serial().printf("\r\n cmdLine_DAPLINKserial.serial().printf test\r\n");
whismanoid 4:d9b05924ad4c 10127 cmdLine_DAPLINKserial.onEOLcommandParser = main_menu_onEOLcommandParser;
whismanoid 4:d9b05924ad4c 10128 //~ cmdLine_DAPLINKserial.on_immediate_0x21 = on_immediate_0x21;
whismanoid 4:d9b05924ad4c 10129 //~ cmdLine_DAPLINKserial.on_immediate_0x7b = on_immediate_0x7b;
whismanoid 4:d9b05924ad4c 10130 //~ cmdLine_DAPLINKserial.on_immediate_0x7d = on_immediate_0x7d;
whismanoid 4:d9b05924ad4c 10131 # endif
whismanoid 6:f6d16658342b 10132 # if HAS_AUX_SERIAL
whismanoid 6:f6d16658342b 10133 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial
whismanoid 10:04022a61b527 10134 #if 0 // HARD CRASH -- USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 10135 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- init aux baud rate g_auxSerialCom_baud
whismanoid 10:04022a61b527 10136 // TODO: if g_auxSerialCom_baud is other than the default 9600 baud,
whismanoid 10:04022a61b527 10137 // then the auxiliary serial port baud rate should be updated.
whismanoid 10:04022a61b527 10138 AUXserial.baud(g_auxSerialCom_baud);
whismanoid 10:04022a61b527 10139 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 6:f6d16658342b 10140 cmdLine_AUXserial.clear();
whismanoid 6:f6d16658342b 10141 //~ cmdLine_AUXserial.serial().printf("\r\n cmdLine_AUXserial.serial().printf test\r\n");
whismanoid 6:f6d16658342b 10142 cmdLine_AUXserial.onEOLcommandParser = main_menu_onEOLcommandParser;
whismanoid 6:f6d16658342b 10143 //~ cmdLine_AUXserial.on_immediate_0x21 = on_immediate_0x21;
whismanoid 6:f6d16658342b 10144 //~ cmdLine_AUXserial.on_immediate_0x7b = on_immediate_0x7b;
whismanoid 6:f6d16658342b 10145 //~ cmdLine_AUXserial.on_immediate_0x7d = on_immediate_0x7d;
whismanoid 6:f6d16658342b 10146 # endif // HAS_AUX_SERIAL
whismanoid 4:d9b05924ad4c 10147 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 0:cb44e2e9ec4c 10148
whismanoid 0:cb44e2e9ec4c 10149 // example code: serial port banner message
whismanoid 0:cb44e2e9ec4c 10150 wait(3); // 3000ms timing delay function, platform-specific
whismanoid 3:9055e17e181a 10151 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 10152 cmdLine.serial().printf("\r\nDataLogger_MAX11410\r\n"); // instead of Hello_MAX11410
whismanoid 3:9055e17e181a 10153 #else // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 10154 cmdLine.serial().printf("\r\nInternal_DataLogger\r\n"); // instead of Hello_MAX11410
whismanoid 3:9055e17e181a 10155 # if HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 10156 cmdLine_DAPLINKserial.serial().printf("\r\nInternal_DataLogger\r\n"); // instead of Hello_MAX11410
whismanoid 3:9055e17e181a 10157 # endif // HAS_DAPLINK_SERIAL
whismanoid 6:f6d16658342b 10158 # if HAS_AUX_SERIAL
whismanoid 6:f6d16658342b 10159 cmdLine_AUXserial.serial().printf("\r\nInternal_DataLogger\r\n"); // instead of Hello_MAX11410
whismanoid 6:f6d16658342b 10160 # endif // HAS_AUX_SERIAL
whismanoid 3:9055e17e181a 10161 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 10:04022a61b527 10162
whismanoid 1:747f1602abfc 10163 // CODE GENERATOR: get spi properties from device
whismanoid 3:9055e17e181a 10164 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 10165 // MAX40108 Datalog Math #362 -- initialize enable/offset/gain arrays SPI_AIN_MATH
whismanoid 55:477ba09475d7 10166 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 10167 for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 55:477ba09475d7 10168 {
whismanoid 55:477ba09475d7 10169 SPI_AIN_Enable_Math_ch[ch] = Platform_AIN_Disable;
whismanoid 55:477ba09475d7 10170 SPI_AIN_MathOffsetA[ch] = 0.0;
whismanoid 55:477ba09475d7 10171 SPI_AIN_MathGainMulA[ch] = 1.0;
whismanoid 55:477ba09475d7 10172 SPI_AIN_MathGainDivA[ch] = 1.0;
whismanoid 55:477ba09475d7 10173 }
whismanoid 55:477ba09475d7 10174 };
whismanoid 55:477ba09475d7 10175 #endif // SPI_AIN_MATH
whismanoid 3:9055e17e181a 10176 if (g_SPI_SCLK_Hz > g_MAX11410_device.get_spi_frequency())
whismanoid 3:9055e17e181a 10177 { // Device limits SPI SCLK frequency
whismanoid 3:9055e17e181a 10178 g_SPI_SCLK_Hz = g_MAX11410_device.get_spi_frequency();
whismanoid 3:9055e17e181a 10179 cmdLine.serial().printf("\r\nMAX11410 limits SPI SCLK frequency to %ld Hz\r\n", g_SPI_SCLK_Hz);
whismanoid 3:9055e17e181a 10180
whismanoid 3:9055e17e181a 10181 g_MAX11410_device.Init();
whismanoid 3:9055e17e181a 10182 }
whismanoid 3:9055e17e181a 10183 if (g_MAX11410_device.get_spi_frequency() > g_SPI_SCLK_Hz)
whismanoid 3:9055e17e181a 10184 { // Platform limits SPI SCLK frequency
whismanoid 3:9055e17e181a 10185 g_MAX11410_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 3:9055e17e181a 10186 cmdLine.serial().printf("\r\nPlatform limits MAX11410 SPI SCLK frequency to %ld Hz\r\n", g_SPI_SCLK_Hz);
whismanoid 3:9055e17e181a 10187
whismanoid 3:9055e17e181a 10188 g_MAX11410_device.Init();
whismanoid 3:9055e17e181a 10189 }
whismanoid 0:cb44e2e9ec4c 10190 // g_SPI_dataMode = g_MAX11410_device.get_spi_dataMode();
whismanoid 3:9055e17e181a 10191 while (g_MAX11410_device.Init() == 0)
whismanoid 3:9055e17e181a 10192 {
whismanoid 3:9055e17e181a 10193 wait(3); // 3000ms timing delay function, platform-specific
whismanoid 3:9055e17e181a 10194 cmdLine.serial().printf("\r\nMAX11410 Init failed; retry...\r\n");
whismanoid 3:9055e17e181a 10195
whismanoid 3:9055e17e181a 10196 }
whismanoid 0:cb44e2e9ec4c 10197
whismanoid 0:cb44e2e9ec4c 10198 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 3:9055e17e181a 10199 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 10200 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[0];
whismanoid 3:9055e17e181a 10201 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[0];
whismanoid 3:9055e17e181a 10202 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[0];
whismanoid 3:9055e17e181a 10203 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 10204 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 3:9055e17e181a 10205 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 10206 // CODE GENERATOR: example code: has no member function REF
whismanoid 0:cb44e2e9ec4c 10207 // CODE GENERATOR: example code for ADC: repeat-forever convert and print conversion result, one record per line
whismanoid 0:cb44e2e9ec4c 10208 // CODE GENERATOR: ResolutionBits = 24
whismanoid 0:cb44e2e9ec4c 10209 // CODE GENERATOR: FScode = 0xffffff
whismanoid 0:cb44e2e9ec4c 10210 // CODE GENERATOR: NumChannels = 10
whismanoid 0:cb44e2e9ec4c 10211 // CODE GENERATOR: banner before DataLogHelloCppCodeList while(1)
whismanoid 3:9055e17e181a 10212 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 10213 cmdLine.serial().printf("v_filter = 0x%2.2x\r\n", g_MAX11410_device.v_filter);
whismanoid 0:cb44e2e9ec4c 10214
whismanoid 3:9055e17e181a 10215 cmdLine.serial().printf("v_pga = 0x%2.2x\r\n", g_MAX11410_device.v_pga);
whismanoid 0:cb44e2e9ec4c 10216
whismanoid 3:9055e17e181a 10217 cmdLine.serial().printf("v_ctrl = 0x%2.2x\r\n", g_MAX11410_device.v_ctrl);
whismanoid 3:9055e17e181a 10218
whismanoid 3:9055e17e181a 10219 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 10220
whismanoid 3:9055e17e181a 10221 // column header banner for csv data columns
whismanoid 8:dffee7509bfb 10222 Datalogger_Need_PrintHeader = true;
whismanoid 10:04022a61b527 10223
whismanoid 12:2dfc1f2009e0 10224 #if USE_LEDS
whismanoid 12:2dfc1f2009e0 10225 #if defined(TARGET_MAX32630)
whismanoid 12:2dfc1f2009e0 10226 led1 = LED_ON; led2 = LED_OFF; led3 = LED_OFF; // diagnostic rbg led RED
whismanoid 12:2dfc1f2009e0 10227 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10228 led1 = LED_OFF; led2 = LED_ON; led3 = LED_OFF; // diagnostic rbg led GREEN
whismanoid 12:2dfc1f2009e0 10229 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10230 led1 = LED_OFF; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led BLUE
whismanoid 12:2dfc1f2009e0 10231 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10232 led1 = LED_ON; led2 = LED_ON; led3 = LED_ON; // diagnostic rbg led RED+GREEN+BLUE=WHITE
whismanoid 12:2dfc1f2009e0 10233 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10234 led1 = LED_OFF; led2 = LED_ON; led3 = LED_ON; // diagnostic rbg led GREEN+BLUE=CYAN
whismanoid 12:2dfc1f2009e0 10235 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10236 led1 = LED_ON; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led RED+BLUE=MAGENTA
whismanoid 12:2dfc1f2009e0 10237 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10238 led1 = LED_ON; led2 = LED_ON; led3 = LED_OFF; // diagnostic rbg led RED+GREEN=YELLOW
whismanoid 12:2dfc1f2009e0 10239 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10240 led1 = LED_OFF; led2 = LED_OFF; led3 = LED_OFF; // diagnostic rbg led BLACK
whismanoid 12:2dfc1f2009e0 10241 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 19:5ff09c8e9daf 10242 #elif defined(TARGET_MAX32625MBED) || defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 12:2dfc1f2009e0 10243 led1 = LED_ON; led2 = LED_OFF; led3 = LED_OFF; // diagnostic rbg led RED
whismanoid 12:2dfc1f2009e0 10244 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10245 led1 = LED_OFF; led2 = LED_ON; led3 = LED_OFF; // diagnostic rbg led GREEN
whismanoid 12:2dfc1f2009e0 10246 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10247 led1 = LED_OFF; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led BLUE
whismanoid 12:2dfc1f2009e0 10248 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10249 led1 = LED_ON; led2 = LED_ON; led3 = LED_ON; // diagnostic rbg led RED+GREEN+BLUE=WHITE
whismanoid 12:2dfc1f2009e0 10250 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10251 led1 = LED_OFF; led2 = LED_ON; led3 = LED_ON; // diagnostic rbg led GREEN+BLUE=CYAN
whismanoid 12:2dfc1f2009e0 10252 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10253 led1 = LED_ON; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led RED+BLUE=MAGENTA
whismanoid 12:2dfc1f2009e0 10254 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10255 led1 = LED_ON; led2 = LED_ON; led3 = LED_OFF; // diagnostic rbg led RED+GREEN=YELLOW
whismanoid 12:2dfc1f2009e0 10256 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10257 led1 = LED_OFF; led2 = LED_OFF; led3 = LED_OFF; // diagnostic rbg led BLACK
whismanoid 12:2dfc1f2009e0 10258 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10259 #else // not defined(TARGET_LPC1768 etc.)
whismanoid 12:2dfc1f2009e0 10260 led1 = LED_ON;
whismanoid 12:2dfc1f2009e0 10261 led2 = LED_OFF;
whismanoid 12:2dfc1f2009e0 10262 led3 = LED_OFF;
whismanoid 12:2dfc1f2009e0 10263 led4 = LED_OFF;
whismanoid 12:2dfc1f2009e0 10264 ThisThread::sleep_for(75); // [since mbed-os-5.10] vs Thread::wait(75);
whismanoid 12:2dfc1f2009e0 10265 //led1 = LED_ON;
whismanoid 12:2dfc1f2009e0 10266 led2 = LED_ON;
whismanoid 12:2dfc1f2009e0 10267 ThisThread::sleep_for(75); // [since mbed-os-5.10] vs Thread::wait(75);
whismanoid 12:2dfc1f2009e0 10268 led1 = LED_OFF;
whismanoid 12:2dfc1f2009e0 10269 //led2 = LED_ON;
whismanoid 12:2dfc1f2009e0 10270 led3 = LED_ON;
whismanoid 12:2dfc1f2009e0 10271 ThisThread::sleep_for(75); // [since mbed-os-5.10] vs Thread::wait(75);
whismanoid 12:2dfc1f2009e0 10272 led2 = LED_OFF;
whismanoid 12:2dfc1f2009e0 10273 //led3 = LED_ON;
whismanoid 12:2dfc1f2009e0 10274 led4 = LED_ON;
whismanoid 12:2dfc1f2009e0 10275 ThisThread::sleep_for(75); // [since mbed-os-5.10] vs Thread::wait(75);
whismanoid 12:2dfc1f2009e0 10276 led3 = LED_OFF;
whismanoid 12:2dfc1f2009e0 10277 led4 = LED_ON;
whismanoid 12:2dfc1f2009e0 10278 //
whismanoid 12:2dfc1f2009e0 10279 #endif // target definition
whismanoid 12:2dfc1f2009e0 10280 #endif
whismanoid 12:2dfc1f2009e0 10281
whismanoid 12:2dfc1f2009e0 10282 if (led1.is_connected()) {
whismanoid 12:2dfc1f2009e0 10283 led1 = LED_ON;
whismanoid 12:2dfc1f2009e0 10284 }
whismanoid 12:2dfc1f2009e0 10285 if (led2.is_connected()) {
whismanoid 12:2dfc1f2009e0 10286 led2 = LED_ON;
whismanoid 12:2dfc1f2009e0 10287 }
whismanoid 12:2dfc1f2009e0 10288 if (led3.is_connected()) {
whismanoid 12:2dfc1f2009e0 10289 led3 = LED_ON;
whismanoid 12:2dfc1f2009e0 10290 }
whismanoid 12:2dfc1f2009e0 10291
whismanoid 46:469d0061df5d 10292 #if HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 10293 // WIP #312 load values from flash_page_configuration_back_up[] during init
whismanoid 48:18647e0516f2 10294 const uint32_t load_arg = load_arg_startup;
whismanoid 46:469d0061df5d 10295 Load_flash_page_configuration_back_up(cmdLine, load_arg);
whismanoid 46:469d0061df5d 10296 #endif // HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 10297
whismanoid 4:d9b05924ad4c 10298 while(1) { // this code repeats forever
whismanoid 4:d9b05924ad4c 10299 // this code repeats forever
whismanoid 4:d9b05924ad4c 10300
whismanoid 21:ac062a97a71d 10301 #if HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 21:ac062a97a71d 10302 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 21:ac062a97a71d 10303 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 21:ac062a97a71d 10304 # if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 10305 static int button1_value_prev = 1;
whismanoid 21:ac062a97a71d 10306 static int button1_value_now = 1;
whismanoid 21:ac062a97a71d 10307 button1_value_prev = button1_value_now;
whismanoid 21:ac062a97a71d 10308 button1_value_now = button1.read();
whismanoid 21:ac062a97a71d 10309 if ((button1_value_prev - button1_value_now) == 1)
whismanoid 21:ac062a97a71d 10310 {
whismanoid 21:ac062a97a71d 10311 // on button1 falling edge (button1 press)
whismanoid 21:ac062a97a71d 10312 onButton1FallingEdge();
whismanoid 21:ac062a97a71d 10313 }
whismanoid 21:ac062a97a71d 10314 # endif // HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 10315 # if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 10316 static int button2_value_prev = 1;
whismanoid 24:032f3683cb2a 10317 static int button2_value_now = 1;
whismanoid 24:032f3683cb2a 10318 button2_value_prev = button2_value_now;
whismanoid 24:032f3683cb2a 10319 button2_value_now = button2.read();
whismanoid 24:032f3683cb2a 10320 if ((button2_value_prev - button2_value_now) == 1)
whismanoid 24:032f3683cb2a 10321 {
whismanoid 24:032f3683cb2a 10322 // on button2 falling edge (button2 press)
whismanoid 24:032f3683cb2a 10323 onButton2FallingEdge();
whismanoid 24:032f3683cb2a 10324 }
whismanoid 24:032f3683cb2a 10325 # endif // HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 10326 # if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 10327 static int button3_value_prev = 1;
whismanoid 24:032f3683cb2a 10328 static int button3_value_now = 1;
whismanoid 24:032f3683cb2a 10329 button3_value_prev = button3_value_now;
whismanoid 24:032f3683cb2a 10330 button3_value_now = button3.read();
whismanoid 24:032f3683cb2a 10331 if ((button3_value_prev - button3_value_now) == 1)
whismanoid 24:032f3683cb2a 10332 {
whismanoid 24:032f3683cb2a 10333 // on button3 falling edge (button3 press)
whismanoid 26:13cba69d88eb 10334 onButton3FallingEdge();
whismanoid 24:032f3683cb2a 10335 }
whismanoid 24:032f3683cb2a 10336 # endif // HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 10337 #endif // HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 4:d9b05924ad4c 10338 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 10339 // TODO support CmdLine command menus (like on Serial_Tester); help and usual boilerplate
whismanoid 10:04022a61b527 10340 #if USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 10341 // Command forwarding to Auxiliary serial port;
whismanoid 10:04022a61b527 10342 // don't accept commands from Auxiliary serial port
whismanoid 10:04022a61b527 10343 #else // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 10344 // Accept commands from Auxiliary serial port
whismanoid 6:f6d16658342b 10345 # if HAS_AUX_SERIAL
whismanoid 6:f6d16658342b 10346 if (AUXserial.readable()) {
whismanoid 6:f6d16658342b 10347 cmdLine_AUXserial.append(AUXserial.getc());
whismanoid 6:f6d16658342b 10348 }
whismanoid 6:f6d16658342b 10349 # endif // HAS_AUX_SERIAL
whismanoid 6:f6d16658342b 10350 # if HAS_DAPLINK_SERIAL
whismanoid 6:f6d16658342b 10351 if (DAPLINKserial.readable()) {
whismanoid 6:f6d16658342b 10352 cmdLine_DAPLINKserial.append(DAPLINKserial.getc());
whismanoid 6:f6d16658342b 10353 }
whismanoid 6:f6d16658342b 10354 # endif // HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 10355 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 4:d9b05924ad4c 10356 if (serial.readable()) {
whismanoid 4:d9b05924ad4c 10357 int c = serial.getc(); // instead of getc() or fgetc()
whismanoid 4:d9b05924ad4c 10358 cmdLine.append(c);
whismanoid 4:d9b05924ad4c 10359 // cmdLine.onEOLcommandParser handler implements menus
whismanoid 4:d9b05924ad4c 10360 } // if (Serial.available())
whismanoid 4:d9b05924ad4c 10361 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 10362
whismanoid 4:d9b05924ad4c 10363 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 32:80f3e5eb77d4 10364 // Datalog trigger
whismanoid 4:d9b05924ad4c 10365 if (Datalogger_Trigger == trigger_Halt) {
whismanoid 4:d9b05924ad4c 10366 // halt the datalogger; continue accepting commands
whismanoid 3:9055e17e181a 10367 continue;
whismanoid 3:9055e17e181a 10368 }
whismanoid 4:d9b05924ad4c 10369 if (Datalogger_Trigger == trigger_FreeRun) {
whismanoid 4:d9b05924ad4c 10370 // free run as fast as possible
whismanoid 3:9055e17e181a 10371 }
whismanoid 4:d9b05924ad4c 10372 if (Datalogger_Trigger == trigger_Timer) {
whismanoid 4:d9b05924ad4c 10373 // timer (configure interval)
whismanoid 32:80f3e5eb77d4 10374 // if Datalogger_Trigger == trigger_Timer sleep(g_timer_interval_msec)
whismanoid 39:4d285e961435 10375 //
whismanoid 39:4d285e961435 10376 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 10377 // USE_DATALOGGER_SLEEP -- support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 10378 // Sleep Mode vs Deep Sleep Mode
whismanoid 39:4d285e961435 10379 // See documentation https://os.mbed.com/docs/mbed-os/v5.15/apis/power-management-sleep.html
whismanoid 41:13a6a097502c 10380 // ThisThread::sleep_for(uint32_t millisec)
whismanoid 41:13a6a097502c 10381 // sleep_manager_can_deep_sleep() // tests whether deep_sleep is locked or not
whismanoid 41:13a6a097502c 10382 // sleep_manager_lock_deep_sleep() // begin section that prevents deep_sleep
whismanoid 41:13a6a097502c 10383 // sleep_manager_unlock_deep_sleep() // end section that prevents deep_sleep
whismanoid 39:4d285e961435 10384 switch(g_timer_sleepmode)
whismanoid 39:4d285e961435 10385 {
whismanoid 39:4d285e961435 10386 case datalogger_Sleep_LP0_Stop: // LT sleep = 0,
whismanoid 45:74bf1fe021e5 10387 // TODO: LP0 stop mode not supported; how would we wake up?
whismanoid 39:4d285e961435 10388 break;
whismanoid 39:4d285e961435 10389 case datalogger_Sleep_LP1_DeepSleep: // LT sleep = 1,
whismanoid 42:89607d5d4e6d 10390 //
whismanoid 45:74bf1fe021e5 10391 // In file mbed-os\targets\TARGET_Maxim\TARGET_MAX32625\sleep.c
whismanoid 45:74bf1fe021e5 10392 // support function hal_deepsleep() just calls hal_sleep(),
whismanoid 45:74bf1fe021e5 10393 // so using LP1 Deep Sleep requires calling the low-level functions directly.
whismanoid 42:89607d5d4e6d 10394 //
whismanoid 41:13a6a097502c 10395 // sleep_manager_can_deep_sleep(); // tests whether deep_sleep is locked or not
whismanoid 41:13a6a097502c 10396 // mbed_file_handle(STDIN_FILENO)->enable_input(false); // (mbed-os-5.15) platform.stdio-buffered-serial prevents deep sleep
whismanoid 45:74bf1fe021e5 10397 #if MBED_VERSION >= MBED_ENCODE_VERSION(5, 15, 0)
whismanoid 41:13a6a097502c 10398 cmdLine.serial().enable_input(false); // (mbed-os-5.15) platform.stdio-buffered-serial prevents deep sleep
whismanoid 41:13a6a097502c 10399 // serial.enable_input(false); // (mbed-os-5.15) platform.stdio-buffered-serial prevents deep sleep
whismanoid 43:4c4733760d4c 10400
whismanoid 43:4c4733760d4c 10401 // configure RTC and start
whismanoid 43:4c4733760d4c 10402 // RTC_Setup();
whismanoid 43:4c4733760d4c 10403 {
whismanoid 43:4c4733760d4c 10404 rtc_cfg_t RTCconfig;
whismanoid 43:4c4733760d4c 10405 RTCconfig.compareCount[0] = 5;//5 second timer -- override with RTC_SetCompare(0,counts)
whismanoid 43:4c4733760d4c 10406 RTCconfig.compareCount[1] = 7;//7 second timer -- override with RTC_SetCompare(1,counts)
whismanoid 43:4c4733760d4c 10407 RTCconfig.prescaler = RTC_PRESCALE_DIV_2_12; //1Hz clock
whismanoid 43:4c4733760d4c 10408 RTCconfig.prescalerMask = RTC_PRESCALE_DIV_2_12;//used for prescaler compare
whismanoid 43:4c4733760d4c 10409 RTCconfig.snoozeCount = 0;
whismanoid 43:4c4733760d4c 10410 RTCconfig.snoozeMode = RTC_SNOOZE_DISABLE;
whismanoid 43:4c4733760d4c 10411 RTC_Init(&RTCconfig);
whismanoid 43:4c4733760d4c 10412 RTC_Start();
whismanoid 43:4c4733760d4c 10413
whismanoid 43:4c4733760d4c 10414 // Clear existing wake-up config
whismanoid 43:4c4733760d4c 10415 LP_ClearWakeUpConfig();
whismanoid 43:4c4733760d4c 10416
whismanoid 43:4c4733760d4c 10417 // Clear any event flags
whismanoid 43:4c4733760d4c 10418 LP_ClearWakeUpFlags();
whismanoid 43:4c4733760d4c 10419
whismanoid 43:4c4733760d4c 10420 // configure wake-up on RTC compare 1
whismanoid 43:4c4733760d4c 10421 // LP_ConfigRTCWakeUp(unsigned int comp0_en, unsigned int comp1_en, unsigned int prescale_cmp_en, unsigned int rollover_en);
whismanoid 43:4c4733760d4c 10422 LP_ConfigRTCWakeUp(0, 1, 0, 0);
whismanoid 43:4c4733760d4c 10423
whismanoid 44:84402faa8eb9 10424 // wait until UART_Busy indicates no ongoing transactions (both ports)
whismanoid 44:84402faa8eb9 10425 while (Console_PrepForSleep() != E_NO_ERROR);
whismanoid 44:84402faa8eb9 10426
whismanoid 43:4c4733760d4c 10427 // set RTC compare 1 value
whismanoid 43:4c4733760d4c 10428 // cmp = RTC_GetCount() + LP1_WakeTime;
whismanoid 43:4c4733760d4c 10429 uint32_t cmp = RTC_GetCount() + ((g_timer_interval_msec + 500.) / 1000.);
whismanoid 43:4c4733760d4c 10430 // RTC_SetCompare(uint8_t compareIndex, uint32_t counts)
whismanoid 43:4c4733760d4c 10431 RTC_SetCompare(1, cmp);
whismanoid 43:4c4733760d4c 10432
whismanoid 43:4c4733760d4c 10433 RTC_ClearFlags(MXC_F_RTC_FLAGS_COMP1);
whismanoid 43:4c4733760d4c 10434 }
whismanoid 43:4c4733760d4c 10435
whismanoid 43:4c4733760d4c 10436 //global disable interrupt
whismanoid 43:4c4733760d4c 10437 __disable_irq();
whismanoid 43:4c4733760d4c 10438
whismanoid 43:4c4733760d4c 10439 LP_EnterLP1();
whismanoid 43:4c4733760d4c 10440
whismanoid 43:4c4733760d4c 10441 //global enable interrupt
whismanoid 43:4c4733760d4c 10442 __enable_irq();
whismanoid 43:4c4733760d4c 10443
whismanoid 43:4c4733760d4c 10444 // stop waking on RTC
whismanoid 43:4c4733760d4c 10445 // LP_ConfigRTCWakeUp(unsigned int comp0_en, unsigned int comp1_en, unsigned int prescale_cmp_en, unsigned int rollover_en);
whismanoid 43:4c4733760d4c 10446 LP_ConfigRTCWakeUp(0, 0, 0, 0);
whismanoid 43:4c4733760d4c 10447
whismanoid 43:4c4733760d4c 10448 // Clear existing wake-up config
whismanoid 43:4c4733760d4c 10449 LP_ClearWakeUpConfig();
whismanoid 43:4c4733760d4c 10450
whismanoid 43:4c4733760d4c 10451 // Clear any event flags
whismanoid 43:4c4733760d4c 10452 LP_ClearWakeUpFlags();
whismanoid 45:74bf1fe021e5 10453
whismanoid 43:4c4733760d4c 10454 RTC_Stop();
whismanoid 43:4c4733760d4c 10455
whismanoid 41:13a6a097502c 10456 // mbed_file_handle(STDIN_FILENO)->enable_input(true); // (mbed-os-5.15)
whismanoid 41:13a6a097502c 10457 cmdLine.serial().enable_input(true); // (mbed-os-5.15)
whismanoid 41:13a6a097502c 10458 // serial.enable_input(true); // (mbed-os-5.15)
whismanoid 39:4d285e961435 10459 break;
whismanoid 45:74bf1fe021e5 10460 #endif // MBED_VERSION >= MBED_ENCODE_VERSION(5, 15, 0)
whismanoid 39:4d285e961435 10461 case datalogger_Sleep_LP2_Sleep: // LT sleep = 2,
whismanoid 41:13a6a097502c 10462 sleep_manager_lock_deep_sleep(); // begin section that prevents deep_sleep
whismanoid 41:13a6a097502c 10463 ThisThread::sleep_for(g_timer_interval_msec); // wait_ms(g_timer_interval_msec); // sleep during delay?
whismanoid 41:13a6a097502c 10464 sleep_manager_unlock_deep_sleep(); // end section that prevents deep_sleep
whismanoid 39:4d285e961435 10465 break;
whismanoid 39:4d285e961435 10466 case datalogger_Sleep_LP3_Run: // LT sleep = 3,
whismanoid 45:74bf1fe021e5 10467 // TODO: USE_DATALOGGER_SLEEP -- ThisThread::sleep_for(uint32_t millisec) instead of wait_ms(g_timer_interval_msec)
whismanoid 41:13a6a097502c 10468 wait_ms(g_timer_interval_msec);
whismanoid 39:4d285e961435 10469 break;
whismanoid 39:4d285e961435 10470 }
whismanoid 39:4d285e961435 10471 #else // USE_DATALOGGER_SLEEP
whismanoid 17:9397ea3ea7e9 10472 wait_ms(g_timer_interval_msec); // sleep during delay?
whismanoid 39:4d285e961435 10473 #endif // USE_DATALOGGER_SLEEP
whismanoid 39:4d285e961435 10474 //
whismanoid 17:9397ea3ea7e9 10475 if (g_timer_interval_counter > 0) {
whismanoid 17:9397ea3ea7e9 10476 g_timer_interval_counter--;
whismanoid 17:9397ea3ea7e9 10477 continue;
whismanoid 17:9397ea3ea7e9 10478 }
whismanoid 17:9397ea3ea7e9 10479 // if time interval not yet reached, continue (continue accepting commands)
whismanoid 32:80f3e5eb77d4 10480 g_timer_interval_counter = g_timer_interval_count-1;
whismanoid 3:9055e17e181a 10481 }
whismanoid 4:d9b05924ad4c 10482 if (Datalogger_Trigger == trigger_PlatformDigitalInput) {
whismanoid 4:d9b05924ad4c 10483 // platform digital input (configure digital input pin reference)
whismanoid 17:9397ea3ea7e9 10484 // TODO: read selected input pin, test value
whismanoid 17:9397ea3ea7e9 10485 // TODO: if no match, continue (continue accepting commands)
whismanoid 3:9055e17e181a 10486 }
whismanoid 4:d9b05924ad4c 10487 if (Datalogger_Trigger == trigger_SPIDeviceRegRead) {
whismanoid 4:d9b05924ad4c 10488 // SPI device register read (configure regaddr, mask value, match value)
whismanoid 17:9397ea3ea7e9 10489 // TODO: SPI transfer regAddr
whismanoid 17:9397ea3ea7e9 10490 // TODO: apply dataMask, compare with testValue
whismanoid 17:9397ea3ea7e9 10491 // TODO: if no match, continue (continue accepting commands)
whismanoid 4:d9b05924ad4c 10492 }
whismanoid 4:d9b05924ad4c 10493 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 0:cb44e2e9ec4c 10494
whismanoid 8:dffee7509bfb 10495 // column header banner for csv data columns
whismanoid 8:dffee7509bfb 10496 if (Datalogger_Need_PrintHeader) {
whismanoid 8:dffee7509bfb 10497 if (Datalogger_enable_serial) {
whismanoid 8:dffee7509bfb 10498 Datalogger_PrintHeader(cmdLine);
whismanoid 8:dffee7509bfb 10499 }
whismanoid 8:dffee7509bfb 10500 # if HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 10501 if (Datalogger_enable_AUXserial) {
whismanoid 8:dffee7509bfb 10502 Datalogger_PrintHeader(cmdLine_AUXserial);
whismanoid 8:dffee7509bfb 10503 }
whismanoid 8:dffee7509bfb 10504 # endif // HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 10505 # if HAS_DAPLINK_SERIAL
whismanoid 8:dffee7509bfb 10506 if (Datalogger_enable_DAPLINKserial) {
whismanoid 8:dffee7509bfb 10507 Datalogger_PrintHeader(cmdLine_DAPLINKserial);
whismanoid 8:dffee7509bfb 10508 }
whismanoid 8:dffee7509bfb 10509 # endif // HAS_DAPLINK_SERIAL
whismanoid 8:dffee7509bfb 10510 Datalogger_Need_PrintHeader = false;
whismanoid 8:dffee7509bfb 10511 }
whismanoid 5:aaf8b5f5fda1 10512 Datalogger_AcquireRow();
whismanoid 17:9397ea3ea7e9 10513 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 10514 // Datalogger_RunActionTable() between Datalogger_AcquireRow() and Datalogger_PrintRow()
whismanoid 17:9397ea3ea7e9 10515 Datalogger_RunActionTable();
whismanoid 17:9397ea3ea7e9 10516 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 0:cb44e2e9ec4c 10517 // wait(3.0);
whismanoid 0:cb44e2e9ec4c 10518 // CODE GENERATOR: print conversion result
whismanoid 0:cb44e2e9ec4c 10519 // Use Arduino Serial Plotter to view output: Tools | Serial Plotter
whismanoid 8:dffee7509bfb 10520 if (Datalogger_enable_serial) {
whismanoid 8:dffee7509bfb 10521 Datalogger_PrintRow(cmdLine);
whismanoid 8:dffee7509bfb 10522 }
whismanoid 8:dffee7509bfb 10523 # if HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 10524 if (Datalogger_enable_AUXserial) {
whismanoid 8:dffee7509bfb 10525 Datalogger_PrintRow(cmdLine_AUXserial);
whismanoid 8:dffee7509bfb 10526 }
whismanoid 8:dffee7509bfb 10527 # endif // HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 10528 # if HAS_DAPLINK_SERIAL
whismanoid 8:dffee7509bfb 10529 if (Datalogger_enable_DAPLINKserial) {
whismanoid 8:dffee7509bfb 10530 Datalogger_PrintRow(cmdLine_DAPLINKserial);
whismanoid 8:dffee7509bfb 10531 }
whismanoid 8:dffee7509bfb 10532 # endif // HAS_DAPLINK_SERIAL
whismanoid 0:cb44e2e9ec4c 10533
whismanoid 0:cb44e2e9ec4c 10534 } // this code repeats forever
whismanoid 0:cb44e2e9ec4c 10535 }
whismanoid 0:cb44e2e9ec4c 10536 //---------- CODE GENERATOR: end DataLogHelloCppCodeList