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:
Fri Apr 15 22:19:14 2022 -0700
Revision:
56:8469ffda6119
Parent:
55:477ba09475d7
Child:
57:9bc5ad707216
Fix L@9 x=0.61 not being parsed

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 55:477ba09475d7 362 flash_Platform_MathOffsetA0 = 0x08071053,
whismanoid 55:477ba09475d7 363 flash_Platform_MathOffsetA1 = 0x08071153,
whismanoid 55:477ba09475d7 364 flash_Platform_MathOffsetA2 = 0x08071253,
whismanoid 55:477ba09475d7 365 flash_Platform_MathOffsetA3 = 0x08071353,
whismanoid 55:477ba09475d7 366 flash_Platform_MathOffsetA4 = 0x08071453,
whismanoid 55:477ba09475d7 367 flash_Platform_MathOffsetA5 = 0x08071553,
whismanoid 55:477ba09475d7 368 //
whismanoid 55:477ba09475d7 369 flash_Platform_MathGainMulA0 = 0x08072053,
whismanoid 55:477ba09475d7 370 flash_Platform_MathGainMulA1 = 0x08072153,
whismanoid 55:477ba09475d7 371 flash_Platform_MathGainMulA2 = 0x08072253,
whismanoid 55:477ba09475d7 372 flash_Platform_MathGainMulA3 = 0x08072353,
whismanoid 55:477ba09475d7 373 flash_Platform_MathGainMulA4 = 0x08072453,
whismanoid 55:477ba09475d7 374 flash_Platform_MathGainMulA5 = 0x08072553,
whismanoid 55:477ba09475d7 375 //
whismanoid 55:477ba09475d7 376 flash_Platform_MathGainDivA0 = 0x08073053,
whismanoid 55:477ba09475d7 377 flash_Platform_MathGainDivA1 = 0x08073153,
whismanoid 55:477ba09475d7 378 flash_Platform_MathGainDivA2 = 0x08073253,
whismanoid 55:477ba09475d7 379 flash_Platform_MathGainDivA3 = 0x08073353,
whismanoid 55:477ba09475d7 380 flash_Platform_MathGainDivA4 = 0x08073453,
whismanoid 55:477ba09475d7 381 flash_Platform_MathGainDivA5 = 0x08073553,
whismanoid 55:477ba09475d7 382 //
whismanoid 55:477ba09475d7 383 flash_Platform_MathUnitString_ch0 = 0x42078053,
whismanoid 55:477ba09475d7 384 flash_Platform_MathUnitString_ch1 = 0x42078153,
whismanoid 55:477ba09475d7 385 flash_Platform_MathUnitString_ch2 = 0x42078253,
whismanoid 55:477ba09475d7 386 flash_Platform_MathUnitString_ch3 = 0x42078353,
whismanoid 55:477ba09475d7 387 flash_Platform_MathUnitString_ch4 = 0x42078453,
whismanoid 55:477ba09475d7 388 flash_Platform_MathUnitString_ch5 = 0x42078553,
whismanoid 55:477ba09475d7 389 //
whismanoid 55:477ba09475d7 390 } flash_item_id_enum_t;
whismanoid 55:477ba09475d7 391 //--------------------------------------------------
whismanoid 55:477ba09475d7 392 // flash_LE_bytes(bigEndianValue) -> four bytes in little-endian order, for flash memory
whismanoid 55:477ba09475d7 393 #define flash_LE_bytes(itemBE) (((itemBE))&0xFF),(((itemBE)>>8)&0xFF),(((itemBE)>>16)&0xFF),(((itemBE)>>24)&0xFF)
whismanoid 55:477ba09475d7 394 //--------------------------------------------------
whismanoid 51:a41d3fd5e441 395 // MAX40108 calibration values assign absolute address
whismanoid 51:a41d3fd5e441 396 // Note this data is little-endian, least significant byte first
whismanoid 47:f1a56afb4aca 397 const char flash_page_configuration_back_up[8192] __attribute__((aligned(8192))) = {
whismanoid 47:f1a56afb4aca 398 // 0x04000053, 0xffffffff, 0xffffffff, 0xffffffff, // g_board_serial_number is blank 0xFFFFFFFF
whismanoid 51:a41d3fd5e441 399 // 3, ___2, ___1, ___0, ___7, ___6, ___5, ___4, ___b, ___a, ___9, ___8, ___f, ___e, ___d, ___c,
whismanoid 55:477ba09475d7 400 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 401 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 402 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 403 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 404 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 405 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 406 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 407 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 408 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 409 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 410 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 411 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 412 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 413 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 414 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 415 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 416 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 417 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 418 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 419 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 420 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 421 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 422 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 423 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 424 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 425 // WIP #312 initial values in flash_page_configuration_back_up[]
whismanoid 55:477ba09475d7 426 //
whismanoid 55:477ba09475d7 427 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 428 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_MathOffsetA
whismanoid 55:477ba09475d7 429 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_MathGainMulA
whismanoid 55:477ba09475d7 430 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_MathGainDivA
whismanoid 55:477ba09475d7 431 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_MathUnitString
whismanoid 55:477ba09475d7 432 //
whismanoid 55:477ba09475d7 433 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 434 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathOffsetA
whismanoid 55:477ba09475d7 435 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathGainMulA
whismanoid 55:477ba09475d7 436 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathGainDivA
whismanoid 55:477ba09475d7 437 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathUnitString
whismanoid 55:477ba09475d7 438 //
whismanoid 55:477ba09475d7 439 // MAX32625 flash peek/poke support (MAX40108 demo) #312 -- more items could be added here
whismanoid 55:477ba09475d7 440 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 441 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 442 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 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), // FLA19 0x000261c0
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 0x000261d0
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 0x000261e0
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 0x000261f0
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 0x00026200
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),
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),
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),
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), // FLA19 0x00026300
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),
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), // FLA19 0x00026400
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),
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), // FLA19 0x00026500
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),
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), // FLA19 0x00026600
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),
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), // FLA19 0x00026700
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),
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), // FLA19 0x00026800
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),
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), // FLA19 0x00026900
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),
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), // FLA19 0x000269f0
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), // FLA19 0x00026a00
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),
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),
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), // FLA19 0x00026af0
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), // FLA19 0x00026b00
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),
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),
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), // FLA19 0x00026bf0
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), // FLA19 0x00026c00
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),
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),
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), // FLA19 0x00026cf0
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), // FLA19 0x00026d00
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),
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),
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), // FLA19 0x00026df0
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), // FLA19 0x00026e00
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),
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),
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), // FLA19 0x00026ef0
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), // FLA19 0x00026f00
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),
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),
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), // FLA19 0x00026ff0
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), // FLA19 0x00027000
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),
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),
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), // FLA19 0x000270f0
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), // FLA19 0x00027100
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),
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),
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), // FLA19 0x000271f0
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), // FLA19 0x00027200
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),
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),
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), // FLA19 0x000272f0
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), // FLA19 0x00027300
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),
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),
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), // FLA19 0x000273f0
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), // FLA19 0x00027400
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),
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),
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), // FLA19 0x000274f0
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), // FLA19 0x00027500
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),
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),
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), // FLA19 0x000275f0
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), // FLA19 0x00027600
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),
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),
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), // FLA19 0x000276f0
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), // FLA19 0x00027700
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),
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),
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), // FLA19 0x000277f0
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), // FLA19 0x00027800
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),
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),
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), // FLA19 0x000278f0
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), // FLA19 0x00027900
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),
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),
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), // FLA19 0x000279f0
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), // FLA19 0x00027a00
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),
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),
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), // FLA19 0x00027af0
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), // FLA19 0x00027b00
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),
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),
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), // FLA19 0x00027bf0
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), // FLA19 0x00027c00
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),
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),
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), // FLA19 0x00027cf0
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), // FLA19 0x00027d00
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),
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),
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), // FLA19 0x00027df0
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), // FLA19 0x00027e00
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),
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),
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), // FLA19 0x00027ef0
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), // FLA19 0x00027f00
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),
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),
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) // FLA19 0x00027ff0
whismanoid 47:f1a56afb4aca 927 };
whismanoid 46:469d0061df5d 928 // WIP #312 map values in flash_page_configuration_back_up[]
whismanoid 46:469d0061df5d 929 // such as board serial number, %A calibration values,
whismanoid 46:469d0061df5d 930 // business logic, button handlers, etc.
whismanoid 46:469d0061df5d 931 // Use some pattern that stands out in the hex file dump
whismanoid 46:469d0061df5d 932 // as well as in the flash dump... note the hex file is LE/LSbyte first,
whismanoid 46:469d0061df5d 933 // while the flash memory is BE/MSbyte first.
whismanoid 46:469d0061df5d 934 //
whismanoid 46:469d0061df5d 935 // I don't have control of where this ends up because "at" attribute
whismanoid 46:469d0061df5d 936 // is not supported, but at least flash_page_configuration_back_up
whismanoid 46:469d0061df5d 937 // is page-aligned and its address is printed in the help.
whismanoid 46:469d0061df5d 938 // Also use a pattern that should stand out in the hex dump.
whismanoid 46:469d0061df5d 939 // Note that in the .bin file, "32107654" is 33 32 31 30 37 36 35 34,
whismanoid 46:469d0061df5d 940 // but in the flash memory it will be 0x30313233 0x34353637
whismanoid 46:469d0061df5d 941 // Use free hex editor to find text in .bin file,
whismanoid 46:469d0061df5d 942 // then add base address 0x00010000 to get peek address.
whismanoid 46:469d0061df5d 943 // char* TestString1 = "UUUUUUUUUUUUUUUUUUUU""32107654BA98FEDC"" MAX32625 Calibration ....####@@@@""UUUUUUUUUUUUUUUUUUUU";
whismanoid 46:469d0061df5d 944 // > %F peek=0x000241f0 len=20
whismanoid 46:469d0061df5d 945 // FLASH 0x000241f0: 0x544c4f56 0x00454741 0x55555555 0x55555555
whismanoid 46:469d0061df5d 946 // FLASH 0x00024200: 0x55555555 0x55555555 0x55555555 0x30313233
whismanoid 46:469d0061df5d 947 // FLASH 0x00024210: 0x34353637 0x38394142 0x43444546 0x58414d20
whismanoid 46:469d0061df5d 948 // FLASH 0x00024220: 0x32363233 0x61432035 0x7262696c 0x6f697461
whismanoid 46:469d0061df5d 949 // FLASH 0x00024230: 0x2020206e 0x2e2e2e2e 0x23232323 0x40404040
whismanoid 46:469d0061df5d 950 // FLASH 0x00024240: 0x55555555 0x55555555 0x55555555 0x55555555
whismanoid 46:469d0061df5d 951 // FLASH 0x00024250: 0x55555555 0x00000000 0x00000000 0x00000000
whismanoid 46:469d0061df5d 952 // FLASH 0x00024260: 0x00013b1b 0x000140d1 0x00013d9f 0x00013e2d
whismanoid 46:469d0061df5d 953 //
whismanoid 46:469d0061df5d 954 // Why did it end up at that address? Here's the linker map report:
whismanoid 46:469d0061df5d 955 // .\BUILD\MAX32625PICO\GCC_ARM\Internal_DataLogger.map
whismanoid 46:469d0061df5d 956 // .text.startup._GLOBAL__sub_I_TestString1
whismanoid 46:469d0061df5d 957 // 0x0001374c 0x33c BUILD/MAX32625PICO/GCC_ARM/DataLogger_Internal.o
whismanoid 46:469d0061df5d 958 // .rodata._GLOBAL__sub_I_TestString1.str1.1
whismanoid 46:469d0061df5d 959 // 0x00022d64 0x12 BUILD/MAX32625PICO/GCC_ARM/DataLogger_Internal.o
whismanoid 46:469d0061df5d 960 // 0x19 (size before relaxing)
whismanoid 46:469d0061df5d 961 //
whismanoid 46:469d0061df5d 962 // For calibration purposes this could still be usable,
whismanoid 46:469d0061df5d 963 // as long as the firmware knows where its calibration constants live.
whismanoid 46:469d0061df5d 964 //
whismanoid 46:469d0061df5d 965 #if defined ( __GNUC__ )
whismanoid 46:469d0061df5d 966 __attribute__ ((section(".calibration_teststring")))
whismanoid 46:469d0061df5d 967 #endif
whismanoid 46:469d0061df5d 968 char* TestString1 = "UUUU" "UUUU" "UUUU" "UUUU"
whismanoid 46:469d0061df5d 969 "\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF"
whismanoid 46:469d0061df5d 970 "\x11\x22\x33\x44" "\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF"
whismanoid 46:469d0061df5d 971 "UUUUUUUUUUUUUUUUUUUU""32107654BA98FEDC"" MAX32625 Calibration ....####@@@@""UUUUUUUUUUUUUUUUUUUU";
whismanoid 46:469d0061df5d 972 //
whismanoid 46:469d0061df5d 973 // Limit the ranges where memory write operation will be allowed
whismanoid 46:469d0061df5d 974 // MAX32625 flash peek/poke support (MAX40108 demo) #312
whismanoid 46:469d0061df5d 975 // FLASH (rx) : ORIGIN = 0x00010000, LENGTH = 0x00070000
whismanoid 46:469d0061df5d 976 // RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00028000
whismanoid 46:469d0061df5d 977 typedef struct {
whismanoid 46:469d0061df5d 978 uint32_t addr_min; // lowest address of range
whismanoid 46:469d0061df5d 979 uint32_t addr_max; // highest address of range
whismanoid 46:469d0061df5d 980 char name[6]; // 5-character name, pad with spaces, null-terminated
whismanoid 46:469d0061df5d 981 char can_flash_write_read; // 8=end of list, 4=flashPoke, 2=ramPoke, 1=read
whismanoid 46:469d0061df5d 982 } poke_access_t;
whismanoid 51:a41d3fd5e441 983 const char poke_access_readOnly = 1;
whismanoid 51:a41d3fd5e441 984 const char poke_access_rw_RAM = 3;
whismanoid 51:a41d3fd5e441 985 const char poke_access_rw_FLASH = 5;
whismanoid 51:a41d3fd5e441 986 const char poke_access_EndOfList = 8;
whismanoid 46:469d0061df5d 987 poke_access_t poke_access_list[] = {
whismanoid 46:469d0061df5d 988 { 0x12345678, 0x12345678, "undef", 0 }, // first record: catch undefined ranges
whismanoid 46:469d0061df5d 989 // { 0x00000000, 0x0000FFFF, " BOOT", 1 }, // boot area is flash page 0-7, but don't allow flashPoke
whismanoid 51:a41d3fd5e441 990 { 0x00000000, 0x00001FFF, "BOOT0", poke_access_readOnly }, // flash page 0
whismanoid 51:a41d3fd5e441 991 { 0x00002000, 0x00003FFF, "BOOT1", poke_access_readOnly }, // flash page 1
whismanoid 51:a41d3fd5e441 992 { 0x00004000, 0x00005FFF, "BOOT2", poke_access_readOnly }, // flash page 2
whismanoid 51:a41d3fd5e441 993 { 0x00006000, 0x00007FFF, "BOOT3", poke_access_readOnly }, // flash page 3
whismanoid 51:a41d3fd5e441 994 { 0x00008000, 0x00009FFF, "BOOT4", poke_access_readOnly }, // flash page 4
whismanoid 51:a41d3fd5e441 995 { 0x0000A000, 0x0000BFFF, "BOOT5", poke_access_readOnly }, // flash page 5
whismanoid 51:a41d3fd5e441 996 { 0x0000C000, 0x0000DFFF, "BOOT6", poke_access_readOnly }, // flash page 6
whismanoid 51:a41d3fd5e441 997 { 0x0000E000, 0x0000FFFF, "BOOT7", poke_access_readOnly }, // flash page 7
whismanoid 46:469d0061df5d 998 //
whismanoid 51:a41d3fd5e441 999 //{ 0x00010000, 0x0007FFFF, "FLASH", poke_access_rw_FLASH }, // flash pages 8-62
whismanoid 46:469d0061df5d 1000 // Future: separate FLASH pages, allow flashPoke only on the calibration page
whismanoid 51:a41d3fd5e441 1001 { 0x00010000, 0x00011FFF, "FLA08", poke_access_rw_FLASH }, // flash page 8
whismanoid 51:a41d3fd5e441 1002 { 0x00012000, 0x00013FFF, "FLA09", poke_access_rw_FLASH }, // flash page 9
whismanoid 51:a41d3fd5e441 1003 { 0x00014000, 0x00015FFF, "FLA10", poke_access_rw_FLASH }, // flash page 10
whismanoid 51:a41d3fd5e441 1004 { 0x00016000, 0x00017FFF, "FLA11", poke_access_rw_FLASH }, // flash page 11
whismanoid 51:a41d3fd5e441 1005 { 0x00018000, 0x00019FFF, "FLA12", poke_access_rw_FLASH }, // flash page 12
whismanoid 51:a41d3fd5e441 1006 { 0x0001A000, 0x0001BFFF, "FLA13", poke_access_rw_FLASH }, // flash page 13
whismanoid 51:a41d3fd5e441 1007 { 0x0001C000, 0x0001DFFF, "FLA14", poke_access_rw_FLASH }, // flash page 14
whismanoid 51:a41d3fd5e441 1008 { 0x0001E000, 0x0001FFFF, "FLA15", poke_access_rw_FLASH }, // flash page 15
whismanoid 46:469d0061df5d 1009 //
whismanoid 51:a41d3fd5e441 1010 { 0x00020000, 0x00021FFF, "FLA16", poke_access_rw_FLASH }, // flash page 16
whismanoid 51:a41d3fd5e441 1011 { 0x00022000, 0x00023FFF, "FLA17", poke_access_rw_FLASH }, // flash page 17
whismanoid 51:a41d3fd5e441 1012 { 0x00024000, 0x00025FFF, "FLA18", poke_access_rw_FLASH }, // flash page 18
whismanoid 51:a41d3fd5e441 1013 { 0x00026000, 0x00027FFF, "FLA19", poke_access_rw_FLASH }, // flash page 19
whismanoid 51:a41d3fd5e441 1014 { 0x00028000, 0x00029FFF, "FLA20", poke_access_rw_FLASH }, // flash page 20
whismanoid 51:a41d3fd5e441 1015 { 0x0002A000, 0x0002BFFF, "FLA21", poke_access_rw_FLASH }, // flash page 21
whismanoid 51:a41d3fd5e441 1016 { 0x0002C000, 0x0002DFFF, "FLA22", poke_access_rw_FLASH }, // flash page 22
whismanoid 51:a41d3fd5e441 1017 { 0x0002E000, 0x0002FFFF, "FLA23", poke_access_rw_FLASH }, // flash page 23
whismanoid 46:469d0061df5d 1018 //
whismanoid 51:a41d3fd5e441 1019 { 0x00030000, 0x00031FFF, "FLA24", poke_access_rw_FLASH }, // flash page 24
whismanoid 51:a41d3fd5e441 1020 { 0x00032000, 0x00033FFF, "FLA25", poke_access_rw_FLASH }, // flash page 25
whismanoid 51:a41d3fd5e441 1021 { 0x00034000, 0x00035FFF, "FLA26", poke_access_rw_FLASH }, // flash page 26
whismanoid 51:a41d3fd5e441 1022 { 0x00036000, 0x00037FFF, "FLA27", poke_access_rw_FLASH }, // flash page 27
whismanoid 51:a41d3fd5e441 1023 { 0x00038000, 0x00039FFF, "FLA28", poke_access_rw_FLASH }, // flash page 28
whismanoid 51:a41d3fd5e441 1024 { 0x0003A000, 0x0003BFFF, "FLA29", poke_access_rw_FLASH }, // flash page 29
whismanoid 51:a41d3fd5e441 1025 { 0x0003C000, 0x0003DFFF, "FLA30", poke_access_rw_FLASH }, // flash page 30
whismanoid 51:a41d3fd5e441 1026 { 0x0003E000, 0x0003FFFF, "FLA31", poke_access_rw_FLASH }, // flash page 31
whismanoid 46:469d0061df5d 1027 //
whismanoid 51:a41d3fd5e441 1028 { 0x00040000, 0x00041FFF, "FLA32", poke_access_rw_FLASH }, // flash page 32
whismanoid 51:a41d3fd5e441 1029 { 0x00042000, 0x00043FFF, "FLA33", poke_access_rw_FLASH }, // flash page 33
whismanoid 51:a41d3fd5e441 1030 { 0x00044000, 0x00045FFF, "FLA34", poke_access_rw_FLASH }, // flash page 34
whismanoid 51:a41d3fd5e441 1031 { 0x00046000, 0x00047FFF, "FLA35", poke_access_rw_FLASH }, // flash page 35
whismanoid 51:a41d3fd5e441 1032 { 0x00048000, 0x00049FFF, "FLA36", poke_access_rw_FLASH }, // flash page 36
whismanoid 51:a41d3fd5e441 1033 { 0x0004A000, 0x0004BFFF, "FLA37", poke_access_rw_FLASH }, // flash page 37
whismanoid 51:a41d3fd5e441 1034 { 0x0004C000, 0x0004DFFF, "FLA38", poke_access_rw_FLASH }, // flash page 38
whismanoid 51:a41d3fd5e441 1035 { 0x0004E000, 0x0004FFFF, "FLA39", poke_access_rw_FLASH }, // flash page 39
whismanoid 46:469d0061df5d 1036 //
whismanoid 51:a41d3fd5e441 1037 { 0x00050000, 0x00051FFF, "FLA40", poke_access_rw_FLASH }, // flash page 40
whismanoid 51:a41d3fd5e441 1038 { 0x00052000, 0x00053FFF, "FLA41", poke_access_rw_FLASH }, // flash page 41
whismanoid 51:a41d3fd5e441 1039 { 0x00054000, 0x00055FFF, "FLA42", poke_access_rw_FLASH }, // flash page 42
whismanoid 51:a41d3fd5e441 1040 { 0x00056000, 0x00057FFF, "FLA43", poke_access_rw_FLASH }, // flash page 43
whismanoid 51:a41d3fd5e441 1041 { 0x00058000, 0x00059FFF, "FLA44", poke_access_rw_FLASH }, // flash page 44
whismanoid 51:a41d3fd5e441 1042 { 0x0005A000, 0x0005BFFF, "FLA45", poke_access_rw_FLASH }, // flash page 45
whismanoid 51:a41d3fd5e441 1043 { 0x0005C000, 0x0005DFFF, "FLA46", poke_access_rw_FLASH }, // flash page 46
whismanoid 51:a41d3fd5e441 1044 { 0x0005E000, 0x0005FFFF, "FLA47", poke_access_rw_FLASH }, // flash page 47
whismanoid 46:469d0061df5d 1045 //
whismanoid 51:a41d3fd5e441 1046 { 0x00060000, 0x00061FFF, "FLA48", poke_access_rw_FLASH }, // flash page 48
whismanoid 51:a41d3fd5e441 1047 { 0x00062000, 0x00063FFF, "FLA49", poke_access_rw_FLASH }, // flash page 49
whismanoid 51:a41d3fd5e441 1048 { 0x00064000, 0x00065FFF, "FLA50", poke_access_rw_FLASH }, // flash page 50
whismanoid 51:a41d3fd5e441 1049 { 0x00066000, 0x00067FFF, "FLA51", poke_access_rw_FLASH }, // flash page 51
whismanoid 51:a41d3fd5e441 1050 { 0x00068000, 0x00069FFF, "FLA52", poke_access_rw_FLASH }, // flash page 52
whismanoid 51:a41d3fd5e441 1051 { 0x0006A000, 0x0006BFFF, "FLA53", poke_access_rw_FLASH }, // flash page 53
whismanoid 51:a41d3fd5e441 1052 { 0x0006C000, 0x0006DFFF, "FLA54", poke_access_rw_FLASH }, // flash page 54
whismanoid 51:a41d3fd5e441 1053 { 0x0006E000, 0x0006FFFF, "FLA55", poke_access_rw_FLASH }, // flash page 55
whismanoid 46:469d0061df5d 1054 //
whismanoid 51:a41d3fd5e441 1055 { 0x00070000, 0x00071FFF, "FLA56", poke_access_rw_FLASH }, // flash page 56
whismanoid 51:a41d3fd5e441 1056 { 0x00072000, 0x00073FFF, "FLA57", poke_access_rw_FLASH }, // flash page 57
whismanoid 51:a41d3fd5e441 1057 { 0x00074000, 0x00075FFF, "FLA58", poke_access_rw_FLASH }, // flash page 58
whismanoid 51:a41d3fd5e441 1058 { 0x00076000, 0x00077FFF, "FLA59", poke_access_rw_FLASH }, // flash page 59
whismanoid 51:a41d3fd5e441 1059 { 0x00078000, 0x00079FFF, "FLA60", poke_access_rw_FLASH }, // flash page 60
whismanoid 51:a41d3fd5e441 1060 { 0x0007A000, 0x0007BFFF, "FLA61", poke_access_rw_FLASH }, // flash page 61
whismanoid 51:a41d3fd5e441 1061 { 0x0007C000, 0x0007DFFF, "FLA62", poke_access_rw_FLASH }, // flash page 62
whismanoid 51:a41d3fd5e441 1062 { 0x0007E000, 0x0007FFFF, "FLA63", poke_access_rw_FLASH }, // flash page 63
whismanoid 46:469d0061df5d 1063 //
whismanoid 51:a41d3fd5e441 1064 { 0x20000000, 0x20027FFF, " RAM", poke_access_rw_RAM }, // ramPoke + read
whismanoid 46:469d0061df5d 1065 { 0x20028000, 0x2002FFFF, "skip ", 0 }, // don't read from this range
whismanoid 51:a41d3fd5e441 1066 { 0x40000000, 0x400003FF, " SYS", poke_access_readOnly }, // read only
whismanoid 51:a41d3fd5e441 1067 { 0x40000400, 0x400007FF, " CLK", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1068 { 0x40000800, 0x400009FF, " PWR", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1069 { 0x40000A00, 0x40000BFF, " RTC", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1070 { 0x40000C00, 0x40001FFF, "IOMAN", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1071 { 0x40002000, 0x40002FFF, " FLC", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1072 { 0x40003000, 0x40003FFF, " ICC", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1073 { 0x40004000, 0x40004FFF, " SPIX", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1074 { 0x40005000, 0x40005FFF, " PMU", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1075 { 0x40006000, 0x40006FFF, " CRC", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1076 { 0x40007000, 0x40007FFF, " TPU", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1077 { 0x40008000, 0x40008FFF, " WDT0", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1078 { 0x40009000, 0x40009FFF, " WDT1", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1079 { 0x4000A000, 0x4000AFFF, " GPIO", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1080 { 0x4000B000, 0x4000FFFF, " TMR", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1081 { 0x40011000, 0x4000FFFF, " PT", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1082 { 0x40012000, 0x4000FFFF, " UART", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1083 { 0x40016000, 0x4000FFFF, " I2CM", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1084 { 0x40019000, 0x4000FFFF, " I2CS", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1085 { 0x4001A000, 0x4000FFFF, " SPIM", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1086 { 0x4001E000, 0x4000FFFF, " OWM", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1087 { 0x4001F000, 0x4000FFFF, " ADC", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1088 { 0x40020000, 0x40000FFF, " SPIS", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1089 { 0x40100000, 0x40100FFF, " USB", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1090 { 0x40101000, 0x40101FFF, " CRC", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1091 { 0x40102000, 0x40102FFF, " TPU", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1092 { 0x40103000, 0x40103FFF, "UART0", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1093 { 0x40104000, 0x40104FFF, "UART1", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1094 { 0x40105000, 0x40105FFF, "UART2", poke_access_readOnly },
whismanoid 51:a41d3fd5e441 1095 //{ 0x40106000, 0x40106FFF, "_____", poke_access_readOnly }, // reserved
whismanoid 51:a41d3fd5e441 1096 { 0x40107000, 0x40107FFF, "I2CM0", poke_access_readOnly }, // I2CM0 FIFOs
whismanoid 51:a41d3fd5e441 1097 { 0x40108000, 0x40108FFF, "I2CM1", poke_access_readOnly }, // I2CM1 FIFOs
whismanoid 51:a41d3fd5e441 1098 //{ 0x40109000, 0x40109FFF, "_____", poke_access_readOnly }, // reserved
whismanoid 51:a41d3fd5e441 1099 { 0x4010A000, 0x4010AFFF, "SPIM0", poke_access_readOnly }, // SPIM0 FIFOs
whismanoid 51:a41d3fd5e441 1100 { 0x4010B000, 0x4010BFFF, "SPIM1", poke_access_readOnly }, // SPIM1 FIFOs
whismanoid 51:a41d3fd5e441 1101 { 0x4010C000, 0x4010CFFF, "SPIM2", poke_access_readOnly }, // SPIM2 FIFOs
whismanoid 51:a41d3fd5e441 1102 //{ 0x4010D000, 0x4010DFFF, "_____", poke_access_readOnly }, // reserved
whismanoid 51:a41d3fd5e441 1103 { 0x4010E000, 0x4010EFFF, " SPIS", poke_access_readOnly }, // SPIS FIFOs
whismanoid 51:a41d3fd5e441 1104 //{ 0x4010F000, 0x4010FFFF, "_____", poke_access_readOnly }, // reserved
whismanoid 46:469d0061df5d 1105 //
whismanoid 51:a41d3fd5e441 1106 { 0x00000000, 0xFFFFFFFF, "last?", poke_access_EndOfList }, // end of list can_flash_write_read=8, catch-all
whismanoid 46:469d0061df5d 1107 };
whismanoid 46:469d0061df5d 1108 int search_poke_access_list(uint32_t addr)
whismanoid 46:469d0061df5d 1109 {
whismanoid 46:469d0061df5d 1110 // scan poke_access_list[] for peek_addr
whismanoid 46:469d0061df5d 1111 for (int i = 0; poke_access_list[i].can_flash_write_read != 8; i++)
whismanoid 46:469d0061df5d 1112 {
whismanoid 46:469d0061df5d 1113 if ((addr >= poke_access_list[i].addr_min) && (addr <= poke_access_list[i].addr_max))
whismanoid 46:469d0061df5d 1114 {
whismanoid 46:469d0061df5d 1115 return i;
whismanoid 46:469d0061df5d 1116 }
whismanoid 46:469d0061df5d 1117 }
whismanoid 46:469d0061df5d 1118 return 0;
whismanoid 46:469d0061df5d 1119 }
whismanoid 46:469d0061df5d 1120 #endif // defined(HAS_FLASH_PEEK) || defined(HAS_FLASH_POKE)
whismanoid 46:469d0061df5d 1121
whismanoid 46:469d0061df5d 1122 //--------------------------------------------------
whismanoid 3:9055e17e181a 1123 // Option to use SPI connected ADC
whismanoid 3:9055e17e181a 1124 #ifndef SPI_ADC_DeviceName
whismanoid 9:45f98573eb6d 1125 #define SPI_ADC_DeviceName MAX11410
whismanoid 3:9055e17e181a 1126 #undef SPI_ADC_DeviceName
whismanoid 3:9055e17e181a 1127 #endif
whismanoid 3:9055e17e181a 1128 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 1129 #include "MAX11410.h"
whismanoid 3:9055e17e181a 1130 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 1131 //--------------------------------------------------
whismanoid 55:477ba09475d7 1132 // Option to Datalog SPI connected ADC analog inputs with offset/gain applied
whismanoid 55:477ba09475d7 1133 // MAX40108 Datalog Math #362 -- define compile-time option SPI_AIN_MATH
whismanoid 55:477ba09475d7 1134 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 1135 #ifndef SPI_AIN_MATH
whismanoid 55:477ba09475d7 1136 #define SPI_AIN_MATH 1
whismanoid 55:477ba09475d7 1137 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 1138 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 1139 //--------------------------------------------------
whismanoid 55:477ba09475d7 1140 // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 1141 // This could be used to identify external hardware attached to each input
whismanoid 55:477ba09475d7 1142 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 1143 #ifndef HAS_SPI_AIN_customChannelHeader
whismanoid 55:477ba09475d7 1144 #define HAS_SPI_AIN_customChannelHeader 1
whismanoid 55:477ba09475d7 1145 #endif
whismanoid 55:477ba09475d7 1146 #if HAS_SPI_AIN_customChannelHeader
whismanoid 55:477ba09475d7 1147 #define SPI_AIN_customChannelHeader_MAXLENGTH 20
whismanoid 55:477ba09475d7 1148 #endif
whismanoid 55:477ba09475d7 1149 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 1150
whismanoid 55:477ba09475d7 1151 //--------------------------------------------------
whismanoid 55:477ba09475d7 1152 // Option to Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 1153 #ifndef LOG_PLATFORM_AIN
whismanoid 55:477ba09475d7 1154 #define LOG_PLATFORM_AIN 6
whismanoid 55:477ba09475d7 1155 //~ #undef LOG_PLATFORM_AIN
whismanoid 55:477ba09475d7 1156 #endif
whismanoid 55:477ba09475d7 1157 //--------------------------------------------------
whismanoid 55:477ba09475d7 1158 // Option to Datalog Arduino platform analog inputs with offset/gain applied
whismanoid 55:477ba09475d7 1159 // MAX40108 Datalog Math #362 -- define compile-time option PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 1160 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 1161 #ifndef PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 1162 #define PLATFORM_AIN_MATH 1
whismanoid 55:477ba09475d7 1163 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 1164 #endif // defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 1165 //--------------------------------------------------
whismanoid 55:477ba09475d7 1166 // Option to customize channel names in datalog header line
whismanoid 55:477ba09475d7 1167 // This could be used to identify external hardware attached to each input
whismanoid 55:477ba09475d7 1168 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 1169 #ifndef HAS_Platform_AIN_customChannelHeader
whismanoid 55:477ba09475d7 1170 #define HAS_Platform_AIN_customChannelHeader 1
whismanoid 55:477ba09475d7 1171 #endif
whismanoid 55:477ba09475d7 1172 #if HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 1173 #define Platform_AIN_customChannelHeader_MAXLENGTH 20
whismanoid 55:477ba09475d7 1174 #endif
whismanoid 55:477ba09475d7 1175 #endif // defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 1176
whismanoid 55:477ba09475d7 1177 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1178 #if defined(TARGET)
whismanoid 0:cb44e2e9ec4c 1179 // TARGET_NAME macros from targets/TARGET_Maxim/TARGET_MAX32625/device/mxc_device.h
whismanoid 0:cb44e2e9ec4c 1180 // Create a string definition for the TARGET
whismanoid 0:cb44e2e9ec4c 1181 #define STRING_ARG(arg) #arg
whismanoid 0:cb44e2e9ec4c 1182 #define STRING_NAME(name) STRING_ARG(name)
whismanoid 0:cb44e2e9ec4c 1183 #define TARGET_NAME STRING_NAME(TARGET)
whismanoid 0:cb44e2e9ec4c 1184 #elif defined(TARGET_MAX32600)
whismanoid 0:cb44e2e9ec4c 1185 #define TARGET_NAME "MAX32600"
whismanoid 0:cb44e2e9ec4c 1186 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 1187 #define TARGET_NAME "LPC1768"
whismanoid 0:cb44e2e9ec4c 1188 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:cb44e2e9ec4c 1189 #define TARGET_NAME "NUCLEO_F446RE"
whismanoid 0:cb44e2e9ec4c 1190 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 1191 #define TARGET_NAME "NUCLEO_F401RE"
whismanoid 0:cb44e2e9ec4c 1192 #else
whismanoid 0:cb44e2e9ec4c 1193 #error TARGET NOT DEFINED
whismanoid 0:cb44e2e9ec4c 1194 #endif
whismanoid 0:cb44e2e9ec4c 1195 #if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 1196 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1197 // TARGET=MAX32630FTHR ARM Cortex-M4F 96MHz 2048kB Flash 512kB SRAM
whismanoid 0:cb44e2e9ec4c 1198 // +-------------[microUSB]-------------+
whismanoid 0:cb44e2e9ec4c 1199 // | J1 MAX32630FTHR J2 |
whismanoid 0:cb44e2e9ec4c 1200 // ______ | [ ] RST GND [ ] |
whismanoid 0:cb44e2e9ec4c 1201 // ______ | [ ] 3V3 BAT+[ ] |
whismanoid 0:cb44e2e9ec4c 1202 // ______ | [ ] 1V8 reset SW1 |
whismanoid 0:cb44e2e9ec4c 1203 // ______ | [ ] GND J4 J3 |
whismanoid 0:cb44e2e9ec4c 1204 // analogIn0/4 | [a] AIN_0 1.2Vfs (bat) SYS [ ] | switched BAT+
whismanoid 0:cb44e2e9ec4c 1205 // analogIn1/5 | [a] AIN_1 1.2Vfs PWR [ ] | external pwr btn
whismanoid 0:cb44e2e9ec4c 1206 // analogIn2 | [a] AIN_2 1.2Vfs +5V VBUS [ ] | USB +5V power
whismanoid 0:cb44e2e9ec4c 1207 // analogIn3 | [a] AIN_3 1.2Vfs 1-WIRE P4_0 [d] | D0 dig9
whismanoid 0:cb44e2e9ec4c 1208 // (I2C2.SDA) | [d] P5_7 SDA2 SRN P5_6 [d] | D1 dig8
whismanoid 0:cb44e2e9ec4c 1209 // (I2C2.SCL) | [d] P6_0 SCL2 SDIO3 P5_5 [d] | D2 dig7
whismanoid 0:cb44e2e9ec4c 1210 // D13/SCLK | [s] P5_0 SCLK SDIO2 P5_4 [d] | D3 dig6
whismanoid 0:cb44e2e9ec4c 1211 // D11/MOSI | [s] P5_1 MOSI SSEL P5_3 [d] | D4 dig5
whismanoid 0:cb44e2e9ec4c 1212 // D12/MISO | [s] P5_2 MISO RTS P3_3 [d] | D5 dig4
whismanoid 0:cb44e2e9ec4c 1213 // D10/CS | [s] P3_0 RX CTS P3_2 [d] | D6 dig3
whismanoid 0:cb44e2e9ec4c 1214 // D9 dig0 | [d] P3_1 TX SCL P3_5 [d] | D7 dig2
whismanoid 0:cb44e2e9ec4c 1215 // ______ | [ ] GND SDA P3_4 [d] | D8 dig1
whismanoid 0:cb44e2e9ec4c 1216 // | |
whismanoid 0:cb44e2e9ec4c 1217 // | XIP Flash MAX14690N |
whismanoid 0:cb44e2e9ec4c 1218 // | XIP_SCLK P1_0 SDA2 P5_7 |
whismanoid 0:cb44e2e9ec4c 1219 // | XIP_MOSI P1_1 SCL2 P6_0 |
whismanoid 0:cb44e2e9ec4c 1220 // | XIP_MISO P1_2 PMIC_INIT P3_7 |
whismanoid 0:cb44e2e9ec4c 1221 // | XIP_SSEL P1_3 MPC P2_7 |
whismanoid 0:cb44e2e9ec4c 1222 // | XIP_DIO2 P1_4 MON AIN_0 |
whismanoid 0:cb44e2e9ec4c 1223 // | XIP_DIO3 P1_5 |
whismanoid 0:cb44e2e9ec4c 1224 // | |
whismanoid 0:cb44e2e9ec4c 1225 // | PAN1326B MicroSD LED |
whismanoid 0:cb44e2e9ec4c 1226 // | BT_RX P0_0 SD_SCLK P0_4 r P2_4 |
whismanoid 0:cb44e2e9ec4c 1227 // | BT_TX P0_1 SD_MOSI P0_5 g P2_5 |
whismanoid 0:cb44e2e9ec4c 1228 // | BT_CTS P0_2 SD_MISO P0_6 b P2_6 |
whismanoid 0:cb44e2e9ec4c 1229 // | BT_RTS P0_3 SD_SSEL P0_7 |
whismanoid 0:cb44e2e9ec4c 1230 // | BT_RST P1_6 DETECT P2_2 |
whismanoid 0:cb44e2e9ec4c 1231 // | BT_CLK P1_7 SW2 P2_3 |
whismanoid 0:cb44e2e9ec4c 1232 // +------------------------------------+
whismanoid 0:cb44e2e9ec4c 1233 // 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 1234 // 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 1235 // AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1236 // AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1237 // AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1238 // AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1239 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1240 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1241 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1242 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1243 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1244 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 1245 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 1246 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1247 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1248 //
whismanoid 0:cb44e2e9ec4c 1249 #include "max32630fthr.h"
whismanoid 0:cb44e2e9ec4c 1250 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
whismanoid 0:cb44e2e9ec4c 1251 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1252 // MAX32630FTHR board supports only internal VREF = 1.200V at bypass capacitor C15
whismanoid 0:cb44e2e9ec4c 1253 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 0:cb44e2e9ec4c 1254 // Arduino connector
whismanoid 0:cb44e2e9ec4c 1255 #ifndef A0
whismanoid 0:cb44e2e9ec4c 1256 #define A0 AIN_0
whismanoid 0:cb44e2e9ec4c 1257 #endif
whismanoid 0:cb44e2e9ec4c 1258 #ifndef A1
whismanoid 0:cb44e2e9ec4c 1259 #define A1 AIN_1
whismanoid 0:cb44e2e9ec4c 1260 #endif
whismanoid 0:cb44e2e9ec4c 1261 #ifndef A2
whismanoid 0:cb44e2e9ec4c 1262 #define A2 AIN_2
whismanoid 0:cb44e2e9ec4c 1263 #endif
whismanoid 0:cb44e2e9ec4c 1264 #ifndef A3
whismanoid 0:cb44e2e9ec4c 1265 #define A3 AIN_3
whismanoid 0:cb44e2e9ec4c 1266 #endif
whismanoid 0:cb44e2e9ec4c 1267 #ifndef D0
whismanoid 0:cb44e2e9ec4c 1268 #define D0 P4_0
whismanoid 0:cb44e2e9ec4c 1269 #endif
whismanoid 0:cb44e2e9ec4c 1270 #ifndef D1
whismanoid 0:cb44e2e9ec4c 1271 #define D1 P5_6
whismanoid 0:cb44e2e9ec4c 1272 #endif
whismanoid 0:cb44e2e9ec4c 1273 #ifndef D2
whismanoid 0:cb44e2e9ec4c 1274 #define D2 P5_5
whismanoid 0:cb44e2e9ec4c 1275 #endif
whismanoid 0:cb44e2e9ec4c 1276 #ifndef D3
whismanoid 0:cb44e2e9ec4c 1277 #define D3 P5_4
whismanoid 0:cb44e2e9ec4c 1278 #endif
whismanoid 0:cb44e2e9ec4c 1279 #ifndef D4
whismanoid 0:cb44e2e9ec4c 1280 #define D4 P5_3
whismanoid 0:cb44e2e9ec4c 1281 #endif
whismanoid 0:cb44e2e9ec4c 1282 #ifndef D5
whismanoid 0:cb44e2e9ec4c 1283 #define D5 P3_3
whismanoid 0:cb44e2e9ec4c 1284 #endif
whismanoid 0:cb44e2e9ec4c 1285 #ifndef D6
whismanoid 0:cb44e2e9ec4c 1286 #define D6 P3_2
whismanoid 0:cb44e2e9ec4c 1287 #endif
whismanoid 0:cb44e2e9ec4c 1288 #ifndef D7
whismanoid 0:cb44e2e9ec4c 1289 #define D7 P3_5
whismanoid 0:cb44e2e9ec4c 1290 #endif
whismanoid 0:cb44e2e9ec4c 1291 #ifndef D8
whismanoid 0:cb44e2e9ec4c 1292 #define D8 P3_4
whismanoid 0:cb44e2e9ec4c 1293 #endif
whismanoid 0:cb44e2e9ec4c 1294 #ifndef D9
whismanoid 0:cb44e2e9ec4c 1295 #define D9 P3_1
whismanoid 0:cb44e2e9ec4c 1296 #endif
whismanoid 0:cb44e2e9ec4c 1297 #ifndef D10
whismanoid 0:cb44e2e9ec4c 1298 #define D10 P3_0
whismanoid 0:cb44e2e9ec4c 1299 #endif
whismanoid 0:cb44e2e9ec4c 1300 #ifndef D11
whismanoid 0:cb44e2e9ec4c 1301 #define D11 P5_1
whismanoid 0:cb44e2e9ec4c 1302 #endif
whismanoid 0:cb44e2e9ec4c 1303 #ifndef D12
whismanoid 0:cb44e2e9ec4c 1304 #define D12 P5_2
whismanoid 0:cb44e2e9ec4c 1305 #endif
whismanoid 0:cb44e2e9ec4c 1306 #ifndef D13
whismanoid 0:cb44e2e9ec4c 1307 #define D13 P5_0
whismanoid 0:cb44e2e9ec4c 1308 #endif
whismanoid 0:cb44e2e9ec4c 1309 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1310 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 1311 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1312 // TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:cb44e2e9ec4c 1313 // +-------------------------------------+
whismanoid 0:cb44e2e9ec4c 1314 // | MAX32625MBED Arduino UNO header |
whismanoid 0:cb44e2e9ec4c 1315 // | |
whismanoid 0:cb44e2e9ec4c 1316 // | A5/SCL[ ] | P1_7 dig15
whismanoid 0:cb44e2e9ec4c 1317 // | A4/SDA[ ] | P1_6 dig14
whismanoid 0:cb44e2e9ec4c 1318 // | AREF=N/C[ ] |
whismanoid 0:cb44e2e9ec4c 1319 // | GND[ ] |
whismanoid 0:cb44e2e9ec4c 1320 // | [ ]N/C SCK/13[ ] | P1_0 dig13
whismanoid 0:cb44e2e9ec4c 1321 // | [ ]IOREF=3V3 MISO/12[ ] | P1_2 dig12
whismanoid 0:cb44e2e9ec4c 1322 // | [ ]RST MOSI/11[ ]~| P1_1 dig11
whismanoid 0:cb44e2e9ec4c 1323 // | [ ]3V3 CS/10[ ]~| P1_3 dig10
whismanoid 0:cb44e2e9ec4c 1324 // | [ ]5V0 9[ ]~| P1_5 dig9
whismanoid 0:cb44e2e9ec4c 1325 // | [ ]GND 8[ ] | P1_4 dig8
whismanoid 0:cb44e2e9ec4c 1326 // | [ ]GND |
whismanoid 0:cb44e2e9ec4c 1327 // | [ ]Vin 7[ ] | P0_7 dig7
whismanoid 0:cb44e2e9ec4c 1328 // | 6[ ]~| P0_6 dig6
whismanoid 0:cb44e2e9ec4c 1329 // AIN_0 | [ ]A0 5[ ]~| P0_5 dig5
whismanoid 0:cb44e2e9ec4c 1330 // AIN_1 | [ ]A1 4[ ] | P0_4 dig4
whismanoid 0:cb44e2e9ec4c 1331 // AIN_2 | [ ]A2 INT1/3[ ]~| P0_3 dig3
whismanoid 0:cb44e2e9ec4c 1332 // AIN_3 | [ ]A3 INT0/2[ ] | P0_2 dig2
whismanoid 0:cb44e2e9ec4c 1333 // dig16 P3_4 | [ ]A4/SDA RST SCK MISO TX>1[ ] | P0_1 dig1
whismanoid 0:cb44e2e9ec4c 1334 // dig17 P3_5 | [ ]A5/SCL [ ] [ ] [ ] RX<0[ ] | P0_0 dig0
whismanoid 0:cb44e2e9ec4c 1335 // | [ ] [ ] [ ] |
whismanoid 0:cb44e2e9ec4c 1336 // | UNO_R3 GND MOSI 5V ____________/
whismanoid 0:cb44e2e9ec4c 1337 // \_______________________/
whismanoid 0:cb44e2e9ec4c 1338 //
whismanoid 0:cb44e2e9ec4c 1339 // +------------------------+
whismanoid 0:cb44e2e9ec4c 1340 // | |
whismanoid 0:cb44e2e9ec4c 1341 // | MicroSD LED |
whismanoid 0:cb44e2e9ec4c 1342 // | SD_SCLK P2_4 r P3_0 |
whismanoid 0:cb44e2e9ec4c 1343 // | SD_MOSI P2_5 g P3_1 |
whismanoid 0:cb44e2e9ec4c 1344 // | SD_MISO P2_6 b P3_2 |
whismanoid 0:cb44e2e9ec4c 1345 // | SD_SSEL P2_7 y P3_3 |
whismanoid 0:cb44e2e9ec4c 1346 // | |
whismanoid 0:cb44e2e9ec4c 1347 // | DAPLINK BUTTONS |
whismanoid 0:cb44e2e9ec4c 1348 // | TX P2_1 SW3 P2_3 |
whismanoid 0:cb44e2e9ec4c 1349 // | RX P2_0 SW2 P2_2 |
whismanoid 0:cb44e2e9ec4c 1350 // +------------------------+
whismanoid 0:cb44e2e9ec4c 1351 //
whismanoid 0:cb44e2e9ec4c 1352 // AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1353 // AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1354 // AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1355 // AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1356 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1357 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 1358 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1359 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1360 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 1361 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 1362 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 1363 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1364 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 1365 //
whismanoid 0:cb44e2e9ec4c 1366 //#include "max32625mbed.h" // ?
whismanoid 0:cb44e2e9ec4c 1367 //MAX32625MBED mbed(MAX32625MBED::VIO_3V3); // ?
whismanoid 0:cb44e2e9ec4c 1368 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1369 // MAX32630FTHR board supports only internal VREF = 1.200V at bypass capacitor C15
whismanoid 0:cb44e2e9ec4c 1370 const float ADC_FULL_SCALE_VOLTAGE = 1.200; // TODO: ADC_FULL_SCALE_VOLTAGE Pico?
whismanoid 0:cb44e2e9ec4c 1371 // Arduino connector
whismanoid 0:cb44e2e9ec4c 1372 #ifndef A0
whismanoid 0:cb44e2e9ec4c 1373 #define A0 AIN_0
whismanoid 0:cb44e2e9ec4c 1374 #endif
whismanoid 0:cb44e2e9ec4c 1375 #ifndef A1
whismanoid 0:cb44e2e9ec4c 1376 #define A1 AIN_1
whismanoid 0:cb44e2e9ec4c 1377 #endif
whismanoid 0:cb44e2e9ec4c 1378 #ifndef A2
whismanoid 0:cb44e2e9ec4c 1379 #define A2 AIN_2
whismanoid 0:cb44e2e9ec4c 1380 #endif
whismanoid 0:cb44e2e9ec4c 1381 #ifndef A3
whismanoid 0:cb44e2e9ec4c 1382 #define A3 AIN_3
whismanoid 0:cb44e2e9ec4c 1383 #endif
whismanoid 0:cb44e2e9ec4c 1384 #ifndef D0
whismanoid 0:cb44e2e9ec4c 1385 #define D0 P0_0
whismanoid 0:cb44e2e9ec4c 1386 #endif
whismanoid 0:cb44e2e9ec4c 1387 #ifndef D1
whismanoid 0:cb44e2e9ec4c 1388 #define D1 P0_1
whismanoid 0:cb44e2e9ec4c 1389 #endif
whismanoid 0:cb44e2e9ec4c 1390 #ifndef D2
whismanoid 0:cb44e2e9ec4c 1391 #define D2 P0_2
whismanoid 0:cb44e2e9ec4c 1392 #endif
whismanoid 0:cb44e2e9ec4c 1393 #ifndef D3
whismanoid 0:cb44e2e9ec4c 1394 #define D3 P0_3
whismanoid 0:cb44e2e9ec4c 1395 #endif
whismanoid 0:cb44e2e9ec4c 1396 #ifndef D4
whismanoid 0:cb44e2e9ec4c 1397 #define D4 P0_4
whismanoid 0:cb44e2e9ec4c 1398 #endif
whismanoid 0:cb44e2e9ec4c 1399 #ifndef D5
whismanoid 0:cb44e2e9ec4c 1400 #define D5 P0_5
whismanoid 0:cb44e2e9ec4c 1401 #endif
whismanoid 0:cb44e2e9ec4c 1402 #ifndef D6
whismanoid 0:cb44e2e9ec4c 1403 #define D6 P0_6
whismanoid 0:cb44e2e9ec4c 1404 #endif
whismanoid 0:cb44e2e9ec4c 1405 #ifndef D7
whismanoid 0:cb44e2e9ec4c 1406 #define D7 P0_7
whismanoid 0:cb44e2e9ec4c 1407 #endif
whismanoid 0:cb44e2e9ec4c 1408 #ifndef D8
whismanoid 0:cb44e2e9ec4c 1409 #define D8 P1_4
whismanoid 0:cb44e2e9ec4c 1410 #endif
whismanoid 0:cb44e2e9ec4c 1411 #ifndef D9
whismanoid 0:cb44e2e9ec4c 1412 #define D9 P1_5
whismanoid 0:cb44e2e9ec4c 1413 #endif
whismanoid 0:cb44e2e9ec4c 1414 #ifndef D10
whismanoid 0:cb44e2e9ec4c 1415 #define D10 P1_3
whismanoid 0:cb44e2e9ec4c 1416 #endif
whismanoid 0:cb44e2e9ec4c 1417 #ifndef D11
whismanoid 0:cb44e2e9ec4c 1418 #define D11 P1_1
whismanoid 0:cb44e2e9ec4c 1419 #endif
whismanoid 0:cb44e2e9ec4c 1420 #ifndef D12
whismanoid 0:cb44e2e9ec4c 1421 #define D12 P1_2
whismanoid 0:cb44e2e9ec4c 1422 #endif
whismanoid 0:cb44e2e9ec4c 1423 #ifndef D13
whismanoid 0:cb44e2e9ec4c 1424 #define D13 P1_0
whismanoid 0:cb44e2e9ec4c 1425 #endif
whismanoid 0:cb44e2e9ec4c 1426 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1427 #elif defined(TARGET_MAX32600)
whismanoid 0:cb44e2e9ec4c 1428 // target MAX32600
whismanoid 0:cb44e2e9ec4c 1429 //
whismanoid 0:cb44e2e9ec4c 1430 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:cb44e2e9ec4c 1431 const float ADC_FULL_SCALE_VOLTAGE = 1.500;
whismanoid 0:cb44e2e9ec4c 1432 //
whismanoid 0:cb44e2e9ec4c 1433 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1434 #elif defined(TARGET_MAX32620FTHR)
whismanoid 0:cb44e2e9ec4c 1435 #warning "TARGET_MAX32620FTHR not previously tested; need to define pins..."
whismanoid 0:cb44e2e9ec4c 1436 #include "MAX32620FTHR.h"
whismanoid 0:cb44e2e9ec4c 1437 // Initialize I/O voltages on MAX32620FTHR board
whismanoid 0:cb44e2e9ec4c 1438 MAX32620FTHR fthr(MAX32620FTHR::VIO_3V3);
whismanoid 0:cb44e2e9ec4c 1439 //#define USE_LEDS 0 ?
whismanoid 0:cb44e2e9ec4c 1440 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 0:cb44e2e9ec4c 1441 #warning "TARGET_MAX32620FTHR not previously tested; need to verify ADC_FULL_SCALE_VOLTAGE..."
whismanoid 0:cb44e2e9ec4c 1442 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 0:cb44e2e9ec4c 1443 //
whismanoid 0:cb44e2e9ec4c 1444 //--------------------------------------------------
whismanoid 19:5ff09c8e9daf 1445 #elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 15:37c83ec50ea0 1446 // #warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
whismanoid 0:cb44e2e9ec4c 1447 #include "max32625pico.h"
whismanoid 0:cb44e2e9ec4c 1448 // configure MAX32625PICO VDDIOH mode, and I/O voltages for DIP pins and SWD pins
whismanoid 0:cb44e2e9ec4c 1449 MAX32625PICO pico(
whismanoid 13:184a08909405 1450 // Select source of higher-voltage logic high supply VDDIOH
whismanoid 0:cb44e2e9ec4c 1451 // vddioh_mode_t iohMode
whismanoid 0:cb44e2e9ec4c 1452 //~ MAX32625PICO::IOH_OFF, // No connections to VDDIOH
whismanoid 0:cb44e2e9ec4c 1453 //~ MAX32625PICO::IOH_DIP_IN, // VDDIOH input from DIP pin 1 (AIN0)
whismanoid 0:cb44e2e9ec4c 1454 //~ MAX32625PICO::IOH_SWD_IN, // VDDIOH input from SWD pin 1
whismanoid 0:cb44e2e9ec4c 1455 MAX32625PICO::IOH_3V3, // VDDIOH = 3.3V from local supply
whismanoid 0:cb44e2e9ec4c 1456 //~ MAX32625PICO::IOH_DIP_OUT, // VDDIOH = 3.3V output to DIP pin 1
whismanoid 0:cb44e2e9ec4c 1457 //~ MAX32625PICO::IOH_SWD_OUT, // VDDIOH = 3.3V output to SWD pin 1
whismanoid 0:cb44e2e9ec4c 1458 //
whismanoid 13:184a08909405 1459 // Digital I/O pin logic high voltage 1.8V or 3.3V
whismanoid 0:cb44e2e9ec4c 1460 // vio_t dipVio = MAX32625PICO::VIO_1V8 or MAX32625PICO::VIO_IOH
whismanoid 13:184a08909405 1461 MAX32625PICO::VIO_1V8, // 1.8V IO (local)
whismanoid 13:184a08909405 1462 //~ MAX32625PICO::VIO_IOH, // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V)
whismanoid 0:cb44e2e9ec4c 1463 //
whismanoid 13:184a08909405 1464 // Software Debug logic high voltage (normally use VIO_IOH)
whismanoid 0:cb44e2e9ec4c 1465 // vio_t swdVio
whismanoid 0:cb44e2e9ec4c 1466 //~ MAX32625PICO::VIO_1V8 // 1.8V IO (local)
whismanoid 0:cb44e2e9ec4c 1467 MAX32625PICO::VIO_IOH // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V)
whismanoid 0:cb44e2e9ec4c 1468 );
whismanoid 0:cb44e2e9ec4c 1469 //#define USE_LEDS 0 ?
whismanoid 0:cb44e2e9ec4c 1470 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
whismanoid 15:37c83ec50ea0 1471 // #warning "TARGET_MAX32625PICO not previously tested; need to verify ADC_FULL_SCALE_VOLTAGE..."
whismanoid 0:cb44e2e9ec4c 1472 const float ADC_FULL_SCALE_VOLTAGE = 1.200;
whismanoid 0:cb44e2e9ec4c 1473 //
whismanoid 0:cb44e2e9ec4c 1474 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1475 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 1476 // TODO1: target NUCLEO_F446RE
whismanoid 0:cb44e2e9ec4c 1477 //
whismanoid 0:cb44e2e9ec4c 1478 // USER_BUTTON PC13
whismanoid 0:cb44e2e9ec4c 1479 // LED1 is shared with SPI_SCK on NUCLEO_F446RE PA_5, so don't use LED1.
whismanoid 0:cb44e2e9ec4c 1480 #define USE_LEDS 0
whismanoid 0:cb44e2e9ec4c 1481 // SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK);
whismanoid 0:cb44e2e9ec4c 1482 // Serial serial(SERIAL_TX, SERIAL_RX);
whismanoid 0:cb44e2e9ec4c 1483 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:cb44e2e9ec4c 1484 const float ADC_FULL_SCALE_VOLTAGE = 3.300; // TODO: ADC_FULL_SCALE_VOLTAGE Pico?
whismanoid 0:cb44e2e9ec4c 1485 //
whismanoid 0:cb44e2e9ec4c 1486 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1487 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 1488 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1489 // TARGET=LPC1768 ARM Cortex-M3 100 MHz 512kB flash 64kB SRAM
whismanoid 0:cb44e2e9ec4c 1490 // +-------------[microUSB]-------------+
whismanoid 0:cb44e2e9ec4c 1491 // ______ | [ ] GND +3.3V VOUT [ ] | ______
whismanoid 0:cb44e2e9ec4c 1492 // ______ | [ ] 4.5V<VIN<9.0V +5.0V VU [ ] | ______
whismanoid 0:cb44e2e9ec4c 1493 // ______ | [ ] VB USB.IF- [ ] | ______
whismanoid 0:cb44e2e9ec4c 1494 // ______ | [ ] nR USB.IF+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 1495 // digitalInOut0 | [ ] p5 MOSI ETHERNET.RD- [ ] | ______
whismanoid 0:cb44e2e9ec4c 1496 // digitalInOut1 | [ ] p6 MISO ETHERNET.RD+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 1497 // digitalInOut2 | [ ] p7 SCLK ETHERNET.TD- [ ] | ______
whismanoid 0:cb44e2e9ec4c 1498 // digitalInOut3 | [ ] p8 ETHERNET.TD+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 1499 // digitalInOut4 | [ ] p9 TX SDA USB.D- [ ] | ______
whismanoid 0:cb44e2e9ec4c 1500 // digitalInOut5 | [ ] p10 RX SCL USB.D+ [ ] | ______
whismanoid 0:cb44e2e9ec4c 1501 // digitalInOut6 | [ ] p11 MOSI CAN-RD p30 [ ] | digitalInOut13
whismanoid 0:cb44e2e9ec4c 1502 // digitalInOut7 | [ ] p12 MISO CAN-TD p29 [ ] | digitalInOut12
whismanoid 0:cb44e2e9ec4c 1503 // digitalInOut8 | [ ] p13 TX SCLK SDA TX p28 [ ] | digitalInOut11
whismanoid 0:cb44e2e9ec4c 1504 // digitalInOut9 | [ ] p14 RX SCL RX p27 [ ] | digitalInOut10
whismanoid 0:cb44e2e9ec4c 1505 // analogIn0 | [ ] p15 AIN0 3.3Vfs PWM1 p26 [ ] | pwmDriver1
whismanoid 0:cb44e2e9ec4c 1506 // analogIn1 | [ ] p16 AIN1 3.3Vfs PWM2 p25 [ ] | pwmDriver2
whismanoid 0:cb44e2e9ec4c 1507 // analogIn2 | [ ] p17 AIN2 3.3Vfs PWM3 p24 [ ] | pwmDriver3
whismanoid 0:cb44e2e9ec4c 1508 // analogIn3 | [ ] p18 AIN3 AOUT PWM4 p23 [ ] | pwmDriver4
whismanoid 0:cb44e2e9ec4c 1509 // analogIn4 | [ ] p19 AIN4 3.3Vfs PWM5 p22 [ ] | pwmDriver5
whismanoid 0:cb44e2e9ec4c 1510 // analogIn5 | [ ] p20 AIN5 3.3Vfs PWM6 p21 [ ] | pwmDriver6
whismanoid 0:cb44e2e9ec4c 1511 // +------------------------------------+
whismanoid 0:cb44e2e9ec4c 1512 // AIN6 = P0.3 = TGT_SBL_RXD?
whismanoid 0:cb44e2e9ec4c 1513 // AIN7 = P0.2 = TGT_SBL_TXD?
whismanoid 0:cb44e2e9ec4c 1514 //
whismanoid 0:cb44e2e9ec4c 1515 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1516 // LPC1768 board uses VREF = 3.300V +A3,3V thru L1 to bypass capacitor C14
whismanoid 0:cb44e2e9ec4c 1517 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 0
whismanoid 0:cb44e2e9ec4c 1518 const float ADC_FULL_SCALE_VOLTAGE = 3.300;
whismanoid 0:cb44e2e9ec4c 1519 #else // not defined(TARGET_LPC1768 etc.)
whismanoid 0:cb44e2e9ec4c 1520 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1521 // unknown target
whismanoid 0:cb44e2e9ec4c 1522 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1523 #endif // target definition
whismanoid 0:cb44e2e9ec4c 1524
whismanoid 0:cb44e2e9ec4c 1525
whismanoid 0:cb44e2e9ec4c 1526
whismanoid 0:cb44e2e9ec4c 1527
whismanoid 18:1235c17b451e 1528 // support LEDs as digital pins 91 92 93; WIP button as digital pin 90
whismanoid 18:1235c17b451e 1529 // move definiton of USE_LEDS earlier than find_digitalInOutPin()
whismanoid 18:1235c17b451e 1530 //--------------------------------------------------
whismanoid 18:1235c17b451e 1531 // Option to use LEDs to show status
whismanoid 18:1235c17b451e 1532 #ifndef USE_LEDS
whismanoid 18:1235c17b451e 1533 #define USE_LEDS 1
whismanoid 18:1235c17b451e 1534 #endif
whismanoid 18:1235c17b451e 1535 #if USE_LEDS
whismanoid 18:1235c17b451e 1536 #if defined(TARGET_MAX32630)
whismanoid 18:1235c17b451e 1537 # define LED_ON 0
whismanoid 18:1235c17b451e 1538 # define LED_OFF 1
whismanoid 18:1235c17b451e 1539 //--------------------------------------------------
whismanoid 18:1235c17b451e 1540 #elif defined(TARGET_MAX32625MBED)
whismanoid 18:1235c17b451e 1541 # define LED_ON 0
whismanoid 18:1235c17b451e 1542 # define LED_OFF 1
whismanoid 19:5ff09c8e9daf 1543 #elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 18:1235c17b451e 1544 # define LED_ON 0
whismanoid 18:1235c17b451e 1545 # define LED_OFF 1
whismanoid 18:1235c17b451e 1546 //--------------------------------------------------
whismanoid 18:1235c17b451e 1547 // TODO1: TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 18:1235c17b451e 1548 #elif defined(TARGET_LPC1768)
whismanoid 18:1235c17b451e 1549 # define LED_ON 1
whismanoid 18:1235c17b451e 1550 # define LED_OFF 0
whismanoid 18:1235c17b451e 1551 #else // not defined(TARGET_LPC1768 etc.)
whismanoid 18:1235c17b451e 1552 // USE_LEDS with some platform other than MAX32630, MAX32625MBED, LPC1768
whismanoid 18:1235c17b451e 1553 // bugfix for MAX32600MBED LED blink pattern: check if LED_ON/LED_OFF already defined
whismanoid 18:1235c17b451e 1554 # ifndef LED_ON
whismanoid 18:1235c17b451e 1555 # define LED_ON 0
whismanoid 18:1235c17b451e 1556 # endif
whismanoid 18:1235c17b451e 1557 # ifndef LED_OFF
whismanoid 18:1235c17b451e 1558 # define LED_OFF 1
whismanoid 18:1235c17b451e 1559 # endif
whismanoid 18:1235c17b451e 1560 //# define LED_ON 1
whismanoid 18:1235c17b451e 1561 //# define LED_OFF 0
whismanoid 18:1235c17b451e 1562 #endif // target definition
whismanoid 18:1235c17b451e 1563 // support LEDs as digital pins 91 92 93; WIP button as digital pin 90
whismanoid 18:1235c17b451e 1564 // support find_digitalInOutPin(91) return DigitalInOut of led1_RFailLED
whismanoid 18:1235c17b451e 1565 // support find_digitalInOutPin(92) return DigitalInOut of led2_GPassLED
whismanoid 18:1235c17b451e 1566 // support find_digitalInOutPin(93) return DigitalInOut of led3_BBusyLED
whismanoid 18:1235c17b451e 1567 // change led1/2/3/4 from DigitalOut to DigitalInOut
whismanoid 18:1235c17b451e 1568 DigitalInOut led1(LED1, PIN_INPUT, PullUp, LED_OFF); // MAX32630FTHR: LED1 = LED_RED
whismanoid 18:1235c17b451e 1569 DigitalInOut led2(LED2, PIN_INPUT, PullUp, LED_OFF); // MAX32630FTHR: LED2 = LED_GREEN
whismanoid 18:1235c17b451e 1570 DigitalInOut led3(LED3, PIN_INPUT, PullUp, LED_OFF); // MAX32630FTHR: LED3 = LED_BLUE
whismanoid 18:1235c17b451e 1571 DigitalInOut led4(LED4, PIN_INPUT, PullUp, LED_OFF);
whismanoid 18:1235c17b451e 1572 #else // USE_LEDS=0
whismanoid 18:1235c17b451e 1573 // issue #41 support Nucleo_F446RE
whismanoid 18:1235c17b451e 1574 // there are no LED indicators on the board, LED1 interferes with SPI;
whismanoid 18:1235c17b451e 1575 // but we still need placeholders led1 led2 led3 led4.
whismanoid 18:1235c17b451e 1576 // Declare DigitalInOut led1 led2 led3 led4 targeting safe pins.
whismanoid 18:1235c17b451e 1577 // PinName NC means NOT_CONNECTED; DigitalOut::is_connected() returns false
whismanoid 18:1235c17b451e 1578 # define LED_ON 0
whismanoid 18:1235c17b451e 1579 # define LED_OFF 1
whismanoid 18:1235c17b451e 1580 // change led1/2/3/4 from DigitalOut to DigitalInOut
whismanoid 18:1235c17b451e 1581 DigitalInOut led1(NC, PIN_INPUT, PullUp, LED_OFF);
whismanoid 18:1235c17b451e 1582 DigitalInOut led2(NC, PIN_INPUT, PullUp, LED_OFF);
whismanoid 18:1235c17b451e 1583 DigitalInOut led3(NC, PIN_INPUT, PullUp, LED_OFF);
whismanoid 18:1235c17b451e 1584 DigitalInOut led4(NC, PIN_INPUT, PullUp, LED_OFF);
whismanoid 18:1235c17b451e 1585 #endif // USE_LEDS
whismanoid 18:1235c17b451e 1586 #define led1_RFailLED led1
whismanoid 18:1235c17b451e 1587 #define led2_GPassLED led2
whismanoid 18:1235c17b451e 1588 #define led3_BBusyLED led3
whismanoid 18:1235c17b451e 1589
whismanoid 21:ac062a97a71d 1590 //--------------------------------------------------
whismanoid 21:ac062a97a71d 1591 // use BUTTON1 trigger some action
whismanoid 46:469d0061df5d 1592 // support for commands %B1! .. %B9!
whismanoid 21:ac062a97a71d 1593 #if defined(TARGET_MAX32630)
whismanoid 21:ac062a97a71d 1594 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 21:ac062a97a71d 1595 #define HAS_BUTTON2_DEMO 0
whismanoid 21:ac062a97a71d 1596 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 21:ac062a97a71d 1597 #elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 25:8a61cb34191d 1598 // #warning "TARGET_MAX32625PICO not previously tested; need to define buttons..."
whismanoid 21:ac062a97a71d 1599 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 24:032f3683cb2a 1600 #if MAX40108_DEMO
whismanoid 25:8a61cb34191d 1601 #if HAS_I2C
whismanoid 25:8a61cb34191d 1602 // MAX40108DEMOP2U9 HAS_I2C: J91.1=1V8 J91.2=P1_6(SDA) J91.3=P1_7(SCL) J91.4=GND
whismanoid 25:8a61cb34191d 1603 // MAX40108DEMOP2U9 HAS_I2C: move button2/button3 to inaccessible pins P3_6 and P3_7 if we need J91 for I2C
whismanoid 24:032f3683cb2a 1604 #define BUTTON2 P3_7
whismanoid 25:8a61cb34191d 1605 #else // HAS_I2C
whismanoid 25:8a61cb34191d 1606 // MAX40108DEMOP2U9 no HAS_I2C: option using J91 for button2 and button3 instead of I2C
whismanoid 25:8a61cb34191d 1607 // 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 1608 // MAX40108DEMOP2U9 no HAS_I2C: avoid conflict between digital pins D16 D17 and button2/button3
whismanoid 25:8a61cb34191d 1609 #define BUTTON2 P1_7
whismanoid 25:8a61cb34191d 1610 #endif // HAS_I2C
whismanoid 24:032f3683cb2a 1611 #define HAS_BUTTON2_DEMO 0
whismanoid 24:032f3683cb2a 1612 #define HAS_BUTTON2_DEMO_INTERRUPT 1
whismanoid 25:8a61cb34191d 1613 #if HAS_I2C
whismanoid 25:8a61cb34191d 1614 // MAX40108DEMOP2U9 HAS_I2C: J91.1=1V8 J91.2=P1_6(SDA) J91.3=P1_7(SCL) J91.4=GND
whismanoid 25:8a61cb34191d 1615 // MAX40108DEMOP2U9 HAS_I2C: move button2/button3 to inaccessible pins P3_6 and P3_7 if we need J91 for I2C
whismanoid 24:032f3683cb2a 1616 #define BUTTON3 P3_6
whismanoid 25:8a61cb34191d 1617 #else // HAS_I2C
whismanoid 25:8a61cb34191d 1618 // MAX40108DEMOP2U9 no HAS_I2C: option using J91 for button2 and button3 instead of I2C
whismanoid 25:8a61cb34191d 1619 // 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 1620 // MAX40108DEMOP2U9 no HAS_I2C: avoid conflict between digital pins D16 D17 and button2/button3
whismanoid 25:8a61cb34191d 1621 #define BUTTON3 P1_6
whismanoid 25:8a61cb34191d 1622 #endif // HAS_I2C
whismanoid 24:032f3683cb2a 1623 #define HAS_BUTTON3_DEMO 0
whismanoid 24:032f3683cb2a 1624 #define HAS_BUTTON3_DEMO_INTERRUPT 1
whismanoid 29:6a9edb6e973b 1625 // additional buttons are assigned to unused/unaccessible pins to avoid conflicts
whismanoid 29:6a9edb6e973b 1626 // activate using %B4! or action_button pin=4
whismanoid 29:6a9edb6e973b 1627 #define BUTTON4 P1_5
whismanoid 29:6a9edb6e973b 1628 #define HAS_BUTTON4_DEMO_INTERRUPT 1
whismanoid 29:6a9edb6e973b 1629 #define BUTTON5 P1_4
whismanoid 29:6a9edb6e973b 1630 #define HAS_BUTTON5_DEMO_INTERRUPT 1
whismanoid 29:6a9edb6e973b 1631 #define BUTTON6 P1_3
whismanoid 29:6a9edb6e973b 1632 #define HAS_BUTTON6_DEMO_INTERRUPT 1
whismanoid 29:6a9edb6e973b 1633 #define BUTTON7 P1_2
whismanoid 29:6a9edb6e973b 1634 #define HAS_BUTTON7_DEMO_INTERRUPT 1
whismanoid 29:6a9edb6e973b 1635 #define BUTTON8 P1_1
whismanoid 29:6a9edb6e973b 1636 #define HAS_BUTTON8_DEMO_INTERRUPT 1
whismanoid 29:6a9edb6e973b 1637 #define BUTTON9 P1_0
whismanoid 29:6a9edb6e973b 1638 #define HAS_BUTTON9_DEMO_INTERRUPT 1
whismanoid 24:032f3683cb2a 1639 #else // MAX40108_DEMO
whismanoid 21:ac062a97a71d 1640 #define HAS_BUTTON2_DEMO 0
whismanoid 21:ac062a97a71d 1641 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 29:6a9edb6e973b 1642 #endif // MAX40108_DEMO ---------------------------------
whismanoid 21:ac062a97a71d 1643 #elif defined(TARGET_MAX32625)
whismanoid 21:ac062a97a71d 1644 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 21:ac062a97a71d 1645 #define HAS_BUTTON2_DEMO_INTERRUPT 1
whismanoid 21:ac062a97a71d 1646 #elif defined(TARGET_MAX32620FTHR)
whismanoid 21:ac062a97a71d 1647 #warning "TARGET_MAX32620FTHR not previously tested; need to define buttons..."
whismanoid 21:ac062a97a71d 1648 #define BUTTON1 SW1
whismanoid 21:ac062a97a71d 1649 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 21:ac062a97a71d 1650 #define HAS_BUTTON2_DEMO 0
whismanoid 21:ac062a97a71d 1651 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 21:ac062a97a71d 1652 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 21:ac062a97a71d 1653 #define HAS_BUTTON1_DEMO_INTERRUPT 0
whismanoid 21:ac062a97a71d 1654 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 21:ac062a97a71d 1655 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 21:ac062a97a71d 1656 #define HAS_BUTTON1_DEMO_INTERRUPT 0
whismanoid 21:ac062a97a71d 1657 #define HAS_BUTTON2_DEMO_INTERRUPT 0
whismanoid 21:ac062a97a71d 1658 #else
whismanoid 21:ac062a97a71d 1659 #warning "target not previously tested; need to define buttons..."
whismanoid 21:ac062a97a71d 1660 #endif
whismanoid 21:ac062a97a71d 1661 //
whismanoid 21:ac062a97a71d 1662 #ifndef HAS_BUTTON1_DEMO
whismanoid 21:ac062a97a71d 1663 #define HAS_BUTTON1_DEMO 0
whismanoid 21:ac062a97a71d 1664 #endif
whismanoid 21:ac062a97a71d 1665 #ifndef HAS_BUTTON2_DEMO
whismanoid 21:ac062a97a71d 1666 #define HAS_BUTTON2_DEMO 0
whismanoid 21:ac062a97a71d 1667 #endif
whismanoid 24:032f3683cb2a 1668 #ifndef HAS_BUTTON3_DEMO
whismanoid 24:032f3683cb2a 1669 #define HAS_BUTTON3_DEMO 0
whismanoid 24:032f3683cb2a 1670 #endif
whismanoid 21:ac062a97a71d 1671 //
whismanoid 21:ac062a97a71d 1672 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 21:ac062a97a71d 1673 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 21:ac062a97a71d 1674 #ifndef HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 21:ac062a97a71d 1675 #define HAS_BUTTON1_DEMO_INTERRUPT_POLLING 1
whismanoid 21:ac062a97a71d 1676 #endif
whismanoid 21:ac062a97a71d 1677 //
whismanoid 21:ac062a97a71d 1678 #ifndef HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 1679 #define HAS_BUTTON1_DEMO_INTERRUPT 1
whismanoid 21:ac062a97a71d 1680 #endif
whismanoid 21:ac062a97a71d 1681 #ifndef HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 1682 #define HAS_BUTTON2_DEMO_INTERRUPT 1
whismanoid 21:ac062a97a71d 1683 #endif
whismanoid 21:ac062a97a71d 1684 //
whismanoid 21:ac062a97a71d 1685 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 1686 # if HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 21:ac062a97a71d 1687 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 21:ac062a97a71d 1688 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 21:ac062a97a71d 1689 DigitalIn button1(BUTTON1);
whismanoid 21:ac062a97a71d 1690 # else
whismanoid 21:ac062a97a71d 1691 InterruptIn button1(BUTTON1);
whismanoid 21:ac062a97a71d 1692 # endif
whismanoid 21:ac062a97a71d 1693 #elif HAS_BUTTON1_DEMO
whismanoid 21:ac062a97a71d 1694 DigitalIn button1(BUTTON1);
whismanoid 21:ac062a97a71d 1695 #endif
whismanoid 21:ac062a97a71d 1696 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 1697 # if HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 21:ac062a97a71d 1698 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 21:ac062a97a71d 1699 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 21:ac062a97a71d 1700 DigitalIn button2(BUTTON2);
whismanoid 21:ac062a97a71d 1701 # else
whismanoid 21:ac062a97a71d 1702 InterruptIn button2(BUTTON2);
whismanoid 21:ac062a97a71d 1703 # endif
whismanoid 21:ac062a97a71d 1704 #elif HAS_BUTTON2_DEMO
whismanoid 21:ac062a97a71d 1705 DigitalIn button2(BUTTON2);
whismanoid 21:ac062a97a71d 1706 #endif
whismanoid 24:032f3683cb2a 1707 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 1708 # if HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 24:032f3683cb2a 1709 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 24:032f3683cb2a 1710 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 24:032f3683cb2a 1711 DigitalIn button3(BUTTON3);
whismanoid 24:032f3683cb2a 1712 # else
whismanoid 24:032f3683cb2a 1713 InterruptIn button3(BUTTON3);
whismanoid 24:032f3683cb2a 1714 # endif
whismanoid 24:032f3683cb2a 1715 #elif HAS_BUTTON3_DEMO
whismanoid 24:032f3683cb2a 1716 DigitalIn button3(BUTTON3);
whismanoid 24:032f3683cb2a 1717 #endif
whismanoid 21:ac062a97a71d 1718
whismanoid 0:cb44e2e9ec4c 1719 // uncrustify-0.66.1 *INDENT-OFF*
whismanoid 0:cb44e2e9ec4c 1720 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1721 // Declare the DigitalInOut GPIO pins
whismanoid 0:cb44e2e9ec4c 1722 // Optional digitalInOut support. If there is only one it should be digitalInOut1.
whismanoid 0:cb44e2e9ec4c 1723 // D) Digital High/Low/Input Pin
whismanoid 0:cb44e2e9ec4c 1724 #if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 1725 // +-------------[microUSB]-------------+
whismanoid 0:cb44e2e9ec4c 1726 // | J1 MAX32630FTHR J2 |
whismanoid 0:cb44e2e9ec4c 1727 // | [ ] RST GND [ ] |
whismanoid 0:cb44e2e9ec4c 1728 // | [ ] 3V3 BAT+[ ] |
whismanoid 0:cb44e2e9ec4c 1729 // | [ ] 1V8 reset SW1 |
whismanoid 0:cb44e2e9ec4c 1730 // | [ ] GND J4 J3 |
whismanoid 0:cb44e2e9ec4c 1731 // | [ ] AIN_0 1.2Vfs (bat) SYS [ ] |
whismanoid 0:cb44e2e9ec4c 1732 // | [ ] AIN_1 1.2Vfs PWR [ ] |
whismanoid 0:cb44e2e9ec4c 1733 // | [ ] AIN_2 1.2Vfs +5V VBUS [ ] |
whismanoid 0:cb44e2e9ec4c 1734 // | [ ] AIN_3 1.2Vfs 1-WIRE P4_0 [ ] | dig9
whismanoid 0:cb44e2e9ec4c 1735 // dig10 | [x] P5_7 SDA2 SRN P5_6 [ ] | dig8
whismanoid 0:cb44e2e9ec4c 1736 // dig11 | [x] P6_0 SCL2 SDIO3 P5_5 [ ] | dig7
whismanoid 0:cb44e2e9ec4c 1737 // dig12 | [x] P5_0 SCLK SDIO2 P5_4 [ ] | dig6
whismanoid 0:cb44e2e9ec4c 1738 // dig13 | [x] P5_1 MOSI SSEL P5_3 [x] | dig5
whismanoid 0:cb44e2e9ec4c 1739 // dig14 | [ ] P5_2 MISO RTS P3_3 [ ] | dig4
whismanoid 0:cb44e2e9ec4c 1740 // dig15 | [ ] P3_0 RX CTS P3_2 [ ] | dig3
whismanoid 0:cb44e2e9ec4c 1741 // dig0 | [ ] P3_1 TX SCL P3_5 [x] | dig2
whismanoid 0:cb44e2e9ec4c 1742 // | [ ] GND SDA P3_4 [x] | dig1
whismanoid 0:cb44e2e9ec4c 1743 // +------------------------------------+
whismanoid 0:cb44e2e9ec4c 1744 #define HAS_digitalInOut0 1 // P3_1 TARGET_MAX32630 J1.15
whismanoid 0:cb44e2e9ec4c 1745 #define HAS_digitalInOut1 1 // P3_4 TARGET_MAX32630 J3.12
whismanoid 0:cb44e2e9ec4c 1746 #define HAS_digitalInOut2 1 // P3_5 TARGET_MAX32630 J3.11
whismanoid 0:cb44e2e9ec4c 1747 #define HAS_digitalInOut3 1 // P3_2 TARGET_MAX32630 J3.10
whismanoid 0:cb44e2e9ec4c 1748 #define HAS_digitalInOut4 1 // P3_3 TARGET_MAX32630 J3.9
whismanoid 0:cb44e2e9ec4c 1749 #define HAS_digitalInOut5 1 // P5_3 TARGET_MAX32630 J3.8
whismanoid 0:cb44e2e9ec4c 1750 #define HAS_digitalInOut6 1 // P5_4 TARGET_MAX32630 J3.7
whismanoid 0:cb44e2e9ec4c 1751 #define HAS_digitalInOut7 1 // P5_5 TARGET_MAX32630 J3.6
whismanoid 0:cb44e2e9ec4c 1752 #define HAS_digitalInOut8 1 // P5_6 TARGET_MAX32630 J3.5
whismanoid 0:cb44e2e9ec4c 1753 #define HAS_digitalInOut9 1 // P4_0 TARGET_MAX32630 J3.4
whismanoid 0:cb44e2e9ec4c 1754 #if HAS_I2C
whismanoid 0:cb44e2e9ec4c 1755 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:cb44e2e9ec4c 1756 #define HAS_digitalInOut10 0 // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:cb44e2e9ec4c 1757 #define HAS_digitalInOut11 0 // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:cb44e2e9ec4c 1758 #else // HAS_I2C
whismanoid 0:cb44e2e9ec4c 1759 #define HAS_digitalInOut10 1 // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:cb44e2e9ec4c 1760 #define HAS_digitalInOut11 1 // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:cb44e2e9ec4c 1761 #endif // HAS_I2C
whismanoid 0:cb44e2e9ec4c 1762 #if HAS_SPI
whismanoid 0:cb44e2e9ec4c 1763 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 1764 #define HAS_digitalInOut12 0 // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:cb44e2e9ec4c 1765 #define HAS_digitalInOut13 0 // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:cb44e2e9ec4c 1766 #define HAS_digitalInOut14 0 // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:cb44e2e9ec4c 1767 #define HAS_digitalInOut15 0 // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:cb44e2e9ec4c 1768 #else // HAS_SPI
whismanoid 0:cb44e2e9ec4c 1769 #define HAS_digitalInOut12 1 // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:cb44e2e9ec4c 1770 #define HAS_digitalInOut13 1 // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:cb44e2e9ec4c 1771 #define HAS_digitalInOut14 1 // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:cb44e2e9ec4c 1772 #define HAS_digitalInOut15 1 // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:cb44e2e9ec4c 1773 #endif // HAS_SPI
whismanoid 0:cb44e2e9ec4c 1774 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 1775 DigitalInOut digitalInOut0(P3_1, PIN_INPUT, PullUp, 1); // P3_1 TARGET_MAX32630 J1.15
whismanoid 0:cb44e2e9ec4c 1776 #endif
whismanoid 0:cb44e2e9ec4c 1777 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 1778 DigitalInOut digitalInOut1(P3_4, PIN_INPUT, PullUp, 1); // P3_4 TARGET_MAX32630 J3.12
whismanoid 0:cb44e2e9ec4c 1779 #endif
whismanoid 0:cb44e2e9ec4c 1780 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 1781 DigitalInOut digitalInOut2(P3_5, PIN_INPUT, PullUp, 1); // P3_5 TARGET_MAX32630 J3.11
whismanoid 0:cb44e2e9ec4c 1782 #endif
whismanoid 0:cb44e2e9ec4c 1783 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 1784 DigitalInOut digitalInOut3(P3_2, PIN_INPUT, PullUp, 1); // P3_2 TARGET_MAX32630 J3.10
whismanoid 0:cb44e2e9ec4c 1785 #endif
whismanoid 0:cb44e2e9ec4c 1786 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 1787 DigitalInOut digitalInOut4(P3_3, PIN_INPUT, PullUp, 1); // P3_3 TARGET_MAX32630 J3.9
whismanoid 0:cb44e2e9ec4c 1788 #endif
whismanoid 0:cb44e2e9ec4c 1789 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 1790 DigitalInOut digitalInOut5(P5_3, PIN_INPUT, PullUp, 1); // P5_3 TARGET_MAX32630 J3.8
whismanoid 0:cb44e2e9ec4c 1791 #endif
whismanoid 0:cb44e2e9ec4c 1792 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 1793 DigitalInOut digitalInOut6(P5_4, PIN_INPUT, PullUp, 1); // P5_4 TARGET_MAX32630 J3.7
whismanoid 0:cb44e2e9ec4c 1794 #endif
whismanoid 0:cb44e2e9ec4c 1795 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 1796 DigitalInOut digitalInOut7(P5_5, PIN_INPUT, PullUp, 1); // P5_5 TARGET_MAX32630 J3.6
whismanoid 0:cb44e2e9ec4c 1797 #endif
whismanoid 0:cb44e2e9ec4c 1798 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 1799 DigitalInOut digitalInOut8(P5_6, PIN_INPUT, PullUp, 1); // P5_6 TARGET_MAX32630 J3.5
whismanoid 0:cb44e2e9ec4c 1800 #endif
whismanoid 0:cb44e2e9ec4c 1801 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 1802 DigitalInOut digitalInOut9(P4_0, PIN_INPUT, PullUp, 1); // P4_0 TARGET_MAX32630 J3.4
whismanoid 0:cb44e2e9ec4c 1803 #endif
whismanoid 0:cb44e2e9ec4c 1804 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 1805 DigitalInOut digitalInOut10(P5_7, PIN_INPUT, PullUp, 1); // P5_7 TARGET_MAX32630 J1.9
whismanoid 0:cb44e2e9ec4c 1806 #endif
whismanoid 0:cb44e2e9ec4c 1807 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 1808 DigitalInOut digitalInOut11(P6_0, PIN_INPUT, PullUp, 1); // P6_0 TARGET_MAX32630 J1.10
whismanoid 0:cb44e2e9ec4c 1809 #endif
whismanoid 0:cb44e2e9ec4c 1810 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 1811 DigitalInOut digitalInOut12(P5_0, PIN_INPUT, PullUp, 1); // P5_0 TARGET_MAX32630 J1.11
whismanoid 0:cb44e2e9ec4c 1812 #endif
whismanoid 0:cb44e2e9ec4c 1813 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 1814 DigitalInOut digitalInOut13(P5_1, PIN_INPUT, PullUp, 1); // P5_1 TARGET_MAX32630 J1.12
whismanoid 0:cb44e2e9ec4c 1815 #endif
whismanoid 0:cb44e2e9ec4c 1816 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 1817 DigitalInOut digitalInOut14(P5_2, PIN_INPUT, PullUp, 1); // P5_2 TARGET_MAX32630 J1.13
whismanoid 0:cb44e2e9ec4c 1818 #endif
whismanoid 0:cb44e2e9ec4c 1819 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 1820 DigitalInOut digitalInOut15(P3_0, PIN_INPUT, PullUp, 1); // P3_0 TARGET_MAX32630 J1.14
whismanoid 0:cb44e2e9ec4c 1821 #endif
whismanoid 0:cb44e2e9ec4c 1822 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 1823 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 1824 // TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:cb44e2e9ec4c 1825 // +-------------------------------------+
whismanoid 0:cb44e2e9ec4c 1826 // | MAX32625MBED Arduino UNO header |
whismanoid 0:cb44e2e9ec4c 1827 // | |
whismanoid 0:cb44e2e9ec4c 1828 // | A5/SCL[ ] | P1_7 dig15
whismanoid 0:cb44e2e9ec4c 1829 // | A4/SDA[ ] | P1_6 dig14
whismanoid 0:cb44e2e9ec4c 1830 // | AREF=N/C[ ] |
whismanoid 0:cb44e2e9ec4c 1831 // | GND[ ] |
whismanoid 0:cb44e2e9ec4c 1832 // | [ ]N/C SCK/13[ ] | P1_0 dig13
whismanoid 0:cb44e2e9ec4c 1833 // | [ ]IOREF=3V3 MISO/12[ ] | P1_2 dig12
whismanoid 0:cb44e2e9ec4c 1834 // | [ ]RST MOSI/11[ ]~| P1_1 dig11
whismanoid 0:cb44e2e9ec4c 1835 // | [ ]3V3 CS/10[ ]~| P1_3 dig10
whismanoid 0:cb44e2e9ec4c 1836 // | [ ]5V0 9[ ]~| P1_5 dig9
whismanoid 0:cb44e2e9ec4c 1837 // | [ ]GND 8[ ] | P1_4 dig8
whismanoid 0:cb44e2e9ec4c 1838 // | [ ]GND |
whismanoid 0:cb44e2e9ec4c 1839 // | [ ]Vin 7[ ] | P0_7 dig7
whismanoid 0:cb44e2e9ec4c 1840 // | 6[ ]~| P0_6 dig6
whismanoid 0:cb44e2e9ec4c 1841 // AIN_0 | [ ]A0 5[ ]~| P0_5 dig5
whismanoid 0:cb44e2e9ec4c 1842 // AIN_1 | [ ]A1 4[ ] | P0_4 dig4
whismanoid 0:cb44e2e9ec4c 1843 // AIN_2 | [ ]A2 INT1/3[ ]~| P0_3 dig3
whismanoid 0:cb44e2e9ec4c 1844 // AIN_3 | [ ]A3 INT0/2[ ] | P0_2 dig2
whismanoid 0:cb44e2e9ec4c 1845 // dig16 P3_4 | [ ]A4/SDA RST SCK MISO TX>1[ ] | P0_1 dig1
whismanoid 0:cb44e2e9ec4c 1846 // dig17 P3_5 | [ ]A5/SCL [ ] [ ] [ ] RX<0[ ] | P0_0 dig0
whismanoid 0:cb44e2e9ec4c 1847 // | [ ] [ ] [ ] |
whismanoid 0:cb44e2e9ec4c 1848 // | UNO_R3 GND MOSI 5V ____________/
whismanoid 0:cb44e2e9ec4c 1849 // \_______________________/
whismanoid 0:cb44e2e9ec4c 1850 //
whismanoid 0:cb44e2e9ec4c 1851 #define HAS_digitalInOut0 1 // P0_0 TARGET_MAX32625MBED D0
whismanoid 0:cb44e2e9ec4c 1852 #define HAS_digitalInOut1 1 // P0_1 TARGET_MAX32625MBED D1
whismanoid 0:cb44e2e9ec4c 1853 #if APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 1854 #define HAS_digitalInOut2 0 // P0_2 TARGET_MAX32625MBED D2 -- MAX11131 EOC DigitalIn
whismanoid 0:cb44e2e9ec4c 1855 #else
whismanoid 0:cb44e2e9ec4c 1856 #define HAS_digitalInOut2 1 // P0_2 TARGET_MAX32625MBED D2
whismanoid 0:cb44e2e9ec4c 1857 #endif
whismanoid 0:cb44e2e9ec4c 1858 #define HAS_digitalInOut3 1 // P0_3 TARGET_MAX32625MBED D3
whismanoid 0:cb44e2e9ec4c 1859 #define HAS_digitalInOut4 1 // P0_4 TARGET_MAX32625MBED D4
whismanoid 0:cb44e2e9ec4c 1860 #define HAS_digitalInOut5 1 // P0_5 TARGET_MAX32625MBED D5
whismanoid 0:cb44e2e9ec4c 1861 #define HAS_digitalInOut6 1 // P0_6 TARGET_MAX32625MBED D6
whismanoid 0:cb44e2e9ec4c 1862 #define HAS_digitalInOut7 1 // P0_7 TARGET_MAX32625MBED D7
whismanoid 0:cb44e2e9ec4c 1863 #define HAS_digitalInOut8 1 // P1_4 TARGET_MAX32625MBED D8
whismanoid 0:cb44e2e9ec4c 1864 #if APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 1865 #define HAS_digitalInOut9 0 // P1_5 TARGET_MAX32625MBED D9 -- MAX11131 CNVST DigitalOut
whismanoid 0:cb44e2e9ec4c 1866 #else
whismanoid 0:cb44e2e9ec4c 1867 #define HAS_digitalInOut9 1 // P1_5 TARGET_MAX32625MBED D9
whismanoid 0:cb44e2e9ec4c 1868 #endif
whismanoid 0:cb44e2e9ec4c 1869 #if HAS_SPI
whismanoid 0:cb44e2e9ec4c 1870 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 1871 #define HAS_digitalInOut10 0 // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:cb44e2e9ec4c 1872 #define HAS_digitalInOut11 0 // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:cb44e2e9ec4c 1873 #define HAS_digitalInOut12 0 // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:cb44e2e9ec4c 1874 #define HAS_digitalInOut13 0 // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:cb44e2e9ec4c 1875 #else // HAS_SPI
whismanoid 0:cb44e2e9ec4c 1876 #define HAS_digitalInOut10 1 // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:cb44e2e9ec4c 1877 #define HAS_digitalInOut11 1 // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:cb44e2e9ec4c 1878 #define HAS_digitalInOut12 1 // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:cb44e2e9ec4c 1879 #define HAS_digitalInOut13 1 // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:cb44e2e9ec4c 1880 #endif // HAS_SPI
whismanoid 0:cb44e2e9ec4c 1881 #if HAS_I2C
whismanoid 0:cb44e2e9ec4c 1882 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:cb44e2e9ec4c 1883 #define HAS_digitalInOut14 0 // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 1884 #define HAS_digitalInOut15 0 // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 1885 #define HAS_digitalInOut16 0 // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 1886 #define HAS_digitalInOut17 0 // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 1887 #else // HAS_I2C
whismanoid 0:cb44e2e9ec4c 1888 #define HAS_digitalInOut14 1 // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 1889 #define HAS_digitalInOut15 1 // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 1890 #define HAS_digitalInOut16 1 // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 1891 #define HAS_digitalInOut17 1 // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 1892 #endif // HAS_I2C
whismanoid 0:cb44e2e9ec4c 1893 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 1894 DigitalInOut digitalInOut0(P0_0, PIN_INPUT, PullUp, 1); // P0_0 TARGET_MAX32625MBED D0
whismanoid 0:cb44e2e9ec4c 1895 #endif
whismanoid 0:cb44e2e9ec4c 1896 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 1897 DigitalInOut digitalInOut1(P0_1, PIN_INPUT, PullUp, 1); // P0_1 TARGET_MAX32625MBED D1
whismanoid 0:cb44e2e9ec4c 1898 #endif
whismanoid 0:cb44e2e9ec4c 1899 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 1900 DigitalInOut digitalInOut2(P0_2, PIN_INPUT, PullUp, 1); // P0_2 TARGET_MAX32625MBED D2
whismanoid 0:cb44e2e9ec4c 1901 #endif
whismanoid 0:cb44e2e9ec4c 1902 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 1903 DigitalInOut digitalInOut3(P0_3, PIN_INPUT, PullUp, 1); // P0_3 TARGET_MAX32625MBED D3
whismanoid 0:cb44e2e9ec4c 1904 #endif
whismanoid 0:cb44e2e9ec4c 1905 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 1906 DigitalInOut digitalInOut4(P0_4, PIN_INPUT, PullUp, 1); // P0_4 TARGET_MAX32625MBED D4
whismanoid 0:cb44e2e9ec4c 1907 #endif
whismanoid 0:cb44e2e9ec4c 1908 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 1909 DigitalInOut digitalInOut5(P0_5, PIN_INPUT, PullUp, 1); // P0_5 TARGET_MAX32625MBED D5
whismanoid 0:cb44e2e9ec4c 1910 #endif
whismanoid 0:cb44e2e9ec4c 1911 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 1912 DigitalInOut digitalInOut6(P0_6, PIN_INPUT, PullUp, 1); // P0_6 TARGET_MAX32625MBED D6
whismanoid 0:cb44e2e9ec4c 1913 #endif
whismanoid 0:cb44e2e9ec4c 1914 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 1915 DigitalInOut digitalInOut7(P0_7, PIN_INPUT, PullUp, 1); // P0_7 TARGET_MAX32625MBED D7
whismanoid 0:cb44e2e9ec4c 1916 #endif
whismanoid 0:cb44e2e9ec4c 1917 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 1918 DigitalInOut digitalInOut8(P1_4, PIN_INPUT, PullUp, 1); // P1_4 TARGET_MAX32625MBED D8
whismanoid 0:cb44e2e9ec4c 1919 #endif
whismanoid 0:cb44e2e9ec4c 1920 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 1921 DigitalInOut digitalInOut9(P1_5, PIN_INPUT, PullUp, 1); // P1_5 TARGET_MAX32625MBED D9
whismanoid 0:cb44e2e9ec4c 1922 #endif
whismanoid 0:cb44e2e9ec4c 1923 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 1924 DigitalInOut digitalInOut10(P1_3, PIN_INPUT, PullUp, 1); // P1_3 TARGET_MAX32635MBED CS/10
whismanoid 0:cb44e2e9ec4c 1925 #endif
whismanoid 0:cb44e2e9ec4c 1926 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 1927 DigitalInOut digitalInOut11(P1_1, PIN_INPUT, PullUp, 1); // P1_1 TARGET_MAX32635MBED MOSI/11
whismanoid 0:cb44e2e9ec4c 1928 #endif
whismanoid 0:cb44e2e9ec4c 1929 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 1930 DigitalInOut digitalInOut12(P1_2, PIN_INPUT, PullUp, 1); // P1_2 TARGET_MAX32635MBED MISO/12
whismanoid 0:cb44e2e9ec4c 1931 #endif
whismanoid 0:cb44e2e9ec4c 1932 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 1933 DigitalInOut digitalInOut13(P1_0, PIN_INPUT, PullUp, 1); // P1_0 TARGET_MAX32635MBED SCK/13
whismanoid 0:cb44e2e9ec4c 1934 #endif
whismanoid 0:cb44e2e9ec4c 1935 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 1936 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 1937 // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain
whismanoid 0:cb44e2e9ec4c 1938 DigitalInOut digitalInOut14(P1_6, PIN_INPUT, OpenDrain, 1); // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 1939 #endif
whismanoid 0:cb44e2e9ec4c 1940 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 1941 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 1942 DigitalInOut digitalInOut15(P1_7, PIN_INPUT, OpenDrain, 1); // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 1943 #endif
whismanoid 0:cb44e2e9ec4c 1944 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 1945 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 1946 // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain
whismanoid 0:cb44e2e9ec4c 1947 // PullUp-->3.4V, PullDown-->1.7V, PullNone-->3.5V, OpenDrain-->0.00V
whismanoid 0:cb44e2e9ec4c 1948 DigitalInOut digitalInOut16(P3_4, PIN_INPUT, OpenDrain, 0); // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 1949 #endif
whismanoid 0:cb44e2e9ec4c 1950 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 1951 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 0:cb44e2e9ec4c 1952 DigitalInOut digitalInOut17(P3_5, PIN_INPUT, OpenDrain, 0); // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 1953 #endif
whismanoid 0:cb44e2e9ec4c 1954 //--------------------------------------------------
whismanoid 19:5ff09c8e9daf 1955 #elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 15:37c83ec50ea0 1956 // TARGET=MAX32625PICO ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 15:37c83ec50ea0 1957 // +-------------[microUSB]-------------+
whismanoid 15:37c83ec50ea0 1958 // | [27]D+ D-[26] |
whismanoid 15:37c83ec50ea0 1959 // | |
whismanoid 15:37c83ec50ea0 1960 // | [BUTTON P2_7] |
whismanoid 15:37c83ec50ea0 1961 // | P2_4 LED_R P2_5 LED_G P2_6 LED_B |
whismanoid 15:37c83ec50ea0 1962 // | |
whismanoid 15:37c83ec50ea0 1963 // 1V8 | [11] 1.8V MAX32625PICO GND [10] | GND
whismanoid 15:37c83ec50ea0 1964 // 3V3 | [12] 3.3V +5V [09] | 5V0
whismanoid 15:37c83ec50ea0 1965 // SPI CS D7 | [13] P0_7 CS s-ssel P4_7 [08] | D15
whismanoid 15:37c83ec50ea0 1966 // SPI MISO D6 | [14] P0_6 MISO s-miso P4_6 [07] | D14
whismanoid 15:37c83ec50ea0 1967 // SPI MOSI D5 | [15] P0_5 MOSI s-mosi P4_5 [06] | D13
whismanoid 15:37c83ec50ea0 1968 // SPI SCLK D4 | [16] P0_4 SCLK s-sclk P4_4 [05] | D12
whismanoid 15:37c83ec50ea0 1969 // D3 | [17] P0_3 RTS SCL P1_7 [04] | SCL/D17
whismanoid 15:37c83ec50ea0 1970 // D2 | [18] P0_2 CTS SDA P1_6 [03] | SDA/D16
whismanoid 15:37c83ec50ea0 1971 // TX/D1 | [19] P0_1 TX0 AIN_2 [02] | A2
whismanoid 15:37c83ec50ea0 1972 // RX/D0 | [20] P0_0 RX0 AIN_0 [01] | A0/A4
whismanoid 15:37c83ec50ea0 1973 // | |
whismanoid 15:37c83ec50ea0 1974 // | DAPLINK |
whismanoid 15:37c83ec50ea0 1975 // | J3 p3_3 p3_2 p3_0 p3_1 p3_7 |
whismanoid 15:37c83ec50ea0 1976 // | DAP [ ] [ ] [RX2][TX2][ ] |
whismanoid 15:37c83ec50ea0 1977 // | TOP [ ] [ ] [ ] [ ] [ ] |
whismanoid 15:37c83ec50ea0 1978 // | AIN1/A5 gnd gnd nc AIN3 |
whismanoid 15:37c83ec50ea0 1979 // | IOH 1-wire |
whismanoid 15:37c83ec50ea0 1980 // | |
whismanoid 15:37c83ec50ea0 1981 // |NO USE RST P2_0 P2_1 |
whismanoid 15:37c83ec50ea0 1982 // |BOTTOM [ ] [ ] [RX1][ ] [TX1] |
whismanoid 15:37c83ec50ea0 1983 // | RST SWC GND SWD 1V8 |
whismanoid 15:37c83ec50ea0 1984 // |BOTTOM [21] [22] [23] [24] [25] |
whismanoid 15:37c83ec50ea0 1985 // +------------------------------------+
whismanoid 15:37c83ec50ea0 1986 #if MAX40108_DEMO
whismanoid 15:37c83ec50ea0 1987 // MAX40108 demo p2: D0..D7 = P0_0..P0_7; D8..15 = P4_0..P4_7; D16/D17=I2C
whismanoid 15:37c83ec50ea0 1988 #endif
whismanoid 15:37c83ec50ea0 1989 // AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 15:37c83ec50ea0 1990 // AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 15:37c83ec50ea0 1991 // AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 15:37c83ec50ea0 1992 // AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 15:37c83ec50ea0 1993 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 15:37c83ec50ea0 1994 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 15:37c83ec50ea0 1995 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 15:37c83ec50ea0 1996 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 15:37c83ec50ea0 1997 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 15:37c83ec50ea0 1998 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 15:37c83ec50ea0 1999 // AIN_10 = x undefined?
whismanoid 15:37c83ec50ea0 2000 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 15:37c83ec50ea0 2001 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 15:37c83ec50ea0 2002 //
whismanoid 15:37c83ec50ea0 2003 #if MAX40108_DEMO
whismanoid 15:37c83ec50ea0 2004 // avoid resource conflict D0,D1 alternate function as RX/TX
whismanoid 15:37c83ec50ea0 2005 #define HAS_digitalInOut0 0
whismanoid 15:37c83ec50ea0 2006 #define HAS_digitalInOut1 0
whismanoid 15:37c83ec50ea0 2007 #else
whismanoid 15:37c83ec50ea0 2008 #define HAS_digitalInOut0 1
whismanoid 19:5ff09c8e9daf 2009 #define HAS_digitalInOut1 1
whismanoid 19:5ff09c8e9daf 2010 // P0_1 TARGET_MAX32625PICO D1
whismanoid 15:37c83ec50ea0 2011 #endif
whismanoid 15:37c83ec50ea0 2012 #if APPLICATION_MAX11131
whismanoid 15:37c83ec50ea0 2013 // avoid resource conflict D2 alternate function as interrupt input
whismanoid 15:37c83ec50ea0 2014 #define HAS_digitalInOut2 0
whismanoid 15:37c83ec50ea0 2015 #else
whismanoid 15:37c83ec50ea0 2016 #define HAS_digitalInOut2 1
whismanoid 15:37c83ec50ea0 2017 #endif
whismanoid 15:37c83ec50ea0 2018 #define HAS_digitalInOut3 1
whismanoid 15:37c83ec50ea0 2019 #define HAS_digitalInOut4 1
whismanoid 15:37c83ec50ea0 2020 #define HAS_digitalInOut5 1
whismanoid 15:37c83ec50ea0 2021 #define HAS_digitalInOut6 1
whismanoid 15:37c83ec50ea0 2022 #define HAS_digitalInOut7 1
whismanoid 15:37c83ec50ea0 2023 //
whismanoid 15:37c83ec50ea0 2024 #define HAS_digitalInOut8 1
whismanoid 15:37c83ec50ea0 2025 #define HAS_digitalInOut9 1
whismanoid 15:37c83ec50ea0 2026 #define HAS_digitalInOut10 1
whismanoid 15:37c83ec50ea0 2027 #define HAS_digitalInOut11 1
whismanoid 15:37c83ec50ea0 2028 #define HAS_digitalInOut12 1
whismanoid 15:37c83ec50ea0 2029 #define HAS_digitalInOut13 1
whismanoid 15:37c83ec50ea0 2030 #define HAS_digitalInOut14 1
whismanoid 15:37c83ec50ea0 2031 #define HAS_digitalInOut15 1
whismanoid 15:37c83ec50ea0 2032 #if HAS_I2C
whismanoid 25:8a61cb34191d 2033 // MAX40108DEMOP2U9 HAS_I2C: J91.1=1V8 J91.2=P1_6(SDA) J91.3=P1_7(SCL) J91.4=GND
whismanoid 25:8a61cb34191d 2034 // MAX40108DEMOP2U9 HAS_I2C: move button2/button3 to inaccessible pins P3_6 and P3_7 if we need J91 for I2C
whismanoid 25:8a61cb34191d 2035 // #define BUTTON2 P3_7
whismanoid 25:8a61cb34191d 2036 // avoid resource conflict between I2C and DigitalInOut
whismanoid 25:8a61cb34191d 2037 #define HAS_digitalInOut16 0 // P1_6 TARGET_MAX40108DEMOP2U9 J91.2=P1_6(button3/'%B3!'/SDA)
whismanoid 25:8a61cb34191d 2038 #define HAS_digitalInOut17 0 // P1_7 TARGET_MAX40108DEMOP2U9 J91.3=P1_7(button2/'%B2!'/SCL)
whismanoid 15:37c83ec50ea0 2039 #else // HAS_I2C
whismanoid 25:8a61cb34191d 2040 // MAX40108DEMOP2U9 no HAS_I2C: option using J91 for button2 and button3 instead of I2C
whismanoid 25:8a61cb34191d 2041 // 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 2042 // MAX40108DEMOP2U9 no HAS_I2C: avoid conflict between digital pins D16 D17 and button2/button3
whismanoid 25:8a61cb34191d 2043 // #define BUTTON2 P1_7
whismanoid 25:8a61cb34191d 2044 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 25:8a61cb34191d 2045 // MAX40108DEMOP2U9 avoid conflict between digital pins D16 D17 and button2/button3
whismanoid 25:8a61cb34191d 2046 #define HAS_digitalInOut16 0 // P1_6 TARGET_MAX40108DEMOP2U9 J91.2=P1_6(button3/'%B3!'/SDA)
whismanoid 25:8a61cb34191d 2047 #else // HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 25:8a61cb34191d 2048 #define HAS_digitalInOut16 1 // P1_6 TARGET_MAX40108DEMOP2U9 J91.2=P1_6(button3/'%B3!'/SDA)
whismanoid 25:8a61cb34191d 2049 #endif // HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 25:8a61cb34191d 2050 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 25:8a61cb34191d 2051 // MAX40108DEMOP2U9 avoid conflict between digital pins D16 D17 and button2/button3
whismanoid 25:8a61cb34191d 2052 #define HAS_digitalInOut17 0 // P1_7 TARGET_MAX40108DEMOP2U9 J91.3=P1_7(button2/'%B2!'/SCL)
whismanoid 25:8a61cb34191d 2053 #else // HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 25:8a61cb34191d 2054 #define HAS_digitalInOut17 1 // P1_7 TARGET_MAX40108DEMOP2U9 J91.3=P1_7(button2/'%B2!'/SCL)
whismanoid 25:8a61cb34191d 2055 #endif // HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 15:37c83ec50ea0 2056 #endif // HAS_I2C
whismanoid 15:37c83ec50ea0 2057 #if HAS_digitalInOut0
whismanoid 25:8a61cb34191d 2058 DigitalInOut digitalInOut0(P0_0, PIN_INPUT, PullUp, 1); // P0_0 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D0
whismanoid 15:37c83ec50ea0 2059 #endif
whismanoid 15:37c83ec50ea0 2060 #if HAS_digitalInOut1
whismanoid 25:8a61cb34191d 2061 DigitalInOut digitalInOut1(P0_1, PIN_INPUT, PullUp, 1); // P0_1 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D1
whismanoid 15:37c83ec50ea0 2062 #endif
whismanoid 15:37c83ec50ea0 2063 #if HAS_digitalInOut2
whismanoid 25:8a61cb34191d 2064 DigitalInOut digitalInOut2(P0_2, PIN_INPUT, PullUp, 1); // P0_2 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D2
whismanoid 15:37c83ec50ea0 2065 #endif
whismanoid 15:37c83ec50ea0 2066 #if HAS_digitalInOut3
whismanoid 25:8a61cb34191d 2067 DigitalInOut digitalInOut3(P0_3, PIN_INPUT, PullUp, 1); // P0_3 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D3
whismanoid 15:37c83ec50ea0 2068 #endif
whismanoid 15:37c83ec50ea0 2069 #if HAS_digitalInOut4
whismanoid 25:8a61cb34191d 2070 DigitalInOut digitalInOut4(P0_4, PIN_INPUT, PullUp, 1); // P0_4 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D4
whismanoid 15:37c83ec50ea0 2071 #endif
whismanoid 15:37c83ec50ea0 2072 #if HAS_digitalInOut5
whismanoid 25:8a61cb34191d 2073 DigitalInOut digitalInOut5(P0_5, PIN_INPUT, PullUp, 1); // P0_5 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D5
whismanoid 15:37c83ec50ea0 2074 #endif
whismanoid 15:37c83ec50ea0 2075 #if HAS_digitalInOut6
whismanoid 25:8a61cb34191d 2076 DigitalInOut digitalInOut6(P0_6, PIN_INPUT, PullUp, 1); // P0_6 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D6
whismanoid 15:37c83ec50ea0 2077 #endif
whismanoid 15:37c83ec50ea0 2078 #if HAS_digitalInOut7
whismanoid 25:8a61cb34191d 2079 DigitalInOut digitalInOut7(P0_7, PIN_INPUT, PullUp, 1); // P0_7 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D7
whismanoid 15:37c83ec50ea0 2080 #endif
whismanoid 15:37c83ec50ea0 2081 #if HAS_digitalInOut8
whismanoid 25:8a61cb34191d 2082 DigitalInOut digitalInOut8(P4_0, PIN_INPUT, PullUp, 1); // P4_0 TARGET_MAX40108DEMOP2U9 D8
whismanoid 15:37c83ec50ea0 2083 #endif
whismanoid 15:37c83ec50ea0 2084 #if HAS_digitalInOut9
whismanoid 25:8a61cb34191d 2085 DigitalInOut digitalInOut9(P4_1, PIN_INPUT, PullUp, 1); // P4_1 TARGET_MAX40108DEMOP2U9 D9
whismanoid 15:37c83ec50ea0 2086 #endif
whismanoid 15:37c83ec50ea0 2087 #if HAS_digitalInOut10
whismanoid 25:8a61cb34191d 2088 DigitalInOut digitalInOut10(P4_2, PIN_INPUT, PullUp, 1); // P4_2 TARGET_MAX40108DEMOP2U9 D10
whismanoid 15:37c83ec50ea0 2089 #endif
whismanoid 15:37c83ec50ea0 2090 #if HAS_digitalInOut11
whismanoid 25:8a61cb34191d 2091 DigitalInOut digitalInOut11(P4_3, PIN_INPUT, PullUp, 1); // P4_3 TARGET_MAX40108DEMOP2U9 D11
whismanoid 15:37c83ec50ea0 2092 #endif
whismanoid 15:37c83ec50ea0 2093 #if HAS_digitalInOut12
whismanoid 25:8a61cb34191d 2094 DigitalInOut digitalInOut12(P4_4, PIN_INPUT, PullUp, 1); // P4_4 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D12
whismanoid 15:37c83ec50ea0 2095 #endif
whismanoid 15:37c83ec50ea0 2096 #if HAS_digitalInOut13
whismanoid 25:8a61cb34191d 2097 DigitalInOut digitalInOut13(P4_5, PIN_INPUT, PullUp, 1); // P4_5 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D13
whismanoid 15:37c83ec50ea0 2098 #endif
whismanoid 15:37c83ec50ea0 2099 #if HAS_digitalInOut14
whismanoid 25:8a61cb34191d 2100 DigitalInOut digitalInOut14(P4_6, PIN_INPUT, PullUp, 1); // P4_6 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D14
whismanoid 15:37c83ec50ea0 2101 #endif
whismanoid 15:37c83ec50ea0 2102 #if HAS_digitalInOut15
whismanoid 25:8a61cb34191d 2103 DigitalInOut digitalInOut15(P4_7, PIN_INPUT, PullUp, 1); // P4_7 TARGET_MAX32625PICO TARGET_MAX40108DEMOP2U9 D15
whismanoid 15:37c83ec50ea0 2104 #endif
whismanoid 15:37c83ec50ea0 2105 #if HAS_digitalInOut16
whismanoid 15:37c83ec50ea0 2106 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 15:37c83ec50ea0 2107 // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain
whismanoid 25:8a61cb34191d 2108 DigitalInOut digitalInOut16(P1_6, PIN_INPUT, OpenDrain, 1); // P1_6 TARGET_MAX40108DEMOP2U9 J91.2=P1_6(button3/'%B3!'/SDA)
whismanoid 15:37c83ec50ea0 2109 #endif
whismanoid 15:37c83ec50ea0 2110 #if HAS_digitalInOut17
whismanoid 15:37c83ec50ea0 2111 // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5
whismanoid 25:8a61cb34191d 2112 DigitalInOut digitalInOut17(P1_7, PIN_INPUT, OpenDrain, 1); // P1_7 TARGET_MAX40108DEMOP2U9 J91.3=P1_7(button2/'%B2!'/SCL)
whismanoid 15:37c83ec50ea0 2113 #endif
whismanoid 15:37c83ec50ea0 2114 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2115 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 2116 #define HAS_digitalInOut0 0
whismanoid 0:cb44e2e9ec4c 2117 #define HAS_digitalInOut1 0
whismanoid 0:cb44e2e9ec4c 2118 #if APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 2119 // D2 -- MAX11131 EOC DigitalIn
whismanoid 0:cb44e2e9ec4c 2120 #define HAS_digitalInOut2 0
whismanoid 0:cb44e2e9ec4c 2121 #else
whismanoid 0:cb44e2e9ec4c 2122 #define HAS_digitalInOut2 1
whismanoid 0:cb44e2e9ec4c 2123 #endif
whismanoid 0:cb44e2e9ec4c 2124 #define HAS_digitalInOut3 1
whismanoid 0:cb44e2e9ec4c 2125 #define HAS_digitalInOut4 1
whismanoid 0:cb44e2e9ec4c 2126 #define HAS_digitalInOut5 1
whismanoid 0:cb44e2e9ec4c 2127 #define HAS_digitalInOut6 1
whismanoid 0:cb44e2e9ec4c 2128 #define HAS_digitalInOut7 1
whismanoid 0:cb44e2e9ec4c 2129 #if APPLICATION_MAX5715
whismanoid 0:cb44e2e9ec4c 2130 // D8 -- MAX5715 CLRb DigitalOut
whismanoid 0:cb44e2e9ec4c 2131 #define HAS_digitalInOut8 0
whismanoid 0:cb44e2e9ec4c 2132 #else
whismanoid 0:cb44e2e9ec4c 2133 #define HAS_digitalInOut8 1
whismanoid 0:cb44e2e9ec4c 2134 #endif
whismanoid 0:cb44e2e9ec4c 2135 #if APPLICATION_MAX5715
whismanoid 0:cb44e2e9ec4c 2136 // D9 -- MAX5715 LDACb DigitalOut
whismanoid 0:cb44e2e9ec4c 2137 #define HAS_digitalInOut9 0
whismanoid 0:cb44e2e9ec4c 2138 #elif APPLICATION_MAX11131
whismanoid 0:cb44e2e9ec4c 2139 // D9 -- MAX11131 CNVST DigitalOut
whismanoid 0:cb44e2e9ec4c 2140 #define HAS_digitalInOut9 0
whismanoid 0:cb44e2e9ec4c 2141 #else
whismanoid 0:cb44e2e9ec4c 2142 #define HAS_digitalInOut9 1
whismanoid 0:cb44e2e9ec4c 2143 #endif
whismanoid 0:cb44e2e9ec4c 2144 #if HAS_SPI
whismanoid 0:cb44e2e9ec4c 2145 // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 2146 // Arduino digital pin D10 SPI function is CS/10
whismanoid 0:cb44e2e9ec4c 2147 // Arduino digital pin D11 SPI function is MOSI/11
whismanoid 0:cb44e2e9ec4c 2148 // Arduino digital pin D12 SPI function is MISO/12
whismanoid 0:cb44e2e9ec4c 2149 // Arduino digital pin D13 SPI function is SCK/13
whismanoid 0:cb44e2e9ec4c 2150 #define HAS_digitalInOut10 0
whismanoid 0:cb44e2e9ec4c 2151 #define HAS_digitalInOut11 0
whismanoid 0:cb44e2e9ec4c 2152 #define HAS_digitalInOut12 0
whismanoid 0:cb44e2e9ec4c 2153 #define HAS_digitalInOut13 0
whismanoid 0:cb44e2e9ec4c 2154 #else // HAS_SPI
whismanoid 0:cb44e2e9ec4c 2155 #define HAS_digitalInOut10 1
whismanoid 0:cb44e2e9ec4c 2156 #define HAS_digitalInOut11 1
whismanoid 0:cb44e2e9ec4c 2157 #define HAS_digitalInOut12 1
whismanoid 0:cb44e2e9ec4c 2158 #define HAS_digitalInOut13 1
whismanoid 0:cb44e2e9ec4c 2159 #endif // HAS_SPI
whismanoid 0:cb44e2e9ec4c 2160 #if HAS_I2C
whismanoid 0:cb44e2e9ec4c 2161 // avoid resource conflict between P5_7, P6_0 I2C and DigitalInOut
whismanoid 0:cb44e2e9ec4c 2162 // Arduino digital pin D14 I2C function is A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 2163 // Arduino digital pin D15 I2C function is A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 2164 // Arduino digital pin D16 I2C function is A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 2165 // Arduino digital pin D17 I2C function is A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 2166 #define HAS_digitalInOut14 0
whismanoid 0:cb44e2e9ec4c 2167 #define HAS_digitalInOut15 0
whismanoid 0:cb44e2e9ec4c 2168 #define HAS_digitalInOut16 0
whismanoid 0:cb44e2e9ec4c 2169 #define HAS_digitalInOut17 0
whismanoid 0:cb44e2e9ec4c 2170 #else // HAS_I2C
whismanoid 0:cb44e2e9ec4c 2171 #define HAS_digitalInOut14 1
whismanoid 0:cb44e2e9ec4c 2172 #define HAS_digitalInOut15 1
whismanoid 0:cb44e2e9ec4c 2173 #define HAS_digitalInOut16 0
whismanoid 0:cb44e2e9ec4c 2174 #define HAS_digitalInOut17 0
whismanoid 0:cb44e2e9ec4c 2175 #endif // HAS_I2C
whismanoid 0:cb44e2e9ec4c 2176 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 2177 DigitalInOut digitalInOut0(D0, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2178 #endif
whismanoid 0:cb44e2e9ec4c 2179 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 2180 DigitalInOut digitalInOut1(D1, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2181 #endif
whismanoid 0:cb44e2e9ec4c 2182 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 2183 DigitalInOut digitalInOut2(D2, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2184 #endif
whismanoid 0:cb44e2e9ec4c 2185 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 2186 DigitalInOut digitalInOut3(D3, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2187 #endif
whismanoid 0:cb44e2e9ec4c 2188 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 2189 DigitalInOut digitalInOut4(D4, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2190 #endif
whismanoid 0:cb44e2e9ec4c 2191 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 2192 DigitalInOut digitalInOut5(D5, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2193 #endif
whismanoid 0:cb44e2e9ec4c 2194 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 2195 DigitalInOut digitalInOut6(D6, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2196 #endif
whismanoid 0:cb44e2e9ec4c 2197 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 2198 DigitalInOut digitalInOut7(D7, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2199 #endif
whismanoid 0:cb44e2e9ec4c 2200 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 2201 DigitalInOut digitalInOut8(D8, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2202 #endif
whismanoid 0:cb44e2e9ec4c 2203 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 2204 DigitalInOut digitalInOut9(D9, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2205 #endif
whismanoid 0:cb44e2e9ec4c 2206 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 2207 // Arduino digital pin D10 SPI function is CS/10
whismanoid 0:cb44e2e9ec4c 2208 DigitalInOut digitalInOut10(D10, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2209 #endif
whismanoid 0:cb44e2e9ec4c 2210 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 2211 // Arduino digital pin D11 SPI function is MOSI/11
whismanoid 0:cb44e2e9ec4c 2212 DigitalInOut digitalInOut11(D11, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2213 #endif
whismanoid 0:cb44e2e9ec4c 2214 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 2215 // Arduino digital pin D12 SPI function is MISO/12
whismanoid 0:cb44e2e9ec4c 2216 DigitalInOut digitalInOut12(D12, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2217 #endif
whismanoid 0:cb44e2e9ec4c 2218 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 2219 // Arduino digital pin D13 SPI function is SCK/13
whismanoid 0:cb44e2e9ec4c 2220 DigitalInOut digitalInOut13(D13, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2221 #endif
whismanoid 0:cb44e2e9ec4c 2222 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 2223 // Arduino digital pin D14 I2C function is A4/SDA (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 2224 DigitalInOut digitalInOut14(D14, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2225 #endif
whismanoid 0:cb44e2e9ec4c 2226 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 2227 // Arduino digital pin D15 I2C function is A5/SCL (10pin digital connector)
whismanoid 0:cb44e2e9ec4c 2228 DigitalInOut digitalInOut15(D15, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2229 #endif
whismanoid 0:cb44e2e9ec4c 2230 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 2231 // Arduino digital pin D16 I2C function is A4/SDA (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 2232 DigitalInOut digitalInOut16(D16, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2233 #endif
whismanoid 0:cb44e2e9ec4c 2234 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 2235 // Arduino digital pin D17 I2C function is A5/SCL (6pin analog connector)
whismanoid 0:cb44e2e9ec4c 2236 DigitalInOut digitalInOut17(D17, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2237 #endif
whismanoid 0:cb44e2e9ec4c 2238 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2239 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 2240 #define HAS_digitalInOut0 1
whismanoid 0:cb44e2e9ec4c 2241 #define HAS_digitalInOut1 1
whismanoid 0:cb44e2e9ec4c 2242 #define HAS_digitalInOut2 1
whismanoid 0:cb44e2e9ec4c 2243 #define HAS_digitalInOut3 1
whismanoid 0:cb44e2e9ec4c 2244 #define HAS_digitalInOut4 1
whismanoid 0:cb44e2e9ec4c 2245 #define HAS_digitalInOut5 1
whismanoid 0:cb44e2e9ec4c 2246 #define HAS_digitalInOut6 1
whismanoid 0:cb44e2e9ec4c 2247 #define HAS_digitalInOut7 1
whismanoid 0:cb44e2e9ec4c 2248 #define HAS_digitalInOut8 1
whismanoid 0:cb44e2e9ec4c 2249 #define HAS_digitalInOut9 1
whismanoid 0:cb44e2e9ec4c 2250 // #define HAS_digitalInOut10 1
whismanoid 0:cb44e2e9ec4c 2251 // #define HAS_digitalInOut11 1
whismanoid 0:cb44e2e9ec4c 2252 // #define HAS_digitalInOut12 1
whismanoid 0:cb44e2e9ec4c 2253 // #define HAS_digitalInOut13 1
whismanoid 0:cb44e2e9ec4c 2254 // #define HAS_digitalInOut14 1
whismanoid 0:cb44e2e9ec4c 2255 // #define HAS_digitalInOut15 1
whismanoid 0:cb44e2e9ec4c 2256 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 2257 DigitalInOut digitalInOut0(p5, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.9/I2STX_SDA/MOSI1/MAT2.3
whismanoid 0:cb44e2e9ec4c 2258 #endif
whismanoid 0:cb44e2e9ec4c 2259 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 2260 DigitalInOut digitalInOut1(p6, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.8/I2STX_WS/MISO1/MAT2.2
whismanoid 0:cb44e2e9ec4c 2261 #endif
whismanoid 0:cb44e2e9ec4c 2262 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 2263 DigitalInOut digitalInOut2(p7, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.7/I2STX_CLK/SCK1/MAT2.1
whismanoid 0:cb44e2e9ec4c 2264 #endif
whismanoid 0:cb44e2e9ec4c 2265 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 2266 DigitalInOut digitalInOut3(p8, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.6/I2SRX_SDA/SSEL1/MAT2.0
whismanoid 0:cb44e2e9ec4c 2267 #endif
whismanoid 0:cb44e2e9ec4c 2268 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 2269 DigitalInOut digitalInOut4(p9, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.0/CAN_RX1/TXD3/SDA1
whismanoid 0:cb44e2e9ec4c 2270 #endif
whismanoid 0:cb44e2e9ec4c 2271 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 2272 DigitalInOut digitalInOut5(p10, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.1/CAN_TX1/RXD3/SCL1
whismanoid 0:cb44e2e9ec4c 2273 #endif
whismanoid 0:cb44e2e9ec4c 2274 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 2275 DigitalInOut digitalInOut6(p11, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.18/DCD1/MOSI0/MOSI1
whismanoid 0:cb44e2e9ec4c 2276 #endif
whismanoid 0:cb44e2e9ec4c 2277 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 2278 DigitalInOut digitalInOut7(p12, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.17/CTS1/MISO0/MISO
whismanoid 0:cb44e2e9ec4c 2279 #endif
whismanoid 0:cb44e2e9ec4c 2280 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 2281 DigitalInOut digitalInOut8(p13, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.15/TXD1/SCK0/SCK
whismanoid 0:cb44e2e9ec4c 2282 #endif
whismanoid 0:cb44e2e9ec4c 2283 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 2284 DigitalInOut digitalInOut9(p14, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.16/RXD1/SSEL0/SSEL
whismanoid 0:cb44e2e9ec4c 2285 #endif
whismanoid 0:cb44e2e9ec4c 2286 //
whismanoid 0:cb44e2e9ec4c 2287 // these pins support analog input analogIn0 .. analogIn5
whismanoid 0:cb44e2e9ec4c 2288 //DigitalInOut digitalInOut_(p15, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.23/AD0.0/I2SRX_CLK/CAP3.0
whismanoid 0:cb44e2e9ec4c 2289 //DigitalInOut digitalInOut_(p16, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.24/AD0.1/I2SRX_WS/CAP3.1
whismanoid 0:cb44e2e9ec4c 2290 //DigitalInOut digitalInOut_(p17, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.25/AD0.2/I2SRX_SDA/TXD3
whismanoid 0:cb44e2e9ec4c 2291 //DigitalInOut digitalInOut_(p18, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.26/AD0.3/AOUT/RXD3
whismanoid 0:cb44e2e9ec4c 2292 //DigitalInOut digitalInOut_(p19, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P1.30/VBUS/AD0.4
whismanoid 0:cb44e2e9ec4c 2293 //DigitalInOut digitalInOut_(p20, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P1.31/SCK1/AD0.5
whismanoid 0:cb44e2e9ec4c 2294 //
whismanoid 0:cb44e2e9ec4c 2295 // these pins support PWM pwmDriver1 .. pwmDriver6
whismanoid 0:cb44e2e9ec4c 2296 //DigitalInOut digitalInOut_(p21, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.5/PWM1.6/DTR1/TRACEDATA0
whismanoid 0:cb44e2e9ec4c 2297 //DigitalInOut digitalInOut_(p22, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.4/PWM1.5/DSR1/TRACEDATA1
whismanoid 0:cb44e2e9ec4c 2298 //DigitalInOut digitalInOut_(p23, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.3/PWM1.4/DCD1/TRACEDATA2
whismanoid 0:cb44e2e9ec4c 2299 //DigitalInOut digitalInOut_(p24, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.2/PWM1.3/CTS1/TRACEDATA3
whismanoid 0:cb44e2e9ec4c 2300 //DigitalInOut digitalInOut_(p25, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.1/PWM1.2/RXD1
whismanoid 0:cb44e2e9ec4c 2301 //DigitalInOut digitalInOut_(p26, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P2.0/PWM1.1/TXD1/TRACECLK
whismanoid 0:cb44e2e9ec4c 2302 //
whismanoid 0:cb44e2e9ec4c 2303 // these could be additional digitalInOut pins
whismanoid 0:cb44e2e9ec4c 2304 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 2305 DigitalInOut digitalInOut10(p27, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.11/RXD2/SCL2/MAT3.1
whismanoid 0:cb44e2e9ec4c 2306 #endif
whismanoid 0:cb44e2e9ec4c 2307 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 2308 DigitalInOut digitalInOut11(p28, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.10/TXD2/SDA2/MAT3.0
whismanoid 0:cb44e2e9ec4c 2309 #endif
whismanoid 0:cb44e2e9ec4c 2310 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 2311 DigitalInOut digitalInOut12(p29, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.5/I2SRX_WS/CAN_TX2/CAP2.1
whismanoid 0:cb44e2e9ec4c 2312 #endif
whismanoid 0:cb44e2e9ec4c 2313 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 2314 DigitalInOut digitalInOut13(p30, PIN_INPUT, PullUp, 1); // TARGET_LPC1768 P0.4/I2SRX_CLK/CAN_RX2/CAP2.0
whismanoid 0:cb44e2e9ec4c 2315 #endif
whismanoid 0:cb44e2e9ec4c 2316 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 2317 DigitalInOut digitalInOut14(___, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2318 #endif
whismanoid 0:cb44e2e9ec4c 2319 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 2320 DigitalInOut digitalInOut15(___, PIN_INPUT, PullUp, 1);
whismanoid 0:cb44e2e9ec4c 2321 #endif
whismanoid 0:cb44e2e9ec4c 2322 #else
whismanoid 0:cb44e2e9ec4c 2323 // unknown target
whismanoid 0:cb44e2e9ec4c 2324 #endif
whismanoid 0:cb44e2e9ec4c 2325 // uncrustify-0.66.1 *INDENT-ON*
whismanoid 0:cb44e2e9ec4c 2326 #if HAS_digitalInOut0 || HAS_digitalInOut1 \
whismanoid 0:cb44e2e9ec4c 2327 || HAS_digitalInOut2 || HAS_digitalInOut3 \
whismanoid 0:cb44e2e9ec4c 2328 || HAS_digitalInOut4 || HAS_digitalInOut5 \
whismanoid 0:cb44e2e9ec4c 2329 || HAS_digitalInOut6 || HAS_digitalInOut7 \
whismanoid 0:cb44e2e9ec4c 2330 || HAS_digitalInOut8 || HAS_digitalInOut9 \
whismanoid 0:cb44e2e9ec4c 2331 || HAS_digitalInOut10 || HAS_digitalInOut11 \
whismanoid 0:cb44e2e9ec4c 2332 || HAS_digitalInOut12 || HAS_digitalInOut13 \
whismanoid 0:cb44e2e9ec4c 2333 || HAS_digitalInOut14 || HAS_digitalInOut15 \
whismanoid 0:cb44e2e9ec4c 2334 || HAS_digitalInOut16 || HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 2335 #define HAS_digitalInOuts 1
whismanoid 0:cb44e2e9ec4c 2336 #else
whismanoid 0:cb44e2e9ec4c 2337 #warning "Note: There are no digitalInOut resources defined"
whismanoid 0:cb44e2e9ec4c 2338 #endif
whismanoid 0:cb44e2e9ec4c 2339
whismanoid 0:cb44e2e9ec4c 2340 // uncrustify-0.66.1 *INDENT-OFF*
whismanoid 0:cb44e2e9ec4c 2341 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2342 // Declare the AnalogIn driver
whismanoid 0:cb44e2e9ec4c 2343 // Optional analogIn support. If there is only one it should be analogIn1.
whismanoid 0:cb44e2e9ec4c 2344 // A) analog input
whismanoid 0:cb44e2e9ec4c 2345 #if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 2346 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2347 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2348 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2349 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2350 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2351 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2352 #define HAS_analogIn6 1
whismanoid 0:cb44e2e9ec4c 2353 #define HAS_analogIn7 1
whismanoid 0:cb44e2e9ec4c 2354 #define HAS_analogIn8 1
whismanoid 0:cb44e2e9ec4c 2355 #define HAS_analogIn9 1
whismanoid 0:cb44e2e9ec4c 2356 // #define HAS_analogIn10 0
whismanoid 0:cb44e2e9ec4c 2357 // #define HAS_analogIn11 0
whismanoid 0:cb44e2e9ec4c 2358 // #define HAS_analogIn12 0
whismanoid 0:cb44e2e9ec4c 2359 // #define HAS_analogIn13 0
whismanoid 0:cb44e2e9ec4c 2360 // #define HAS_analogIn14 0
whismanoid 0:cb44e2e9ec4c 2361 // #define HAS_analogIn15 0
whismanoid 0:cb44e2e9ec4c 2362 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2363 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2364 #endif
whismanoid 0:cb44e2e9ec4c 2365 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2366 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2367 #endif
whismanoid 0:cb44e2e9ec4c 2368 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2369 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2370 #endif
whismanoid 0:cb44e2e9ec4c 2371 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2372 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2373 #endif
whismanoid 0:cb44e2e9ec4c 2374 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2375 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2376 #endif
whismanoid 0:cb44e2e9ec4c 2377 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2378 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2379 #endif
whismanoid 0:cb44e2e9ec4c 2380 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 2381 AnalogIn analogIn6(AIN_6); // TARGET_MAX32630 AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2382 #endif
whismanoid 0:cb44e2e9ec4c 2383 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 2384 AnalogIn analogIn7(AIN_7); // TARGET_MAX32630 AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2385 #endif
whismanoid 0:cb44e2e9ec4c 2386 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 2387 AnalogIn analogIn8(AIN_8); // TARGET_MAX32630 AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2388 #endif
whismanoid 0:cb44e2e9ec4c 2389 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 2390 AnalogIn analogIn9(AIN_9); // TARGET_MAX32630 AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 2391 #endif
whismanoid 0:cb44e2e9ec4c 2392 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 2393 AnalogIn analogIn10(____); // TARGET_MAX32630 AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 2394 #endif
whismanoid 0:cb44e2e9ec4c 2395 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 2396 AnalogIn analogIn11(____); // TARGET_MAX32630 AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2397 #endif
whismanoid 0:cb44e2e9ec4c 2398 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 2399 AnalogIn analogIn12(____); // TARGET_MAX32630 AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2400 #endif
whismanoid 0:cb44e2e9ec4c 2401 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 2402 AnalogIn analogIn13(____);
whismanoid 0:cb44e2e9ec4c 2403 #endif
whismanoid 0:cb44e2e9ec4c 2404 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 2405 AnalogIn analogIn14(____);
whismanoid 0:cb44e2e9ec4c 2406 #endif
whismanoid 0:cb44e2e9ec4c 2407 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 2408 AnalogIn analogIn15(____);
whismanoid 0:cb44e2e9ec4c 2409 #endif
whismanoid 0:cb44e2e9ec4c 2410 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2411 #elif defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 2412 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2413 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2414 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2415 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2416 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2417 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2418 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2419 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2420 #endif
whismanoid 0:cb44e2e9ec4c 2421 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2422 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2423 #endif
whismanoid 0:cb44e2e9ec4c 2424 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2425 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2426 #endif
whismanoid 0:cb44e2e9ec4c 2427 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2428 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2429 #endif
whismanoid 0:cb44e2e9ec4c 2430 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2431 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2432 #endif
whismanoid 0:cb44e2e9ec4c 2433 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2434 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2435 #endif
whismanoid 0:cb44e2e9ec4c 2436 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2437 #elif defined(TARGET_MAX32620FTHR)
whismanoid 0:cb44e2e9ec4c 2438 #warning "TARGET_MAX32620FTHR not previously tested; need to verify analogIn0..."
whismanoid 0:cb44e2e9ec4c 2439 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2440 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2441 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2442 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2443 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2444 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2445 #define HAS_analogIn6 1
whismanoid 0:cb44e2e9ec4c 2446 #define HAS_analogIn7 1
whismanoid 0:cb44e2e9ec4c 2447 #define HAS_analogIn8 1
whismanoid 0:cb44e2e9ec4c 2448 #define HAS_analogIn9 1
whismanoid 0:cb44e2e9ec4c 2449 // #define HAS_analogIn10 0
whismanoid 0:cb44e2e9ec4c 2450 // #define HAS_analogIn11 0
whismanoid 0:cb44e2e9ec4c 2451 // #define HAS_analogIn12 0
whismanoid 0:cb44e2e9ec4c 2452 // #define HAS_analogIn13 0
whismanoid 0:cb44e2e9ec4c 2453 // #define HAS_analogIn14 0
whismanoid 0:cb44e2e9ec4c 2454 // #define HAS_analogIn15 0
whismanoid 0:cb44e2e9ec4c 2455 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2456 AnalogIn analogIn0(AIN_0); // TARGET_MAX32620FTHR J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2457 #endif
whismanoid 0:cb44e2e9ec4c 2458 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2459 AnalogIn analogIn1(AIN_1); // TARGET_MAX32620FTHR J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2460 #endif
whismanoid 0:cb44e2e9ec4c 2461 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2462 AnalogIn analogIn2(AIN_2); // TARGET_MAX32620FTHR J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2463 #endif
whismanoid 0:cb44e2e9ec4c 2464 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2465 AnalogIn analogIn3(AIN_3); // TARGET_MAX32620FTHR J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2466 #endif
whismanoid 0:cb44e2e9ec4c 2467 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2468 AnalogIn analogIn4(AIN_4); // TARGET_MAX32620FTHR J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2469 #endif
whismanoid 0:cb44e2e9ec4c 2470 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2471 AnalogIn analogIn5(AIN_5); // TARGET_MAX32620FTHR J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2472 #endif
whismanoid 0:cb44e2e9ec4c 2473 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 2474 AnalogIn analogIn6(AIN_6); // TARGET_MAX32620FTHR AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2475 #endif
whismanoid 0:cb44e2e9ec4c 2476 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 2477 AnalogIn analogIn7(AIN_7); // TARGET_MAX32620FTHR AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2478 #endif
whismanoid 0:cb44e2e9ec4c 2479 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 2480 AnalogIn analogIn8(AIN_8); // TARGET_MAX32620FTHR AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2481 #endif
whismanoid 0:cb44e2e9ec4c 2482 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 2483 AnalogIn analogIn9(AIN_9); // TARGET_MAX32620FTHR AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 2484 #endif
whismanoid 0:cb44e2e9ec4c 2485 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 2486 AnalogIn analogIn10(____); // TARGET_MAX32620FTHR AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 2487 #endif
whismanoid 0:cb44e2e9ec4c 2488 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 2489 AnalogIn analogIn11(____); // TARGET_MAX32620FTHR AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2490 #endif
whismanoid 0:cb44e2e9ec4c 2491 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 2492 AnalogIn analogIn12(____); // TARGET_MAX32620FTHR AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2493 #endif
whismanoid 0:cb44e2e9ec4c 2494 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 2495 AnalogIn analogIn13(____);
whismanoid 0:cb44e2e9ec4c 2496 #endif
whismanoid 0:cb44e2e9ec4c 2497 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 2498 AnalogIn analogIn14(____);
whismanoid 0:cb44e2e9ec4c 2499 #endif
whismanoid 0:cb44e2e9ec4c 2500 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 2501 AnalogIn analogIn15(____);
whismanoid 0:cb44e2e9ec4c 2502 #endif
whismanoid 0:cb44e2e9ec4c 2503 //--------------------------------------------------
whismanoid 19:5ff09c8e9daf 2504 #elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 37:3f369235e5bc 2505 // #warning "TARGET_MAX32625PICO not previously tested; need to verify analogIn0..."
whismanoid 0:cb44e2e9ec4c 2506 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2507 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2508 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2509 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2510 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2511 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2512 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2513 AnalogIn analogIn0(AIN_0); // TARGET_MAX32630 J1.5 AIN_0 = AIN0 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2514 #endif
whismanoid 0:cb44e2e9ec4c 2515 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2516 AnalogIn analogIn1(AIN_1); // TARGET_MAX32630 J1.6 AIN_1 = AIN1 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2517 #endif
whismanoid 0:cb44e2e9ec4c 2518 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2519 AnalogIn analogIn2(AIN_2); // TARGET_MAX32630 J1.7 AIN_2 = AIN2 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2520 #endif
whismanoid 0:cb44e2e9ec4c 2521 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2522 AnalogIn analogIn3(AIN_3); // TARGET_MAX32630 J1.8 AIN_3 = AIN3 pin fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2523 #endif
whismanoid 0:cb44e2e9ec4c 2524 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2525 AnalogIn analogIn4(AIN_4); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2526 #endif
whismanoid 0:cb44e2e9ec4c 2527 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2528 AnalogIn analogIn5(AIN_5); // TARGET_MAX32630 J1.6 AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2529 #endif
whismanoid 0:cb44e2e9ec4c 2530 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2531 #elif defined(TARGET_MAX32600)
whismanoid 0:cb44e2e9ec4c 2532 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2533 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2534 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2535 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2536 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2537 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2538 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2539 AnalogIn analogIn0(A0);
whismanoid 0:cb44e2e9ec4c 2540 #endif
whismanoid 0:cb44e2e9ec4c 2541 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2542 AnalogIn analogIn1(A1);
whismanoid 0:cb44e2e9ec4c 2543 #endif
whismanoid 0:cb44e2e9ec4c 2544 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2545 AnalogIn analogIn2(A2);
whismanoid 0:cb44e2e9ec4c 2546 #endif
whismanoid 0:cb44e2e9ec4c 2547 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2548 AnalogIn analogIn3(A3);
whismanoid 0:cb44e2e9ec4c 2549 #endif
whismanoid 0:cb44e2e9ec4c 2550 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2551 AnalogIn analogIn4(A4);
whismanoid 0:cb44e2e9ec4c 2552 #endif
whismanoid 0:cb44e2e9ec4c 2553 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2554 AnalogIn analogIn5(A5);
whismanoid 0:cb44e2e9ec4c 2555 #endif
whismanoid 0:cb44e2e9ec4c 2556 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2557 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:cb44e2e9ec4c 2558 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2559 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2560 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2561 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2562 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2563 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2564 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2565 AnalogIn analogIn0(A0);
whismanoid 0:cb44e2e9ec4c 2566 #endif
whismanoid 0:cb44e2e9ec4c 2567 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2568 AnalogIn analogIn1(A1);
whismanoid 0:cb44e2e9ec4c 2569 #endif
whismanoid 0:cb44e2e9ec4c 2570 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2571 AnalogIn analogIn2(A2);
whismanoid 0:cb44e2e9ec4c 2572 #endif
whismanoid 0:cb44e2e9ec4c 2573 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2574 AnalogIn analogIn3(A3);
whismanoid 0:cb44e2e9ec4c 2575 #endif
whismanoid 0:cb44e2e9ec4c 2576 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2577 AnalogIn analogIn4(A4);
whismanoid 0:cb44e2e9ec4c 2578 #endif
whismanoid 0:cb44e2e9ec4c 2579 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2580 AnalogIn analogIn5(A5);
whismanoid 0:cb44e2e9ec4c 2581 #endif
whismanoid 0:cb44e2e9ec4c 2582 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2583 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 2584 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2585 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2586 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2587 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2588 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2589 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2590 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2591 AnalogIn analogIn0(A0);
whismanoid 0:cb44e2e9ec4c 2592 #endif
whismanoid 0:cb44e2e9ec4c 2593 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2594 AnalogIn analogIn1(A1);
whismanoid 0:cb44e2e9ec4c 2595 #endif
whismanoid 0:cb44e2e9ec4c 2596 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2597 AnalogIn analogIn2(A2);
whismanoid 0:cb44e2e9ec4c 2598 #endif
whismanoid 0:cb44e2e9ec4c 2599 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2600 AnalogIn analogIn3(A3);
whismanoid 0:cb44e2e9ec4c 2601 #endif
whismanoid 0:cb44e2e9ec4c 2602 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2603 AnalogIn analogIn4(A4);
whismanoid 0:cb44e2e9ec4c 2604 #endif
whismanoid 0:cb44e2e9ec4c 2605 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2606 AnalogIn analogIn5(A5);
whismanoid 0:cb44e2e9ec4c 2607 #endif
whismanoid 0:cb44e2e9ec4c 2608 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 2609 // TODO1: TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
whismanoid 0:cb44e2e9ec4c 2610 #elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 2611 #define HAS_analogIn0 1
whismanoid 0:cb44e2e9ec4c 2612 #define HAS_analogIn1 1
whismanoid 0:cb44e2e9ec4c 2613 #define HAS_analogIn2 1
whismanoid 0:cb44e2e9ec4c 2614 #define HAS_analogIn3 1
whismanoid 0:cb44e2e9ec4c 2615 #define HAS_analogIn4 1
whismanoid 0:cb44e2e9ec4c 2616 #define HAS_analogIn5 1
whismanoid 0:cb44e2e9ec4c 2617 // #define HAS_analogIn6 1
whismanoid 0:cb44e2e9ec4c 2618 // #define HAS_analogIn7 1
whismanoid 0:cb44e2e9ec4c 2619 // #define HAS_analogIn8 1
whismanoid 0:cb44e2e9ec4c 2620 // #define HAS_analogIn9 1
whismanoid 0:cb44e2e9ec4c 2621 // #define HAS_analogIn10 1
whismanoid 0:cb44e2e9ec4c 2622 // #define HAS_analogIn11 1
whismanoid 0:cb44e2e9ec4c 2623 // #define HAS_analogIn12 1
whismanoid 0:cb44e2e9ec4c 2624 // #define HAS_analogIn13 1
whismanoid 0:cb44e2e9ec4c 2625 // #define HAS_analogIn14 1
whismanoid 0:cb44e2e9ec4c 2626 // #define HAS_analogIn15 1
whismanoid 0:cb44e2e9ec4c 2627 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2628 AnalogIn analogIn0(p15); // TARGET_LPC1768 P0.23/AD0.0/I2SRX_CLK/CAP3.0
whismanoid 0:cb44e2e9ec4c 2629 #endif
whismanoid 0:cb44e2e9ec4c 2630 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2631 AnalogIn analogIn1(p16); // TARGET_LPC1768 P0.24/AD0.1/I2SRX_WS/CAP3.1
whismanoid 0:cb44e2e9ec4c 2632 #endif
whismanoid 0:cb44e2e9ec4c 2633 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2634 AnalogIn analogIn2(p17); // TARGET_LPC1768 P0.25/AD0.2/I2SRX_SDA/TXD3
whismanoid 0:cb44e2e9ec4c 2635 #endif
whismanoid 0:cb44e2e9ec4c 2636 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2637 AnalogIn analogIn3(p18); // TARGET_LPC1768 P0.26/AD0.3/AOUT/RXD3
whismanoid 0:cb44e2e9ec4c 2638 #endif
whismanoid 0:cb44e2e9ec4c 2639 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2640 AnalogIn analogIn4(p19); // TARGET_LPC1768 P1.30/VBUS/AD0.4
whismanoid 0:cb44e2e9ec4c 2641 #endif
whismanoid 0:cb44e2e9ec4c 2642 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2643 AnalogIn analogIn5(p20); // TARGET_LPC1768 P1.31/SCK1/AD0.5
whismanoid 0:cb44e2e9ec4c 2644 #endif
whismanoid 0:cb44e2e9ec4c 2645 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 2646 AnalogIn analogIn6(____);
whismanoid 0:cb44e2e9ec4c 2647 #endif
whismanoid 0:cb44e2e9ec4c 2648 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 2649 AnalogIn analogIn7(____);
whismanoid 0:cb44e2e9ec4c 2650 #endif
whismanoid 0:cb44e2e9ec4c 2651 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 2652 AnalogIn analogIn8(____);
whismanoid 0:cb44e2e9ec4c 2653 #endif
whismanoid 0:cb44e2e9ec4c 2654 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 2655 AnalogIn analogIn9(____);
whismanoid 0:cb44e2e9ec4c 2656 #endif
whismanoid 0:cb44e2e9ec4c 2657 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 2658 AnalogIn analogIn10(____);
whismanoid 0:cb44e2e9ec4c 2659 #endif
whismanoid 0:cb44e2e9ec4c 2660 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 2661 AnalogIn analogIn11(____);
whismanoid 0:cb44e2e9ec4c 2662 #endif
whismanoid 0:cb44e2e9ec4c 2663 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 2664 AnalogIn analogIn12(____);
whismanoid 0:cb44e2e9ec4c 2665 #endif
whismanoid 0:cb44e2e9ec4c 2666 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 2667 AnalogIn analogIn13(____);
whismanoid 0:cb44e2e9ec4c 2668 #endif
whismanoid 0:cb44e2e9ec4c 2669 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 2670 AnalogIn analogIn14(____);
whismanoid 0:cb44e2e9ec4c 2671 #endif
whismanoid 0:cb44e2e9ec4c 2672 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 2673 AnalogIn analogIn15(____);
whismanoid 0:cb44e2e9ec4c 2674 #endif
whismanoid 0:cb44e2e9ec4c 2675 #else
whismanoid 0:cb44e2e9ec4c 2676 // unknown target
whismanoid 0:cb44e2e9ec4c 2677 #endif
whismanoid 0:cb44e2e9ec4c 2678 // uncrustify-0.66.1 *INDENT-ON*
whismanoid 0:cb44e2e9ec4c 2679 #if HAS_analogIn0 || HAS_analogIn1 \
whismanoid 0:cb44e2e9ec4c 2680 || HAS_analogIn2 || HAS_analogIn3 \
whismanoid 0:cb44e2e9ec4c 2681 || HAS_analogIn4 || HAS_analogIn5 \
whismanoid 0:cb44e2e9ec4c 2682 || HAS_analogIn6 || HAS_analogIn7 \
whismanoid 0:cb44e2e9ec4c 2683 || HAS_analogIn8 || HAS_analogIn9 \
whismanoid 0:cb44e2e9ec4c 2684 || HAS_analogIn10 || HAS_analogIn11 \
whismanoid 0:cb44e2e9ec4c 2685 || HAS_analogIn12 || HAS_analogIn13 \
whismanoid 0:cb44e2e9ec4c 2686 || HAS_analogIn14 || HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 2687 #define HAS_analogIns 1
whismanoid 0:cb44e2e9ec4c 2688 #else
whismanoid 0:cb44e2e9ec4c 2689 #warning "Note: There are no analogIn resources defined"
whismanoid 0:cb44e2e9ec4c 2690 #endif
whismanoid 0:cb44e2e9ec4c 2691
whismanoid 0:cb44e2e9ec4c 2692 // DigitalInOut pin resource: print the pin index names to serial
whismanoid 0:cb44e2e9ec4c 2693 #if HAS_digitalInOuts
whismanoid 0:cb44e2e9ec4c 2694 void list_digitalInOutPins(Stream& serialStream)
whismanoid 0:cb44e2e9ec4c 2695 {
whismanoid 0:cb44e2e9ec4c 2696 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 2697 serialStream.printf(" 0");
whismanoid 0:cb44e2e9ec4c 2698 #endif
whismanoid 0:cb44e2e9ec4c 2699 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 2700 serialStream.printf(" 1");
whismanoid 0:cb44e2e9ec4c 2701 #endif
whismanoid 0:cb44e2e9ec4c 2702 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 2703 serialStream.printf(" 2");
whismanoid 0:cb44e2e9ec4c 2704 #endif
whismanoid 0:cb44e2e9ec4c 2705 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 2706 serialStream.printf(" 3");
whismanoid 0:cb44e2e9ec4c 2707 #endif
whismanoid 0:cb44e2e9ec4c 2708 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 2709 serialStream.printf(" 4");
whismanoid 0:cb44e2e9ec4c 2710 #endif
whismanoid 0:cb44e2e9ec4c 2711 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 2712 serialStream.printf(" 5");
whismanoid 0:cb44e2e9ec4c 2713 #endif
whismanoid 0:cb44e2e9ec4c 2714 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 2715 serialStream.printf(" 6");
whismanoid 0:cb44e2e9ec4c 2716 #endif
whismanoid 0:cb44e2e9ec4c 2717 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 2718 serialStream.printf(" 7");
whismanoid 0:cb44e2e9ec4c 2719 #endif
whismanoid 0:cb44e2e9ec4c 2720 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 2721 serialStream.printf(" 8");
whismanoid 0:cb44e2e9ec4c 2722 #endif
whismanoid 0:cb44e2e9ec4c 2723 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 2724 serialStream.printf(" 9");
whismanoid 0:cb44e2e9ec4c 2725 #endif
whismanoid 0:cb44e2e9ec4c 2726 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 2727 serialStream.printf(" 10");
whismanoid 0:cb44e2e9ec4c 2728 #endif
whismanoid 0:cb44e2e9ec4c 2729 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 2730 serialStream.printf(" 11");
whismanoid 0:cb44e2e9ec4c 2731 #endif
whismanoid 0:cb44e2e9ec4c 2732 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 2733 serialStream.printf(" 12");
whismanoid 0:cb44e2e9ec4c 2734 #endif
whismanoid 0:cb44e2e9ec4c 2735 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 2736 serialStream.printf(" 13");
whismanoid 0:cb44e2e9ec4c 2737 #endif
whismanoid 0:cb44e2e9ec4c 2738 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 2739 serialStream.printf(" 14");
whismanoid 0:cb44e2e9ec4c 2740 #endif
whismanoid 0:cb44e2e9ec4c 2741 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 2742 serialStream.printf(" 15");
whismanoid 0:cb44e2e9ec4c 2743 #endif
whismanoid 0:cb44e2e9ec4c 2744 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 2745 serialStream.printf(" 16");
whismanoid 0:cb44e2e9ec4c 2746 #endif
whismanoid 0:cb44e2e9ec4c 2747 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 2748 serialStream.printf(" 17");
whismanoid 0:cb44e2e9ec4c 2749 #endif
whismanoid 18:1235c17b451e 2750 #if USE_LEDS
whismanoid 18:1235c17b451e 2751 // support LEDs as digital pins 91 92 93; WIP button as digital pin 90
whismanoid 18:1235c17b451e 2752 // support list_digitalInOutPins() listing buttons and leds as pin numbers 90/91/92/93
whismanoid 18:1235c17b451e 2753 // TODO: support find_digitalInOutPin(90) return DigitalInOut of switch SW1/BUTTON1
whismanoid 18:1235c17b451e 2754 //~ serialStream.printf(" 90");
whismanoid 18:1235c17b451e 2755 // support find_digitalInOutPin(91) return DigitalInOut of led1_RFailLED
whismanoid 18:1235c17b451e 2756 serialStream.printf(" 91");
whismanoid 18:1235c17b451e 2757 // support find_digitalInOutPin(92) return DigitalInOut of led2_GPassLED
whismanoid 18:1235c17b451e 2758 serialStream.printf(" 92");
whismanoid 18:1235c17b451e 2759 // support find_digitalInOutPin(93) return DigitalInOut of led3_BBusyLED
whismanoid 18:1235c17b451e 2760 serialStream.printf(" 93");
whismanoid 18:1235c17b451e 2761 #else // USE_LEDS
whismanoid 18:1235c17b451e 2762 #endif // USE_LEDS
whismanoid 0:cb44e2e9ec4c 2763 }
whismanoid 0:cb44e2e9ec4c 2764 #endif
whismanoid 0:cb44e2e9ec4c 2765
whismanoid 0:cb44e2e9ec4c 2766
whismanoid 0:cb44e2e9ec4c 2767 // DigitalInOut pin resource: search index
whismanoid 0:cb44e2e9ec4c 2768 #if HAS_digitalInOuts
whismanoid 0:cb44e2e9ec4c 2769 DigitalInOut& find_digitalInOutPin(int cPinIndex)
whismanoid 0:cb44e2e9ec4c 2770 {
whismanoid 0:cb44e2e9ec4c 2771 switch (cPinIndex)
whismanoid 0:cb44e2e9ec4c 2772 {
whismanoid 0:cb44e2e9ec4c 2773 default: // default to the first defined digitalInOut pin
whismanoid 0:cb44e2e9ec4c 2774 #if HAS_digitalInOut0
whismanoid 0:cb44e2e9ec4c 2775 case '0': case 0x00: return digitalInOut0;
whismanoid 0:cb44e2e9ec4c 2776 #endif
whismanoid 0:cb44e2e9ec4c 2777 #if HAS_digitalInOut1
whismanoid 0:cb44e2e9ec4c 2778 case '1': case 0x01: return digitalInOut1;
whismanoid 0:cb44e2e9ec4c 2779 #endif
whismanoid 0:cb44e2e9ec4c 2780 #if HAS_digitalInOut2
whismanoid 0:cb44e2e9ec4c 2781 case '2': case 0x02: return digitalInOut2;
whismanoid 0:cb44e2e9ec4c 2782 #endif
whismanoid 0:cb44e2e9ec4c 2783 #if HAS_digitalInOut3
whismanoid 0:cb44e2e9ec4c 2784 case '3': case 0x03: return digitalInOut3;
whismanoid 0:cb44e2e9ec4c 2785 #endif
whismanoid 0:cb44e2e9ec4c 2786 #if HAS_digitalInOut4
whismanoid 0:cb44e2e9ec4c 2787 case '4': case 0x04: return digitalInOut4;
whismanoid 0:cb44e2e9ec4c 2788 #endif
whismanoid 0:cb44e2e9ec4c 2789 #if HAS_digitalInOut5
whismanoid 0:cb44e2e9ec4c 2790 case '5': case 0x05: return digitalInOut5;
whismanoid 0:cb44e2e9ec4c 2791 #endif
whismanoid 0:cb44e2e9ec4c 2792 #if HAS_digitalInOut6
whismanoid 0:cb44e2e9ec4c 2793 case '6': case 0x06: return digitalInOut6;
whismanoid 0:cb44e2e9ec4c 2794 #endif
whismanoid 0:cb44e2e9ec4c 2795 #if HAS_digitalInOut7
whismanoid 0:cb44e2e9ec4c 2796 case '7': case 0x07: return digitalInOut7;
whismanoid 0:cb44e2e9ec4c 2797 #endif
whismanoid 0:cb44e2e9ec4c 2798 #if HAS_digitalInOut8
whismanoid 0:cb44e2e9ec4c 2799 case '8': case 0x08: return digitalInOut8;
whismanoid 0:cb44e2e9ec4c 2800 #endif
whismanoid 0:cb44e2e9ec4c 2801 #if HAS_digitalInOut9
whismanoid 0:cb44e2e9ec4c 2802 case '9': case 0x09: return digitalInOut9;
whismanoid 0:cb44e2e9ec4c 2803 #endif
whismanoid 0:cb44e2e9ec4c 2804 #if HAS_digitalInOut10
whismanoid 0:cb44e2e9ec4c 2805 case 'a': case 0x0a: return digitalInOut10;
whismanoid 0:cb44e2e9ec4c 2806 #endif
whismanoid 0:cb44e2e9ec4c 2807 #if HAS_digitalInOut11
whismanoid 0:cb44e2e9ec4c 2808 case 'b': case 0x0b: return digitalInOut11;
whismanoid 0:cb44e2e9ec4c 2809 #endif
whismanoid 0:cb44e2e9ec4c 2810 #if HAS_digitalInOut12
whismanoid 0:cb44e2e9ec4c 2811 case 'c': case 0x0c: return digitalInOut12;
whismanoid 0:cb44e2e9ec4c 2812 #endif
whismanoid 0:cb44e2e9ec4c 2813 #if HAS_digitalInOut13
whismanoid 0:cb44e2e9ec4c 2814 case 'd': case 0x0d: return digitalInOut13;
whismanoid 0:cb44e2e9ec4c 2815 #endif
whismanoid 0:cb44e2e9ec4c 2816 #if HAS_digitalInOut14
whismanoid 0:cb44e2e9ec4c 2817 case 'e': case 0x0e: return digitalInOut14;
whismanoid 0:cb44e2e9ec4c 2818 #endif
whismanoid 0:cb44e2e9ec4c 2819 #if HAS_digitalInOut15
whismanoid 0:cb44e2e9ec4c 2820 case 'f': case 0x0f: return digitalInOut15;
whismanoid 0:cb44e2e9ec4c 2821 #endif
whismanoid 0:cb44e2e9ec4c 2822 #if HAS_digitalInOut16
whismanoid 0:cb44e2e9ec4c 2823 case 'g': case 0x10: return digitalInOut16;
whismanoid 0:cb44e2e9ec4c 2824 #endif
whismanoid 0:cb44e2e9ec4c 2825 #if HAS_digitalInOut17
whismanoid 0:cb44e2e9ec4c 2826 case 'h': case 0x11: return digitalInOut17;
whismanoid 0:cb44e2e9ec4c 2827 #endif
whismanoid 18:1235c17b451e 2828 // support LEDs as digital pins 91 92 93; WIP button as digital pin 90
whismanoid 18:1235c17b451e 2829 // TODO: support find_digitalInOutPin(90) return DigitalInOut of switch SW1/BUTTON1
whismanoid 18:1235c17b451e 2830 //~ case 90: return button1;
whismanoid 18:1235c17b451e 2831 #if USE_LEDS
whismanoid 18:1235c17b451e 2832 // support find_digitalInOutPin(91) return DigitalInOut of led1_RFailLED
whismanoid 18:1235c17b451e 2833 case 91: return led1_RFailLED;
whismanoid 18:1235c17b451e 2834 // support find_digitalInOutPin(92) return DigitalInOut of led2_GPassLED
whismanoid 18:1235c17b451e 2835 case 92: return led2_GPassLED;
whismanoid 18:1235c17b451e 2836 // support find_digitalInOutPin(93) return DigitalInOut of led3_BBusyLED
whismanoid 18:1235c17b451e 2837 case 93: return led3_BBusyLED;
whismanoid 18:1235c17b451e 2838 #else // USE_LEDS
whismanoid 18:1235c17b451e 2839 #endif // USE_LEDS
whismanoid 0:cb44e2e9ec4c 2840 }
whismanoid 0:cb44e2e9ec4c 2841 }
whismanoid 0:cb44e2e9ec4c 2842 #endif
whismanoid 0:cb44e2e9ec4c 2843
whismanoid 0:cb44e2e9ec4c 2844
whismanoid 0:cb44e2e9ec4c 2845 // AnalogIn pin resource: search index
whismanoid 0:cb44e2e9ec4c 2846 #if HAS_analogIns
whismanoid 0:cb44e2e9ec4c 2847 AnalogIn& find_analogInPin(int cPinIndex)
whismanoid 0:cb44e2e9ec4c 2848 {
whismanoid 0:cb44e2e9ec4c 2849 switch (cPinIndex)
whismanoid 0:cb44e2e9ec4c 2850 {
whismanoid 0:cb44e2e9ec4c 2851 default: // default to the first defined analogIn pin
whismanoid 0:cb44e2e9ec4c 2852 #if HAS_analogIn0
whismanoid 0:cb44e2e9ec4c 2853 case '0': case 0x00: return analogIn0;
whismanoid 0:cb44e2e9ec4c 2854 #endif
whismanoid 0:cb44e2e9ec4c 2855 #if HAS_analogIn1
whismanoid 0:cb44e2e9ec4c 2856 case '1': case 0x01: return analogIn1;
whismanoid 0:cb44e2e9ec4c 2857 #endif
whismanoid 0:cb44e2e9ec4c 2858 #if HAS_analogIn2
whismanoid 0:cb44e2e9ec4c 2859 case '2': case 0x02: return analogIn2;
whismanoid 0:cb44e2e9ec4c 2860 #endif
whismanoid 0:cb44e2e9ec4c 2861 #if HAS_analogIn3
whismanoid 0:cb44e2e9ec4c 2862 case '3': case 0x03: return analogIn3;
whismanoid 0:cb44e2e9ec4c 2863 #endif
whismanoid 0:cb44e2e9ec4c 2864 #if HAS_analogIn4
whismanoid 0:cb44e2e9ec4c 2865 case '4': case 0x04: return analogIn4;
whismanoid 0:cb44e2e9ec4c 2866 #endif
whismanoid 0:cb44e2e9ec4c 2867 #if HAS_analogIn5
whismanoid 0:cb44e2e9ec4c 2868 case '5': case 0x05: return analogIn5;
whismanoid 0:cb44e2e9ec4c 2869 #endif
whismanoid 0:cb44e2e9ec4c 2870 #if HAS_analogIn6
whismanoid 0:cb44e2e9ec4c 2871 case '6': case 0x06: return analogIn6;
whismanoid 0:cb44e2e9ec4c 2872 #endif
whismanoid 0:cb44e2e9ec4c 2873 #if HAS_analogIn7
whismanoid 0:cb44e2e9ec4c 2874 case '7': case 0x07: return analogIn7;
whismanoid 0:cb44e2e9ec4c 2875 #endif
whismanoid 0:cb44e2e9ec4c 2876 #if HAS_analogIn8
whismanoid 0:cb44e2e9ec4c 2877 case '8': case 0x08: return analogIn8;
whismanoid 0:cb44e2e9ec4c 2878 #endif
whismanoid 0:cb44e2e9ec4c 2879 #if HAS_analogIn9
whismanoid 0:cb44e2e9ec4c 2880 case '9': case 0x09: return analogIn9;
whismanoid 0:cb44e2e9ec4c 2881 #endif
whismanoid 0:cb44e2e9ec4c 2882 #if HAS_analogIn10
whismanoid 0:cb44e2e9ec4c 2883 case 'a': case 0x0a: return analogIn10;
whismanoid 0:cb44e2e9ec4c 2884 #endif
whismanoid 0:cb44e2e9ec4c 2885 #if HAS_analogIn11
whismanoid 0:cb44e2e9ec4c 2886 case 'b': case 0x0b: return analogIn11;
whismanoid 0:cb44e2e9ec4c 2887 #endif
whismanoid 0:cb44e2e9ec4c 2888 #if HAS_analogIn12
whismanoid 0:cb44e2e9ec4c 2889 case 'c': case 0x0c: return analogIn12;
whismanoid 0:cb44e2e9ec4c 2890 #endif
whismanoid 0:cb44e2e9ec4c 2891 #if HAS_analogIn13
whismanoid 0:cb44e2e9ec4c 2892 case 'd': case 0x0d: return analogIn13;
whismanoid 0:cb44e2e9ec4c 2893 #endif
whismanoid 0:cb44e2e9ec4c 2894 #if HAS_analogIn14
whismanoid 0:cb44e2e9ec4c 2895 case 'e': case 0x0e: return analogIn14;
whismanoid 0:cb44e2e9ec4c 2896 #endif
whismanoid 0:cb44e2e9ec4c 2897 #if HAS_analogIn15
whismanoid 0:cb44e2e9ec4c 2898 case 'f': case 0x0f: return analogIn15;
whismanoid 0:cb44e2e9ec4c 2899 #endif
whismanoid 0:cb44e2e9ec4c 2900 }
whismanoid 0:cb44e2e9ec4c 2901 }
whismanoid 0:cb44e2e9ec4c 2902 #endif
whismanoid 0:cb44e2e9ec4c 2903
whismanoid 0:cb44e2e9ec4c 2904 #if HAS_analogIns
whismanoid 0:cb44e2e9ec4c 2905 const float analogInPin_fullScaleVoltage[] = {
whismanoid 0:cb44e2e9ec4c 2906 # if defined(TARGET_MAX32630)
whismanoid 0:cb44e2e9ec4c 2907 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 2908 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 2909 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 2910 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 2911 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2912 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2913 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn6 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2914 ADC_FULL_SCALE_VOLTAGE, // analogIn7 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2915 ADC_FULL_SCALE_VOLTAGE, // analogIn8 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2916 ADC_FULL_SCALE_VOLTAGE * 2.0f, // analogIn9 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 2917 ADC_FULL_SCALE_VOLTAGE, // analogIn10 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 2918 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn11 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2919 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn12 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2920 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 2921 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 2922 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 2923 # elif defined(TARGET_MAX32620FTHR)
whismanoid 0:cb44e2e9ec4c 2924 #warning "TARGET_MAX32620FTHR not previously tested; need to verify analogIn0..."
whismanoid 0:cb44e2e9ec4c 2925 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 2926 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 2927 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 2928 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 2929 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2930 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2931 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn6 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2932 ADC_FULL_SCALE_VOLTAGE, // analogIn7 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2933 ADC_FULL_SCALE_VOLTAGE, // analogIn8 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2934 ADC_FULL_SCALE_VOLTAGE * 2.0f, // analogIn9 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 2935 ADC_FULL_SCALE_VOLTAGE, // analogIn10 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 2936 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn11 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2937 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn12 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2938 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 2939 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 2940 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 19:5ff09c8e9daf 2941 #elif defined(TARGET_MAX32625MBED) || defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 0:cb44e2e9ec4c 2942 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn0 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2943 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn1 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2944 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn2 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2945 ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn3 // fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2946 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2947 ADC_FULL_SCALE_VOLTAGE * 5.0f, // analogIn4 // AIN_5 = AIN1 / 5.0 fullscale is 6.0V
whismanoid 0:cb44e2e9ec4c 2948 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn6 // AIN_6 = VDDB / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2949 ADC_FULL_SCALE_VOLTAGE, // analogIn7 // AIN_7 = VDD18 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2950 ADC_FULL_SCALE_VOLTAGE, // analogIn8 // AIN_8 = VDD12 fullscale is 1.2V
whismanoid 0:cb44e2e9ec4c 2951 ADC_FULL_SCALE_VOLTAGE * 2.0f, // analogIn9 // AIN_9 = VRTC / 2.0 fullscale is 2.4V
whismanoid 0:cb44e2e9ec4c 2952 ADC_FULL_SCALE_VOLTAGE, // analogIn10 // AIN_10 = x undefined?
whismanoid 0:cb44e2e9ec4c 2953 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn11 // AIN_11 = VDDIO / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2954 ADC_FULL_SCALE_VOLTAGE * 4.0f, // analogIn12 // AIN_12 = VDDIOH / 4.0 fullscale is 4.8V
whismanoid 0:cb44e2e9ec4c 2955 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 2956 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 2957 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 2958 #elif defined(TARGET_NUCLEO_F446RE)
whismanoid 0:cb44e2e9ec4c 2959 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 2960 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 2961 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 2962 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 2963 ADC_FULL_SCALE_VOLTAGE, // analogIn4
whismanoid 0:cb44e2e9ec4c 2964 ADC_FULL_SCALE_VOLTAGE, // analogIn5
whismanoid 0:cb44e2e9ec4c 2965 ADC_FULL_SCALE_VOLTAGE, // analogIn6
whismanoid 0:cb44e2e9ec4c 2966 ADC_FULL_SCALE_VOLTAGE, // analogIn7
whismanoid 0:cb44e2e9ec4c 2967 ADC_FULL_SCALE_VOLTAGE, // analogIn8
whismanoid 0:cb44e2e9ec4c 2968 ADC_FULL_SCALE_VOLTAGE, // analogIn9
whismanoid 0:cb44e2e9ec4c 2969 ADC_FULL_SCALE_VOLTAGE, // analogIn10
whismanoid 0:cb44e2e9ec4c 2970 ADC_FULL_SCALE_VOLTAGE, // analogIn11
whismanoid 0:cb44e2e9ec4c 2971 ADC_FULL_SCALE_VOLTAGE, // analogIn12
whismanoid 0:cb44e2e9ec4c 2972 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 2973 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 2974 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 2975 #elif defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 2976 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 2977 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 2978 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 2979 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 2980 ADC_FULL_SCALE_VOLTAGE, // analogIn4
whismanoid 0:cb44e2e9ec4c 2981 ADC_FULL_SCALE_VOLTAGE, // analogIn5
whismanoid 0:cb44e2e9ec4c 2982 ADC_FULL_SCALE_VOLTAGE, // analogIn6
whismanoid 0:cb44e2e9ec4c 2983 ADC_FULL_SCALE_VOLTAGE, // analogIn7
whismanoid 0:cb44e2e9ec4c 2984 ADC_FULL_SCALE_VOLTAGE, // analogIn8
whismanoid 0:cb44e2e9ec4c 2985 ADC_FULL_SCALE_VOLTAGE, // analogIn9
whismanoid 0:cb44e2e9ec4c 2986 ADC_FULL_SCALE_VOLTAGE, // analogIn10
whismanoid 0:cb44e2e9ec4c 2987 ADC_FULL_SCALE_VOLTAGE, // analogIn11
whismanoid 0:cb44e2e9ec4c 2988 ADC_FULL_SCALE_VOLTAGE, // analogIn12
whismanoid 0:cb44e2e9ec4c 2989 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 2990 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 2991 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 2992 //#elif defined(TARGET_LPC1768)
whismanoid 0:cb44e2e9ec4c 2993 #else
whismanoid 0:cb44e2e9ec4c 2994 // unknown target
whismanoid 0:cb44e2e9ec4c 2995 ADC_FULL_SCALE_VOLTAGE, // analogIn0
whismanoid 0:cb44e2e9ec4c 2996 ADC_FULL_SCALE_VOLTAGE, // analogIn1
whismanoid 0:cb44e2e9ec4c 2997 ADC_FULL_SCALE_VOLTAGE, // analogIn2
whismanoid 0:cb44e2e9ec4c 2998 ADC_FULL_SCALE_VOLTAGE, // analogIn3
whismanoid 0:cb44e2e9ec4c 2999 ADC_FULL_SCALE_VOLTAGE, // analogIn4
whismanoid 0:cb44e2e9ec4c 3000 ADC_FULL_SCALE_VOLTAGE, // analogIn5
whismanoid 0:cb44e2e9ec4c 3001 ADC_FULL_SCALE_VOLTAGE, // analogIn6
whismanoid 0:cb44e2e9ec4c 3002 ADC_FULL_SCALE_VOLTAGE, // analogIn7
whismanoid 0:cb44e2e9ec4c 3003 ADC_FULL_SCALE_VOLTAGE, // analogIn8
whismanoid 0:cb44e2e9ec4c 3004 ADC_FULL_SCALE_VOLTAGE, // analogIn9
whismanoid 0:cb44e2e9ec4c 3005 ADC_FULL_SCALE_VOLTAGE, // analogIn10
whismanoid 0:cb44e2e9ec4c 3006 ADC_FULL_SCALE_VOLTAGE, // analogIn11
whismanoid 0:cb44e2e9ec4c 3007 ADC_FULL_SCALE_VOLTAGE, // analogIn12
whismanoid 0:cb44e2e9ec4c 3008 ADC_FULL_SCALE_VOLTAGE, // analogIn13
whismanoid 0:cb44e2e9ec4c 3009 ADC_FULL_SCALE_VOLTAGE, // analogIn14
whismanoid 0:cb44e2e9ec4c 3010 ADC_FULL_SCALE_VOLTAGE // analogIn15
whismanoid 0:cb44e2e9ec4c 3011 # endif
whismanoid 0:cb44e2e9ec4c 3012 };
whismanoid 0:cb44e2e9ec4c 3013 #endif
whismanoid 0:cb44e2e9ec4c 3014
whismanoid 0:cb44e2e9ec4c 3015
whismanoid 0:cb44e2e9ec4c 3016
whismanoid 0:cb44e2e9ec4c 3017
whismanoid 0:cb44e2e9ec4c 3018 //--------------------------------------------------
whismanoid 45:74bf1fe021e5 3019 // support CmdLine command menus (like on Serial_Tester)
whismanoid 4:d9b05924ad4c 3020 #ifndef USE_CMDLINE_MENUS
whismanoid 4:d9b05924ad4c 3021 #define USE_CMDLINE_MENUS 1
whismanoid 4:d9b05924ad4c 3022 //~ #undef USE_CMDLINE_MENUS
whismanoid 4:d9b05924ad4c 3023 #endif
whismanoid 4:d9b05924ad4c 3024 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 3025 #include "CmdLine.h"
whismanoid 4:d9b05924ad4c 3026 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 3027 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 3028 extern CmdLine cmdLine; // declared later
whismanoid 4:d9b05924ad4c 3029 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 3030
whismanoid 4:d9b05924ad4c 3031 //--------------------------------------------------
whismanoid 39:4d285e961435 3032 // support sleep modes in Datalogger_Trigger
whismanoid 39:4d285e961435 3033 #ifndef USE_DATALOGGER_SLEEP
whismanoid 39:4d285e961435 3034 #define USE_DATALOGGER_SLEEP 1
whismanoid 39:4d285e961435 3035 //~ #undef USE_DATALOGGER_SLEEP
whismanoid 39:4d285e961435 3036 #endif
whismanoid 39:4d285e961435 3037 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 3038 // USE_DATALOGGER_SLEEP -- support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 3039 // USE_DATALOGGER_SLEEP -- #include "lp.h" -- LP_EnterLP1()
whismanoid 42:89607d5d4e6d 3040 #include "lp.h"
whismanoid 43:4c4733760d4c 3041 #include "rtc.h"
whismanoid 39:4d285e961435 3042 #endif
whismanoid 39:4d285e961435 3043 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 44:84402faa8eb9 3044 // wait until UART_Busy indicates no ongoing transactions (both ports)
whismanoid 44:84402faa8eb9 3045 #include "uart.h"
whismanoid 44:84402faa8eb9 3046 int Console_PrepForSleep(void)
whismanoid 44:84402faa8eb9 3047 {
whismanoid 44:84402faa8eb9 3048 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX40108DEMOP2U9: P0_1,P0_0 (J90.1/J90.0 to console)
whismanoid 44:84402faa8eb9 3049 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK)
whismanoid 44:84402faa8eb9 3050 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX40108DEMOP2U9: P3_1,P3_0 (unavailable)
whismanoid 44:84402faa8eb9 3051 return (
whismanoid 44:84402faa8eb9 3052 (UART_PrepForSleep(MXC_UART_GET_UART(0)) == E_NO_ERROR)
whismanoid 44:84402faa8eb9 3053 && (UART_PrepForSleep(MXC_UART_GET_UART(1)) == E_NO_ERROR)
whismanoid 44:84402faa8eb9 3054 )
whismanoid 44:84402faa8eb9 3055 ? E_NO_ERROR
whismanoid 44:84402faa8eb9 3056 : E_BUSY;
whismanoid 44:84402faa8eb9 3057 }
whismanoid 44:84402faa8eb9 3058 #endif // USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 44:84402faa8eb9 3059 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 39:4d285e961435 3060 typedef enum Datalogger_Sleep_enum_t {
whismanoid 39:4d285e961435 3061 datalogger_Sleep_LP0_Stop = 0,
whismanoid 39:4d285e961435 3062 datalogger_Sleep_LP1_DeepSleep = 1,
whismanoid 39:4d285e961435 3063 datalogger_Sleep_LP2_Sleep = 2,
whismanoid 39:4d285e961435 3064 datalogger_Sleep_LP3_Run = 3,
whismanoid 39:4d285e961435 3065 } Datalogger_Sleep_enum_t;
whismanoid 45:74bf1fe021e5 3066 // USE_DATALOGGER_SLEEP -- support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 3067 Datalogger_Sleep_enum_t g_timer_sleepmode = datalogger_Sleep_LP1_DeepSleep;
whismanoid 39:4d285e961435 3068 #endif
whismanoid 39:4d285e961435 3069
whismanoid 39:4d285e961435 3070 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 3071 // Datalog trigger types
whismanoid 4:d9b05924ad4c 3072 #ifndef USE_DATALOGGER_TRIGGER
whismanoid 4:d9b05924ad4c 3073 #define USE_DATALOGGER_TRIGGER 1
whismanoid 4:d9b05924ad4c 3074 //~ #undef USE_DATALOGGER_TRIGGER
whismanoid 4:d9b05924ad4c 3075 #endif
whismanoid 4:d9b05924ad4c 3076 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 4:d9b05924ad4c 3077 typedef enum Datalogger_Trigger_enum_t {
whismanoid 4:d9b05924ad4c 3078 trigger_Halt = 0, //!< halt
whismanoid 4:d9b05924ad4c 3079 trigger_FreeRun = 1, //!< free run as fast as possible
whismanoid 4:d9b05924ad4c 3080 trigger_Timer = 2, //!< timer (configure interval)
whismanoid 4:d9b05924ad4c 3081 trigger_PlatformDigitalInput, //!< platform digital input (configure digital input pin reference)
whismanoid 4:d9b05924ad4c 3082 trigger_SPIDeviceRegRead, //!< SPI device register read (configure regaddr, mask value, match value)
whismanoid 4:d9b05924ad4c 3083 } Datalogger_Trigger_enum_t;
whismanoid 4:d9b05924ad4c 3084 Datalogger_Trigger_enum_t Datalogger_Trigger = trigger_FreeRun;
whismanoid 17:9397ea3ea7e9 3085 //
whismanoid 17:9397ea3ea7e9 3086 // configuration for trigger_Timer
whismanoid 17:9397ea3ea7e9 3087 int g_timer_interval_msec = 500; // trigger_Timer
whismanoid 17:9397ea3ea7e9 3088 int g_timer_interval_count = 10; // trigger_Timer
whismanoid 17:9397ea3ea7e9 3089 int g_timer_interval_counter = 0; // trigger_Timer
whismanoid 17:9397ea3ea7e9 3090 //
whismanoid 17:9397ea3ea7e9 3091 // TODO: configuration for trigger_PlatformDigitalInput
whismanoid 17:9397ea3ea7e9 3092 //
whismanoid 17:9397ea3ea7e9 3093 // TODO: configuration for trigger_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 3094 //
whismanoid 4:d9b05924ad4c 3095 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 4:d9b05924ad4c 3096
whismanoid 4:d9b05924ad4c 3097 //--------------------------------------------------
whismanoid 17:9397ea3ea7e9 3098 // support trigger_SPIDeviceRegRead: Datalog when SPI read of address matches mask
whismanoid 17:9397ea3ea7e9 3099 #ifndef USE_DATALOGGER_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 3100 #define USE_DATALOGGER_SPIDeviceRegRead 0
whismanoid 17:9397ea3ea7e9 3101 #endif // USE_DATALOGGER_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 3102 #if USE_DATALOGGER_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 3103 // TODO: uint16_t regAddr;
whismanoid 17:9397ea3ea7e9 3104 // TODO: uint16_t regDataMask;
whismanoid 17:9397ea3ea7e9 3105 // TODO: uint16_t regDataTest;
whismanoid 17:9397ea3ea7e9 3106 #endif // USE_DATALOGGER_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 3107
whismanoid 17:9397ea3ea7e9 3108 //--------------------------------------------------
whismanoid 30:07197a430869 3109 // support Datalogger_PrintRow() print gstrRemarkText field from recent #remark
whismanoid 30:07197a430869 3110 #ifndef USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 3111 #define USE_DATALOGGER_REMARK_FIELD 1
whismanoid 30:07197a430869 3112 #endif // USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 3113 #if USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 3114 // Datalogger_PrintRow() print gstrRemarkText field from recent #remark
whismanoid 30:07197a430869 3115 const size_t gstrRemarkTextLASTINDEX = 40; // gstrRemarkText buffer size - 1
whismanoid 30:07197a430869 3116 char gstrRemarkText[gstrRemarkTextLASTINDEX+1] = "";
whismanoid 30:07197a430869 3117 char gstrRemarkHeader[] = "comment"; // comment or remark?
whismanoid 30:07197a430869 3118 #endif // USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 3119
whismanoid 30:07197a430869 3120 //--------------------------------------------------
whismanoid 17:9397ea3ea7e9 3121 // Datalogger_RunActionTable() supported actions
whismanoid 45:74bf1fe021e5 3122 // support command L@
whismanoid 45:74bf1fe021e5 3123 // configurable "business logic" for the data log
whismanoid 17:9397ea3ea7e9 3124 #ifndef USE_DATALOGGER_ActionTable
whismanoid 17:9397ea3ea7e9 3125 #define USE_DATALOGGER_ActionTable 1
whismanoid 17:9397ea3ea7e9 3126 //~ #undef USE_DATALOGGER_ActionTable
whismanoid 17:9397ea3ea7e9 3127 #endif
whismanoid 17:9397ea3ea7e9 3128 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 3129 //
whismanoid 17:9397ea3ea7e9 3130 // Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 3131 typedef enum action_type_enum_t {
whismanoid 17:9397ea3ea7e9 3132 action_noop = 0, // no operation
whismanoid 30:07197a430869 3133 action_digitalOutLow = 1, // pin = low if condition
whismanoid 30:07197a430869 3134 action_digitalOutHigh = 2, // pin = high if condition
whismanoid 30:07197a430869 3135 action_button = 3, // pin = button event index 1, 2, 3
whismanoid 30:07197a430869 3136 action_trigger_Halt = 4,
whismanoid 30:07197a430869 3137 action_trigger_FreeRun = 5,
whismanoid 30:07197a430869 3138 action_trigger_Timer = 6,
whismanoid 53:fdb510e3eb37 3139 action_trigger_PlatformDigitalInput = 7, // FUTURE
whismanoid 53:fdb510e3eb37 3140 action_trigger_SPIDeviceRegRead = 8, // FUTURE
whismanoid 17:9397ea3ea7e9 3141 } action_type_enum_t;
whismanoid 17:9397ea3ea7e9 3142 //
whismanoid 17:9397ea3ea7e9 3143 // Datalogger_RunActionTable() supported conditions
whismanoid 17:9397ea3ea7e9 3144 typedef enum action_condition_enum_t {
whismanoid 17:9397ea3ea7e9 3145 condition_always = 0, // ( true )
whismanoid 17:9397ea3ea7e9 3146 condition_if_An_gt_threshold, // (Platform_Voltage[channel] > threhsold)
whismanoid 17:9397ea3ea7e9 3147 condition_if_An_lt_threshold, // (Platform_Voltage[channel] < threhsold)
whismanoid 17:9397ea3ea7e9 3148 condition_if_An_eq_threshold, // (Platform_Voltage[channel] == threhsold)
whismanoid 17:9397ea3ea7e9 3149 condition_if_An_ge_threshold, // (Platform_Voltage[channel] >= threhsold)
whismanoid 17:9397ea3ea7e9 3150 condition_if_An_le_threshold, // (Platform_Voltage[channel] <= threhsold)
whismanoid 17:9397ea3ea7e9 3151 condition_if_An_ne_threshold, // (Platform_Voltage[channel] != threhsold)
whismanoid 17:9397ea3ea7e9 3152 condition_if_AINn_gt_threshold, // (SPI_AIN_Voltage[channel] > threhsold)
whismanoid 17:9397ea3ea7e9 3153 condition_if_AINn_lt_threshold, // (SPI_AIN_Voltage[channel] < threhsold)
whismanoid 17:9397ea3ea7e9 3154 condition_if_AINn_eq_threshold, // (SPI_AIN_Voltage[channel] == threhsold)
whismanoid 17:9397ea3ea7e9 3155 condition_if_AINn_ge_threshold, // (SPI_AIN_Voltage[channel] >= threhsold)
whismanoid 17:9397ea3ea7e9 3156 condition_if_AINn_le_threshold, // (SPI_AIN_Voltage[channel] <= threhsold)
whismanoid 17:9397ea3ea7e9 3157 condition_if_AINn_ne_threshold, // (SPI_AIN_Voltage[channel] != threhsold)
whismanoid 55:477ba09475d7 3158 // WIP Datalog Math -- if channel has its math enabled, compare with the math-adjusted version. Keep it simple. #362
whismanoid 17:9397ea3ea7e9 3159 } condition_enum_t;
whismanoid 17:9397ea3ea7e9 3160 //
whismanoid 17:9397ea3ea7e9 3161 // Datalogger_RunActionTable() structure
whismanoid 17:9397ea3ea7e9 3162 typedef struct action_table_row_t {
whismanoid 17:9397ea3ea7e9 3163 action_type_enum_t action;
whismanoid 17:9397ea3ea7e9 3164 int digitalOutPin;
whismanoid 17:9397ea3ea7e9 3165 action_condition_enum_t condition;
whismanoid 17:9397ea3ea7e9 3166 int condition_channel;
whismanoid 17:9397ea3ea7e9 3167 double condition_threshold;
whismanoid 17:9397ea3ea7e9 3168 } action_table_row_t;
whismanoid 17:9397ea3ea7e9 3169 #if MAX40108_DEMO
whismanoid 39:4d285e961435 3170 # ifdef BOARD_SERIAL_NUMBER
whismanoid 39:4d285e961435 3171 // data unique to certain boards based on serial number
whismanoid 39:4d285e961435 3172 // channels A0/A4(CSA*100/3.34=mA), A1/A5(1V0), A2(WE), A3(CE)
whismanoid 39:4d285e961435 3173 # if (BOARD_SERIAL_NUMBER) == 1
whismanoid 55:477ba09475d7 3174 #warning "info: (BOARD_SERIAL_NUMBER) == 1 -- logic uses A3(CE) instead of A2(WE)"
whismanoid 39:4d285e961435 3175 const int channel_WE = 3; // use channel_CE instead on proto board s/n 1 for diagnostics; easier to sweep values
whismanoid 39:4d285e961435 3176 # elif (BOARD_SERIAL_NUMBER) == 5
whismanoid 55:477ba09475d7 3177 #warning "info: (BOARD_SERIAL_NUMBER) == 5 -- 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 # else // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 17:9397ea3ea7e9 3180 const int channel_WE = 2;
whismanoid 39:4d285e961435 3181 # endif
whismanoid 39:4d285e961435 3182 # endif // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 17:9397ea3ea7e9 3183 const double threshold_WE_0V5 = 0.5;
whismanoid 17:9397ea3ea7e9 3184 const double threshold_WE_0V6 = 0.6;
whismanoid 17:9397ea3ea7e9 3185 const double threshold_WE_0V7 = 0.7;
whismanoid 18:1235c17b451e 3186 const int pin_LED_1 = 91; // support find_digitalInOutPin(91) return DigitalInOut of led1_RFailLED
whismanoid 18:1235c17b451e 3187 const int pin_LED_2 = 92; // support find_digitalInOutPin(92) return DigitalInOut of led2_GPassLED
whismanoid 18:1235c17b451e 3188 const int pin_LED_3 = 93; // support find_digitalInOutPin(93) return DigitalInOut of led3_BBusyLED
whismanoid 17:9397ea3ea7e9 3189 #endif
whismanoid 17:9397ea3ea7e9 3190 const int ACTION_TABLE_ROW_MAX = 20;
whismanoid 17:9397ea3ea7e9 3191 #if MAX40108_DEMO
whismanoid 17:9397ea3ea7e9 3192 bool Datalogger_action_table_enabled = true;
whismanoid 45:74bf1fe021e5 3193 int Datalogger_action_table_row_count = 10; // assert (Datalogger_action_table_row_count <= ACTION_TABLE_ROW_MAX)
whismanoid 17:9397ea3ea7e9 3194 #else // MAX40108_DEMO
whismanoid 17:9397ea3ea7e9 3195 int Datalogger_action_table_row_count = 0;
whismanoid 17:9397ea3ea7e9 3196 #endif // MAX40108_DEMO
whismanoid 45:74bf1fe021e5 3197 // configurable "business logic" for the data log
whismanoid 17:9397ea3ea7e9 3198 action_table_row_t Datalogger_action_table[ACTION_TABLE_ROW_MAX] = {
whismanoid 17:9397ea3ea7e9 3199 #if MAX40108_DEMO
whismanoid 45:74bf1fe021e5 3200 //
whismanoid 45:74bf1fe021e5 3201 // LED1 indicator on if (WE > 0.85V)
whismanoid 45:74bf1fe021e5 3202 // L@0 act=1 pin=91 if=1 ch=3 x=0.8500 -- digitalOutLow D91 if A3 > 0.85
whismanoid 45:74bf1fe021e5 3203 {action_digitalOutLow, pin_LED_1, condition_if_An_gt_threshold, channel_WE, 0.85},
whismanoid 45:74bf1fe021e5 3204 //
whismanoid 45:74bf1fe021e5 3205 // LED1 indicator off if (WE < 0.80V)
whismanoid 45:74bf1fe021e5 3206 // L@1 act=2 pin=91 if=2 ch=3 x=0.8000 -- digitalOutHigh D91 if A3 < 0.80
whismanoid 45:74bf1fe021e5 3207 {action_digitalOutHigh, pin_LED_1, condition_if_An_lt_threshold, channel_WE, 0.80},
whismanoid 45:74bf1fe021e5 3208 //
whismanoid 45:74bf1fe021e5 3209 // LED2 indicator on if (WE > 0.75V)
whismanoid 45:74bf1fe021e5 3210 // L@2 act=1 pin=92 if=1 ch=3 x=0.7500 -- digitalOutLow D92 if A3 > 0.75
whismanoid 45:74bf1fe021e5 3211 {action_digitalOutLow, pin_LED_2, condition_if_An_gt_threshold, channel_WE, 0.75},
whismanoid 17:9397ea3ea7e9 3212 //
whismanoid 45:74bf1fe021e5 3213 // LED2 indicator off if (WE < 0.70V)
whismanoid 45:74bf1fe021e5 3214 // L@3 act=2 pin=92 if=2 ch=3 x=0.7000 -- digitalOutHigh D92 if A3 < 0.70
whismanoid 45:74bf1fe021e5 3215 {action_digitalOutHigh, pin_LED_2, condition_if_An_lt_threshold, channel_WE, 0.70},
whismanoid 17:9397ea3ea7e9 3216 //
whismanoid 45:74bf1fe021e5 3217 // LED3 indicator on if (WE > 0.65V)
whismanoid 45:74bf1fe021e5 3218 // L@4 act=1 pin=93 if=1 ch=3 x=0.6500 -- digitalOutLow D93 if A3 > 0.65
whismanoid 45:74bf1fe021e5 3219 {action_digitalOutLow, pin_LED_3, condition_if_An_gt_threshold, channel_WE, 0.65},
whismanoid 45:74bf1fe021e5 3220 //
whismanoid 45:74bf1fe021e5 3221 // LED3 indicator off if (WE < 0.60V)
whismanoid 45:74bf1fe021e5 3222 // L@5 act=2 pin=93 if=2 ch=3 x=0.6000 -- digitalOutHigh D93 if A3 < 0.60
whismanoid 45:74bf1fe021e5 3223 {action_digitalOutHigh, pin_LED_3, condition_if_An_lt_threshold, channel_WE, 0.60},
whismanoid 45:74bf1fe021e5 3224 //
whismanoid 45:74bf1fe021e5 3225 // Free run if (WE > 0.70V)
whismanoid 45:74bf1fe021e5 3226 // L@6 act=5 if=1 ch=3 x=0.7000 -- LR if A3 > 0.70
whismanoid 17:9397ea3ea7e9 3227 {action_trigger_FreeRun, 0, condition_if_An_gt_threshold, channel_WE, threshold_WE_0V7},
whismanoid 17:9397ea3ea7e9 3228 //
whismanoid 45:74bf1fe021e5 3229 // Deep Sleep if (WE < 0.60V)
whismanoid 45:74bf1fe021e5 3230 // L@7 act=6 if=2 ch=3 x=0.6000 -- LT count=10 base=1000ms sleep=1 if A3 < 0.60
whismanoid 17:9397ea3ea7e9 3231 {action_trigger_Timer, 0, condition_if_An_lt_threshold, channel_WE, threshold_WE_0V6},
whismanoid 18:1235c17b451e 3232 //
whismanoid 45:74bf1fe021e5 3233 // Free run if (WE > 0.70V)
whismanoid 45:74bf1fe021e5 3234 // L@8 act=3 pin=4 if=1 ch=3 x=0.7000 -- button %B4! if A3 > 0.70
whismanoid 30:07197a430869 3235 {action_button, 4, condition_if_An_gt_threshold, channel_WE, threshold_WE_0V7},
whismanoid 29:6a9edb6e973b 3236 //
whismanoid 45:74bf1fe021e5 3237 // Deep Sleep if (WE < 0.60V)
whismanoid 45:74bf1fe021e5 3238 // L@9 act=3 pin=5 if=2 ch=3 x=0.6000 -- button %B5! if A3 < 0.60
whismanoid 30:07197a430869 3239 {action_button, 5, condition_if_An_lt_threshold, channel_WE, threshold_WE_0V6},
whismanoid 29:6a9edb6e973b 3240 //
whismanoid 17:9397ea3ea7e9 3241 #endif // MAX40108_DEMO
whismanoid 17:9397ea3ea7e9 3242 //
whismanoid 17:9397ea3ea7e9 3243 {action_noop, 0, condition_always, 0, 0},
whismanoid 17:9397ea3ea7e9 3244 };
whismanoid 17:9397ea3ea7e9 3245 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 3246
whismanoid 17:9397ea3ea7e9 3247 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 3248 // print column header banner for csv data columns
whismanoid 8:dffee7509bfb 3249 uint8_t Datalogger_Need_PrintHeader = true;
whismanoid 9:45f98573eb6d 3250 uint8_t need_reinit = true;
whismanoid 8:dffee7509bfb 3251 void Datalogger_PrintHeader(CmdLine& cmdLine);
whismanoid 5:aaf8b5f5fda1 3252 void Datalogger_AcquireRow();
whismanoid 17:9397ea3ea7e9 3253 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 3254 // TODO: Datalogger_RunActionTable() between Datalogger_AcquireRow() and Datalogger_PrintRow()
whismanoid 17:9397ea3ea7e9 3255 void Datalogger_RunActionTable();
whismanoid 17:9397ea3ea7e9 3256 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 8:dffee7509bfb 3257 void Datalogger_PrintRow(CmdLine& cmdLine);
whismanoid 4:d9b05924ad4c 3258
whismanoid 4:d9b05924ad4c 3259 //--------------------------------------------------
whismanoid 51:a41d3fd5e441 3260 // MAX32625 flash peek/poke support (MAX40108 demo) #312 - forward declarations for flash_page_configuration_back_up
whismanoid 51:a41d3fd5e441 3261 extern int Platform_AIN_Average_N; // forward declaration
whismanoid 51:a41d3fd5e441 3262 //
whismanoid 51:a41d3fd5e441 3263 extern const int COMMAND_TABLE_COL_MAX; // forward declaration
whismanoid 51:a41d3fd5e441 3264 extern char onButton1_command_table_00[];
whismanoid 51:a41d3fd5e441 3265 extern char onButton1_command_table_01[];
whismanoid 51:a41d3fd5e441 3266 extern char onButton1_command_table_02[];
whismanoid 51:a41d3fd5e441 3267 extern char onButton1_command_table_03[];
whismanoid 51:a41d3fd5e441 3268 extern char onButton1_command_table_04[];
whismanoid 51:a41d3fd5e441 3269 extern char onButton1_command_table_05[];
whismanoid 51:a41d3fd5e441 3270 extern char onButton1_command_table_06[];
whismanoid 51:a41d3fd5e441 3271 extern char onButton1_command_table_07[];
whismanoid 51:a41d3fd5e441 3272 extern char onButton1_command_table_08[];
whismanoid 51:a41d3fd5e441 3273 extern char onButton1_command_table_09[];
whismanoid 51:a41d3fd5e441 3274 //
whismanoid 51:a41d3fd5e441 3275 extern char onButton2_command_table_00[];
whismanoid 51:a41d3fd5e441 3276 extern char onButton2_command_table_01[];
whismanoid 51:a41d3fd5e441 3277 extern char onButton2_command_table_02[];
whismanoid 51:a41d3fd5e441 3278 extern char onButton2_command_table_03[];
whismanoid 51:a41d3fd5e441 3279 extern char onButton2_command_table_04[];
whismanoid 51:a41d3fd5e441 3280 extern char onButton2_command_table_05[];
whismanoid 51:a41d3fd5e441 3281 extern char onButton2_command_table_06[];
whismanoid 51:a41d3fd5e441 3282 extern char onButton2_command_table_07[];
whismanoid 51:a41d3fd5e441 3283 extern char onButton2_command_table_08[];
whismanoid 51:a41d3fd5e441 3284 extern char onButton2_command_table_09[];
whismanoid 51:a41d3fd5e441 3285 //
whismanoid 51:a41d3fd5e441 3286 extern char onButton3_command_table_00[];
whismanoid 51:a41d3fd5e441 3287 extern char onButton3_command_table_01[];
whismanoid 51:a41d3fd5e441 3288 extern char onButton3_command_table_02[];
whismanoid 51:a41d3fd5e441 3289 extern char onButton3_command_table_03[];
whismanoid 51:a41d3fd5e441 3290 extern char onButton3_command_table_04[];
whismanoid 51:a41d3fd5e441 3291 extern char onButton3_command_table_05[];
whismanoid 51:a41d3fd5e441 3292 extern char onButton3_command_table_06[];
whismanoid 51:a41d3fd5e441 3293 extern char onButton3_command_table_07[];
whismanoid 51:a41d3fd5e441 3294 extern char onButton3_command_table_08[];
whismanoid 51:a41d3fd5e441 3295 extern char onButton3_command_table_09[];
whismanoid 51:a41d3fd5e441 3296 //
whismanoid 51:a41d3fd5e441 3297 extern char onButton4_command_table_00[];
whismanoid 51:a41d3fd5e441 3298 extern char onButton4_command_table_01[];
whismanoid 51:a41d3fd5e441 3299 extern char onButton4_command_table_02[];
whismanoid 51:a41d3fd5e441 3300 extern char onButton4_command_table_03[];
whismanoid 51:a41d3fd5e441 3301 extern char onButton4_command_table_04[];
whismanoid 51:a41d3fd5e441 3302 extern char onButton4_command_table_05[];
whismanoid 51:a41d3fd5e441 3303 extern char onButton4_command_table_06[];
whismanoid 51:a41d3fd5e441 3304 extern char onButton4_command_table_07[];
whismanoid 51:a41d3fd5e441 3305 extern char onButton4_command_table_08[];
whismanoid 51:a41d3fd5e441 3306 extern char onButton4_command_table_09[];
whismanoid 51:a41d3fd5e441 3307 //
whismanoid 51:a41d3fd5e441 3308 extern char onButton5_command_table_00[];
whismanoid 51:a41d3fd5e441 3309 extern char onButton5_command_table_01[];
whismanoid 51:a41d3fd5e441 3310 extern char onButton5_command_table_02[];
whismanoid 51:a41d3fd5e441 3311 extern char onButton5_command_table_03[];
whismanoid 51:a41d3fd5e441 3312 extern char onButton5_command_table_04[];
whismanoid 51:a41d3fd5e441 3313 extern char onButton5_command_table_05[];
whismanoid 51:a41d3fd5e441 3314 extern char onButton5_command_table_06[];
whismanoid 51:a41d3fd5e441 3315 extern char onButton5_command_table_07[];
whismanoid 51:a41d3fd5e441 3316 extern char onButton5_command_table_08[];
whismanoid 51:a41d3fd5e441 3317 extern char onButton5_command_table_09[];
whismanoid 51:a41d3fd5e441 3318 //
whismanoid 51:a41d3fd5e441 3319 extern char onButton6_command_table_00[];
whismanoid 51:a41d3fd5e441 3320 extern char onButton6_command_table_01[];
whismanoid 51:a41d3fd5e441 3321 extern char onButton6_command_table_02[];
whismanoid 51:a41d3fd5e441 3322 extern char onButton6_command_table_03[];
whismanoid 51:a41d3fd5e441 3323 extern char onButton6_command_table_04[];
whismanoid 51:a41d3fd5e441 3324 extern char onButton6_command_table_05[];
whismanoid 51:a41d3fd5e441 3325 extern char onButton6_command_table_06[];
whismanoid 51:a41d3fd5e441 3326 extern char onButton6_command_table_07[];
whismanoid 51:a41d3fd5e441 3327 extern char onButton6_command_table_08[];
whismanoid 51:a41d3fd5e441 3328 extern char onButton6_command_table_09[];
whismanoid 51:a41d3fd5e441 3329 //
whismanoid 51:a41d3fd5e441 3330 extern char onButton7_command_table_00[];
whismanoid 51:a41d3fd5e441 3331 extern char onButton7_command_table_01[];
whismanoid 51:a41d3fd5e441 3332 extern char onButton7_command_table_02[];
whismanoid 51:a41d3fd5e441 3333 extern char onButton7_command_table_03[];
whismanoid 51:a41d3fd5e441 3334 extern char onButton7_command_table_04[];
whismanoid 51:a41d3fd5e441 3335 extern char onButton7_command_table_05[];
whismanoid 51:a41d3fd5e441 3336 extern char onButton7_command_table_06[];
whismanoid 51:a41d3fd5e441 3337 extern char onButton7_command_table_07[];
whismanoid 51:a41d3fd5e441 3338 extern char onButton7_command_table_08[];
whismanoid 51:a41d3fd5e441 3339 extern char onButton7_command_table_09[];
whismanoid 51:a41d3fd5e441 3340 //
whismanoid 51:a41d3fd5e441 3341 extern char onButton8_command_table_00[];
whismanoid 51:a41d3fd5e441 3342 extern char onButton8_command_table_01[];
whismanoid 51:a41d3fd5e441 3343 extern char onButton8_command_table_02[];
whismanoid 51:a41d3fd5e441 3344 extern char onButton8_command_table_03[];
whismanoid 51:a41d3fd5e441 3345 extern char onButton8_command_table_04[];
whismanoid 51:a41d3fd5e441 3346 extern char onButton8_command_table_05[];
whismanoid 51:a41d3fd5e441 3347 extern char onButton8_command_table_06[];
whismanoid 51:a41d3fd5e441 3348 extern char onButton8_command_table_07[];
whismanoid 51:a41d3fd5e441 3349 extern char onButton8_command_table_08[];
whismanoid 51:a41d3fd5e441 3350 extern char onButton8_command_table_09[];
whismanoid 51:a41d3fd5e441 3351 //
whismanoid 51:a41d3fd5e441 3352 extern char onButton9_command_table_00[];
whismanoid 51:a41d3fd5e441 3353 extern char onButton9_command_table_01[];
whismanoid 51:a41d3fd5e441 3354 extern char onButton9_command_table_02[];
whismanoid 51:a41d3fd5e441 3355 extern char onButton9_command_table_03[];
whismanoid 51:a41d3fd5e441 3356 extern char onButton9_command_table_04[];
whismanoid 51:a41d3fd5e441 3357 extern char onButton9_command_table_05[];
whismanoid 51:a41d3fd5e441 3358 extern char onButton9_command_table_06[];
whismanoid 51:a41d3fd5e441 3359 extern char onButton9_command_table_07[];
whismanoid 51:a41d3fd5e441 3360 extern char onButton9_command_table_08[];
whismanoid 51:a41d3fd5e441 3361 extern char onButton9_command_table_09[];
whismanoid 51:a41d3fd5e441 3362 //
whismanoid 55:477ba09475d7 3363 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 3364 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_customChannelHeader_ch forward declaration
whismanoid 55:477ba09475d7 3365 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 3366 //
whismanoid 55:477ba09475d7 3367 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 3368 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_AIN_customChannelHeader_ch forward declaration
whismanoid 55:477ba09475d7 3369 extern char Platform_AIN_customChannelHeader_ch0[];
whismanoid 55:477ba09475d7 3370 extern char Platform_AIN_customChannelHeader_ch1[];
whismanoid 55:477ba09475d7 3371 extern char Platform_AIN_customChannelHeader_ch2[];
whismanoid 55:477ba09475d7 3372 extern char Platform_AIN_customChannelHeader_ch3[];
whismanoid 55:477ba09475d7 3373 extern char Platform_AIN_customChannelHeader_ch4[];
whismanoid 55:477ba09475d7 3374 extern char Platform_AIN_customChannelHeader_ch5[];
whismanoid 55:477ba09475d7 3375 extern double Platform_MathOffsetA[];
whismanoid 55:477ba09475d7 3376 extern double Platform_MathGainMulA[];
whismanoid 55:477ba09475d7 3377 extern double Platform_MathGainDivA[];
whismanoid 55:477ba09475d7 3378 extern char Platform_MathUnitString_ch0[];
whismanoid 55:477ba09475d7 3379 extern char Platform_MathUnitString_ch1[];
whismanoid 55:477ba09475d7 3380 extern char Platform_MathUnitString_ch2[];
whismanoid 55:477ba09475d7 3381 extern char Platform_MathUnitString_ch3[];
whismanoid 55:477ba09475d7 3382 extern char Platform_MathUnitString_ch4[];
whismanoid 55:477ba09475d7 3383 extern char Platform_MathUnitString_ch5[];
whismanoid 55:477ba09475d7 3384 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 3385 //
whismanoid 46:469d0061df5d 3386 // MAX32625 flash peek/poke support (MAX40108 demo) #312
whismanoid 46:469d0061df5d 3387 #if HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 3388 // WIP #312 flash_page_configuration_back_up[] records map to variables
whismanoid 46:469d0061df5d 3389 typedef struct {
whismanoid 46:469d0061df5d 3390 uint32_t recordType; // unique record type for each variable, 0 end of list, -1 blank record
whismanoid 46:469d0061df5d 3391 void* addr;
whismanoid 51:a41d3fd5e441 3392 uint32_t length_bytes; // must be multiple of 4 bytes
whismanoid 46:469d0061df5d 3393 const char* name;
whismanoid 46:469d0061df5d 3394 } configuration_back_up_t;
whismanoid 51:a41d3fd5e441 3395 // WIP #312 unique recordType key values are defined by configuration_back_up_list[]
whismanoid 46:469d0061df5d 3396 configuration_back_up_t configuration_back_up_list[] = {
whismanoid 55:477ba09475d7 3397 { flash_blank_ff, NULL, 0, "blank" }, // Ignore 0xFFFFFFFF blank records
whismanoid 47:f1a56afb4aca 3398 //
whismanoid 47:f1a56afb4aca 3399 #ifdef BOARD_SERIAL_NUMBER
whismanoid 47:f1a56afb4aca 3400 // WIP #312 flash load/save g_board_serial_number BOARD_SERIAL_NUMBER
whismanoid 55:477ba09475d7 3401 { flash_g_board_serial_number, &g_board_serial_number, sizeof(g_board_serial_number), "g_board_serial_number" },
whismanoid 47:f1a56afb4aca 3402 #endif // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 47:f1a56afb4aca 3403 // WIP #312 flash load/save board ID string message
whismanoid 47:f1a56afb4aca 3404 //
whismanoid 55:477ba09475d7 3405 { flash_calibration_05_V0, &calibration_05_V[0], sizeof(calibration_05_V[0]), "calibration_05_V[0]" },
whismanoid 55:477ba09475d7 3406 { flash_calibration_05_V1, &calibration_05_V[1], sizeof(calibration_05_V[1]), "calibration_05_V[1]" },
whismanoid 55:477ba09475d7 3407 { flash_calibration_05_V2, &calibration_05_V[2], sizeof(calibration_05_V[2]), "calibration_05_V[2]" },
whismanoid 55:477ba09475d7 3408 { flash_calibration_05_V3, &calibration_05_V[3], sizeof(calibration_05_V[3]), "calibration_05_V[3]" },
whismanoid 55:477ba09475d7 3409 { flash_calibration_05_V4, &calibration_05_V[4], sizeof(calibration_05_V[4]), "calibration_05_V[4]" },
whismanoid 55:477ba09475d7 3410 { flash_calibration_05_V5, &calibration_05_V[5], sizeof(calibration_05_V[5]), "calibration_05_V[5]" },
whismanoid 55:477ba09475d7 3411 { 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 3412 { 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 3413 { 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 3414 { 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 3415 { 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 3416 { 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 3417 { flash_calibration_95_V0, &calibration_95_V[0], sizeof(calibration_95_V[0]), "calibration_95_V[0]" },
whismanoid 55:477ba09475d7 3418 { flash_calibration_95_V1, &calibration_95_V[1], sizeof(calibration_95_V[1]), "calibration_95_V[1]" },
whismanoid 55:477ba09475d7 3419 { flash_calibration_95_V2, &calibration_95_V[2], sizeof(calibration_95_V[2]), "calibration_95_V[2]" },
whismanoid 55:477ba09475d7 3420 { flash_calibration_95_V3, &calibration_95_V[3], sizeof(calibration_95_V[3]), "calibration_95_V[3]" },
whismanoid 55:477ba09475d7 3421 { flash_calibration_95_V4, &calibration_95_V[4], sizeof(calibration_95_V[4]), "calibration_95_V[4]" },
whismanoid 55:477ba09475d7 3422 { flash_calibration_95_V5, &calibration_95_V[5], sizeof(calibration_95_V[5]), "calibration_95_V[5]" },
whismanoid 55:477ba09475d7 3423 { 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 3424 { 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 3425 { 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 3426 { 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 3427 { 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 3428 { 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 3429 //
whismanoid 51:a41d3fd5e441 3430 // forward declaration
whismanoid 55:477ba09475d7 3431 { flash_Platform_AIN_Average_N, &Platform_AIN_Average_N, sizeof(Platform_AIN_Average_N), "Platform_AIN_Average_N" },
whismanoid 51:a41d3fd5e441 3432 //
whismanoid 46:469d0061df5d 3433 // WIP #312 @L Datalogger_action_table_row_count
whismanoid 55:477ba09475d7 3434 { 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 3435 // WIP #312 @L Datalogger_action_table_enabled - only 1 byte, write will fail
whismanoid 55:477ba09475d7 3436 // { 0x01000353, &Datalogger_action_table_enabled, sizeof(Datalogger_action_table_enabled), "Datalogger_action_table_enabled" },
whismanoid 46:469d0061df5d 3437 // WIP #312 @L Datalogger_action_table[0] __ bytes
whismanoid 55:477ba09475d7 3438 { flash_Datalogger_action_table, &Datalogger_action_table, sizeof(Datalogger_action_table), "Datalogger_action_table" },
whismanoid 55:477ba09475d7 3439 //{ 0x08____53, &Datalogger_action_table[1], sizeof(Datalogger_action_table[1]), "Datalogger_action_table[1]" },
whismanoid 47:f1a56afb4aca 3440 //
whismanoid 51:a41d3fd5e441 3441 // forward declaration
whismanoid 51:a41d3fd5e441 3442 // WIP #312 %B onButton1_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3443 { flash_onButton1_command_table_00, &onButton1_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_00" },
whismanoid 55:477ba09475d7 3444 { flash_onButton1_command_table_01, &onButton1_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_01" },
whismanoid 55:477ba09475d7 3445 { flash_onButton1_command_table_02, &onButton1_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_02" },
whismanoid 55:477ba09475d7 3446 { flash_onButton1_command_table_03, &onButton1_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_03" },
whismanoid 55:477ba09475d7 3447 { flash_onButton1_command_table_04, &onButton1_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_04" },
whismanoid 55:477ba09475d7 3448 { flash_onButton1_command_table_05, &onButton1_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_05" },
whismanoid 55:477ba09475d7 3449 { flash_onButton1_command_table_06, &onButton1_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_06" },
whismanoid 55:477ba09475d7 3450 { flash_onButton1_command_table_07, &onButton1_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_07" },
whismanoid 55:477ba09475d7 3451 { flash_onButton1_command_table_08, &onButton1_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_08" },
whismanoid 55:477ba09475d7 3452 { flash_onButton1_command_table_09, &onButton1_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton1_command_table_09" },
whismanoid 51:a41d3fd5e441 3453 // WIP #312 %B onButton2_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3454 { flash_onButton2_command_table_00, &onButton2_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_00" },
whismanoid 55:477ba09475d7 3455 { flash_onButton2_command_table_01, &onButton2_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_01" },
whismanoid 55:477ba09475d7 3456 { flash_onButton2_command_table_02, &onButton2_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_02" },
whismanoid 55:477ba09475d7 3457 { flash_onButton2_command_table_03, &onButton2_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_03" },
whismanoid 55:477ba09475d7 3458 { flash_onButton2_command_table_04, &onButton2_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_04" },
whismanoid 55:477ba09475d7 3459 { flash_onButton2_command_table_05, &onButton2_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_05" },
whismanoid 55:477ba09475d7 3460 { flash_onButton2_command_table_06, &onButton2_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_06" },
whismanoid 55:477ba09475d7 3461 { flash_onButton2_command_table_07, &onButton2_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_07" },
whismanoid 55:477ba09475d7 3462 { flash_onButton2_command_table_08, &onButton2_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_08" },
whismanoid 55:477ba09475d7 3463 { flash_onButton2_command_table_09, &onButton2_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton2_command_table_09" },
whismanoid 51:a41d3fd5e441 3464 // WIP #312 %B onButton3_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3465 { flash_onButton3_command_table_00, &onButton3_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_00" },
whismanoid 55:477ba09475d7 3466 { flash_onButton3_command_table_01, &onButton3_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_01" },
whismanoid 55:477ba09475d7 3467 { flash_onButton3_command_table_02, &onButton3_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_02" },
whismanoid 55:477ba09475d7 3468 { flash_onButton3_command_table_03, &onButton3_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_03" },
whismanoid 55:477ba09475d7 3469 { flash_onButton3_command_table_04, &onButton3_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_04" },
whismanoid 55:477ba09475d7 3470 { flash_onButton3_command_table_05, &onButton3_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_05" },
whismanoid 55:477ba09475d7 3471 { flash_onButton3_command_table_06, &onButton3_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_06" },
whismanoid 55:477ba09475d7 3472 { flash_onButton3_command_table_07, &onButton3_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_07" },
whismanoid 55:477ba09475d7 3473 { flash_onButton3_command_table_08, &onButton3_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_08" },
whismanoid 55:477ba09475d7 3474 { flash_onButton3_command_table_09, &onButton3_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton3_command_table_09" },
whismanoid 51:a41d3fd5e441 3475 // WIP #312 %B onButton4_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3476 { flash_onButton4_command_table_00, &onButton4_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_00" },
whismanoid 55:477ba09475d7 3477 { flash_onButton4_command_table_01, &onButton4_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_01" },
whismanoid 55:477ba09475d7 3478 { flash_onButton4_command_table_02, &onButton4_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_02" },
whismanoid 55:477ba09475d7 3479 { flash_onButton4_command_table_03, &onButton4_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_03" },
whismanoid 55:477ba09475d7 3480 { flash_onButton4_command_table_04, &onButton4_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_04" },
whismanoid 55:477ba09475d7 3481 { flash_onButton4_command_table_05, &onButton4_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_05" },
whismanoid 55:477ba09475d7 3482 { flash_onButton4_command_table_06, &onButton4_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_06" },
whismanoid 55:477ba09475d7 3483 { flash_onButton4_command_table_07, &onButton4_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_07" },
whismanoid 55:477ba09475d7 3484 { flash_onButton4_command_table_08, &onButton4_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_08" },
whismanoid 55:477ba09475d7 3485 { flash_onButton4_command_table_09, &onButton4_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton4_command_table_09" },
whismanoid 51:a41d3fd5e441 3486 // WIP #312 %B onButton5_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3487 { flash_onButton5_command_table_00, &onButton5_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_00" },
whismanoid 55:477ba09475d7 3488 { flash_onButton5_command_table_01, &onButton5_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_01" },
whismanoid 55:477ba09475d7 3489 { flash_onButton5_command_table_02, &onButton5_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_02" },
whismanoid 55:477ba09475d7 3490 { flash_onButton5_command_table_03, &onButton5_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_03" },
whismanoid 55:477ba09475d7 3491 { flash_onButton5_command_table_04, &onButton5_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_04" },
whismanoid 55:477ba09475d7 3492 { flash_onButton5_command_table_05, &onButton5_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_05" },
whismanoid 55:477ba09475d7 3493 { flash_onButton5_command_table_06, &onButton5_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_06" },
whismanoid 55:477ba09475d7 3494 { flash_onButton5_command_table_07, &onButton5_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_07" },
whismanoid 55:477ba09475d7 3495 { flash_onButton5_command_table_08, &onButton5_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_08" },
whismanoid 55:477ba09475d7 3496 { flash_onButton5_command_table_09, &onButton5_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton5_command_table_09" },
whismanoid 51:a41d3fd5e441 3497 // WIP #312 %B onButton6_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3498 { flash_onButton6_command_table_00, &onButton6_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_00" },
whismanoid 55:477ba09475d7 3499 { flash_onButton6_command_table_01, &onButton6_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_01" },
whismanoid 55:477ba09475d7 3500 { flash_onButton6_command_table_02, &onButton6_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_02" },
whismanoid 55:477ba09475d7 3501 { flash_onButton6_command_table_03, &onButton6_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_03" },
whismanoid 55:477ba09475d7 3502 { flash_onButton6_command_table_04, &onButton6_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_04" },
whismanoid 55:477ba09475d7 3503 { flash_onButton6_command_table_05, &onButton6_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_05" },
whismanoid 55:477ba09475d7 3504 { flash_onButton6_command_table_06, &onButton6_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_06" },
whismanoid 55:477ba09475d7 3505 { flash_onButton6_command_table_07, &onButton6_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_07" },
whismanoid 55:477ba09475d7 3506 { flash_onButton6_command_table_08, &onButton6_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_08" },
whismanoid 55:477ba09475d7 3507 { flash_onButton6_command_table_09, &onButton6_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton6_command_table_09" },
whismanoid 51:a41d3fd5e441 3508 // WIP #312 %B onButton7_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3509 { flash_onButton7_command_table_00, &onButton7_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_00" },
whismanoid 55:477ba09475d7 3510 { flash_onButton7_command_table_01, &onButton7_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_01" },
whismanoid 55:477ba09475d7 3511 { flash_onButton7_command_table_02, &onButton7_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_02" },
whismanoid 55:477ba09475d7 3512 { flash_onButton7_command_table_03, &onButton7_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_03" },
whismanoid 55:477ba09475d7 3513 { flash_onButton7_command_table_04, &onButton7_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_04" },
whismanoid 55:477ba09475d7 3514 { flash_onButton7_command_table_05, &onButton7_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_05" },
whismanoid 55:477ba09475d7 3515 { flash_onButton7_command_table_06, &onButton7_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_06" },
whismanoid 55:477ba09475d7 3516 { flash_onButton7_command_table_07, &onButton7_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_07" },
whismanoid 55:477ba09475d7 3517 { flash_onButton7_command_table_08, &onButton7_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_08" },
whismanoid 55:477ba09475d7 3518 { flash_onButton7_command_table_09, &onButton7_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton7_command_table_09" },
whismanoid 51:a41d3fd5e441 3519 // WIP #312 %B onButton8_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3520 { flash_onButton8_command_table_00, &onButton8_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_00" },
whismanoid 55:477ba09475d7 3521 { flash_onButton8_command_table_01, &onButton8_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_01" },
whismanoid 55:477ba09475d7 3522 { flash_onButton8_command_table_02, &onButton8_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_02" },
whismanoid 55:477ba09475d7 3523 { flash_onButton8_command_table_03, &onButton8_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_03" },
whismanoid 55:477ba09475d7 3524 { flash_onButton8_command_table_04, &onButton8_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_04" },
whismanoid 55:477ba09475d7 3525 { flash_onButton8_command_table_05, &onButton8_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_05" },
whismanoid 55:477ba09475d7 3526 { flash_onButton8_command_table_06, &onButton8_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_06" },
whismanoid 55:477ba09475d7 3527 { flash_onButton8_command_table_07, &onButton8_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_07" },
whismanoid 55:477ba09475d7 3528 { flash_onButton8_command_table_08, &onButton8_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_08" },
whismanoid 55:477ba09475d7 3529 { flash_onButton8_command_table_09, &onButton8_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton8_command_table_09" },
whismanoid 51:a41d3fd5e441 3530 // WIP #312 %B onButton9_command_table_00[0] __ bytes -- string
whismanoid 55:477ba09475d7 3531 { flash_onButton9_command_table_00, &onButton9_command_table_00, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_00" },
whismanoid 55:477ba09475d7 3532 { flash_onButton9_command_table_01, &onButton9_command_table_01, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_01" },
whismanoid 55:477ba09475d7 3533 { flash_onButton9_command_table_02, &onButton9_command_table_02, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_02" },
whismanoid 55:477ba09475d7 3534 { flash_onButton9_command_table_03, &onButton9_command_table_03, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_03" },
whismanoid 55:477ba09475d7 3535 { flash_onButton9_command_table_04, &onButton9_command_table_04, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_04" },
whismanoid 55:477ba09475d7 3536 { flash_onButton9_command_table_05, &onButton9_command_table_05, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_05" },
whismanoid 55:477ba09475d7 3537 { flash_onButton9_command_table_06, &onButton9_command_table_06, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_06" },
whismanoid 55:477ba09475d7 3538 { flash_onButton9_command_table_07, &onButton9_command_table_07, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_07" },
whismanoid 55:477ba09475d7 3539 { flash_onButton9_command_table_08, &onButton9_command_table_08, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_08" },
whismanoid 55:477ba09475d7 3540 { flash_onButton9_command_table_09, &onButton9_command_table_09, (uint32_t)COMMAND_TABLE_COL_MAX, "onButton9_command_table_09" },
whismanoid 46:469d0061df5d 3541 // WIP #312 %B onButton9_command_table[0] __ bytes
whismanoid 47:f1a56afb4aca 3542 //
whismanoid 55:477ba09475d7 3543 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 3544 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_MathOffsetA
whismanoid 55:477ba09475d7 3545 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_MathGainMulA
whismanoid 55:477ba09475d7 3546 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_AIN_MathGainDivA
whismanoid 55:477ba09475d7 3547 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- SPI_MathUnitString
whismanoid 55:477ba09475d7 3548 //
whismanoid 55:477ba09475d7 3549 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 3550 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 3551 // { 0x08070053, &Platform_AIN_customChannelHeader_ch, sizeof(Platform_AIN_customChannelHeader_ch), "Platform_AIN_customChannelHeader_ch" },
whismanoid 55:477ba09475d7 3552 { flash_Platform_AIN_customChannelHeader_ch0, &Platform_AIN_customChannelHeader_ch0, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_AIN_customChannelHeader_ch0" },
whismanoid 55:477ba09475d7 3553 //
whismanoid 55:477ba09475d7 3554 { flash_Platform_AIN_customChannelHeader_ch1, &Platform_AIN_customChannelHeader_ch1, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_AIN_customChannelHeader_ch1" },
whismanoid 55:477ba09475d7 3555 { flash_Platform_AIN_customChannelHeader_ch2, &Platform_AIN_customChannelHeader_ch2, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_AIN_customChannelHeader_ch2" },
whismanoid 55:477ba09475d7 3556 { flash_Platform_AIN_customChannelHeader_ch3, &Platform_AIN_customChannelHeader_ch3, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_AIN_customChannelHeader_ch3" },
whismanoid 55:477ba09475d7 3557 { flash_Platform_AIN_customChannelHeader_ch4, &Platform_AIN_customChannelHeader_ch4, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_AIN_customChannelHeader_ch4" },
whismanoid 55:477ba09475d7 3558 { flash_Platform_AIN_customChannelHeader_ch5, &Platform_AIN_customChannelHeader_ch5, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_AIN_customChannelHeader_ch5" },
whismanoid 55:477ba09475d7 3559 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathOffsetA
whismanoid 55:477ba09475d7 3560 { flash_Platform_MathOffsetA0, &Platform_MathOffsetA[0], sizeof(Platform_MathOffsetA[0]), "Platform_MathOffsetA[0]" },
whismanoid 55:477ba09475d7 3561 { flash_Platform_MathOffsetA1, &Platform_MathOffsetA[1], sizeof(Platform_MathOffsetA[1]), "Platform_MathOffsetA[1]" },
whismanoid 55:477ba09475d7 3562 { flash_Platform_MathOffsetA2, &Platform_MathOffsetA[2], sizeof(Platform_MathOffsetA[2]), "Platform_MathOffsetA[2]" },
whismanoid 55:477ba09475d7 3563 { flash_Platform_MathOffsetA3, &Platform_MathOffsetA[3], sizeof(Platform_MathOffsetA[3]), "Platform_MathOffsetA[3]" },
whismanoid 55:477ba09475d7 3564 { flash_Platform_MathOffsetA4, &Platform_MathOffsetA[4], sizeof(Platform_MathOffsetA[4]), "Platform_MathOffsetA[4]" },
whismanoid 55:477ba09475d7 3565 { flash_Platform_MathOffsetA5, &Platform_MathOffsetA[5], sizeof(Platform_MathOffsetA[5]), "Platform_MathOffsetA[5]" },
whismanoid 55:477ba09475d7 3566 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathGainMulA
whismanoid 55:477ba09475d7 3567 { flash_Platform_MathGainMulA0, &Platform_MathGainMulA[0], sizeof(Platform_MathGainMulA[0]), "Platform_MathGainMulA[0]" },
whismanoid 55:477ba09475d7 3568 { flash_Platform_MathGainMulA1, &Platform_MathGainMulA[1], sizeof(Platform_MathGainMulA[1]), "Platform_MathGainMulA[1]" },
whismanoid 55:477ba09475d7 3569 { flash_Platform_MathGainMulA2, &Platform_MathGainMulA[2], sizeof(Platform_MathGainMulA[2]), "Platform_MathGainMulA[2]" },
whismanoid 55:477ba09475d7 3570 { flash_Platform_MathGainMulA3, &Platform_MathGainMulA[3], sizeof(Platform_MathGainMulA[3]), "Platform_MathGainMulA[3]" },
whismanoid 55:477ba09475d7 3571 { flash_Platform_MathGainMulA4, &Platform_MathGainMulA[4], sizeof(Platform_MathGainMulA[4]), "Platform_MathGainMulA[4]" },
whismanoid 55:477ba09475d7 3572 { flash_Platform_MathGainMulA5, &Platform_MathGainMulA[5], sizeof(Platform_MathGainMulA[5]), "Platform_MathGainMulA[5]" },
whismanoid 55:477ba09475d7 3573 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathGainDivA
whismanoid 55:477ba09475d7 3574 { flash_Platform_MathGainDivA0, &Platform_MathGainDivA[0], sizeof(Platform_MathGainDivA[0]), "Platform_MathGainDivA[0]" },
whismanoid 55:477ba09475d7 3575 { flash_Platform_MathGainDivA1, &Platform_MathGainDivA[1], sizeof(Platform_MathGainDivA[1]), "Platform_MathGainDivA[1]" },
whismanoid 55:477ba09475d7 3576 { flash_Platform_MathGainDivA2, &Platform_MathGainDivA[2], sizeof(Platform_MathGainDivA[2]), "Platform_MathGainDivA[2]" },
whismanoid 55:477ba09475d7 3577 { flash_Platform_MathGainDivA3, &Platform_MathGainDivA[3], sizeof(Platform_MathGainDivA[3]), "Platform_MathGainDivA[3]" },
whismanoid 55:477ba09475d7 3578 { flash_Platform_MathGainDivA4, &Platform_MathGainDivA[4], sizeof(Platform_MathGainDivA[4]), "Platform_MathGainDivA[4]" },
whismanoid 55:477ba09475d7 3579 { flash_Platform_MathGainDivA5, &Platform_MathGainDivA[5], sizeof(Platform_MathGainDivA[5]), "Platform_MathGainDivA[5]" },
whismanoid 55:477ba09475d7 3580 // MAX32625 flash peek/poke support (MAX40108 demo) #312 #363 -- Platform_MathUnitString
whismanoid 55:477ba09475d7 3581 // { 0x08070453, &Platform_MathUnitString, sizeof(Platform_MathUnitString), "Platform_MathUnitString" },
whismanoid 55:477ba09475d7 3582 { flash_Platform_MathUnitString_ch0, &Platform_MathUnitString_ch0, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_MathUnitString_ch0" },
whismanoid 55:477ba09475d7 3583 { flash_Platform_MathUnitString_ch1, &Platform_MathUnitString_ch1, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_MathUnitString_ch1" },
whismanoid 55:477ba09475d7 3584 { flash_Platform_MathUnitString_ch2, &Platform_MathUnitString_ch2, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_MathUnitString_ch2" },
whismanoid 55:477ba09475d7 3585 { flash_Platform_MathUnitString_ch3, &Platform_MathUnitString_ch3, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_MathUnitString_ch3" },
whismanoid 55:477ba09475d7 3586 { flash_Platform_MathUnitString_ch4, &Platform_MathUnitString_ch4, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_MathUnitString_ch4" },
whismanoid 55:477ba09475d7 3587 { flash_Platform_MathUnitString_ch5, &Platform_MathUnitString_ch5, (uint32_t)Platform_AIN_customChannelHeader_MAXLENGTH, "Platform_MathUnitString_ch5" },
whismanoid 55:477ba09475d7 3588 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 3589 //
whismanoid 55:477ba09475d7 3590 // MAX32625 flash peek/poke support (MAX40108 demo) #312 -- more items could be added here
whismanoid 55:477ba09475d7 3591 { flash_wiped_00, NULL, 0, "wiped" }, // Ignore 0x00000000 wiped records; end of table
whismanoid 46:469d0061df5d 3592 };
whismanoid 48:18647e0516f2 3593 const uint32_t save_arg_01_pageErase = 0x00000001; // page erase and rewrite
whismanoid 48:18647e0516f2 3594 const uint32_t load_arg_01_brief = 0x00000001; // brief list loaded values
whismanoid 48:18647e0516f2 3595 const uint32_t save_arg_02_verbose = 0x00000002; // verbose diagnostic messages
whismanoid 48:18647e0516f2 3596 const uint32_t save_arg_04_reserved = 0x00000004; // reserved
whismanoid 48:18647e0516f2 3597 const uint32_t save_arg_08_reserved = 0x00000008; // reserved
whismanoid 48:18647e0516f2 3598 const uint32_t save_arg_10_calibration = 0x00000010; // save board ID and calibration
whismanoid 48:18647e0516f2 3599 const uint32_t save_arg_20_action_table = 0x00000020; // save Datalogger_action_table
whismanoid 48:18647e0516f2 3600 const uint32_t save_arg_40_command_table = 0x00000040; // save onButtonX_command_table
whismanoid 48:18647e0516f2 3601 const uint32_t save_arg_80_reserved = 0x00000080; // reserved
whismanoid 55:477ba09475d7 3602 const uint32_t save_arg_100_reserved = 0x00000100; // reserved
whismanoid 55:477ba09475d7 3603 const uint32_t save_arg_200_reserved = 0x00000200; // reserved
whismanoid 55:477ba09475d7 3604 const uint32_t save_arg_400_reserved = 0x00000400; // reserved
whismanoid 55:477ba09475d7 3605 const uint32_t save_arg_800_reserved = 0x00000800; // reserved
whismanoid 55:477ba09475d7 3606 const uint32_t save_arg_1000_reserved = 0x000001000; // reserved
whismanoid 55:477ba09475d7 3607 const uint32_t save_arg_2000_reserved = 0x000002000; // reserved
whismanoid 55:477ba09475d7 3608 const uint32_t save_arg_4000_reserved = 0x000004000; // reserved
whismanoid 55:477ba09475d7 3609 const uint32_t save_arg_8000_reserved = 0x000008000; // reserved
whismanoid 48:18647e0516f2 3610 const uint32_t save_arg_default = 0
whismanoid 48:18647e0516f2 3611 | save_arg_01_pageErase
whismanoid 48:18647e0516f2 3612 // | save_arg_02_verbose
whismanoid 48:18647e0516f2 3613 // | save_arg_04_reserved
whismanoid 48:18647e0516f2 3614 // | save_arg_08_reserved
whismanoid 48:18647e0516f2 3615 | save_arg_10_calibration
whismanoid 48:18647e0516f2 3616 | save_arg_20_action_table
whismanoid 48:18647e0516f2 3617 | save_arg_40_command_table
whismanoid 48:18647e0516f2 3618 // | save_arg_80_reserved
whismanoid 55:477ba09475d7 3619 // | save_arg_100_reserved
whismanoid 55:477ba09475d7 3620 // | save_arg_200_reserved
whismanoid 55:477ba09475d7 3621 // | save_arg_400_reserved
whismanoid 55:477ba09475d7 3622 // | save_arg_800_reserved
whismanoid 55:477ba09475d7 3623 // | save_arg_1000_reserved
whismanoid 55:477ba09475d7 3624 // | save_arg_2000_reserved
whismanoid 55:477ba09475d7 3625 // | save_arg_4000_reserved
whismanoid 55:477ba09475d7 3626 // | save_arg_8000_reserved
whismanoid 48:18647e0516f2 3627 ;
whismanoid 48:18647e0516f2 3628 const uint32_t load_arg_default = 0
whismanoid 48:18647e0516f2 3629 | load_arg_01_brief
whismanoid 48:18647e0516f2 3630 | save_arg_02_verbose
whismanoid 48:18647e0516f2 3631 // | save_arg_04_reserved
whismanoid 48:18647e0516f2 3632 // | save_arg_08_reserved
whismanoid 48:18647e0516f2 3633 | save_arg_10_calibration
whismanoid 48:18647e0516f2 3634 | save_arg_20_action_table
whismanoid 48:18647e0516f2 3635 | save_arg_40_command_table
whismanoid 48:18647e0516f2 3636 // | save_arg_80_reserved
whismanoid 55:477ba09475d7 3637 // | save_arg_100_reserved
whismanoid 55:477ba09475d7 3638 // | save_arg_200_reserved
whismanoid 55:477ba09475d7 3639 // | save_arg_400_reserved
whismanoid 55:477ba09475d7 3640 // | save_arg_800_reserved
whismanoid 55:477ba09475d7 3641 // | save_arg_1000_reserved
whismanoid 55:477ba09475d7 3642 // | save_arg_2000_reserved
whismanoid 55:477ba09475d7 3643 // | save_arg_4000_reserved
whismanoid 55:477ba09475d7 3644 // | save_arg_8000_reserved
whismanoid 48:18647e0516f2 3645 ;
whismanoid 48:18647e0516f2 3646 const uint32_t load_arg_startup = 0
whismanoid 54:ba36cb18504f 3647 // | load_arg_01_brief
whismanoid 48:18647e0516f2 3648 // | save_arg_02_verbose
whismanoid 48:18647e0516f2 3649 // | save_arg_04_reserved
whismanoid 48:18647e0516f2 3650 // | save_arg_08_reserved
whismanoid 48:18647e0516f2 3651 | save_arg_10_calibration
whismanoid 48:18647e0516f2 3652 | save_arg_20_action_table
whismanoid 48:18647e0516f2 3653 | save_arg_40_command_table
whismanoid 48:18647e0516f2 3654 // | save_arg_80_reserved
whismanoid 55:477ba09475d7 3655 // | save_arg_100_reserved
whismanoid 55:477ba09475d7 3656 // | save_arg_200_reserved
whismanoid 55:477ba09475d7 3657 // | save_arg_400_reserved
whismanoid 55:477ba09475d7 3658 // | save_arg_800_reserved
whismanoid 55:477ba09475d7 3659 // | save_arg_1000_reserved
whismanoid 55:477ba09475d7 3660 // | save_arg_2000_reserved
whismanoid 55:477ba09475d7 3661 // | save_arg_4000_reserved
whismanoid 55:477ba09475d7 3662 // | save_arg_8000_reserved
whismanoid 48:18647e0516f2 3663 ;
whismanoid 46:469d0061df5d 3664 // WIP #312 store values into flash_page_configuration_back_up[] from calibration_05_V[] etc. Default save everything.
whismanoid 48:18647e0516f2 3665 // @param[in] save_arg %F save=0x00000001 = page erase and rewrite, else append in next available blank space within page
whismanoid 48:18647e0516f2 3666 // @param[in] save_arg %F save=0x00000002 = verbose diagnostic messages
whismanoid 48:18647e0516f2 3667 // @param[in] save_arg %F save=0x00000004 = reserved
whismanoid 48:18647e0516f2 3668 // @param[in] save_arg %F save=0x00000008 = reserved
whismanoid 48:18647e0516f2 3669 // @param[in] save_arg %F save=0x00000010 = save board ID and calibration
whismanoid 48:18647e0516f2 3670 // @param[in] save_arg %F save=0x00000020 = save Datalogger_action_table
whismanoid 48:18647e0516f2 3671 // @param[in] save_arg %F save=0x00000040 = save onButtonX_command_table
whismanoid 48:18647e0516f2 3672 // @param[in] save_arg %F save=0x00000080 = reserved
whismanoid 46:469d0061df5d 3673 int Save_flash_page_configuration_back_up(CmdLine& cmdLine, uint32_t save_arg)
whismanoid 46:469d0061df5d 3674 {
whismanoid 48:18647e0516f2 3675 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3676 {
whismanoid 48:18647e0516f2 3677 cmdLine.serial().printf("\r\nSave_flash_page_configuration_back_up(0x%8.8lx)...", save_arg);
whismanoid 48:18647e0516f2 3678 }
whismanoid 48:18647e0516f2 3679 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3680 {
whismanoid 48:18647e0516f2 3681 // @param[in] save_arg %F save=0x00000002 = verbose diagnostic messages
whismanoid 52:bb09c0f452ec 3682 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 3683 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 3684 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 3685 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 3686 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 3687 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 3688 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 3689 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 3690 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 3691 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 3692 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 3693 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 3694 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 3695 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 3696 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 3697 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 3698 }
whismanoid 46:469d0061df5d 3699 // WIP #312 %F save=save_arg could filter which items to append to flash file
whismanoid 46:469d0061df5d 3700 // initialize flash memory interface
whismanoid 46:469d0061df5d 3701 // FlashIAP: FlashIAP flash; flash.init();
whismanoid 46:469d0061df5d 3702 // int FLC_Init(void);
whismanoid 46:469d0061df5d 3703 // returns E_NO_ERROR or E_BUSY or E_UNKNOWN
whismanoid 48:18647e0516f2 3704 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3705 {
whismanoid 48:18647e0516f2 3706 cmdLine.serial().printf("FLC_Init ");
whismanoid 48:18647e0516f2 3707 }
whismanoid 46:469d0061df5d 3708 if (FLC_Init() != E_NO_ERROR)
whismanoid 46:469d0061df5d 3709 {
whismanoid 48:18647e0516f2 3710 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3711 {
whismanoid 48:18647e0516f2 3712 cmdLine.serial().printf("FAIL ");
whismanoid 48:18647e0516f2 3713 }
whismanoid 46:469d0061df5d 3714 return 1; // can't perform the command
whismanoid 46:469d0061df5d 3715 }
whismanoid 48:18647e0516f2 3716 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3717 {
whismanoid 48:18647e0516f2 3718 cmdLine.serial().printf("PASS ");
whismanoid 48:18647e0516f2 3719 }
whismanoid 46:469d0061df5d 3720 //
whismanoid 46:469d0061df5d 3721
whismanoid 52:bb09c0f452ec 3722 const uint32_t file_addr_start = (uint32_t)&flash_page_configuration_back_up[0];
whismanoid 52:bb09c0f452ec 3723 const uint32_t file_addr_end = file_addr_start + 8192 - 4; // last record at 0x00027ff0
whismanoid 52:bb09c0f452ec 3724 // uint32_t file_addr_end = file_addr_start + 256 - 4; // development: reduce listing size
whismanoid 52:bb09c0f452ec 3725 uint32_t file_addr = file_addr_start;
whismanoid 46:469d0061df5d 3726
whismanoid 46:469d0061df5d 3727 int poke_access_list_index = search_poke_access_list(file_addr);
whismanoid 48:18647e0516f2 3728 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3729 {
whismanoid 48:18647e0516f2 3730 cmdLine.serial().printf("\r\npoke_access_list[%d] %5s 0x%8.8lx - 0x%8.8lx access %x ",
whismanoid 48:18647e0516f2 3731 poke_access_list_index,
whismanoid 48:18647e0516f2 3732 poke_access_list[poke_access_list_index].name,
whismanoid 48:18647e0516f2 3733 poke_access_list[poke_access_list_index].addr_min,
whismanoid 48:18647e0516f2 3734 poke_access_list[poke_access_list_index].addr_max,
whismanoid 48:18647e0516f2 3735 poke_access_list[poke_access_list_index].can_flash_write_read);
whismanoid 48:18647e0516f2 3736 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, file_addr);
whismanoid 48:18647e0516f2 3737 }
whismanoid 46:469d0061df5d 3738
whismanoid 48:18647e0516f2 3739 if ((save_arg & save_arg_01_pageErase) != 0)
whismanoid 46:469d0061df5d 3740 {
whismanoid 48:18647e0516f2 3741 // @param[in] save_arg %F save=0x00000001 = page erase and rewrite, else append in next available blank space within page
whismanoid 46:469d0061df5d 3742 // erase flash file before saving configuration
whismanoid 46:469d0061df5d 3743 //
whismanoid 46:469d0061df5d 3744 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: erase page ...",
whismanoid 46:469d0061df5d 3745 poke_access_list[poke_access_list_index].name, file_addr);
whismanoid 46:469d0061df5d 3746 // page erase using flash.erase(addr, flash.get_sector_size(addr));
whismanoid 46:469d0061df5d 3747 // int FLC_PageErase(uint32_t address, MXC_V_FLC_ERASE_CODE_PAGE_ERASE, MXC_V_FLC_FLSH_UNLOCK_KEY);
whismanoid 46:469d0061df5d 3748 // @param address Address of the page to be erased.
whismanoid 46:469d0061df5d 3749 // @param erase_code Flash erase code; defined as
whismanoid 46:469d0061df5d 3750 // #MXC_V_FLC_ERASE_CODE_PAGE_ERASE for page erase
whismanoid 46:469d0061df5d 3751 // @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY.
whismanoid 46:469d0061df5d 3752 // returns E_NO_ERROR or else
whismanoid 46:469d0061df5d 3753 if (FLC_PageErase(file_addr, MXC_V_FLC_ERASE_CODE_PAGE_ERASE,
whismanoid 46:469d0061df5d 3754 MXC_V_FLC_FLSH_UNLOCK_KEY) != E_NO_ERROR)
whismanoid 46:469d0061df5d 3755 {
whismanoid 46:469d0061df5d 3756 cmdLine.serial().printf("FAIL ");
whismanoid 46:469d0061df5d 3757 return 1; // can't perform the command
whismanoid 46:469d0061df5d 3758 }
whismanoid 46:469d0061df5d 3759 cmdLine.serial().printf("PASS ");
whismanoid 46:469d0061df5d 3760 }
whismanoid 48:18647e0516f2 3761 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3762 {
whismanoid 48:18647e0516f2 3763 // @param[in] save_arg %F save=0x00000002 = verbose diagnostic messages
whismanoid 48:18647e0516f2 3764 }
whismanoid 48:18647e0516f2 3765 if ((save_arg & save_arg_04_reserved) != 0)
whismanoid 48:18647e0516f2 3766 {
whismanoid 48:18647e0516f2 3767 // @param[in] save_arg %F save=0x00000004 = reserved
whismanoid 48:18647e0516f2 3768 }
whismanoid 48:18647e0516f2 3769 if ((save_arg & save_arg_08_reserved) != 0)
whismanoid 48:18647e0516f2 3770 {
whismanoid 48:18647e0516f2 3771 // @param[in] save_arg %F save=0x00000008 = reserved
whismanoid 48:18647e0516f2 3772 }
whismanoid 48:18647e0516f2 3773 if ((save_arg & save_arg_10_calibration) != 0)
whismanoid 48:18647e0516f2 3774 {
whismanoid 48:18647e0516f2 3775 // @param[in] save_arg %F save=0x00000010 = save board ID and calibration
whismanoid 48:18647e0516f2 3776 }
whismanoid 48:18647e0516f2 3777 if ((save_arg & save_arg_20_action_table) != 0)
whismanoid 48:18647e0516f2 3778 {
whismanoid 48:18647e0516f2 3779 // @param[in] save_arg %F save=0x00000020 = save Datalogger_action_table
whismanoid 48:18647e0516f2 3780 }
whismanoid 48:18647e0516f2 3781 if ((save_arg & save_arg_40_command_table) != 0)
whismanoid 48:18647e0516f2 3782 {
whismanoid 48:18647e0516f2 3783 // @param[in] save_arg %F save=0x00000040 = save onButtonX_command_table
whismanoid 48:18647e0516f2 3784 }
whismanoid 48:18647e0516f2 3785 if ((save_arg & save_arg_80_reserved) != 0)
whismanoid 48:18647e0516f2 3786 {
whismanoid 48:18647e0516f2 3787 // @param[in] save_arg %F save=0x00000080 = reserved
whismanoid 48:18647e0516f2 3788 }
whismanoid 55:477ba09475d7 3789 if ((save_arg & save_arg_100_reserved) != 0)
whismanoid 55:477ba09475d7 3790 {
whismanoid 55:477ba09475d7 3791 }
whismanoid 55:477ba09475d7 3792 if ((save_arg & save_arg_200_reserved) != 0)
whismanoid 55:477ba09475d7 3793 {
whismanoid 55:477ba09475d7 3794 }
whismanoid 55:477ba09475d7 3795 if ((save_arg & save_arg_400_reserved) != 0)
whismanoid 55:477ba09475d7 3796 {
whismanoid 55:477ba09475d7 3797 }
whismanoid 55:477ba09475d7 3798 if ((save_arg & save_arg_800_reserved) != 0)
whismanoid 55:477ba09475d7 3799 {
whismanoid 55:477ba09475d7 3800 }
whismanoid 55:477ba09475d7 3801 if ((save_arg & save_arg_1000_reserved) != 0)
whismanoid 55:477ba09475d7 3802 {
whismanoid 55:477ba09475d7 3803 }
whismanoid 55:477ba09475d7 3804 if ((save_arg & save_arg_2000_reserved) != 0)
whismanoid 55:477ba09475d7 3805 {
whismanoid 55:477ba09475d7 3806 }
whismanoid 55:477ba09475d7 3807 if ((save_arg & save_arg_4000_reserved) != 0)
whismanoid 55:477ba09475d7 3808 {
whismanoid 55:477ba09475d7 3809 }
whismanoid 55:477ba09475d7 3810 if ((save_arg & save_arg_8000_reserved) != 0)
whismanoid 55:477ba09475d7 3811 {
whismanoid 55:477ba09475d7 3812 }
whismanoid 48:18647e0516f2 3813
whismanoid 48:18647e0516f2 3814 // address of next 16-byte-aligned record start address
whismanoid 48:18647e0516f2 3815 uint32_t file_addr_next = (file_addr + 16) &~ 0x0000000F;
whismanoid 46:469d0061df5d 3816
whismanoid 46:469d0061df5d 3817 // scan configuration_back_up_list[] for recordType
whismanoid 46:469d0061df5d 3818 for (int i = 0; configuration_back_up_list[i].recordType != 0x00000000; i++)
whismanoid 46:469d0061df5d 3819 {
whismanoid 48:18647e0516f2 3820 file_addr_next = (file_addr + 16) &~ 0x0000000F;
whismanoid 46:469d0061df5d 3821 if (configuration_back_up_list[i].recordType == 0xFFFFFFFF) continue;
whismanoid 46:469d0061df5d 3822 //
whismanoid 46:469d0061df5d 3823 // configuration_back_up_list[i].recordType
whismanoid 46:469d0061df5d 3824 // configuration_back_up_list[i].addr
whismanoid 46:469d0061df5d 3825 // configuration_back_up_list[i].length_bytes
whismanoid 46:469d0061df5d 3826 // configuration_back_up_list[i].name
whismanoid 46:469d0061df5d 3827 // WIP #312 %F save=save_arg could filter which items to append to flash file
whismanoid 46:469d0061df5d 3828 //
whismanoid 48:18647e0516f2 3829 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 3830 {
whismanoid 48:18647e0516f2 3831 cmdLine.serial().printf("\r\n save 0x%8.8lx %s address 0x%8.8lx length 0x%lx bytes",
whismanoid 48:18647e0516f2 3832 configuration_back_up_list[i].recordType,
whismanoid 48:18647e0516f2 3833 configuration_back_up_list[i].name,
whismanoid 48:18647e0516f2 3834 (uint32_t)configuration_back_up_list[i].addr,
whismanoid 48:18647e0516f2 3835 configuration_back_up_list[i].length_bytes);
whismanoid 48:18647e0516f2 3836 }
whismanoid 46:469d0061df5d 3837 //
whismanoid 52:bb09c0f452ec 3838 if ((save_arg & save_arg_10_calibration) != 0)
whismanoid 52:bb09c0f452ec 3839 {
whismanoid 52:bb09c0f452ec 3840 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 52:bb09c0f452ec 3841 // @param[in] save_arg %F save=0x00000010 = save board ID and calibration
whismanoid 52:bb09c0f452ec 3842 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 52:bb09c0f452ec 3843 // print " skip";
whismanoid 52:bb09c0f452ec 3844 // }
whismanoid 52:bb09c0f452ec 3845 }
whismanoid 52:bb09c0f452ec 3846 if ((save_arg & save_arg_20_action_table) != 0)
whismanoid 52:bb09c0f452ec 3847 {
whismanoid 52:bb09c0f452ec 3848 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 52:bb09c0f452ec 3849 // @param[in] save_arg %F save=0x00000020 = save Datalogger_action_table
whismanoid 52:bb09c0f452ec 3850 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 52:bb09c0f452ec 3851 // print " skip";
whismanoid 52:bb09c0f452ec 3852 // }
whismanoid 52:bb09c0f452ec 3853 }
whismanoid 52:bb09c0f452ec 3854 if ((save_arg & save_arg_40_command_table) != 0)
whismanoid 52:bb09c0f452ec 3855 {
whismanoid 52:bb09c0f452ec 3856 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 52:bb09c0f452ec 3857 // @param[in] save_arg %F save=0x00000040 = save onButtonX_command_table
whismanoid 52:bb09c0f452ec 3858 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 52:bb09c0f452ec 3859 // print " skip";
whismanoid 52:bb09c0f452ec 3860 // }
whismanoid 52:bb09c0f452ec 3861 }
whismanoid 52:bb09c0f452ec 3862 if ((save_arg & save_arg_80_reserved) != 0)
whismanoid 52:bb09c0f452ec 3863 {
whismanoid 52:bb09c0f452ec 3864 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 52:bb09c0f452ec 3865 // @param[in] save_arg %F save=0x00000080 = reserved
whismanoid 52:bb09c0f452ec 3866 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 52:bb09c0f452ec 3867 // print " skip";
whismanoid 52:bb09c0f452ec 3868 // }
whismanoid 52:bb09c0f452ec 3869 }
whismanoid 55:477ba09475d7 3870 if ((save_arg & save_arg_100_reserved) != 0)
whismanoid 55:477ba09475d7 3871 {
whismanoid 55:477ba09475d7 3872 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3873 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3874 // print " skip";
whismanoid 55:477ba09475d7 3875 // }
whismanoid 55:477ba09475d7 3876 }
whismanoid 55:477ba09475d7 3877 if ((save_arg & save_arg_200_reserved) != 0)
whismanoid 55:477ba09475d7 3878 {
whismanoid 55:477ba09475d7 3879 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3880 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3881 // print " skip";
whismanoid 55:477ba09475d7 3882 // }
whismanoid 55:477ba09475d7 3883 }
whismanoid 55:477ba09475d7 3884 if ((save_arg & save_arg_400_reserved) != 0)
whismanoid 55:477ba09475d7 3885 {
whismanoid 55:477ba09475d7 3886 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3887 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3888 // print " skip";
whismanoid 55:477ba09475d7 3889 // }
whismanoid 55:477ba09475d7 3890 }
whismanoid 55:477ba09475d7 3891 if ((save_arg & save_arg_800_reserved) != 0)
whismanoid 55:477ba09475d7 3892 {
whismanoid 55:477ba09475d7 3893 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3894 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3895 // print " skip";
whismanoid 55:477ba09475d7 3896 // }
whismanoid 55:477ba09475d7 3897 }
whismanoid 55:477ba09475d7 3898 if ((save_arg & save_arg_1000_reserved) != 0)
whismanoid 55:477ba09475d7 3899 {
whismanoid 55:477ba09475d7 3900 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3901 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3902 // print " skip";
whismanoid 55:477ba09475d7 3903 // }
whismanoid 55:477ba09475d7 3904 }
whismanoid 55:477ba09475d7 3905 if ((save_arg & save_arg_2000_reserved) != 0)
whismanoid 55:477ba09475d7 3906 {
whismanoid 55:477ba09475d7 3907 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3908 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3909 // print " skip";
whismanoid 55:477ba09475d7 3910 // }
whismanoid 55:477ba09475d7 3911 }
whismanoid 55:477ba09475d7 3912 if ((save_arg & save_arg_4000_reserved) != 0)
whismanoid 55:477ba09475d7 3913 {
whismanoid 55:477ba09475d7 3914 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3915 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3916 // print " skip";
whismanoid 55:477ba09475d7 3917 // }
whismanoid 55:477ba09475d7 3918 }
whismanoid 55:477ba09475d7 3919 if ((save_arg & save_arg_8000_reserved) != 0)
whismanoid 55:477ba09475d7 3920 {
whismanoid 55:477ba09475d7 3921 // WIP #312 -- save a subset of configuration_back_up_list[]
whismanoid 55:477ba09475d7 3922 // if (configuration_back_up_list[i].recordType __not_match__ __something__) {
whismanoid 55:477ba09475d7 3923 // print " skip";
whismanoid 55:477ba09475d7 3924 // }
whismanoid 55:477ba09475d7 3925 }
whismanoid 52:bb09c0f452ec 3926 //
whismanoid 52:bb09c0f452ec 3927 if ((save_arg & save_arg_01_pageErase) == 0)
whismanoid 52:bb09c0f452ec 3928 {
whismanoid 52:bb09c0f452ec 3929 // WIP %F save=(even) save incremental: append only changed values #353
whismanoid 52:bb09c0f452ec 3930 // If the record we're about to append (or have just appended)
whismanoid 52:bb09c0f452ec 3931 // matches the previous record of that type, then skip this record
whismanoid 52:bb09c0f452ec 3932 // and blank out 0xffffffff the duplicate.
whismanoid 52:bb09c0f452ec 3933 //
whismanoid 52:bb09c0f452ec 3934 // scan from file_addr_start, find latest record match configuration_back_up_list[i].recordType
whismanoid 52:bb09c0f452ec 3935 uint32_t file_addr_previous_record = file_addr_start;
whismanoid 52:bb09c0f452ec 3936 for (uint32_t file_addr_scan = file_addr_start;
whismanoid 52:bb09c0f452ec 3937 file_addr_scan < file_addr_end;
whismanoid 52:bb09c0f452ec 3938 file_addr_scan = (file_addr_scan + 16) &~ 0x0000000F)
whismanoid 52:bb09c0f452ec 3939 {
whismanoid 52:bb09c0f452ec 3940 if (*((uint32_t*)file_addr_scan) == configuration_back_up_list[i].recordType)
whismanoid 52:bb09c0f452ec 3941 {
whismanoid 52:bb09c0f452ec 3942 // previous record of this type is at file_addr_previous_record
whismanoid 52:bb09c0f452ec 3943 file_addr_previous_record = file_addr_scan;
whismanoid 52:bb09c0f452ec 3944 }
whismanoid 52:bb09c0f452ec 3945 }
whismanoid 52:bb09c0f452ec 3946 if (*((uint32_t*)file_addr_previous_record) == configuration_back_up_list[i].recordType)
whismanoid 52:bb09c0f452ec 3947 {
whismanoid 52:bb09c0f452ec 3948 // last record of this type is at file_addr_previous_record
whismanoid 52:bb09c0f452ec 3949 // does the stored value match the value we intend to store?
whismanoid 52:bb09c0f452ec 3950 //
whismanoid 52:bb09c0f452ec 3951 // WIP %F save=(even) save incremental: append only changed values #353
whismanoid 52:bb09c0f452ec 3952 // ((uint32_t*)file_addr_previous_record+1) is the previous 32-bit value
whismanoid 52:bb09c0f452ec 3953 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 52:bb09c0f452ec 3954 {
whismanoid 52:bb09c0f452ec 3955 // print " previous value 0x%8.8lx";
whismanoid 52:bb09c0f452ec 3956 cmdLine.serial().printf("\r\n save 0x%8.8lx %s address 0x%8.8lx length 0x%lx bytes",
whismanoid 52:bb09c0f452ec 3957 configuration_back_up_list[i].recordType,
whismanoid 52:bb09c0f452ec 3958 configuration_back_up_list[i].name,
whismanoid 52:bb09c0f452ec 3959 (uint32_t)configuration_back_up_list[i].addr,
whismanoid 52:bb09c0f452ec 3960 configuration_back_up_list[i].length_bytes);
whismanoid 52:bb09c0f452ec 3961 }
whismanoid 52:bb09c0f452ec 3962 // compare with the 32-bit value we intend to store
whismanoid 52:bb09c0f452ec 3963 int is_record_a_duplicate = true;
whismanoid 55:477ba09475d7 3964 for (unsigned int compareOffset = 0; compareOffset*4 < configuration_back_up_list[i].length_bytes; compareOffset++)
whismanoid 52:bb09c0f452ec 3965 {
whismanoid 52:bb09c0f452ec 3966 uint32_t saved_data_word = *((uint32_t*)file_addr_previous_record+1+compareOffset);
whismanoid 52:bb09c0f452ec 3967 uint32_t new_data_word = *((uint32_t*)configuration_back_up_list[i].addr+compareOffset);
whismanoid 52:bb09c0f452ec 3968 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 52:bb09c0f452ec 3969 {
whismanoid 52:bb09c0f452ec 3970 cmdLine.serial().printf("\r\n saved 0x%8.8lx vs new 0x%8.8lx",
whismanoid 52:bb09c0f452ec 3971 saved_data_word,
whismanoid 52:bb09c0f452ec 3972 new_data_word);
whismanoid 52:bb09c0f452ec 3973 }
whismanoid 52:bb09c0f452ec 3974 if (saved_data_word != new_data_word)
whismanoid 52:bb09c0f452ec 3975 {
whismanoid 52:bb09c0f452ec 3976 // new data is different
whismanoid 52:bb09c0f452ec 3977 is_record_a_duplicate = false;
whismanoid 52:bb09c0f452ec 3978 }
whismanoid 52:bb09c0f452ec 3979 }
whismanoid 52:bb09c0f452ec 3980 if (is_record_a_duplicate)
whismanoid 52:bb09c0f452ec 3981 {
whismanoid 52:bb09c0f452ec 3982 // print " skip duplicate";
whismanoid 52:bb09c0f452ec 3983 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 52:bb09c0f452ec 3984 {
whismanoid 52:bb09c0f452ec 3985 cmdLine.serial().printf("\r\n skip duplicate");
whismanoid 52:bb09c0f452ec 3986 }
whismanoid 52:bb09c0f452ec 3987 continue; // skip to the next item in configuration_back_up_list
whismanoid 52:bb09c0f452ec 3988 }
whismanoid 52:bb09c0f452ec 3989 else
whismanoid 52:bb09c0f452ec 3990 {
whismanoid 52:bb09c0f452ec 3991 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 52:bb09c0f452ec 3992 {
whismanoid 52:bb09c0f452ec 3993 cmdLine.serial().printf("\r\n append updated record");
whismanoid 52:bb09c0f452ec 3994 }
whismanoid 52:bb09c0f452ec 3995 }
whismanoid 52:bb09c0f452ec 3996 }
whismanoid 52:bb09c0f452ec 3997 }
whismanoid 52:bb09c0f452ec 3998 else
whismanoid 52:bb09c0f452ec 3999 {
whismanoid 52:bb09c0f452ec 4000 // page was erased so value should be saved
whismanoid 52:bb09c0f452ec 4001 }
whismanoid 52:bb09c0f452ec 4002 //
whismanoid 46:469d0061df5d 4003 // find next free space to store record in flash file
whismanoid 46:469d0061df5d 4004 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, file_addr);
whismanoid 46:469d0061df5d 4005 cmdLine.serial().printf("0x%8.8lx ", *((uint32_t*)file_addr));
whismanoid 46:469d0061df5d 4006 while (*((uint32_t*)file_addr) != 0xFFFFFFFF)
whismanoid 46:469d0061df5d 4007 {
whismanoid 46:469d0061df5d 4008 if (file_addr >= file_addr_end)
whismanoid 46:469d0061df5d 4009 {
whismanoid 46:469d0061df5d 4010 return 1; // fail: no room to write file
whismanoid 46:469d0061df5d 4011 }
whismanoid 48:18647e0516f2 4012 file_addr_next = (file_addr + 16) &~ 0x0000000F;
whismanoid 48:18647e0516f2 4013 file_addr = file_addr_next;
whismanoid 46:469d0061df5d 4014 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: 0x%8.8lx ",
whismanoid 46:469d0061df5d 4015 poke_access_list[poke_access_list_index].name,
whismanoid 46:469d0061df5d 4016 file_addr,
whismanoid 46:469d0061df5d 4017 *((uint32_t*)file_addr)
whismanoid 46:469d0061df5d 4018 );
whismanoid 46:469d0061df5d 4019 }
whismanoid 48:18647e0516f2 4020 file_addr_next = (file_addr + configuration_back_up_list[i].length_bytes + 16) &~ 0x0000000F;
whismanoid 46:469d0061df5d 4021 //
whismanoid 46:469d0061df5d 4022 // copy data from RAM into flash file
whismanoid 46:469d0061df5d 4023 // not_memcpy(file_addr + 4, configuration_back_up_list[i].addr, configuration_back_up_list[i].length_bytes);
whismanoid 46:469d0061df5d 4024 // pageBuf[0..3] = configuration_back_up_list[i].recordType;
whismanoid 46:469d0061df5d 4025 // pageBuf[4...] = configuration_back_up_list[i].addr, configuration_back_up_list[i].length_bytes
whismanoid 46:469d0061df5d 4026 // WIP #312: FLC_Write(...) in Save_flash_page_configuration_back_up
whismanoid 48:18647e0516f2 4027 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4028 {
whismanoid 48:18647e0516f2 4029 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: write page buffer ...",
whismanoid 48:18647e0516f2 4030 poke_access_list[poke_access_list_index].name, file_addr);
whismanoid 48:18647e0516f2 4031 }
whismanoid 46:469d0061df5d 4032 // page write using flash.program(page_buffer, addr, page_size);
whismanoid 46:469d0061df5d 4033 // int FLC_Write(uint32_t address, const void *data, uint32_t length, MXC_V_FLC_FLSH_UNLOCK_KEY);
whismanoid 46:469d0061df5d 4034 // @param address Start address for desired write. @note This address
whismanoid 46:469d0061df5d 4035 // must be 32-bit word aligned
whismanoid 46:469d0061df5d 4036 // @param data A pointer to the buffer containing the data to write.
whismanoid 46:469d0061df5d 4037 // @param length Size of the data to write in bytes. @note The length
whismanoid 46:469d0061df5d 4038 // must be in 32-bit multiples.
whismanoid 46:469d0061df5d 4039 // @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY.
whismanoid 46:469d0061df5d 4040 // returns E_NO_ERROR or else
whismanoid 46:469d0061df5d 4041 if (FLC_Write(file_addr,
whismanoid 46:469d0061df5d 4042 (uint32_t*)(&configuration_back_up_list[i].recordType),
whismanoid 46:469d0061df5d 4043 sizeof(uint32_t),
whismanoid 46:469d0061df5d 4044 MXC_V_FLC_FLSH_UNLOCK_KEY) != E_NO_ERROR)
whismanoid 46:469d0061df5d 4045 {
whismanoid 48:18647e0516f2 4046 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4047 {
whismanoid 48:18647e0516f2 4048 cmdLine.serial().printf("FAIL ");
whismanoid 48:18647e0516f2 4049 }
whismanoid 46:469d0061df5d 4050 break; // can't perform the command
whismanoid 46:469d0061df5d 4051 }
whismanoid 48:18647e0516f2 4052 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4053 {
whismanoid 48:18647e0516f2 4054 cmdLine.serial().printf("PASS ");
whismanoid 48:18647e0516f2 4055 }
whismanoid 46:469d0061df5d 4056 if (FLC_Write(file_addr + 4,
whismanoid 46:469d0061df5d 4057 (uint32_t*)(configuration_back_up_list[i].addr),
whismanoid 46:469d0061df5d 4058 configuration_back_up_list[i].length_bytes,
whismanoid 46:469d0061df5d 4059 MXC_V_FLC_FLSH_UNLOCK_KEY) != E_NO_ERROR)
whismanoid 46:469d0061df5d 4060 {
whismanoid 48:18647e0516f2 4061 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4062 {
whismanoid 48:18647e0516f2 4063 cmdLine.serial().printf("FAIL ");
whismanoid 48:18647e0516f2 4064 }
whismanoid 46:469d0061df5d 4065 break; // can't perform the command
whismanoid 46:469d0061df5d 4066 }
whismanoid 48:18647e0516f2 4067 if ((save_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4068 {
whismanoid 48:18647e0516f2 4069 cmdLine.serial().printf("PASS ");
whismanoid 48:18647e0516f2 4070 }
whismanoid 46:469d0061df5d 4071 // advance to next 16-byte-aligned record start address
whismanoid 48:18647e0516f2 4072 file_addr = file_addr_next;
whismanoid 46:469d0061df5d 4073 } // end for each configuration_back_up_list[...]
whismanoid 46:469d0061df5d 4074 return 0;
whismanoid 46:469d0061df5d 4075 } // end Save_flash_page_configuration_back_up
whismanoid 46:469d0061df5d 4076 // WIP #312 load values from flash_page_configuration_back_up[] into calibration_05_V[] etc. Default load everything.
whismanoid 46:469d0061df5d 4077 int Load_flash_page_configuration_back_up(CmdLine& cmdLine, uint32_t load_arg)
whismanoid 46:469d0061df5d 4078 {
whismanoid 48:18647e0516f2 4079 if ((load_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4080 {
whismanoid 48:18647e0516f2 4081 cmdLine.serial().printf("\r\nLoad_flash_page_configuration_back_up(0x%8.8lx)...", load_arg);
whismanoid 48:18647e0516f2 4082 }
whismanoid 48:18647e0516f2 4083 if ((load_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4084 {
whismanoid 48:18647e0516f2 4085 // @param[in] save_arg %F save=0x00000002 = verbose diagnostic messages
whismanoid 49:359a6b9df7c1 4086 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 4087 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 4088 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 4089 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 4090 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 4091 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 4092 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 4093 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 4094 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 4095 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 4096 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 4097 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 4098 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 4099 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 4100 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 4101 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 4102 }
whismanoid 46:469d0061df5d 4103 // WIP #312 %F load=load_arg could filter which items to accept from flash file
whismanoid 46:469d0061df5d 4104
whismanoid 46:469d0061df5d 4105 uint32_t file_addr = (uint32_t)&flash_page_configuration_back_up[0];
whismanoid 52:bb09c0f452ec 4106 uint32_t file_addr_end = file_addr + 8192 - 4; // last record at 0x00027ff0
whismanoid 46:469d0061df5d 4107 // uint32_t file_addr_end = file_addr + 256 - 4; // development: reduce listing size -- last record at 0x000260f0
whismanoid 52:bb09c0f452ec 4108 // uint32_t file_addr_end = file_addr + 512 - 4; // development: reduce listing size -- last record at 0x000261f0
whismanoid 46:469d0061df5d 4109
whismanoid 46:469d0061df5d 4110 // diagnostic print
whismanoid 46:469d0061df5d 4111 int poke_access_list_index = search_poke_access_list(file_addr);
whismanoid 48:18647e0516f2 4112 if ((load_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4113 {
whismanoid 48:18647e0516f2 4114 cmdLine.serial().printf("\r\npoke_access_list[%d] %5s 0x%8.8lx - 0x%8.8lx access %x ",
whismanoid 48:18647e0516f2 4115 poke_access_list_index,
whismanoid 48:18647e0516f2 4116 poke_access_list[poke_access_list_index].name,
whismanoid 48:18647e0516f2 4117 poke_access_list[poke_access_list_index].addr_min,
whismanoid 48:18647e0516f2 4118 poke_access_list[poke_access_list_index].addr_max,
whismanoid 48:18647e0516f2 4119 poke_access_list[poke_access_list_index].can_flash_write_read);
whismanoid 48:18647e0516f2 4120 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, file_addr);
whismanoid 48:18647e0516f2 4121 }
whismanoid 46:469d0061df5d 4122
whismanoid 46:469d0061df5d 4123 // Scan backup configuration file
whismanoid 46:469d0061df5d 4124 while (file_addr < file_addr_end)
whismanoid 46:469d0061df5d 4125 {
whismanoid 48:18647e0516f2 4126 if ((load_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4127 {
whismanoid 48:18647e0516f2 4128 // diagnostic print
whismanoid 48:18647e0516f2 4129 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: 0x%8.8lx ",
whismanoid 48:18647e0516f2 4130 poke_access_list[poke_access_list_index].name,
whismanoid 48:18647e0516f2 4131 file_addr,
whismanoid 48:18647e0516f2 4132 *((uint32_t*)file_addr));
whismanoid 48:18647e0516f2 4133 }
whismanoid 46:469d0061df5d 4134
whismanoid 46:469d0061df5d 4135 // address of next 16-byte-aligned record start address
whismanoid 46:469d0061df5d 4136 uint32_t file_addr_next = (file_addr + 16) &~ 0x0000000F;
whismanoid 46:469d0061df5d 4137
whismanoid 46:469d0061df5d 4138 // scan configuration_back_up_list[] to decode recordType
whismanoid 46:469d0061df5d 4139 for (int i = 0; configuration_back_up_list[i].recordType != 0x00000000; i++)
whismanoid 46:469d0061df5d 4140 {
whismanoid 46:469d0061df5d 4141 // configuration_back_up_list[i].recordType
whismanoid 46:469d0061df5d 4142 // configuration_back_up_list[i].addr
whismanoid 46:469d0061df5d 4143 // configuration_back_up_list[i].length_bytes
whismanoid 46:469d0061df5d 4144 // configuration_back_up_list[i].name
whismanoid 46:469d0061df5d 4145 //
whismanoid 46:469d0061df5d 4146 uint32_t file_addr_recordType = file_addr;
whismanoid 52:bb09c0f452ec 4147 // uint32_t file_addr_recordData = file_addr + 1;
whismanoid 46:469d0061df5d 4148 // uint32_t file_addr_recordNext = (file_addr + configuration_back_up_list[i].length_bytes) & ______;
whismanoid 46:469d0061df5d 4149 if (configuration_back_up_list[i].recordType == *((uint32_t*)file_addr_recordType))
whismanoid 46:469d0061df5d 4150 {
whismanoid 46:469d0061df5d 4151 if ((configuration_back_up_list[i].addr == 0) ||
whismanoid 46:469d0061df5d 4152 (configuration_back_up_list[i].length_bytes==0))
whismanoid 46:469d0061df5d 4153 {
whismanoid 46:469d0061df5d 4154 break; // Ignore blank record, stop searching
whismanoid 46:469d0061df5d 4155 }
whismanoid 46:469d0061df5d 4156 // found a matching recordHeader
whismanoid 48:18647e0516f2 4157 if ((load_arg & load_arg_01_brief) != 0)
whismanoid 46:469d0061df5d 4158 {
whismanoid 48:18647e0516f2 4159 // diagnostic print
whismanoid 48:18647e0516f2 4160 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: 0x%8.8lx load %s",
whismanoid 46:469d0061df5d 4161 poke_access_list[poke_access_list_index].name,
whismanoid 48:18647e0516f2 4162 file_addr,
whismanoid 48:18647e0516f2 4163 *((uint32_t*)file_addr),
whismanoid 48:18647e0516f2 4164 configuration_back_up_list[i].name
whismanoid 46:469d0061df5d 4165 );
whismanoid 46:469d0061df5d 4166 }
whismanoid 48:18647e0516f2 4167 if ((load_arg & save_arg_02_verbose) != 0)
whismanoid 48:18647e0516f2 4168 {
whismanoid 55:477ba09475d7 4169 for (unsigned int j = 0; j <= configuration_back_up_list[i].length_bytes; j += 4)
whismanoid 48:18647e0516f2 4170 {
whismanoid 48:18647e0516f2 4171 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: 0x%8.8lx",
whismanoid 48:18647e0516f2 4172 poke_access_list[poke_access_list_index].name,
whismanoid 48:18647e0516f2 4173 (file_addr + 4 + j),
whismanoid 48:18647e0516f2 4174 *((uint32_t*)(file_addr + 4 + j))
whismanoid 48:18647e0516f2 4175 );
whismanoid 48:18647e0516f2 4176 }
whismanoid 48:18647e0516f2 4177 }
whismanoid 46:469d0061df5d 4178 // cmdLine.serial().printf("\r\n load %s 0x%8.8lx length 0x%lx address 0x%8.8lx",
whismanoid 46:469d0061df5d 4179 // configuration_back_up_list[i].name,
whismanoid 46:469d0061df5d 4180 // configuration_back_up_list[i].recordType,
whismanoid 46:469d0061df5d 4181 // configuration_back_up_list[i].length_bytes,
whismanoid 46:469d0061df5d 4182 // (uint32_t)configuration_back_up_list[i].addr,
whismanoid 46:469d0061df5d 4183 // );
whismanoid 46:469d0061df5d 4184 // cmdLine.serial().printf("\r\n load %s 0x%8.8lx length 0x%lx address 0x%8.8lx",
whismanoid 46:469d0061df5d 4185 // configuration_back_up_list[i].name,
whismanoid 46:469d0061df5d 4186 // configuration_back_up_list[i].recordType,
whismanoid 46:469d0061df5d 4187 // configuration_back_up_list[i].length_bytes,
whismanoid 46:469d0061df5d 4188 // (uint32_t)configuration_back_up_list[i].addr,
whismanoid 46:469d0061df5d 4189 // );
whismanoid 46:469d0061df5d 4190 //
whismanoid 46:469d0061df5d 4191 // WIP #312: copy data from flash file into RAM in Load_flash_page_configuration_back_up
whismanoid 46:469d0061df5d 4192 memcpy(configuration_back_up_list[i].addr,
whismanoid 46:469d0061df5d 4193 (const void *)(file_addr + 4),
whismanoid 46:469d0061df5d 4194 configuration_back_up_list[i].length_bytes);
whismanoid 46:469d0061df5d 4195 //
whismanoid 46:469d0061df5d 4196 // advance to next 16-byte-aligned record start address
whismanoid 46:469d0061df5d 4197 file_addr_next = (file_addr + configuration_back_up_list[i].length_bytes + 16) &~ 0x0000000F;
whismanoid 46:469d0061df5d 4198 break; // stop searching
whismanoid 46:469d0061df5d 4199 } // end if match recordType
whismanoid 46:469d0061df5d 4200 } // end for each configuration_back_up_list[...]
whismanoid 46:469d0061df5d 4201 // advance to next 16-byte-aligned record start address
whismanoid 46:469d0061df5d 4202 file_addr = file_addr_next;
whismanoid 46:469d0061df5d 4203 } // end while (file_addr < file_addr_end)
whismanoid 46:469d0061df5d 4204 return 0;
whismanoid 46:469d0061df5d 4205 } // end Load_flash_page_configuration_back_up
whismanoid 46:469d0061df5d 4206 #endif // HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 4207
whismanoid 46:469d0061df5d 4208 //--------------------------------------------------
whismanoid 0:cb44e2e9ec4c 4209 // Option to validate SPI link by reading PART_ID register
whismanoid 0:cb44e2e9ec4c 4210 #ifndef VERIFY_PART_ID_IN_LOOP
whismanoid 3:9055e17e181a 4211 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 4212 #define VERIFY_PART_ID_IN_LOOP 1
whismanoid 3:9055e17e181a 4213 #else
whismanoid 0:cb44e2e9ec4c 4214 #define VERIFY_PART_ID_IN_LOOP 0
whismanoid 3:9055e17e181a 4215 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 4216 #endif
whismanoid 0:cb44e2e9ec4c 4217
whismanoid 3:9055e17e181a 4218 //--------------------------------------------------
whismanoid 3:9055e17e181a 4219 #define NUM_DUT_ANALOG_IN_CHANNELS 10
whismanoid 3:9055e17e181a 4220
whismanoid 3:9055e17e181a 4221 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 4222 // MAX11410 individual channels 1=LSB, 2=Volt, 0=Disabled
whismanoid 3:9055e17e181a 4223 typedef enum SPI_AIN_Enable_t {
whismanoid 10:04022a61b527 4224 SPI_AIN_Disable = 0,
whismanoid 10:04022a61b527 4225 SPI_AIN_Enable_LSB = 1,
whismanoid 10:04022a61b527 4226 SPI_AIN_Enable_Volt = 2,
whismanoid 3:9055e17e181a 4227 } SPI_AIN_Enable_t;
whismanoid 3:9055e17e181a 4228 uint8_t SPI_AIN_Enable_ch[NUM_DUT_ANALOG_IN_CHANNELS] = {
whismanoid 10:04022a61b527 4229 SPI_AIN_Enable_LSB, // AIN0 1=LSB
whismanoid 10:04022a61b527 4230 SPI_AIN_Enable_LSB, // AIN1 1=LSB
whismanoid 10:04022a61b527 4231 SPI_AIN_Enable_LSB, // AIN2 1=LSB
whismanoid 10:04022a61b527 4232 SPI_AIN_Enable_LSB, // AIN3 1=LSB
whismanoid 10:04022a61b527 4233 SPI_AIN_Enable_LSB, // AIN4 1=LSB
whismanoid 10:04022a61b527 4234 SPI_AIN_Enable_LSB, // AIN5 1=LSB
whismanoid 10:04022a61b527 4235 SPI_AIN_Enable_LSB, // AIN6 1=LSB
whismanoid 10:04022a61b527 4236 SPI_AIN_Enable_LSB, // AIN7 1=LSB
whismanoid 10:04022a61b527 4237 SPI_AIN_Enable_LSB, // AIN8 1=LSB
whismanoid 10:04022a61b527 4238 SPI_AIN_Enable_LSB, // AIN9 1=LSB
whismanoid 3:9055e17e181a 4239 };
whismanoid 3:9055e17e181a 4240 //
whismanoid 10:04022a61b527 4241 double SPI_AIN_Voltage[NUM_DUT_ANALOG_IN_CHANNELS];
whismanoid 13:184a08909405 4242 // Optional custom per-channel header suffix
whismanoid 45:74bf1fe021e5 4243 // This could be used to identify external hardware attached to each input
whismanoid 13:184a08909405 4244 #if HAS_SPI_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 4245 // WIP Editable customChannelHeader strings #363 - SPI_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 4246 char SPI_AIN_customChannelHeader_ch0[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4247 char SPI_AIN_customChannelHeader_ch1[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4248 char SPI_AIN_customChannelHeader_ch2[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4249 char SPI_AIN_customChannelHeader_ch3[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4250 char SPI_AIN_customChannelHeader_ch4[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4251 char SPI_AIN_customChannelHeader_ch5[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4252 char SPI_AIN_customChannelHeader_ch6[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4253 char SPI_AIN_customChannelHeader_ch7[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4254 char SPI_AIN_customChannelHeader_ch8[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4255 char SPI_AIN_customChannelHeader_ch9[SPI_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4256 static char* SPI_AIN_customChannelHeader_ch[NUM_SPI_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4257 SPI_AIN_customChannelHeader_ch0,
whismanoid 55:477ba09475d7 4258 SPI_AIN_customChannelHeader_ch1,
whismanoid 55:477ba09475d7 4259 SPI_AIN_customChannelHeader_ch2,
whismanoid 55:477ba09475d7 4260 SPI_AIN_customChannelHeader_ch3,
whismanoid 55:477ba09475d7 4261 SPI_AIN_customChannelHeader_ch4,
whismanoid 55:477ba09475d7 4262 SPI_AIN_customChannelHeader_ch5,
whismanoid 55:477ba09475d7 4263 SPI_AIN_customChannelHeader_ch6,
whismanoid 55:477ba09475d7 4264 SPI_AIN_customChannelHeader_ch7,
whismanoid 55:477ba09475d7 4265 SPI_AIN_customChannelHeader_ch8,
whismanoid 55:477ba09475d7 4266 SPI_AIN_customChannelHeader_ch9,
whismanoid 13:184a08909405 4267 };
whismanoid 13:184a08909405 4268 #endif // HAS_SPI_AIN_customChannelHeader
whismanoid 55:477ba09475d7 4269 //
whismanoid 55:477ba09475d7 4270 // MAX40108 Datalog Math #362 -- SPI_AIN_Enable_Math_ch[] SPI_AIN_MATH
whismanoid 55:477ba09475d7 4271 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 4272 uint8_t SPI_AIN_Enable_Math_ch[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4273 Platform_AIN_Disable,
whismanoid 55:477ba09475d7 4274 };
whismanoid 55:477ba09475d7 4275 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 4276 //
whismanoid 55:477ba09475d7 4277 // MAX40108 Datalog Math #362 -- SPI_AIN_MathOffsetA[] SPI_AIN_MATH
whismanoid 55:477ba09475d7 4278 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 4279 double SPI_AIN_MathOffsetA[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4280 1.0,
whismanoid 55:477ba09475d7 4281 };
whismanoid 55:477ba09475d7 4282 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 4283 //
whismanoid 55:477ba09475d7 4284 // MAX40108 Datalog Math #362 -- SPI_AIN_MathGainMulA[] SPI_AIN_MATH
whismanoid 55:477ba09475d7 4285 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 4286 double SPI_AIN_MathGainMulA[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4287 1.0,
whismanoid 55:477ba09475d7 4288 };
whismanoid 55:477ba09475d7 4289 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 4290 //
whismanoid 55:477ba09475d7 4291 // MAX40108 Datalog Math #362 -- SPI_AIN_MathGainDivA[] SPI_AIN_MATH
whismanoid 55:477ba09475d7 4292 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 4293 double SPI_AIN_MathGainDivA[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4294 1.0,
whismanoid 55:477ba09475d7 4295 };
whismanoid 55:477ba09475d7 4296 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 4297 //
whismanoid 55:477ba09475d7 4298 // MAX40108 Datalog Math #362 -- SPI_AIN_MathUnitString[] SPI_AIN_MATH
whismanoid 55:477ba09475d7 4299 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 4300 // WIP Editable customChannelHeader strings #363 - SPI_AIN_MathUnitString
whismanoid 55:477ba09475d7 4301 #define SPI_AIN_MathUnitString_MAXLENGTH 20
whismanoid 55:477ba09475d7 4302 char SPI_AIN_MathUnitString_ch0[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4303 char SPI_AIN_MathUnitString_ch1[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4304 char SPI_AIN_MathUnitString_ch2[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4305 char SPI_AIN_MathUnitString_ch3[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4306 char SPI_AIN_MathUnitString_ch4[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4307 char SPI_AIN_MathUnitString_ch5[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4308 char SPI_AIN_MathUnitString_ch6[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4309 char SPI_AIN_MathUnitString_ch7[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4310 char SPI_AIN_MathUnitString_ch8[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4311 char SPI_AIN_MathUnitString_ch9[SPI_AIN_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4312 static char* SPI_AIN_MathUnitString[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4313 SPI_AIN_MathUnitString_ch0,
whismanoid 55:477ba09475d7 4314 SPI_AIN_MathUnitString_ch1,
whismanoid 55:477ba09475d7 4315 SPI_AIN_MathUnitString_ch2,
whismanoid 55:477ba09475d7 4316 SPI_AIN_MathUnitString_ch3,
whismanoid 55:477ba09475d7 4317 SPI_AIN_MathUnitString_ch4,
whismanoid 55:477ba09475d7 4318 SPI_AIN_MathUnitString_ch5,
whismanoid 55:477ba09475d7 4319 SPI_AIN_MathUnitString_ch6,
whismanoid 55:477ba09475d7 4320 SPI_AIN_MathUnitString_ch7,
whismanoid 55:477ba09475d7 4321 SPI_AIN_MathUnitString_ch8,
whismanoid 55:477ba09475d7 4322 SPI_AIN_MathUnitString_ch9,
whismanoid 55:477ba09475d7 4323 };
whismanoid 55:477ba09475d7 4324 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 4325 //
whismanoid 3:9055e17e181a 4326 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 4327 // ---------- Measure_Voltage_custom_props in Measure_Voltage @pre and in class properties ----------
whismanoid 3:9055e17e181a 4328 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 4:d9b05924ad4c 4329 // MAX11410 specific per-channel config register v_filter
whismanoid 3:9055e17e181a 4330 uint8_t SPI_AIN_Cfg_v_filter_ch[NUM_DUT_ANALOG_IN_CHANNELS] = {
whismanoid 3:9055e17e181a 4331 0x34, // AIN0 @ v_filter=0x34
whismanoid 3:9055e17e181a 4332 0x34, // AIN1 @ v_filter=0x34
whismanoid 3:9055e17e181a 4333 0x34, // AIN2 @ v_filter=0x34
whismanoid 3:9055e17e181a 4334 0x34, // AIN3 @ v_filter=0x34
whismanoid 3:9055e17e181a 4335 0x34, // AIN4 @ v_filter=0x34
whismanoid 3:9055e17e181a 4336 0x34, // AIN5 @ v_filter=0x34
whismanoid 3:9055e17e181a 4337 0x34, // AIN6 @ v_filter=0x34
whismanoid 3:9055e17e181a 4338 0x34, // AIN7 @ v_filter=0x34
whismanoid 3:9055e17e181a 4339 0x34, // AIN8 @ v_filter=0x34
whismanoid 3:9055e17e181a 4340 0x34, // AIN9 @ v_filter=0x34
whismanoid 3:9055e17e181a 4341 };
whismanoid 3:9055e17e181a 4342 //
whismanoid 4:d9b05924ad4c 4343 // MAX11410 specific per-channel config register v_ctrl
whismanoid 3:9055e17e181a 4344 uint8_t SPI_AIN_Cfg_v_ctrl_ch[NUM_DUT_ANALOG_IN_CHANNELS] = {
whismanoid 3:9055e17e181a 4345 0x42, // AIN0 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4346 0x42, // AIN1 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4347 0x42, // AIN2 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4348 0x42, // AIN3 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4349 0x42, // AIN4 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4350 0x42, // AIN5 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4351 0x42, // AIN6 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4352 0x42, // AIN7 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4353 0x42, // AIN8 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4354 0x42, // AIN9 @ v_ctrl=0x42
whismanoid 3:9055e17e181a 4355 };
whismanoid 3:9055e17e181a 4356 //
whismanoid 4:d9b05924ad4c 4357 // MAX11410 specific per-channel config register v_pga
whismanoid 3:9055e17e181a 4358 uint8_t SPI_AIN_Cfg_v_pga_ch[NUM_DUT_ANALOG_IN_CHANNELS] = {
whismanoid 3:9055e17e181a 4359 0x00, // AIN0 @ v_pga=0x00
whismanoid 3:9055e17e181a 4360 0x00, // AIN1 @ v_pga=0x00
whismanoid 3:9055e17e181a 4361 0x00, // AIN2 @ v_pga=0x00
whismanoid 3:9055e17e181a 4362 0x00, // AIN3 @ v_pga=0x00
whismanoid 3:9055e17e181a 4363 0x00, // AIN4 @ v_pga=0x00
whismanoid 3:9055e17e181a 4364 0x00, // AIN5 @ v_pga=0x00
whismanoid 3:9055e17e181a 4365 0x00, // AIN6 @ v_pga=0x00
whismanoid 3:9055e17e181a 4366 0x00, // AIN7 @ v_pga=0x00
whismanoid 3:9055e17e181a 4367 0x00, // AIN8 @ v_pga=0x00
whismanoid 3:9055e17e181a 4368 0x00, // AIN9 @ v_pga=0x00
whismanoid 3:9055e17e181a 4369 };
whismanoid 3:9055e17e181a 4370 //
whismanoid 3:9055e17e181a 4371 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 4372 // ---------- Measure_Voltage_custom_props ----------
whismanoid 0:cb44e2e9ec4c 4373 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 4374 // filter register configuration in Measure_Voltage and Read_All_Voltages CONV_TYPE_01_Continuous
whismanoid 0:cb44e2e9ec4c 4375 //~ const uint8_t custom_v_filter = 0x34; // @ v_filter=0x34 --*LINEF_11_SINC4 RATE_0100 | 60SPS
whismanoid 0:cb44e2e9ec4c 4376 //~ const uint8_t custom_v_filter = 0x00; // @ v_filter=0x00 -- LINEF_00_50Hz_60Hz_FIR RATE_0000 | 1.1SPS
whismanoid 0:cb44e2e9ec4c 4377 //~ const uint8_t custom_v_filter = 0x01; // @ v_filter=0x01 -- LINEF_00_50Hz_60Hz_FIR RATE_0001 | 2.1SPS
whismanoid 0:cb44e2e9ec4c 4378 //~ const uint8_t custom_v_filter = 0x02; // @ v_filter=0x02 -- LINEF_00_50Hz_60Hz_FIR RATE_0010 | 4.2SPS
whismanoid 0:cb44e2e9ec4c 4379 //~ const uint8_t custom_v_filter = 0x03; // @ v_filter=0x03 -- LINEF_00_50Hz_60Hz_FIR RATE_0011 | 8.4SPS
whismanoid 0:cb44e2e9ec4c 4380 //~ const uint8_t custom_v_filter = 0x04; // @ v_filter=0x04 -- LINEF_00_50Hz_60Hz_FIR RATE_0100 | 16.8SPS
whismanoid 0:cb44e2e9ec4c 4381 //~ const uint8_t custom_v_filter = 0x10; // @ v_filter=0x10 -- LINEF_01_50Hz_FIR RATE_0000 | 1.3SPS
whismanoid 0:cb44e2e9ec4c 4382 //~ const uint8_t custom_v_filter = 0x11; // @ v_filter=0x11 -- LINEF_01_50Hz_FIR RATE_0001 | 2.7SPS
whismanoid 0:cb44e2e9ec4c 4383 //~ const uint8_t custom_v_filter = 0x12; // @ v_filter=0x12 -- LINEF_01_50Hz_FIR RATE_0010 | 5.3SPS
whismanoid 0:cb44e2e9ec4c 4384 //~ const uint8_t custom_v_filter = 0x13; // @ v_filter=0x13 -- LINEF_01_50Hz_FIR RATE_0011 | 10.7SPS
whismanoid 0:cb44e2e9ec4c 4385 //~ const uint8_t custom_v_filter = 0x14; // @ v_filter=0x14 -- LINEF_01_50Hz_FIR RATE_0100 | 21.3SPS
whismanoid 0:cb44e2e9ec4c 4386 //~ const uint8_t custom_v_filter = 0x15; // @ v_filter=0x15 -- LINEF_01_50Hz_FIR RATE_0101 | 40.0SPS
whismanoid 0:cb44e2e9ec4c 4387 //~ const uint8_t custom_v_filter = 0x20; // @ v_filter=0x20 -- LINEF_10_60Hz_FIR RATE_0000 | 1.3SPS
whismanoid 0:cb44e2e9ec4c 4388 //~ const uint8_t custom_v_filter = 0x21; // @ v_filter=0x21 -- LINEF_10_60Hz_FIR RATE_0001 | 2.7SPS
whismanoid 0:cb44e2e9ec4c 4389 //~ const uint8_t custom_v_filter = 0x22; // @ v_filter=0x22 -- LINEF_10_60Hz_FIR RATE_0010 | 5.3SPS
whismanoid 0:cb44e2e9ec4c 4390 //~ const uint8_t custom_v_filter = 0x23; // @ v_filter=0x23 -- LINEF_10_60Hz_FIR RATE_0011 | 10.7SPS
whismanoid 0:cb44e2e9ec4c 4391 //~ const uint8_t custom_v_filter = 0x24; // @ v_filter=0x24 -- LINEF_10_60Hz_FIR RATE_0100 | 21.3SPS
whismanoid 0:cb44e2e9ec4c 4392 //~ const uint8_t custom_v_filter = 0x25; // @ v_filter=0x25 -- LINEF_10_60Hz_FIR RATE_0101 | 40.0SPS
whismanoid 0:cb44e2e9ec4c 4393 //~ const uint8_t custom_v_filter = 0x30; // @ v_filter=0x30 -- LINEF_11_SINC4 RATE_0000 | 4SPS
whismanoid 0:cb44e2e9ec4c 4394 //~ const uint8_t custom_v_filter = 0x31; // @ v_filter=0x31 -- LINEF_11_SINC4 RATE_0001 | 10SPS
whismanoid 0:cb44e2e9ec4c 4395 //~ const uint8_t custom_v_filter = 0x32; // @ v_filter=0x32 -- LINEF_11_SINC4 RATE_0010 | 20SPS
whismanoid 0:cb44e2e9ec4c 4396 //~ const uint8_t custom_v_filter = 0x33; // @ v_filter=0x33 -- LINEF_11_SINC4 RATE_0011 | 40SPS
whismanoid 0:cb44e2e9ec4c 4397 //~ const uint8_t custom_v_filter = 0x34; // @ v_filter=0x34 --*LINEF_11_SINC4 RATE_0100 | 60SPS
whismanoid 0:cb44e2e9ec4c 4398 //~ const uint8_t custom_v_filter = 0x35; // @ v_filter=0x35 -- LINEF_11_SINC4 RATE_0101 | 120SPS
whismanoid 0:cb44e2e9ec4c 4399 //~ const uint8_t custom_v_filter = 0x36; // @ v_filter=0x36 -- LINEF_11_SINC4 RATE_0110 | 240SPS
whismanoid 0:cb44e2e9ec4c 4400 //~ const uint8_t custom_v_filter = 0x37; // @ v_filter=0x37 -- LINEF_11_SINC4 RATE_0111 | 480SPS
whismanoid 0:cb44e2e9ec4c 4401 //~ const uint8_t custom_v_filter = 0x38; // @ v_filter=0x38 -- LINEF_11_SINC4 RATE_1000 | 960SPS
whismanoid 0:cb44e2e9ec4c 4402 //~ const uint8_t custom_v_filter = 0x39; // @ v_filter=0x39 -- LINEF_11_SINC4 RATE_1001 | 1920SPS
whismanoid 0:cb44e2e9ec4c 4403 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 4404 //
whismanoid 0:cb44e2e9ec4c 4405 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 4406 // pga register configuration in Measure_Voltage and Read_All_Voltages
whismanoid 0:cb44e2e9ec4c 4407 //~ const uint8_t custom_v_pga = 0x00; // @ v_pga=0x00 -- 0x00 SIG_PATH_00_BUFFERED
whismanoid 0:cb44e2e9ec4c 4408 //~ const uint8_t custom_v_pga = 0x00; // @ v_pga=0x00 -- 0x00 SIG_PATH_00_BUFFERED
whismanoid 0:cb44e2e9ec4c 4409 //~ const uint8_t custom_v_pga = 0x10; // @ v_pga=0x10 -- 0x10 SIG_PATH_01_BYPASS
whismanoid 0:cb44e2e9ec4c 4410 //~ const uint8_t custom_v_pga = 0x20; // @ v_pga=0x20 -- 0x20 SIG_PATH_10_PGA GAIN_000_1
whismanoid 0:cb44e2e9ec4c 4411 //~ const uint8_t custom_v_pga = 0x21; // @ v_pga=0x21 --*0x21 SIG_PATH_10_PGA GAIN_001_2
whismanoid 0:cb44e2e9ec4c 4412 //~ const uint8_t custom_v_pga = 0x22; // @ v_pga=0x22 -- 0x22 SIG_PATH_10_PGA GAIN_010_4
whismanoid 0:cb44e2e9ec4c 4413 //~ const uint8_t custom_v_pga = 0x23; // @ v_pga=0x23 -- 0x23 SIG_PATH_10_PGA GAIN_011_8
whismanoid 0:cb44e2e9ec4c 4414 //~ const uint8_t custom_v_pga = 0x24; // @ v_pga=0x24 -- 0x24 SIG_PATH_10_PGA GAIN_100_16
whismanoid 0:cb44e2e9ec4c 4415 //~ const uint8_t custom_v_pga = 0x25; // @ v_pga=0x25 -- 0x25 SIG_PATH_10_PGA GAIN_101_32
whismanoid 0:cb44e2e9ec4c 4416 //~ const uint8_t custom_v_pga = 0x26; // @ v_pga=0x26 -- 0x26 SIG_PATH_10_PGA GAIN_110_64
whismanoid 0:cb44e2e9ec4c 4417 //~ const uint8_t custom_v_pga = 0x27; // @ v_pga=0x27 -- 0x27 SIG_PATH_10_PGA GAIN_111_128
whismanoid 0:cb44e2e9ec4c 4418 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 4419 //
whismanoid 0:cb44e2e9ec4c 4420 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 0:cb44e2e9ec4c 4421 // ctrl register configuration in Measure_Voltage and Read_All_Voltages
whismanoid 3:9055e17e181a 4422 //~ const uint8_t custom_v_ctrl = 0x42; // @ v_ctrl=0x42 -- 0x40 unipolar, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 4423 //~ const uint8_t custom_v_ctrl = 0x40; // @ v_ctrl=0x40 -- 0x40 unipolar, 0x00 REF_SEL_000_AIN0_AIN1
whismanoid 0:cb44e2e9ec4c 4424 //~ const uint8_t custom_v_ctrl = 0x44; // @ v_ctrl=0x44 -- 0x40 unipolar, 0x04 REF_SEL_100_AIN0_AGND
whismanoid 0:cb44e2e9ec4c 4425 //~ const uint8_t custom_v_ctrl = 0x58; // @ v_ctrl=0x58 -- 0x40 unipolar, 0x00 REF_SEL_000_AIN0_AIN1, 0x18 refbuf
whismanoid 0:cb44e2e9ec4c 4426 //
whismanoid 0:cb44e2e9ec4c 4427 //~ const uint8_t custom_v_ctrl = 0x41; // @ v_ctrl=0x41 -- 0x40 unipolar, 0x01 REF_SEL_001_REF1P_REF1N
whismanoid 0:cb44e2e9ec4c 4428 //~ const uint8_t custom_v_ctrl = 0x45; // @ v_ctrl=0x45 -- 0x40 unipolar, 0x05 REF_SEL_101_REF1P_AGND
whismanoid 0:cb44e2e9ec4c 4429 //~ const uint8_t custom_v_ctrl = 0x59; // @ v_ctrl=0x59 -- 0x40 unipolar, 0x01 REF_SEL_001_REF1P_REF1N, 0x18 refbuf
whismanoid 0:cb44e2e9ec4c 4430 //
whismanoid 0:cb44e2e9ec4c 4431 //~ const uint8_t custom_v_ctrl = 0x42; // @ v_ctrl=0x42 -- 0x40 unipolar, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 4432 //~ const uint8_t custom_v_ctrl = 0x46; // @ v_ctrl=0x46 -- 0x40 unipolar, 0x06 REF_SEL_110_REF2P_AGND
whismanoid 0:cb44e2e9ec4c 4433 //~ const uint8_t custom_v_ctrl = 0x22; // @ v_ctrl=0x22 -- 0x20 bipolar offset binary, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 4434 //~ const uint8_t custom_v_ctrl = 0x02; // @ v_ctrl=0x02 -- 0x00 bipolar 2's complement, 0x02 REF_SEL_010_REF2P_REF2N
whismanoid 0:cb44e2e9ec4c 4435 //
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 = 0x47; // @ v_ctrl=0x47 -- 0x40 unipolar, 0x07 REF_SEL_111_AVDD_AGND
whismanoid 0:cb44e2e9ec4c 4438 //~ const uint8_t custom_v_ctrl = 0x27; // @ v_ctrl=0x27 -- 0x20 bipolar offset binary, 0x07 REF_SEL_111_AVDD_AGND
whismanoid 0:cb44e2e9ec4c 4439 //~ const uint8_t custom_v_ctrl = 0x07; // @ v_ctrl=0x07 -- 0x00 bipolar 2's complement, 0x07 REF_SEL_111_AVDD_AGND
whismanoid 0:cb44e2e9ec4c 4440 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 0:cb44e2e9ec4c 4441
whismanoid 3:9055e17e181a 4442 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 4443 // example code declare SPI interface (GPIO controlled CS)
whismanoid 0:cb44e2e9ec4c 4444 #if defined(TARGET_MAX32625MBED)
whismanoid 0:cb44e2e9ec4c 4445 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 4446 DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32625MBED: P1_3 Arduino 10-pin header D10
whismanoid 19:5ff09c8e9daf 4447 #elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 0:cb44e2e9ec4c 4448 #warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
whismanoid 0:cb44e2e9ec4c 4449 SPI spi(SPI0_MOSI, SPI0_MISO, SPI0_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625PICO: pin P0_5 P0_6 P0_4
whismanoid 0:cb44e2e9ec4c 4450 DigitalOut spi_cs(SPI0_SS); // TARGET_MAX32625PICO: pin P0_7
whismanoid 0:cb44e2e9ec4c 4451 #elif defined(TARGET_MAX32600MBED)
whismanoid 0:cb44e2e9ec4c 4452 SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
whismanoid 0:cb44e2e9ec4c 4453 DigitalOut spi_cs(SPI2_SS); // Generic: Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 4454 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 0:cb44e2e9ec4c 4455 // TODO1: avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
whismanoid 0:cb44e2e9ec4c 4456 // void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
whismanoid 0:cb44e2e9ec4c 4457 //
whismanoid 0:cb44e2e9ec4c 4458 // TODO1: NUCLEO_F446RE SPI not working; CS and MOSI data looks OK but no SCLK clock pulses.
whismanoid 0:cb44e2e9ec4c 4459 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 4460 DigitalOut spi_cs(SPI_CS); // TARGET_NUCLEO_F446RE: PB_6 Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 4461 //
whismanoid 0:cb44e2e9ec4c 4462 #else
whismanoid 3:9055e17e181a 4463 SPI spi(D11, D12, D13); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
whismanoid 3:9055e17e181a 4464 DigitalOut spi_cs(D10); // Generic: Arduino 10-pin header D10
whismanoid 0:cb44e2e9ec4c 4465 #endif
whismanoid 0:cb44e2e9ec4c 4466
whismanoid 0:cb44e2e9ec4c 4467 // example code declare GPIO interface pins
whismanoid 0:cb44e2e9ec4c 4468 // example code declare device instance
whismanoid 3:9055e17e181a 4469 MAX11410 g_MAX11410_device(spi, spi_cs, MAX11410::MAX11410_IC);
whismanoid 3:9055e17e181a 4470 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 4471
whismanoid 1:747f1602abfc 4472 //--------------------------------------------------
whismanoid 3:9055e17e181a 4473 // Option to Datalog Arduino platform analog inputs
whismanoid 3:9055e17e181a 4474 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 1:747f1602abfc 4475 //#ifndef NUM_PLATFORM_ANALOG_IN_CHANNELS
whismanoid 1:747f1602abfc 4476 //#define NUM_PLATFORM_ANALOG_IN_CHANNELS 6
whismanoid 1:747f1602abfc 4477 //#endif
whismanoid 1:747f1602abfc 4478 const int NUM_PLATFORM_ANALOG_IN_CHANNELS = 6;
whismanoid 55:477ba09475d7 4479 //
whismanoid 55:477ba09475d7 4480 // Option to Datalog Arduino platform analog inputs
whismanoid 1:747f1602abfc 4481 const double adc_full_scale_voltage[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 10:04022a61b527 4482 analogInPin_fullScaleVoltage[0], // 1.2,
whismanoid 10:04022a61b527 4483 analogInPin_fullScaleVoltage[1], // 1.2,
whismanoid 10:04022a61b527 4484 analogInPin_fullScaleVoltage[2], // 1.2,
whismanoid 10:04022a61b527 4485 analogInPin_fullScaleVoltage[3], // 1.2,
whismanoid 10:04022a61b527 4486 analogInPin_fullScaleVoltage[4], // 6.0
whismanoid 10:04022a61b527 4487 analogInPin_fullScaleVoltage[5], // 6.0
whismanoid 0:cb44e2e9ec4c 4488 };
whismanoid 9:45f98573eb6d 4489 // Platform ADC individual channels 1=LSB, 2=Volt, 0=Disabled
whismanoid 9:45f98573eb6d 4490 typedef enum Platform_AIN_Enable_t {
whismanoid 9:45f98573eb6d 4491 Platform_AIN_Disable = 0,
whismanoid 9:45f98573eb6d 4492 Platform_AIN_Enable_LSB = 1,
whismanoid 9:45f98573eb6d 4493 Platform_AIN_Enable_Volt = 2,
whismanoid 55:477ba09475d7 4494 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_LSB - display math result instead of LSB in channel# position
whismanoid 55:477ba09475d7 4495 Platform_AIN_Enable_Math_LSB = 3,
whismanoid 55:477ba09475d7 4496 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_Volt - display math result instead of volts in channel# position
whismanoid 55:477ba09475d7 4497 Platform_AIN_Enable_Math_Volt = 4,
whismanoid 9:45f98573eb6d 4498 } Platform_AIN_Enable_t;
whismanoid 13:184a08909405 4499 uint8_t Platform_Enable_ch[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 9:45f98573eb6d 4500 Platform_AIN_Enable_Volt, // AIN0 2=Volt
whismanoid 9:45f98573eb6d 4501 Platform_AIN_Enable_Volt, // AIN1 2=Volt
whismanoid 55:477ba09475d7 4502 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4503 Platform_AIN_Enable_Math_Volt, // Math ch2 Volt enable, offset 0.74, gainMul R206=10000, gainDiv 1, units nA
whismanoid 55:477ba09475d7 4504 #else // PLATFORM_AIN_MATH
whismanoid 9:45f98573eb6d 4505 Platform_AIN_Enable_Volt, // AIN2 2=Volt
whismanoid 55:477ba09475d7 4506 #endif // PLATFORM_AIN_MATH
whismanoid 9:45f98573eb6d 4507 Platform_AIN_Enable_Volt, // AIN3 2=Volt
whismanoid 55:477ba09475d7 4508 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4509 Platform_AIN_Enable_Math_Volt, // Math ch4 Volt enable, offset 0, gainMul 100, gainDiv 3.34, units mA
whismanoid 55:477ba09475d7 4510 #else // PLATFORM_AIN_MATH
whismanoid 9:45f98573eb6d 4511 Platform_AIN_Enable_Volt, // AIN4 2=Volt
whismanoid 55:477ba09475d7 4512 #endif // PLATFORM_AIN_MATH
whismanoid 9:45f98573eb6d 4513 Platform_AIN_Enable_Volt, // AIN5 2=Volt
whismanoid 9:45f98573eb6d 4514 };
whismanoid 55:477ba09475d7 4515 // MAX40108 Datalog Math #362 -- Platform_Enable_Math_ch[] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4516 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4517 uint8_t Platform_Enable_Math_ch[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4518 Platform_AIN_Disable,
whismanoid 55:477ba09475d7 4519 Platform_AIN_Disable,
whismanoid 55:477ba09475d7 4520 Platform_AIN_Disable, // Math ch2 Volt enable, offset 0.74, gainMul R206=10000, gainDiv 1, units nA
whismanoid 55:477ba09475d7 4521 Platform_AIN_Disable,
whismanoid 55:477ba09475d7 4522 Platform_AIN_Disable, // Math ch4 Volt enable, offset 0, gainMul 100, gainDiv 3.34, units mA
whismanoid 55:477ba09475d7 4523 Platform_AIN_Disable,
whismanoid 55:477ba09475d7 4524 };
whismanoid 55:477ba09475d7 4525 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4526 //
whismanoid 37:3f369235e5bc 4527 // Option to report average value of Arduino platform analog inputs
whismanoid 37:3f369235e5bc 4528 #ifndef USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 4529 #define USE_Platform_AIN_Average 1
whismanoid 37:3f369235e5bc 4530 //~ #undef USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 4531 #endif
whismanoid 37:3f369235e5bc 4532 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 4533 #endif // USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 4534 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 4535 int Platform_AIN_Average_N = 16;
whismanoid 37:3f369235e5bc 4536 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 4537 // Option to apply calibration to Arduino platform analog inputs
whismanoid 34:a1993a1ee904 4538 #ifndef HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 4539 #define HAS_Platform_AIN_Calibration 1
whismanoid 34:a1993a1ee904 4540 //~ #undef HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 4541 #endif
whismanoid 34:a1993a1ee904 4542 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 4543 double CalibratedNormValue(int channel_0_5, double raw_normValue_0_1);
whismanoid 34:a1993a1ee904 4544 // Calibration is between two points for each channel, defined by
whismanoid 34:a1993a1ee904 4545 // a normalized value between 0% and 100%, and the corresponding voltage.
whismanoid 34:a1993a1ee904 4546 // nominal 5% fullscale point; normValue_0_1 < 0.5
whismanoid 34:a1993a1ee904 4547 // calibration_05_normValue_0_1, calibration_05_V should be around 5% or 25%
whismanoid 42:89607d5d4e6d 4548 extern double calibration_05_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 42:89607d5d4e6d 4549 extern double calibration_05_V [NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 34:a1993a1ee904 4550 // nominal 95% fullscale point; normValue_0_1 > 0.5
whismanoid 34:a1993a1ee904 4551 // calibration_95_normValue_0_1, calibration_95_V should be around 95% or 75%
whismanoid 42:89607d5d4e6d 4552 extern double calibration_95_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 42:89607d5d4e6d 4553 extern double calibration_95_V [NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 34:a1993a1ee904 4554 #endif // HAS_Platform_AIN_Calibration
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 {
whismanoid 34:a1993a1ee904 4558 // TODO: return corrected normValue_0_1 using two-point linear calibration
whismanoid 34:a1993a1ee904 4559 // point 1: calibration_05_normValue_0_1[ch], calibration_05_V[ch]
whismanoid 34:a1993a1ee904 4560 // point 2: calibration_95_normValue_0_1[ch], calibration_95_V[ch]
whismanoid 34:a1993a1ee904 4561 // validate that there is enough span to get sensible results
whismanoid 34:a1993a1ee904 4562 //
whismanoid 34:a1993a1ee904 4563 int ch = channel_0_5;
whismanoid 34:a1993a1ee904 4564 // 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 4565 // ch, calibration_05_normValue_0_1[ch],
whismanoid 34:a1993a1ee904 4566 // ch, calibration_05_V[ch],
whismanoid 34:a1993a1ee904 4567 // ch, calibration_95_normValue_0_1[ch],
whismanoid 34:a1993a1ee904 4568 // ch, calibration_95_V[ch]
whismanoid 34:a1993a1ee904 4569 // );
whismanoid 34:a1993a1ee904 4570 // cmdLine.serial().printf("\r\n adc_full_scale_voltage[%d] = %1.6fV",
whismanoid 34:a1993a1ee904 4571 // ch,
whismanoid 34:a1993a1ee904 4572 // adc_full_scale_voltage[ch]
whismanoid 34:a1993a1ee904 4573 // );
whismanoid 34:a1993a1ee904 4574 // raw normValue nominal 5% and 95% points
whismanoid 34:a1993a1ee904 4575 double raw_05_normValue = calibration_05_normValue_0_1[ch];
whismanoid 34:a1993a1ee904 4576 double raw_95_normValue = calibration_95_normValue_0_1[ch];
whismanoid 34:a1993a1ee904 4577 // calibrated normValue nominal 5% and 95% points
whismanoid 34:a1993a1ee904 4578 // divide V/adc_full_scale_voltage[0] to get normValue_0_1
whismanoid 34:a1993a1ee904 4579 double cal_05_normValue = calibration_05_V[ch] / adc_full_scale_voltage[ch];
whismanoid 34:a1993a1ee904 4580 double cal_95_normValue = calibration_95_V[ch] / adc_full_scale_voltage[ch];
whismanoid 34:a1993a1ee904 4581 // cmdLine.serial().printf("\r\n CalibratedNormValue(%d, %1.6f) cal_05_normValue = %1.6f",
whismanoid 34:a1993a1ee904 4582 // ch,
whismanoid 34:a1993a1ee904 4583 // raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4584 // cal_05_normValue
whismanoid 34:a1993a1ee904 4585 // );
whismanoid 34:a1993a1ee904 4586 // cmdLine.serial().printf("\r\n CalibratedNormValue(%d, %1.6f) cal_95_normValue = %1.6f",
whismanoid 34:a1993a1ee904 4587 // ch,
whismanoid 34:a1993a1ee904 4588 // raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4589 // cal_95_normValue
whismanoid 34:a1993a1ee904 4590 // );
whismanoid 34:a1993a1ee904 4591 //
whismanoid 34:a1993a1ee904 4592 double span_raw = raw_95_normValue - raw_05_normValue;
whismanoid 34:a1993a1ee904 4593 double span_cal = cal_95_normValue - cal_05_normValue;
whismanoid 34:a1993a1ee904 4594 // cmdLine.serial().printf("\r\n CalibratedNormValue(%d, %1.6f) span_raw = %1.6f",
whismanoid 34:a1993a1ee904 4595 // ch,
whismanoid 34:a1993a1ee904 4596 // raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4597 // span_raw
whismanoid 34:a1993a1ee904 4598 // );
whismanoid 34:a1993a1ee904 4599 // cmdLine.serial().printf("\r\n CalibratedNormValue(%d, %1.6f) span_cal = %1.6f",
whismanoid 34:a1993a1ee904 4600 // ch,
whismanoid 34:a1993a1ee904 4601 // raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4602 // span_cal
whismanoid 34:a1993a1ee904 4603 // );
whismanoid 34:a1993a1ee904 4604 // if calibration is not valid, return unmodified normValue_0_1 and print a warning
whismanoid 34:a1993a1ee904 4605 if (span_raw < 0.001) {
whismanoid 34:a1993a1ee904 4606 cmdLine.serial().printf("\r\n! CalibratedNormValue(%d, %1.6f) ERRRRRR span_raw = %1.6f",
whismanoid 34:a1993a1ee904 4607 ch,
whismanoid 34:a1993a1ee904 4608 raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4609 span_raw
whismanoid 34:a1993a1ee904 4610 );
whismanoid 34:a1993a1ee904 4611 return raw_normValue_0_1;
whismanoid 34:a1993a1ee904 4612 }
whismanoid 34:a1993a1ee904 4613 if (span_cal < 0.001) {
whismanoid 34:a1993a1ee904 4614 cmdLine.serial().printf("\r\n! CalibratedNormValue(%d, %1.6f) ERRRRRR span_cal = %1.6f",
whismanoid 34:a1993a1ee904 4615 ch,
whismanoid 34:a1993a1ee904 4616 raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4617 span_cal
whismanoid 34:a1993a1ee904 4618 );
whismanoid 34:a1993a1ee904 4619 return raw_normValue_0_1;
whismanoid 34:a1993a1ee904 4620 }
whismanoid 34:a1993a1ee904 4621 double slope_correction = span_cal / span_raw;
whismanoid 34:a1993a1ee904 4622 double corrected_normValue_0_1 = cal_05_normValue + ((raw_normValue_0_1 - raw_05_normValue) * slope_correction);
whismanoid 34:a1993a1ee904 4623 // cmdLine.serial().printf("\r\n CalibratedNormValue(%d, %1.6f) slope_correction = %1.6f",
whismanoid 34:a1993a1ee904 4624 // ch,
whismanoid 34:a1993a1ee904 4625 // raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4626 // slope_correction
whismanoid 34:a1993a1ee904 4627 // );
whismanoid 34:a1993a1ee904 4628 // cmdLine.serial().printf("\r\n CalibratedNormValue(%d, %1.6f) corrected_normValue_0_1 = %1.6f\r\n",
whismanoid 34:a1993a1ee904 4629 // ch,
whismanoid 34:a1993a1ee904 4630 // raw_normValue_0_1,
whismanoid 34:a1993a1ee904 4631 // corrected_normValue_0_1
whismanoid 34:a1993a1ee904 4632 // );
whismanoid 34:a1993a1ee904 4633 return corrected_normValue_0_1;
whismanoid 34:a1993a1ee904 4634 }
whismanoid 34:a1993a1ee904 4635 #endif // HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 4636 // Option to customize channel names in datalog header line
whismanoid 45:74bf1fe021e5 4637 // This could be used to identify external hardware attached to each input
whismanoid 13:184a08909405 4638 #if HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 4639 // WIP Editable customChannelHeader strings #363 - Platform_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 4640 #if MAX40108_DEMO
whismanoid 55:477ba09475d7 4641 char Platform_AIN_customChannelHeader_ch0[Platform_AIN_customChannelHeader_MAXLENGTH] = "=AIN4"; // MAX40108: AIN0_1V0_current_ 0.591202*100/3.34 = 17.70065868263473mA
whismanoid 55:477ba09475d7 4642 char Platform_AIN_customChannelHeader_ch1[Platform_AIN_customChannelHeader_MAXLENGTH] = "=AIN5"; // MAX40108: AIN1_1V0_voltage
whismanoid 55:477ba09475d7 4643 char Platform_AIN_customChannelHeader_ch2[Platform_AIN_customChannelHeader_MAXLENGTH] = "WE"; // MAX40108: AIN2_WE
whismanoid 55:477ba09475d7 4644 char Platform_AIN_customChannelHeader_ch3[Platform_AIN_customChannelHeader_MAXLENGTH] = "CE"; // MAX40108: AIN3_CE
whismanoid 55:477ba09475d7 4645 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4646 char Platform_AIN_customChannelHeader_ch4[Platform_AIN_customChannelHeader_MAXLENGTH] = "BATTmA"; // MAX40108: AIN4_*100/3.34=mA
whismanoid 55:477ba09475d7 4647 #else // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4648 char Platform_AIN_customChannelHeader_ch4[Platform_AIN_customChannelHeader_MAXLENGTH] = "*100/3.34=mA"; // MAX40108: AIN4_*100/3.34=mA
whismanoid 55:477ba09475d7 4649 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4650 char Platform_AIN_customChannelHeader_ch5[Platform_AIN_customChannelHeader_MAXLENGTH] = "BATTV"; // MAX40108: AIN5_CELL_VOLTAGE
whismanoid 55:477ba09475d7 4651 #else // MAX40108_DEMO ----------
whismanoid 55:477ba09475d7 4652 char Platform_AIN_customChannelHeader_ch0[Platform_AIN_customChannelHeader_MAXLENGTH] = "=AIN4";
whismanoid 55:477ba09475d7 4653 char Platform_AIN_customChannelHeader_ch1[Platform_AIN_customChannelHeader_MAXLENGTH] = "=AIN5";
whismanoid 55:477ba09475d7 4654 char Platform_AIN_customChannelHeader_ch2[Platform_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4655 char Platform_AIN_customChannelHeader_ch3[Platform_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4656 char Platform_AIN_customChannelHeader_ch4[Platform_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4657 char Platform_AIN_customChannelHeader_ch5[Platform_AIN_customChannelHeader_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4658 #endif // MAX40108_DEMO ----------
whismanoid 55:477ba09475d7 4659 static char* Platform_AIN_customChannelHeader_ch[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4660 Platform_AIN_customChannelHeader_ch0,
whismanoid 55:477ba09475d7 4661 Platform_AIN_customChannelHeader_ch1,
whismanoid 55:477ba09475d7 4662 Platform_AIN_customChannelHeader_ch2,
whismanoid 55:477ba09475d7 4663 Platform_AIN_customChannelHeader_ch3,
whismanoid 55:477ba09475d7 4664 Platform_AIN_customChannelHeader_ch4,
whismanoid 55:477ba09475d7 4665 Platform_AIN_customChannelHeader_ch5,
whismanoid 13:184a08909405 4666 };
whismanoid 13:184a08909405 4667 #endif // HAS_Platform_AIN_customChannelHeader
whismanoid 55:477ba09475d7 4668 // MAX40108 Datalog Math #362 -- Platform_MathOffsetA[] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4669 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4670 double Platform_MathOffsetA[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4671 0,
whismanoid 55:477ba09475d7 4672 0,
whismanoid 55:477ba09475d7 4673 0.74, // Math ch2 Volt enable, offset 0.74, gainMul R206=10000, gainDiv 1, units nA
whismanoid 55:477ba09475d7 4674 0,
whismanoid 55:477ba09475d7 4675 0, // Math ch4 Volt enable, offset 0, gainMul 100, gainDiv 3.34, units mA
whismanoid 55:477ba09475d7 4676 0,
whismanoid 55:477ba09475d7 4677 };
whismanoid 55:477ba09475d7 4678 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4679 //
whismanoid 55:477ba09475d7 4680 // MAX40108 Datalog Math #362 -- Platform_MathGainMulA[] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4681 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4682 double Platform_MathGainMulA[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4683 1.0,
whismanoid 55:477ba09475d7 4684 1.0,
whismanoid 55:477ba09475d7 4685 10000.0, // Math ch2 Volt enable, offset 0.74, gainMul R206=10000, gainDiv 1, units nA
whismanoid 55:477ba09475d7 4686 1.0,
whismanoid 55:477ba09475d7 4687 100.0, // Math ch4 Volt enable, offset 0, gainMul 100, gainDiv 3.34, units mA
whismanoid 55:477ba09475d7 4688 1.0,
whismanoid 55:477ba09475d7 4689 };
whismanoid 55:477ba09475d7 4690 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4691 //
whismanoid 55:477ba09475d7 4692 // MAX40108 Datalog Math #362 -- Platform_MathGainDivA[] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4693 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4694 double Platform_MathGainDivA[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4695 1.0,
whismanoid 55:477ba09475d7 4696 1.0,
whismanoid 55:477ba09475d7 4697 1.0, // Math ch2 Volt enable, offset 0.74, gainMul R206=10000, gainDiv 1, units nA
whismanoid 55:477ba09475d7 4698 1.0,
whismanoid 55:477ba09475d7 4699 3.34, // Math ch4 Volt enable, offset 0, gainMul 100, gainDiv 3.34, units mA
whismanoid 55:477ba09475d7 4700 1.0,
whismanoid 55:477ba09475d7 4701 };
whismanoid 55:477ba09475d7 4702 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4703 //
whismanoid 55:477ba09475d7 4704 // MAX40108 Datalog Math #362 -- Platform_MathUnitString[] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4705 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4706 // WIP Editable customChannelHeader strings #363 - Platform_MathUnitString
whismanoid 55:477ba09475d7 4707 #define Platform_MathUnitString_MAXLENGTH 20
whismanoid 55:477ba09475d7 4708 #if MAX40108_DEMO
whismanoid 55:477ba09475d7 4709 char Platform_MathUnitString_ch0[Platform_MathUnitString_MAXLENGTH] = "mA"; // MAX40108: AIN0_1V0_current_ 0.591202*100/3.34 = 17.70065868263473mA
whismanoid 55:477ba09475d7 4710 char Platform_MathUnitString_ch1[Platform_MathUnitString_MAXLENGTH] = "V"; // MAX40108: AIN1_1V0_voltage
whismanoid 55:477ba09475d7 4711 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 4712 char Platform_MathUnitString_ch3[Platform_MathUnitString_MAXLENGTH] = "V"; // MAX40108: AIN3_CE
whismanoid 55:477ba09475d7 4713 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 4714 char Platform_MathUnitString_ch5[Platform_MathUnitString_MAXLENGTH] = "V"; // MAX40108: AIN5_CELL_VOLTAGE
whismanoid 55:477ba09475d7 4715 #else // MAX40108_DEMO ----------
whismanoid 55:477ba09475d7 4716 char Platform_MathUnitString_ch0[Platform_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4717 char Platform_MathUnitString_ch1[Platform_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4718 char Platform_MathUnitString_ch2[Platform_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4719 char Platform_MathUnitString_ch3[Platform_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4720 char Platform_MathUnitString_ch4[Platform_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4721 char Platform_MathUnitString_ch5[Platform_MathUnitString_MAXLENGTH] = "";
whismanoid 55:477ba09475d7 4722 #endif // MAX40108_DEMO ----------
whismanoid 55:477ba09475d7 4723 static char* Platform_MathUnitString[NUM_PLATFORM_ANALOG_IN_CHANNELS] = {
whismanoid 55:477ba09475d7 4724 Platform_MathUnitString_ch0,
whismanoid 55:477ba09475d7 4725 Platform_MathUnitString_ch1,
whismanoid 55:477ba09475d7 4726 Platform_MathUnitString_ch2,
whismanoid 55:477ba09475d7 4727 Platform_MathUnitString_ch3,
whismanoid 55:477ba09475d7 4728 Platform_MathUnitString_ch4,
whismanoid 55:477ba09475d7 4729 Platform_MathUnitString_ch5,
whismanoid 55:477ba09475d7 4730 };
whismanoid 55:477ba09475d7 4731 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 4732 //
whismanoid 1:747f1602abfc 4733 //--------------------------------------------------
whismanoid 1:747f1602abfc 4734 // Option to log platform analog inputs as raw LSB code
whismanoid 1:747f1602abfc 4735 #ifndef LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 1:747f1602abfc 4736 #define LOG_PLATFORM_ANALOG_IN_LSB 0
whismanoid 1:747f1602abfc 4737 #endif
whismanoid 1:747f1602abfc 4738 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 1:747f1602abfc 4739 int Platform_LSB[NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 1:747f1602abfc 4740 #endif
whismanoid 1:747f1602abfc 4741
whismanoid 1:747f1602abfc 4742 //--------------------------------------------------
whismanoid 1:747f1602abfc 4743 // Option to use platform analog inputs as Voltage
whismanoid 1:747f1602abfc 4744 #ifndef LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 1:747f1602abfc 4745 #define LOG_PLATFORM_ANALOG_IN_VOLTS 1
whismanoid 1:747f1602abfc 4746 #endif
whismanoid 1:747f1602abfc 4747 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 1:747f1602abfc 4748 double Platform_Voltage[NUM_PLATFORM_ANALOG_IN_CHANNELS];
whismanoid 1:747f1602abfc 4749 #endif
whismanoid 3:9055e17e181a 4750 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 0:cb44e2e9ec4c 4751
whismanoid 10:04022a61b527 4752 //--------------------------------------------------
whismanoid 10:04022a61b527 4753 // Option to use Command forwarding to Auxiliary serial port
whismanoid 10:04022a61b527 4754 // Command forwarding to Auxiliary serial port TX/RX
whismanoid 10:04022a61b527 4755 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial
whismanoid 10:04022a61b527 4756 // Command forwarding to DAPLINK serial TX/RX cmdLine_DAPLINKserial
whismanoid 10:04022a61b527 4757 // prefer cmdLine_AUXserial if available, else cmdLine_DAPLINKserial; else we don't have this feature
whismanoid 10:04022a61b527 4758 #ifndef USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4759 #define USE_AUX_SERIAL_CMD_FORWARDING 1
whismanoid 10:04022a61b527 4760 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4761 #if USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4762 // Command forwarding to Auxiliary serial port TX/RX #257 -- global parameters
whismanoid 49:359a6b9df7c1 4763 const size_t RX_STRING_BUF_SIZE = 5000;
whismanoid 10:04022a61b527 4764 int g_auxSerialCom_baud = 9600; //!< baud rate Auxiliary serial port
whismanoid 10:04022a61b527 4765 // transmit command string by AUX TX
whismanoid 10:04022a61b527 4766 #if 0
whismanoid 10:04022a61b527 4767 int g_auxSerialCom_tx_wait_echo = 0; //!< TX wait for each character echo?
whismanoid 10:04022a61b527 4768 int g_auxSerialCom_tx_char_delay_ms = 0; //!< TX delay after each char?
whismanoid 10:04022a61b527 4769 int g_auxSerialCom_tx_line_delay_ms = 0; //!< TX delay after each CR/LF?
whismanoid 10:04022a61b527 4770 #endif
whismanoid 10:04022a61b527 4771 // capture received string from AUX RX
whismanoid 10:04022a61b527 4772 Timer g_auxSerialCom_Timer;
whismanoid 10:04022a61b527 4773 int g_auxSerialCom_Timer_begin_message_ms = 0; //!< start of message
whismanoid 10:04022a61b527 4774 int g_auxSerialCom_Timer_begin_rx_idle_ms = 0; //!< recent RX character timestamp
whismanoid 10:04022a61b527 4775 int g_auxSerialCom_message_ms = 10000; //!< maximum RX message total response time
whismanoid 10:04022a61b527 4776 int g_auxSerialCom_rx_idle_ms = 500; //!< maximum RX message idle time between characters
whismanoid 10:04022a61b527 4777 int g_auxSerialCom_rx_max_count = RX_STRING_BUF_SIZE-1; //!< maximum RX message total length
whismanoid 10:04022a61b527 4778 const int aux_serial_cmd_forwarding_rx_eot_not_used = 'x';
whismanoid 10:04022a61b527 4779 int g_auxSerialCom_rx_eot = aux_serial_cmd_forwarding_rx_eot_not_used; //!< capture RX until match end of text char
whismanoid 10:04022a61b527 4780 //~ int g_auxSerialCom_rx_eot = 0; //!< capture RX until match end of text string?
whismanoid 10:04022a61b527 4781 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4782 #if USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4783 // TODO WIP Command forwarding to Auxiliary serial port TX/RX #257
whismanoid 10:04022a61b527 4784 // prefer cmdLine_AUXserial if available, else cmdLine_DAPLINKserial; else we don't have this feature
whismanoid 10:04022a61b527 4785 # if HAS_AUX_SERIAL
whismanoid 10:04022a61b527 4786 // TODO WIP Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257
whismanoid 10:04022a61b527 4787 # elif HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 4788 // TODO WIP Command forwarding to DAPLINK serial TX/RX cmdLine_DAPLINKserial #257
whismanoid 10:04022a61b527 4789 # else // neither HAS_AUX_SERIAL HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 4790 #warning "info: USE_AUX_SERIAL_CMD_FORWARDING should not be enabled without HAS_AUX_SERIAL or HAS_DAPLINK_SERIAL"
whismanoid 10:04022a61b527 4791 # endif // HAS_AUX_SERIAL HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 4792 # if HAS_AUX_SERIAL
whismanoid 10:04022a61b527 4793 // TODO WIP Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257
whismanoid 10:04022a61b527 4794 # endif // HAS_AUX_SERIAL
whismanoid 10:04022a61b527 4795 # if HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 4796 // TODO WIP Command forwarding to DAPLINK serial TX/RX cmdLine_DAPLINKserial #257
whismanoid 10:04022a61b527 4797 # endif // HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 4798 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4799
whismanoid 8:dffee7509bfb 4800 // CODE GENERATOR: example code for ADC: serial port declaration
whismanoid 8:dffee7509bfb 4801 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4802 // Declare the Serial driver
whismanoid 8:dffee7509bfb 4803 // default baud rate settings are 9600 8N1
whismanoid 8:dffee7509bfb 4804 // install device driver from http://developer.mbed.org/media/downloads/drivers/mbedWinSerial_16466.exe
whismanoid 8:dffee7509bfb 4805 // see docs https://docs.mbed.com/docs/mbed-os-handbook/en/5.5/getting_started/what_need/
whismanoid 8:dffee7509bfb 4806 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4807 #if defined(TARGET_MAX32630)
whismanoid 8:dffee7509bfb 4808 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32630FTHR: P0_1,P0_0 (Bluetooth PAN1326B)
whismanoid 8:dffee7509bfb 4809 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX32630FTHR: P2_1,P2_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4810 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32630FTHR: P3_1,P3_0 (J1.15,J1.14)
whismanoid 8:dffee7509bfb 4811 //Serial UART3serial(UART3_TX,UART3_RX); // tx,rx UART3 MAX32630FTHR: P5_4,P5_3 (J3.7,J3.8)
whismanoid 8:dffee7509bfb 4812 //
whismanoid 8:dffee7509bfb 4813 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial
whismanoid 8:dffee7509bfb 4814 Serial AUXserial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32630FTHR: P3_1,P3_0 (J1.15,J1.14)
whismanoid 8:dffee7509bfb 4815 //Serial J3AUXserial(UART3_TX,UART3_RX); // tx,rx UART3 MAX32630FTHR: P5_4,P5_3 (J3.7,J3.8)
whismanoid 8:dffee7509bfb 4816 //Serial BTAUXserial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32630FTHR: P0_1,P0_0 (Bluetooth PAN1326B)
whismanoid 8:dffee7509bfb 4817 #define HAS_AUX_SERIAL 1
whismanoid 8:dffee7509bfb 4818 //
whismanoid 8:dffee7509bfb 4819 // Hardware serial port over DAPLink
whismanoid 8:dffee7509bfb 4820 // The default baud rate for the DapLink UART is 9600
whismanoid 8:dffee7509bfb 4821 Serial DAPLINKserial(P2_1,P2_0); // tx,rx UART1 MAX32630FTHR: P2_1,P2_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4822 #define HAS_DAPLINK_SERIAL 1
whismanoid 8:dffee7509bfb 4823 //
whismanoid 8:dffee7509bfb 4824 // Virtual serial port over USB
whismanoid 8:dffee7509bfb 4825 #include "USBSerial.h"
whismanoid 8:dffee7509bfb 4826 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 8:dffee7509bfb 4827 USBSerial serial;
whismanoid 8:dffee7509bfb 4828 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4829 #elif defined(TARGET_MAX32625MBED)
whismanoid 8:dffee7509bfb 4830 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32625MBED: P0_1,P0_0 (Arduino D1,D0)
whismanoid 8:dffee7509bfb 4831 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX32625MBED: P2_1,P2_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4832 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32625MBED: P3_1,P3_0 (J15-LEDgreen,LEDred)
whismanoid 8:dffee7509bfb 4833 //
whismanoid 8:dffee7509bfb 4834 // Hardware serial port over DAPLink
whismanoid 8:dffee7509bfb 4835 // The default baud rate for the DapLink UART is 9600
whismanoid 8:dffee7509bfb 4836 Serial DAPLINKserial(P2_1,P2_0); // tx,rx UART1 MAX32625MBED: P2_1,P2_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4837 #define HAS_DAPLINK_SERIAL 1
whismanoid 8:dffee7509bfb 4838 //
whismanoid 8:dffee7509bfb 4839 // Virtual serial port over USB
whismanoid 8:dffee7509bfb 4840 #include "USBSerial.h"
whismanoid 8:dffee7509bfb 4841 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 8:dffee7509bfb 4842 USBSerial serial;
whismanoid 8:dffee7509bfb 4843 //--------------------------------------------------
whismanoid 22:d6dc8a85f435 4844 #elif defined(TARGET_MAX32625PICO)
whismanoid 8:dffee7509bfb 4845 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32625PICO: P0_1,P0_0 (pin 19/20)
whismanoid 8:dffee7509bfb 4846 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX32625PICO: P2_1,P2_0 (underside?)
whismanoid 8:dffee7509bfb 4847 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32625PICO: P3_1,P3_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4848 //
whismanoid 8:dffee7509bfb 4849 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial
whismanoid 8:dffee7509bfb 4850 Serial AUXserial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32625PICO: P0_1,P0_0 (pin 19/20)
whismanoid 8:dffee7509bfb 4851 #define HAS_AUX_SERIAL 1
whismanoid 8:dffee7509bfb 4852 //
whismanoid 8:dffee7509bfb 4853 // Hardware serial port over DAPLink
whismanoid 8:dffee7509bfb 4854 Serial DAPLINKserial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32625PICO: P3_1,P3_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4855 #define HAS_DAPLINK_SERIAL 1
whismanoid 8:dffee7509bfb 4856 //
whismanoid 8:dffee7509bfb 4857 // Virtual serial port over USB
whismanoid 8:dffee7509bfb 4858 #include "USBSerial.h"
whismanoid 8:dffee7509bfb 4859 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 8:dffee7509bfb 4860 USBSerial serial;
whismanoid 22:d6dc8a85f435 4861 //--------------------------------------------------
whismanoid 22:d6dc8a85f435 4862 #elif defined(TARGET_MAX40108DEMOP2U9)
whismanoid 22:d6dc8a85f435 4863 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX40108DEMOP2U9: P0_1,P0_0 (J90.1/J90.0 to console)
whismanoid 22:d6dc8a85f435 4864 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK)
whismanoid 22:d6dc8a85f435 4865 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX40108DEMOP2U9: P3_1,P3_0 (unavailable)
whismanoid 22:d6dc8a85f435 4866 //
whismanoid 22:d6dc8a85f435 4867 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial is used as main serial port in MAX40108 Demo board
whismanoid 22:d6dc8a85f435 4868 Serial serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX40108DEMOP2U9: P0_1,P0_0 (J90.1/J90.0 to console)
whismanoid 22:d6dc8a85f435 4869 // #define HAS_AUX_SERIAL 1
whismanoid 22:d6dc8a85f435 4870 //
whismanoid 22:d6dc8a85f435 4871 // Hardware serial port over DAPLink
whismanoid 22:d6dc8a85f435 4872 // connection to external MAX32625PICO(DAPLINK) needed TX/RX swap in firmware.
whismanoid 22:d6dc8a85f435 4873 // MAX32625PICO(DAPLINK) drives DAPLINK.8, listens on DAPLINK.6.
whismanoid 22:d6dc8a85f435 4874 // See AN6350 MAX32625 Users Guide 7.5.2.3.1 TX and RX Pin Mapping for UART 1 -- Mapping Option B
whismanoid 39:4d285e961435 4875 #ifdef BOARD_SERIAL_NUMBER
whismanoid 39:4d285e961435 4876 // data unique to certain boards based on serial number
whismanoid 39:4d285e961435 4877 # if (BOARD_SERIAL_NUMBER) == 0
whismanoid 39:4d285e961435 4878 #warning "(BOARD_SERIAL_NUMBER) == 0"
whismanoid 39:4d285e961435 4879 // s/n 0 is not really a MAX40108 board, it's actually a MAX32625PICO used for early development. So no swap.
whismanoid 39:4d285e961435 4880 Serial DAPLINKserial(UART1_TX,UART1_RX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option A (normal)
whismanoid 39:4d285e961435 4881 //Serial DAPLINKserial(UART1_RX,UART1_TX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option B (TX/RX-swap)
whismanoid 39:4d285e961435 4882 #define HAS_DAPLINK_SERIAL 1
whismanoid 39:4d285e961435 4883 //
whismanoid 39:4d285e961435 4884 // # elif (BOARD_SERIAL_NUMBER) == 1
whismanoid 39:4d285e961435 4885 // #warning "(BOARD_SERIAL_NUMBER) == 1"
whismanoid 39:4d285e961435 4886 // //
whismanoid 39:4d285e961435 4887 // # elif (BOARD_SERIAL_NUMBER) == 2
whismanoid 39:4d285e961435 4888 // #warning "(BOARD_SERIAL_NUMBER) == 2"
whismanoid 39:4d285e961435 4889 // //
whismanoid 39:4d285e961435 4890 // # elif (BOARD_SERIAL_NUMBER) == 3
whismanoid 39:4d285e961435 4891 // #warning "(BOARD_SERIAL_NUMBER) == 3"
whismanoid 39:4d285e961435 4892 // //
whismanoid 39:4d285e961435 4893 // # elif (BOARD_SERIAL_NUMBER) == 4
whismanoid 39:4d285e961435 4894 // #warning "(BOARD_SERIAL_NUMBER) == 4"
whismanoid 39:4d285e961435 4895 // //
whismanoid 39:4d285e961435 4896 // # elif (BOARD_SERIAL_NUMBER) == 5
whismanoid 39:4d285e961435 4897 // #warning "(BOARD_SERIAL_NUMBER) == 5"
whismanoid 39:4d285e961435 4898 // //
whismanoid 39:4d285e961435 4899 // # elif (BOARD_SERIAL_NUMBER) == 6
whismanoid 39:4d285e961435 4900 // #warning "(BOARD_SERIAL_NUMBER) == 6"
whismanoid 39:4d285e961435 4901 // //
whismanoid 39:4d285e961435 4902 # else
whismanoid 39:4d285e961435 4903 // #warning "BOARD_SERIAL_NUMBER defined but not recognized"
whismanoid 22:d6dc8a85f435 4904 //Serial DAPLINKserial(UART1_TX,UART1_RX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option A (normal)
whismanoid 22:d6dc8a85f435 4905 Serial DAPLINKserial(UART1_RX,UART1_TX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option B (TX/RX-swap)
whismanoid 22:d6dc8a85f435 4906 #define HAS_DAPLINK_SERIAL 1
whismanoid 39:4d285e961435 4907 # endif
whismanoid 39:4d285e961435 4908 #else // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 39:4d285e961435 4909 #warning "BOARD_SERIAL_NUMBER not defined; using default values"
whismanoid 39:4d285e961435 4910 //Serial DAPLINKserial(UART1_TX,UART1_RX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option A (normal)
whismanoid 39:4d285e961435 4911 Serial DAPLINKserial(UART1_RX,UART1_TX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option B (TX/RX-swap)
whismanoid 39:4d285e961435 4912 #define HAS_DAPLINK_SERIAL 1
whismanoid 39:4d285e961435 4913 //
whismanoid 39:4d285e961435 4914 #endif // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 22:d6dc8a85f435 4915 //
whismanoid 22:d6dc8a85f435 4916 // Serial AUXserial(UART1_TX,UART1_RX); // tx,rx UART2 MAX40108DEMOP2U9: P3_1,P3_0 (unavailable)
whismanoid 22:d6dc8a85f435 4917 // #define HAS_AUX_SERIAL 1
whismanoid 22:d6dc8a85f435 4918 //
whismanoid 22:d6dc8a85f435 4919 // Virtual serial port over USB
whismanoid 22:d6dc8a85f435 4920 // #include "USBSerial.h"
whismanoid 22:d6dc8a85f435 4921 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 22:d6dc8a85f435 4922 //USBSerial serial;
whismanoid 8:dffee7509bfb 4923 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4924 #elif defined(TARGET_MAX32620FTHR)
whismanoid 8:dffee7509bfb 4925 #warning "TARGET_MAX32620FTHR not previously tested; need to define serial pins..."
whismanoid 8:dffee7509bfb 4926 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32620FTHR: P0_1,P0_0 (PMOD0.2,PMOD0.3)
whismanoid 8:dffee7509bfb 4927 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX32620FTHR: P2_1,P2_0 (DAPLINK)
whismanoid 8:dffee7509bfb 4928 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32620FTHR: P3_1,P3_0 (J1.15,J1.14)
whismanoid 8:dffee7509bfb 4929 //Serial UART3serial(UART3_TX,UART3_RX); // tx,rx UART3 MAX32620FTHR: P5_4,P5_3 (J2.7,J2.8)
whismanoid 8:dffee7509bfb 4930 //
whismanoid 8:dffee7509bfb 4931 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial
whismanoid 8:dffee7509bfb 4932 Serial serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32620FTHR: P3_1,P3_0 (J1.15,J1.14)
whismanoid 8:dffee7509bfb 4933 //Serial AUXserial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32620FTHR: P3_1,P3_0 (J1.15,J1.14)
whismanoid 8:dffee7509bfb 4934 Serial AUXserial(UART3_TX,UART3_RX); // tx,rx UART3 MAX32620FTHR: P5_4,P5_3 (J2.7,J2.8)
whismanoid 8:dffee7509bfb 4935 //Serial PMOD0AUXserial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32620FTHR: P0_1,P0_0 (PMOD0.2,PMOD0.3)
whismanoid 8:dffee7509bfb 4936 #define HAS_AUX_SERIAL 1
whismanoid 8:dffee7509bfb 4937 //
whismanoid 8:dffee7509bfb 4938 // Hardware serial port over DAPLink
whismanoid 8:dffee7509bfb 4939 // The default baud rate for the DapLink UART is 9600
whismanoid 8:dffee7509bfb 4940 Serial DAPLINKserial(USBTX, USBRX); // tx,rx MAX32620FTHR: P2_1,P2_0
whismanoid 8:dffee7509bfb 4941 //Serial DAPLINKserial(STDIO_UART_TX, STDIO_UART_RX); // tx, rx
whismanoid 8:dffee7509bfb 4942 #define HAS_DAPLINK_SERIAL 1
whismanoid 8:dffee7509bfb 4943 //
whismanoid 8:dffee7509bfb 4944 // Virtual serial port over USB
whismanoid 8:dffee7509bfb 4945 // #include "USBSerial.h"
whismanoid 8:dffee7509bfb 4946 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 8:dffee7509bfb 4947 //USBSerial serial; // MAX32620FTHR: USBSerial crash??
whismanoid 8:dffee7509bfb 4948 #warning "TARGET_MAX32620FTHR not previously tested; USBSerial crash?"
whismanoid 8:dffee7509bfb 4949 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4950 #elif defined(TARGET_MAX32600)
whismanoid 8:dffee7509bfb 4951 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32600MBED: P1_1,P1_0 (Arduino D1,D0)(DAPLINK)
whismanoid 8:dffee7509bfb 4952 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART2 MAX32625MBED: P1_3,P1_2 (Arduino D3,D2)
whismanoid 8:dffee7509bfb 4953 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART1 MAX32625MBED: P7_3,P7_2 ( ?? )
whismanoid 8:dffee7509bfb 4954 //
whismanoid 8:dffee7509bfb 4955 // Hardware serial port over DAPLink
whismanoid 8:dffee7509bfb 4956 // The default baud rate for the DapLink UART is 9600
whismanoid 8:dffee7509bfb 4957 Serial DAPLINKserial(P1_1,P1_0); // tx,rx UART0 MAX32600MBED: P1_1,P1_0 (Arduino D1,D0)(DAPLINK)
whismanoid 8:dffee7509bfb 4958 #define HAS_DAPLINK_SERIAL 1
whismanoid 8:dffee7509bfb 4959 //
whismanoid 8:dffee7509bfb 4960 // Virtual serial port over USB
whismanoid 8:dffee7509bfb 4961 #include "USBSerial.h"
whismanoid 8:dffee7509bfb 4962 // The baud rate does not affect the virtual USBSerial UART.
whismanoid 8:dffee7509bfb 4963 USBSerial serial;
whismanoid 8:dffee7509bfb 4964 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4965 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
whismanoid 8:dffee7509bfb 4966 Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx
whismanoid 8:dffee7509bfb 4967 //--------------------------------------------------
whismanoid 8:dffee7509bfb 4968 #else
whismanoid 8:dffee7509bfb 4969 #if defined(SERIAL_TX)
whismanoid 8:dffee7509bfb 4970 #warning "target not previously tested; guess serial pins are SERIAL_TX, SERIAL_RX..."
whismanoid 8:dffee7509bfb 4971 Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx
whismanoid 8:dffee7509bfb 4972 #elif defined(USBTX)
whismanoid 8:dffee7509bfb 4973 #warning "target not previously tested; guess serial pins are USBTX, USBRX..."
whismanoid 8:dffee7509bfb 4974 Serial serial(USBTX, USBRX); // tx, rx
whismanoid 8:dffee7509bfb 4975 #elif defined(UART_TX)
whismanoid 8:dffee7509bfb 4976 #warning "target not previously tested; guess serial pins are UART_TX, UART_RX..."
whismanoid 8:dffee7509bfb 4977 Serial serial(UART_TX, UART_RX); // tx, rx
whismanoid 8:dffee7509bfb 4978 #else
whismanoid 8:dffee7509bfb 4979 #warning "target not previously tested; need to define serial pins..."
whismanoid 8:dffee7509bfb 4980 #endif
whismanoid 8:dffee7509bfb 4981 #endif
whismanoid 8:dffee7509bfb 4982 //
whismanoid 8:dffee7509bfb 4983 #include "CmdLine.h"
whismanoid 8:dffee7509bfb 4984
whismanoid 8:dffee7509bfb 4985 # if HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 4986 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial
whismanoid 8:dffee7509bfb 4987 CmdLine cmdLine_AUXserial(AUXserial, "AUXserial");
whismanoid 10:04022a61b527 4988 uint8_t Datalogger_enable_AUXserial = {
whismanoid 10:04022a61b527 4989 #if USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4990 // Command forwarding to Auxiliary serial port;
whismanoid 10:04022a61b527 4991 // don't accept commands from Auxiliary serial port
whismanoid 10:04022a61b527 4992 false
whismanoid 10:04022a61b527 4993 #else // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4994 true
whismanoid 10:04022a61b527 4995 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 4996 };
whismanoid 8:dffee7509bfb 4997 # endif // HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 4998 # if HAS_DAPLINK_SERIAL
whismanoid 8:dffee7509bfb 4999 CmdLine cmdLine_DAPLINKserial(DAPLINKserial, "DAPLINK");
whismanoid 8:dffee7509bfb 5000 uint8_t Datalogger_enable_DAPLINKserial = true;
whismanoid 8:dffee7509bfb 5001 # endif // HAS_DAPLINK_SERIAL
whismanoid 8:dffee7509bfb 5002 CmdLine cmdLine(serial, "serial");
whismanoid 8:dffee7509bfb 5003 uint8_t Datalogger_enable_serial = true;
whismanoid 8:dffee7509bfb 5004 // CODE GENERATOR: example code for ADC: serial port declaration (end)
whismanoid 8:dffee7509bfb 5005
whismanoid 21:ac062a97a71d 5006
whismanoid 21:ac062a97a71d 5007 //--------------------------------------------------
whismanoid 23:c6c652bef4b9 5008 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5009 // support for commands %B1! .. %B9!
whismanoid 23:c6c652bef4b9 5010 #ifndef USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5011 #define USE_DATALOGGER_CommandTable 1
whismanoid 23:c6c652bef4b9 5012 //~ #undef USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5013 #endif
whismanoid 23:c6c652bef4b9 5014 #if USE_DATALOGGER_CommandTable // Run_command_table(onButton1_command_table)
whismanoid 23:c6c652bef4b9 5015 const int COMMAND_TABLE_ROW_MAX = 10;
whismanoid 23:c6c652bef4b9 5016 const int COMMAND_TABLE_COL_MAX = 40;
whismanoid 23:c6c652bef4b9 5017 #endif // USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5018 //
whismanoid 23:c6c652bef4b9 5019 #if USE_DATALOGGER_CommandTable // Run_command_table(onButton1_command_table)
whismanoid 23:c6c652bef4b9 5020 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 23:c6c652bef4b9 5021 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5022 // onButton1_command_table[] supports command %B1! -- run, %B1@ -- edit
whismanoid 45:74bf1fe021e5 5023 // MAX40108p2 hardware pin P2_7 button SW1 active low
whismanoid 45:74bf1fe021e5 5024 //........................................................12345678901234567890
whismanoid 45:74bf1fe021e5 5025 char onButton1_command_table_00[COMMAND_TABLE_COL_MAX] = "# SW1 event";
whismanoid 45:74bf1fe021e5 5026 char onButton1_command_table_01[COMMAND_TABLE_COL_MAX] = ">>SW1=LP1 deep sleep 10 sec";
whismanoid 45:74bf1fe021e5 5027 char onButton1_command_table_02[COMMAND_TABLE_COL_MAX] = "%H91"; // LED off
whismanoid 45:74bf1fe021e5 5028 char onButton1_command_table_03[COMMAND_TABLE_COL_MAX] = "%H92"; // LED off
whismanoid 45:74bf1fe021e5 5029 char onButton1_command_table_04[COMMAND_TABLE_COL_MAX] = "%H93"; // LED off
whismanoid 45:74bf1fe021e5 5030 char onButton1_command_table_05[COMMAND_TABLE_COL_MAX] = "%H9"; // diagnostic pulse D9
whismanoid 45:74bf1fe021e5 5031 char onButton1_command_table_06[COMMAND_TABLE_COL_MAX] = "LT count=10 base=1000 sleep=1";
whismanoid 45:74bf1fe021e5 5032 char onButton1_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5033 char onButton1_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5034 char onButton1_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5035 static char* onButton1_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 23:c6c652bef4b9 5036 onButton1_command_table_00,
whismanoid 23:c6c652bef4b9 5037 onButton1_command_table_01,
whismanoid 23:c6c652bef4b9 5038 onButton1_command_table_02,
whismanoid 23:c6c652bef4b9 5039 onButton1_command_table_03,
whismanoid 23:c6c652bef4b9 5040 onButton1_command_table_04,
whismanoid 23:c6c652bef4b9 5041 onButton1_command_table_05,
whismanoid 23:c6c652bef4b9 5042 onButton1_command_table_06,
whismanoid 23:c6c652bef4b9 5043 onButton1_command_table_07,
whismanoid 23:c6c652bef4b9 5044 onButton1_command_table_08,
whismanoid 23:c6c652bef4b9 5045 onButton1_command_table_09,
whismanoid 23:c6c652bef4b9 5046 };
whismanoid 23:c6c652bef4b9 5047 #endif // HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 23:c6c652bef4b9 5048 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 23:c6c652bef4b9 5049 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5050 // onButton2_command_table[] supports command %B2! -- run, %B2@ -- edit
whismanoid 45:74bf1fe021e5 5051 // MAX40108p2 hardware pin P1_7 connector J91.3 active low
whismanoid 45:74bf1fe021e5 5052 //........................................................12345678901234567890
whismanoid 45:74bf1fe021e5 5053 char onButton2_command_table_00[COMMAND_TABLE_COL_MAX] = "# J91.3=Halt"; // remark
whismanoid 45:74bf1fe021e5 5054 char onButton2_command_table_01[COMMAND_TABLE_COL_MAX] = "%L91"; // LED on
whismanoid 45:74bf1fe021e5 5055 char onButton2_command_table_02[COMMAND_TABLE_COL_MAX] = "L"; // halts data logging
whismanoid 45:74bf1fe021e5 5056 char onButton2_command_table_03[COMMAND_TABLE_COL_MAX] = "%H92"; // LED off
whismanoid 45:74bf1fe021e5 5057 char onButton2_command_table_04[COMMAND_TABLE_COL_MAX] = "%L93"; // LED on
whismanoid 45:74bf1fe021e5 5058 char onButton2_command_table_05[COMMAND_TABLE_COL_MAX] = ">>J91.2=Halt"; // to DAPLINK comms
whismanoid 23:c6c652bef4b9 5059 char onButton2_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5060 char onButton2_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5061 char onButton2_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5062 char onButton2_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 23:c6c652bef4b9 5063 static char* onButton2_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 23:c6c652bef4b9 5064 onButton2_command_table_00,
whismanoid 23:c6c652bef4b9 5065 onButton2_command_table_01,
whismanoid 23:c6c652bef4b9 5066 onButton2_command_table_02,
whismanoid 23:c6c652bef4b9 5067 onButton2_command_table_03,
whismanoid 23:c6c652bef4b9 5068 onButton2_command_table_04,
whismanoid 23:c6c652bef4b9 5069 onButton2_command_table_05,
whismanoid 23:c6c652bef4b9 5070 onButton2_command_table_06,
whismanoid 23:c6c652bef4b9 5071 onButton2_command_table_07,
whismanoid 23:c6c652bef4b9 5072 onButton2_command_table_08,
whismanoid 23:c6c652bef4b9 5073 onButton2_command_table_09,
whismanoid 23:c6c652bef4b9 5074 };
whismanoid 23:c6c652bef4b9 5075 #endif // HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 5076 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 5077 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5078 // onButton3_command_table[] supports command %B3! -- run, %B3@ -- edit
whismanoid 45:74bf1fe021e5 5079 // MAX40108p2 hardware pin P1_6 connector J91.2 active low
whismanoid 45:74bf1fe021e5 5080 //........................................................12345678901234567890
whismanoid 45:74bf1fe021e5 5081 char onButton3_command_table_00[COMMAND_TABLE_COL_MAX] = "# J91.2 event";
whismanoid 45:74bf1fe021e5 5082 char onButton3_command_table_01[COMMAND_TABLE_COL_MAX] = ">>J91.2 event";
whismanoid 45:74bf1fe021e5 5083 char onButton3_command_table_02[COMMAND_TABLE_COL_MAX] = "%L91";
whismanoid 45:74bf1fe021e5 5084 char onButton3_command_table_03[COMMAND_TABLE_COL_MAX] = "%H92";
whismanoid 45:74bf1fe021e5 5085 char onButton3_command_table_04[COMMAND_TABLE_COL_MAX] = "%L93";
whismanoid 45:74bf1fe021e5 5086 char onButton3_command_table_05[COMMAND_TABLE_COL_MAX] = "%H91";
whismanoid 45:74bf1fe021e5 5087 char onButton3_command_table_06[COMMAND_TABLE_COL_MAX] = "%L92";
whismanoid 45:74bf1fe021e5 5088 char onButton3_command_table_07[COMMAND_TABLE_COL_MAX] = "%H93";
whismanoid 45:74bf1fe021e5 5089 char onButton3_command_table_08[COMMAND_TABLE_COL_MAX] = ">>LR -- run full speed";
whismanoid 45:74bf1fe021e5 5090 char onButton3_command_table_09[COMMAND_TABLE_COL_MAX] = "LR";
whismanoid 24:032f3683cb2a 5091 static char* onButton3_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 24:032f3683cb2a 5092 onButton3_command_table_00,
whismanoid 24:032f3683cb2a 5093 onButton3_command_table_01,
whismanoid 24:032f3683cb2a 5094 onButton3_command_table_02,
whismanoid 24:032f3683cb2a 5095 onButton3_command_table_03,
whismanoid 24:032f3683cb2a 5096 onButton3_command_table_04,
whismanoid 24:032f3683cb2a 5097 onButton3_command_table_05,
whismanoid 24:032f3683cb2a 5098 onButton3_command_table_06,
whismanoid 24:032f3683cb2a 5099 onButton3_command_table_07,
whismanoid 24:032f3683cb2a 5100 onButton3_command_table_08,
whismanoid 24:032f3683cb2a 5101 onButton3_command_table_09,
whismanoid 24:032f3683cb2a 5102 };
whismanoid 24:032f3683cb2a 5103 #endif // HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5104 #if HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5105 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5106 // onButton4_command_table[] supports command %B4! -- run, %B4@ -- edit
whismanoid 45:74bf1fe021e5 5107 // no hardware pin available, but useful for containing "# remark" labels for action table
whismanoid 45:74bf1fe021e5 5108 //........................................................12345678901234567890
whismanoid 29:6a9edb6e973b 5109 char onButton4_command_table_00[COMMAND_TABLE_COL_MAX] = "# Button4 event";
whismanoid 30:07197a430869 5110 char onButton4_command_table_01[COMMAND_TABLE_COL_MAX] = "# WE>0.7:active";
whismanoid 29:6a9edb6e973b 5111 char onButton4_command_table_02[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5112 char onButton4_command_table_03[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5113 char onButton4_command_table_04[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5114 char onButton4_command_table_05[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5115 char onButton4_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5116 char onButton4_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5117 char onButton4_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5118 char onButton4_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5119 static char* onButton4_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 29:6a9edb6e973b 5120 onButton4_command_table_00,
whismanoid 29:6a9edb6e973b 5121 onButton4_command_table_01,
whismanoid 29:6a9edb6e973b 5122 onButton4_command_table_02,
whismanoid 29:6a9edb6e973b 5123 onButton4_command_table_03,
whismanoid 29:6a9edb6e973b 5124 onButton4_command_table_04,
whismanoid 29:6a9edb6e973b 5125 onButton4_command_table_05,
whismanoid 29:6a9edb6e973b 5126 onButton4_command_table_06,
whismanoid 29:6a9edb6e973b 5127 onButton4_command_table_07,
whismanoid 29:6a9edb6e973b 5128 onButton4_command_table_08,
whismanoid 29:6a9edb6e973b 5129 onButton4_command_table_09,
whismanoid 29:6a9edb6e973b 5130 };
whismanoid 29:6a9edb6e973b 5131 #endif // HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5132 #if HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5133 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5134 // onButton5_command_table[] supports command %B5! -- run, %B5@ -- edit
whismanoid 45:74bf1fe021e5 5135 // no hardware pin available, but useful for containing "# remark" labels for action table
whismanoid 45:74bf1fe021e5 5136 //........................................................12345678901234567890
whismanoid 29:6a9edb6e973b 5137 char onButton5_command_table_00[COMMAND_TABLE_COL_MAX] = "# Button5 event";
whismanoid 30:07197a430869 5138 char onButton5_command_table_01[COMMAND_TABLE_COL_MAX] = "# WE<0.6:sleep";
whismanoid 29:6a9edb6e973b 5139 char onButton5_command_table_02[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5140 char onButton5_command_table_03[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5141 char onButton5_command_table_04[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5142 char onButton5_command_table_05[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5143 char onButton5_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5144 char onButton5_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5145 char onButton5_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5146 char onButton5_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5147 static char* onButton5_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 29:6a9edb6e973b 5148 onButton5_command_table_00,
whismanoid 29:6a9edb6e973b 5149 onButton5_command_table_01,
whismanoid 29:6a9edb6e973b 5150 onButton5_command_table_02,
whismanoid 29:6a9edb6e973b 5151 onButton5_command_table_03,
whismanoid 29:6a9edb6e973b 5152 onButton5_command_table_04,
whismanoid 29:6a9edb6e973b 5153 onButton5_command_table_05,
whismanoid 29:6a9edb6e973b 5154 onButton5_command_table_06,
whismanoid 29:6a9edb6e973b 5155 onButton5_command_table_07,
whismanoid 29:6a9edb6e973b 5156 onButton5_command_table_08,
whismanoid 29:6a9edb6e973b 5157 onButton5_command_table_09,
whismanoid 29:6a9edb6e973b 5158 };
whismanoid 29:6a9edb6e973b 5159 #endif // HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5160 #if HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5161 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5162 // onButton6_command_table[] supports command %B6! -- run, %B6@ -- edit
whismanoid 45:74bf1fe021e5 5163 // no hardware pin available, but useful for containing "# remark" labels for action table
whismanoid 45:74bf1fe021e5 5164 //........................................................12345678901234567890
whismanoid 29:6a9edb6e973b 5165 char onButton6_command_table_00[COMMAND_TABLE_COL_MAX] = "# Button6 event";
whismanoid 29:6a9edb6e973b 5166 char onButton6_command_table_01[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5167 char onButton6_command_table_02[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5168 char onButton6_command_table_03[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5169 char onButton6_command_table_04[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5170 char onButton6_command_table_05[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5171 char onButton6_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5172 char onButton6_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5173 char onButton6_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5174 char onButton6_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5175 static char* onButton6_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 29:6a9edb6e973b 5176 onButton6_command_table_00,
whismanoid 29:6a9edb6e973b 5177 onButton6_command_table_01,
whismanoid 29:6a9edb6e973b 5178 onButton6_command_table_02,
whismanoid 29:6a9edb6e973b 5179 onButton6_command_table_03,
whismanoid 29:6a9edb6e973b 5180 onButton6_command_table_04,
whismanoid 29:6a9edb6e973b 5181 onButton6_command_table_05,
whismanoid 29:6a9edb6e973b 5182 onButton6_command_table_06,
whismanoid 29:6a9edb6e973b 5183 onButton6_command_table_07,
whismanoid 29:6a9edb6e973b 5184 onButton6_command_table_08,
whismanoid 29:6a9edb6e973b 5185 onButton6_command_table_09,
whismanoid 29:6a9edb6e973b 5186 };
whismanoid 29:6a9edb6e973b 5187 #endif // HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5188 #if HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5189 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5190 // onButton7_command_table[] supports command %B7! -- run, %B7@ -- edit
whismanoid 45:74bf1fe021e5 5191 // no hardware pin available, but useful for containing "# remark" labels for action table
whismanoid 45:74bf1fe021e5 5192 //........................................................12345678901234567890
whismanoid 29:6a9edb6e973b 5193 char onButton7_command_table_00[COMMAND_TABLE_COL_MAX] = "# Button7 event";
whismanoid 29:6a9edb6e973b 5194 char onButton7_command_table_01[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5195 char onButton7_command_table_02[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5196 char onButton7_command_table_03[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5197 char onButton7_command_table_04[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5198 char onButton7_command_table_05[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5199 char onButton7_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5200 char onButton7_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5201 char onButton7_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5202 char onButton7_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5203 static char* onButton7_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 29:6a9edb6e973b 5204 onButton7_command_table_00,
whismanoid 29:6a9edb6e973b 5205 onButton7_command_table_01,
whismanoid 29:6a9edb6e973b 5206 onButton7_command_table_02,
whismanoid 29:6a9edb6e973b 5207 onButton7_command_table_03,
whismanoid 29:6a9edb6e973b 5208 onButton7_command_table_04,
whismanoid 29:6a9edb6e973b 5209 onButton7_command_table_05,
whismanoid 29:6a9edb6e973b 5210 onButton7_command_table_06,
whismanoid 29:6a9edb6e973b 5211 onButton7_command_table_07,
whismanoid 29:6a9edb6e973b 5212 onButton7_command_table_08,
whismanoid 29:6a9edb6e973b 5213 onButton7_command_table_09,
whismanoid 29:6a9edb6e973b 5214 };
whismanoid 29:6a9edb6e973b 5215 #endif // HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5216 #if HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5217 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5218 // onButton8_command_table[] supports command %B8! -- run, %B8@ -- edit
whismanoid 45:74bf1fe021e5 5219 // no hardware pin available, but useful for containing "# remark" labels for action table
whismanoid 45:74bf1fe021e5 5220 //........................................................12345678901234567890
whismanoid 29:6a9edb6e973b 5221 char onButton8_command_table_00[COMMAND_TABLE_COL_MAX] = "# Button8 event";
whismanoid 29:6a9edb6e973b 5222 char onButton8_command_table_01[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5223 char onButton8_command_table_02[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5224 char onButton8_command_table_03[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5225 char onButton8_command_table_04[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5226 char onButton8_command_table_05[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5227 char onButton8_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5228 char onButton8_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5229 char onButton8_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5230 char onButton8_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5231 static char* onButton8_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 29:6a9edb6e973b 5232 onButton8_command_table_00,
whismanoid 29:6a9edb6e973b 5233 onButton8_command_table_01,
whismanoid 29:6a9edb6e973b 5234 onButton8_command_table_02,
whismanoid 29:6a9edb6e973b 5235 onButton8_command_table_03,
whismanoid 29:6a9edb6e973b 5236 onButton8_command_table_04,
whismanoid 29:6a9edb6e973b 5237 onButton8_command_table_05,
whismanoid 29:6a9edb6e973b 5238 onButton8_command_table_06,
whismanoid 29:6a9edb6e973b 5239 onButton8_command_table_07,
whismanoid 29:6a9edb6e973b 5240 onButton8_command_table_08,
whismanoid 29:6a9edb6e973b 5241 onButton8_command_table_09,
whismanoid 29:6a9edb6e973b 5242 };
whismanoid 29:6a9edb6e973b 5243 #endif // HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5244 #if HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5245 // command_table: list of commands to perform on button press
whismanoid 45:74bf1fe021e5 5246 // onButton9_command_table[] supports command %B9! -- run, %B9@ -- edit
whismanoid 45:74bf1fe021e5 5247 // no hardware pin available, but useful for containing "# remark" labels for action table
whismanoid 45:74bf1fe021e5 5248 //........................................................12345678901234567890
whismanoid 29:6a9edb6e973b 5249 char onButton9_command_table_00[COMMAND_TABLE_COL_MAX] = "# Button9 event";
whismanoid 29:6a9edb6e973b 5250 char onButton9_command_table_01[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5251 char onButton9_command_table_02[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5252 char onButton9_command_table_03[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5253 char onButton9_command_table_04[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5254 char onButton9_command_table_05[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5255 char onButton9_command_table_06[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5256 char onButton9_command_table_07[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5257 char onButton9_command_table_08[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5258 char onButton9_command_table_09[COMMAND_TABLE_COL_MAX] = "";
whismanoid 29:6a9edb6e973b 5259 static char* onButton9_command_table[COMMAND_TABLE_ROW_MAX] = {
whismanoid 29:6a9edb6e973b 5260 onButton9_command_table_00,
whismanoid 29:6a9edb6e973b 5261 onButton9_command_table_01,
whismanoid 29:6a9edb6e973b 5262 onButton9_command_table_02,
whismanoid 29:6a9edb6e973b 5263 onButton9_command_table_03,
whismanoid 29:6a9edb6e973b 5264 onButton9_command_table_04,
whismanoid 29:6a9edb6e973b 5265 onButton9_command_table_05,
whismanoid 29:6a9edb6e973b 5266 onButton9_command_table_06,
whismanoid 29:6a9edb6e973b 5267 onButton9_command_table_07,
whismanoid 29:6a9edb6e973b 5268 onButton9_command_table_08,
whismanoid 29:6a9edb6e973b 5269 onButton9_command_table_09,
whismanoid 29:6a9edb6e973b 5270 };
whismanoid 29:6a9edb6e973b 5271 #endif // HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 23:c6c652bef4b9 5272 #endif // USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5273 //--------------------------------------------------
whismanoid 23:c6c652bef4b9 5274 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 5275 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 31:47eee7e0cc2d 5276 bool g_Run_command_table_running = false;
whismanoid 23:c6c652bef4b9 5277 void Run_command_table(char* command_table[])
whismanoid 23:c6c652bef4b9 5278 {
whismanoid 23:c6c652bef4b9 5279 // command_table: perform list of commands
whismanoid 31:47eee7e0cc2d 5280 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 31:47eee7e0cc2d 5281 if (g_Run_command_table_running) {
whismanoid 31:47eee7e0cc2d 5282 // TODO: button event chaining is not supported at this time
whismanoid 31:47eee7e0cc2d 5283 } // if (g_Run_command_table_running)
whismanoid 31:47eee7e0cc2d 5284 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 31:47eee7e0cc2d 5285 g_Run_command_table_running = true;
whismanoid 23:c6c652bef4b9 5286 for (int lineIndex = 0; lineIndex < COMMAND_TABLE_ROW_MAX; lineIndex++) {
whismanoid 23:c6c652bef4b9 5287 if (command_table[lineIndex] == NULL) { break; }
whismanoid 23:c6c652bef4b9 5288 if (command_table[lineIndex][0] == '\0') { break; }
whismanoid 23:c6c652bef4b9 5289 cmdLine.clear();
whismanoid 31:47eee7e0cc2d 5290 cmdLine.quiet = g_Run_command_table_running;
whismanoid 23:c6c652bef4b9 5291 //~ char* strIndex = command_table[lineIndex];
whismanoid 23:c6c652bef4b9 5292 for (char* strIndex = command_table[lineIndex]; *strIndex != '\0'; strIndex++)
whismanoid 23:c6c652bef4b9 5293 {
whismanoid 23:c6c652bef4b9 5294 cmdLine.append(*strIndex);
whismanoid 23:c6c652bef4b9 5295 }
whismanoid 23:c6c652bef4b9 5296 cmdLine.append('\r'); // append \r invokes onEOLcommandParser to handle command
whismanoid 23:c6c652bef4b9 5297 }
whismanoid 31:47eee7e0cc2d 5298 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 31:47eee7e0cc2d 5299 g_Run_command_table_running = false;
whismanoid 31:47eee7e0cc2d 5300 cmdLine.quiet = g_Run_command_table_running;
whismanoid 23:c6c652bef4b9 5301 }
whismanoid 23:c6c652bef4b9 5302 #endif // USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5303 //--------------------------------------------------
whismanoid 21:ac062a97a71d 5304 // When user presses button BUTTON1, perform actions
whismanoid 21:ac062a97a71d 5305 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 5306 void onButton1FallingEdge(void)
whismanoid 21:ac062a97a71d 5307 {
whismanoid 21:ac062a97a71d 5308 //~ void SelfTest(CmdLine & cmdLine);
whismanoid 21:ac062a97a71d 5309 //~ SelfTest(cmdLine_serial);
whismanoid 22:d6dc8a85f435 5310 //
whismanoid 23:c6c652bef4b9 5311 #if USE_DATALOGGER_CommandTable // Run_command_table(onButton1_command_table)
whismanoid 22:d6dc8a85f435 5312 // command_table: list of commands to perform on button press
whismanoid 22:d6dc8a85f435 5313 // command_table: perform list of commands
whismanoid 23:c6c652bef4b9 5314 Run_command_table(onButton1_command_table);
whismanoid 23:c6c652bef4b9 5315 #endif // USE_DATALOGGER_CommandTable
whismanoid 21:ac062a97a71d 5316 }
whismanoid 21:ac062a97a71d 5317 #endif // HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 5318
whismanoid 21:ac062a97a71d 5319 //--------------------------------------------------
whismanoid 21:ac062a97a71d 5320 // When user presses button BUTTON2, perform actions
whismanoid 21:ac062a97a71d 5321 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 5322 void onButton2FallingEdge(void)
whismanoid 21:ac062a97a71d 5323 {
whismanoid 21:ac062a97a71d 5324 // TBD demo configuration
whismanoid 21:ac062a97a71d 5325 // TODO diagnostic LED
whismanoid 21:ac062a97a71d 5326 // led1 = LED_OFF; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led BLUE
whismanoid 22:d6dc8a85f435 5327 //
whismanoid 23:c6c652bef4b9 5328 #if USE_DATALOGGER_CommandTable // Run_command_table(onButton1_command_table)
whismanoid 22:d6dc8a85f435 5329 // command_table: list of commands to perform on button press
whismanoid 22:d6dc8a85f435 5330 // command_table: perform list of commands
whismanoid 23:c6c652bef4b9 5331 Run_command_table(onButton2_command_table);
whismanoid 23:c6c652bef4b9 5332 #endif // USE_DATALOGGER_CommandTable
whismanoid 21:ac062a97a71d 5333 }
whismanoid 21:ac062a97a71d 5334 #endif // HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 5335
whismanoid 24:032f3683cb2a 5336 //--------------------------------------------------
whismanoid 29:6a9edb6e973b 5337 // When user presses button BUTTON3, perform actions
whismanoid 24:032f3683cb2a 5338 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 5339 void onButton3FallingEdge(void)
whismanoid 24:032f3683cb2a 5340 {
whismanoid 24:032f3683cb2a 5341 #if USE_DATALOGGER_CommandTable // Run_command_table(onButton1_command_table)
whismanoid 24:032f3683cb2a 5342 // command_table: list of commands to perform on button press
whismanoid 24:032f3683cb2a 5343 // command_table: perform list of commands
whismanoid 24:032f3683cb2a 5344 Run_command_table(onButton3_command_table);
whismanoid 24:032f3683cb2a 5345 #endif // USE_DATALOGGER_CommandTable
whismanoid 24:032f3683cb2a 5346 }
whismanoid 24:032f3683cb2a 5347 #endif // HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5348 #if HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5349 void onButton4FallingEdge(void)
whismanoid 29:6a9edb6e973b 5350 {
whismanoid 29:6a9edb6e973b 5351 #if USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5352 Run_command_table(onButton4_command_table);
whismanoid 29:6a9edb6e973b 5353 #endif // USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5354 }
whismanoid 29:6a9edb6e973b 5355 #endif // HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5356 #if HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5357 void onButton5FallingEdge(void)
whismanoid 29:6a9edb6e973b 5358 {
whismanoid 29:6a9edb6e973b 5359 #if USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5360 Run_command_table(onButton5_command_table);
whismanoid 29:6a9edb6e973b 5361 #endif // USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5362 }
whismanoid 29:6a9edb6e973b 5363 #endif // HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5364 #if HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5365 void onButton6FallingEdge(void)
whismanoid 29:6a9edb6e973b 5366 {
whismanoid 29:6a9edb6e973b 5367 #if USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5368 Run_command_table(onButton6_command_table);
whismanoid 29:6a9edb6e973b 5369 #endif // USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5370 }
whismanoid 29:6a9edb6e973b 5371 #endif // HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5372 #if HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5373 void onButton7FallingEdge(void)
whismanoid 29:6a9edb6e973b 5374 {
whismanoid 29:6a9edb6e973b 5375 #if USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5376 Run_command_table(onButton7_command_table);
whismanoid 29:6a9edb6e973b 5377 #endif // USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5378 }
whismanoid 29:6a9edb6e973b 5379 #endif // HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5380 #if HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5381 void onButton8FallingEdge(void)
whismanoid 29:6a9edb6e973b 5382 {
whismanoid 29:6a9edb6e973b 5383 #if USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5384 Run_command_table(onButton8_command_table);
whismanoid 29:6a9edb6e973b 5385 #endif // USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5386 }
whismanoid 29:6a9edb6e973b 5387 #endif // HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5388 #if HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5389 void onButton9FallingEdge(void)
whismanoid 29:6a9edb6e973b 5390 {
whismanoid 29:6a9edb6e973b 5391 #if USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5392 Run_command_table(onButton9_command_table);
whismanoid 29:6a9edb6e973b 5393 #endif // USE_DATALOGGER_CommandTable
whismanoid 29:6a9edb6e973b 5394 }
whismanoid 29:6a9edb6e973b 5395 #endif // HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 5396
whismanoid 4:d9b05924ad4c 5397 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 5398 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 5399 inline void print_command_prompt()
whismanoid 4:d9b05924ad4c 5400 {
whismanoid 4:d9b05924ad4c 5401 //~ Serial.println(F(">"));
whismanoid 4:d9b05924ad4c 5402 cmdLine.serial().printf("\r\n> ");
whismanoid 4:d9b05924ad4c 5403 }
whismanoid 4:d9b05924ad4c 5404 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 5405
whismanoid 4:d9b05924ad4c 5406 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 5407 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 5408 void main_menu_status(CmdLine & cmdLine)
whismanoid 4:d9b05924ad4c 5409 {
whismanoid 4:d9b05924ad4c 5410 cmdLine.serial().printf("\r\nMain menu");
whismanoid 4:d9b05924ad4c 5411 #if APPLICATION_MAX5715 // main_menu_status banner
whismanoid 4:d9b05924ad4c 5412 cmdLine.serial().printf(" MAX5715 12-bit 4-ch SPI VOUT DAC");
whismanoid 4:d9b05924ad4c 5413 #elif APPLICATION_MAX11131 // main_menu_status banner
whismanoid 4:d9b05924ad4c 5414 cmdLine.serial().printf(" MAX11131 12-bit 3MSps 16-ch ADC");
whismanoid 4:d9b05924ad4c 5415 #elif APPLICATION_MAX5171 // main_menu_status banner
whismanoid 4:d9b05924ad4c 5416 cmdLine.serial().printf(" MAX5171 14-bit Force/Sense VOUT DAC");
whismanoid 4:d9b05924ad4c 5417 #elif APPLICATION_MAX11410 // main_menu_status banner
whismanoid 4:d9b05924ad4c 5418 cmdLine.serial().printf(" MAX11410 24-bit 1.9ksps Delta-Sigma ADC");
whismanoid 4:d9b05924ad4c 5419 #elif APPLICATION_MAX12345 // main_menu_status banner
whismanoid 4:d9b05924ad4c 5420 cmdLine.serial().printf(" MAX12345");
whismanoid 16:819c5aaf5271 5421 #elif MAX40108_DEMO // main_menu_status banner
whismanoid 17:9397ea3ea7e9 5422 cmdLine.serial().printf(" MAX40108_U%d", MAX40108_DEMO);
whismanoid 36:e7aac874b8be 5423 #ifdef BOARD_SERIAL_NUMBER
whismanoid 36:e7aac874b8be 5424 // data unique to certain boards based on serial number
whismanoid 49:359a6b9df7c1 5425 cmdLine.serial().printf(" [s/n %ld]", g_board_serial_number);
whismanoid 36:e7aac874b8be 5426 #else // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 36:e7aac874b8be 5427 #warning "BOARD_SERIAL_NUMBER not defined; using default values"
whismanoid 36:e7aac874b8be 5428 //
whismanoid 36:e7aac874b8be 5429 #endif // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 37:3f369235e5bc 5430 #ifdef FW_REV
whismanoid 37:3f369235e5bc 5431 cmdLine.serial().printf(" [FW_REV %d]", FW_REV);
whismanoid 37:3f369235e5bc 5432 #endif // FW_REV
whismanoid 4:d9b05924ad4c 5433 #else
whismanoid 4:d9b05924ad4c 5434 //cmdLine.serial().printf(" ");
whismanoid 4:d9b05924ad4c 5435 #endif
whismanoid 4:d9b05924ad4c 5436 //cmdLine.serial().printf(" %s", TARGET_NAME);
whismanoid 4:d9b05924ad4c 5437 if (cmdLine.nameStr())
whismanoid 4:d9b05924ad4c 5438 {
whismanoid 4:d9b05924ad4c 5439 cmdLine.serial().printf(" [%s]", cmdLine.nameStr());
whismanoid 4:d9b05924ad4c 5440 }
whismanoid 4:d9b05924ad4c 5441 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5442 cmdLine.serial().printf(" [Button1");
whismanoid 4:d9b05924ad4c 5443 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5444 cmdLine.serial().printf("2");
whismanoid 24:032f3683cb2a 5445 #endif
whismanoid 24:032f3683cb2a 5446 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5447 cmdLine.serial().printf("3");
whismanoid 29:6a9edb6e973b 5448 #endif
whismanoid 29:6a9edb6e973b 5449 #if HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5450 cmdLine.serial().printf("4");
whismanoid 29:6a9edb6e973b 5451 #endif
whismanoid 29:6a9edb6e973b 5452 #if HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5453 cmdLine.serial().printf("5");
whismanoid 29:6a9edb6e973b 5454 #endif
whismanoid 29:6a9edb6e973b 5455 #if HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5456 cmdLine.serial().printf("6");
whismanoid 29:6a9edb6e973b 5457 #endif
whismanoid 29:6a9edb6e973b 5458 #if HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5459 cmdLine.serial().printf("7");
whismanoid 29:6a9edb6e973b 5460 #endif
whismanoid 29:6a9edb6e973b 5461 #if HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5462 cmdLine.serial().printf("8");
whismanoid 29:6a9edb6e973b 5463 #endif
whismanoid 29:6a9edb6e973b 5464 #if HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 5465 cmdLine.serial().printf("9");
whismanoid 29:6a9edb6e973b 5466 #endif
whismanoid 29:6a9edb6e973b 5467 cmdLine.serial().printf("]");
whismanoid 29:6a9edb6e973b 5468 #endif // HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 4:d9b05924ad4c 5469 #if HAS_BUTTON1_DEMO
whismanoid 4:d9b05924ad4c 5470 // print BUTTON1 status
whismanoid 4:d9b05924ad4c 5471 cmdLine.serial().printf("\r\n BUTTON1 = %d", button1.read());
whismanoid 4:d9b05924ad4c 5472 #endif
whismanoid 4:d9b05924ad4c 5473 #if HAS_BUTTON2_DEMO
whismanoid 24:032f3683cb2a 5474 // print BUTTON2 status
whismanoid 4:d9b05924ad4c 5475 cmdLine.serial().printf("\r\n BUTTON2 = %d", button2.read());
whismanoid 4:d9b05924ad4c 5476 #endif
whismanoid 24:032f3683cb2a 5477 #if HAS_BUTTON3_DEMO
whismanoid 24:032f3683cb2a 5478 // print BUTTON3 status
whismanoid 24:032f3683cb2a 5479 cmdLine.serial().printf("\r\n BUTTON3 = %d", button3.read());
whismanoid 24:032f3683cb2a 5480 #endif
whismanoid 4:d9b05924ad4c 5481 cmdLine.serial().printf("\r\n ? -- help");
whismanoid 4:d9b05924ad4c 5482 }
whismanoid 4:d9b05924ad4c 5483 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 5484
whismanoid 28:a9a3a9db592b 5485 //--------------------------------------------------
whismanoid 28:a9a3a9db592b 5486 #ifndef USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 5487 #define USE_DATALOGGER_TRIGGER_HELP_BRIEF 1
whismanoid 28:a9a3a9db592b 5488 //~ #undef USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 5489 #endif // USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 5490
whismanoid 4:d9b05924ad4c 5491 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 5492 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 5493 void main_menu_help(CmdLine & cmdLine)
whismanoid 4:d9b05924ad4c 5494 {
whismanoid 4:d9b05924ad4c 5495 // ? -- help
whismanoid 4:d9b05924ad4c 5496 //~ cmdLine.serial().printf("\r\nMenu:");
whismanoid 10:04022a61b527 5497 //
whismanoid 4:d9b05924ad4c 5498 cmdLine.serial().printf("\r\n # -- lines beginning with # are comments");
whismanoid 10:04022a61b527 5499 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 10:04022a61b527 5500 cmdLine.serial().printf("\r\n ! -- Init");
whismanoid 10:04022a61b527 5501 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 4:d9b05924ad4c 5502 #if USE_SELFTEST
whismanoid 4:d9b05924ad4c 5503 cmdLine.serial().printf("\r\n . -- SelfTest");
whismanoid 4:d9b05924ad4c 5504 #endif // USE_SELFTEST
whismanoid 9:45f98573eb6d 5505 #if USE_STAR_REG_READWRITE // * command read/write reg *reg? *reg=value
whismanoid 9:45f98573eb6d 5506 // CODE GENERATOR: help menu if has_register_write_command: *regname? -- read register; *regname=regvalue -- write register
whismanoid 9:45f98573eb6d 5507 cmdLine.serial().printf("\r\n * -- read core registers\r\n *regname? -- read register\r\n *regname=regvalue -- write register");
whismanoid 9:45f98573eb6d 5508 // cmdLine.serial().printf("\r\n 01 23 45 67 89 ab cd ef -- write and read raw hex codes");
whismanoid 10:04022a61b527 5509 #endif // USE_STAR_REG_READWRITE
whismanoid 10:04022a61b527 5510 //
whismanoid 10:04022a61b527 5511 #if USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 5512 // Command forwarding to Auxiliary serial port TX/RX #257 -- main_menu_help
whismanoid 10:04022a61b527 5513 //~ cmdLine.serial().printf("\r\n > -- auxiliary UART port");
whismanoid 10:04022a61b527 5514 // prefer cmdLine_AUXserial if available, else cmdLine_DAPLINKserial; else we don't have this feature
whismanoid 10:04022a61b527 5515 # if HAS_AUX_SERIAL
whismanoid 10:04022a61b527 5516 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257
whismanoid 10:04022a61b527 5517 if (cmdLine_AUXserial.nameStr())
whismanoid 10:04022a61b527 5518 {
whismanoid 10:04022a61b527 5519 cmdLine.serial().printf("\r\n > -- auxiliary UART port [%s]", cmdLine_AUXserial.nameStr());
whismanoid 10:04022a61b527 5520 }
whismanoid 10:04022a61b527 5521 # elif HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 5522 // Command forwarding to DAPLINK serial TX/RX cmdLine_DAPLINKserial #257
whismanoid 10:04022a61b527 5523 if (cmdLine_DAPLINKserial.nameStr())
whismanoid 10:04022a61b527 5524 {
whismanoid 10:04022a61b527 5525 cmdLine.serial().printf("\r\n > -- auxiliary UART port [%s]", cmdLine_DAPLINKserial.nameStr());
whismanoid 10:04022a61b527 5526 }
whismanoid 10:04022a61b527 5527 # endif // HAS_AUX_SERIAL HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 5528 # if HAS_AUX_SERIAL || HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 5529 // WIP Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257
whismanoid 10:04022a61b527 5530 cmdLine.serial().printf("\r\n >xyzzy -- Forward command/data 'xyzzy' to aux TX/RX");
whismanoid 10:04022a61b527 5531 cmdLine.serial().printf("\r\n >>xyzzy -- Forward 'xyzzy' to aux TX/RX, no key=value parsing");
whismanoid 10:04022a61b527 5532 cmdLine.serial().printf("\r\n >>>xyzzy -- Forward '>xyzzy' to aux TX/RX, no key=value parsing");
whismanoid 10:04022a61b527 5533 #if 0
whismanoid 10:04022a61b527 5534 cmdLine.serial().printf("\r\n >tx_wait_echo=%d -- configure TX wait for each character echo", g_auxSerialCom_tx_wait_echo);
whismanoid 10:04022a61b527 5535 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 5536 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 5537 #endif
whismanoid 20:78ef670955d4 5538 #if 1 // HAS_AUX_SERIAL_HELP_BRIEF
whismanoid 20:78ef670955d4 5539 cmdLine.serial().printf("\r\n >baud=%d message_ms=%d rx_idle_ms=%d rx_max_count=%d rx_eot=%d",
whismanoid 20:78ef670955d4 5540 g_auxSerialCom_baud,
whismanoid 20:78ef670955d4 5541 g_auxSerialCom_message_ms,
whismanoid 20:78ef670955d4 5542 g_auxSerialCom_rx_idle_ms,
whismanoid 20:78ef670955d4 5543 g_auxSerialCom_rx_max_count,
whismanoid 20:78ef670955d4 5544 g_auxSerialCom_rx_eot);
whismanoid 20:78ef670955d4 5545 #else // HAS_AUX_SERIAL_HELP_BRIEF
whismanoid 20:78ef670955d4 5546 cmdLine.serial().printf("\r\n >baud=%d -- configure aux TX/RX port", g_auxSerialCom_baud);
whismanoid 10:04022a61b527 5547 cmdLine.serial().printf("\r\n >message_ms=%d -- maximum RX message total response time", g_auxSerialCom_message_ms);
whismanoid 10:04022a61b527 5548 cmdLine.serial().printf("\r\n >rx_idle_ms=%d -- maximum RX message idle time between characters", g_auxSerialCom_rx_idle_ms);
whismanoid 10:04022a61b527 5549 cmdLine.serial().printf("\r\n >rx_max_count=%d -- maximum RX message total length", g_auxSerialCom_rx_max_count);
whismanoid 10:04022a61b527 5550 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 5551 #endif // HAS_AUX_SERIAL_HELP_BRIEF
whismanoid 10:04022a61b527 5552 # endif // HAS_AUX_SERIAL
whismanoid 10:04022a61b527 5553 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 5554 //
whismanoid 4:d9b05924ad4c 5555 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 28:a9a3a9db592b 5556 #if USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 5557 // Datalog trigger menu
whismanoid 28:a9a3a9db592b 5558 // brief toplevel heading for datalog help L
whismanoid 28:a9a3a9db592b 5559 // L -- detailed help for datalog commands
whismanoid 28:a9a3a9db592b 5560 cmdLine.serial().printf("\r\n L -- halt the datalogger; show more commands");
whismanoid 28:a9a3a9db592b 5561 // set Datalogger_Trigger to trigger_Halt or trigger_FreeRun
whismanoid 28:a9a3a9db592b 5562 // Datalogger_Trigger = trigger_Halt // halt the datalogger; continue accepting commands
whismanoid 28:a9a3a9db592b 5563 // cmdLine.serial().print(F("\r\n L -- halt the datalogger; continue accepting commands"));
whismanoid 28:a9a3a9db592b 5564 //
whismanoid 28:a9a3a9db592b 5565 // Datalogger_Trigger = trigger_FreeRun // free run as fast as possible "always-on mode"
whismanoid 28:a9a3a9db592b 5566 cmdLine.serial().printf("\r\n LR -- Datalog free run as fast as possible");
whismanoid 28:a9a3a9db592b 5567 //
whismanoid 39:4d285e961435 5568 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 5569 // USE_DATALOGGER_SLEEP -- support sleep modes in Datalogger_Trigger
whismanoid 39:4d285e961435 5570 cmdLine.serial().printf("\r\n LT count=%d base=%dms sleep=%d -- Datalog timer",
whismanoid 39:4d285e961435 5571 g_timer_interval_count,
whismanoid 39:4d285e961435 5572 g_timer_interval_msec,
whismanoid 39:4d285e961435 5573 (int)g_timer_sleepmode
whismanoid 39:4d285e961435 5574 ); // trigger_Timer
whismanoid 39:4d285e961435 5575 #else // USE_DATALOGGER_SLEEP
whismanoid 28:a9a3a9db592b 5576 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 5577 #endif // USE_DATALOGGER_SLEEP
whismanoid 28:a9a3a9db592b 5578 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 28:a9a3a9db592b 5579 //~ cmdLine.serial().printf("\r\n L@ -- configures Datalogger_action_table; show more commands");
whismanoid 28:a9a3a9db592b 5580 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 28:a9a3a9db592b 5581 #else // USE_DATALOGGER_TRIGGER_HELP_BRIEF -----------------------------------------------
whismanoid 4:d9b05924ad4c 5582 // TODO Datalog trigger menu
whismanoid 4:d9b05924ad4c 5583 // set Datalogger_Trigger to trigger_Halt or trigger_FreeRun
whismanoid 4:d9b05924ad4c 5584 // Datalogger_Trigger = trigger_Halt // halt the datalogger; continue accepting commands
whismanoid 9:45f98573eb6d 5585 // cmdLine.serial().print(F("\r\n L -- halt the datalogger; continue accepting commands"));
whismanoid 9:45f98573eb6d 5586 //
whismanoid 17:9397ea3ea7e9 5587 // Datalogger_Trigger = trigger_FreeRun // free run as fast as possible "always-on mode"
whismanoid 4:d9b05924ad4c 5588 cmdLine.serial().printf("\r\n LR -- Datalog free run as fast as possible");
whismanoid 9:45f98573eb6d 5589 //
whismanoid 17:9397ea3ea7e9 5590 // Datalogger_Trigger = trigger_Timer // timer (configure interval) "intermittent-sleep-mode"
whismanoid 17:9397ea3ea7e9 5591 //~ cmdLine.serial().printf("\r\n LT -- Datalog timer"); // trigger_Timer
whismanoid 17:9397ea3ea7e9 5592 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 5593 //
whismanoid 9:45f98573eb6d 5594 // TODO: Datalogger_Trigger = trigger_PlatformDigitalInput // platform digital input (configure digital input pin reference)
whismanoid 17:9397ea3ea7e9 5595 //~ cmdLine.serial().printf("\r\n LI -- Datalog _______"); // trigger_PlatformDigitalInput
whismanoid 17:9397ea3ea7e9 5596 // TODO: cmdLine.serial().printf("\r\n LIH3 -- Datalog when input high D3"); // trigger_PlatformDigitalInput
whismanoid 17:9397ea3ea7e9 5597 // TODO: cmdLine.serial().printf("\r\n LIL6 -- Datalog when input low D6"); // trigger_PlatformDigitalInput
whismanoid 9:45f98573eb6d 5598 //
whismanoid 17:9397ea3ea7e9 5599 #if USE_DATALOGGER_SPIDeviceRegRead
whismanoid 9:45f98573eb6d 5600 // TODO: Datalogger_Trigger = trigger_SPIDeviceRegRead // SPI device register read (configure regaddr, mask value, match value)
whismanoid 17:9397ea3ea7e9 5601 //~ cmdLine.serial().printf("\r\n L$ -- Datalog _______"); // trigger_SPIDeviceRegRead
whismanoid 27:b4ac095b83b3 5602 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 5603 #endif // USE_DATALOGGER_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 5604 //
whismanoid 17:9397ea3ea7e9 5605 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 28:a9a3a9db592b 5606 cmdLine.serial().printf("\r\n L@ -- configures Datalogger_action_table; show more commands");
whismanoid 17:9397ea3ea7e9 5607 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 9:45f98573eb6d 5608 //
whismanoid 9:45f98573eb6d 5609 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 5610 // LS<channel ID><verb>: Configure SPI_AIN channels
whismanoid 9:45f98573eb6d 5611 // channel ID: 0,1,2,... or - for all channels
whismanoid 9:45f98573eb6d 5612 // verb: D for disable, V for Voltage, L for LSB
whismanoid 9:45f98573eb6d 5613 cmdLine.serial().printf("\r\n LS-D -- Datalog SPI ADC channel '-'(all) Disable");
whismanoid 9:45f98573eb6d 5614 cmdLine.serial().printf("\r\n LS-V -- Datalog SPI ADC channel '-'(all) Volt");
whismanoid 9:45f98573eb6d 5615 cmdLine.serial().printf("\r\n LS-L -- Datalog SPI ADC channel '-'(all) LSB");
whismanoid 9:45f98573eb6d 5616 cmdLine.serial().printf("\r\n LS2D -- Datalog SPI ADC channel channel 2 Disable");
whismanoid 9:45f98573eb6d 5617 cmdLine.serial().printf("\r\n LS3V -- Datalog SPI ADC channel channel 3 Volt");
whismanoid 9:45f98573eb6d 5618 cmdLine.serial().printf("\r\n LS4L -- Datalog SPI ADC channel channel 4 LSB");
whismanoid 9:45f98573eb6d 5619 //
whismanoid 9:45f98573eb6d 5620 // MAX11410 verb for configuring SPI_AIN_Cfg_v_filter_ch[channel_index]
whismanoid 9:45f98573eb6d 5621 // cmdLine.serial().print(F("\r\n LS-CF34 -- Datalog SPI ADC channel channel 5 v_filter 0x34"));
whismanoid 9:45f98573eb6d 5622 cmdLine.serial().printf("\r\n LS-CF34 -- Datalog SPI ADC channel '-'(all) v_filter 0x34");
whismanoid 9:45f98573eb6d 5623 //
whismanoid 9:45f98573eb6d 5624 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 9:45f98573eb6d 5625 // cmdLine.serial().print(F("\r\n LS-CC42 -- Datalog SPI ADC channel '-'(all) v_ctrl 0x42"));
whismanoid 9:45f98573eb6d 5626 cmdLine.serial().printf("\r\n LS-CC42 -- Datalog SPI ADC channel '-'(all) v_ctrl 0x42");
whismanoid 9:45f98573eb6d 5627 //
whismanoid 9:45f98573eb6d 5628 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 9:45f98573eb6d 5629 // cmdLine.serial().print(F("\r\n LS5___ -- Datalog SPI ADC channel channel 5 v_ctrl"));
whismanoid 9:45f98573eb6d 5630 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 9:45f98573eb6d 5631 cmdLine.serial().printf("\r\n LS5CU -- Datalog SPI ADC channel channel 5 v_ctrl Unipolar");
whismanoid 9:45f98573eb6d 5632 // ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) ? "BIPOLAR" : "Unipolar"
whismanoid 9:45f98573eb6d 5633 cmdLine.serial().printf("\r\n LS5CB -- Datalog SPI ADC channel channel 5 v_ctrl Bipolar");
whismanoid 9:45f98573eb6d 5634 // ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) ? "BIPOLAR" : "Unipolar"
whismanoid 9:45f98573eb6d 5635 //
whismanoid 9:45f98573eb6d 5636 // MAX11410 verb for configuring SPI_AIN_Cfg_v_pga_ch[channel_index]
whismanoid 9:45f98573eb6d 5637 // cmdLine.serial().print(F("\r\n LS5CP00 -- Datalog SPI ADC channel channel 5 v_pga 0x00"));
whismanoid 9:45f98573eb6d 5638 cmdLine.serial().printf("\r\n LS-CP00 -- Datalog SPI ADC channel '-'(all) v_pga 0x00");
whismanoid 9:45f98573eb6d 5639 //
whismanoid 9:45f98573eb6d 5640 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 5641 //
whismanoid 9:45f98573eb6d 5642 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 9:45f98573eb6d 5643 // LA<channel ID><verb>: Configure Platform_AIN channels
whismanoid 9:45f98573eb6d 5644 // channel ID: 0,1,2,... or - for all channels
whismanoid 9:45f98573eb6d 5645 // verb: D for disable, V for Voltage, L for LSB
whismanoid 9:45f98573eb6d 5646 cmdLine.serial().printf("\r\n LA-D -- Datalog Platform-AIN all-channel Disable");
whismanoid 9:45f98573eb6d 5647 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 9:45f98573eb6d 5648 cmdLine.serial().printf("\r\n LA-V -- Datalog Platform-AIN all-channel Volt");
whismanoid 9:45f98573eb6d 5649 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 9:45f98573eb6d 5650 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 5651 cmdLine.serial().printf("\r\n LA-L -- Datalog Platform-AIN all-channel LSB");
whismanoid 9:45f98573eb6d 5652 #endif // LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 5653 cmdLine.serial().printf("\r\n LA2D -- Datalog Platform-AIN channel 2 Disable");
whismanoid 9:45f98573eb6d 5654 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 9:45f98573eb6d 5655 cmdLine.serial().printf("\r\n LA3V -- Datalog Platform-AIN channel 3 Volt");
whismanoid 9:45f98573eb6d 5656 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 9:45f98573eb6d 5657 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 5658 cmdLine.serial().printf("\r\n LA4L -- Datalog Platform-AIN channel 4 LSB");
whismanoid 9:45f98573eb6d 5659 #endif // LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 5660 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 28:a9a3a9db592b 5661 #endif // USE_DATALOGGER_TRIGGER_HELP_BRIEF -----------------------------------------------
whismanoid 4:d9b05924ad4c 5662 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 28:a9a3a9db592b 5663 #if USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 5664 #else // USE_DATALOGGER_TRIGGER_HELP_BRIEF -----------------------------------------------
whismanoid 8:dffee7509bfb 5665 # if HAS_AUX_SERIAL
whismanoid 9:45f98573eb6d 5666 cmdLine.serial().printf("\r\n L>A -- Datalogger_enable_AUXserial %s", (Datalogger_enable_AUXserial?"disable":"enable"));
whismanoid 8:dffee7509bfb 5667 # endif // HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 5668 # if HAS_DAPLINK_SERIAL
whismanoid 9:45f98573eb6d 5669 cmdLine.serial().printf("\r\n L>D -- Datalogger_enable_DAPLINKserial %s", (Datalogger_enable_DAPLINKserial?"disable":"enable"));
whismanoid 8:dffee7509bfb 5670 # endif // HAS_DAPLINK_SERIAL
whismanoid 9:45f98573eb6d 5671 cmdLine.serial().printf("\r\n L>S -- Datalogger_enable_serial %s", (Datalogger_enable_serial?"disable":"enable"));
whismanoid 28:a9a3a9db592b 5672 #endif // USE_DATALOGGER_TRIGGER_HELP_BRIEF -----------------------------------------------
whismanoid 8:dffee7509bfb 5673 //
whismanoid 4:d9b05924ad4c 5674 //cmdLine.serial().print(F("\r\n ! -- Initial Configuration"));
whismanoid 4:d9b05924ad4c 5675 //
whismanoid 4:d9b05924ad4c 5676 // % standardize diagnostic commands
whismanoid 4:d9b05924ad4c 5677 // %Hpin -- digital output high
whismanoid 4:d9b05924ad4c 5678 // %Lpin -- digital output low
whismanoid 4:d9b05924ad4c 5679 // %?pin -- digital input
whismanoid 4:d9b05924ad4c 5680 // %A %Apin -- analog input
whismanoid 4:d9b05924ad4c 5681 // %Ppin df=xx -- pwm output
whismanoid 4:d9b05924ad4c 5682 // %Wpin -- measure high pulsewidth input in usec
whismanoid 4:d9b05924ad4c 5683 // %wpin -- measure low pulsewidth input in usec
whismanoid 4:d9b05924ad4c 5684 // %I... -- I2C diagnostics
whismanoid 4:d9b05924ad4c 5685 // %IP -- I2C probe
whismanoid 4:d9b05924ad4c 5686 // %IC scl=100khz ADDR=? -- I2C configure
whismanoid 4:d9b05924ad4c 5687 // %IW ADDR=? cmd=? data,data,data -- write
whismanoid 4:d9b05924ad4c 5688 // %IR ADDR=? RD=? -- read
whismanoid 4:d9b05924ad4c 5689 // %I^ cmd=? -- i2c_smbus_read_word_data
whismanoid 4:d9b05924ad4c 5690 // %S... -- SPI diagnostics
whismanoid 4:d9b05924ad4c 5691 // %SC sclk=1Mhz -- SPI configure
whismanoid 4:d9b05924ad4c 5692 // %SW -- write (write and read)
whismanoid 4:d9b05924ad4c 5693 // %SR -- read (alias for %SW because SPI always write and read)
whismanoid 4:d9b05924ad4c 5694 // A-Z,a-z,0-9 reserved for application use
whismanoid 4:d9b05924ad4c 5695 //
whismanoid 23:c6c652bef4b9 5696 //--------------------------------------------------
whismanoid 23:c6c652bef4b9 5697 #if USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5698 // command_table: list of commands to perform on button press
whismanoid 23:c6c652bef4b9 5699 // TODO: %B1 submenu for Button1
whismanoid 23:c6c652bef4b9 5700 // TODO: future: %B2 submenu for Button2
whismanoid 23:c6c652bef4b9 5701 // TODO: future: %B3 submenu for Button3
whismanoid 23:c6c652bef4b9 5702 // TODO: %B1@ view command table, similar to L@ for action table
whismanoid 23:c6c652bef4b9 5703 // TODO: %B1@+ command add new row (if there is room to add) (ignore one space before command)
whismanoid 23:c6c652bef4b9 5704 // TODO: %B1@-nnn delete row number nnn (if list is not empty)
whismanoid 23:c6c652bef4b9 5705 // TODO: %B1@-~~~ clear entire command table
whismanoid 23:c6c652bef4b9 5706 // TODO: %B1@nnn command replace row number nnn (ignore one space before command)
whismanoid 23:c6c652bef4b9 5707 // TODO: %B1@! disable button response but keep command table contents
whismanoid 23:c6c652bef4b9 5708 // TODO: %B1@@ enable button response
whismanoid 23:c6c652bef4b9 5709 // TODO: %B1! trigger onButton1FallingEdge() immediately (for test development)
whismanoid 45:74bf1fe021e5 5710 // cmdLine.serial().printf("\r\n %%B1! trigger Button1 event; %%B1@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5711 cmdLine.serial().printf("\r\n %%B1! trigger Button1 event;");
whismanoid 45:74bf1fe021e5 5712 // print maximum index for %B1 submenu
whismanoid 45:74bf1fe021e5 5713 #if HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5714 cmdLine.serial().printf(" %%B9@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5715 #elif HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5716 cmdLine.serial().printf(" %%B8@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5717 #elif HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5718 cmdLine.serial().printf(" %%B7@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5719 #elif HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5720 cmdLine.serial().printf(" %%B6@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5721 #elif HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5722 cmdLine.serial().printf(" %%B5@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5723 #elif HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5724 cmdLine.serial().printf(" %%B4@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5725 #elif HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5726 cmdLine.serial().printf(" %%B3@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5727 #elif HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5728 cmdLine.serial().printf(" %%B2@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5729 #elif HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5730 cmdLine.serial().printf(" %%B1@ -- view/edit command table");
whismanoid 45:74bf1fe021e5 5731 #endif // HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 45:74bf1fe021e5 5732
whismanoid 45:74bf1fe021e5 5733
whismanoid 23:c6c652bef4b9 5734 #endif // USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 5735 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 5736 #if HAS_digitalInOuts
whismanoid 4:d9b05924ad4c 5737 // %Hpin -- digital output high
whismanoid 4:d9b05924ad4c 5738 // %Lpin -- digital output low
whismanoid 4:d9b05924ad4c 5739 // %?pin -- digital input
whismanoid 4:d9b05924ad4c 5740 cmdLine.serial().printf("\r\n %%Hn {pin:");
whismanoid 4:d9b05924ad4c 5741 list_digitalInOutPins(cmdLine.serial());
whismanoid 4:d9b05924ad4c 5742 cmdLine.serial().printf("} -- High Output");
whismanoid 4:d9b05924ad4c 5743 cmdLine.serial().printf("\r\n %%Ln {pin:");
whismanoid 4:d9b05924ad4c 5744 list_digitalInOutPins(cmdLine.serial());
whismanoid 4:d9b05924ad4c 5745 cmdLine.serial().printf("} -- Low Output");
whismanoid 4:d9b05924ad4c 5746 cmdLine.serial().printf("\r\n %%?n {pin:");
whismanoid 4:d9b05924ad4c 5747 list_digitalInOutPins(cmdLine.serial());
whismanoid 4:d9b05924ad4c 5748 cmdLine.serial().printf("} -- Input");
whismanoid 4:d9b05924ad4c 5749 #endif
whismanoid 4:d9b05924ad4c 5750
whismanoid 4:d9b05924ad4c 5751 #if HAS_analogIns
whismanoid 4:d9b05924ad4c 5752 // Menu A) analogRead A0..7
whismanoid 4:d9b05924ad4c 5753 // %A %Apin -- analog input
whismanoid 4:d9b05924ad4c 5754 // analogRead(pinIndex) // analog input pins A0, A1, A2, A3, A4, A5; float voltage = analogRead(A0) * (5.0 / 1023.0)
whismanoid 37:3f369235e5bc 5755 cmdLine.serial().printf("\r\n %%A -- analogRead");
whismanoid 37:3f369235e5bc 5756 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 5757 // %A avg=%d -- help string display Platform_AIN_Average_N
whismanoid 37:3f369235e5bc 5758 cmdLine.serial().printf("; %%A avg=%d -- average", Platform_AIN_Average_N);
whismanoid 37:3f369235e5bc 5759 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 5760 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 5761 // %A cal? view/export raw calibration values for all channels
whismanoid 37:3f369235e5bc 5762 cmdLine.serial().printf("; %%A cal? -- calibration");
whismanoid 34:a1993a1ee904 5763 #endif // HAS_Platform_AIN_Calibration
whismanoid 4:d9b05924ad4c 5764 #endif
whismanoid 4:d9b05924ad4c 5765
whismanoid 4:d9b05924ad4c 5766 #if HAS_SPI2_MAX541
whismanoid 4:d9b05924ad4c 5767 // TODO1: MAX541 max541(spi2_max541, spi2_max541_cs);
whismanoid 4:d9b05924ad4c 5768 cmdLine.serial().printf("\r\n %%D -- DAC output MAX541 (SPI2)");
whismanoid 4:d9b05924ad4c 5769 #endif
whismanoid 4:d9b05924ad4c 5770
whismanoid 46:469d0061df5d 5771 //--------------------------------------------------
whismanoid 46:469d0061df5d 5772 #if defined(HAS_FLASH_PEEK) || defined(HAS_FLASH_POKE)
whismanoid 46:469d0061df5d 5773 // MAX32625 flash peek/poke support (MAX40108 demo) #312
whismanoid 46:469d0061df5d 5774 // cmdLine.serial().printf("\r\n %%F -- flash support");
whismanoid 46:469d0061df5d 5775 # if HAS_FLASH_PEEK
whismanoid 46:469d0061df5d 5776 // flash peek memory %F peek=0x0007ff00 len=0x0100 -- hex dump
whismanoid 46:469d0061df5d 5777 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 5778 # endif // HAS_FLASH_PEEK
whismanoid 46:469d0061df5d 5779 # if HAS_FLASH_POKE
whismanoid 46:469d0061df5d 5780 // flash poke memory %F poke=0x0007ff00 0xab 0xcd 0xef 0x27 0x18 0x28 -- erase/write flash page
whismanoid 48:18647e0516f2 5781 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 5782 # endif // HAS_FLASH_POKE
whismanoid 46:469d0061df5d 5783 # if HAS_FLASH_LOAD_SAVE
whismanoid 48:18647e0516f2 5784 // cmdLine.serial().printf("\r\n %%F save=0xFF -- erase config; %%F save=0 -- save all config");
whismanoid 48:18647e0516f2 5785 // const uint32_t save_arg_01_pageErase = 0x00000001; // page erase and rewrite
whismanoid 48:18647e0516f2 5786 // const uint32_t save_arg_02_verbose = 0x00000002; // verbose diagnostic messages
whismanoid 48:18647e0516f2 5787 // const uint32_t save_arg_04_reserved = 0x00000004; // reserved
whismanoid 48:18647e0516f2 5788 // const uint32_t save_arg_08_reserved = 0x00000008; // reserved
whismanoid 48:18647e0516f2 5789 // const uint32_t save_arg_10_calibration = 0x00000010; // save board ID and calibration
whismanoid 48:18647e0516f2 5790 // const uint32_t save_arg_20_action_table = 0x00000020; // save Datalogger_action_table
whismanoid 48:18647e0516f2 5791 // const uint32_t save_arg_40_command_table = 0x00000040; // save onButtonX_command_table
whismanoid 48:18647e0516f2 5792 // const uint32_t save_arg_80_reserved = 0x00000080; // reserved
whismanoid 49:359a6b9df7c1 5793 cmdLine.serial().printf("\r\n %%F load=0x%lx ; %%F save=0x%lx -- calibration",
whismanoid 48:18647e0516f2 5794 (load_arg_default | save_arg_02_verbose), (save_arg_default | save_arg_02_verbose));
whismanoid 48:18647e0516f2 5795 //~ cmdLine.serial().printf("\r\n %%F save=0x11 -- erase; config; %%F save=0 -- save all config");
whismanoid 48:18647e0516f2 5796 //~ cmdLine.serial().printf("\r\n %%F load -- load all config");
whismanoid 46:469d0061df5d 5797 # endif // HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 5798 #endif
whismanoid 46:469d0061df5d 5799
whismanoid 4:d9b05924ad4c 5800 #if HAS_I2C // SUPPORT_I2C
whismanoid 4:d9b05924ad4c 5801 // TODO: support I2C HAS_I2C // SUPPORT_I2C
whismanoid 4:d9b05924ad4c 5802 // VERIFY: I2C utility commands SUPPORT_I2C
whismanoid 4:d9b05924ad4c 5803 // VERIFY: report g_I2C_SCL_Hz = (F_CPU / ((TWBR * 2) + 16)) from last Wire_Sr.setClock(I2C_SCL_Hz);
whismanoid 4:d9b05924ad4c 5804 // %I... -- I2C diagnostics
whismanoid 4:d9b05924ad4c 5805 // %IP -- I2C probe
whismanoid 4:d9b05924ad4c 5806 // %IC scl=100khz ADDR=? -- I2C configure
whismanoid 4:d9b05924ad4c 5807 // %IW byte byte ... byte RD=? ADDR=0x -- write
whismanoid 4:d9b05924ad4c 5808 // %IR ADDR=? RD=? -- read
whismanoid 4:d9b05924ad4c 5809 // %I^ cmd=? -- i2c_smbus_read_word_data
whismanoid 4:d9b05924ad4c 5810 //g_I2C_SCL_Hz = (F_CPU / ((TWBR * 2) + 16)); // 'F_CPU' 'TWBR' not declared in this scope
whismanoid 4:d9b05924ad4c 5811 cmdLine.serial().printf("\r\n %%IC ADDR=0x%2.2x=(0x%2.2x>>1) SCL=%d=%1.3fkHz -- I2C config",
whismanoid 4:d9b05924ad4c 5812 g_I2C_deviceAddress7, (g_I2C_deviceAddress7 << 1), g_I2C_SCL_Hz,
whismanoid 4:d9b05924ad4c 5813 (g_I2C_SCL_Hz / 1000.));
whismanoid 4:d9b05924ad4c 5814 cmdLine.serial().printf("\r\n %%IW byte byte ... byte RD=? ADDR=0x%2.2x -- I2C write/read",
whismanoid 4:d9b05924ad4c 5815 g_I2C_deviceAddress7);
whismanoid 4:d9b05924ad4c 5816 //
whismanoid 4:d9b05924ad4c 5817 #if SUPPORT_I2C
whismanoid 4:d9b05924ad4c 5818 // Menu ^ cmd=?) i2c_smbus_read_word_data
whismanoid 4:d9b05924ad4c 5819 cmdLine.serial().printf("\r\n %%I^ cmd=? -- i2c_smbus_read_word_data");
whismanoid 4:d9b05924ad4c 5820 // test low-level I2C i2c_smbus_read_word_data
whismanoid 4:d9b05924ad4c 5821 #endif // SUPPORT_I2C
whismanoid 4:d9b05924ad4c 5822 //cmdLine.serial().printf(" H) Hunt for attached I2C devices");
whismanoid 4:d9b05924ad4c 5823 cmdLine.serial().printf("\r\n %%IP -- I2C Probe for attached devices");
whismanoid 4:d9b05924ad4c 5824 // cmdLine.serial().printf(" s) search i2c address");
whismanoid 4:d9b05924ad4c 5825 #endif // SUPPORT_I2C
whismanoid 4:d9b05924ad4c 5826
whismanoid 4:d9b05924ad4c 5827 #if HAS_SPI // SUPPORT_SPI
whismanoid 4:d9b05924ad4c 5828 // TODO: support SPI HAS_SPI // SUPPORT_SPI
whismanoid 4:d9b05924ad4c 5829 // SPI test command S (mosiData)+
whismanoid 4:d9b05924ad4c 5830 // %S... -- SPI diagnostics
whismanoid 4:d9b05924ad4c 5831 // %SC sclk=1Mhz -- SPI configure
whismanoid 4:d9b05924ad4c 5832 // %SW -- write (write and read)
whismanoid 4:d9b05924ad4c 5833 // %SR -- read (alias for %SW because SPI always write and read)
whismanoid 4:d9b05924ad4c 5834 // spi.format(8,0); // int bits_must_be_8, int mode=0_3 CPOL=0,CPHA=0 rising edge (initial default)
whismanoid 4:d9b05924ad4c 5835 // spi.format(8,1); // int bits_must_be_8, int mode=0_3 CPOL=0,CPHA=1 falling edge (initial default)
whismanoid 4:d9b05924ad4c 5836 // spi.format(8,2); // int bits_must_be_8, int mode=0_3 CPOL=1,CPHA=0 falling edge (initial default)
whismanoid 4:d9b05924ad4c 5837 // spi.format(8,3); // int bits_must_be_8, int mode=0_3 CPOL=1,CPHA=1 rising edge (initial default)
whismanoid 4:d9b05924ad4c 5838 // spi.frequency(1000000); // int SCLK_Hz=1000000 = 1MHz (initial default)
whismanoid 4:d9b05924ad4c 5839 // mode | POL PHA
whismanoid 4:d9b05924ad4c 5840 // -----+--------
whismanoid 4:d9b05924ad4c 5841 // 0 | 0 0
whismanoid 4:d9b05924ad4c 5842 // 1 | 0 1
whismanoid 4:d9b05924ad4c 5843 // 2 | 1 0
whismanoid 4:d9b05924ad4c 5844 // 3 | 1 1
whismanoid 4:d9b05924ad4c 5845 //cmdLine.serial().printf(" S) SPI mosi,mosi,...mosi hex bytes SCLK=1000000 CPOL=0 CPHA=0");
whismanoid 4:d9b05924ad4c 5846 // 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 5847 cmdLine.serial().printf("\r\n %%SC SCLK=%ld=%1.3fMHz CPOL=%d CPHA=%d -- SPI config",
whismanoid 4:d9b05924ad4c 5848 g_SPI_SCLK_Hz, (g_SPI_SCLK_Hz / 1000000.),
whismanoid 4:d9b05924ad4c 5849 ((g_SPI_dataMode & SPI_MODE2) ? 1 : 0),
whismanoid 4:d9b05924ad4c 5850 ((g_SPI_dataMode & SPI_MODE1) ? 1 : 0));
whismanoid 4:d9b05924ad4c 5851 cmdLine.serial().printf("\r\n %%SD -- SPI diagnostic messages ");
whismanoid 4:d9b05924ad4c 5852 if (g_MAX11410_device.onSPIprint) {
whismanoid 4:d9b05924ad4c 5853 cmdLine.serial().printf("hide");
whismanoid 4:d9b05924ad4c 5854 }
whismanoid 4:d9b05924ad4c 5855 else {
whismanoid 4:d9b05924ad4c 5856 cmdLine.serial().printf("show");
whismanoid 4:d9b05924ad4c 5857 }
whismanoid 4:d9b05924ad4c 5858 cmdLine.serial().printf("\r\n %%SW mosi,mosi,...mosi -- SPI write hex bytes");
whismanoid 4:d9b05924ad4c 5859 // VERIFY: parse new SPI settings parse_strCommandArgs() SCLK=1000000 CPOL=0 CPHA=0
whismanoid 4:d9b05924ad4c 5860 #endif // SUPPORT_SPI
whismanoid 4:d9b05924ad4c 5861 //
whismanoid 4:d9b05924ad4c 5862 // Application-specific commands (help text) here
whismanoid 4:d9b05924ad4c 5863 //
whismanoid 4:d9b05924ad4c 5864 #if APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 5865 cmdLine.serial().printf("\r\n A-Z,a-z,0-9 -- reserved for application use"); // ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 5866 #endif // APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 5867 //
whismanoid 4:d9b05924ad4c 5868
whismanoid 4:d9b05924ad4c 5869 //~ extern void MAX11410_menu_help(CmdLine & cmdLine); // defined in Test_Menu_MAX11410.cpp\n
whismanoid 4:d9b05924ad4c 5870 //~ MAX11410_menu_help(cmdLine);
whismanoid 4:d9b05924ad4c 5871 }
whismanoid 4:d9b05924ad4c 5872 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 5873
whismanoid 4:d9b05924ad4c 5874 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 15:37c83ec50ea0 5875
whismanoid 15:37c83ec50ea0 5876 //--------------------------------------------------
whismanoid 15:37c83ec50ea0 5877 void pinsMonitor_submenu_onEOLcommandParser(CmdLine& cmdLine)
whismanoid 15:37c83ec50ea0 5878 {
whismanoid 15:37c83ec50ea0 5879 // % diagnostic commands submenu
whismanoid 15:37c83ec50ea0 5880 // %Hpin -- digital output high
whismanoid 15:37c83ec50ea0 5881 // %Lpin -- digital output low
whismanoid 15:37c83ec50ea0 5882 // %?pin -- digital input
whismanoid 15:37c83ec50ea0 5883 // %A %Apin -- analog input
whismanoid 15:37c83ec50ea0 5884 // %Ppin df=xx -- pwm output
whismanoid 15:37c83ec50ea0 5885 // %Wpin -- measure high pulsewidth input in usec
whismanoid 15:37c83ec50ea0 5886 // %wpin -- measure low pulsewidth input in usec
whismanoid 15:37c83ec50ea0 5887 // %I... -- I2C diagnostics
whismanoid 15:37c83ec50ea0 5888 // %IP -- I2C probe
whismanoid 15:37c83ec50ea0 5889 // %IC scl=100khz ADDR=? -- I2C configure
whismanoid 15:37c83ec50ea0 5890 // %IW byte byte ... byte RD=? ADDR=0x -- write
whismanoid 15:37c83ec50ea0 5891 // %IR ADDR=? RD=? -- read
whismanoid 15:37c83ec50ea0 5892 // %I^ cmd=? -- i2c_smbus_read_word_data
whismanoid 15:37c83ec50ea0 5893 // %S... -- SPI diagnostics
whismanoid 15:37c83ec50ea0 5894 // %SC sclk=1Mhz -- SPI configure
whismanoid 15:37c83ec50ea0 5895 // %SW -- write (write and read)
whismanoid 15:37c83ec50ea0 5896 // %SR -- read (alias for %SW because SPI always write and read)
whismanoid 15:37c83ec50ea0 5897 // A-Z,a-z,0-9 reserved for application use
whismanoid 15:37c83ec50ea0 5898 //
whismanoid 15:37c83ec50ea0 5899 char strPinIndex[3];
whismanoid 15:37c83ec50ea0 5900 strPinIndex[0] = cmdLine[2];
whismanoid 15:37c83ec50ea0 5901 strPinIndex[1] = cmdLine[3];
whismanoid 15:37c83ec50ea0 5902 strPinIndex[2] = '\0';
whismanoid 15:37c83ec50ea0 5903 int pinIndex = strtoul(strPinIndex, NULL, 10); // strtol(str, NULL, 10): get decimal value
whismanoid 15:37c83ec50ea0 5904 //cmdLine.serial().printf(" pinIndex=%d ", pinIndex);
whismanoid 15:37c83ec50ea0 5905 //
whismanoid 15:37c83ec50ea0 5906 // get next character
whismanoid 15:37c83ec50ea0 5907 switch (cmdLine[1])
whismanoid 15:37c83ec50ea0 5908 {
whismanoid 23:c6c652bef4b9 5909 //--------------------------------------------------
whismanoid 46:469d0061df5d 5910 #if defined(HAS_FLASH_PEEK) || defined(HAS_FLASH_POKE)
whismanoid 46:469d0061df5d 5911 // MAX32625 flash peek/poke support (MAX40108 demo) #312
whismanoid 46:469d0061df5d 5912 case 'F': case 'f':
whismanoid 46:469d0061df5d 5913 {
whismanoid 46:469d0061df5d 5914 # if HAS_FLASH_PEEK
whismanoid 46:469d0061df5d 5915 // Limit the ranges where memory write operation will be allowed
whismanoid 46:469d0061df5d 5916 // FLASH (rx) : ORIGIN = 0x00010000, LENGTH = 0x00070000
whismanoid 46:469d0061df5d 5917 //~ const uint32_t poke_flash_min = 0x00010000;
whismanoid 46:469d0061df5d 5918 //~ const uint32_t poke_flash_max = 0x0007FFFF;
whismanoid 46:469d0061df5d 5919 // RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00028000
whismanoid 46:469d0061df5d 5920 //~ const uint32_t poke_ram_min = 0x20000000;
whismanoid 46:469d0061df5d 5921 //~ const uint32_t poke_ram_max = 0x20027FFF;
whismanoid 46:469d0061df5d 5922 //
whismanoid 46:469d0061df5d 5923 // flash peek memory %F peek=0x0007ff00 len=0x0100 -- hex dump
whismanoid 46:469d0061df5d 5924 // get "len" keyword, default 1
whismanoid 46:469d0061df5d 5925 uint32_t peek_len = 1;
whismanoid 46:469d0061df5d 5926 if (cmdLine.parse_uint32_hex("len", peek_len))
whismanoid 46:469d0061df5d 5927 {
whismanoid 46:469d0061df5d 5928 }
whismanoid 46:469d0061df5d 5929 // get "peek" keyword, do peek operation if keyword is present
whismanoid 46:469d0061df5d 5930 uint32_t peek_addr = 0x00010000;
whismanoid 46:469d0061df5d 5931 if (cmdLine.parse_uint32_hex("peek", peek_addr))
whismanoid 46:469d0061df5d 5932 {
whismanoid 46:469d0061df5d 5933 // #312 hex dump memory from peek_addr length peek_len
whismanoid 46:469d0061df5d 5934 peek_addr = peek_addr &~ 0x00000003; // 32-bit word align
whismanoid 46:469d0061df5d 5935 //
whismanoid 46:469d0061df5d 5936 // scan poke_access_list[] for peek_addr
whismanoid 46:469d0061df5d 5937 int poke_access_list_index = search_poke_access_list(peek_addr);
whismanoid 46:469d0061df5d 5938 // post: poke_access_list[poke_access_list_index].addr_min is lowest address of range
whismanoid 46:469d0061df5d 5939 // post: poke_access_list[poke_access_list_index].addr_max is highest address of range
whismanoid 46:469d0061df5d 5940 // post: poke_access_list[poke_access_list_index].name
whismanoid 46:469d0061df5d 5941 // 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 5942 cmdLine.serial().printf("\r\npoke_access_list[%d] %5s 0x%8.8lx - 0x%8.8lx access %x ",
whismanoid 46:469d0061df5d 5943 poke_access_list_index,
whismanoid 46:469d0061df5d 5944 poke_access_list[poke_access_list_index].name,
whismanoid 46:469d0061df5d 5945 poke_access_list[poke_access_list_index].addr_min,
whismanoid 46:469d0061df5d 5946 poke_access_list[poke_access_list_index].addr_max,
whismanoid 46:469d0061df5d 5947 poke_access_list[poke_access_list_index].can_flash_write_read);
whismanoid 46:469d0061df5d 5948 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x04)
whismanoid 46:469d0061df5d 5949 {
whismanoid 46:469d0061df5d 5950 cmdLine.serial().printf("flashPoke ");
whismanoid 46:469d0061df5d 5951 }
whismanoid 46:469d0061df5d 5952 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x02)
whismanoid 46:469d0061df5d 5953 {
whismanoid 46:469d0061df5d 5954 cmdLine.serial().printf("ramPoke ");
whismanoid 46:469d0061df5d 5955 }
whismanoid 46:469d0061df5d 5956 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x01)
whismanoid 46:469d0061df5d 5957 {
whismanoid 46:469d0061df5d 5958 cmdLine.serial().printf("read ");
whismanoid 46:469d0061df5d 5959 }
whismanoid 46:469d0061df5d 5960 //
whismanoid 46:469d0061df5d 5961 //~ cmdLine.serial().printf("\r\n0x%8.8lx: ", peek_addr);
whismanoid 46:469d0061df5d 5962 if ((peek_addr & 0x0F) != 0)
whismanoid 46:469d0061df5d 5963 {
whismanoid 46:469d0061df5d 5964 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, peek_addr);
whismanoid 46:469d0061df5d 5965 }
whismanoid 46:469d0061df5d 5966 while (peek_len > 0)
whismanoid 46:469d0061df5d 5967 {
whismanoid 46:469d0061df5d 5968 if ((peek_addr & 0x0F) == 0)
whismanoid 46:469d0061df5d 5969 {
whismanoid 46:469d0061df5d 5970 poke_access_list_index = search_poke_access_list(peek_addr);
whismanoid 46:469d0061df5d 5971 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, peek_addr);
whismanoid 46:469d0061df5d 5972 }
whismanoid 46:469d0061df5d 5973 if (poke_access_list[poke_access_list_index].can_flash_write_read & 1)
whismanoid 46:469d0061df5d 5974 {
whismanoid 46:469d0061df5d 5975 // read memory by using peek_addr as a uint32_t pointer
whismanoid 46:469d0061df5d 5976 cmdLine.serial().printf("0x%8.8lx ", *((uint32_t*)peek_addr));
whismanoid 46:469d0061df5d 5977 }
whismanoid 46:469d0061df5d 5978 else
whismanoid 46:469d0061df5d 5979 {
whismanoid 46:469d0061df5d 5980 // read operation is forbidden in this address range
whismanoid 46:469d0061df5d 5981 cmdLine.serial().printf("__________ ");
whismanoid 46:469d0061df5d 5982 }
whismanoid 46:469d0061df5d 5983 peek_addr += 4;
whismanoid 46:469d0061df5d 5984 peek_len--;
whismanoid 46:469d0061df5d 5985 }
whismanoid 46:469d0061df5d 5986 }
whismanoid 46:469d0061df5d 5987 # endif // HAS_FLASH_PEEK
whismanoid 46:469d0061df5d 5988 # if HAS_FLASH_POKE
whismanoid 46:469d0061df5d 5989 // flash poke memory %F poke=0x0007ff00 0xab 0xcd 0xef 0x27 0x18 0x28 -- erase/write flash page
whismanoid 46:469d0061df5d 5990 // get "poke" keyword, do poke operation if keyword is present
whismanoid 46:469d0061df5d 5991 uint32_t poke_addr = 0x20000000;
whismanoid 46:469d0061df5d 5992 if (cmdLine.parse_uint32_hex("poke", poke_addr))
whismanoid 46:469d0061df5d 5993 {
whismanoid 46:469d0061df5d 5994 size_t byteCount = 0;
whismanoid 46:469d0061df5d 5995 uint8_t pokeDataBuf[16];
whismanoid 46:469d0061df5d 5996 // get list of bytes after processing keywords
whismanoid 46:469d0061df5d 5997 // bool parse_byteCount_byteList_hex(size_t& byteCount, char *mosiDataBuf, size_t mosiDataBufSize);
whismanoid 46:469d0061df5d 5998 if (cmdLine.parse_byteCount_byteList_hex(byteCount, ((char *)pokeDataBuf), sizeof(pokeDataBuf)))
whismanoid 46:469d0061df5d 5999 {
whismanoid 46:469d0061df5d 6000 // #312 write memory at poke_addr
whismanoid 46:469d0061df5d 6001 poke_addr = poke_addr &~ 0x00000003; // 32-bit word align
whismanoid 46:469d0061df5d 6002 //
whismanoid 46:469d0061df5d 6003 // scan poke_access_list[] for poke_addr
whismanoid 46:469d0061df5d 6004 int poke_access_list_index = search_poke_access_list(poke_addr);
whismanoid 46:469d0061df5d 6005 // post: poke_access_list[poke_access_list_index].addr_min is lowest address of range
whismanoid 46:469d0061df5d 6006 // post: poke_access_list[poke_access_list_index].addr_max is highest address of range
whismanoid 46:469d0061df5d 6007 // post: poke_access_list[poke_access_list_index].name
whismanoid 46:469d0061df5d 6008 // 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 6009 cmdLine.serial().printf("\r\npoke_access_list[%d] %5s 0x%8.8lx - 0x%8.8lx access %x ",
whismanoid 46:469d0061df5d 6010 poke_access_list_index,
whismanoid 46:469d0061df5d 6011 poke_access_list[poke_access_list_index].name,
whismanoid 46:469d0061df5d 6012 poke_access_list[poke_access_list_index].addr_min,
whismanoid 46:469d0061df5d 6013 poke_access_list[poke_access_list_index].addr_max,
whismanoid 46:469d0061df5d 6014 poke_access_list[poke_access_list_index].can_flash_write_read);
whismanoid 46:469d0061df5d 6015 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x04)
whismanoid 46:469d0061df5d 6016 {
whismanoid 46:469d0061df5d 6017 cmdLine.serial().printf("flashPoke ");
whismanoid 46:469d0061df5d 6018 }
whismanoid 46:469d0061df5d 6019 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x02)
whismanoid 46:469d0061df5d 6020 {
whismanoid 46:469d0061df5d 6021 cmdLine.serial().printf("ramPoke ");
whismanoid 46:469d0061df5d 6022 }
whismanoid 46:469d0061df5d 6023 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x01)
whismanoid 46:469d0061df5d 6024 {
whismanoid 46:469d0061df5d 6025 cmdLine.serial().printf("read ");
whismanoid 46:469d0061df5d 6026 }
whismanoid 46:469d0061df5d 6027 //
whismanoid 46:469d0061df5d 6028 if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x0004)
whismanoid 46:469d0061df5d 6029 {
whismanoid 46:469d0061df5d 6030 //------------------------------
whismanoid 46:469d0061df5d 6031 // mbed interface to on-chip Flash
whismanoid 46:469d0061df5d 6032 // FlashIAP flash;
whismanoid 46:469d0061df5d 6033 // Maxim MAX32625 flash interface flc.h not .\mbed-os\drivers\FlashIAP.h
whismanoid 46:469d0061df5d 6034 // .\mbed-os\targets\TARGET_Maxim\TARGET_MAX32625\mxc\flc.h
whismanoid 46:469d0061df5d 6035 // .\mbed-os\targets\TARGET_Maxim\TARGET_MAX32625\mxc\flc.c
whismanoid 46:469d0061df5d 6036 //
whismanoid 46:469d0061df5d 6037 // MAX32625IWY+ Flash 512Kbyte in 64 pages of 8Kbyte per page
whismanoid 46:469d0061df5d 6038 static uint8_t pageBuf[8192];
whismanoid 46:469d0061df5d 6039 uint32_t pageBuf_addr = poke_addr &~ 0x1FFF; // 32-bit word align, 8Kbyte page boundary
whismanoid 46:469d0061df5d 6040 //
whismanoid 46:469d0061df5d 6041 // poke_addr is in FLASH address range, there's more steps
whismanoid 46:469d0061df5d 6042 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: flashPoke ...",
whismanoid 46:469d0061df5d 6043 poke_access_list[poke_access_list_index].name, poke_addr);
whismanoid 46:469d0061df5d 6044 // initialize flash memory interface
whismanoid 46:469d0061df5d 6045 // FlashIAP: FlashIAP flash; flash.init();
whismanoid 46:469d0061df5d 6046 // int FLC_Init(void);
whismanoid 46:469d0061df5d 6047 // returns E_NO_ERROR or E_BUSY or E_UNKNOWN
whismanoid 46:469d0061df5d 6048 cmdLine.serial().printf("FLC_Init ");
whismanoid 46:469d0061df5d 6049 if (FLC_Init() != E_NO_ERROR)
whismanoid 46:469d0061df5d 6050 {
whismanoid 46:469d0061df5d 6051 cmdLine.serial().printf("FAIL ");
whismanoid 46:469d0061df5d 6052 break; // can't perform the command
whismanoid 46:469d0061df5d 6053 }
whismanoid 46:469d0061df5d 6054 cmdLine.serial().printf("PASS ");
whismanoid 46:469d0061df5d 6055 //
whismanoid 46:469d0061df5d 6056 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: start of 8KByte page containing 0x%8.8lx...",
whismanoid 46:469d0061df5d 6057 poke_access_list[poke_access_list_index].name, pageBuf_addr, poke_addr);
whismanoid 46:469d0061df5d 6058 //
whismanoid 46:469d0061df5d 6059 // page read, update buffer from command line bytes, page erase, page write
whismanoid 46:469d0061df5d 6060 cmdLine.serial().printf("\r\nPgBuf 0x%8.8lx: copy page buffer, len=0x%x words = 0x%x bytes...",
whismanoid 46:469d0061df5d 6061 pageBuf_addr, sizeof(pageBuf)/4, sizeof(pageBuf));
whismanoid 46:469d0061df5d 6062 // memcpy(uint32_t *out, uint32_t *in, unsigned int count)
whismanoid 46:469d0061df5d 6063 memcpy(&pageBuf[0], (uint32_t*)pageBuf_addr, sizeof(pageBuf));
whismanoid 46:469d0061df5d 6064 //
whismanoid 46:469d0061df5d 6065 cmdLine.serial().printf("\r\nPgBuf 0x%8.8lx: udpate page buffer ...", poke_addr);
whismanoid 46:469d0061df5d 6066 // update buffer from command line bytes using my cmdline lib
whismanoid 46:469d0061df5d 6067 // ignore pokeDataBuf[0], its 0x0F because this is command F. :(
whismanoid 46:469d0061df5d 6068 for (size_t byteIndex = 1; byteIndex < byteCount; byteIndex += 4)
whismanoid 46:469d0061df5d 6069 {
whismanoid 46:469d0061df5d 6070 // How to handle big-endian vs little-endian?
whismanoid 46:469d0061df5d 6071 pageBuf[(poke_addr - pageBuf_addr + byteIndex-1) + 0] = pokeDataBuf[byteIndex + 3];
whismanoid 46:469d0061df5d 6072 pageBuf[(poke_addr - pageBuf_addr + byteIndex-1) + 1] = pokeDataBuf[byteIndex + 2];
whismanoid 46:469d0061df5d 6073 pageBuf[(poke_addr - pageBuf_addr + byteIndex-1) + 2] = pokeDataBuf[byteIndex + 1];
whismanoid 46:469d0061df5d 6074 pageBuf[(poke_addr - pageBuf_addr + byteIndex-1) + 3] = pokeDataBuf[byteIndex + 0];
whismanoid 46:469d0061df5d 6075 // seems 0x12 0x34 0x56 0x78 becomes 0x78563412
whismanoid 46:469d0061df5d 6076 uint32_t wordbuf = 0
whismanoid 46:469d0061df5d 6077 | ((uint32_t)pokeDataBuf[byteIndex + 0] << 24)
whismanoid 46:469d0061df5d 6078 | ((uint32_t)pokeDataBuf[byteIndex + 1] << 16)
whismanoid 46:469d0061df5d 6079 | ((uint32_t)pokeDataBuf[byteIndex + 2] << 8)
whismanoid 46:469d0061df5d 6080 | ((uint32_t)pokeDataBuf[byteIndex + 3] << 0)
whismanoid 46:469d0061df5d 6081 ;
whismanoid 46:469d0061df5d 6082 cmdLine.serial().printf("\r\nPgBuf[0x%8.8lx] = FLASH 0x%8.8lx: ",
whismanoid 46:469d0061df5d 6083 (poke_addr - pageBuf_addr + byteIndex-1), (poke_addr + byteIndex-1));
whismanoid 46:469d0061df5d 6084 cmdLine.serial().printf("0x%8.8lx ", wordbuf);
whismanoid 46:469d0061df5d 6085 // poke_addr += 4;
whismanoid 46:469d0061df5d 6086 }
whismanoid 46:469d0061df5d 6087 //
whismanoid 46:469d0061df5d 6088 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: erase page ...",
whismanoid 46:469d0061df5d 6089 poke_access_list[poke_access_list_index].name, pageBuf_addr);
whismanoid 46:469d0061df5d 6090 // page erase using flash.erase(addr, flash.get_sector_size(addr));
whismanoid 46:469d0061df5d 6091 // int FLC_PageErase(uint32_t address, MXC_V_FLC_ERASE_CODE_PAGE_ERASE, MXC_V_FLC_FLSH_UNLOCK_KEY);
whismanoid 46:469d0061df5d 6092 // @param address Address of the page to be erased.
whismanoid 46:469d0061df5d 6093 // @param erase_code Flash erase code; defined as
whismanoid 46:469d0061df5d 6094 // #MXC_V_FLC_ERASE_CODE_PAGE_ERASE for page erase
whismanoid 46:469d0061df5d 6095 // @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY.
whismanoid 46:469d0061df5d 6096 // returns E_NO_ERROR or else
whismanoid 46:469d0061df5d 6097 if (FLC_PageErase(pageBuf_addr, MXC_V_FLC_ERASE_CODE_PAGE_ERASE,
whismanoid 46:469d0061df5d 6098 MXC_V_FLC_FLSH_UNLOCK_KEY) != E_NO_ERROR)
whismanoid 46:469d0061df5d 6099 {
whismanoid 46:469d0061df5d 6100 cmdLine.serial().printf("FAIL ");
whismanoid 46:469d0061df5d 6101 break; // can't perform the command
whismanoid 46:469d0061df5d 6102 }
whismanoid 46:469d0061df5d 6103 cmdLine.serial().printf("PASS ");
whismanoid 46:469d0061df5d 6104 //
whismanoid 46:469d0061df5d 6105 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: write page buffer ...",
whismanoid 46:469d0061df5d 6106 poke_access_list[poke_access_list_index].name, pageBuf_addr);
whismanoid 46:469d0061df5d 6107 // page write using flash.program(page_buffer, addr, page_size);
whismanoid 46:469d0061df5d 6108 // int FLC_Write(uint32_t address, const void *data, uint32_t length, MXC_V_FLC_FLSH_UNLOCK_KEY);
whismanoid 46:469d0061df5d 6109 // @param address Start address for desired write. @note This address
whismanoid 46:469d0061df5d 6110 // must be 32-bit word aligned
whismanoid 46:469d0061df5d 6111 // @param data A pointer to the buffer containing the data to write.
whismanoid 46:469d0061df5d 6112 // @param length Size of the data to write in bytes. @note The length
whismanoid 46:469d0061df5d 6113 // must be in 32-bit multiples.
whismanoid 46:469d0061df5d 6114 // @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY.
whismanoid 46:469d0061df5d 6115 // returns E_NO_ERROR or else
whismanoid 46:469d0061df5d 6116 if (FLC_Write(pageBuf_addr, (uint32_t*)&pageBuf[0], sizeof(pageBuf),
whismanoid 46:469d0061df5d 6117 MXC_V_FLC_FLSH_UNLOCK_KEY) != E_NO_ERROR)
whismanoid 46:469d0061df5d 6118 {
whismanoid 46:469d0061df5d 6119 cmdLine.serial().printf("FAIL ");
whismanoid 46:469d0061df5d 6120 break; // can't perform the command
whismanoid 46:469d0061df5d 6121 }
whismanoid 46:469d0061df5d 6122 cmdLine.serial().printf("PASS ");
whismanoid 46:469d0061df5d 6123 //
whismanoid 46:469d0061df5d 6124 // FlashIAP: close flash memory interface flash.deinit();
whismanoid 46:469d0061df5d 6125 //
whismanoid 46:469d0061df5d 6126 // verify buffer matches flash page, or fail
whismanoid 46:469d0061df5d 6127 // for verification, perform %F peek=(poke_addr) len=(from byteCount)
whismanoid 46:469d0061df5d 6128 // hex dump memory from peek_addr length peek_len
whismanoid 46:469d0061df5d 6129 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: verify page buffer ...",
whismanoid 46:469d0061df5d 6130 poke_access_list[poke_access_list_index].name, pageBuf_addr);
whismanoid 46:469d0061df5d 6131 int verify_failed = 0;
whismanoid 46:469d0061df5d 6132 peek_addr = poke_addr;
whismanoid 46:469d0061df5d 6133 peek_len = (byteCount - 1)/4;
whismanoid 46:469d0061df5d 6134 //~ cmdLine.serial().printf("\r\n0x%8.8lx: ", peek_addr);
whismanoid 46:469d0061df5d 6135 if ((peek_addr & 0x0F) != 0)
whismanoid 46:469d0061df5d 6136 {
whismanoid 46:469d0061df5d 6137 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, peek_addr);
whismanoid 46:469d0061df5d 6138 }
whismanoid 46:469d0061df5d 6139 while (peek_len > 0)
whismanoid 46:469d0061df5d 6140 {
whismanoid 46:469d0061df5d 6141 if ((peek_addr & 0x0F) == 0)
whismanoid 46:469d0061df5d 6142 {
whismanoid 46:469d0061df5d 6143 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ", poke_access_list[poke_access_list_index].name, peek_addr);
whismanoid 46:469d0061df5d 6144 }
whismanoid 46:469d0061df5d 6145 // read memory by using peek_addr as a uint32_t pointer
whismanoid 46:469d0061df5d 6146 // cmdLine.serial().printf("0x%8.8lx ", *((uint32_t*)peek_addr));
whismanoid 46:469d0061df5d 6147 // #312 %F peek verify, report fail if mismatch page buffer
whismanoid 46:469d0061df5d 6148 uint32_t expect_data = 0
whismanoid 46:469d0061df5d 6149 | ((uint32_t)pageBuf[peek_addr - pageBuf_addr + 3] << 24)
whismanoid 46:469d0061df5d 6150 | ((uint32_t)pageBuf[peek_addr - pageBuf_addr + 2] << 16)
whismanoid 46:469d0061df5d 6151 | ((uint32_t)pageBuf[peek_addr - pageBuf_addr + 1] << 8)
whismanoid 46:469d0061df5d 6152 | ((uint32_t)pageBuf[peek_addr - pageBuf_addr + 0] << 0)
whismanoid 46:469d0061df5d 6153 ;
whismanoid 46:469d0061df5d 6154 uint32_t actual_data = *((uint32_t*)peek_addr);
whismanoid 46:469d0061df5d 6155 if (actual_data == expect_data)
whismanoid 46:469d0061df5d 6156 {
whismanoid 46:469d0061df5d 6157 // this word matches
whismanoid 46:469d0061df5d 6158 cmdLine.serial().printf("=0x%8.8lx ", actual_data);
whismanoid 46:469d0061df5d 6159 }
whismanoid 46:469d0061df5d 6160 else
whismanoid 46:469d0061df5d 6161 {
whismanoid 46:469d0061df5d 6162 // mismatch, verification failed
whismanoid 46:469d0061df5d 6163 cmdLine.serial().printf("#0x%8.8lx(expected 0x%8.8lx)\r\n%5s 0x%8.8lx: ",
whismanoid 46:469d0061df5d 6164 actual_data, expect_data,
whismanoid 46:469d0061df5d 6165 poke_access_list[poke_access_list_index].name, peek_addr);
whismanoid 46:469d0061df5d 6166 verify_failed++;
whismanoid 46:469d0061df5d 6167 }
whismanoid 46:469d0061df5d 6168 //
whismanoid 46:469d0061df5d 6169 peek_addr += 4;
whismanoid 46:469d0061df5d 6170 peek_len--;
whismanoid 46:469d0061df5d 6171 }
whismanoid 46:469d0061df5d 6172 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: verify page buffer ",
whismanoid 46:469d0061df5d 6173 poke_access_list[poke_access_list_index].name, pageBuf_addr);
whismanoid 46:469d0061df5d 6174 if (verify_failed)
whismanoid 46:469d0061df5d 6175 {
whismanoid 46:469d0061df5d 6176 cmdLine.serial().printf("FAIL ");
whismanoid 46:469d0061df5d 6177 break; // can't perform the command
whismanoid 46:469d0061df5d 6178 }
whismanoid 46:469d0061df5d 6179 cmdLine.serial().printf("PASS ");
whismanoid 46:469d0061df5d 6180 //
whismanoid 46:469d0061df5d 6181 } // end of flashPoke operation
whismanoid 46:469d0061df5d 6182 else if (poke_access_list[poke_access_list_index].can_flash_write_read & 0x0002)
whismanoid 46:469d0061df5d 6183 {
whismanoid 46:469d0061df5d 6184 // poke_addr is in RAM address range, write directly
whismanoid 46:469d0061df5d 6185 cmdLine.serial().printf("\r\n%5s 0x%8.8lx: ramPoke ", poke_access_list[poke_access_list_index].name, poke_addr);
whismanoid 46:469d0061df5d 6186 // ignore pokeDataBuf[0], its 0x0F because this is command F. :(
whismanoid 46:469d0061df5d 6187 for (size_t byteIndex = 1; byteIndex < byteCount; byteIndex += 4)
whismanoid 46:469d0061df5d 6188 {
whismanoid 46:469d0061df5d 6189 // How to handle big-endian vs little-endian?
whismanoid 46:469d0061df5d 6190 // seems 0x12 0x34 0x56 0x78 becomes 0x78563412
whismanoid 46:469d0061df5d 6191 poke_addr += 4;
whismanoid 46:469d0061df5d 6192 uint32_t wordbuf = 0
whismanoid 46:469d0061df5d 6193 | ((uint32_t)pokeDataBuf[byteIndex + 0] << 24)
whismanoid 46:469d0061df5d 6194 | ((uint32_t)pokeDataBuf[byteIndex + 1] << 16)
whismanoid 46:469d0061df5d 6195 | ((uint32_t)pokeDataBuf[byteIndex + 2] << 8)
whismanoid 46:469d0061df5d 6196 | ((uint32_t)pokeDataBuf[byteIndex + 3] << 0)
whismanoid 46:469d0061df5d 6197 ;
whismanoid 46:469d0061df5d 6198 cmdLine.serial().printf("0x%8.8lx ", wordbuf);
whismanoid 46:469d0061df5d 6199 //
whismanoid 46:469d0061df5d 6200 // write RAM by using poke_addr as a uint32_t pointer
whismanoid 46:469d0061df5d 6201 *((uint32_t*)poke_addr) = wordbuf;
whismanoid 46:469d0061df5d 6202 //
whismanoid 46:469d0061df5d 6203 // verify?
whismanoid 46:469d0061df5d 6204 if (*((uint32_t*)poke_addr) == wordbuf)
whismanoid 46:469d0061df5d 6205 {
whismanoid 46:469d0061df5d 6206 cmdLine.serial().printf("PASS ");
whismanoid 46:469d0061df5d 6207 }
whismanoid 46:469d0061df5d 6208 else
whismanoid 46:469d0061df5d 6209 {
whismanoid 46:469d0061df5d 6210 cmdLine.serial().printf("FAIL ");
whismanoid 46:469d0061df5d 6211 }
whismanoid 46:469d0061df5d 6212 }
whismanoid 46:469d0061df5d 6213 } // end of ramPoke operation
whismanoid 46:469d0061df5d 6214 else
whismanoid 46:469d0061df5d 6215 {
whismanoid 46:469d0061df5d 6216 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 6217 }
whismanoid 46:469d0061df5d 6218 }
whismanoid 46:469d0061df5d 6219 }
whismanoid 46:469d0061df5d 6220 # endif // HAS_FLASH_POKE
whismanoid 46:469d0061df5d 6221 # if HAS_FLASH_LOAD_SAVE
whismanoid 48:18647e0516f2 6222 uint32_t save_arg = save_arg_default;
whismanoid 46:469d0061df5d 6223 if (cmdLine.parse_uint32_hex("save", save_arg))
whismanoid 46:469d0061df5d 6224 {
whismanoid 46:469d0061df5d 6225 Save_flash_page_configuration_back_up(cmdLine, save_arg);
whismanoid 46:469d0061df5d 6226 }
whismanoid 48:18647e0516f2 6227 uint32_t load_arg = load_arg_default;
whismanoid 46:469d0061df5d 6228 if (cmdLine.parse_uint32_hex("load", load_arg))
whismanoid 46:469d0061df5d 6229 {
whismanoid 46:469d0061df5d 6230 Load_flash_page_configuration_back_up(cmdLine, load_arg);
whismanoid 46:469d0061df5d 6231 }
whismanoid 46:469d0061df5d 6232 # endif // HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 6233 }
whismanoid 46:469d0061df5d 6234 break;
whismanoid 46:469d0061df5d 6235 #endif // defined(HAS_FLASH_PEEK) || defined(HAS_FLASH_POKE)
whismanoid 46:469d0061df5d 6236 //--------------------------------------------------
whismanoid 23:c6c652bef4b9 6237 #if USE_DATALOGGER_CommandTable // Run_command_table(onButton1_command_table)
whismanoid 23:c6c652bef4b9 6238 // command_table: list of commands to perform on button press
whismanoid 23:c6c652bef4b9 6239 case 'B': case 'b':
whismanoid 23:c6c652bef4b9 6240 {
whismanoid 24:032f3683cb2a 6241 int command_table_button_index = 1;
whismanoid 23:c6c652bef4b9 6242 // %B1 submenu for Button1
whismanoid 23:c6c652bef4b9 6243 // future: %B2 submenu for Button2
whismanoid 23:c6c652bef4b9 6244 // future: %B3 submenu for Button3
whismanoid 23:c6c652bef4b9 6245 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 23:c6c652bef4b9 6246 // cmdLine[2] == '1' selects onButton1_command_table
whismanoid 23:c6c652bef4b9 6247 char** command_table = onButton1_command_table;
whismanoid 23:c6c652bef4b9 6248 #endif
whismanoid 24:032f3683cb2a 6249 switch(cmdLine[2])
whismanoid 24:032f3683cb2a 6250 {
whismanoid 24:032f3683cb2a 6251 default:
whismanoid 24:032f3683cb2a 6252 case '1': case 'A': case 'a': case '!':
whismanoid 24:032f3683cb2a 6253 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 6254 command_table_button_index = 1;
whismanoid 24:032f3683cb2a 6255 command_table = onButton1_command_table;
whismanoid 24:032f3683cb2a 6256 #endif
whismanoid 24:032f3683cb2a 6257 break;
whismanoid 24:032f3683cb2a 6258 case '2': case 'B': case 'b': case '@':
whismanoid 23:c6c652bef4b9 6259 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 6260 command_table_button_index = 2;
whismanoid 24:032f3683cb2a 6261 command_table = onButton2_command_table;
whismanoid 24:032f3683cb2a 6262 #endif
whismanoid 24:032f3683cb2a 6263 break;
whismanoid 24:032f3683cb2a 6264 case '3': case 'C': case 'c': case '#':
whismanoid 23:c6c652bef4b9 6265 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 6266 command_table_button_index = 3;
whismanoid 24:032f3683cb2a 6267 command_table = onButton3_command_table;
whismanoid 24:032f3683cb2a 6268 #endif
whismanoid 24:032f3683cb2a 6269 break;
whismanoid 29:6a9edb6e973b 6270 case '4':
whismanoid 29:6a9edb6e973b 6271 #if HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 6272 command_table_button_index = 4;
whismanoid 29:6a9edb6e973b 6273 command_table = onButton4_command_table;
whismanoid 29:6a9edb6e973b 6274 #endif
whismanoid 29:6a9edb6e973b 6275 break;
whismanoid 29:6a9edb6e973b 6276 case '5':
whismanoid 29:6a9edb6e973b 6277 #if HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 6278 command_table_button_index = 5;
whismanoid 29:6a9edb6e973b 6279 command_table = onButton5_command_table;
whismanoid 29:6a9edb6e973b 6280 #endif
whismanoid 29:6a9edb6e973b 6281 break;
whismanoid 29:6a9edb6e973b 6282 case '6':
whismanoid 29:6a9edb6e973b 6283 #if HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 6284 command_table_button_index = 6;
whismanoid 29:6a9edb6e973b 6285 command_table = onButton6_command_table;
whismanoid 29:6a9edb6e973b 6286 #endif
whismanoid 29:6a9edb6e973b 6287 break;
whismanoid 29:6a9edb6e973b 6288 case '7':
whismanoid 29:6a9edb6e973b 6289 #if HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 6290 command_table_button_index = 7;
whismanoid 29:6a9edb6e973b 6291 command_table = onButton7_command_table;
whismanoid 29:6a9edb6e973b 6292 #endif
whismanoid 29:6a9edb6e973b 6293 break;
whismanoid 29:6a9edb6e973b 6294 case '8':
whismanoid 29:6a9edb6e973b 6295 #if HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 6296 command_table_button_index = 8;
whismanoid 29:6a9edb6e973b 6297 command_table = onButton8_command_table;
whismanoid 29:6a9edb6e973b 6298 #endif
whismanoid 29:6a9edb6e973b 6299 break;
whismanoid 29:6a9edb6e973b 6300 case '9':
whismanoid 29:6a9edb6e973b 6301 #if HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 6302 command_table_button_index = 9;
whismanoid 29:6a9edb6e973b 6303 command_table = onButton9_command_table;
whismanoid 29:6a9edb6e973b 6304 #endif
whismanoid 29:6a9edb6e973b 6305 break;
whismanoid 24:032f3683cb2a 6306 }
whismanoid 24:032f3683cb2a 6307 //
whismanoid 23:c6c652bef4b9 6308 switch(cmdLine[3])
whismanoid 23:c6c652bef4b9 6309 {
whismanoid 23:c6c652bef4b9 6310 case '@':
whismanoid 23:c6c652bef4b9 6311 {
whismanoid 23:c6c652bef4b9 6312 // %B1@ view/edit command table, similar to L@ for action table
whismanoid 23:c6c652bef4b9 6313 int editRowIndex = 0;
whismanoid 23:c6c652bef4b9 6314 int command_table_row_count = 0;
whismanoid 23:c6c652bef4b9 6315 for (int lineIndex = 0; lineIndex < COMMAND_TABLE_ROW_MAX; lineIndex++) {
whismanoid 23:c6c652bef4b9 6316 if (command_table[lineIndex] == NULL) { break; }
whismanoid 23:c6c652bef4b9 6317 if (command_table[lineIndex][0] == '\0') { break; }
whismanoid 24:032f3683cb2a 6318 command_table_row_count = lineIndex+1;
whismanoid 24:032f3683cb2a 6319 }
whismanoid 24:032f3683cb2a 6320 //
whismanoid 24:032f3683cb2a 6321 // ignore extra spaces before the command
whismanoid 24:032f3683cb2a 6322 // find argIndex such that cmdLine[argIndex] is the start of the second word
whismanoid 24:032f3683cb2a 6323 int argIndex;
whismanoid 24:032f3683cb2a 6324 for (argIndex = 5; cmdLine[argIndex] != '\0'; argIndex++)
whismanoid 24:032f3683cb2a 6325 {
whismanoid 24:032f3683cb2a 6326 if (cmdLine[argIndex] == ' ') break;
whismanoid 24:032f3683cb2a 6327 }
whismanoid 24:032f3683cb2a 6328 for (; cmdLine[argIndex] != '\0'; argIndex++)
whismanoid 24:032f3683cb2a 6329 {
whismanoid 24:032f3683cb2a 6330 if (cmdLine[argIndex] != ' ') break;
whismanoid 23:c6c652bef4b9 6331 }
whismanoid 23:c6c652bef4b9 6332 //
whismanoid 23:c6c652bef4b9 6333 // Edit the contents of command_table
whismanoid 23:c6c652bef4b9 6334 switch (cmdLine[4]) // %B1@... -- Edit the contents of command_table
whismanoid 23:c6c652bef4b9 6335 {
whismanoid 23:c6c652bef4b9 6336 case '0': case '1': case '2': case '3': case '4':
whismanoid 23:c6c652bef4b9 6337 case '5': case '6': case '7': case '8': case '9':
whismanoid 24:032f3683cb2a 6338 // %B1@nnn command replace row number nnn
whismanoid 23:c6c652bef4b9 6339 // edit row data
whismanoid 33:70a28cfe9e01 6340 // get row number to edit from cmdLine[4]
whismanoid 33:70a28cfe9e01 6341 editRowIndex = atoi(cmdLine.str()+4);
whismanoid 23:c6c652bef4b9 6342 if (command_table_row_count > 0) {
whismanoid 23:c6c652bef4b9 6343 // if Datalogger_action_table_row_count == 0 then the table is empty
whismanoid 24:032f3683cb2a 6344 if ((editRowIndex >= 0) && (editRowIndex < command_table_row_count)) {
whismanoid 28:a9a3a9db592b 6345 // avoid replacing with null because that would truncate the table
whismanoid 28:a9a3a9db592b 6346 if (*(cmdLine.str()+argIndex)=='\0') {
whismanoid 28:a9a3a9db592b 6347 cmdLine.serial().printf("\r\n cannot replace row %d with nothing",
whismanoid 28:a9a3a9db592b 6348 editRowIndex);
whismanoid 28:a9a3a9db592b 6349 }
whismanoid 28:a9a3a9db592b 6350 else
whismanoid 28:a9a3a9db592b 6351 {
whismanoid 28:a9a3a9db592b 6352 // update row
whismanoid 28:a9a3a9db592b 6353 cmdLine.serial().printf("\r\n replace row %d with \"%s\"",
whismanoid 28:a9a3a9db592b 6354 editRowIndex, cmdLine.str()+argIndex);
whismanoid 28:a9a3a9db592b 6355 strncpy(command_table[editRowIndex], cmdLine.str()+argIndex, COMMAND_TABLE_COL_MAX-1);
whismanoid 28:a9a3a9db592b 6356 command_table[editRowIndex][COMMAND_TABLE_COL_MAX-1]='\0'; // null character at end of line
whismanoid 28:a9a3a9db592b 6357 }
whismanoid 24:032f3683cb2a 6358 }
whismanoid 33:70a28cfe9e01 6359 } // end if (command_table_row_count > 0)
whismanoid 33:70a28cfe9e01 6360 if ((editRowIndex == command_table_row_count) && (command_table_row_count < COMMAND_TABLE_ROW_MAX)) {
whismanoid 33:70a28cfe9e01 6361 // %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 6362 //
whismanoid 33:70a28cfe9e01 6363 command_table_row_count++;
whismanoid 33:70a28cfe9e01 6364 cmdLine.serial().printf("\r\n add next row %d containing \"%s\"",
whismanoid 33:70a28cfe9e01 6365 editRowIndex, cmdLine.str()+argIndex);
whismanoid 33:70a28cfe9e01 6366 strncpy(command_table[editRowIndex], cmdLine.str()+argIndex, COMMAND_TABLE_COL_MAX-1);
whismanoid 33:70a28cfe9e01 6367 command_table[editRowIndex][COMMAND_TABLE_COL_MAX-1]='\0'; // null character at end of line
whismanoid 33:70a28cfe9e01 6368 command_table[command_table_row_count][0]='\0'; // empty string marks end of command_table
whismanoid 33:70a28cfe9e01 6369 //
whismanoid 23:c6c652bef4b9 6370 }
whismanoid 33:70a28cfe9e01 6371 //
whismanoid 23:c6c652bef4b9 6372 break;
whismanoid 23:c6c652bef4b9 6373 case '+':
whismanoid 24:032f3683cb2a 6374 // %B1@+ command add new row (if there is room to add)
whismanoid 23:c6c652bef4b9 6375 // add a new row at end of table
whismanoid 23:c6c652bef4b9 6376 if (command_table_row_count < COMMAND_TABLE_ROW_MAX) {
whismanoid 23:c6c652bef4b9 6377 // if command_table_row_count => COMMAND_TABLE_ROW_MAX then the table is full
whismanoid 23:c6c652bef4b9 6378 editRowIndex = command_table_row_count;
whismanoid 28:a9a3a9db592b 6379 // avoid replacing with null because that would truncate the table
whismanoid 28:a9a3a9db592b 6380 if (*(cmdLine.str()+argIndex)=='\0') {
whismanoid 28:a9a3a9db592b 6381 cmdLine.serial().printf("\r\n cannot add new row %d containing nothing",
whismanoid 28:a9a3a9db592b 6382 editRowIndex);
whismanoid 28:a9a3a9db592b 6383 }
whismanoid 28:a9a3a9db592b 6384 else
whismanoid 28:a9a3a9db592b 6385 {
whismanoid 28:a9a3a9db592b 6386 command_table_row_count++;
whismanoid 28:a9a3a9db592b 6387 cmdLine.serial().printf("\r\n add new row %d containing \"%s\"",
whismanoid 28:a9a3a9db592b 6388 editRowIndex, cmdLine.str()+argIndex);
whismanoid 28:a9a3a9db592b 6389 strncpy(command_table[editRowIndex], cmdLine.str()+argIndex, COMMAND_TABLE_COL_MAX-1);
whismanoid 28:a9a3a9db592b 6390 command_table[editRowIndex][COMMAND_TABLE_COL_MAX-1]='\0'; // null character at end of line
whismanoid 28:a9a3a9db592b 6391 command_table[command_table_row_count][0]='\0'; // empty string marks end of command_table
whismanoid 28:a9a3a9db592b 6392 }
whismanoid 23:c6c652bef4b9 6393 }
whismanoid 23:c6c652bef4b9 6394 break;
whismanoid 23:c6c652bef4b9 6395 case '-':
whismanoid 24:032f3683cb2a 6396 // %B1@-nnn delete row number nnn (if list is not empty)
whismanoid 23:c6c652bef4b9 6397 // delete row from table
whismanoid 23:c6c652bef4b9 6398 if (command_table_row_count > 0) {
whismanoid 23:c6c652bef4b9 6399 // if command_table_row_count == 0 then the table is empty
whismanoid 23:c6c652bef4b9 6400 if ((cmdLine[5] == '~') && (cmdLine[6] == '~') && (cmdLine[7] == '~')) {
whismanoid 23:c6c652bef4b9 6401 // %B1@-~~~ clear entire command table
whismanoid 24:032f3683cb2a 6402 cmdLine.serial().printf("\r\n clear entire command table");
whismanoid 23:c6c652bef4b9 6403 command_table_row_count = 0;
whismanoid 28:a9a3a9db592b 6404 command_table[command_table_row_count][0]='\0'; // empty string marks end of command_table
whismanoid 23:c6c652bef4b9 6405 break;
whismanoid 23:c6c652bef4b9 6406 }
whismanoid 24:032f3683cb2a 6407 else
whismanoid 23:c6c652bef4b9 6408 {
whismanoid 24:032f3683cb2a 6409 // %B1@-nnn delete row number nnn (if list is not empty)
whismanoid 24:032f3683cb2a 6410 editRowIndex = atoi(cmdLine.str()+5);
whismanoid 24:032f3683cb2a 6411 if ((editRowIndex >= 0) && (editRowIndex < command_table_row_count)) {
whismanoid 24:032f3683cb2a 6412 cmdLine.serial().printf("\r\n delete row %d", editRowIndex);
whismanoid 24:032f3683cb2a 6413 // delete row editRowIndex from Datalogger_action_table
whismanoid 24:032f3683cb2a 6414 for (int i = editRowIndex; i < (command_table_row_count-1); i++)
whismanoid 24:032f3683cb2a 6415 {
whismanoid 24:032f3683cb2a 6416 // copy row i+1 into row i
whismanoid 24:032f3683cb2a 6417 cmdLine.serial().printf("\r\n copy row %d into row %d: \"%s\"",
whismanoid 24:032f3683cb2a 6418 i+1, i, command_table[i+1]);
whismanoid 24:032f3683cb2a 6419 strncpy(command_table[i], command_table[i+1], COMMAND_TABLE_COL_MAX-1);
whismanoid 28:a9a3a9db592b 6420 command_table[i][COMMAND_TABLE_COL_MAX-1]='\0'; // null character at end of line
whismanoid 24:032f3683cb2a 6421 }
whismanoid 24:032f3683cb2a 6422 command_table_row_count--;
whismanoid 28:a9a3a9db592b 6423 command_table[command_table_row_count][0]='\0'; // empty string marks end of command_table
whismanoid 24:032f3683cb2a 6424 }
whismanoid 23:c6c652bef4b9 6425 }
whismanoid 23:c6c652bef4b9 6426 }
whismanoid 23:c6c652bef4b9 6427 break;
whismanoid 30:07197a430869 6428 case '.': // something other than ! because %B1! means trigger event
whismanoid 30:07197a430869 6429 // pause the button event
whismanoid 30:07197a430869 6430 // TODO: %B1@. disable button response but keep command table contents
whismanoid 23:c6c652bef4b9 6431 //~ Datalogger_action_table_enabled = false;
whismanoid 23:c6c652bef4b9 6432 break;
whismanoid 23:c6c652bef4b9 6433 case '@':
whismanoid 30:07197a430869 6434 // enable the button event
whismanoid 23:c6c652bef4b9 6435 // TODO: %B1@@ enable button response
whismanoid 23:c6c652bef4b9 6436 //~ Datalogger_action_table_enabled = true;
whismanoid 23:c6c652bef4b9 6437 break;
whismanoid 23:c6c652bef4b9 6438 }
whismanoid 23:c6c652bef4b9 6439 //
whismanoid 23:c6c652bef4b9 6440 // Print the contents of command_table
whismanoid 23:c6c652bef4b9 6441 for (int lineIndex = 0; lineIndex < COMMAND_TABLE_ROW_MAX; lineIndex++) {
whismanoid 23:c6c652bef4b9 6442 if (command_table[lineIndex] == NULL) { break; }
whismanoid 23:c6c652bef4b9 6443 if (command_table[lineIndex][0] == '\0') { break; }
whismanoid 24:032f3683cb2a 6444 command_table_row_count = lineIndex+1;
whismanoid 24:032f3683cb2a 6445 cmdLine.serial().printf("\r\n %%B%1d@%d %s",
whismanoid 24:032f3683cb2a 6446 command_table_button_index,
whismanoid 24:032f3683cb2a 6447 lineIndex,
whismanoid 24:032f3683cb2a 6448 command_table[lineIndex]);
whismanoid 23:c6c652bef4b9 6449 }
whismanoid 30:07197a430869 6450 //~ cmdLine.serial().printf("\r\n command_table_row_count = %d/%d",
whismanoid 30:07197a430869 6451 //~ command_table_row_count, COMMAND_TABLE_ROW_MAX);
whismanoid 30:07197a430869 6452 cmdLine.serial().printf("\r\n\r\nEdit Button%d event (used %d/%d, %d free):",
whismanoid 30:07197a430869 6453 command_table_button_index,
whismanoid 30:07197a430869 6454 command_table_row_count,
whismanoid 30:07197a430869 6455 COMMAND_TABLE_ROW_MAX,
whismanoid 30:07197a430869 6456 (COMMAND_TABLE_ROW_MAX - command_table_row_count)
whismanoid 30:07197a430869 6457 );
whismanoid 23:c6c652bef4b9 6458 if (command_table_row_count < COMMAND_TABLE_ROW_MAX) {
whismanoid 23:c6c652bef4b9 6459 // if command_table_row_count => COMMAND_TABLE_ROW_MAX then the table is full
whismanoid 24:032f3683cb2a 6460 cmdLine.serial().printf("\r\n %%B%1d@+ command -- add new row %d at end of table",
whismanoid 24:032f3683cb2a 6461 command_table_button_index,
whismanoid 24:032f3683cb2a 6462 command_table_row_count);
whismanoid 23:c6c652bef4b9 6463 }
whismanoid 23:c6c652bef4b9 6464 if (command_table_row_count > 0) {
whismanoid 23:c6c652bef4b9 6465 // if command_table_row_count == 0 then the table is empty
whismanoid 24:032f3683cb2a 6466 cmdLine.serial().printf("\r\n %%B%1d@%d command -- replace row %d",
whismanoid 24:032f3683cb2a 6467 command_table_button_index,
whismanoid 23:c6c652bef4b9 6468 command_table_row_count-1,
whismanoid 23:c6c652bef4b9 6469 command_table_row_count-1);
whismanoid 24:032f3683cb2a 6470 cmdLine.serial().printf("\r\n %%B%1d@-%d -- delete row %d",
whismanoid 24:032f3683cb2a 6471 command_table_button_index,
whismanoid 24:032f3683cb2a 6472 command_table_row_count-1,
whismanoid 24:032f3683cb2a 6473 command_table_row_count-1);
whismanoid 24:032f3683cb2a 6474 cmdLine.serial().printf("\r\n %%B%1d@-~~~ -- delete all rows",
whismanoid 24:032f3683cb2a 6475 command_table_button_index);
whismanoid 30:07197a430869 6476 //~ cmdLine.serial().printf("\r\n %%B%1d@. -- pause entire command table",
whismanoid 30:07197a430869 6477 //~ command_table_button_index);
whismanoid 30:07197a430869 6478 //~ cmdLine.serial().printf("\r\n %%B%1d@@ -- enable command table",
whismanoid 30:07197a430869 6479 //~ command_table_button_index);
whismanoid 30:07197a430869 6480 cmdLine.serial().printf("\r\n %%B%1d! -- trigger Button%d event",
whismanoid 30:07197a430869 6481 command_table_button_index,
whismanoid 24:032f3683cb2a 6482 command_table_button_index);
whismanoid 23:c6c652bef4b9 6483 }
whismanoid 23:c6c652bef4b9 6484 //
whismanoid 23:c6c652bef4b9 6485 } // case '@' -- %B1@ view/edit command table
whismanoid 23:c6c652bef4b9 6486 break;
whismanoid 23:c6c652bef4b9 6487 case '!':
whismanoid 23:c6c652bef4b9 6488 // TODO: %B1! trigger onButton1FallingEdge() immediately (for test development)
whismanoid 23:c6c652bef4b9 6489 Run_command_table(command_table);
whismanoid 23:c6c652bef4b9 6490 break;
whismanoid 23:c6c652bef4b9 6491 }
whismanoid 23:c6c652bef4b9 6492 }
whismanoid 23:c6c652bef4b9 6493 break;
whismanoid 23:c6c652bef4b9 6494 #endif // USE_DATALOGGER_CommandTable
whismanoid 23:c6c652bef4b9 6495 //--------------------------------------------------
whismanoid 15:37c83ec50ea0 6496 #if HAS_digitalInOuts
whismanoid 15:37c83ec50ea0 6497 case 'H': case 'h':
whismanoid 15:37c83ec50ea0 6498 {
whismanoid 15:37c83ec50ea0 6499 // %Hpin -- digital output high
whismanoid 15:37c83ec50ea0 6500 #if ARDUINO_STYLE
whismanoid 15:37c83ec50ea0 6501 pinMode(pinIndex, OUTPUT); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 15:37c83ec50ea0 6502 digitalWrite(pinIndex, HIGH); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 15:37c83ec50ea0 6503 #else
whismanoid 15:37c83ec50ea0 6504 DigitalInOut& digitalInOutPin = find_digitalInOutPin(pinIndex);
whismanoid 15:37c83ec50ea0 6505 digitalInOutPin.output();
whismanoid 15:37c83ec50ea0 6506 digitalInOutPin.write(1);
whismanoid 15:37c83ec50ea0 6507 #endif
whismanoid 15:37c83ec50ea0 6508 cmdLine.serial().printf(" digitalInOutPin %d Output High ", pinIndex);
whismanoid 15:37c83ec50ea0 6509 }
whismanoid 15:37c83ec50ea0 6510 break;
whismanoid 15:37c83ec50ea0 6511 case 'L': case 'l':
whismanoid 15:37c83ec50ea0 6512 {
whismanoid 15:37c83ec50ea0 6513 // %Lpin -- digital output low
whismanoid 15:37c83ec50ea0 6514 #if ARDUINO_STYLE
whismanoid 15:37c83ec50ea0 6515 pinMode(pinIndex, OUTPUT); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 15:37c83ec50ea0 6516 digitalWrite(pinIndex, LOW); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 15:37c83ec50ea0 6517 #else
whismanoid 15:37c83ec50ea0 6518 DigitalInOut& digitalInOutPin = find_digitalInOutPin(pinIndex);
whismanoid 15:37c83ec50ea0 6519 digitalInOutPin.output();
whismanoid 15:37c83ec50ea0 6520 digitalInOutPin.write(0);
whismanoid 15:37c83ec50ea0 6521 #endif
whismanoid 15:37c83ec50ea0 6522 cmdLine.serial().printf(" digitalInOutPin %d Output Low ", pinIndex);
whismanoid 15:37c83ec50ea0 6523 }
whismanoid 15:37c83ec50ea0 6524 break;
whismanoid 15:37c83ec50ea0 6525 case '?':
whismanoid 15:37c83ec50ea0 6526 {
whismanoid 15:37c83ec50ea0 6527 // %?pin -- digital input
whismanoid 15:37c83ec50ea0 6528 #if ARDUINO_STYLE
whismanoid 15:37c83ec50ea0 6529 pinMode(pinIndex, INPUT); // 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.input();
whismanoid 15:37c83ec50ea0 6533 #endif
whismanoid 15:37c83ec50ea0 6534 serial.printf(" digitalInOutPin %d Input ", pinIndex);
whismanoid 15:37c83ec50ea0 6535 #if ARDUINO_STYLE
whismanoid 15:37c83ec50ea0 6536 int value = digitalRead(pinIndex);
whismanoid 15:37c83ec50ea0 6537 #else
whismanoid 15:37c83ec50ea0 6538 int value = digitalInOutPin.read();
whismanoid 15:37c83ec50ea0 6539 #endif
whismanoid 15:37c83ec50ea0 6540 cmdLine.serial().printf("%d ", value);
whismanoid 15:37c83ec50ea0 6541 }
whismanoid 15:37c83ec50ea0 6542 break;
whismanoid 15:37c83ec50ea0 6543 #endif
whismanoid 15:37c83ec50ea0 6544 //
whismanoid 15:37c83ec50ea0 6545 #if HAS_analogIns
whismanoid 15:37c83ec50ea0 6546 case 'A': case 'a':
whismanoid 15:37c83ec50ea0 6547 {
whismanoid 15:37c83ec50ea0 6548 // %A %Apin -- analog input
whismanoid 37:3f369235e5bc 6549 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 6550 // %A avg= -- set Platform_AIN_Average_N
whismanoid 37:3f369235e5bc 6551 if (cmdLine.parse_int_dec("avg", Platform_AIN_Average_N))
whismanoid 37:3f369235e5bc 6552 {
whismanoid 37:3f369235e5bc 6553 // Platform_AIN_Average_N was updated
whismanoid 37:3f369235e5bc 6554 }
whismanoid 37:3f369235e5bc 6555 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 6556 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6557 // %A cal? view/export raw calibration values for all channels
whismanoid 34:a1993a1ee904 6558 // double calibration_05_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6559 // double calibration_05_V [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6560 // double calibration_95_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6561 // double calibration_95_V [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6562 {
whismanoid 34:a1993a1ee904 6563 char valueBuf[16];
whismanoid 34:a1993a1ee904 6564 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 34:a1993a1ee904 6565 if (cmdLine.parse_and_remove_key("cal?", valueBuf, sizeof(valueBuf)))
whismanoid 34:a1993a1ee904 6566 {
whismanoid 34:a1993a1ee904 6567 for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6568 {
whismanoid 52:bb09c0f452ec 6569 // %A cl0n= cl0v= ch0n= ch0v= -- unambiguous low and high cal points alternative to cal0n= cal0v= cal0n= cal0v= #354
whismanoid 52:bb09c0f452ec 6570 //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 6571 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 6572 ch, calibration_05_normValue_0_1[ch],
whismanoid 34:a1993a1ee904 6573 ch, calibration_05_V[ch],
whismanoid 34:a1993a1ee904 6574 ch, calibration_95_normValue_0_1[ch],
whismanoid 34:a1993a1ee904 6575 ch, calibration_95_V[ch]
whismanoid 34:a1993a1ee904 6576 );
whismanoid 34:a1993a1ee904 6577 }
whismanoid 34:a1993a1ee904 6578 //
whismanoid 34:a1993a1ee904 6579 // print extended help for %A
whismanoid 34:a1993a1ee904 6580 // %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 6581 //~ cmdLine.serial().printf("\r\n %%A cal0n=0.02 cal0v=0.123 cal0n=0.938 cal0v=1.132 -- update calibration");
whismanoid 34:a1993a1ee904 6582 // %A cal0test=0.5 test calibration functions by calculating the calibrated voltage of specified normValue_0_1
whismanoid 34:a1993a1ee904 6583 cmdLine.serial().printf(" %%A cal0test=0.5 -- calculate voltage at 50%% of full scale");
whismanoid 49:359a6b9df7c1 6584 // #350 MAX40108 %A vl#cal / vh#cal / v#copy=
whismanoid 49:359a6b9df7c1 6585 // cmdLine.serial().printf("\r\n %%A v0cal=1.000V -- calibrate channel against a known input voltage");
whismanoid 49:359a6b9df7c1 6586 cmdLine.serial().printf("\r\n %%A v0cal=1.000V | vl5cal=0.800V | vh5cal=1.600V -- calibrate input voltage");
whismanoid 49:359a6b9df7c1 6587 cmdLine.serial().printf("\r\n %%A v4copy=5 -- copy calibration from other channel");
whismanoid 34:a1993a1ee904 6588 // %A calreset -- reset all calibration data
whismanoid 34:a1993a1ee904 6589 cmdLine.serial().printf("\r\n %%A calreset -- reset all calibration data");
whismanoid 37:3f369235e5bc 6590 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 6591 // %A avg=%d -- help string display Platform_AIN_Average_N
whismanoid 37:3f369235e5bc 6592 cmdLine.serial().printf("\r\n %%A avg=%d -- average", Platform_AIN_Average_N);
whismanoid 37:3f369235e5bc 6593 #endif // USE_Platform_AIN_Average
whismanoid 48:18647e0516f2 6594 #ifdef BOARD_SERIAL_NUMBER
whismanoid 48:18647e0516f2 6595 // %A sn= set g_board_serial_number ; use with %F save during calibration #312
whismanoid 49:359a6b9df7c1 6596 cmdLine.serial().printf("\r\n %%A sn=%ld -- serial number", g_board_serial_number);
whismanoid 48:18647e0516f2 6597 #endif // BOARD_SERIAL_NUMBER
whismanoid 34:a1993a1ee904 6598 cmdLine.serial().printf("\r\n\r\n");
whismanoid 34:a1993a1ee904 6599 //
whismanoid 34:a1993a1ee904 6600 } // end if (cmdLine.parse_and_remove_key("cal?", valueBuf, sizeof(valueBuf)))
whismanoid 34:a1993a1ee904 6601 }
whismanoid 34:a1993a1ee904 6602 #endif // HAS_Platform_AIN_Calibration
whismanoid 48:18647e0516f2 6603 #ifdef BOARD_SERIAL_NUMBER
whismanoid 48:18647e0516f2 6604 {
whismanoid 48:18647e0516f2 6605 // %A sn= set g_board_serial_number ; use with %F save during calibration #312
whismanoid 48:18647e0516f2 6606 if (cmdLine.parse_uint32_dec("sn", g_board_serial_number))
whismanoid 48:18647e0516f2 6607 {
whismanoid 48:18647e0516f2 6608 }
whismanoid 48:18647e0516f2 6609 }
whismanoid 48:18647e0516f2 6610 #endif // BOARD_SERIAL_NUMBER
whismanoid 34:a1993a1ee904 6611 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6612 {
whismanoid 34:a1993a1ee904 6613 // %A calreset -- reset all calibration data
whismanoid 34:a1993a1ee904 6614 char valueBuf[16];
whismanoid 34:a1993a1ee904 6615 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 34:a1993a1ee904 6616 if (cmdLine.parse_and_remove_key("calreset", valueBuf, sizeof(valueBuf)))
whismanoid 34:a1993a1ee904 6617 {
whismanoid 34:a1993a1ee904 6618 // nominal 5% fullscale point; normValue_0_1 < 0.5
whismanoid 34:a1993a1ee904 6619 calibration_05_normValue_0_1[0] = 0.25; calibration_05_V[0] = 0.3;
whismanoid 34:a1993a1ee904 6620 calibration_05_normValue_0_1[1] = 0.25; calibration_05_V[1] = 0.3;
whismanoid 34:a1993a1ee904 6621 calibration_05_normValue_0_1[2] = 0.25; calibration_05_V[2] = 0.3;
whismanoid 34:a1993a1ee904 6622 calibration_05_normValue_0_1[3] = 0.25; calibration_05_V[3] = 0.3;
whismanoid 34:a1993a1ee904 6623 calibration_05_normValue_0_1[4] = 0.25; calibration_05_V[4] = 1.5;
whismanoid 34:a1993a1ee904 6624 calibration_05_normValue_0_1[5] = 0.25; calibration_05_V[5] = 1.5;
whismanoid 34:a1993a1ee904 6625 //
whismanoid 34:a1993a1ee904 6626 // nominal 95% fullscale point; normValue_0_1 > 0.5
whismanoid 34:a1993a1ee904 6627 calibration_95_normValue_0_1[0] = 0.75; calibration_95_V[0] = 0.9;
whismanoid 34:a1993a1ee904 6628 calibration_95_normValue_0_1[1] = 0.75; calibration_95_V[1] = 0.9;
whismanoid 34:a1993a1ee904 6629 calibration_95_normValue_0_1[2] = 0.75; calibration_95_V[2] = 0.9;
whismanoid 34:a1993a1ee904 6630 calibration_95_normValue_0_1[3] = 0.75; calibration_95_V[3] = 0.9;
whismanoid 34:a1993a1ee904 6631 calibration_95_normValue_0_1[4] = 0.75; calibration_95_V[4] = 4.5;
whismanoid 34:a1993a1ee904 6632 calibration_95_normValue_0_1[5] = 0.75; calibration_95_V[5] = 4.5;
whismanoid 34:a1993a1ee904 6633 //
whismanoid 34:a1993a1ee904 6634 }
whismanoid 34:a1993a1ee904 6635 }
whismanoid 34:a1993a1ee904 6636 #endif // HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6637 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6638 // %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 6639 // %A cal4n=0.135874882 cal4v=0.800000012V cal4n=0.286168128 cal4v=1.700000048V
whismanoid 34:a1993a1ee904 6640 // double calibration_05_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6641 // double calibration_05_V [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6642 // double calibration_95_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6643 // double calibration_95_V [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6644 {
whismanoid 34:a1993a1ee904 6645 double normValue_0_1, V;
whismanoid 34:a1993a1ee904 6646 for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6647 {
whismanoid 52:bb09c0f452ec 6648 // %A cl0n= cl0v= ch0n= ch0v= -- unambiguous low and high cal points alternative to cal0n= cal0v= cal0n= cal0v= #354
whismanoid 52:bb09c0f452ec 6649 static char key_call0n[8] = "call0n_";
whismanoid 52:bb09c0f452ec 6650 sprintf(key_call0n, "cl%1dn", ch);
whismanoid 52:bb09c0f452ec 6651 static char key_call0v[8] = "call0v_";
whismanoid 52:bb09c0f452ec 6652 sprintf(key_call0v, "cl%1dv", ch);
whismanoid 52:bb09c0f452ec 6653 static char key_calh0n[8] = "calh0n_";
whismanoid 52:bb09c0f452ec 6654 sprintf(key_calh0n, "ch%1dn", ch);
whismanoid 52:bb09c0f452ec 6655 static char key_calh0v[8] = "calh0v_";
whismanoid 52:bb09c0f452ec 6656 sprintf(key_calh0v, "ch%1dv", ch);
whismanoid 52:bb09c0f452ec 6657 if (cmdLine.parse_double(key_call0n, normValue_0_1))
whismanoid 52:bb09c0f452ec 6658 {
whismanoid 52:bb09c0f452ec 6659 if (cmdLine.parse_double(key_call0v, V))
whismanoid 52:bb09c0f452ec 6660 {
whismanoid 52:bb09c0f452ec 6661 // store first calibration point in the 5% slot
whismanoid 52:bb09c0f452ec 6662 calibration_05_normValue_0_1[ch] = normValue_0_1;
whismanoid 52:bb09c0f452ec 6663 calibration_05_V[ch] = V;
whismanoid 52:bb09c0f452ec 6664 }
whismanoid 52:bb09c0f452ec 6665 }
whismanoid 52:bb09c0f452ec 6666 if (cmdLine.parse_double(key_calh0n, normValue_0_1))
whismanoid 52:bb09c0f452ec 6667 {
whismanoid 52:bb09c0f452ec 6668 if (cmdLine.parse_double(key_calh0v, V))
whismanoid 52:bb09c0f452ec 6669 {
whismanoid 52:bb09c0f452ec 6670 calibration_95_normValue_0_1[ch] = normValue_0_1;
whismanoid 52:bb09c0f452ec 6671 calibration_95_V[ch] = V;
whismanoid 52:bb09c0f452ec 6672 }
whismanoid 52:bb09c0f452ec 6673 }
whismanoid 52:bb09c0f452ec 6674 // auto select low or high cal points: cal0n= cal0v= cal0n= cal0v=
whismanoid 34:a1993a1ee904 6675 static char key_can0n[8] = "cal0n__";
whismanoid 34:a1993a1ee904 6676 sprintf(key_can0n, "cal%1dn", ch);
whismanoid 34:a1993a1ee904 6677 static char key_cal0v[8] = "cal0v__";
whismanoid 34:a1993a1ee904 6678 sprintf(key_cal0v, "cal%1dv", ch);
whismanoid 35:c9549b5c01de 6679 // first point could be the 5% point or the 95% point
whismanoid 35:c9549b5c01de 6680 double norm_threshold = (calibration_05_normValue_0_1[ch] + calibration_95_normValue_0_1[ch]) / 2.0;
whismanoid 35:c9549b5c01de 6681 bool updated_05 = false;
whismanoid 35:c9549b5c01de 6682 //~ bool updated_95 = false;
whismanoid 35:c9549b5c01de 6683 if (cmdLine.parse_double(key_can0n, normValue_0_1)) {
whismanoid 34:a1993a1ee904 6684 if (cmdLine.parse_double(key_cal0v, V))
whismanoid 34:a1993a1ee904 6685 {
whismanoid 35:c9549b5c01de 6686 if (normValue_0_1 < norm_threshold) {
whismanoid 35:c9549b5c01de 6687 // store first calibration point in the 5% slot
whismanoid 35:c9549b5c01de 6688 calibration_05_normValue_0_1[ch] = normValue_0_1;
whismanoid 34:a1993a1ee904 6689 calibration_05_V[ch] = V;
whismanoid 35:c9549b5c01de 6690 updated_05 = true;
whismanoid 34:a1993a1ee904 6691 }
whismanoid 34:a1993a1ee904 6692 else {
whismanoid 35:c9549b5c01de 6693 // store first calibration point in the 95% slot
whismanoid 35:c9549b5c01de 6694 calibration_95_normValue_0_1[ch] = normValue_0_1;
whismanoid 34:a1993a1ee904 6695 calibration_95_V[ch] = V;
whismanoid 35:c9549b5c01de 6696 //~ updated_95 = true;
whismanoid 34:a1993a1ee904 6697 }
whismanoid 34:a1993a1ee904 6698 }
whismanoid 35:c9549b5c01de 6699 }
whismanoid 35:c9549b5c01de 6700 // handle the optional second calibration point
whismanoid 35:c9549b5c01de 6701 if (cmdLine.parse_double(key_can0n, normValue_0_1))
whismanoid 35:c9549b5c01de 6702 {
whismanoid 35:c9549b5c01de 6703 if (cmdLine.parse_double(key_cal0v, V))
whismanoid 35:c9549b5c01de 6704 {
whismanoid 35:c9549b5c01de 6705 if (updated_05) {
whismanoid 35:c9549b5c01de 6706 // we already stored the first point here
whismanoid 35:c9549b5c01de 6707 // calibration_05_normValue_0_1[ch] = normValue_0_1;
whismanoid 35:c9549b5c01de 6708 // calibration_05_V[ch] = V;
whismanoid 35:c9549b5c01de 6709 // store the second point in the other slot
whismanoid 35:c9549b5c01de 6710 calibration_95_normValue_0_1[ch] = normValue_0_1;
whismanoid 35:c9549b5c01de 6711 calibration_95_V[ch] = V;
whismanoid 35:c9549b5c01de 6712 }
whismanoid 35:c9549b5c01de 6713 else {
whismanoid 35:c9549b5c01de 6714 // we already stored the first point here
whismanoid 35:c9549b5c01de 6715 // calibration_95_normValue_0_1[ch] = normValue_0_1;
whismanoid 35:c9549b5c01de 6716 // calibration_95_V[ch] = V;
whismanoid 35:c9549b5c01de 6717 // store the second point in the other slot
whismanoid 35:c9549b5c01de 6718 calibration_05_normValue_0_1[ch] = normValue_0_1;
whismanoid 35:c9549b5c01de 6719 calibration_05_V[ch] = V;
whismanoid 35:c9549b5c01de 6720 }
whismanoid 35:c9549b5c01de 6721 }
whismanoid 35:c9549b5c01de 6722 }
whismanoid 38:fda80a0020d1 6723 // make sure calibration_05_normValue_0_1[ch] < calibration_95_normValue_0_1[ch]
whismanoid 38:fda80a0020d1 6724 if (calibration_05_normValue_0_1[ch] > calibration_95_normValue_0_1[ch])
whismanoid 38:fda80a0020d1 6725 {
whismanoid 38:fda80a0020d1 6726 // swap to make sure calibration_05_normValue_0_1[ch] < calibration_95_normValue_0_1[ch]
whismanoid 38:fda80a0020d1 6727 double n05 = calibration_95_normValue_0_1[ch];
whismanoid 38:fda80a0020d1 6728 double V05 = calibration_95_V[ch];
whismanoid 38:fda80a0020d1 6729 double n95 = calibration_05_normValue_0_1[ch];
whismanoid 38:fda80a0020d1 6730 double V95 = calibration_05_V[ch];
whismanoid 38:fda80a0020d1 6731 calibration_05_normValue_0_1[ch] = n05;
whismanoid 38:fda80a0020d1 6732 calibration_05_V[ch] = V05;
whismanoid 38:fda80a0020d1 6733 calibration_95_normValue_0_1[ch] = n95;
whismanoid 38:fda80a0020d1 6734 calibration_95_V[ch] = V95;
whismanoid 38:fda80a0020d1 6735 }
whismanoid 34:a1993a1ee904 6736 } // end for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6737 }
whismanoid 34:a1993a1ee904 6738 #endif // HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6739 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6740 // %A cal0test=0.5 test calibration functions by calculating the calibrated voltage of specified normValue_0_1
whismanoid 34:a1993a1ee904 6741 // double CalibratedNormValue(int channel_0_5, double raw_normValue_0_1);
whismanoid 34:a1993a1ee904 6742 for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6743 {
whismanoid 34:a1993a1ee904 6744 static char key_cal0test[12] = "cal0test__";
whismanoid 34:a1993a1ee904 6745 sprintf(key_cal0test, "cal%1dtest", ch);
whismanoid 34:a1993a1ee904 6746 double normValue_0_1, Vtest;
whismanoid 34:a1993a1ee904 6747 if (cmdLine.parse_double(key_cal0test, Vtest))
whismanoid 34:a1993a1ee904 6748 {
whismanoid 34:a1993a1ee904 6749 // divide Vtest/adc_full_scale_voltage[0] to get normValue_0_1
whismanoid 34:a1993a1ee904 6750 normValue_0_1 = Vtest/adc_full_scale_voltage[ch];
whismanoid 34:a1993a1ee904 6751 //
whismanoid 34:a1993a1ee904 6752 cmdLine.serial().printf(" CalibratedNormValue(%d, %1.6f) = %1.6f = %1.6fV\r\n",
whismanoid 34:a1993a1ee904 6753 ch,
whismanoid 34:a1993a1ee904 6754 normValue_0_1,
whismanoid 34:a1993a1ee904 6755 CalibratedNormValue(ch, normValue_0_1),
whismanoid 34:a1993a1ee904 6756 (CalibratedNormValue(ch, normValue_0_1) * adc_full_scale_voltage[ch])
whismanoid 34:a1993a1ee904 6757 );
whismanoid 34:a1993a1ee904 6758 //
whismanoid 34:a1993a1ee904 6759 // sweep CalibratedNormValue argument
whismanoid 34:a1993a1ee904 6760 double normValue_0_1_start = -0.05;
whismanoid 34:a1993a1ee904 6761 double normValue_0_1_step = 0.05;
whismanoid 34:a1993a1ee904 6762 double normValue_0_1_end = 1.07;
whismanoid 34:a1993a1ee904 6763 for (normValue_0_1 = normValue_0_1_start;
whismanoid 34:a1993a1ee904 6764 normValue_0_1 <= normValue_0_1_end;
whismanoid 34:a1993a1ee904 6765 normValue_0_1 = normValue_0_1 + normValue_0_1_step)
whismanoid 34:a1993a1ee904 6766 {
whismanoid 34:a1993a1ee904 6767 cmdLine.serial().printf(" CalibratedNormValue(%d, %1.6f) = %1.6f = %1.6fV\r\n",
whismanoid 34:a1993a1ee904 6768 ch,
whismanoid 34:a1993a1ee904 6769 normValue_0_1,
whismanoid 34:a1993a1ee904 6770 CalibratedNormValue(ch, normValue_0_1),
whismanoid 34:a1993a1ee904 6771 (CalibratedNormValue(ch, normValue_0_1) * adc_full_scale_voltage[ch])
whismanoid 34:a1993a1ee904 6772 );
whismanoid 34:a1993a1ee904 6773 }
whismanoid 34:a1993a1ee904 6774 }
whismanoid 34:a1993a1ee904 6775 } // end for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6776 #endif // HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6777 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6778 // %A v0cal=1.000V -- calibrate channel against a known input voltage
whismanoid 34:a1993a1ee904 6779 // double calibration_05_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6780 // double calibration_05_V [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6781 // double calibration_95_normValue_0_1 [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6782 // double calibration_95_V [NUM_PLATFORM_ANALOG_IN_CHANNELS] = {0.0, ... }
whismanoid 34:a1993a1ee904 6783 for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6784 {
whismanoid 49:359a6b9df7c1 6785 // #350 MAX40108 %A vl#cal / vh#cal / v#copy=
whismanoid 49:359a6b9df7c1 6786 static char key_v0cal[10] = "v0cal__"; // v#cal=Vtest
whismanoid 49:359a6b9df7c1 6787 sprintf(key_v0cal, "v%1dcal", ch); // v#cal=Vtest
whismanoid 49:359a6b9df7c1 6788 static char key_vl0cal[10] = "vl0cal__"; // vl#cal=Vtest
whismanoid 49:359a6b9df7c1 6789 sprintf(key_vl0cal, "vl%1dcal", ch); // vl#cal=Vtest
whismanoid 49:359a6b9df7c1 6790 static char key_vh0cal[10] = "vh0cal__"; // vh#cal=Vtest
whismanoid 49:359a6b9df7c1 6791 sprintf(key_vh0cal, "vh%1dcal", ch); // vh#cal=Vtest
whismanoid 49:359a6b9df7c1 6792 static char key_v0copy[10] = "v0copy__"; // v#copy=srcChannel
whismanoid 49:359a6b9df7c1 6793 sprintf(key_v0copy, "v%1dcopy", ch); // v#copy=srcChannel
whismanoid 34:a1993a1ee904 6794 double Vtest;
whismanoid 49:359a6b9df7c1 6795 int srcChannel = 0;
whismanoid 49:359a6b9df7c1 6796 char calibration_command = '\0';
whismanoid 34:a1993a1ee904 6797 if (cmdLine.parse_double(key_v0cal, Vtest))
whismanoid 34:a1993a1ee904 6798 {
whismanoid 49:359a6b9df7c1 6799 // v#cal=Vtest: update calibration_05 or calibration_95
whismanoid 49:359a6b9df7c1 6800 calibration_command = 'V';
whismanoid 49:359a6b9df7c1 6801 }
whismanoid 49:359a6b9df7c1 6802 else if (cmdLine.parse_double(key_vl0cal, Vtest))
whismanoid 49:359a6b9df7c1 6803 {
whismanoid 49:359a6b9df7c1 6804 // vl#cal=Vtest: update calibration_05
whismanoid 49:359a6b9df7c1 6805 calibration_command = 'L';
whismanoid 49:359a6b9df7c1 6806 }
whismanoid 49:359a6b9df7c1 6807 else if (cmdLine.parse_double(key_vh0cal, Vtest))
whismanoid 49:359a6b9df7c1 6808 {
whismanoid 49:359a6b9df7c1 6809 // vh#cal=Vtest: update calibration_95
whismanoid 49:359a6b9df7c1 6810 calibration_command = 'H';
whismanoid 49:359a6b9df7c1 6811 }
whismanoid 49:359a6b9df7c1 6812 else if (cmdLine.parse_int_dec(key_v0copy, srcChannel))
whismanoid 49:359a6b9df7c1 6813 {
whismanoid 49:359a6b9df7c1 6814 // v#copy=srcChannel
whismanoid 49:359a6b9df7c1 6815 // update calibration_05 and calibration_95 from other channel
whismanoid 49:359a6b9df7c1 6816 calibration_command = '\0';
whismanoid 49:359a6b9df7c1 6817 calibration_05_normValue_0_1[ch] = calibration_05_normValue_0_1[srcChannel];
whismanoid 49:359a6b9df7c1 6818 calibration_05_V[ch] = calibration_05_V[srcChannel];
whismanoid 49:359a6b9df7c1 6819 calibration_95_normValue_0_1[ch] = calibration_95_normValue_0_1[srcChannel];
whismanoid 49:359a6b9df7c1 6820 calibration_95_V[ch] = calibration_95_V[srcChannel];
whismanoid 49:359a6b9df7c1 6821 // print updated calibration values
whismanoid 49:359a6b9df7c1 6822 cmdLine.serial().printf("\r\n");
whismanoid 52:bb09c0f452ec 6823 // %A cl0n= cl0v= ch0n= ch0v= -- unambiguous low and high cal points alternative to cal0n= cal0v= cal0n= cal0v= #354
whismanoid 52:bb09c0f452ec 6824 //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 6825 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 6826 ch, calibration_05_normValue_0_1[ch],
whismanoid 49:359a6b9df7c1 6827 ch, calibration_05_V[ch],
whismanoid 49:359a6b9df7c1 6828 ch, calibration_95_normValue_0_1[ch],
whismanoid 49:359a6b9df7c1 6829 ch, calibration_95_V[ch]
whismanoid 49:359a6b9df7c1 6830 );
whismanoid 49:359a6b9df7c1 6831 }
whismanoid 49:359a6b9df7c1 6832 if (calibration_command != '\0')
whismanoid 49:359a6b9df7c1 6833 {
whismanoid 34:a1993a1ee904 6834 // divide Vtest/adc_full_scale_voltage[0] to get normValue_0_1
whismanoid 34:a1993a1ee904 6835 double Vtest_normValue_0_1 = Vtest/adc_full_scale_voltage[ch];
whismanoid 34:a1993a1ee904 6836 //
whismanoid 34:a1993a1ee904 6837 // %A v0cal=1.000 calibrate one channel by measuring against a known input voltage
whismanoid 34:a1993a1ee904 6838 //
whismanoid 34:a1993a1ee904 6839 cmdLine.serial().printf("\r\n Measuring against input voltage of %1.6fV...", Vtest);
whismanoid 37:3f369235e5bc 6840 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 6841 const int numberOfMeasurements = 16 * Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 6842 #else // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 6843 const int numberOfMeasurements = 16;
whismanoid 37:3f369235e5bc 6844 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 6845 double Sx_measure_normValue_0_1 = 0; // sum of values
whismanoid 34:a1993a1ee904 6846 double Sxx_measure_normValue_0_1 = 0; // sum of the squares of the values
whismanoid 34:a1993a1ee904 6847 for (int count = 0; count < numberOfMeasurements; count++)
whismanoid 34:a1993a1ee904 6848 {
whismanoid 34:a1993a1ee904 6849 double measure_normValue_0_1;
whismanoid 34:a1993a1ee904 6850 switch(ch)
whismanoid 34:a1993a1ee904 6851 {
whismanoid 34:a1993a1ee904 6852 case 0: measure_normValue_0_1 = analogIn0.read(); break;
whismanoid 34:a1993a1ee904 6853 case 1: measure_normValue_0_1 = analogIn1.read(); break;
whismanoid 34:a1993a1ee904 6854 case 2: measure_normValue_0_1 = analogIn2.read(); break;
whismanoid 34:a1993a1ee904 6855 case 3: measure_normValue_0_1 = analogIn3.read(); break;
whismanoid 34:a1993a1ee904 6856 case 4: measure_normValue_0_1 = analogIn4.read(); break;
whismanoid 34:a1993a1ee904 6857 case 5: measure_normValue_0_1 = analogIn5.read(); break;
whismanoid 34:a1993a1ee904 6858 }
whismanoid 34:a1993a1ee904 6859 Sx_measure_normValue_0_1 = Sx_measure_normValue_0_1 + measure_normValue_0_1;
whismanoid 34:a1993a1ee904 6860 Sxx_measure_normValue_0_1 = Sxx_measure_normValue_0_1 + (measure_normValue_0_1 * measure_normValue_0_1);
whismanoid 38:fda80a0020d1 6861 if ((count < 3) || (count >= numberOfMeasurements - 3)) {
whismanoid 38:fda80a0020d1 6862 cmdLine.serial().printf("\r\n raw: %7.6f%% = %1.6fV",
whismanoid 38:fda80a0020d1 6863 measure_normValue_0_1 * 100.0,
whismanoid 38:fda80a0020d1 6864 (measure_normValue_0_1 * adc_full_scale_voltage[ch])
whismanoid 38:fda80a0020d1 6865 );
whismanoid 38:fda80a0020d1 6866 }
whismanoid 34:a1993a1ee904 6867 }
whismanoid 34:a1993a1ee904 6868 cmdLine.serial().printf("\r\n numberOfMeasurements = %d", numberOfMeasurements);
whismanoid 34:a1993a1ee904 6869 cmdLine.serial().printf("\r\n Sx_measure_normValue_0_1 = %1.6f", Sx_measure_normValue_0_1);
whismanoid 34:a1993a1ee904 6870 cmdLine.serial().printf("\r\n Sxx_measure_normValue_0_1 = %1.6f", Sxx_measure_normValue_0_1);
whismanoid 34:a1993a1ee904 6871 //
whismanoid 34:a1993a1ee904 6872 // calculate mean_measure_normValue_0_1 from
whismanoid 34:a1993a1ee904 6873 // Sxx_measure_normValue_0_1, Sx_measure_normValue_0_1, numberOfMeasurements
whismanoid 34:a1993a1ee904 6874 double mean_measure_normValue_0_1 = Sx_measure_normValue_0_1 / numberOfMeasurements;
whismanoid 34:a1993a1ee904 6875 cmdLine.serial().printf("\r\n mean = %7.6f%% = %1.6fV",
whismanoid 34:a1993a1ee904 6876 mean_measure_normValue_0_1 * 100.0,
whismanoid 34:a1993a1ee904 6877 (mean_measure_normValue_0_1 * adc_full_scale_voltage[ch])
whismanoid 34:a1993a1ee904 6878 );
whismanoid 34:a1993a1ee904 6879 //
whismanoid 34:a1993a1ee904 6880 // TODO: calculate sample variance_measure_normValue_0_1 from
whismanoid 34:a1993a1ee904 6881 // Sxx_measure_normValue_0_1, Sx_measure_normValue_0_1, numberOfMeasurements
whismanoid 34:a1993a1ee904 6882 // variance_measure_normValue_0_1 = (Sxx - ( Sx * Sx / nWords) ) / (nWords - 1);
whismanoid 34:a1993a1ee904 6883 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 6884 cmdLine.serial().printf("\r\n variance = %7.6f%% = %1.6fV",
whismanoid 34:a1993a1ee904 6885 variance_measure_normValue_0_1 * 100.0,
whismanoid 34:a1993a1ee904 6886 (variance_measure_normValue_0_1 * adc_full_scale_voltage[ch])
whismanoid 34:a1993a1ee904 6887 );
whismanoid 34:a1993a1ee904 6888 //
whismanoid 34:a1993a1ee904 6889 // calculate sample stddev_measure_normValue_0_1 from
whismanoid 34:a1993a1ee904 6890 // Sxx_measure_normValue_0_1, Sx_measure_normValue_0_1, numberOfMeasurements
whismanoid 34:a1993a1ee904 6891 double stddev_measure_normValue_0_1 = sqrt(variance_measure_normValue_0_1);
whismanoid 34:a1993a1ee904 6892 cmdLine.serial().printf("\r\n stddev = %7.6f%% = %1.6fV",
whismanoid 34:a1993a1ee904 6893 stddev_measure_normValue_0_1 * 100.0,
whismanoid 34:a1993a1ee904 6894 (stddev_measure_normValue_0_1 * adc_full_scale_voltage[ch])
whismanoid 34:a1993a1ee904 6895 );
whismanoid 34:a1993a1ee904 6896 //
whismanoid 34:a1993a1ee904 6897 // Validate the measurements:
whismanoid 34:a1993a1ee904 6898 // is the mean near the expected value?
whismanoid 34:a1993a1ee904 6899 // is the standard deviation not too high?
whismanoid 34:a1993a1ee904 6900 bool isCalibrationValid = true;
whismanoid 34:a1993a1ee904 6901 if ((Vtest_normValue_0_1 - mean_measure_normValue_0_1) > 0.1) {
whismanoid 34:a1993a1ee904 6902 isCalibrationValid = false;
whismanoid 34:a1993a1ee904 6903 cmdLine.serial().printf(" mean value too far from expected.\r\n");
whismanoid 34:a1993a1ee904 6904 }
whismanoid 34:a1993a1ee904 6905 if ((Vtest_normValue_0_1 - mean_measure_normValue_0_1) < -0.1) {
whismanoid 34:a1993a1ee904 6906 isCalibrationValid = false;
whismanoid 34:a1993a1ee904 6907 cmdLine.serial().printf(" mean value too far from expected.\r\n");
whismanoid 34:a1993a1ee904 6908 }
whismanoid 34:a1993a1ee904 6909 if ((stddev_measure_normValue_0_1) > 10) {
whismanoid 34:a1993a1ee904 6910 isCalibrationValid = false;
whismanoid 34:a1993a1ee904 6911 cmdLine.serial().printf(" stddev too high.\r\n");
whismanoid 34:a1993a1ee904 6912 }
whismanoid 34:a1993a1ee904 6913 if (isCalibrationValid)
whismanoid 34:a1993a1ee904 6914 {
whismanoid 34:a1993a1ee904 6915 // update calibration point (mean_measure_normValue_0_1, Vtest)
whismanoid 49:359a6b9df7c1 6916 // #350 MAX40108 %A vl#cal / vh#cal / v#copy=
whismanoid 49:359a6b9df7c1 6917 switch(calibration_command)
whismanoid 49:359a6b9df7c1 6918 {
whismanoid 49:359a6b9df7c1 6919 case 'V': // v#cal=Vtest: update calibration_05 or calibration_95
whismanoid 49:359a6b9df7c1 6920 if (Vtest_normValue_0_1 < 0.5) {
whismanoid 49:359a6b9df7c1 6921 calibration_05_normValue_0_1[ch] = mean_measure_normValue_0_1;
whismanoid 49:359a6b9df7c1 6922 calibration_05_V[ch] = Vtest;
whismanoid 49:359a6b9df7c1 6923 } else {
whismanoid 49:359a6b9df7c1 6924 calibration_95_normValue_0_1[ch] = mean_measure_normValue_0_1;
whismanoid 49:359a6b9df7c1 6925 calibration_95_V[ch] = Vtest;
whismanoid 49:359a6b9df7c1 6926 }
whismanoid 49:359a6b9df7c1 6927 break;
whismanoid 49:359a6b9df7c1 6928 case 'L': // vl#cal=Vtest: update calibration_05
whismanoid 49:359a6b9df7c1 6929 calibration_05_normValue_0_1[ch] = mean_measure_normValue_0_1;
whismanoid 49:359a6b9df7c1 6930 calibration_05_V[ch] = Vtest;
whismanoid 49:359a6b9df7c1 6931 break;
whismanoid 49:359a6b9df7c1 6932 case 'H': // vh#cal=Vtest: update calibration_95
whismanoid 49:359a6b9df7c1 6933 calibration_95_normValue_0_1[ch] = mean_measure_normValue_0_1;
whismanoid 49:359a6b9df7c1 6934 calibration_95_V[ch] = Vtest;
whismanoid 49:359a6b9df7c1 6935 break;
whismanoid 34:a1993a1ee904 6936 }
whismanoid 34:a1993a1ee904 6937 //
whismanoid 34:a1993a1ee904 6938 // print updated calibration values
whismanoid 34:a1993a1ee904 6939 cmdLine.serial().printf("\r\n");
whismanoid 52:bb09c0f452ec 6940 // %A cl0n= cl0v= ch0n= ch0v= -- unambiguous low and high cal points alternative to cal0n= cal0v= cal0n= cal0v= #354
whismanoid 52:bb09c0f452ec 6941 //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 6942 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 6943 ch, calibration_05_normValue_0_1[ch],
whismanoid 34:a1993a1ee904 6944 ch, calibration_05_V[ch],
whismanoid 34:a1993a1ee904 6945 ch, calibration_95_normValue_0_1[ch],
whismanoid 34:a1993a1ee904 6946 ch, calibration_95_V[ch]
whismanoid 34:a1993a1ee904 6947 );
whismanoid 34:a1993a1ee904 6948 // print corrected value of mean of measurements (should be close to Vtest)
whismanoid 34:a1993a1ee904 6949 cmdLine.serial().printf(" CalibratedNormValue(%d, %1.6f) = %1.6f = %1.6fV vs %1.6fV\r\n",
whismanoid 34:a1993a1ee904 6950 ch,
whismanoid 34:a1993a1ee904 6951 mean_measure_normValue_0_1,
whismanoid 34:a1993a1ee904 6952 CalibratedNormValue(ch, mean_measure_normValue_0_1),
whismanoid 34:a1993a1ee904 6953 (CalibratedNormValue(ch, mean_measure_normValue_0_1) * adc_full_scale_voltage[ch]),
whismanoid 34:a1993a1ee904 6954 Vtest
whismanoid 34:a1993a1ee904 6955 );
whismanoid 34:a1993a1ee904 6956 } // end if (isCalibrationValid)
whismanoid 34:a1993a1ee904 6957 else {
whismanoid 34:a1993a1ee904 6958 cmdLine.serial().printf("\r\n");
whismanoid 34:a1993a1ee904 6959 cmdLine.serial().printf(" Measurement Error: Calibration will not be updated.\r\n");
whismanoid 34:a1993a1ee904 6960 } // end if (isCalibrationValid)
whismanoid 34:a1993a1ee904 6961 } // end if key_v0cal
whismanoid 34:a1993a1ee904 6962 } // end for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 34:a1993a1ee904 6963 #endif // HAS_Platform_AIN_Calibration
whismanoid 37:3f369235e5bc 6964 // %A -- report analog input voltages
whismanoid 37:3f369235e5bc 6965 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 6966 // #if USE_Platform_AIN_Average -- for (i=0; i<Platform_AIN_Average_N; i++) -- analogInPin.read()
whismanoid 37:3f369235e5bc 6967 #endif // USE_Platform_AIN_Average
whismanoid 15:37c83ec50ea0 6968 #if analogIn4_IS_HIGH_RANGE_OF_analogIn0
whismanoid 15:37c83ec50ea0 6969 // Platform board uses AIN4,AIN5,.. as high range of AIN0,AIN1,..
whismanoid 15:37c83ec50ea0 6970 for (int pinIndex = 0; pinIndex < 2; pinIndex++)
whismanoid 15:37c83ec50ea0 6971 {
whismanoid 15:37c83ec50ea0 6972 int cPinIndex = '0' + pinIndex;
whismanoid 15:37c83ec50ea0 6973 AnalogIn& analogInPin = find_analogInPin(cPinIndex);
whismanoid 15:37c83ec50ea0 6974 float adc_full_scale_voltage = analogInPin_fullScaleVoltage[pinIndex];
whismanoid 37:3f369235e5bc 6975 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 6976 // #if USE_Platform_AIN_Average -- for (i=0; i<Platform_AIN_Average_N; i++) -- analogInPin.read()
whismanoid 37:3f369235e5bc 6977 // float normValue_0_1 = analogInPin.read(); but mean of Platform_AIN_Average_N samples
whismanoid 37:3f369235e5bc 6978 float normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 6979 for (int i = 0; i < Platform_AIN_Average_N; i++) {
whismanoid 37:3f369235e5bc 6980 normValue_0_1 = normValue_0_1 + analogInPin.read();
whismanoid 37:3f369235e5bc 6981 }
whismanoid 37:3f369235e5bc 6982 normValue_0_1 = normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 6983 #else // USE_Platform_AIN_Average
whismanoid 15:37c83ec50ea0 6984 float normValue_0_1 = analogInPin.read();
whismanoid 37:3f369235e5bc 6985 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 6986 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 6987 // apply calibration to normValue_0_1 value
whismanoid 34:a1993a1ee904 6988 normValue_0_1 = CalibratedNormValue(pinIndex, normValue_0_1);
whismanoid 34:a1993a1ee904 6989 #endif // HAS_Platform_AIN_Calibration
whismanoid 15:37c83ec50ea0 6990 //
whismanoid 15:37c83ec50ea0 6991 int pinIndexH = pinIndex + 4;
whismanoid 15:37c83ec50ea0 6992 int cPinIndexH = '0' + pinIndexH;
whismanoid 15:37c83ec50ea0 6993 AnalogIn& analogInPinH = find_analogInPin(cPinIndexH);
whismanoid 15:37c83ec50ea0 6994 float adc_full_scale_voltageH = analogInPin_fullScaleVoltage[pinIndexH];
whismanoid 37:3f369235e5bc 6995 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 6996 // #if USE_Platform_AIN_Average -- for (i=0; i<Platform_AIN_Average_N; i++) -- analogInPin.read()
whismanoid 37:3f369235e5bc 6997 // float normValueH_0_1 = analogInPinH.read(); but mean of Platform_AIN_Average_N samples
whismanoid 37:3f369235e5bc 6998 float normValueH_0_1 = 0;
whismanoid 37:3f369235e5bc 6999 for (int i = 0; i < Platform_AIN_Average_N; i++) {
whismanoid 37:3f369235e5bc 7000 normValueH_0_1 = normValueH_0_1 + analogInPinH.read();
whismanoid 37:3f369235e5bc 7001 }
whismanoid 37:3f369235e5bc 7002 normValueH_0_1 = normValueH_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 7003 #else // USE_Platform_AIN_Average
whismanoid 15:37c83ec50ea0 7004 float normValueH_0_1 = analogInPinH.read();
whismanoid 37:3f369235e5bc 7005 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 7006 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 7007 // apply calibration to normValue_0_1 value
whismanoid 34:a1993a1ee904 7008 normValueH_0_1 = CalibratedNormValue(pinIndex, normValueH_0_1);
whismanoid 34:a1993a1ee904 7009 #endif // HAS_Platform_AIN_Calibration
whismanoid 15:37c83ec50ea0 7010 //
whismanoid 37:3f369235e5bc 7011 cmdLine.serial().printf("A%c = %7.3f%% = %1.3fV high range A%c = %7.3f%% = %1.3fV \r\n",
whismanoid 15:37c83ec50ea0 7012 cPinIndex,
whismanoid 15:37c83ec50ea0 7013 normValue_0_1 * 100.0,
whismanoid 15:37c83ec50ea0 7014 normValue_0_1 * adc_full_scale_voltage,
whismanoid 15:37c83ec50ea0 7015 cPinIndexH,
whismanoid 15:37c83ec50ea0 7016 normValueH_0_1 * 100.0,
whismanoid 15:37c83ec50ea0 7017 normValueH_0_1 * adc_full_scale_voltageH
whismanoid 15:37c83ec50ea0 7018 );
whismanoid 15:37c83ec50ea0 7019 }
whismanoid 15:37c83ec50ea0 7020 for (int pinIndex = 2; pinIndex < 4; pinIndex++)
whismanoid 15:37c83ec50ea0 7021 {
whismanoid 15:37c83ec50ea0 7022 int cPinIndex = '0' + pinIndex;
whismanoid 15:37c83ec50ea0 7023 AnalogIn& analogInPin = find_analogInPin(cPinIndex);
whismanoid 15:37c83ec50ea0 7024 float adc_full_scale_voltage = analogInPin_fullScaleVoltage[pinIndex];
whismanoid 37:3f369235e5bc 7025 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 7026 // #if USE_Platform_AIN_Average -- for (i=0; i<Platform_AIN_Average_N; i++) -- analogInPin.read()
whismanoid 37:3f369235e5bc 7027 // float normValue_0_1 = analogInPin.read(); but mean of Platform_AIN_Average_N samples
whismanoid 37:3f369235e5bc 7028 float normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 7029 for (int i = 0; i < Platform_AIN_Average_N; i++) {
whismanoid 37:3f369235e5bc 7030 normValue_0_1 = normValue_0_1 + analogInPin.read();
whismanoid 37:3f369235e5bc 7031 }
whismanoid 37:3f369235e5bc 7032 normValue_0_1 = normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 7033 #else // USE_Platform_AIN_Average
whismanoid 15:37c83ec50ea0 7034 float normValue_0_1 = analogInPin.read();
whismanoid 37:3f369235e5bc 7035 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 7036 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 7037 // apply calibration to normValue_0_1 value
whismanoid 34:a1993a1ee904 7038 normValue_0_1 = CalibratedNormValue(pinIndex, normValue_0_1);
whismanoid 34:a1993a1ee904 7039 #endif // HAS_Platform_AIN_Calibration
whismanoid 15:37c83ec50ea0 7040 //
whismanoid 37:3f369235e5bc 7041 cmdLine.serial().printf("A%c = %7.3f%% = %1.3fV\r\n",
whismanoid 15:37c83ec50ea0 7042 cPinIndex,
whismanoid 15:37c83ec50ea0 7043 normValue_0_1 * 100.0,
whismanoid 15:37c83ec50ea0 7044 normValue_0_1 * adc_full_scale_voltage
whismanoid 15:37c83ec50ea0 7045 );
whismanoid 15:37c83ec50ea0 7046 }
whismanoid 15:37c83ec50ea0 7047 #else // analogIn4_IS_HIGH_RANGE_OF_analogIn0
whismanoid 15:37c83ec50ea0 7048 // Platform board uses simple analog inputs
whismanoid 15:37c83ec50ea0 7049 // assume standard Arduino analog inputs A0-A5
whismanoid 15:37c83ec50ea0 7050 for (int pinIndex = 0; pinIndex < 6; pinIndex++)
whismanoid 15:37c83ec50ea0 7051 {
whismanoid 15:37c83ec50ea0 7052 int cPinIndex = '0' + pinIndex;
whismanoid 15:37c83ec50ea0 7053 AnalogIn& analogInPin = find_analogInPin(cPinIndex);
whismanoid 15:37c83ec50ea0 7054 float adc_full_scale_voltage = analogInPin_fullScaleVoltage[pinIndex];
whismanoid 37:3f369235e5bc 7055 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 7056 // #if USE_Platform_AIN_Average -- for (i=0; i<Platform_AIN_Average_N; i++) -- analogInPin.read()
whismanoid 37:3f369235e5bc 7057 // float normValue_0_1 = analogInPin.read(); but mean of Platform_AIN_Average_N samples
whismanoid 37:3f369235e5bc 7058 float normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 7059 for (int i = 0; i < Platform_AIN_Average_N; i++) {
whismanoid 37:3f369235e5bc 7060 normValue_0_1 = normValue_0_1 + analogInPin.read();
whismanoid 37:3f369235e5bc 7061 }
whismanoid 37:3f369235e5bc 7062 normValue_0_1 = normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 7063 #else // USE_Platform_AIN_Average
whismanoid 15:37c83ec50ea0 7064 float normValue_0_1 = analogInPin.read();
whismanoid 37:3f369235e5bc 7065 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 7066 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 7067 // apply calibration to normValue_0_1 value
whismanoid 34:a1993a1ee904 7068 normValue_0_1 = CalibratedNormValue(pinIndex, normValue_0_1);
whismanoid 34:a1993a1ee904 7069 #endif // HAS_Platform_AIN_Calibration
whismanoid 15:37c83ec50ea0 7070 //
whismanoid 37:3f369235e5bc 7071 cmdLine.serial().printf("A%c = %7.3f%% = %1.3fV\r\n",
whismanoid 15:37c83ec50ea0 7072 cPinIndex,
whismanoid 15:37c83ec50ea0 7073 normValue_0_1 * 100.0,
whismanoid 15:37c83ec50ea0 7074 normValue_0_1 * adc_full_scale_voltage
whismanoid 15:37c83ec50ea0 7075 );
whismanoid 15:37c83ec50ea0 7076 }
whismanoid 15:37c83ec50ea0 7077 #endif // analogIn4_IS_HIGH_RANGE_OF_analogIn0
whismanoid 15:37c83ec50ea0 7078 }
whismanoid 15:37c83ec50ea0 7079 break;
whismanoid 15:37c83ec50ea0 7080 #endif
whismanoid 15:37c83ec50ea0 7081 //
whismanoid 15:37c83ec50ea0 7082 #if HAS_SPI2_MAX541
whismanoid 15:37c83ec50ea0 7083 case 'D': case 'd':
whismanoid 15:37c83ec50ea0 7084 {
whismanoid 15:37c83ec50ea0 7085 // %D -- DAC output MAX541 (SPI2) -- need cmdLine.parse_float(voltageV)
whismanoid 15:37c83ec50ea0 7086 // MAX541 max541(spi2_max541, spi2_max541_cs);
whismanoid 15:37c83ec50ea0 7087 float voltageV = max541.Get_Voltage();
whismanoid 15:37c83ec50ea0 7088 // if (cmdLine[2] == '+') {
whismanoid 15:37c83ec50ea0 7089 // // %D+
whismanoid 15:37c83ec50ea0 7090 // voltageV = voltageV * 1.25f;
whismanoid 15:37c83ec50ea0 7091 // if (voltageV >= max541.VRef) voltageV = max541.VRef;
whismanoid 15:37c83ec50ea0 7092 // SelfTest_MAX541_Voltage(cmdLine, max541, voltageV);
whismanoid 15:37c83ec50ea0 7093 // }
whismanoid 15:37c83ec50ea0 7094 // else if (cmdLine[2] == '-') {
whismanoid 15:37c83ec50ea0 7095 // // %D-
whismanoid 15:37c83ec50ea0 7096 // voltageV = voltageV * 0.75f;
whismanoid 15:37c83ec50ea0 7097 // if (voltageV < 0.1f) voltageV = 0.1f;
whismanoid 15:37c83ec50ea0 7098 // SelfTest_MAX541_Voltage(cmdLine, max541, voltageV);
whismanoid 15:37c83ec50ea0 7099 // }
whismanoid 15:37c83ec50ea0 7100 if (cmdLine.parse_float("V", voltageV))
whismanoid 15:37c83ec50ea0 7101 {
whismanoid 15:37c83ec50ea0 7102 // %D V=1.234 -- set voltage
whismanoid 15:37c83ec50ea0 7103 max541.Set_Voltage(voltageV);
whismanoid 15:37c83ec50ea0 7104 }
whismanoid 15:37c83ec50ea0 7105 else if (cmdLine.parse_float("TEST", voltageV))
whismanoid 15:37c83ec50ea0 7106 {
whismanoid 15:37c83ec50ea0 7107 // %D TEST=1.234 -- set voltage and compare with AIN0
whismanoid 15:37c83ec50ea0 7108 SelfTest_MAX541_Voltage(cmdLine, max541, voltageV);
whismanoid 15:37c83ec50ea0 7109 }
whismanoid 15:37c83ec50ea0 7110 else if (cmdLine.parse_float("CAL", voltageV))
whismanoid 15:37c83ec50ea0 7111 {
whismanoid 15:37c83ec50ea0 7112 // %D CAL=1.234 -- calibrate VRef and compare with AIN0
whismanoid 15:37c83ec50ea0 7113
whismanoid 15:37c83ec50ea0 7114 max541.Set_Code(0x8000); // we don't know the fullscale voltage yet, so set code to midscale
whismanoid 15:37c83ec50ea0 7115 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 7116 const int average_count = 100;
whismanoid 15:37c83ec50ea0 7117 const double average_K = 0.25;
whismanoid 15:37c83ec50ea0 7118 for (int count = 0; count < average_count; count++) {
whismanoid 15:37c83ec50ea0 7119 double measurement_V = analogInPin_fullScaleVoltage[4] * analogIn4.read(); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V
whismanoid 15:37c83ec50ea0 7120 max541_midscale_V = ((1 - average_K) * max541_midscale_V) + (average_K * measurement_V);
whismanoid 15:37c83ec50ea0 7121 }
whismanoid 15:37c83ec50ea0 7122 max541.VRef = 2.0 * max541_midscale_V;
whismanoid 15:37c83ec50ea0 7123 cmdLine.serial().printf(
whismanoid 15:37c83ec50ea0 7124 "\r\n MAX541 midscale = %1.3fV, so fullscale = %1.3fV",
whismanoid 15:37c83ec50ea0 7125 max541_midscale_V, max541.VRef);
whismanoid 15:37c83ec50ea0 7126 // Detect whether MAX541 is really connected to MAX32625MBED.AIN0/AIN4
whismanoid 15:37c83ec50ea0 7127 voltageV = 1.0f;
whismanoid 15:37c83ec50ea0 7128 SelfTest_MAX541_Voltage(cmdLine, max541, voltageV);
whismanoid 15:37c83ec50ea0 7129 }
whismanoid 15:37c83ec50ea0 7130 else {
whismanoid 15:37c83ec50ea0 7131 // %D -- print MAX541 DAC status
whismanoid 15:37c83ec50ea0 7132 cmdLine.serial().printf("MAX541 code=0x%4.4x = %1.3fV VRef=%1.3fV\r\n",
whismanoid 15:37c83ec50ea0 7133 max541.Get_Code(), max541.Get_Voltage(), max541.VRef);
whismanoid 15:37c83ec50ea0 7134 }
whismanoid 15:37c83ec50ea0 7135 }
whismanoid 15:37c83ec50ea0 7136 break;
whismanoid 15:37c83ec50ea0 7137 #endif
whismanoid 15:37c83ec50ea0 7138
whismanoid 15:37c83ec50ea0 7139 //
whismanoid 15:37c83ec50ea0 7140 #if HAS_I2C // SUPPORT_I2C
whismanoid 15:37c83ec50ea0 7141 case 'I': case 'i':
whismanoid 15:37c83ec50ea0 7142 // %I... -- I2C diagnostics
whismanoid 15:37c83ec50ea0 7143 // %IP -- I2C probe
whismanoid 15:37c83ec50ea0 7144 // %IC scl=100khz ADDR=? -- I2C configure
whismanoid 15:37c83ec50ea0 7145 // %IW byte byte ... byte RD=? ADDR=0x -- write
whismanoid 15:37c83ec50ea0 7146 // %IR ADDR=? RD=? -- read
whismanoid 15:37c83ec50ea0 7147 // %I^ cmd=? -- i2c_smbus_read_word_data
whismanoid 15:37c83ec50ea0 7148 // get next character
whismanoid 15:37c83ec50ea0 7149 // TODO: parse cmdLine arg (ADDR=\d+)? --> g_I2C_deviceAddress7
whismanoid 15:37c83ec50ea0 7150 cmdLine.parse_byte_hex("ADDR", g_I2C_deviceAddress7);
whismanoid 15:37c83ec50ea0 7151 // TODO: parse cmdLine arg (RD=\d)? --> g_I2C_read_count
whismanoid 15:37c83ec50ea0 7152 g_I2C_read_count = 0; // read count must be reset every command
whismanoid 15:37c83ec50ea0 7153 cmdLine.parse_byte_dec("RD", g_I2C_read_count);
whismanoid 15:37c83ec50ea0 7154 // TODO: parse cmdLine arg (CMD=\d)? --> g_I2C_command_regAddress
whismanoid 15:37c83ec50ea0 7155 cmdLine.parse_byte_hex("CMD", g_I2C_command_regAddress);
whismanoid 15:37c83ec50ea0 7156 switch (cmdLine[2])
whismanoid 15:37c83ec50ea0 7157 {
whismanoid 15:37c83ec50ea0 7158 case 'P': case 'p':
whismanoid 15:37c83ec50ea0 7159 {
whismanoid 15:37c83ec50ea0 7160 // %IP -- I2C probe
whismanoid 15:37c83ec50ea0 7161 HuntAttachedI2CDevices(cmdLine, 0x03, 0x77);
whismanoid 15:37c83ec50ea0 7162 }
whismanoid 15:37c83ec50ea0 7163 break;
whismanoid 15:37c83ec50ea0 7164 case 'C': case 'c':
whismanoid 15:37c83ec50ea0 7165 {
whismanoid 15:37c83ec50ea0 7166 bool isUpdatedI2CConfig = false;
whismanoid 15:37c83ec50ea0 7167 // %IC scl=100khz ADDR=? -- I2C configure
whismanoid 15:37c83ec50ea0 7168 // parse cmdLine arg (SCL=\d+(kHZ|MHZ)?)? --> g_I2C_SCL_Hz
whismanoid 15:37c83ec50ea0 7169 if (cmdLine.parse_frequency_Hz("SCL", g_I2C_SCL_Hz))
whismanoid 15:37c83ec50ea0 7170 {
whismanoid 15:37c83ec50ea0 7171 isUpdatedI2CConfig = true;
whismanoid 15:37c83ec50ea0 7172 // TODO1: validate g_I2C_SCL_Hz against system clock frequency F_CPU
whismanoid 15:37c83ec50ea0 7173 if (g_I2C_SCL_Hz > limit_max_I2C_SCL_Hz)
whismanoid 15:37c83ec50ea0 7174 {
whismanoid 15:37c83ec50ea0 7175 g_I2C_SCL_Hz = limit_max_I2C_SCL_Hz;
whismanoid 15:37c83ec50ea0 7176 }
whismanoid 15:37c83ec50ea0 7177 if (g_I2C_SCL_Hz < limit_min_I2C_SCL_Hz)
whismanoid 15:37c83ec50ea0 7178 {
whismanoid 15:37c83ec50ea0 7179 g_I2C_SCL_Hz = limit_min_I2C_SCL_Hz;
whismanoid 15:37c83ec50ea0 7180 }
whismanoid 15:37c83ec50ea0 7181 }
whismanoid 15:37c83ec50ea0 7182 if (isUpdatedI2CConfig)
whismanoid 15:37c83ec50ea0 7183 {
whismanoid 15:37c83ec50ea0 7184 // declare in narrower scope: MAX32625MBED I2C i2cMaster(...)
whismanoid 15:37c83ec50ea0 7185 I2C i2cMaster(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 15:37c83ec50ea0 7186 i2cMaster.frequency(g_I2C_SCL_Hz);
whismanoid 15:37c83ec50ea0 7187 i2cMaster.start();
whismanoid 15:37c83ec50ea0 7188 i2cMaster.stop();
whismanoid 15:37c83ec50ea0 7189 i2cMaster.frequency(g_I2C_SCL_Hz);
whismanoid 15:37c83ec50ea0 7190 cmdLine.serial().printf(
whismanoid 15:37c83ec50ea0 7191 "\r\n %%IC ADDR=0x%2.2x=(0x%2.2x>>1) SCL=%d=%1.3fkHz -- I2C config",
whismanoid 15:37c83ec50ea0 7192 g_I2C_deviceAddress7, (g_I2C_deviceAddress7 << 1), g_I2C_SCL_Hz,
whismanoid 15:37c83ec50ea0 7193 (g_I2C_SCL_Hz / 1000.));
whismanoid 15:37c83ec50ea0 7194 i2cMaster.start();
whismanoid 15:37c83ec50ea0 7195 i2cMaster.stop();
whismanoid 15:37c83ec50ea0 7196 }
whismanoid 15:37c83ec50ea0 7197 }
whismanoid 15:37c83ec50ea0 7198 break;
whismanoid 15:37c83ec50ea0 7199 case 'W': case 'w':
whismanoid 15:37c83ec50ea0 7200 {
whismanoid 15:37c83ec50ea0 7201 // declare in narrower scope: MAX32625MBED I2C i2cMaster(...)
whismanoid 15:37c83ec50ea0 7202 I2C i2cMaster(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 15:37c83ec50ea0 7203 i2cMaster.frequency(g_I2C_SCL_Hz);
whismanoid 15:37c83ec50ea0 7204 // %IW byte byte ... byte RD=? ADDR=0x -- write
whismanoid 15:37c83ec50ea0 7205 // parse cmdLine byte list --> int byteCount; int mosiData[MAX_SPI_BYTE_COUNT];
whismanoid 15:37c83ec50ea0 7206 #define MAX_I2C_BYTE_COUNT 32
whismanoid 15:37c83ec50ea0 7207 size_t byteCount = byteCount;
whismanoid 15:37c83ec50ea0 7208 static char mosiData[MAX_I2C_BYTE_COUNT];
whismanoid 15:37c83ec50ea0 7209 static char misoData[MAX_I2C_BYTE_COUNT];
whismanoid 15:37c83ec50ea0 7210 if (cmdLine.parse_byteCount_byteList_hex(byteCount, mosiData,
whismanoid 15:37c83ec50ea0 7211 MAX_I2C_BYTE_COUNT))
whismanoid 15:37c83ec50ea0 7212 {
whismanoid 15:37c83ec50ea0 7213 // hex dump mosiData[0..byteCount-1]
whismanoid 15:37c83ec50ea0 7214 cmdLine.serial().printf(
whismanoid 15:37c83ec50ea0 7215 "\r\nADDR=0x%2.2x=(0x%2.2x>>1) byteCount:%d RD=%d\r\nI2C MOSI->",
whismanoid 15:37c83ec50ea0 7216 g_I2C_deviceAddress7,
whismanoid 15:37c83ec50ea0 7217 (g_I2C_deviceAddress7 << 1), byteCount, g_I2C_read_count);
whismanoid 15:37c83ec50ea0 7218 for (unsigned int byteIndex = 0; byteIndex < byteCount; byteIndex++)
whismanoid 15:37c83ec50ea0 7219 {
whismanoid 15:37c83ec50ea0 7220 cmdLine.serial().printf(" 0x%2.2X", mosiData[byteIndex]);
whismanoid 15:37c83ec50ea0 7221 }
whismanoid 15:37c83ec50ea0 7222 //
whismanoid 15:37c83ec50ea0 7223 // TODO: i2c transfer
whismanoid 15:37c83ec50ea0 7224 //const int addr7bit = 0x48; // 7 bit I2C address
whismanoid 15:37c83ec50ea0 7225 //const int addr8bit = 0x48 << 1; // 8bit I2C address, 0x90
whismanoid 15:37c83ec50ea0 7226 // /* int */ i2cMaster.read (int addr8bit, char *data, int length, bool repeated=false) // Read from an I2C slave.
whismanoid 15:37c83ec50ea0 7227 // /* int */ i2cMaster.read (int ack) // Read a single byte from the I2C bus.
whismanoid 15:37c83ec50ea0 7228 // /* int */ i2cMaster.write (int addr8bit, const char *data, int length, bool repeated=false) // Write to an I2C slave.
whismanoid 15:37c83ec50ea0 7229 // /* int */ i2cMaster.write (int data) // Write single byte out on the I2C bus.
whismanoid 15:37c83ec50ea0 7230 // /* void */ i2cMaster.start (void) // Creates a start condition on the I2C bus.
whismanoid 15:37c83ec50ea0 7231 // /* void */ i2cMaster.stop (void) // Creates a stop condition on the I2C bus.
whismanoid 15:37c83ec50ea0 7232 // /* 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 7233 // /* void */ i2cMaster.abort_transfer () // Abort the ongoing I2C transfer. More...
whismanoid 15:37c83ec50ea0 7234 const int addr8bit = g_I2C_deviceAddress7 << 1; // 8bit I2C address, 0x90
whismanoid 15:37c83ec50ea0 7235 unsigned int misoLength = 0;
whismanoid 15:37c83ec50ea0 7236 bool repeated = (g_I2C_read_count > 0);
whismanoid 15:37c83ec50ea0 7237 //
whismanoid 15:37c83ec50ea0 7238 int writeStatus = i2cMaster.write (addr8bit, mosiData, byteCount, repeated);
whismanoid 15:37c83ec50ea0 7239 switch (writeStatus)
whismanoid 15:37c83ec50ea0 7240 {
whismanoid 15:37c83ec50ea0 7241 case 0: cmdLine.serial().printf(" ack "); break;
whismanoid 15:37c83ec50ea0 7242 case 1: cmdLine.serial().printf(" nack "); break;
whismanoid 15:37c83ec50ea0 7243 default: cmdLine.serial().printf(" {writeStatus 0x%2.2X} ",
whismanoid 15:37c83ec50ea0 7244 writeStatus);
whismanoid 15:37c83ec50ea0 7245 }
whismanoid 15:37c83ec50ea0 7246 if (repeated)
whismanoid 15:37c83ec50ea0 7247 {
whismanoid 15:37c83ec50ea0 7248 int readStatus =
whismanoid 15:37c83ec50ea0 7249 i2cMaster.read (addr8bit, misoData, g_I2C_read_count, false);
whismanoid 15:37c83ec50ea0 7250 switch (readStatus)
whismanoid 15:37c83ec50ea0 7251 {
whismanoid 15:37c83ec50ea0 7252 case 1: cmdLine.serial().printf(" nack "); break;
whismanoid 15:37c83ec50ea0 7253 case 0: cmdLine.serial().printf(" ack "); break;
whismanoid 15:37c83ec50ea0 7254 default: cmdLine.serial().printf(" {readStatus 0x%2.2X} ",
whismanoid 15:37c83ec50ea0 7255 readStatus);
whismanoid 15:37c83ec50ea0 7256 }
whismanoid 15:37c83ec50ea0 7257 }
whismanoid 15:37c83ec50ea0 7258 //
whismanoid 15:37c83ec50ea0 7259 if (misoLength > 0)
whismanoid 15:37c83ec50ea0 7260 {
whismanoid 15:37c83ec50ea0 7261 // hex dump misoData[0..byteCount-1]
whismanoid 15:37c83ec50ea0 7262 cmdLine.serial().printf(" MISO<-");
whismanoid 15:37c83ec50ea0 7263 for (unsigned int byteIndex = 0; byteIndex < g_I2C_read_count;
whismanoid 15:37c83ec50ea0 7264 byteIndex++)
whismanoid 15:37c83ec50ea0 7265 {
whismanoid 15:37c83ec50ea0 7266 cmdLine.serial().printf(" 0x%2.2X", misoData[byteIndex]);
whismanoid 15:37c83ec50ea0 7267 }
whismanoid 15:37c83ec50ea0 7268 }
whismanoid 15:37c83ec50ea0 7269 cmdLine.serial().printf(" ");
whismanoid 15:37c83ec50ea0 7270 }
whismanoid 15:37c83ec50ea0 7271 }
whismanoid 15:37c83ec50ea0 7272 break;
whismanoid 15:37c83ec50ea0 7273 case 'R': case 'r':
whismanoid 15:37c83ec50ea0 7274 {
whismanoid 15:37c83ec50ea0 7275 // declare in narrower scope: MAX32625MBED I2C i2cMaster(...)
whismanoid 15:37c83ec50ea0 7276 I2C i2cMaster(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 15:37c83ec50ea0 7277 i2cMaster.frequency(g_I2C_SCL_Hz);
whismanoid 15:37c83ec50ea0 7278 // %IR ADDR=? RD=? -- read
whismanoid 15:37c83ec50ea0 7279 // TODO: i2c transfer
whismanoid 15:37c83ec50ea0 7280 //const int addr7bit = 0x48; // 7 bit I2C address
whismanoid 15:37c83ec50ea0 7281 //const int addr8bit = 0x48 << 1; // 8bit I2C address, 0x90
whismanoid 15:37c83ec50ea0 7282 // /* int */ i2cMaster.read (int addr8bit, char *data, int length, bool repeated=false) // Read from an I2C slave.
whismanoid 15:37c83ec50ea0 7283 // /* int */ i2cMaster.read (int ack) // Read a single byte from the I2C bus.
whismanoid 15:37c83ec50ea0 7284 // /* int */ i2cMaster.write (int addr8bit, const char *data, int length, bool repeated=false) // Write to an I2C slave.
whismanoid 15:37c83ec50ea0 7285 // /* int */ i2cMaster.write (int data) // Write single byte out on the I2C bus.
whismanoid 15:37c83ec50ea0 7286 // /* void */ i2cMaster.start (void) // Creates a start condition on the I2C bus.
whismanoid 15:37c83ec50ea0 7287 // /* void */ i2cMaster.stop (void) // Creates a stop condition on the I2C bus.
whismanoid 15:37c83ec50ea0 7288 // /* 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 7289 // /* void */ i2cMaster.abort_transfer () // Abort the ongoing I2C transfer. More...
whismanoid 15:37c83ec50ea0 7290 }
whismanoid 15:37c83ec50ea0 7291 break;
whismanoid 15:37c83ec50ea0 7292 case '^':
whismanoid 15:37c83ec50ea0 7293 {
whismanoid 15:37c83ec50ea0 7294 // declare in narrower scope: MAX32625MBED I2C i2cMaster(...)
whismanoid 15:37c83ec50ea0 7295 I2C i2cMaster(I2C0_SDA, I2C0_SCL); // sda scl TARGET_MAX32635MBED: P1_6, P1_7 Arduino 10-pin header
whismanoid 15:37c83ec50ea0 7296 i2cMaster.frequency(g_I2C_SCL_Hz);
whismanoid 15:37c83ec50ea0 7297 // %I^ cmd=? -- i2c_smbus_read_word_data
whismanoid 15:37c83ec50ea0 7298 // TODO: i2c transfer
whismanoid 15:37c83ec50ea0 7299 //const int addr7bit = 0x48; // 7 bit I2C address
whismanoid 15:37c83ec50ea0 7300 //const int addr8bit = 0x48 << 1; // 8bit I2C address, 0x90
whismanoid 15:37c83ec50ea0 7301 // /* int */ i2cMaster.read (int addr8bit, char *data, int length, bool repeated=false) // Read from an I2C slave.
whismanoid 15:37c83ec50ea0 7302 // /* int */ i2cMaster.read (int ack) // Read a single byte from the I2C bus.
whismanoid 15:37c83ec50ea0 7303 // /* int */ i2cMaster.write (int addr8bit, const char *data, int length, bool repeated=false) // Write to an I2C slave.
whismanoid 15:37c83ec50ea0 7304 // /* int */ i2cMaster.write (int data) // Write single byte out on the I2C bus.
whismanoid 15:37c83ec50ea0 7305 // /* void */ i2cMaster.start (void) // Creates a start condition on the I2C bus.
whismanoid 15:37c83ec50ea0 7306 // /* void */ i2cMaster.stop (void) // Creates a stop condition on the I2C bus.
whismanoid 15:37c83ec50ea0 7307 // /* 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 7308 // /* void */ i2cMaster.abort_transfer () // Abort the ongoing I2C transfer. More...
whismanoid 15:37c83ec50ea0 7309 }
whismanoid 15:37c83ec50ea0 7310 break;
whismanoid 15:37c83ec50ea0 7311 } // switch(cmdLine[2])
whismanoid 15:37c83ec50ea0 7312 break;
whismanoid 15:37c83ec50ea0 7313 #endif
whismanoid 15:37c83ec50ea0 7314 //
whismanoid 15:37c83ec50ea0 7315 #if HAS_SPI // SUPPORT_SPI
whismanoid 15:37c83ec50ea0 7316 case 'S': case 's':
whismanoid 15:37c83ec50ea0 7317 {
whismanoid 15:37c83ec50ea0 7318 // %S... -- SPI diagnostics
whismanoid 15:37c83ec50ea0 7319 // %SC sclk=1Mhz -- SPI configure
whismanoid 15:37c83ec50ea0 7320 // %SW -- write (write and read)
whismanoid 15:37c83ec50ea0 7321 // %SR -- read (alias for %SW because SPI always write and read)
whismanoid 15:37c83ec50ea0 7322 //
whismanoid 15:37c83ec50ea0 7323 // Process arguments SCLK=\d+(kHZ|MHZ) CPOL=\d CPHA=\d
whismanoid 15:37c83ec50ea0 7324 bool isUpdatedSPIConfig = false;
whismanoid 15:37c83ec50ea0 7325 // parse cmdLine arg (CPOL=\d)? --> g_SPI_dataMode | SPI_MODE2
whismanoid 15:37c83ec50ea0 7326 // parse cmdLine arg (CPHA=\d)? --> g_SPI_dataMode | SPI_MODE1
whismanoid 15:37c83ec50ea0 7327 if (cmdLine.parse_flag("CPOL", g_SPI_dataMode, SPI_MODE2))
whismanoid 15:37c83ec50ea0 7328 {
whismanoid 15:37c83ec50ea0 7329 isUpdatedSPIConfig = true;
whismanoid 15:37c83ec50ea0 7330 }
whismanoid 15:37c83ec50ea0 7331 if (cmdLine.parse_flag("CPHA", g_SPI_dataMode, SPI_MODE1))
whismanoid 15:37c83ec50ea0 7332 {
whismanoid 15:37c83ec50ea0 7333 isUpdatedSPIConfig = true;
whismanoid 15:37c83ec50ea0 7334 }
whismanoid 15:37c83ec50ea0 7335 if (cmdLine.parse_flag("CS", g_SPI_cs_state, 1))
whismanoid 15:37c83ec50ea0 7336 {
whismanoid 15:37c83ec50ea0 7337 isUpdatedSPIConfig = true;
whismanoid 15:37c83ec50ea0 7338 }
whismanoid 15:37c83ec50ea0 7339 // parse cmdLine arg (SCLK=\d+(kHZ|MHZ)?)? --> g_SPI_SCLK_Hz
whismanoid 15:37c83ec50ea0 7340 if (cmdLine.parse_frequency_Hz("SCLK", g_SPI_SCLK_Hz))
whismanoid 15:37c83ec50ea0 7341 {
whismanoid 15:37c83ec50ea0 7342 isUpdatedSPIConfig = true;
whismanoid 15:37c83ec50ea0 7343 // TODO1: validate g_SPI_SCLK_Hz against system clock frequency F_CPU
whismanoid 15:37c83ec50ea0 7344 if (g_SPI_SCLK_Hz > limit_max_SPI_SCLK_Hz)
whismanoid 15:37c83ec50ea0 7345 {
whismanoid 15:37c83ec50ea0 7346 g_SPI_SCLK_Hz = limit_max_SPI_SCLK_Hz;
whismanoid 15:37c83ec50ea0 7347 }
whismanoid 15:37c83ec50ea0 7348 if (g_SPI_SCLK_Hz < limit_min_SPI_SCLK_Hz)
whismanoid 15:37c83ec50ea0 7349 {
whismanoid 15:37c83ec50ea0 7350 g_SPI_SCLK_Hz = limit_min_SPI_SCLK_Hz;
whismanoid 15:37c83ec50ea0 7351 }
whismanoid 15:37c83ec50ea0 7352 }
whismanoid 15:37c83ec50ea0 7353 // Update SPI configuration
whismanoid 15:37c83ec50ea0 7354 if (isUpdatedSPIConfig)
whismanoid 15:37c83ec50ea0 7355 {
whismanoid 15:37c83ec50ea0 7356 // %SC sclk=1Mhz -- SPI configure
whismanoid 15:37c83ec50ea0 7357 spi_cs = g_SPI_cs_state;
whismanoid 15:37c83ec50ea0 7358 spi.format(8,g_SPI_dataMode); // int bits_must_be_8, int mode=0_3 CPOL=0,CPHA=0
whismanoid 15:37c83ec50ea0 7359 #if APPLICATION_MAX5715
whismanoid 15:37c83ec50ea0 7360 g_MAX5715_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 15:37c83ec50ea0 7361 #elif APPLICATION_MAX11131
whismanoid 15:37c83ec50ea0 7362 g_MAX11131_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 15:37c83ec50ea0 7363 #elif APPLICATION_MAX5171
whismanoid 15:37c83ec50ea0 7364 g_MAX5171_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 15:37c83ec50ea0 7365 #elif APPLICATION_MAX11410
whismanoid 15:37c83ec50ea0 7366 g_MAX11410_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 15:37c83ec50ea0 7367 #elif APPLICATION_MAX12345
whismanoid 15:37c83ec50ea0 7368 g_MAX12345_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 15:37c83ec50ea0 7369 #else
whismanoid 15:37c83ec50ea0 7370 spi.frequency(g_SPI_SCLK_Hz); // int SCLK_Hz=1000000 = 1MHz (initial default)
whismanoid 15:37c83ec50ea0 7371 #endif
whismanoid 15:37c83ec50ea0 7372 //
whismanoid 15:37c83ec50ea0 7373 double ideal_divisor = ((double)SystemCoreClock) / g_SPI_SCLK_Hz;
whismanoid 15:37c83ec50ea0 7374 int actual_divisor = (int)(ideal_divisor + 0.0); // frequency divisor truncate
whismanoid 15:37c83ec50ea0 7375 double actual_SCLK_Hz = SystemCoreClock / actual_divisor;
whismanoid 15:37c83ec50ea0 7376 //
whismanoid 15:37c83ec50ea0 7377 // 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 7378 cmdLine.serial().printf(
whismanoid 15:37c83ec50ea0 7379 "\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 7380 ((g_SPI_dataMode & SPI_MODE2) ? 1 : 0),
whismanoid 15:37c83ec50ea0 7381 ((g_SPI_dataMode & SPI_MODE1) ? 1 : 0),
whismanoid 15:37c83ec50ea0 7382 g_SPI_cs_state,
whismanoid 15:37c83ec50ea0 7383 g_SPI_SCLK_Hz,
whismanoid 15:37c83ec50ea0 7384 (g_SPI_SCLK_Hz / 1000000.),
whismanoid 15:37c83ec50ea0 7385 ((double)(SystemCoreClock / 1000000.)),
whismanoid 15:37c83ec50ea0 7386 ideal_divisor,
whismanoid 15:37c83ec50ea0 7387 (actual_SCLK_Hz / 1000000.)
whismanoid 15:37c83ec50ea0 7388 );
whismanoid 15:37c83ec50ea0 7389 }
whismanoid 15:37c83ec50ea0 7390 // get next character
whismanoid 15:37c83ec50ea0 7391 switch (cmdLine[2])
whismanoid 15:37c83ec50ea0 7392 {
whismanoid 15:37c83ec50ea0 7393 case 'C': case 's':
whismanoid 15:37c83ec50ea0 7394 // %SC sclk=1Mhz -- SPI configure
whismanoid 15:37c83ec50ea0 7395 break;
whismanoid 15:37c83ec50ea0 7396 case 'D': case 'd':
whismanoid 15:37c83ec50ea0 7397 // %SD -- SPI diagnostic messages enable
whismanoid 15:37c83ec50ea0 7398 if (g_MAX5719_device.onSPIprint) {
whismanoid 15:37c83ec50ea0 7399 g_MAX5719_device.onSPIprint = NULL;
whismanoid 15:37c83ec50ea0 7400 // no g_MAX5719_device.loop_limit property; device_has_property(Device, 'loop_limit') != None is false
whismanoid 15:37c83ec50ea0 7401 }
whismanoid 15:37c83ec50ea0 7402 else {
whismanoid 15:37c83ec50ea0 7403 void onSPIprint_handler(size_t byteCount, uint8_t mosiData[], uint8_t misoData[]);
whismanoid 15:37c83ec50ea0 7404 g_MAX5719_device.onSPIprint = onSPIprint_handler;
whismanoid 15:37c83ec50ea0 7405 // no g_MAX5719_device.loop_limit property; device_has_property(Device, 'loop_limit') is false
whismanoid 15:37c83ec50ea0 7406 }
whismanoid 15:37c83ec50ea0 7407 break;
whismanoid 15:37c83ec50ea0 7408 case 'W': case 'R': case 'w': case 'r':
whismanoid 15:37c83ec50ea0 7409 {
whismanoid 15:37c83ec50ea0 7410 // %SW -- write (write and read)
whismanoid 15:37c83ec50ea0 7411 // %SR -- read (alias for %SW because SPI always write and read)
whismanoid 15:37c83ec50ea0 7412 // parse cmdLine byte list --> int byteCount; int mosiData[MAX_SPI_BYTE_COUNT];
whismanoid 15:37c83ec50ea0 7413 #define MAX_SPI_BYTE_COUNT 32
whismanoid 15:37c83ec50ea0 7414 size_t byteCount = byteCount;
whismanoid 15:37c83ec50ea0 7415 static char mosiData[MAX_SPI_BYTE_COUNT];
whismanoid 15:37c83ec50ea0 7416 static char misoData[MAX_SPI_BYTE_COUNT];
whismanoid 15:37c83ec50ea0 7417 if (cmdLine.parse_byteCount_byteList_hex(byteCount, mosiData,
whismanoid 15:37c83ec50ea0 7418 MAX_SPI_BYTE_COUNT))
whismanoid 15:37c83ec50ea0 7419 {
whismanoid 15:37c83ec50ea0 7420 // hex dump mosiData[0..byteCount-1]
whismanoid 15:37c83ec50ea0 7421 cmdLine.serial().printf("\r\nSPI");
whismanoid 15:37c83ec50ea0 7422 if (byteCount > 7) {
whismanoid 15:37c83ec50ea0 7423 cmdLine.serial().printf(" byteCount:%d", byteCount);
whismanoid 15:37c83ec50ea0 7424 }
whismanoid 15:37c83ec50ea0 7425 cmdLine.serial().printf(" MOSI->");
whismanoid 15:37c83ec50ea0 7426 for (unsigned int byteIndex = 0; byteIndex < byteCount; byteIndex++)
whismanoid 15:37c83ec50ea0 7427 {
whismanoid 15:37c83ec50ea0 7428 cmdLine.serial().printf(" 0x%2.2X", mosiData[byteIndex]);
whismanoid 15:37c83ec50ea0 7429 }
whismanoid 15:37c83ec50ea0 7430 spi_cs = 0;
whismanoid 15:37c83ec50ea0 7431 unsigned int numBytesTransferred =
whismanoid 15:37c83ec50ea0 7432 spi.write(mosiData, byteCount, misoData, byteCount);
whismanoid 15:37c83ec50ea0 7433 spi_cs = 1;
whismanoid 15:37c83ec50ea0 7434 // hex dump misoData[0..byteCount-1]
whismanoid 15:37c83ec50ea0 7435 cmdLine.serial().printf(" MISO<-");
whismanoid 15:37c83ec50ea0 7436 for (unsigned int byteIndex = 0; byteIndex < numBytesTransferred;
whismanoid 15:37c83ec50ea0 7437 byteIndex++)
whismanoid 15:37c83ec50ea0 7438 {
whismanoid 15:37c83ec50ea0 7439 cmdLine.serial().printf(" 0x%2.2X", misoData[byteIndex]);
whismanoid 15:37c83ec50ea0 7440 }
whismanoid 15:37c83ec50ea0 7441 cmdLine.serial().printf(" ");
whismanoid 15:37c83ec50ea0 7442 }
whismanoid 15:37c83ec50ea0 7443 }
whismanoid 15:37c83ec50ea0 7444 break;
whismanoid 15:37c83ec50ea0 7445 } // switch(cmdLine[2])
whismanoid 15:37c83ec50ea0 7446 } // case 'S': // %S... -- SPI diagnostics
whismanoid 15:37c83ec50ea0 7447 break;
whismanoid 15:37c83ec50ea0 7448 #endif
whismanoid 15:37c83ec50ea0 7449 //
whismanoid 15:37c83ec50ea0 7450 // A-Z,a-z,0-9 reserved for application use
whismanoid 15:37c83ec50ea0 7451 } // switch(cmdLine[1])
whismanoid 15:37c83ec50ea0 7452 } // end void pinsMonitor_submenu_onEOLcommandParser(CmdLine & cmdLine)
whismanoid 15:37c83ec50ea0 7453 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 15:37c83ec50ea0 7454
whismanoid 53:fdb510e3eb37 7455 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 53:fdb510e3eb37 7456 //--------------------------------------------------
whismanoid 53:fdb510e3eb37 7457 // argument parsing for L@ Datalogger_action_table
whismanoid 53:fdb510e3eb37 7458 int edit_action = (int)action_noop;
whismanoid 53:fdb510e3eb37 7459 int edit_digitalOutPin = 0;
whismanoid 53:fdb510e3eb37 7460 int edit_condition = (int)condition_always;
whismanoid 53:fdb510e3eb37 7461 int edit_condition_channel = 0;
whismanoid 53:fdb510e3eb37 7462 double edit_condition_threshold = 0;
whismanoid 53:fdb510e3eb37 7463 // argument parsing for L@ Datalogger_action_table
whismanoid 53:fdb510e3eb37 7464 void parse_action_table_args(CmdLine& cmdLine)
whismanoid 53:fdb510e3eb37 7465 {
whismanoid 53:fdb510e3eb37 7466 // parse_and_remove_key() aliases to make editing easier
whismanoid 53:fdb510e3eb37 7467 char valueBuf[16];
whismanoid 53:fdb510e3eb37 7468 //
whismanoid 53:fdb510e3eb37 7469 if (cmdLine.parse_int_dec("act", edit_action))
whismanoid 53:fdb510e3eb37 7470 {
whismanoid 53:fdb510e3eb37 7471 //~ cmdLine.serial().printf("\r\n act=%d", edit_action);
whismanoid 53:fdb510e3eb37 7472 }
whismanoid 53:fdb510e3eb37 7473 if (cmdLine.parse_int_dec("pin", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7474 {
whismanoid 53:fdb510e3eb37 7475 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7476 }
whismanoid 53:fdb510e3eb37 7477 if (cmdLine.parse_int_dec("if", edit_condition))
whismanoid 53:fdb510e3eb37 7478 {
whismanoid 53:fdb510e3eb37 7479 //~ cmdLine.serial().printf("\r\n if=%d", edit_condition);
whismanoid 53:fdb510e3eb37 7480 }
whismanoid 53:fdb510e3eb37 7481 if (cmdLine.parse_int_dec("ch", edit_condition_channel))
whismanoid 53:fdb510e3eb37 7482 {
whismanoid 53:fdb510e3eb37 7483 //~ cmdLine.serial().printf("\r\n ch=%d", edit_condition_channel);
whismanoid 53:fdb510e3eb37 7484 }
whismanoid 53:fdb510e3eb37 7485 if (cmdLine.parse_double("x", edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7486 {
whismanoid 53:fdb510e3eb37 7487 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7488 }
whismanoid 53:fdb510e3eb37 7489 //
whismanoid 53:fdb510e3eb37 7490 // "nop" key alias for act=0 -- action_noop = 0 // no operation
whismanoid 53:fdb510e3eb37 7491 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 53:fdb510e3eb37 7492 if (cmdLine.parse_and_remove_key("nop", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7493 {
whismanoid 53:fdb510e3eb37 7494 edit_action = (int)action_noop;
whismanoid 53:fdb510e3eb37 7495 }
whismanoid 53:fdb510e3eb37 7496 //
whismanoid 53:fdb510e3eb37 7497 // "always" key alias if=0 -- condition_always
whismanoid 53:fdb510e3eb37 7498 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 53:fdb510e3eb37 7499 if (cmdLine.parse_and_remove_key("always", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7500 {
whismanoid 53:fdb510e3eb37 7501 edit_condition = (int)condition_always;
whismanoid 53:fdb510e3eb37 7502 }
whismanoid 53:fdb510e3eb37 7503 //
whismanoid 53:fdb510e3eb37 7504 // "pinL=" alias for act=1 pin=_ -- action_digitalOutLow = 1 // pin = low if condition
whismanoid 53:fdb510e3eb37 7505 // note: this should be after "pin" argument
whismanoid 53:fdb510e3eb37 7506 if (cmdLine.parse_int_dec("pinL", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7507 {
whismanoid 53:fdb510e3eb37 7508 edit_action = (int)action_digitalOutLow;
whismanoid 53:fdb510e3eb37 7509 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7510 }
whismanoid 53:fdb510e3eb37 7511 if (cmdLine.parse_int_dec("Lpin", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7512 {
whismanoid 53:fdb510e3eb37 7513 edit_action = (int)action_digitalOutLow;
whismanoid 53:fdb510e3eb37 7514 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7515 }
whismanoid 53:fdb510e3eb37 7516 //
whismanoid 53:fdb510e3eb37 7517 // "pinH=" alias for act=2 pin=_ -- action_digitalOutHigh = 2 // pin = high if condition
whismanoid 53:fdb510e3eb37 7518 if (cmdLine.parse_int_dec("pinH", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7519 {
whismanoid 53:fdb510e3eb37 7520 edit_action = (int)action_digitalOutHigh;
whismanoid 53:fdb510e3eb37 7521 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7522 }
whismanoid 53:fdb510e3eb37 7523 if (cmdLine.parse_int_dec("Hpin", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7524 {
whismanoid 53:fdb510e3eb37 7525 edit_action = (int)action_digitalOutHigh;
whismanoid 53:fdb510e3eb37 7526 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7527 }
whismanoid 53:fdb510e3eb37 7528 //
whismanoid 53:fdb510e3eb37 7529 // "button=" alias for act=3 pin=_ -- action_button = 3 // pin = button event index 1, 2, 3
whismanoid 53:fdb510e3eb37 7530 if (cmdLine.parse_int_dec("button", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7531 {
whismanoid 53:fdb510e3eb37 7532 edit_action = (int)action_button;
whismanoid 53:fdb510e3eb37 7533 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7534 }
whismanoid 53:fdb510e3eb37 7535 if (cmdLine.parse_int_dec("btn", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7536 {
whismanoid 53:fdb510e3eb37 7537 edit_action = (int)action_button;
whismanoid 53:fdb510e3eb37 7538 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7539 }
whismanoid 53:fdb510e3eb37 7540 //
whismanoid 53:fdb510e3eb37 7541 // "LR" key alias for act=5 -- action_trigger_FreeRun = 5
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("run_LR", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7544 {
whismanoid 53:fdb510e3eb37 7545 edit_action = (int)action_trigger_FreeRun;
whismanoid 53:fdb510e3eb37 7546 }
whismanoid 53:fdb510e3eb37 7547 //
whismanoid 53:fdb510e3eb37 7548 // "LT" key alias for act=6 -- action_trigger_Timer = 6
whismanoid 53:fdb510e3eb37 7549 // this may conflict with lt as "less than"...
whismanoid 53:fdb510e3eb37 7550 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 53:fdb510e3eb37 7551 if (cmdLine.parse_and_remove_key("timer_LT", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7552 {
whismanoid 53:fdb510e3eb37 7553 edit_action = (int)action_trigger_Timer;
whismanoid 53:fdb510e3eb37 7554 }
whismanoid 53:fdb510e3eb37 7555 // "halt" key alias for act=4 -- action_trigger_Halt = 4
whismanoid 53:fdb510e3eb37 7556 // needs to be after key "LT"
whismanoid 53:fdb510e3eb37 7557 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 53:fdb510e3eb37 7558 if (cmdLine.parse_and_remove_key("Halt", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7559 {
whismanoid 53:fdb510e3eb37 7560 edit_action = (int)action_trigger_Halt;
whismanoid 53:fdb510e3eb37 7561 }
whismanoid 53:fdb510e3eb37 7562 if (cmdLine.parse_and_remove_key("halt", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7563 {
whismanoid 53:fdb510e3eb37 7564 edit_action = (int)action_trigger_Halt;
whismanoid 53:fdb510e3eb37 7565 }
whismanoid 53:fdb510e3eb37 7566 //
whismanoid 53:fdb510e3eb37 7567 // FUTURE: "__TBD__" alias for act=7 -- action_trigger_PlatformDigitalInput = 7
whismanoid 53:fdb510e3eb37 7568 if (cmdLine.parse_int_dec("pinIN", edit_digitalOutPin))
whismanoid 53:fdb510e3eb37 7569 {
whismanoid 53:fdb510e3eb37 7570 edit_action = (int)action_trigger_PlatformDigitalInput;
whismanoid 53:fdb510e3eb37 7571 //~ cmdLine.serial().printf("\r\n pin=%d", edit_digitalOutPin);
whismanoid 53:fdb510e3eb37 7572 }
whismanoid 53:fdb510e3eb37 7573 //
whismanoid 53:fdb510e3eb37 7574 // FUTURE: "__TBD__" alias for act=8 -- action_trigger_SPIDeviceRegRead = 8
whismanoid 53:fdb510e3eb37 7575 // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
whismanoid 53:fdb510e3eb37 7576 if (cmdLine.parse_and_remove_key("SPI", valueBuf, sizeof(valueBuf)))
whismanoid 53:fdb510e3eb37 7577 {
whismanoid 53:fdb510e3eb37 7578 edit_action = (int)action_trigger_SPIDeviceRegRead;
whismanoid 53:fdb510e3eb37 7579 }
whismanoid 53:fdb510e3eb37 7580 //
whismanoid 53:fdb510e3eb37 7581 // aliases for Platform_Voltage[channel] thresholds
whismanoid 53:fdb510e3eb37 7582 // loop through ch=$ 0..limit
whismanoid 53:fdb510e3eb37 7583 // "A0gtx=" alias for if=1 ch=$ x=_ -- condition_if_An_gt_threshold, // (Platform_Voltage[channel] > threhsold)
whismanoid 53:fdb510e3eb37 7584 // "A0ltx=" alias for if=2 ch=$ x=_ -- condition_if_An_lt_threshold, // (Platform_Voltage[channel] < threhsold)
whismanoid 53:fdb510e3eb37 7585 // "A0eqx=" alias for if=3 ch=$ x=_ -- condition_if_An_eq_threshold, // (Platform_Voltage[channel] == threhsold)
whismanoid 53:fdb510e3eb37 7586 // "A0gex=" alias for if=4 ch=$ x=_ -- condition_if_An_ge_threshold, // (Platform_Voltage[channel] >= threhsold)
whismanoid 53:fdb510e3eb37 7587 // "A0lex=" alias for if=5 ch=$ x=_ -- condition_if_An_le_threshold, // (Platform_Voltage[channel] <= threhsold)
whismanoid 53:fdb510e3eb37 7588 // "A0nex=" alias for if=6 ch=$ x=_ -- condition_if_An_ne_threshold, // (Platform_Voltage[channel] != threhsold)
whismanoid 53:fdb510e3eb37 7589 // "AIN0gtx=" alias for if=7 ch=$ x=_ -- condition_if_AINn_gt_threshold, // (SPI_AIN_Voltage[channel] > threhsold)
whismanoid 53:fdb510e3eb37 7590 // "AIN0ltx=" alias for if=8 ch=$ x=_ -- condition_if_AINn_lt_threshold, // (SPI_AIN_Voltage[channel] < threhsold)
whismanoid 53:fdb510e3eb37 7591 // "AIN0eqx=" alias for if=9 ch=$ x=_ -- condition_if_AINn_eq_threshold, // (SPI_AIN_Voltage[channel] == threhsold)
whismanoid 53:fdb510e3eb37 7592 // "AIN0gex=" alias for if=10 ch=$ x=_ -- condition_if_AINn_ge_threshold, // (SPI_AIN_Voltage[channel] >= threhsold)
whismanoid 53:fdb510e3eb37 7593 // "AIN0lex=" alias for if=11 ch=$ x=_ -- condition_if_AINn_le_threshold, // (SPI_AIN_Voltage[channel] <= threhsold)
whismanoid 53:fdb510e3eb37 7594 // "AIN0nex=" alias for if=12 ch=$ x=_ -- condition_if_AINn_ne_threshold, // (SPI_AIN_Voltage[channel] != threhsold)
whismanoid 53:fdb510e3eb37 7595 for (int channel_index = 0; (
whismanoid 53:fdb510e3eb37 7596 (channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS)
whismanoid 53:fdb510e3eb37 7597 && (channel_index < NUM_DUT_ANALOG_IN_CHANNELS));
whismanoid 53:fdb510e3eb37 7598 channel_index++)
whismanoid 53:fdb510e3eb37 7599 {
whismanoid 53:fdb510e3eb37 7600 char key[16];
whismanoid 53:fdb510e3eb37 7601 //
whismanoid 53:fdb510e3eb37 7602 sprintf(key, "A%dgtx", 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_gt_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%dltx", 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_lt_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%deqx", 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_eq_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%dgex", 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_ge_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%dlex", 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_le_threshold;
whismanoid 53:fdb510e3eb37 7639 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7640 }
whismanoid 53:fdb510e3eb37 7641 //
whismanoid 53:fdb510e3eb37 7642 sprintf(key, "A%dnex", 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_An_ne_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%dgtx", 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_gt_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%dltx", 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_lt_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%deqx", 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_eq_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%dgex", 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_ge_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%dlex", 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_le_threshold;
whismanoid 53:fdb510e3eb37 7687 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7688 }
whismanoid 53:fdb510e3eb37 7689 //
whismanoid 53:fdb510e3eb37 7690 sprintf(key, "AIN%dnex", channel_index);
whismanoid 53:fdb510e3eb37 7691 if (cmdLine.parse_double(key, edit_condition_threshold))
whismanoid 53:fdb510e3eb37 7692 {
whismanoid 53:fdb510e3eb37 7693 //~ cmdLine.serial().printf("\r\n x=%d", edit_condition_threshold);
whismanoid 53:fdb510e3eb37 7694 edit_condition = (int)condition_if_AINn_ne_threshold;
whismanoid 53:fdb510e3eb37 7695 edit_condition_channel = channel_index;
whismanoid 53:fdb510e3eb37 7696 }
whismanoid 53:fdb510e3eb37 7697 //
whismanoid 55:477ba09475d7 7698 // MAX40108 Datalog Math #362 -- parse_action_table_args() support condition_if_MathAn_gt_threshold gt lt eq ne etc.
whismanoid 55:477ba09475d7 7699 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 7700 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 7701 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 7702 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 7703 //
whismanoid 55:477ba09475d7 7704 //
whismanoid 53:fdb510e3eb37 7705 } // end for (channel_index...)
whismanoid 53:fdb510e3eb37 7706 //
whismanoid 53:fdb510e3eb37 7707 }
whismanoid 53:fdb510e3eb37 7708 #endif // USE_DATALOGGER_ActionTable
whismanoid 53:fdb510e3eb37 7709
whismanoid 15:37c83ec50ea0 7710 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 7711 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 7712 void main_menu_onEOLcommandParser(CmdLine& cmdLine)
whismanoid 4:d9b05924ad4c 7713 {
whismanoid 9:45f98573eb6d 7714 // process command line
whismanoid 31:47eee7e0cc2d 7715 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 45:74bf1fe021e5 7716 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7717 if (g_Run_command_table_running == false) {
whismanoid 45:74bf1fe021e5 7718 #endif // USE_DATALOGGER_CommandTable
whismanoid 48:18647e0516f2 7719 //~ cmdLine.serial().printf("\r\nCmdLine buf:\"%s\"\r\n", cmdLine.str());
whismanoid 45:74bf1fe021e5 7720 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7721 } // if (g_Run_command_table_running)
whismanoid 45:74bf1fe021e5 7722 #endif // USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7723 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 45:74bf1fe021e5 7724 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7725 if (g_Run_command_table_running == false) {
whismanoid 45:74bf1fe021e5 7726 #endif // USE_DATALOGGER_CommandTable
whismanoid 45:74bf1fe021e5 7727 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7728 } // if (g_Run_command_table_running)
whismanoid 45:74bf1fe021e5 7729 #endif // USE_DATALOGGER_CommandTable
whismanoid 4:d9b05924ad4c 7730
whismanoid 4:d9b05924ad4c 7731 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 31:47eee7e0cc2d 7732 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 45:74bf1fe021e5 7733 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7734 if (g_Run_command_table_running == false) {
whismanoid 45:74bf1fe021e5 7735 #endif // USE_DATALOGGER_CommandTable
whismanoid 4:d9b05924ad4c 7736 // If datalog is free running, halt on any possible received command
whismanoid 17:9397ea3ea7e9 7737 if (Datalogger_Trigger != trigger_Halt) {
whismanoid 4:d9b05924ad4c 7738 Datalogger_Trigger = trigger_Halt;
whismanoid 9:45f98573eb6d 7739 cmdLine.serial().printf("Datalog stopped by USB command input\r\n");
whismanoid 9:45f98573eb6d 7740 cmdLine.serial().printf("Restart datalog by sending LR\r\n");
whismanoid 4:d9b05924ad4c 7741 }
whismanoid 45:74bf1fe021e5 7742 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7743 } // if (g_Run_command_table_running)
whismanoid 45:74bf1fe021e5 7744 #endif // USE_DATALOGGER_CommandTable
whismanoid 4:d9b05924ad4c 7745 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 4:d9b05924ad4c 7746
whismanoid 4:d9b05924ad4c 7747 // DIAGNOSTIC: print line buffer
whismanoid 4:d9b05924ad4c 7748 //~ cmdLine.serial().printf("\r\nmain_menu_onEOLcommandParser: ~%s~\r\n", cmdLine.str());
whismanoid 4:d9b05924ad4c 7749 //
whismanoid 4:d9b05924ad4c 7750 switch (cmdLine[0])
whismanoid 4:d9b05924ad4c 7751 {
whismanoid 4:d9b05924ad4c 7752 case '?':
whismanoid 4:d9b05924ad4c 7753 main_menu_status(cmdLine);
whismanoid 4:d9b05924ad4c 7754 main_menu_help(cmdLine);
whismanoid 4:d9b05924ad4c 7755 // print command prompt
whismanoid 4:d9b05924ad4c 7756 //cmdLine.serial().printf("\r\n>");
whismanoid 4:d9b05924ad4c 7757 break;
whismanoid 4:d9b05924ad4c 7758 case '\r': case '\n': // ignore blank line
whismanoid 4:d9b05924ad4c 7759 case '\0': // ignore empty line
whismanoid 30:07197a430869 7760 main_menu_status(cmdLine);
whismanoid 30:07197a430869 7761 //~ main_menu_help(cmdLine);
whismanoid 30:07197a430869 7762 // print command prompt
whismanoid 30:07197a430869 7763 //cmdLine.serial().printf("\r\n>");
whismanoid 30:07197a430869 7764 break;
whismanoid 4:d9b05924ad4c 7765 case '#': // ignore comment line
whismanoid 4:d9b05924ad4c 7766 // # -- lines beginning with # are comments
whismanoid 30:07197a430869 7767 //
whismanoid 30:07197a430869 7768 #if USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 7769 // Datalogger_PrintRow() print gstrRemarkText field from recent #remark -- in main_menu_onEOLcommandParser
whismanoid 30:07197a430869 7770 // # command handler update gstrRemarkText buffer instead of just ignoring the remark
whismanoid 30:07197a430869 7771 //
whismanoid 30:07197a430869 7772 // ignore extra spaces before the remark
whismanoid 30:07197a430869 7773 // find argIndex such that cmdLine[argIndex] is the start of the second word
whismanoid 30:07197a430869 7774 int argIndex;
whismanoid 30:07197a430869 7775 for (argIndex = 1; cmdLine[argIndex] != '\0'; argIndex++)
whismanoid 30:07197a430869 7776 {
whismanoid 30:07197a430869 7777 if (cmdLine[argIndex] == ' ') break;
whismanoid 30:07197a430869 7778 }
whismanoid 30:07197a430869 7779 for (; cmdLine[argIndex] != '\0'; argIndex++)
whismanoid 30:07197a430869 7780 {
whismanoid 30:07197a430869 7781 if (cmdLine[argIndex] != ' ') break;
whismanoid 30:07197a430869 7782 }
whismanoid 30:07197a430869 7783 //
whismanoid 30:07197a430869 7784 strncpy(gstrRemarkText, cmdLine.str()+argIndex, gstrRemarkTextLASTINDEX+1);
whismanoid 30:07197a430869 7785 // do not exceed string buffer limit; keep sentinel null character at end of buffer
whismanoid 30:07197a430869 7786 gstrRemarkText[gstrRemarkTextLASTINDEX] = '\0';
whismanoid 41:13a6a097502c 7787 for (unsigned int index = 0; index < gstrRemarkTextLASTINDEX; index++)
whismanoid 30:07197a430869 7788 {
whismanoid 30:07197a430869 7789 if ((gstrRemarkText[index]) == '\0') break; // null character at end of string
whismanoid 30:07197a430869 7790 if ((gstrRemarkText[index]) < 0x20) {
whismanoid 30:07197a430869 7791 // replace non-printing characters with _
whismanoid 30:07197a430869 7792 gstrRemarkText[index] = '_';
whismanoid 30:07197a430869 7793 continue;
whismanoid 30:07197a430869 7794 }
whismanoid 30:07197a430869 7795 if ((gstrRemarkText[index]) >= 0x7F) {
whismanoid 30:07197a430869 7796 // replace non-printing characters with _
whismanoid 30:07197a430869 7797 gstrRemarkText[index] = '_';
whismanoid 30:07197a430869 7798 continue;
whismanoid 30:07197a430869 7799 }
whismanoid 30:07197a430869 7800 switch(gstrRemarkText[index])
whismanoid 30:07197a430869 7801 {
whismanoid 30:07197a430869 7802 case ',':
whismanoid 30:07197a430869 7803 // replace , with ;
whismanoid 30:07197a430869 7804 gstrRemarkText[index] = ';';
whismanoid 30:07197a430869 7805 break;
whismanoid 30:07197a430869 7806 case '"':
whismanoid 30:07197a430869 7807 // replace " with '
whismanoid 30:07197a430869 7808 gstrRemarkText[index] = '\'';
whismanoid 30:07197a430869 7809 break;
whismanoid 30:07197a430869 7810 case '\\':
whismanoid 30:07197a430869 7811 // replace \ with /
whismanoid 30:07197a430869 7812 gstrRemarkText[index] = '/';
whismanoid 30:07197a430869 7813 break;
whismanoid 30:07197a430869 7814 }
whismanoid 30:07197a430869 7815 }
whismanoid 30:07197a430869 7816 #endif // USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 7817 //
whismanoid 31:47eee7e0cc2d 7818 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 45:74bf1fe021e5 7819 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7820 if (g_Run_command_table_running == false) {
whismanoid 45:74bf1fe021e5 7821 #endif // USE_DATALOGGER_CommandTable
whismanoid 4:d9b05924ad4c 7822 main_menu_status(cmdLine);
whismanoid 45:74bf1fe021e5 7823 #if USE_DATALOGGER_CommandTable
whismanoid 31:47eee7e0cc2d 7824 } // if (g_Run_command_table_running)
whismanoid 45:74bf1fe021e5 7825 #endif // USE_DATALOGGER_CommandTable
whismanoid 4:d9b05924ad4c 7826 //~ main_menu_help(cmdLine);
whismanoid 4:d9b05924ad4c 7827 // print command prompt
whismanoid 4:d9b05924ad4c 7828 //cmdLine.serial().printf("\r\n>");
whismanoid 4:d9b05924ad4c 7829 break;
whismanoid 4:d9b05924ad4c 7830 #if ECHO_EOF_ON_EOL
whismanoid 4:d9b05924ad4c 7831 case '\x04': // Unicode (U+0004) EOT END OF TRANSMISSION = CTRL+D as EOF end of file
whismanoid 4:d9b05924ad4c 7832 cmdLine.serial().printf("\x04"); // immediately echo EOF for test scripting
whismanoid 4:d9b05924ad4c 7833 diagnostic_led_EOF();
whismanoid 4:d9b05924ad4c 7834 break;
whismanoid 4:d9b05924ad4c 7835 case '\x1a': // Unicode (U+001A) SUB SUBSTITUTE = CTRL+Z as EOF end of file
whismanoid 4:d9b05924ad4c 7836 cmdLine.serial().printf("\x1a"); // immediately echo EOF for test scripting
whismanoid 4:d9b05924ad4c 7837 diagnostic_led_EOF();
whismanoid 4:d9b05924ad4c 7838 break;
whismanoid 4:d9b05924ad4c 7839 #endif
whismanoid 10:04022a61b527 7840 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 10:04022a61b527 7841 case '!': // device init
whismanoid 10:04022a61b527 7842 {
whismanoid 10:04022a61b527 7843 cmdLine.serial().printf("Init");
whismanoid 10:04022a61b527 7844 // call function Init
whismanoid 10:04022a61b527 7845 uint8_t result = g_MAX11410_device.Init();
whismanoid 10:04022a61b527 7846 // cmdLine.serial().printf(" =%d\r\n", result);
whismanoid 10:04022a61b527 7847 cmdLine.serial().printf(" =%d\r\n", result);
whismanoid 10:04022a61b527 7848 #if USE_CUSTOM_REG_INIT // custom_reg_init_addr[], custom_reg_init_data[], custom_reg_init_count
whismanoid 10:04022a61b527 7849 // in command '!' device init, apply list of custom register writes after init
whismanoid 10:04022a61b527 7850 // custom_reg_init_addr[], custom_reg_init_data[], custom_reg_init_count
whismanoid 10:04022a61b527 7851 for (unsigned int index = 0; index < custom_reg_init_count; index++) {
whismanoid 10:04022a61b527 7852 uint8_t regAddress = custom_reg_init_addr[index];
whismanoid 10:04022a61b527 7853 uint32_t regData = custom_reg_init_data[index];
whismanoid 10:04022a61b527 7854 cmdLine.serial().printf("*%s=0x%06.6x",
whismanoid 10:04022a61b527 7855 g_MAX11410_device.RegName((MAX11410::MAX11410_CMD_enum_t)regAddress),
whismanoid 10:04022a61b527 7856 regData
whismanoid 10:04022a61b527 7857 );
whismanoid 10:04022a61b527 7858 g_MAX11410_device.RegWrite((MAX11410::MAX11410_CMD_enum_t)regAddress, regData);
whismanoid 10:04022a61b527 7859 }
whismanoid 10:04022a61b527 7860 #endif // USE_CUSTOM_REG_INIT
whismanoid 10:04022a61b527 7861 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[0];
whismanoid 10:04022a61b527 7862 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[0];
whismanoid 10:04022a61b527 7863 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[0];
whismanoid 10:04022a61b527 7864 }
whismanoid 10:04022a61b527 7865 break;
whismanoid 10:04022a61b527 7866 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 4:d9b05924ad4c 7867 #if USE_SELFTEST
whismanoid 4:d9b05924ad4c 7868 case '.':
whismanoid 4:d9b05924ad4c 7869 {
whismanoid 4:d9b05924ad4c 7870 // . -- SelfTest
whismanoid 4:d9b05924ad4c 7871 cmdLine.serial().printf("SelfTest()");
whismanoid 4:d9b05924ad4c 7872 SelfTest(cmdLine);
whismanoid 4:d9b05924ad4c 7873 }
whismanoid 4:d9b05924ad4c 7874 break;
whismanoid 4:d9b05924ad4c 7875 #endif // USE_SELFTEST
whismanoid 15:37c83ec50ea0 7876 #if 1 // APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 7877 case '%':
whismanoid 4:d9b05924ad4c 7878 {
whismanoid 4:d9b05924ad4c 7879 pinsMonitor_submenu_onEOLcommandParser(cmdLine);
whismanoid 4:d9b05924ad4c 7880 }
whismanoid 4:d9b05924ad4c 7881 break; // case '%'
whismanoid 4:d9b05924ad4c 7882 #endif // APPLICATION_ArduinoPinsMonitor
whismanoid 9:45f98573eb6d 7883 #if USE_STAR_REG_READWRITE // * command read/write reg *reg? *reg=value
whismanoid 10:04022a61b527 7884 // reuse the Serial_Tester command *regName=regValue
whismanoid 10:04022a61b527 7885 // CODE GENERATOR: generate * command read/write reg *reg? *reg=value
whismanoid 10:04022a61b527 7886 case '*':
whismanoid 10:04022a61b527 7887 {
whismanoid 10:04022a61b527 7888 // if buffer starts with a regName:
whismanoid 10:04022a61b527 7889 // for each reg value (0..n) if(cmdLine.has_keyword(device.regName(r))):
whismanoid 10:04022a61b527 7890 // cmdLine.serial().printf(" scan RegName...\r\n");
whismanoid 10:04022a61b527 7891 }
whismanoid 10:04022a61b527 7892 break;
whismanoid 9:45f98573eb6d 7893 #endif // USE_STAR_REG_READWRITE // * command read/write reg *reg? *reg=value
whismanoid 10:04022a61b527 7894 //
whismanoid 10:04022a61b527 7895 #if 1 // USE_AUX_SERIAL_CMD_FORWARDING && (HAS_AUX_SERIAL || HAS_DAPLINK_SERIAL)
whismanoid 10:04022a61b527 7896 // TODO WIP Command forwarding to Auxiliary serial port TX/RX #257 -- main_menu_onEOLcommandParser
whismanoid 40:330b28116178 7897 case '>': case '<': // > send and receive; < receive without sending anything
whismanoid 10:04022a61b527 7898 {
whismanoid 10:04022a61b527 7899 // prefer cmdLine_AUXserial if available, else cmdLine_DAPLINKserial; else we don't have this feature
whismanoid 10:04022a61b527 7900 # if HAS_AUX_SERIAL
whismanoid 10:04022a61b527 7901 // TODO WIP Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257
whismanoid 10:04022a61b527 7902 CmdLine& cmdLine_AuxSerial = cmdLine_AUXserial;
whismanoid 10:04022a61b527 7903 Serial& AuxSerial = AUXserial;
whismanoid 10:04022a61b527 7904 # elif HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 7905 // TODO WIP Command forwarding to DAPLINK serial TX/RX cmdLine_DAPLINKserial #257
whismanoid 10:04022a61b527 7906 CmdLine& cmdLine_AuxSerial = cmdLine_DAPLINKserial;
whismanoid 10:04022a61b527 7907 Serial& AuxSerial = DAPLINKserial;
whismanoid 10:04022a61b527 7908 # else // neither HAS_AUX_SERIAL HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 7909 #warning "USE_AUX_SERIAL_CMD_FORWARDING should not be enabled without HAS_AUX_SERIAL or HAS_DAPLINK_SERIAL"
whismanoid 10:04022a61b527 7910 # endif // HAS_AUX_SERIAL HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 7911 //
whismanoid 40:330b28116178 7912 int g_auxSerialCom_outgoing_string_cr = 1; // option to send CR after outgoing_string
whismanoid 40:330b28116178 7913 int g_auxSerialCom_outgoing_string_lf = 0; // option to send LF after outgoing_string (breaks remote datalogger LR!)
whismanoid 40:330b28116178 7914 int g_auxSerialCom_rx_string_verbose_crlf = 0; // option to display \r\n as "\\r\\n" in rx_string_buf
whismanoid 40:330b28116178 7915 int g_auxSerialCom_rx_string_verbose_ctrl = 1; // option to display control codes as \xXX
whismanoid 40:330b28116178 7916 const char* g_auxSerialCom_display_tx_prefix = "\r\n->|"; // "\r\n >";
whismanoid 40:330b28116178 7917 const char* g_auxSerialCom_display_rx_prefix = "\r\n<-|"; // "\r\n< ";
whismanoid 40:330b28116178 7918 //
whismanoid 40:330b28116178 7919 bool need_g_auxSerialCom_display_rx_prefix = 1; // temp
whismanoid 40:330b28116178 7920 //
whismanoid 10:04022a61b527 7921 // >> suppress key=value parsing
whismanoid 10:04022a61b527 7922 bool suppress_parsing = (cmdLine[1] == '>');
whismanoid 10:04022a61b527 7923 if (suppress_parsing == false) {
whismanoid 10:04022a61b527 7924 // int g_auxSerialCom_baud = 9600; //!< baud rate Auxiliary serial port
whismanoid 10:04022a61b527 7925 if (cmdLine.parse_int_dec("baud", g_auxSerialCom_baud))
whismanoid 10:04022a61b527 7926 {
whismanoid 10:04022a61b527 7927 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- baud rate
whismanoid 10:04022a61b527 7928 cmdLine_AuxSerial.serial().printf("\r\n*** New Baud Rate %d ***\r\n", g_auxSerialCom_baud);
whismanoid 10:04022a61b527 7929 AuxSerial.baud(g_auxSerialCom_baud);
whismanoid 10:04022a61b527 7930 cmdLine_AuxSerial.serial().printf("\r\n*** Baud Rate was set to %d ***\r\n", g_auxSerialCom_baud);
whismanoid 10:04022a61b527 7931 }
whismanoid 10:04022a61b527 7932 #if 0
whismanoid 10:04022a61b527 7933 // int g_auxSerialCom_tx_wait_echo = 0; //!< TX wait for each character echo?
whismanoid 10:04022a61b527 7934 if (cmdLine.parse_int_dec("tx_wait_echo", g_auxSerialCom_tx_wait_echo))
whismanoid 10:04022a61b527 7935 {
whismanoid 10:04022a61b527 7936 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- tx_wait_echo
whismanoid 10:04022a61b527 7937 //~ cmdLine_AuxSerial.serial().printf("\r\n*** tx_wait_echo was set to %d ***\r\n", g_auxSerialCom_tx_wait_echo);
whismanoid 10:04022a61b527 7938 cmdLine.serial().printf("\r\n tx_wait_echo=%d", g_auxSerialCom_tx_wait_echo);
whismanoid 10:04022a61b527 7939 }
whismanoid 10:04022a61b527 7940 // int g_auxSerialCom_tx_char_delay_ms = 0; //!< TX delay after each char?
whismanoid 10:04022a61b527 7941 if (cmdLine.parse_int_dec("tx_char_delay_ms", g_auxSerialCom_tx_char_delay_ms))
whismanoid 10:04022a61b527 7942 {
whismanoid 10:04022a61b527 7943 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- tx_char_delay_ms
whismanoid 10:04022a61b527 7944 //~ 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 7945 cmdLine.serial().printf("\r\n tx_char_delay_ms=%dms", g_auxSerialCom_tx_char_delay_ms);
whismanoid 10:04022a61b527 7946 }
whismanoid 10:04022a61b527 7947 // int g_auxSerialCom_tx_line_delay_ms = 0; //!< TX delay after each CR/LF?
whismanoid 10:04022a61b527 7948 if (cmdLine.parse_int_dec("tx_line_delay_ms", g_auxSerialCom_tx_line_delay_ms))
whismanoid 10:04022a61b527 7949 {
whismanoid 10:04022a61b527 7950 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- tx_line_delay_ms
whismanoid 10:04022a61b527 7951 //~ 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 7952 cmdLine.serial().printf("\r\n tx_line_delay_ms=%dms", g_auxSerialCom_tx_line_delay_ms);
whismanoid 10:04022a61b527 7953 }
whismanoid 10:04022a61b527 7954 #endif
whismanoid 10:04022a61b527 7955 // int g_auxSerialCom_message_ms = 0; //!< capture RX until response timeout?
whismanoid 10:04022a61b527 7956 if (cmdLine.parse_int_dec("message_ms", g_auxSerialCom_message_ms))
whismanoid 10:04022a61b527 7957 {
whismanoid 10:04022a61b527 7958 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- message_ms
whismanoid 10:04022a61b527 7959 //~ cmdLine_AuxSerial.serial().printf("\r\n*** message_ms was set to %d ***\r\n", g_auxSerialCom_message_ms);
whismanoid 10:04022a61b527 7960 cmdLine.serial().printf("\r\n message_ms timeout %dms", g_auxSerialCom_message_ms);
whismanoid 10:04022a61b527 7961 }
whismanoid 10:04022a61b527 7962 // int g_auxSerialCom_rx_idle_ms = 0; //!< capture RX until idle timeout?
whismanoid 10:04022a61b527 7963 if (cmdLine.parse_int_dec("rx_idle_ms", g_auxSerialCom_rx_idle_ms))
whismanoid 10:04022a61b527 7964 {
whismanoid 10:04022a61b527 7965 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- rx_idle_ms
whismanoid 10:04022a61b527 7966 //~ cmdLine_AuxSerial.serial().printf("\r\n*** rx_idle_ms was set to %d ***\r\n", g_auxSerialCom_rx_idle_ms);
whismanoid 10:04022a61b527 7967 cmdLine.serial().printf("\r\n rx_idle_ms timeout %dms", g_auxSerialCom_rx_idle_ms);
whismanoid 10:04022a61b527 7968 }
whismanoid 10:04022a61b527 7969 // int g_auxSerialCom_rx_max_count = 0; //!< capture RX until max character count?
whismanoid 10:04022a61b527 7970 if (cmdLine.parse_int_dec("rx_max_count", g_auxSerialCom_rx_max_count))
whismanoid 10:04022a61b527 7971 {
whismanoid 10:04022a61b527 7972 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- rx_max_count
whismanoid 10:04022a61b527 7973 //~ cmdLine_AuxSerial.serial().printf("\r\n*** rx_max_count was set to %d ***\r\n", g_auxSerialCom_rx_max_count);
whismanoid 10:04022a61b527 7974 cmdLine.serial().printf("\r\n rx_max_count %d bytes", g_auxSerialCom_rx_max_count);
whismanoid 10:04022a61b527 7975 }
whismanoid 10:04022a61b527 7976 // int g_auxSerialCom_rx_eot = 0; //!< capture RX until match end of text char?
whismanoid 10:04022a61b527 7977 if (cmdLine.parse_int_dec("rx_eot", g_auxSerialCom_rx_eot))
whismanoid 10:04022a61b527 7978 {
whismanoid 10:04022a61b527 7979 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- rx_eot
whismanoid 10:04022a61b527 7980 //~ cmdLine_AUXserial.serial().printf("\r\n*** rx_eot was set to %d ***\r\n", g_auxSerialCom_rx_eot);
whismanoid 10:04022a61b527 7981 cmdLine.serial().printf("\r\n rx_eot %d", g_auxSerialCom_rx_eot);
whismanoid 10:04022a61b527 7982 }
whismanoid 10:04022a61b527 7983 }
whismanoid 10:04022a61b527 7984 // Command forwarding to AUX serial TX/RX cmdLine_AuxSerial #257 -- send outgoing_string
whismanoid 41:13a6a097502c 7985 char* outgoing_string = ""; // warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
whismanoid 40:330b28116178 7986 if (cmdLine[0] == '>') {
whismanoid 40:330b28116178 7987 outgoing_string = (char*)cmdLine.str();
whismanoid 40:330b28116178 7988 // > use key=value parsing
whismanoid 40:330b28116178 7989 // >> suppress key=value parsing
whismanoid 40:330b28116178 7990 if (suppress_parsing) {
whismanoid 40:330b28116178 7991 cmdLine.serial().printf("\r\n suppress_parsing outgoing_string=\"%s\"", outgoing_string);
whismanoid 40:330b28116178 7992 outgoing_string++; // skip the first '>'
whismanoid 40:330b28116178 7993 outgoing_string++; // skip the second '>'
whismanoid 40:330b28116178 7994 } else {
whismanoid 40:330b28116178 7995 // TODO: after parsing, key=value pairs should be deleted, but outgoing_string=">xyzzy abc=def"
whismanoid 40:330b28116178 7996 cmdLine.serial().printf("\r\n after parsing, outgoing_string=\"%s\"", outgoing_string);
whismanoid 40:330b28116178 7997 outgoing_string++; // skip the first '>'
whismanoid 40:330b28116178 7998 }
whismanoid 40:330b28116178 7999 } // if (cmdLine[0] == '>')
whismanoid 10:04022a61b527 8000 static char rx_string_buf[RX_STRING_BUF_SIZE];
whismanoid 10:04022a61b527 8001 unsigned int rx_string_length = 0;
whismanoid 40:330b28116178 8002 //cmdLine.serial().printf("\r\n >%s\r\n <", outgoing_string);
whismanoid 40:330b28116178 8003 //char* g_auxSerialCom_display_tx_prefix = "\r\n >";
whismanoid 40:330b28116178 8004 //char* g_auxSerialCom_display_rx_prefix = "\r\n< ";
whismanoid 40:330b28116178 8005 cmdLine.serial().printf("%s%s%s",
whismanoid 40:330b28116178 8006 g_auxSerialCom_display_tx_prefix, // "\r\n >"
whismanoid 40:330b28116178 8007 outgoing_string,
whismanoid 40:330b28116178 8008 g_auxSerialCom_display_rx_prefix // "\r\n <"
whismanoid 40:330b28116178 8009 );
whismanoid 10:04022a61b527 8010 rx_string_buf[0] = '\0';
whismanoid 10:04022a61b527 8011 rx_string_length = 0;
whismanoid 10:04022a61b527 8012 //
whismanoid 10:04022a61b527 8013 // int g_auxSerialCom_tx_wait_echo = 0; //!< TX wait for each character echo?
whismanoid 10:04022a61b527 8014 // int g_auxSerialCom_tx_char_delay_ms = 0; //!< TX delay after each char?
whismanoid 10:04022a61b527 8015 // int g_auxSerialCom_tx_line_delay_ms = 0; //!< TX delay after each CR/LF?
whismanoid 10:04022a61b527 8016 //
whismanoid 10:04022a61b527 8017 // int g_auxSerialCom_Timer_begin_message_ms = 0; //!< start of message
whismanoid 10:04022a61b527 8018 // int g_auxSerialCom_Timer_begin_rx_idle_ms = 0; //!< recent RX character timestamp
whismanoid 10:04022a61b527 8019 // int g_auxSerialCom_message_ms = 10000; //!< maximum RX message total response time
whismanoid 10:04022a61b527 8020 // int g_auxSerialCom_rx_idle_ms = 2000; //!< maximum RX message idle time between characters
whismanoid 10:04022a61b527 8021 // int g_auxSerialCom_rx_max_count = RX_STRING_BUF_SIZE-1; //!< maximum RX message total length
whismanoid 10:04022a61b527 8022 // int g_auxSerialCom_rx_eot = '\r'; //!< capture RX until match end of text char
whismanoid 10:04022a61b527 8023 //~ cmdLine_AuxSerial.serial().printf("\r\n*** TODO forward %s ***\r\n", outgoing_string);
whismanoid 10:04022a61b527 8024 //
whismanoid 10:04022a61b527 8025 // TODO: send whole string or send character-by-character?
whismanoid 40:330b28116178 8026 if (cmdLine[0] == '>') {
whismanoid 40:330b28116178 8027 cmdLine_AuxSerial.serial().printf("%s", outgoing_string);
whismanoid 40:330b28116178 8028 //
whismanoid 40:330b28116178 8029 // TODO: send CRLF or just send CR line end?
whismanoid 40:330b28116178 8030 if (g_auxSerialCom_outgoing_string_cr) { cmdLine_AuxSerial.serial().printf("\r"); }
whismanoid 40:330b28116178 8031 if (g_auxSerialCom_outgoing_string_lf) { cmdLine_AuxSerial.serial().printf("\n"); }
whismanoid 40:330b28116178 8032 // cmdLine_AuxSerial.serial().printf("\r\n");
whismanoid 40:330b28116178 8033 } // if (cmdLine[0] == '>')
whismanoid 40:330b28116178 8034 //
whismanoid 10:04022a61b527 8035 g_auxSerialCom_Timer.start();
whismanoid 10:04022a61b527 8036 g_auxSerialCom_Timer_begin_message_ms = g_auxSerialCom_Timer.read_ms(); // start of message
whismanoid 10:04022a61b527 8037 g_auxSerialCom_Timer_begin_rx_idle_ms = g_auxSerialCom_Timer.read_ms(); // recent RX character timestamp
whismanoid 10:04022a61b527 8038 while (rx_string_length < (RX_STRING_BUF_SIZE-1)) {
whismanoid 10:04022a61b527 8039 if ((g_auxSerialCom_Timer.read_ms() - g_auxSerialCom_Timer_begin_message_ms) > g_auxSerialCom_message_ms) {
whismanoid 10:04022a61b527 8040 cmdLine.serial().printf("\r\n message_ms timeout %dms", g_auxSerialCom_message_ms);
whismanoid 10:04022a61b527 8041 break;
whismanoid 10:04022a61b527 8042 }
whismanoid 10:04022a61b527 8043 if ((g_auxSerialCom_Timer.read_ms() - g_auxSerialCom_Timer_begin_rx_idle_ms) > g_auxSerialCom_rx_idle_ms) {
whismanoid 10:04022a61b527 8044 cmdLine.serial().printf("\r\n rx_idle_ms timeout %dms", g_auxSerialCom_rx_idle_ms);
whismanoid 10:04022a61b527 8045 break;
whismanoid 10:04022a61b527 8046 }
whismanoid 41:13a6a097502c 8047 if ((int)rx_string_length >= g_auxSerialCom_rx_max_count) {
whismanoid 10:04022a61b527 8048 cmdLine.serial().printf("\r\n rx_max_count %d bytes", g_auxSerialCom_rx_max_count);
whismanoid 10:04022a61b527 8049 break;
whismanoid 10:04022a61b527 8050 }
whismanoid 10:04022a61b527 8051 if (AuxSerial.readable()) {
whismanoid 10:04022a61b527 8052 g_auxSerialCom_Timer_begin_rx_idle_ms = g_auxSerialCom_Timer.read_ms(); // recent RX character timestamp
whismanoid 10:04022a61b527 8053 char ch = AuxSerial.getc();
whismanoid 10:04022a61b527 8054 rx_string_buf[rx_string_length++] = ch;
whismanoid 10:04022a61b527 8055 rx_string_buf[rx_string_length] = '\0'; // null terminate buffer
whismanoid 40:330b28116178 8056 //
whismanoid 40:330b28116178 8057 #if 1
whismanoid 40:330b28116178 8058 // immediate character echo
whismanoid 40:330b28116178 8059 for (char* cp = &(rx_string_buf[rx_string_length-1]); *cp != '\0'; cp++)
whismanoid 40:330b28116178 8060 {
whismanoid 40:330b28116178 8061 //cmdLine.serial().printf("\r\n <%s\r\n", rx_string_buf);
whismanoid 40:330b28116178 8062 if (need_g_auxSerialCom_display_rx_prefix) {
whismanoid 40:330b28116178 8063 cmdLine.serial().printf(g_auxSerialCom_display_rx_prefix); // "\r\n< " g_auxSerialCom_rx_string display prefix
whismanoid 40:330b28116178 8064 need_g_auxSerialCom_display_rx_prefix = 0;
whismanoid 40:330b28116178 8065 }
whismanoid 40:330b28116178 8066 if ((*cp) == '\r') {
whismanoid 40:330b28116178 8067 if (g_auxSerialCom_rx_string_verbose_crlf) { cmdLine.serial().printf("\\r"); }
whismanoid 40:330b28116178 8068 // if (*(cp+1) != '\n') { need_g_auxSerialCom_display_rx_prefix = 1; }
whismanoid 40:330b28116178 8069 } else if ((*cp) == '\n') {
whismanoid 40:330b28116178 8070 if (g_auxSerialCom_rx_string_verbose_crlf) { cmdLine.serial().printf("\\n"); }
whismanoid 40:330b28116178 8071 need_g_auxSerialCom_display_rx_prefix = 1;
whismanoid 40:330b28116178 8072 if (*(cp-1) != '\r') { need_g_auxSerialCom_display_rx_prefix = 1; }
whismanoid 40:330b28116178 8073 } else if ((*cp) < 0x20) {
whismanoid 40:330b28116178 8074 if (g_auxSerialCom_rx_string_verbose_ctrl) { cmdLine.serial().printf("\\x%2.2x", *cp); }
whismanoid 40:330b28116178 8075 } else if ((*cp) >= 0x7f) {
whismanoid 40:330b28116178 8076 if (g_auxSerialCom_rx_string_verbose_ctrl) { cmdLine.serial().printf("\\x%2.2x", *cp); }
whismanoid 40:330b28116178 8077 } else {
whismanoid 40:330b28116178 8078 cmdLine.serial().printf("%c", *cp);
whismanoid 40:330b28116178 8079 }
whismanoid 40:330b28116178 8080 }
whismanoid 40:330b28116178 8081 #else
whismanoid 40:330b28116178 8082 // immediate character echo
whismanoid 40:330b28116178 8083 cmdLine.serial().printf("%s", &(rx_string_buf[rx_string_length-1]) );
whismanoid 40:330b28116178 8084 #endif
whismanoid 40:330b28116178 8085 //
whismanoid 10:04022a61b527 8086 if (g_auxSerialCom_rx_eot != aux_serial_cmd_forwarding_rx_eot_not_used) {
whismanoid 10:04022a61b527 8087 if (ch == g_auxSerialCom_rx_eot) {
whismanoid 10:04022a61b527 8088 cmdLine.serial().printf("\r\n rx_eot %d", g_auxSerialCom_rx_eot);
whismanoid 10:04022a61b527 8089 break;
whismanoid 10:04022a61b527 8090 }
whismanoid 10:04022a61b527 8091 }
whismanoid 10:04022a61b527 8092 }
whismanoid 10:04022a61b527 8093 } // end while (rx_string_length < (RX_STRING_BUF_SIZE-1))
whismanoid 40:330b28116178 8094 #if 0
whismanoid 10:04022a61b527 8095 // print summary. is this needed? we already print aux rx as it is received.
whismanoid 10:04022a61b527 8096 rx_string_buf[rx_string_length] = '\0'; // null terminate buffer
whismanoid 40:330b28116178 8097 # if 1 // support multi-line rx_string_buf response
whismanoid 40:330b28116178 8098 if (cmdLine[0] == '>') {
whismanoid 40:330b28116178 8099 cmdLine.serial().printf("%s%s", g_auxSerialCom_display_tx_prefix, outgoing_string);
whismanoid 40:330b28116178 8100 } // if (cmdLine[0] == '>')
whismanoid 40:330b28116178 8101 // cmdLine.serial().printf("\r\n <"); // prefix
whismanoid 40:330b28116178 8102 need_g_auxSerialCom_display_rx_prefix = 1;
whismanoid 40:330b28116178 8103 for (char* cp = rx_string_buf; *cp != '\0'; cp++)
whismanoid 40:330b28116178 8104 {
whismanoid 40:330b28116178 8105 //cmdLine.serial().printf("\r\n <%s\r\n", rx_string_buf);
whismanoid 40:330b28116178 8106 if (need_g_auxSerialCom_display_rx_prefix) {
whismanoid 40:330b28116178 8107 cmdLine.serial().printf(g_auxSerialCom_display_rx_prefix); // "\r\n< " g_auxSerialCom_rx_string display prefix
whismanoid 40:330b28116178 8108 need_g_auxSerialCom_display_rx_prefix = 0;
whismanoid 40:330b28116178 8109 }
whismanoid 40:330b28116178 8110 if ((*cp) == '\r') {
whismanoid 40:330b28116178 8111 if (g_auxSerialCom_rx_string_verbose_crlf) { cmdLine.serial().printf("\\r"); }
whismanoid 40:330b28116178 8112 if (*(cp+1) != '\n') { need_g_auxSerialCom_display_rx_prefix = 1; }
whismanoid 40:330b28116178 8113 } else if ((*cp) == '\n') {
whismanoid 40:330b28116178 8114 if (g_auxSerialCom_rx_string_verbose_crlf) { cmdLine.serial().printf("\\n"); }
whismanoid 40:330b28116178 8115 need_g_auxSerialCom_display_rx_prefix = 1;
whismanoid 40:330b28116178 8116 } else if ((*cp) < 0x20) {
whismanoid 40:330b28116178 8117 if (g_auxSerialCom_rx_string_verbose_ctrl) { cmdLine.serial().printf("\\x%2.2x", *cp); }
whismanoid 40:330b28116178 8118 } else if ((*cp) >= 0x7f) {
whismanoid 40:330b28116178 8119 if (g_auxSerialCom_rx_string_verbose_ctrl) { cmdLine.serial().printf("\\x%2.2x", *cp); }
whismanoid 40:330b28116178 8120 } else {
whismanoid 40:330b28116178 8121 cmdLine.serial().printf("%c", *cp);
whismanoid 40:330b28116178 8122 }
whismanoid 40:330b28116178 8123 }
whismanoid 40:330b28116178 8124 cmdLine.serial().printf("\r\n");
whismanoid 40:330b28116178 8125 # else
whismanoid 10:04022a61b527 8126 cmdLine.serial().printf("\r\n >%s", outgoing_string);
whismanoid 10:04022a61b527 8127 cmdLine.serial().printf("\r\n <%s\r\n", rx_string_buf);
whismanoid 40:330b28116178 8128 # endif
whismanoid 10:04022a61b527 8129 #endif
whismanoid 10:04022a61b527 8130 //
whismanoid 10:04022a61b527 8131 }
whismanoid 10:04022a61b527 8132 break; // case '>'
whismanoid 10:04022a61b527 8133 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 8134 //
whismanoid 4:d9b05924ad4c 8135 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 4:d9b05924ad4c 8136 // TODO Datalog trigger menu
whismanoid 4:d9b05924ad4c 8137 // set Datalogger_Trigger to trigger_Halt or trigger_FreeRun
whismanoid 4:d9b05924ad4c 8138 // Datalogger_Trigger = trigger_Halt // halt the datalogger; continue accepting commands
whismanoid 4:d9b05924ad4c 8139 // Datalogger_Trigger = trigger_FreeRun // free run as fast as possible
whismanoid 9:45f98573eb6d 8140 case 'L': case 'l':
whismanoid 4:d9b05924ad4c 8141 {
whismanoid 4:d9b05924ad4c 8142 // halt the datalogger; continue accepting commands
whismanoid 4:d9b05924ad4c 8143 Datalogger_Trigger = trigger_Halt;
whismanoid 4:d9b05924ad4c 8144 switch (cmdLine[1])
whismanoid 4:d9b05924ad4c 8145 {
whismanoid 17:9397ea3ea7e9 8146 // LT%1.0fs -- Datalog timer sleep=%1.3f seconds g_timer_interval_msec
whismanoid 17:9397ea3ea7e9 8147 case 'T': case 't':
whismanoid 17:9397ea3ea7e9 8148 {
whismanoid 17:9397ea3ea7e9 8149 // timer (configure interval) "intermittent-sleep-mode"
whismanoid 17:9397ea3ea7e9 8150 Datalogger_Trigger = trigger_Timer;
whismanoid 17:9397ea3ea7e9 8151 Datalogger_Need_PrintHeader = true;
whismanoid 17:9397ea3ea7e9 8152 g_timer_interval_counter = 0;
whismanoid 39:4d285e961435 8153 // get g_timer_interval_msec from cmdLine
whismanoid 17:9397ea3ea7e9 8154 // g_timer_interval_msec = 500;
whismanoid 17:9397ea3ea7e9 8155 // g_timer_interval_count = 10;
whismanoid 17:9397ea3ea7e9 8156 if (cmdLine.parse_int_dec("count", g_timer_interval_count))
whismanoid 17:9397ea3ea7e9 8157 {
whismanoid 32:80f3e5eb77d4 8158 if (g_timer_interval_count < 1) { g_timer_interval_count = 1; }
whismanoid 17:9397ea3ea7e9 8159 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- message_ms
whismanoid 17:9397ea3ea7e9 8160 //~ cmdLine_AuxSerial.serial().printf("\r\n*** message_ms was set to %d ***\r\n", g_auxSerialCom_message_ms);
whismanoid 17:9397ea3ea7e9 8161 cmdLine.serial().printf("\r\n g_timer_interval_count=%d", g_timer_interval_count);
whismanoid 17:9397ea3ea7e9 8162 }
whismanoid 17:9397ea3ea7e9 8163 if (cmdLine.parse_int_dec("base", g_timer_interval_msec))
whismanoid 17:9397ea3ea7e9 8164 {
whismanoid 17:9397ea3ea7e9 8165 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- message_ms
whismanoid 17:9397ea3ea7e9 8166 //~ cmdLine_AuxSerial.serial().printf("\r\n*** message_ms was set to %d ***\r\n", g_auxSerialCom_message_ms);
whismanoid 17:9397ea3ea7e9 8167 cmdLine.serial().printf("\r\n g_timer_interval_msec=%d", g_timer_interval_msec);
whismanoid 17:9397ea3ea7e9 8168 }
whismanoid 39:4d285e961435 8169 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 8170 // USE_DATALOGGER_SLEEP -- support sleep modes in Datalogger_Trigger
whismanoid 39:4d285e961435 8171 int int_timer_sleepmode = g_timer_sleepmode;
whismanoid 39:4d285e961435 8172 if (cmdLine.parse_int_dec("sleep", int_timer_sleepmode))
whismanoid 39:4d285e961435 8173 {
whismanoid 39:4d285e961435 8174 g_timer_sleepmode = (Datalogger_Sleep_enum_t)int_timer_sleepmode;
whismanoid 39:4d285e961435 8175 //~ if (g_timer_interval_count < 1) { g_timer_interval_count = 1; }
whismanoid 39:4d285e961435 8176 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- message_ms
whismanoid 39:4d285e961435 8177 //~ cmdLine_AuxSerial.serial().printf("\r\n*** message_ms was set to %d ***\r\n", g_auxSerialCom_message_ms);
whismanoid 39:4d285e961435 8178 cmdLine.serial().printf("\r\n g_timer_sleepmode=%d", (int)g_timer_sleepmode);
whismanoid 39:4d285e961435 8179 }
whismanoid 39:4d285e961435 8180 #else // USE_DATALOGGER_SLEEP
whismanoid 39:4d285e961435 8181 #endif // USE_DATALOGGER_SLEEP
whismanoid 17:9397ea3ea7e9 8182 return; // instead of break; avoid falling through to print_command_prompt();
whismanoid 17:9397ea3ea7e9 8183 }
whismanoid 17:9397ea3ea7e9 8184 break;
whismanoid 17:9397ea3ea7e9 8185 // LIH3 -- Datalog when input high D3
whismanoid 17:9397ea3ea7e9 8186 // LIL6 -- Datalog when input low D6
whismanoid 17:9397ea3ea7e9 8187 case 'I': case 'i':
whismanoid 17:9397ea3ea7e9 8188 {
whismanoid 17:9397ea3ea7e9 8189 // TODO: switch cmdLine[2] configure High or Low, configure input pin
whismanoid 17:9397ea3ea7e9 8190 }
whismanoid 17:9397ea3ea7e9 8191 break;
whismanoid 17:9397ea3ea7e9 8192 #if USE_DATALOGGER_SPIDeviceRegRead
whismanoid 27:b4ac095b83b3 8193 // L$ count=10 base=500ms addr=xxx data=xxx mask=xxx -- Datalog when SPI read of address matches mask
whismanoid 17:9397ea3ea7e9 8194 case '$':
whismanoid 17:9397ea3ea7e9 8195 {
whismanoid 17:9397ea3ea7e9 8196 // TODO: scan cmdLine for regAddr, dataMask, testValue
whismanoid 17:9397ea3ea7e9 8197 }
whismanoid 17:9397ea3ea7e9 8198 break;
whismanoid 17:9397ea3ea7e9 8199 #endif // USE_DATALOGGER_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 8200 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 8201 // L@ -- configures Datalogger_action_table
whismanoid 17:9397ea3ea7e9 8202 case '@':
whismanoid 17:9397ea3ea7e9 8203 {
whismanoid 17:9397ea3ea7e9 8204 // L@ -- configures Datalogger_action_table
whismanoid 17:9397ea3ea7e9 8205 int editRowIndex = 0;
whismanoid 56:8469ffda6119 8206 // parse_action_table_args(cmdLine);
whismanoid 17:9397ea3ea7e9 8207 //
whismanoid 17:9397ea3ea7e9 8208 // Edit the contents of Datalogger_action_table
whismanoid 17:9397ea3ea7e9 8209 switch (cmdLine[2]) // L@... -- Edit the contents of Datalogger_action_table
whismanoid 17:9397ea3ea7e9 8210 {
whismanoid 17:9397ea3ea7e9 8211 // LT%1.0fs -- Datalog timer sleep=%1.3f seconds g_timer_interval_msec
whismanoid 17:9397ea3ea7e9 8212 case '0': case '1': case '2': case '3': case '4':
whismanoid 17:9397ea3ea7e9 8213 case '5': case '6': case '7': case '8': case '9':
whismanoid 17:9397ea3ea7e9 8214 // edit row data
whismanoid 30:07197a430869 8215 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 8216 // if Datalogger_action_table_row_count == 0 then the table is empty
whismanoid 17:9397ea3ea7e9 8217 // get row number to edit from cmdLine[2]
whismanoid 17:9397ea3ea7e9 8218 editRowIndex = atoi(cmdLine.str()+2);
whismanoid 30:07197a430869 8219 if ((editRowIndex >= 0) && (editRowIndex < Datalogger_action_table_row_count)) {
whismanoid 30:07197a430869 8220 // update row
whismanoid 30:07197a430869 8221 cmdLine.serial().printf("\r\n replace row %d", editRowIndex);
whismanoid 30:07197a430869 8222 // rescan cmdLine[2] for key=value of what fields to change (now that we have got defaults from the existing line
whismanoid 30:07197a430869 8223 edit_action = Datalogger_action_table[editRowIndex].action;
whismanoid 30:07197a430869 8224 edit_digitalOutPin = Datalogger_action_table[editRowIndex].digitalOutPin;
whismanoid 30:07197a430869 8225 edit_condition = Datalogger_action_table[editRowIndex].condition;
whismanoid 30:07197a430869 8226 edit_condition_channel = Datalogger_action_table[editRowIndex].condition_channel;
whismanoid 30:07197a430869 8227 edit_condition_threshold = Datalogger_action_table[editRowIndex].condition_threshold;
whismanoid 30:07197a430869 8228 // rescan cmdLine[2] for key=value of what fields to change (now that we have got defaults from the existing line
whismanoid 53:fdb510e3eb37 8229 parse_action_table_args(cmdLine);
whismanoid 30:07197a430869 8230 Datalogger_action_table[editRowIndex].action = (action_type_enum_t)edit_action;
whismanoid 30:07197a430869 8231 Datalogger_action_table[editRowIndex].digitalOutPin = edit_digitalOutPin;
whismanoid 30:07197a430869 8232 Datalogger_action_table[editRowIndex].condition = (action_condition_enum_t)edit_condition;
whismanoid 30:07197a430869 8233 Datalogger_action_table[editRowIndex].condition_channel = edit_condition_channel;
whismanoid 30:07197a430869 8234 Datalogger_action_table[editRowIndex].condition_threshold = edit_condition_threshold;
whismanoid 17:9397ea3ea7e9 8235 }
whismanoid 30:07197a430869 8236 else if ((editRowIndex == Datalogger_action_table_row_count) && (Datalogger_action_table_row_count < ACTION_TABLE_ROW_MAX)) {
whismanoid 30:07197a430869 8237 // %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 8238 parse_action_table_args(cmdLine);
whismanoid 30:07197a430869 8239 Datalogger_action_table_row_count++;
whismanoid 30:07197a430869 8240 cmdLine.serial().printf("\r\n add next row %d", editRowIndex);
whismanoid 30:07197a430869 8241 Datalogger_action_table[editRowIndex].action = (action_type_enum_t)edit_action;
whismanoid 30:07197a430869 8242 Datalogger_action_table[editRowIndex].digitalOutPin = edit_digitalOutPin;
whismanoid 30:07197a430869 8243 Datalogger_action_table[editRowIndex].condition = (action_condition_enum_t)edit_condition;
whismanoid 30:07197a430869 8244 Datalogger_action_table[editRowIndex].condition_channel = edit_condition_channel;
whismanoid 30:07197a430869 8245 Datalogger_action_table[editRowIndex].condition_threshold = edit_condition_threshold;
whismanoid 30:07197a430869 8246 //
whismanoid 17:9397ea3ea7e9 8247 }
whismanoid 17:9397ea3ea7e9 8248 }
whismanoid 17:9397ea3ea7e9 8249 break;
whismanoid 17:9397ea3ea7e9 8250 case '+':
whismanoid 17:9397ea3ea7e9 8251 // add a new row at end of table
whismanoid 17:9397ea3ea7e9 8252 if (Datalogger_action_table_row_count < ACTION_TABLE_ROW_MAX) {
whismanoid 17:9397ea3ea7e9 8253 // if Datalogger_action_table_row_count => ACTION_TABLE_ROW_MAX then the table is full
whismanoid 56:8469ffda6119 8254 parse_action_table_args(cmdLine);
whismanoid 17:9397ea3ea7e9 8255 editRowIndex = Datalogger_action_table_row_count;
whismanoid 17:9397ea3ea7e9 8256 Datalogger_action_table_row_count++;
whismanoid 30:07197a430869 8257 cmdLine.serial().printf("\r\n add new row %d", editRowIndex);
whismanoid 17:9397ea3ea7e9 8258 Datalogger_action_table[editRowIndex].action = (action_type_enum_t)edit_action;
whismanoid 17:9397ea3ea7e9 8259 Datalogger_action_table[editRowIndex].digitalOutPin = edit_digitalOutPin;
whismanoid 17:9397ea3ea7e9 8260 Datalogger_action_table[editRowIndex].condition = (action_condition_enum_t)edit_condition;
whismanoid 17:9397ea3ea7e9 8261 Datalogger_action_table[editRowIndex].condition_channel = edit_condition_channel;
whismanoid 17:9397ea3ea7e9 8262 Datalogger_action_table[editRowIndex].condition_threshold = edit_condition_threshold;
whismanoid 17:9397ea3ea7e9 8263 }
whismanoid 17:9397ea3ea7e9 8264 break;
whismanoid 17:9397ea3ea7e9 8265 case '-':
whismanoid 17:9397ea3ea7e9 8266 // delete row from table
whismanoid 17:9397ea3ea7e9 8267 if (Datalogger_action_table_row_count > 0) {
whismanoid 17:9397ea3ea7e9 8268 // if Datalogger_action_table_row_count == 0 then the table is empty
whismanoid 17:9397ea3ea7e9 8269 if ((cmdLine[3] == '~') && (cmdLine[4] == '~') && (cmdLine[5] == '~')) {
whismanoid 17:9397ea3ea7e9 8270 // L@-~~~ -- delete all rows from table
whismanoid 30:07197a430869 8271 cmdLine.serial().printf("\r\n delete all rows");
whismanoid 17:9397ea3ea7e9 8272 Datalogger_action_table_row_count = 0;
whismanoid 17:9397ea3ea7e9 8273 break;
whismanoid 17:9397ea3ea7e9 8274 }
whismanoid 30:07197a430869 8275 else {
whismanoid 30:07197a430869 8276 editRowIndex = atoi(cmdLine.str()+3);
whismanoid 30:07197a430869 8277 cmdLine.serial().printf("\r\n delete row %d", editRowIndex);
whismanoid 30:07197a430869 8278 // delete row editRowIndex from Datalogger_action_table
whismanoid 30:07197a430869 8279 for (int i = editRowIndex; i < (Datalogger_action_table_row_count-1); i++)
whismanoid 30:07197a430869 8280 {
whismanoid 30:07197a430869 8281 // copy row i+1 into row i
whismanoid 30:07197a430869 8282 Datalogger_action_table[i].action = Datalogger_action_table[i+1].action;
whismanoid 30:07197a430869 8283 Datalogger_action_table[i].digitalOutPin = Datalogger_action_table[i+1].digitalOutPin;
whismanoid 30:07197a430869 8284 Datalogger_action_table[i].condition = Datalogger_action_table[i+1].condition;
whismanoid 30:07197a430869 8285 Datalogger_action_table[i].condition_channel = Datalogger_action_table[i+1].condition_channel;
whismanoid 30:07197a430869 8286 Datalogger_action_table[i].condition_threshold = Datalogger_action_table[i+1].condition_threshold;
whismanoid 30:07197a430869 8287 }
whismanoid 30:07197a430869 8288 Datalogger_action_table_row_count--;
whismanoid 17:9397ea3ea7e9 8289 }
whismanoid 17:9397ea3ea7e9 8290 }
whismanoid 17:9397ea3ea7e9 8291 break;
whismanoid 30:07197a430869 8292 case '.':
whismanoid 30:07197a430869 8293 // L@. pause the entire Log action table
whismanoid 30:07197a430869 8294 cmdLine.serial().printf("\r\n pause the entire Log action table");
whismanoid 17:9397ea3ea7e9 8295 Datalogger_action_table_enabled = false;
whismanoid 17:9397ea3ea7e9 8296 break;
whismanoid 17:9397ea3ea7e9 8297 case '@':
whismanoid 30:07197a430869 8298 // L@@ enable the entire Log action table
whismanoid 30:07197a430869 8299 cmdLine.serial().printf("\r\n enable the entire Log action table");
whismanoid 17:9397ea3ea7e9 8300 Datalogger_action_table_enabled = true;
whismanoid 17:9397ea3ea7e9 8301 break;
whismanoid 53:fdb510e3eb37 8302 } // end switch (cmdLine[2]) // L@... -- Edit the contents of Datalogger_action_table
whismanoid 17:9397ea3ea7e9 8303 //
whismanoid 17:9397ea3ea7e9 8304 // Print the contents of Datalogger_action_table
whismanoid 53:fdb510e3eb37 8305 cmdLine.serial().printf("sequence performed on each datalog row:");
whismanoid 17:9397ea3ea7e9 8306 if (Datalogger_action_table_enabled) {
whismanoid 30:07197a430869 8307 // cmdLine.serial().printf("Log action table enabled; L@. to pause");
whismanoid 17:9397ea3ea7e9 8308 }
whismanoid 17:9397ea3ea7e9 8309 else {
whismanoid 30:07197a430869 8310 cmdLine.serial().printf("Log action table paused; L@@ to enable");
whismanoid 17:9397ea3ea7e9 8311 }
whismanoid 17:9397ea3ea7e9 8312 //~ cmdLine.serial().printf("\r\n Datalogger_action_table_row_count=%d", Datalogger_action_table_row_count);
whismanoid 17:9397ea3ea7e9 8313 for (int i = 0; i < Datalogger_action_table_row_count; i++)
whismanoid 17:9397ea3ea7e9 8314 {
whismanoid 17:9397ea3ea7e9 8315 cmdLine.serial().printf("\r\n L@%d", i);
whismanoid 17:9397ea3ea7e9 8316 cmdLine.serial().printf(" act=%d", Datalogger_action_table[i].action);
whismanoid 17:9397ea3ea7e9 8317 switch(Datalogger_action_table[i].action)
whismanoid 17:9397ea3ea7e9 8318 {
whismanoid 17:9397ea3ea7e9 8319 case action_digitalOutLow:
whismanoid 17:9397ea3ea7e9 8320 case action_digitalOutHigh:
whismanoid 17:9397ea3ea7e9 8321 cmdLine.serial().printf(" pin=%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 17:9397ea3ea7e9 8322 break;
whismanoid 29:6a9edb6e973b 8323 case action_button: // pin = button index 1, 2, 3
whismanoid 29:6a9edb6e973b 8324 cmdLine.serial().printf(" pin=%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 29:6a9edb6e973b 8325 break;
whismanoid 17:9397ea3ea7e9 8326 default:
whismanoid 17:9397ea3ea7e9 8327 case action_noop:
whismanoid 17:9397ea3ea7e9 8328 case action_trigger_Halt:
whismanoid 17:9397ea3ea7e9 8329 case action_trigger_FreeRun:
whismanoid 17:9397ea3ea7e9 8330 case action_trigger_Timer:
whismanoid 17:9397ea3ea7e9 8331 case action_trigger_PlatformDigitalInput:
whismanoid 17:9397ea3ea7e9 8332 case action_trigger_SPIDeviceRegRead:
whismanoid 17:9397ea3ea7e9 8333 break;
whismanoid 17:9397ea3ea7e9 8334 }
whismanoid 17:9397ea3ea7e9 8335 switch(Datalogger_action_table[i].condition)
whismanoid 17:9397ea3ea7e9 8336 {
whismanoid 17:9397ea3ea7e9 8337 case condition_always:
whismanoid 17:9397ea3ea7e9 8338 break;
whismanoid 17:9397ea3ea7e9 8339 default:
whismanoid 17:9397ea3ea7e9 8340 case condition_if_An_gt_threshold:
whismanoid 17:9397ea3ea7e9 8341 case condition_if_An_lt_threshold:
whismanoid 17:9397ea3ea7e9 8342 case condition_if_An_eq_threshold:
whismanoid 17:9397ea3ea7e9 8343 case condition_if_An_ge_threshold:
whismanoid 17:9397ea3ea7e9 8344 case condition_if_An_le_threshold:
whismanoid 17:9397ea3ea7e9 8345 case condition_if_An_ne_threshold:
whismanoid 17:9397ea3ea7e9 8346 case condition_if_AINn_gt_threshold:
whismanoid 17:9397ea3ea7e9 8347 case condition_if_AINn_lt_threshold:
whismanoid 17:9397ea3ea7e9 8348 case condition_if_AINn_eq_threshold:
whismanoid 17:9397ea3ea7e9 8349 case condition_if_AINn_ge_threshold:
whismanoid 17:9397ea3ea7e9 8350 case condition_if_AINn_le_threshold:
whismanoid 17:9397ea3ea7e9 8351 case condition_if_AINn_ne_threshold:
whismanoid 17:9397ea3ea7e9 8352 cmdLine.serial().printf(" if=%d", Datalogger_action_table[i].condition);
whismanoid 17:9397ea3ea7e9 8353 cmdLine.serial().printf(" ch=%d", Datalogger_action_table[i].condition_channel);
whismanoid 40:330b28116178 8354 // our voltage measurement is around 1mV at best
whismanoid 40:330b28116178 8355 cmdLine.serial().printf(" x=%1.4f", Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8356 break;
whismanoid 17:9397ea3ea7e9 8357 }
whismanoid 17:9397ea3ea7e9 8358 cmdLine.serial().printf(" -- ");
whismanoid 17:9397ea3ea7e9 8359 switch(Datalogger_action_table[i].action)
whismanoid 17:9397ea3ea7e9 8360 {
whismanoid 17:9397ea3ea7e9 8361 case action_noop:
whismanoid 53:fdb510e3eb37 8362 //~ cmdLine.serial().printf("No_Operation");
whismanoid 53:fdb510e3eb37 8363 cmdLine.serial().printf("nop");
whismanoid 17:9397ea3ea7e9 8364 break;
whismanoid 17:9397ea3ea7e9 8365 case action_digitalOutLow:
whismanoid 53:fdb510e3eb37 8366 //~ cmdLine.serial().printf("digitalOutLow");
whismanoid 53:fdb510e3eb37 8367 //~ cmdLine.serial().printf(" D%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 53:fdb510e3eb37 8368 cmdLine.serial().printf("Lpin=%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 17:9397ea3ea7e9 8369 break;
whismanoid 17:9397ea3ea7e9 8370 case action_digitalOutHigh:
whismanoid 53:fdb510e3eb37 8371 //~ cmdLine.serial().printf("digitalOutHigh");
whismanoid 53:fdb510e3eb37 8372 //~ cmdLine.serial().printf(" D%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 53:fdb510e3eb37 8373 cmdLine.serial().printf("Hpin=%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 17:9397ea3ea7e9 8374 break;
whismanoid 29:6a9edb6e973b 8375 case action_button: // pin = button index 1, 2, 3
whismanoid 53:fdb510e3eb37 8376 //~ cmdLine.serial().printf("button %%B%d!", Datalogger_action_table[i].digitalOutPin);
whismanoid 53:fdb510e3eb37 8377 cmdLine.serial().printf("btn=%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 53:fdb510e3eb37 8378 cmdLine.serial().printf(" %%B%d!", Datalogger_action_table[i].digitalOutPin);
whismanoid 29:6a9edb6e973b 8379 break;
whismanoid 17:9397ea3ea7e9 8380 case action_trigger_Halt:
whismanoid 53:fdb510e3eb37 8381 //~ cmdLine.serial().printf("Halt");
whismanoid 40:330b28116178 8382 cmdLine.serial().printf("Halt");
whismanoid 17:9397ea3ea7e9 8383 break;
whismanoid 17:9397ea3ea7e9 8384 case action_trigger_FreeRun:
whismanoid 53:fdb510e3eb37 8385 //~ cmdLine.serial().printf("LR");
whismanoid 53:fdb510e3eb37 8386 cmdLine.serial().printf("run_LR");
whismanoid 17:9397ea3ea7e9 8387 break;
whismanoid 17:9397ea3ea7e9 8388 case action_trigger_Timer:
whismanoid 53:fdb510e3eb37 8389 //~ cmdLine.serial().printf("LT count=%d base=%dms", g_timer_interval_count, g_timer_interval_msec);
whismanoid 53:fdb510e3eb37 8390 cmdLine.serial().printf("timer_LT count=%d base=%dms", g_timer_interval_count, g_timer_interval_msec);
whismanoid 45:74bf1fe021e5 8391 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 8392 cmdLine.serial().printf(" sleep=%d", g_timer_sleepmode);
whismanoid 45:74bf1fe021e5 8393 #endif // USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 17:9397ea3ea7e9 8394 break;
whismanoid 17:9397ea3ea7e9 8395 case action_trigger_PlatformDigitalInput:
whismanoid 53:fdb510e3eb37 8396 //~ cmdLine.serial().printf("trigger_PlatformDigitalInput");
whismanoid 53:fdb510e3eb37 8397 cmdLine.serial().printf("pinIN=%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 17:9397ea3ea7e9 8398 // TODO: print configuration for trigger_PlatformDigitalInput
whismanoid 17:9397ea3ea7e9 8399 //~ cmdLine.serial().printf("(%d)", g_config_PlatformDigitalInput);
whismanoid 17:9397ea3ea7e9 8400 break;
whismanoid 17:9397ea3ea7e9 8401 case action_trigger_SPIDeviceRegRead:
whismanoid 53:fdb510e3eb37 8402 //~ cmdLine.serial().printf("trigger_SPIDeviceRegRead");
whismanoid 53:fdb510e3eb37 8403 cmdLine.serial().printf("SPI");
whismanoid 17:9397ea3ea7e9 8404 // TODO: print configuration for trigger_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 8405 //~ cmdLine.serial().printf("(%d)", g_config_SPIDeviceRegRead);
whismanoid 17:9397ea3ea7e9 8406 break;
whismanoid 17:9397ea3ea7e9 8407 } // switch(Datalogger_action_table[i].action)
whismanoid 17:9397ea3ea7e9 8408 //~ cmdLine.serial().printf(" condition %d", Datalogger_action_table[i].condition);
whismanoid 55:477ba09475d7 8409 // WIP Datalog Math -- if channel has its math enabled, compare with the math-adjusted version. Keep it simple. #362
whismanoid 17:9397ea3ea7e9 8410 switch(Datalogger_action_table[i].condition)
whismanoid 17:9397ea3ea7e9 8411 {
whismanoid 17:9397ea3ea7e9 8412 case condition_always:
whismanoid 17:9397ea3ea7e9 8413 cmdLine.serial().printf(" always");
whismanoid 17:9397ea3ea7e9 8414 break;
whismanoid 17:9397ea3ea7e9 8415 case condition_if_An_gt_threshold:
whismanoid 40:330b28116178 8416 cmdLine.serial().printf(" if A%d > %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 53:fdb510e3eb37 8417 cmdLine.serial().printf(" A%dgtX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8418 break;
whismanoid 17:9397ea3ea7e9 8419 case condition_if_An_lt_threshold:
whismanoid 40:330b28116178 8420 cmdLine.serial().printf(" if A%d < %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 53:fdb510e3eb37 8421 cmdLine.serial().printf(" A%dltX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8422 break;
whismanoid 17:9397ea3ea7e9 8423 case condition_if_An_eq_threshold:
whismanoid 40:330b28116178 8424 cmdLine.serial().printf(" if A%d == %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 53:fdb510e3eb37 8425 cmdLine.serial().printf(" A%deqX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8426 break;
whismanoid 17:9397ea3ea7e9 8427 case condition_if_An_ge_threshold:
whismanoid 40:330b28116178 8428 cmdLine.serial().printf(" if A%d >= %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 53:fdb510e3eb37 8429 cmdLine.serial().printf(" A%dgeX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8430 break;
whismanoid 17:9397ea3ea7e9 8431 case condition_if_An_le_threshold:
whismanoid 40:330b28116178 8432 cmdLine.serial().printf(" if A%d <= %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 53:fdb510e3eb37 8433 cmdLine.serial().printf(" A%dleX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8434 break;
whismanoid 17:9397ea3ea7e9 8435 case condition_if_An_ne_threshold:
whismanoid 40:330b28116178 8436 cmdLine.serial().printf(" if A%d != %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 53:fdb510e3eb37 8437 cmdLine.serial().printf(" A%dneX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8438 break;
whismanoid 17:9397ea3ea7e9 8439 case condition_if_AINn_gt_threshold:
whismanoid 40:330b28116178 8440 cmdLine.serial().printf(" if AIN%d > %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 53:fdb510e3eb37 8441 cmdLine.serial().printf(" AIN%dgtX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8442 break;
whismanoid 17:9397ea3ea7e9 8443 case condition_if_AINn_lt_threshold:
whismanoid 40:330b28116178 8444 cmdLine.serial().printf(" if AIN%d < %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 53:fdb510e3eb37 8445 cmdLine.serial().printf(" AIN%dleX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8446 break;
whismanoid 17:9397ea3ea7e9 8447 case condition_if_AINn_eq_threshold:
whismanoid 40:330b28116178 8448 cmdLine.serial().printf(" if AIN%d == %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 53:fdb510e3eb37 8449 cmdLine.serial().printf(" AIN%deqX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8450 break;
whismanoid 17:9397ea3ea7e9 8451 case condition_if_AINn_ge_threshold:
whismanoid 40:330b28116178 8452 cmdLine.serial().printf(" if AIN%d >= %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 53:fdb510e3eb37 8453 cmdLine.serial().printf(" AIN%dgeX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8454 break;
whismanoid 17:9397ea3ea7e9 8455 case condition_if_AINn_le_threshold:
whismanoid 40:330b28116178 8456 cmdLine.serial().printf(" if AIN%d <= %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 53:fdb510e3eb37 8457 cmdLine.serial().printf(" AIN%dleX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8458 break;
whismanoid 17:9397ea3ea7e9 8459 case condition_if_AINn_ne_threshold:
whismanoid 40:330b28116178 8460 cmdLine.serial().printf(" if AIN%d != %1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 53:fdb510e3eb37 8461 cmdLine.serial().printf(" AIN%dneX=%1.2f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 8462 break;
whismanoid 17:9397ea3ea7e9 8463 } // switch(Datalogger_action_table[i].condition)
whismanoid 17:9397ea3ea7e9 8464 } // for ...Datalogger_action_table_row_count // Print the contents of Datalogger_action_table
whismanoid 30:07197a430869 8465 cmdLine.serial().printf("\r\n\r\nEdit Log action table (used %d/%d, %d free):",
whismanoid 30:07197a430869 8466 Datalogger_action_table_row_count,
whismanoid 30:07197a430869 8467 ACTION_TABLE_ROW_MAX,
whismanoid 30:07197a430869 8468 (ACTION_TABLE_ROW_MAX - Datalogger_action_table_row_count)
whismanoid 30:07197a430869 8469 );
whismanoid 17:9397ea3ea7e9 8470 if (Datalogger_action_table_row_count < ACTION_TABLE_ROW_MAX) {
whismanoid 17:9397ea3ea7e9 8471 // if Datalogger_action_table_row_count => ACTION_TABLE_ROW_MAX then the table is full
whismanoid 17:9397ea3ea7e9 8472 cmdLine.serial().printf("\r\n L@+ act=4 if=1 ch=5 x=12345 -- add new entry at end of table");
whismanoid 17:9397ea3ea7e9 8473 }
whismanoid 17:9397ea3ea7e9 8474 if (Datalogger_action_table_row_count > 0) {
whismanoid 17:9397ea3ea7e9 8475 // if Datalogger_action_table_row_count == 0 then the table is empty
whismanoid 17:9397ea3ea7e9 8476 cmdLine.serial().printf("\r\n L@%d act=4 if=1 ch=5 x=12345 -- edit row %d",
whismanoid 17:9397ea3ea7e9 8477 Datalogger_action_table_row_count-1,
whismanoid 17:9397ea3ea7e9 8478 Datalogger_action_table_row_count-1);
whismanoid 17:9397ea3ea7e9 8479 cmdLine.serial().printf("\r\n L@-%d -- delete row %d",
whismanoid 17:9397ea3ea7e9 8480 Datalogger_action_table_row_count-1,
whismanoid 17:9397ea3ea7e9 8481 Datalogger_action_table_row_count-1);
whismanoid 17:9397ea3ea7e9 8482 cmdLine.serial().printf("\r\n L@-~~~ -- delete all rows");
whismanoid 30:07197a430869 8483 if (Datalogger_action_table_enabled) cmdLine.serial().printf("\r\n L@. -- pause entire Log action table");
whismanoid 30:07197a430869 8484 if (!Datalogger_action_table_enabled) cmdLine.serial().printf("\r\n L@@ -- enable Log action table");
whismanoid 17:9397ea3ea7e9 8485 }
whismanoid 17:9397ea3ea7e9 8486 //
whismanoid 17:9397ea3ea7e9 8487 } // case L@ -- configures Datalogger_action_table
whismanoid 17:9397ea3ea7e9 8488 break;
whismanoid 17:9397ea3ea7e9 8489 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 8490 // LR -- Datalog free run as fast as possible
whismanoid 4:d9b05924ad4c 8491 case 'R': case 'r':
whismanoid 4:d9b05924ad4c 8492 // free run as fast as possible
whismanoid 8:dffee7509bfb 8493 Datalogger_Trigger = trigger_FreeRun;
whismanoid 8:dffee7509bfb 8494 Datalogger_Need_PrintHeader = true;
whismanoid 4:d9b05924ad4c 8495 return; // instead of break; avoid falling through to print_command_prompt();
whismanoid 9:45f98573eb6d 8496 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 8497 // LS<channel ID><verb>: Configure SPI_AIN channels
whismanoid 9:45f98573eb6d 8498 // channel ID: 0,1,2,... or - for all channels
whismanoid 9:45f98573eb6d 8499 // verb: D for disable, V for Voltage, L for LSB
whismanoid 9:45f98573eb6d 8500 case 'S': case 's':
whismanoid 9:45f98573eb6d 8501 {
whismanoid 9:45f98573eb6d 8502 for (int channel_index = 0; channel_index < NUM_DUT_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 9:45f98573eb6d 8503 if ((cmdLine[2] == '-' /* all channels */)
whismanoid 9:45f98573eb6d 8504 || (cmdLine[2] == '0'+channel_index)
whismanoid 9:45f98573eb6d 8505 )
whismanoid 9:45f98573eb6d 8506 {
whismanoid 9:45f98573eb6d 8507 // it's me
whismanoid 55:477ba09475d7 8508 #if HAS_SPI_AIN_customChannelHeader
whismanoid 55:477ba09475d7 8509 // WIP Editable customChannelHeader strings #363 - LS__ header= -- update SPI_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 8510 // menu LS__ header=xyzzy -- custom channel header
whismanoid 55:477ba09475d7 8511 if (cmdLine.parse_and_remove_key("header",
whismanoid 55:477ba09475d7 8512 SPI_AIN_customChannelHeader_ch[channel_index],
whismanoid 55:477ba09475d7 8513 SPI_AIN_customChannelHeader_ch_MAXLENGTH))
whismanoid 55:477ba09475d7 8514 {
whismanoid 55:477ba09475d7 8515 cmdLine.serial().printf("\r\n LS%d%c header=%s", channel_index, cmdLine[3], SPI_AIN_customChannelHeader_ch[channel_index]);
whismanoid 55:477ba09475d7 8516 // SPI_AIN_customChannelHeader_ch[channel_index] was updated
whismanoid 55:477ba09475d7 8517 if (cmdLine[2] == '-' /* all channels */)
whismanoid 55:477ba09475d7 8518 { // LS-_ header= -- all channels custom header
whismanoid 55:477ba09475d7 8519 cmdLine.serial().printf("\r\n LS%c%c -- all channels", cmdLine[2], cmdLine[3]);
whismanoid 55:477ba09475d7 8520 for (int cx = 0; cx < NUM_DUT_ANALOG_IN_CHANNELS; cx++)
whismanoid 55:477ba09475d7 8521 {
whismanoid 55:477ba09475d7 8522 if (cx != channel_index)
whismanoid 55:477ba09475d7 8523 {
whismanoid 55:477ba09475d7 8524 // strncpy(char* dst, const char* src, size_t n)
whismanoid 55:477ba09475d7 8525 strncpy(SPI_AIN_customChannelHeader_ch[cx],
whismanoid 55:477ba09475d7 8526 SPI_AIN_customChannelHeader_ch[channel_index],
whismanoid 55:477ba09475d7 8527 SPI_AIN_customChannelHeader_MAXLENGTH);
whismanoid 55:477ba09475d7 8528 cmdLine.serial().printf("\r\n LS%d%c header=%s", cx, cmdLine[3], SPI_AIN_customChannelHeader_ch[cx]);
whismanoid 55:477ba09475d7 8529 }
whismanoid 55:477ba09475d7 8530 }
whismanoid 55:477ba09475d7 8531 }
whismanoid 55:477ba09475d7 8532 else
whismanoid 55:477ba09475d7 8533 {
whismanoid 55:477ba09475d7 8534 cmdLine.serial().printf("\r\n LS%c%c -- single channel", cmdLine[2], cmdLine[3]);
whismanoid 55:477ba09475d7 8535 }
whismanoid 55:477ba09475d7 8536 }
whismanoid 55:477ba09475d7 8537 #endif // HAS_SPI_AIN_customChannelHeader
whismanoid 9:45f98573eb6d 8538 // test cmdLine[3] to determine action
whismanoid 9:45f98573eb6d 8539 // Platform_Enable_ch[channel_index] = Platform_AIN_xxxxx;
whismanoid 9:45f98573eb6d 8540 switch (cmdLine[3])
whismanoid 9:45f98573eb6d 8541 {
whismanoid 9:45f98573eb6d 8542 case 'D': case 'd':
whismanoid 9:45f98573eb6d 8543 SPI_AIN_Enable_ch[channel_index] = SPI_AIN_Disable;
whismanoid 9:45f98573eb6d 8544 break;
whismanoid 9:45f98573eb6d 8545 case 'L': case 'l':
whismanoid 9:45f98573eb6d 8546 SPI_AIN_Enable_ch[channel_index] = SPI_AIN_Enable_LSB;
whismanoid 9:45f98573eb6d 8547 break;
whismanoid 9:45f98573eb6d 8548 case 'V': case 'v':
whismanoid 9:45f98573eb6d 8549 SPI_AIN_Enable_ch[channel_index] = SPI_AIN_Enable_Volt;
whismanoid 9:45f98573eb6d 8550 break;
whismanoid 9:45f98573eb6d 8551 //
whismanoid 55:477ba09475d7 8552 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 8553 // MAX40108 Datalog Math #362 -- menu LS_M_ SPI_AIN Math channels configuration SPI_AIN_MATH
whismanoid 55:477ba09475d7 8554 case 'M': case 'm':
whismanoid 55:477ba09475d7 8555 switch (cmdLine[4])
whismanoid 55:477ba09475d7 8556 {
whismanoid 55:477ba09475d7 8557 case 'D': case 'd':
whismanoid 55:477ba09475d7 8558 SPI_AIN_Enable_Math_ch[channel_index] = Platform_AIN_Disable;
whismanoid 55:477ba09475d7 8559 break;
whismanoid 55:477ba09475d7 8560 case 'L': case 'l':
whismanoid 55:477ba09475d7 8561 SPI_AIN_Enable_Math_ch[channel_index] = Platform_AIN_Enable_LSB;
whismanoid 55:477ba09475d7 8562 break;
whismanoid 55:477ba09475d7 8563 case 'V': case 'v':
whismanoid 55:477ba09475d7 8564 SPI_AIN_Enable_Math_ch[channel_index] = Platform_AIN_Enable_Volt;
whismanoid 55:477ba09475d7 8565 break;
whismanoid 55:477ba09475d7 8566 default:
whismanoid 55:477ba09475d7 8567 SPI_AIN_Enable_ch[channel_index] = Platform_AIN_Enable_Math_Volt;
whismanoid 55:477ba09475d7 8568 break;
whismanoid 55:477ba09475d7 8569 }
whismanoid 55:477ba09475d7 8570 //
whismanoid 55:477ba09475d7 8571 // MAX40108 Datalog Math #362 -- menu LS_M_ parse mul=? update SPI_AIN_MathGainMulA[ch] SPI_AIN_MATH
whismanoid 55:477ba09475d7 8572 cmdLine.parse_double("mul", SPI_AIN_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 8573 //
whismanoid 55:477ba09475d7 8574 // MAX40108 Datalog Math #362 -- menu LS_M_ parse div=? update SPI_AIN_MathGainDivA[ch] SPI_AIN_MATH
whismanoid 55:477ba09475d7 8575 cmdLine.parse_double("div", SPI_AIN_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 8576 //
whismanoid 55:477ba09475d7 8577 // MAX40108 Datalog Math #362 -- menu LS_M_ parse unit=nA update SPI_AIN_MathUnitString[ch] SPI_AIN_MATH
whismanoid 55:477ba09475d7 8578 // cmdLine.parse_key("unit", SPI_AIN_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 8579 // WIP Editable customChannelHeader strings #363 - LS_M unit= -- update SPI_AIN_MathUnitString
whismanoid 55:477ba09475d7 8580 if (cmdLine.parse_and_remove_key("unit",
whismanoid 55:477ba09475d7 8581 SPI_AIN_MathUnitString[channel_index],
whismanoid 55:477ba09475d7 8582 SPI_AIN_MathUnitString_MAXLENGTH))
whismanoid 55:477ba09475d7 8583 {
whismanoid 55:477ba09475d7 8584 // SPI_AIN_MathUnitString[channel_index] was updated
whismanoid 55:477ba09475d7 8585 }
whismanoid 55:477ba09475d7 8586 //
whismanoid 55:477ba09475d7 8587 // MAX40108 Datalog Math #362 -- menu LS_M_ parse o=? update SPI_AIN_MathOffsetA[ch] SPI_AIN_MATH
whismanoid 55:477ba09475d7 8588 // parse o=? last, otherwise can't have unit string with letter "o" in it due to conflict...
whismanoid 55:477ba09475d7 8589 cmdLine.parse_double("o", SPI_AIN_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 8590 //
whismanoid 55:477ba09475d7 8591 // MAX40108 Datalog Math #362 -- menu LS_M_ always print the values of o=? mul=? div=? unit=nA SPI_AIN_MATH
whismanoid 55:477ba09475d7 8592 cmdLine.serial().printf("\r\n", channel_index);
whismanoid 55:477ba09475d7 8593 // if (cmdLine[2] == '-' /* all channels */) {
whismanoid 55:477ba09475d7 8594 cmdLine.serial().printf("LS%dM", channel_index);
whismanoid 55:477ba09475d7 8595 // }
whismanoid 55:477ba09475d7 8596 cmdLine.serial().printf(" o=%6.6f", SPI_AIN_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 8597 cmdLine.serial().printf(" mul=%6.6f", SPI_AIN_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 8598 cmdLine.serial().printf(" div=%6.6f", SPI_AIN_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 8599 cmdLine.serial().printf(" unit=%s", SPI_AIN_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 8600 //
whismanoid 55:477ba09475d7 8601 break;
whismanoid 55:477ba09475d7 8602 // MAX40108 Datalog Math #362 -- menu LS_M_ SPI_AIN Math channels configuration SPI_AIN_MATH
whismanoid 55:477ba09475d7 8603 #endif // SPI_AIN_MATH
whismanoid 9:45f98573eb6d 8604 //
whismanoid 9:45f98573eb6d 8605 // TODO: MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 9:45f98573eb6d 8606 case 'C': case 'c':
whismanoid 9:45f98573eb6d 8607 {
whismanoid 9:45f98573eb6d 8608 uint8_t hexValue = 0;
whismanoid 9:45f98573eb6d 8609 hexValue = hexValueOfChar(cmdLine[5]) * 0x10 + hexValueOfChar(cmdLine[6]);
whismanoid 9:45f98573eb6d 8610 switch (cmdLine[4])
whismanoid 9:45f98573eb6d 8611 {
whismanoid 9:45f98573eb6d 8612 //
whismanoid 9:45f98573eb6d 8613 // MAX11410 verb for configuring SPI_AIN_Cfg_v_filter_ch[channel_index]
whismanoid 9:45f98573eb6d 8614 // cmdLine.serial().print(F("\r\n LS-CF34 -- Datalog SPI ADC channel '-'(all) v_filter 0x34"));
whismanoid 9:45f98573eb6d 8615 case 'F': case 'f':
whismanoid 9:45f98573eb6d 8616 SPI_AIN_Cfg_v_filter_ch[channel_index] = hexValue;
whismanoid 9:45f98573eb6d 8617 break;
whismanoid 9:45f98573eb6d 8618 //
whismanoid 9:45f98573eb6d 8619 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 9:45f98573eb6d 8620 // cmdLine.serial().print(F("\r\n LS-CC42 -- Datalog SPI ADC channel '-'(all) v_ctrl 0x42"));
whismanoid 9:45f98573eb6d 8621 case 'C': case 'c':
whismanoid 9:45f98573eb6d 8622 SPI_AIN_Cfg_v_ctrl_ch[channel_index] = hexValue;
whismanoid 9:45f98573eb6d 8623 break;
whismanoid 9:45f98573eb6d 8624 //
whismanoid 9:45f98573eb6d 8625 // MAX11410 verb for configuring SPI_AIN_Cfg_v_pga_ch[channel_index]
whismanoid 9:45f98573eb6d 8626 // cmdLine.serial().print(F("\r\n LS-CP00 -- Datalog SPI ADC channel '-'(all) v_pga 0x00"));
whismanoid 9:45f98573eb6d 8627 case 'P': case 'p':
whismanoid 9:45f98573eb6d 8628 SPI_AIN_Cfg_v_pga_ch[channel_index] = hexValue;
whismanoid 9:45f98573eb6d 8629 break;
whismanoid 9:45f98573eb6d 8630 //
whismanoid 9:45f98573eb6d 8631 // cmdLine.serial().print(F("\r\n LS5CU -- Datalog SPI ADC channel channel 5 v_ctrl Unipolar"));
whismanoid 9:45f98573eb6d 8632 // ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) ? "BIPOLAR" : "Unipolar"
whismanoid 9:45f98573eb6d 8633 case 'U': case 'u':
whismanoid 9:45f98573eb6d 8634 SPI_AIN_Cfg_v_ctrl_ch[channel_index] = SPI_AIN_Cfg_v_ctrl_ch[channel_index] | 0x40;
whismanoid 9:45f98573eb6d 8635 break;
whismanoid 9:45f98573eb6d 8636 //
whismanoid 9:45f98573eb6d 8637 // cmdLine.serial().print(F("\r\n LS5CB -- Datalog SPI ADC channel channel 5 v_ctrl Bipolar"));
whismanoid 9:45f98573eb6d 8638 // ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) ? "BIPOLAR" : "Unipolar"
whismanoid 9:45f98573eb6d 8639 case 'B': case 'b':
whismanoid 9:45f98573eb6d 8640 SPI_AIN_Cfg_v_ctrl_ch[channel_index] = SPI_AIN_Cfg_v_ctrl_ch[channel_index] &~ 0x40;
whismanoid 9:45f98573eb6d 8641 break;
whismanoid 9:45f98573eb6d 8642 }
whismanoid 9:45f98573eb6d 8643 break;
whismanoid 9:45f98573eb6d 8644 }
whismanoid 9:45f98573eb6d 8645 //
whismanoid 9:45f98573eb6d 8646 //
whismanoid 9:45f98573eb6d 8647 }
whismanoid 9:45f98573eb6d 8648 } // end if cmdLine[2] channel_index
whismanoid 9:45f98573eb6d 8649 } // end for channel_index
whismanoid 9:45f98573eb6d 8650 Datalogger_PrintHeader();
whismanoid 9:45f98573eb6d 8651 Datalogger_Need_PrintHeader = true;
whismanoid 9:45f98573eb6d 8652 }
whismanoid 9:45f98573eb6d 8653 break;
whismanoid 9:45f98573eb6d 8654 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 8655 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 9:45f98573eb6d 8656 // LA<channel ID><verb>: Configure Platform_AIN channels
whismanoid 9:45f98573eb6d 8657 // channel ID: 0,1,2,... or - for all channels
whismanoid 9:45f98573eb6d 8658 // verb: D for disable, V for Voltage, L for LSB
whismanoid 8:dffee7509bfb 8659 case 'A': case 'a':
whismanoid 9:45f98573eb6d 8660 {
whismanoid 9:45f98573eb6d 8661 // all-channel: loop through all valid channel_index, test cmdLine[2] 'is it me'?
whismanoid 9:45f98573eb6d 8662 // for channel_index loop through 0..NUM_DUT_ANALOG_IN_CHANNELS
whismanoid 9:45f98573eb6d 8663 // if ((cmdLine[2] == '-' /* all channels */)
whismanoid 9:45f98573eb6d 8664 // || (cmdLine[2] == '0'+channel_index)
whismanoid 9:45f98573eb6d 8665 // ) {
whismanoid 9:45f98573eb6d 8666 // // it's me
whismanoid 9:45f98573eb6d 8667 // // test cmdLine[3] to determine action
whismanoid 9:45f98573eb6d 8668 // // Platform_Enable_ch[channel_index] = Platform_AIN_xxxxx;
whismanoid 9:45f98573eb6d 8669 // } end if cmdLine[2] channel_index
whismanoid 9:45f98573eb6d 8670 // } end for channel_index
whismanoid 9:45f98573eb6d 8671 for (int channel_index = 0; channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 9:45f98573eb6d 8672 if ((cmdLine[2] == '-' /* all channels */)
whismanoid 9:45f98573eb6d 8673 || (cmdLine[2] == '0'+channel_index)
whismanoid 9:45f98573eb6d 8674 )
whismanoid 9:45f98573eb6d 8675 {
whismanoid 9:45f98573eb6d 8676 // it's me
whismanoid 55:477ba09475d7 8677 #if HAS_Platform_AIN_customChannelHeader
whismanoid 55:477ba09475d7 8678 // WIP Editable customChannelHeader strings #363 - LA__ header= -- update Platform_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 8679 // menu LA__ header=xyzzy -- custom channel header
whismanoid 55:477ba09475d7 8680 if (cmdLine.parse_and_remove_key("header",
whismanoid 55:477ba09475d7 8681 Platform_AIN_customChannelHeader_ch[channel_index],
whismanoid 55:477ba09475d7 8682 Platform_AIN_customChannelHeader_MAXLENGTH))
whismanoid 55:477ba09475d7 8683 {
whismanoid 55:477ba09475d7 8684 cmdLine.serial().printf("\r\n LA%d%c header=%s", channel_index, cmdLine[3], Platform_AIN_customChannelHeader_ch[channel_index]);
whismanoid 55:477ba09475d7 8685 // Platform_AIN_customChannelHeader_ch[channel_index] was updated
whismanoid 55:477ba09475d7 8686 if (cmdLine[2] == '-' /* all channels */)
whismanoid 55:477ba09475d7 8687 { // LA-_ header= -- all channels custom header
whismanoid 55:477ba09475d7 8688 cmdLine.serial().printf("\r\n LA%c%c -- all channels", cmdLine[2], cmdLine[3]);
whismanoid 55:477ba09475d7 8689 for (int cx = 0; cx < NUM_PLATFORM_ANALOG_IN_CHANNELS; cx++)
whismanoid 55:477ba09475d7 8690 {
whismanoid 55:477ba09475d7 8691 if (cx != channel_index)
whismanoid 55:477ba09475d7 8692 {
whismanoid 55:477ba09475d7 8693 // strncpy(char* dst, const char* src, size_t n)
whismanoid 55:477ba09475d7 8694 strncpy(Platform_AIN_customChannelHeader_ch[cx],
whismanoid 55:477ba09475d7 8695 Platform_AIN_customChannelHeader_ch[channel_index],
whismanoid 55:477ba09475d7 8696 Platform_AIN_customChannelHeader_MAXLENGTH);
whismanoid 55:477ba09475d7 8697 cmdLine.serial().printf("\r\n LA%d%c header=%s", cx, cmdLine[3], Platform_AIN_customChannelHeader_ch[cx]);
whismanoid 55:477ba09475d7 8698 }
whismanoid 55:477ba09475d7 8699 }
whismanoid 55:477ba09475d7 8700 }
whismanoid 55:477ba09475d7 8701 else
whismanoid 55:477ba09475d7 8702 {
whismanoid 55:477ba09475d7 8703 cmdLine.serial().printf("\r\n LA%c%c -- single channel", cmdLine[2], cmdLine[3]);
whismanoid 55:477ba09475d7 8704 }
whismanoid 55:477ba09475d7 8705 }
whismanoid 55:477ba09475d7 8706 #endif // HAS_Platform_AIN_customChannelHeader
whismanoid 9:45f98573eb6d 8707 // test cmdLine[3] to determine action
whismanoid 9:45f98573eb6d 8708 // Platform_Enable_ch[channel_index] = Platform_AIN_xxxxx;
whismanoid 9:45f98573eb6d 8709 switch (cmdLine[3])
whismanoid 9:45f98573eb6d 8710 {
whismanoid 9:45f98573eb6d 8711 case 'D': case 'd':
whismanoid 9:45f98573eb6d 8712 Platform_Enable_ch[channel_index] = Platform_AIN_Disable;
whismanoid 9:45f98573eb6d 8713 break;
whismanoid 9:45f98573eb6d 8714 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 8715 case 'L': case 'l':
whismanoid 9:45f98573eb6d 8716 Platform_Enable_ch[channel_index] = Platform_AIN_Enable_LSB;
whismanoid 9:45f98573eb6d 8717 break;
whismanoid 9:45f98573eb6d 8718 #endif // LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 8719 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 9:45f98573eb6d 8720 case 'V': case 'v':
whismanoid 9:45f98573eb6d 8721 Platform_Enable_ch[channel_index] = Platform_AIN_Enable_Volt;
whismanoid 9:45f98573eb6d 8722 break;
whismanoid 9:45f98573eb6d 8723 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 55:477ba09475d7 8724 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8725 // MAX40108 Datalog Math #362 -- menu LA_M_ Platform_AIN Math channels configuration PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8726 case 'M': case 'm':
whismanoid 55:477ba09475d7 8727 switch (cmdLine[4])
whismanoid 55:477ba09475d7 8728 {
whismanoid 55:477ba09475d7 8729 case 'D': case 'd':
whismanoid 55:477ba09475d7 8730 Platform_Enable_Math_ch[channel_index] = Platform_AIN_Disable;
whismanoid 55:477ba09475d7 8731 break;
whismanoid 55:477ba09475d7 8732 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 55:477ba09475d7 8733 case 'L': case 'l':
whismanoid 55:477ba09475d7 8734 Platform_Enable_Math_ch[channel_index] = Platform_AIN_Enable_LSB;
whismanoid 55:477ba09475d7 8735 break;
whismanoid 55:477ba09475d7 8736 #endif // LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 55:477ba09475d7 8737 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 55:477ba09475d7 8738 case 'V': case 'v':
whismanoid 55:477ba09475d7 8739 Platform_Enable_Math_ch[channel_index] = Platform_AIN_Enable_Volt;
whismanoid 55:477ba09475d7 8740 break;
whismanoid 55:477ba09475d7 8741 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 55:477ba09475d7 8742 default:
whismanoid 55:477ba09475d7 8743 Platform_Enable_ch[channel_index] = Platform_AIN_Enable_Math_Volt;
whismanoid 55:477ba09475d7 8744 break;
whismanoid 55:477ba09475d7 8745 }
whismanoid 55:477ba09475d7 8746 //
whismanoid 55:477ba09475d7 8747 // MAX40108 Datalog Math #362 -- menu LA_M_ parse mul=? update Platform_MathGainMulA[ch] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8748 cmdLine.parse_double("mul", Platform_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 8749 //
whismanoid 55:477ba09475d7 8750 // MAX40108 Datalog Math #362 -- menu LA_M_ parse div=? update Platform_MathGainDivA[ch] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8751 cmdLine.parse_double("div", Platform_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 8752 //
whismanoid 55:477ba09475d7 8753 // MAX40108 Datalog Math #362 -- menu LA_M_ parse unit=nA update Platform_MathUnitString[ch] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8754 // WIP Editable customChannelHeader strings #363 - LA_M unit= -- update Platform_MathUnitString
whismanoid 55:477ba09475d7 8755 if (cmdLine.parse_and_remove_key("unit",
whismanoid 55:477ba09475d7 8756 Platform_MathUnitString[channel_index],
whismanoid 55:477ba09475d7 8757 Platform_MathUnitString_MAXLENGTH))
whismanoid 55:477ba09475d7 8758 {
whismanoid 55:477ba09475d7 8759 // Platform_MathUnitString[channel_index] was updated
whismanoid 55:477ba09475d7 8760 }
whismanoid 55:477ba09475d7 8761 //
whismanoid 55:477ba09475d7 8762 // MAX40108 Datalog Math #362 -- menu LA_M_ parse o=? update Platform_MathOffsetA[ch] PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8763 // parse o=? last, otherwise can't have unit string with letter "o" in it due to conflict...
whismanoid 55:477ba09475d7 8764 cmdLine.parse_double("o", Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 8765 //
whismanoid 55:477ba09475d7 8766 // MAX40108 Datalog Math #362 -- menu LA_M_ always print the values of o=? mul=? div=? unit=nA PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8767 cmdLine.serial().printf("\r\n");
whismanoid 55:477ba09475d7 8768 // if (cmdLine[2] == '-' /* all channels */) {
whismanoid 55:477ba09475d7 8769 cmdLine.serial().printf("LA%dM", channel_index);
whismanoid 55:477ba09475d7 8770 // }
whismanoid 55:477ba09475d7 8771 cmdLine.serial().printf(" o=%6.6f", Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 8772 cmdLine.serial().printf(" mul=%6.6f", Platform_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 8773 cmdLine.serial().printf(" div=%6.6f", Platform_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 8774 cmdLine.serial().printf(" unit=%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 8775 #if HAS_Platform_AIN_customChannelHeader
whismanoid 55:477ba09475d7 8776 cmdLine.serial().printf(" header=%s", Platform_AIN_customChannelHeader_ch[channel_index]);
whismanoid 55:477ba09475d7 8777 #endif // HAS_Platform_AIN_customChannelHeader
whismanoid 55:477ba09475d7 8778 //
whismanoid 55:477ba09475d7 8779 break;
whismanoid 55:477ba09475d7 8780 // MAX40108 Datalog Math #362 -- menu LA_M_ Platform_AIN Math channels configuration PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8781 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8782 //
whismanoid 9:45f98573eb6d 8783 }
whismanoid 9:45f98573eb6d 8784 } // end if cmdLine[2] channel_index
whismanoid 9:45f98573eb6d 8785 } // end for channel_index
whismanoid 10:04022a61b527 8786 // Datalogger_PrintHeader(cmdLine);
whismanoid 9:45f98573eb6d 8787 if (Datalogger_enable_serial) {
whismanoid 9:45f98573eb6d 8788 Datalogger_PrintHeader(cmdLine);
whismanoid 9:45f98573eb6d 8789 }
whismanoid 9:45f98573eb6d 8790 # if HAS_AUX_SERIAL
whismanoid 9:45f98573eb6d 8791 if (Datalogger_enable_AUXserial) {
whismanoid 9:45f98573eb6d 8792 Datalogger_PrintHeader(cmdLine_AUXserial);
whismanoid 9:45f98573eb6d 8793 }
whismanoid 9:45f98573eb6d 8794 # endif // HAS_AUX_SERIAL
whismanoid 9:45f98573eb6d 8795 # if HAS_DAPLINK_SERIAL
whismanoid 9:45f98573eb6d 8796 if (Datalogger_enable_DAPLINKserial) {
whismanoid 9:45f98573eb6d 8797 Datalogger_PrintHeader(cmdLine_DAPLINKserial);
whismanoid 9:45f98573eb6d 8798 }
whismanoid 9:45f98573eb6d 8799 # endif // HAS_DAPLINK_SERIAL
whismanoid 9:45f98573eb6d 8800 Datalogger_Need_PrintHeader = true;
whismanoid 9:45f98573eb6d 8801 }
whismanoid 8:dffee7509bfb 8802 break;
whismanoid 9:45f98573eb6d 8803 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 9:45f98573eb6d 8804 case '>':
whismanoid 9:45f98573eb6d 8805 // L>A -- Datalogger_enable_AUXserial
whismanoid 9:45f98573eb6d 8806 // L>D -- Datalogger_enable_DAPLINKserial
whismanoid 9:45f98573eb6d 8807 // L>S -- Datalogger_enable_serial
whismanoid 9:45f98573eb6d 8808 switch (cmdLine[2])
whismanoid 9:45f98573eb6d 8809 {
whismanoid 9:45f98573eb6d 8810 # if HAS_AUX_SERIAL
whismanoid 9:45f98573eb6d 8811 case 'A': case 'a':
whismanoid 9:45f98573eb6d 8812 Datalogger_enable_AUXserial = !Datalogger_enable_AUXserial;
whismanoid 9:45f98573eb6d 8813 Datalogger_Need_PrintHeader = true;
whismanoid 9:45f98573eb6d 8814 break;
whismanoid 8:dffee7509bfb 8815 # endif // HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 8816 # if HAS_DAPLINK_SERIAL
whismanoid 9:45f98573eb6d 8817 case 'D': case 'd':
whismanoid 9:45f98573eb6d 8818 Datalogger_enable_DAPLINKserial = !Datalogger_enable_DAPLINKserial;
whismanoid 9:45f98573eb6d 8819 Datalogger_Need_PrintHeader = true;
whismanoid 9:45f98573eb6d 8820 break;
whismanoid 8:dffee7509bfb 8821 # endif // HAS_DAPLINK_SERIAL
whismanoid 9:45f98573eb6d 8822 case 'S': case 's':
whismanoid 9:45f98573eb6d 8823 Datalogger_enable_serial = !Datalogger_enable_serial;
whismanoid 9:45f98573eb6d 8824 Datalogger_Need_PrintHeader = true;
whismanoid 9:45f98573eb6d 8825 break;
whismanoid 9:45f98573eb6d 8826 }
whismanoid 9:45f98573eb6d 8827 break; // case '>' L>S serial enable toggle
whismanoid 28:a9a3a9db592b 8828 default:
whismanoid 28:a9a3a9db592b 8829 // TODO: L -- detailed help for datalog commands
whismanoid 28:a9a3a9db592b 8830 //
whismanoid 28:a9a3a9db592b 8831 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 28:a9a3a9db592b 8832 #if 1 // USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 8833 // Datalogger_Trigger = trigger_FreeRun // free run as fast as possible "always-on mode"
whismanoid 28:a9a3a9db592b 8834 cmdLine.serial().printf("\r\n LR -- Datalog free run as fast as possible");
whismanoid 28:a9a3a9db592b 8835 //
whismanoid 28:a9a3a9db592b 8836 // Datalogger_Trigger = trigger_Timer // timer (configure interval) "intermittent-sleep-mode"
whismanoid 28:a9a3a9db592b 8837 //~ cmdLine.serial().printf("\r\n LT -- Datalog timer"); // trigger_Timer
whismanoid 39:4d285e961435 8838 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 8839 // USE_DATALOGGER_SLEEP -- support sleep modes in Datalogger_Trigger
whismanoid 39:4d285e961435 8840 cmdLine.serial().printf("\r\n LT count=%d base=%dms sleep=%d -- Datalog timer",
whismanoid 39:4d285e961435 8841 g_timer_interval_count,
whismanoid 39:4d285e961435 8842 g_timer_interval_msec,
whismanoid 39:4d285e961435 8843 (int)g_timer_sleepmode
whismanoid 39:4d285e961435 8844 ); // trigger_Timer
whismanoid 39:4d285e961435 8845 #else // USE_DATALOGGER_SLEEP
whismanoid 28:a9a3a9db592b 8846 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 8847 #endif // USE_DATALOGGER_SLEEP
whismanoid 28:a9a3a9db592b 8848 //
whismanoid 28:a9a3a9db592b 8849 // TODO: Datalogger_Trigger = trigger_PlatformDigitalInput // platform digital input (configure digital input pin reference)
whismanoid 28:a9a3a9db592b 8850 //~ cmdLine.serial().printf("\r\n LI -- Datalog _______"); // trigger_PlatformDigitalInput
whismanoid 28:a9a3a9db592b 8851 // TODO: cmdLine.serial().printf("\r\n LIH3 -- Datalog when input high D3"); // trigger_PlatformDigitalInput
whismanoid 28:a9a3a9db592b 8852 // TODO: cmdLine.serial().printf("\r\n LIL6 -- Datalog when input low D6"); // trigger_PlatformDigitalInput
whismanoid 28:a9a3a9db592b 8853 //
whismanoid 28:a9a3a9db592b 8854 #if USE_DATALOGGER_SPIDeviceRegRead
whismanoid 28:a9a3a9db592b 8855 // TODO: Datalogger_Trigger = trigger_SPIDeviceRegRead // SPI device register read (configure regaddr, mask value, match value)
whismanoid 28:a9a3a9db592b 8856 //~ cmdLine.serial().printf("\r\n L$ -- Datalog _______"); // trigger_SPIDeviceRegRead
whismanoid 28:a9a3a9db592b 8857 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 8858 #endif // USE_DATALOGGER_SPIDeviceRegRead
whismanoid 28:a9a3a9db592b 8859 //
whismanoid 28:a9a3a9db592b 8860 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 28:a9a3a9db592b 8861 cmdLine.serial().printf("\r\n L@ -- configures Datalogger_action_table; show more commands");
whismanoid 28:a9a3a9db592b 8862 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 28:a9a3a9db592b 8863 //
whismanoid 28:a9a3a9db592b 8864 //
whismanoid 28:a9a3a9db592b 8865 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 28:a9a3a9db592b 8866 // LS<channel ID><verb>: Configure SPI_AIN channels
whismanoid 28:a9a3a9db592b 8867 // channel ID: 0,1,2,... or - for all channels
whismanoid 28:a9a3a9db592b 8868 // verb: D for disable, V for Voltage, L for LSB
whismanoid 28:a9a3a9db592b 8869 cmdLine.serial().printf("\r\n LS-D -- Datalog SPI ADC channel '-'(all) Disable");
whismanoid 28:a9a3a9db592b 8870 cmdLine.serial().printf("\r\n LS-V -- Datalog SPI ADC channel '-'(all) Volt");
whismanoid 28:a9a3a9db592b 8871 cmdLine.serial().printf("\r\n LS-L -- Datalog SPI ADC channel '-'(all) LSB");
whismanoid 28:a9a3a9db592b 8872 cmdLine.serial().printf("\r\n LS2D -- Datalog SPI ADC channel channel 2 Disable");
whismanoid 28:a9a3a9db592b 8873 cmdLine.serial().printf("\r\n LS3V -- Datalog SPI ADC channel channel 3 Volt");
whismanoid 28:a9a3a9db592b 8874 cmdLine.serial().printf("\r\n LS4L -- Datalog SPI ADC channel channel 4 LSB");
whismanoid 28:a9a3a9db592b 8875 //
whismanoid 55:477ba09475d7 8876 // 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 8877 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 8878 cmdLine.serial().printf("\r\n LS2M o=? mul=? div=? unit=nA -- math (AIN2V+o)*mul/div");
whismanoid 55:477ba09475d7 8879 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 8880 // WIP Editable customChannelHeader strings #363 -- menu L expanded help menu LA__ header=xyzzy
whismanoid 55:477ba09475d7 8881 #if HAS_SPI_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 8882 cmdLine.serial().printf("\r\n LS- header=xyzzy -- custom per-channel header suffix");
whismanoid 55:477ba09475d7 8883 #endif // HAS_SPI_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 8884 //
whismanoid 28:a9a3a9db592b 8885 // MAX11410 verb for configuring SPI_AIN_Cfg_v_filter_ch[channel_index]
whismanoid 28:a9a3a9db592b 8886 // cmdLine.serial().print(F("\r\n LS-CF34 -- Datalog SPI ADC channel channel 5 v_filter 0x34"));
whismanoid 28:a9a3a9db592b 8887 cmdLine.serial().printf("\r\n LS-CF34 -- Datalog SPI ADC channel '-'(all) v_filter 0x34");
whismanoid 28:a9a3a9db592b 8888 //
whismanoid 28:a9a3a9db592b 8889 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 28:a9a3a9db592b 8890 // cmdLine.serial().print(F("\r\n LS-CC42 -- Datalog SPI ADC channel '-'(all) v_ctrl 0x42"));
whismanoid 28:a9a3a9db592b 8891 cmdLine.serial().printf("\r\n LS-CC42 -- Datalog SPI ADC channel '-'(all) v_ctrl 0x42");
whismanoid 28:a9a3a9db592b 8892 //
whismanoid 28:a9a3a9db592b 8893 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 28:a9a3a9db592b 8894 // cmdLine.serial().print(F("\r\n LS5___ -- Datalog SPI ADC channel channel 5 v_ctrl"));
whismanoid 28:a9a3a9db592b 8895 // MAX11410 verb for configuring SPI_AIN_Cfg_v_ctrl_ch[channel_index]
whismanoid 28:a9a3a9db592b 8896 cmdLine.serial().printf("\r\n LS5CU -- Datalog SPI ADC channel channel 5 v_ctrl Unipolar");
whismanoid 28:a9a3a9db592b 8897 // ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) ? "BIPOLAR" : "Unipolar"
whismanoid 28:a9a3a9db592b 8898 cmdLine.serial().printf("\r\n LS5CB -- Datalog SPI ADC channel channel 5 v_ctrl Bipolar");
whismanoid 28:a9a3a9db592b 8899 // ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) ? "BIPOLAR" : "Unipolar"
whismanoid 28:a9a3a9db592b 8900 //
whismanoid 28:a9a3a9db592b 8901 // MAX11410 verb for configuring SPI_AIN_Cfg_v_pga_ch[channel_index]
whismanoid 28:a9a3a9db592b 8902 // cmdLine.serial().print(F("\r\n LS5CP00 -- Datalog SPI ADC channel channel 5 v_pga 0x00"));
whismanoid 28:a9a3a9db592b 8903 cmdLine.serial().printf("\r\n LS-CP00 -- Datalog SPI ADC channel '-'(all) v_pga 0x00");
whismanoid 28:a9a3a9db592b 8904 //
whismanoid 55:477ba09475d7 8905 //
whismanoid 28:a9a3a9db592b 8906 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 28:a9a3a9db592b 8907 //
whismanoid 28:a9a3a9db592b 8908 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 28:a9a3a9db592b 8909 // LA<channel ID><verb>: Configure Platform_AIN channels
whismanoid 28:a9a3a9db592b 8910 // channel ID: 0,1,2,... or - for all channels
whismanoid 28:a9a3a9db592b 8911 // verb: D for disable, V for Voltage, L for LSB
whismanoid 28:a9a3a9db592b 8912 cmdLine.serial().printf("\r\n LA-D -- Datalog Platform-AIN all-channel Disable");
whismanoid 28:a9a3a9db592b 8913 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 28:a9a3a9db592b 8914 cmdLine.serial().printf("\r\n LA-V -- Datalog Platform-AIN all-channel Volt");
whismanoid 28:a9a3a9db592b 8915 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 28:a9a3a9db592b 8916 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 28:a9a3a9db592b 8917 cmdLine.serial().printf("\r\n LA-L -- Datalog Platform-AIN all-channel LSB");
whismanoid 28:a9a3a9db592b 8918 #endif // LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 28:a9a3a9db592b 8919 cmdLine.serial().printf("\r\n LA2D -- Datalog Platform-AIN channel 2 Disable");
whismanoid 28:a9a3a9db592b 8920 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 28:a9a3a9db592b 8921 cmdLine.serial().printf("\r\n LA3V -- Datalog Platform-AIN channel 3 Volt");
whismanoid 28:a9a3a9db592b 8922 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 28:a9a3a9db592b 8923 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 28:a9a3a9db592b 8924 cmdLine.serial().printf("\r\n LA4L -- Datalog Platform-AIN channel 4 LSB");
whismanoid 28:a9a3a9db592b 8925 #endif // LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 55:477ba09475d7 8926 // 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 8927 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8928 cmdLine.serial().printf("\r\n LA2M o=? mul=? div=? unit=nA -- math (AIN2V+o)*mul/div");
whismanoid 55:477ba09475d7 8929 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 8930 // WIP Editable customChannelHeader strings #363 -- menu L expanded help menu LA__ header=xyzzy
whismanoid 55:477ba09475d7 8931 #if HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 8932 cmdLine.serial().printf("\r\n LA- header=xyzzy -- custom per-channel header suffix");
whismanoid 55:477ba09475d7 8933 #endif // HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 8934 //
whismanoid 28:a9a3a9db592b 8935 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 28:a9a3a9db592b 8936 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 28:a9a3a9db592b 8937 # if HAS_AUX_SERIAL
whismanoid 28:a9a3a9db592b 8938 cmdLine.serial().printf("\r\n L>A -- Datalogger_enable_AUXserial %s", (Datalogger_enable_AUXserial?"disable":"enable"));
whismanoid 28:a9a3a9db592b 8939 # endif // HAS_AUX_SERIAL
whismanoid 28:a9a3a9db592b 8940 # if HAS_DAPLINK_SERIAL
whismanoid 28:a9a3a9db592b 8941 cmdLine.serial().printf("\r\n L>D -- Datalogger_enable_DAPLINKserial %s", (Datalogger_enable_DAPLINKserial?"disable":"enable"));
whismanoid 28:a9a3a9db592b 8942 # endif // HAS_DAPLINK_SERIAL
whismanoid 28:a9a3a9db592b 8943 cmdLine.serial().printf("\r\n L>S -- Datalogger_enable_serial %s", (Datalogger_enable_serial?"disable":"enable"));
whismanoid 28:a9a3a9db592b 8944 //
whismanoid 28:a9a3a9db592b 8945 #else // USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 8946 #endif // USE_DATALOGGER_TRIGGER_HELP_BRIEF
whismanoid 28:a9a3a9db592b 8947 break;
whismanoid 17:9397ea3ea7e9 8948 } // switch (cmdLine[1]) inside case 'L'
whismanoid 4:d9b05924ad4c 8949 }
whismanoid 4:d9b05924ad4c 8950 break; // case 'L'
whismanoid 4:d9b05924ad4c 8951 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 4:d9b05924ad4c 8952 //
whismanoid 4:d9b05924ad4c 8953 // Application-specific commands here
whismanoid 4:d9b05924ad4c 8954 // alphanumeric command codes A-Z,a-z,0-9 reserved for application use
whismanoid 4:d9b05924ad4c 8955 //
whismanoid 4:d9b05924ad4c 8956 #if APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 8957 #endif // APPLICATION_ArduinoPinsMonitor
whismanoid 4:d9b05924ad4c 8958
whismanoid 4:d9b05924ad4c 8959 //
whismanoid 4:d9b05924ad4c 8960 // TODO1: add new commands here
whismanoid 4:d9b05924ad4c 8961 //
whismanoid 4:d9b05924ad4c 8962 default:
whismanoid 4:d9b05924ad4c 8963 #if APPLICATION_MAX5715 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 8964 extern bool MAX5715_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX5715.cpp
whismanoid 4:d9b05924ad4c 8965 if (!MAX5715_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 8966 #elif APPLICATION_MAX11131 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 8967 extern bool MAX11131_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX11131.cpp
whismanoid 4:d9b05924ad4c 8968 if (!MAX11131_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 8969 #elif APPLICATION_MAX5171 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 8970 extern bool MAX5171_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX5171.cpp
whismanoid 4:d9b05924ad4c 8971 if (!MAX5171_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 8972 #elif APPLICATION_MAX11410 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 8973 extern bool MAX11410_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX11410.cpp
whismanoid 4:d9b05924ad4c 8974 if (!MAX11410_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 8975 #elif APPLICATION_MAX12345 // main_menu_onEOLcommandParser print command prompt
whismanoid 4:d9b05924ad4c 8976 extern bool MAX12345_menu_onEOLcommandParser(CmdLine & cmdLine); // defined in Test_Menu_MAX12345.cpp
whismanoid 4:d9b05924ad4c 8977 if (!MAX12345_menu_onEOLcommandParser(cmdLine))
whismanoid 4:d9b05924ad4c 8978 #else
whismanoid 4:d9b05924ad4c 8979 if (0) // not_handled_by_device_submenu
whismanoid 4:d9b05924ad4c 8980 #endif
whismanoid 4:d9b05924ad4c 8981 {
whismanoid 4:d9b05924ad4c 8982 cmdLine.serial().printf("\r\n unknown command ");
whismanoid 4:d9b05924ad4c 8983 //~ cmdLine.serial().printf("\r\n unknown command 0x%2.2x \"%s\"\r\n", cmdLine.str()[0], cmdLine.str());
whismanoid 4:d9b05924ad4c 8984 # if HAS_DAPLINK_SERIAL
whismanoid 8:dffee7509bfb 8985 cmdLine_DAPLINKserial.serial().printf("\r\n unknown command 0x%2.2x \"%s\"\r\n",
whismanoid 4:d9b05924ad4c 8986 cmdLine.str()[0], cmdLine.str());
whismanoid 4:d9b05924ad4c 8987 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 8988 }
whismanoid 4:d9b05924ad4c 8989 } // switch (cmdLine[0])
whismanoid 4:d9b05924ad4c 8990 //
whismanoid 31:47eee7e0cc2d 8991 // TODO: avoid excess console noise when a Button event happens during datalogging -- quiet inside Run_command_table()
whismanoid 31:47eee7e0cc2d 8992 if (g_Run_command_table_running == false) {
whismanoid 4:d9b05924ad4c 8993 // print command prompt
whismanoid 8:dffee7509bfb 8994 // print_command_prompt();
whismanoid 8:dffee7509bfb 8995 cmdLine.serial().printf("\r\n> ");
whismanoid 31:47eee7e0cc2d 8996 } // if (g_Run_command_table_running)
whismanoid 4:d9b05924ad4c 8997 }
whismanoid 4:d9b05924ad4c 8998 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 8999
whismanoid 4:d9b05924ad4c 9000 //--------------------------------------------------
whismanoid 4:d9b05924ad4c 9001 // print column header banner for csv data columns
whismanoid 8:dffee7509bfb 9002 void Datalogger_PrintHeader(CmdLine& cmdLine)
whismanoid 4:d9b05924ad4c 9003 {
whismanoid 37:3f369235e5bc 9004 #if MAX40108_DEMO // main_menu_status banner
whismanoid 37:3f369235e5bc 9005 cmdLine.serial().printf("\r\n\r\n\"MAX40108_U%d", MAX40108_DEMO);
whismanoid 37:3f369235e5bc 9006 #ifdef BOARD_SERIAL_NUMBER
whismanoid 37:3f369235e5bc 9007 // data unique to certain boards based on serial number
whismanoid 49:359a6b9df7c1 9008 cmdLine.serial().printf(" [s/n %ld]", g_board_serial_number);
whismanoid 37:3f369235e5bc 9009 #endif // BOARD_SERIAL_NUMBER data unique to certain boards based on serial number
whismanoid 37:3f369235e5bc 9010 #ifdef FW_REV
whismanoid 37:3f369235e5bc 9011 cmdLine.serial().printf(" [FW_REV %d]", FW_REV);
whismanoid 37:3f369235e5bc 9012 #endif // FW_REV
whismanoid 37:3f369235e5bc 9013 cmdLine.serial().printf("\"\r\n");
whismanoid 37:3f369235e5bc 9014 #endif // MAX40108_DEMO
whismanoid 37:3f369235e5bc 9015
whismanoid 4:d9b05924ad4c 9016 // column header banner for csv data columns
whismanoid 4:d9b05924ad4c 9017 int field_index = 0;
whismanoid 4:d9b05924ad4c 9018 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 10:04022a61b527 9019 for (int channel_index = 0; channel_index < NUM_DUT_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 10:04022a61b527 9020 if (SPI_AIN_Enable_ch[channel_index] == SPI_AIN_Disable) {
whismanoid 4:d9b05924ad4c 9021 continue;
whismanoid 4:d9b05924ad4c 9022 }
whismanoid 4:d9b05924ad4c 9023 // comma between fields
whismanoid 4:d9b05924ad4c 9024 if (field_index > 0) {
whismanoid 4:d9b05924ad4c 9025 cmdLine.serial().printf(",");
whismanoid 4:d9b05924ad4c 9026 }
whismanoid 10:04022a61b527 9027 field_index++;
whismanoid 4:d9b05924ad4c 9028 // AIN_index column header prefix
whismanoid 4:d9b05924ad4c 9029 #if SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 4:d9b05924ad4c 9030 // MAX11410 v_ctrl bipolar configuration or unipolar?
whismanoid 4:d9b05924ad4c 9031 if ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) {
whismanoid 4:d9b05924ad4c 9032 cmdLine.serial().printf("\"AIN%d-%d_BIP", channel_index, channel_index+1);
whismanoid 4:d9b05924ad4c 9033 }
whismanoid 4:d9b05924ad4c 9034 else {
whismanoid 4:d9b05924ad4c 9035 cmdLine.serial().printf("\"AIN%d", channel_index);
whismanoid 4:d9b05924ad4c 9036 }
whismanoid 4:d9b05924ad4c 9037 #else // SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 4:d9b05924ad4c 9038 cmdLine.serial().printf("\"AIN%d", channel_index);
whismanoid 4:d9b05924ad4c 9039 #endif // SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 10:04022a61b527 9040 if (SPI_AIN_Enable_ch[channel_index] == SPI_AIN_Enable_LSB) {
whismanoid 4:d9b05924ad4c 9041 // _LSB column header suffix
whismanoid 13:184a08909405 9042 cmdLine.serial().printf("_LSB");
whismanoid 4:d9b05924ad4c 9043 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9044 cmdLine_DAPLINKserial.serial().printf("_LSB");
whismanoid 4:d9b05924ad4c 9045 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9046 }
whismanoid 10:04022a61b527 9047 else if (SPI_AIN_Enable_ch[channel_index] == SPI_AIN_Enable_Volt) {
whismanoid 4:d9b05924ad4c 9048 // _V column header suffix
whismanoid 13:184a08909405 9049 cmdLine.serial().printf("_V");
whismanoid 4:d9b05924ad4c 9050 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9051 cmdLine_DAPLINKserial.serial().printf("_V");
whismanoid 4:d9b05924ad4c 9052 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9053 }
whismanoid 13:184a08909405 9054 #if HAS_SPI_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 13:184a08909405 9055 // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 9056 // WIP Editable customChannelHeader strings #363 - Datalogger_PrintHeader SPI_AIN_customChannelHeader_ch
whismanoid 13:184a08909405 9057 if (SPI_AIN_customChannelHeader_ch[channel_index] && SPI_AIN_customChannelHeader_ch[channel_index][0]) {
whismanoid 13:184a08909405 9058 // not a null pointer, and not an empty string
whismanoid 13:184a08909405 9059 cmdLine.serial().printf("_%s", SPI_AIN_customChannelHeader_ch[channel_index]);
whismanoid 13:184a08909405 9060 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9061 cmdLine_DAPLINKserial.serial().printf("_%s", SPI_AIN_customChannelHeader_ch[channel_index]);
whismanoid 13:184a08909405 9062 # endif // HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9063 } else {
whismanoid 13:184a08909405 9064 // no custom channel name for this channel
whismanoid 13:184a08909405 9065 //~ cmdLine.serial().printf("~");
whismanoid 13:184a08909405 9066 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9067 //~ cmdLine_DAPLINKserial.serial().printf("~");
whismanoid 13:184a08909405 9068 # endif // HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9069 }
whismanoid 13:184a08909405 9070 #endif // HAS_SPI_AIN_customChannelHeader
whismanoid 13:184a08909405 9071 // close quote
whismanoid 13:184a08909405 9072 cmdLine.serial().printf("\"");
whismanoid 13:184a08909405 9073 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9074 cmdLine_DAPLINKserial.serial().printf("\"");
whismanoid 13:184a08909405 9075 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9076 }
whismanoid 4:d9b05924ad4c 9077
whismanoid 4:d9b05924ad4c 9078 #if VERIFY_PART_ID_IN_LOOP
whismanoid 4:d9b05924ad4c 9079 // PART_ID field: Device ID Validation
whismanoid 4:d9b05924ad4c 9080 cmdLine.serial().printf(",\"PART_ID\"");
whismanoid 4:d9b05924ad4c 9081 # if HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9082 cmdLine_DAPLINKserial.serial().printf(",\"PART_ID\"");
whismanoid 4:d9b05924ad4c 9083 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9084 #endif // VERIFY_PART_ID_IN_LOOP
whismanoid 55:477ba09475d7 9085 // MAX40108 Datalog Math #362 -- Datalogger_PrintHeader() SPI_AIN_MATH
whismanoid 55:477ba09475d7 9086 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 9087 // SPI_AIN_Enable_Math_ch[] option to report math
whismanoid 55:477ba09475d7 9088 // based on g_MAX11410_device.AINcode[] or SPI_AIN_Voltage[]
whismanoid 55:477ba09475d7 9089 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9090 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9091 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9092 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9093 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 9094 //
whismanoid 4:d9b05924ad4c 9095 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 4:d9b05924ad4c 9096 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 9:45f98573eb6d 9097 for (int channel_index = 0; channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 9:45f98573eb6d 9098 if (Platform_Enable_ch[channel_index] == Platform_AIN_Disable) {
whismanoid 9:45f98573eb6d 9099 continue;
whismanoid 9:45f98573eb6d 9100 }
whismanoid 4:d9b05924ad4c 9101 // comma between fields
whismanoid 4:d9b05924ad4c 9102 if (field_index > 0) {
whismanoid 4:d9b05924ad4c 9103 cmdLine.serial().printf(",");
whismanoid 4:d9b05924ad4c 9104 }
whismanoid 9:45f98573eb6d 9105 field_index++;
whismanoid 4:d9b05924ad4c 9106 // AIN_index column header prefix
whismanoid 4:d9b05924ad4c 9107 cmdLine.serial().printf("\"A%d", channel_index);
whismanoid 9:45f98573eb6d 9108 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_LSB) {
whismanoid 9:45f98573eb6d 9109 // _LSB column header suffix
whismanoid 13:184a08909405 9110 cmdLine.serial().printf("_LSB");
whismanoid 9:45f98573eb6d 9111 }
whismanoid 9:45f98573eb6d 9112 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Volt) {
whismanoid 9:45f98573eb6d 9113 // _V column header suffix
whismanoid 13:184a08909405 9114 cmdLine.serial().printf("_V");
whismanoid 9:45f98573eb6d 9115 }
whismanoid 55:477ba09475d7 9116 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_LSB - display math result instead of LSB in channel# position
whismanoid 55:477ba09475d7 9117 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9118 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Math_LSB) {
whismanoid 55:477ba09475d7 9119 // _LSB column header suffix
whismanoid 55:477ba09475d7 9120 cmdLine.serial().printf("_LSB");
whismanoid 55:477ba09475d7 9121 if (Platform_MathOffsetA[channel_index] > 0) {
whismanoid 55:477ba09475d7 9122 cmdLine.serial().printf("-%4.2f", Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9123 }
whismanoid 55:477ba09475d7 9124 else if (Platform_MathOffsetA[channel_index] < 0) {
whismanoid 55:477ba09475d7 9125 cmdLine.serial().printf("+%4.2f", -Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9126 }
whismanoid 55:477ba09475d7 9127 if (Platform_MathGainMulA[channel_index] != 1.0) {
whismanoid 55:477ba09475d7 9128 cmdLine.serial().printf("*%4.2f", Platform_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 9129 }
whismanoid 55:477ba09475d7 9130 if (Platform_MathGainDivA[channel_index] != 1.0) {
whismanoid 55:477ba09475d7 9131 cmdLine.serial().printf("/%4.2f", Platform_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 9132 }
whismanoid 55:477ba09475d7 9133 if (Platform_MathUnitString[channel_index][0] != '\0') {
whismanoid 55:477ba09475d7 9134 cmdLine.serial().printf("_%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9135 }
whismanoid 55:477ba09475d7 9136 }
whismanoid 55:477ba09475d7 9137 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9138 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_Volt - display math result instead of volts in channel# position
whismanoid 55:477ba09475d7 9139 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9140 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Math_Volt) {
whismanoid 55:477ba09475d7 9141 // _V column header suffix
whismanoid 55:477ba09475d7 9142 cmdLine.serial().printf("_V");
whismanoid 55:477ba09475d7 9143 if (Platform_MathOffsetA[channel_index] > 0) {
whismanoid 55:477ba09475d7 9144 cmdLine.serial().printf("-%4.2f", Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9145 }
whismanoid 55:477ba09475d7 9146 else if (Platform_MathOffsetA[channel_index] < 0) {
whismanoid 55:477ba09475d7 9147 cmdLine.serial().printf("+%4.2f", -Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9148 }
whismanoid 55:477ba09475d7 9149 if (Platform_MathGainMulA[channel_index] != 1.0) {
whismanoid 55:477ba09475d7 9150 cmdLine.serial().printf("*%4.2f", Platform_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 9151 }
whismanoid 55:477ba09475d7 9152 if (Platform_MathGainDivA[channel_index] != 1.0) {
whismanoid 55:477ba09475d7 9153 cmdLine.serial().printf("/%4.2f", Platform_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 9154 }
whismanoid 55:477ba09475d7 9155 if (Platform_MathUnitString[channel_index][0] != '\0') {
whismanoid 55:477ba09475d7 9156 cmdLine.serial().printf("_%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9157 }
whismanoid 55:477ba09475d7 9158 }
whismanoid 55:477ba09475d7 9159 #endif // PLATFORM_AIN_MATH
whismanoid 13:184a08909405 9160 #if HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 13:184a08909405 9161 // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 9162 // WIP Editable customChannelHeader strings #363 - Datalogger_PrintHeader Platform_AIN_customChannelHeader_ch
whismanoid 13:184a08909405 9163 if (Platform_AIN_customChannelHeader_ch[channel_index] && Platform_AIN_customChannelHeader_ch[channel_index][0]) {
whismanoid 13:184a08909405 9164 // not a null pointer, and not an empty string
whismanoid 13:184a08909405 9165 cmdLine.serial().printf("_%s", Platform_AIN_customChannelHeader_ch[channel_index]);
whismanoid 13:184a08909405 9166 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9167 cmdLine_DAPLINKserial.serial().printf("_%s", Platform_AIN_customChannelHeader_ch[channel_index]);
whismanoid 13:184a08909405 9168 # endif // HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9169 } else {
whismanoid 13:184a08909405 9170 // no custom channel name for this channel
whismanoid 13:184a08909405 9171 //~ cmdLine.serial().printf("~");
whismanoid 13:184a08909405 9172 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9173 //~ cmdLine_DAPLINKserial.serial().printf("~");
whismanoid 13:184a08909405 9174 # endif // HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9175 }
whismanoid 13:184a08909405 9176 #endif // HAS_Platform_AIN_customChannelHeader
whismanoid 13:184a08909405 9177 // close quote
whismanoid 13:184a08909405 9178 cmdLine.serial().printf("\"");
whismanoid 13:184a08909405 9179 # if HAS_DAPLINK_SERIAL
whismanoid 13:184a08909405 9180 cmdLine_DAPLINKserial.serial().printf("\"");
whismanoid 13:184a08909405 9181 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9182 }
whismanoid 4:d9b05924ad4c 9183 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 55:477ba09475d7 9184 // MAX40108 Datalog Math #362 -- Datalogger_PrintHeader() PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9185 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9186 // Platform_Enable_Math_ch[] option to report math
whismanoid 55:477ba09475d7 9187 // based on Platform_LSB[] or Platform_Voltage[]
whismanoid 55:477ba09475d7 9188 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9189 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9190 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9191 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9192 for (int channel_index = 0; channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 55:477ba09475d7 9193 if (Platform_Enable_Math_ch[channel_index] == Platform_AIN_Disable) {
whismanoid 55:477ba09475d7 9194 continue;
whismanoid 55:477ba09475d7 9195 }
whismanoid 55:477ba09475d7 9196 // comma between fields
whismanoid 55:477ba09475d7 9197 if (field_index > 0) {
whismanoid 55:477ba09475d7 9198 cmdLine.serial().printf(",");
whismanoid 55:477ba09475d7 9199 }
whismanoid 55:477ba09475d7 9200 field_index++;
whismanoid 55:477ba09475d7 9201 // AIN_index column header prefix
whismanoid 55:477ba09475d7 9202 cmdLine.serial().printf("\"MATH:");
whismanoid 55:477ba09475d7 9203 // if (Platform_MathOffsetA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9204 // cmdLine.serial().printf("");
whismanoid 55:477ba09475d7 9205 // }
whismanoid 55:477ba09475d7 9206 cmdLine.serial().printf("A%d", channel_index);
whismanoid 55:477ba09475d7 9207 if (Platform_Enable_Math_ch[channel_index] == Platform_AIN_Enable_LSB) {
whismanoid 55:477ba09475d7 9208 // _LSB column header suffix
whismanoid 55:477ba09475d7 9209 cmdLine.serial().printf("_LSB");
whismanoid 55:477ba09475d7 9210 }
whismanoid 55:477ba09475d7 9211 if (Platform_Enable_Math_ch[channel_index] == Platform_AIN_Enable_Volt) {
whismanoid 55:477ba09475d7 9212 // _V column header suffix
whismanoid 55:477ba09475d7 9213 cmdLine.serial().printf("_V");
whismanoid 55:477ba09475d7 9214 }
whismanoid 55:477ba09475d7 9215 if (Platform_MathOffsetA[channel_index] > 0) {
whismanoid 55:477ba09475d7 9216 cmdLine.serial().printf("-%4.2f", Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9217 }
whismanoid 55:477ba09475d7 9218 if (Platform_MathOffsetA[channel_index] < 0) {
whismanoid 55:477ba09475d7 9219 cmdLine.serial().printf("+%4.2f", -Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9220 }
whismanoid 55:477ba09475d7 9221 if (Platform_MathGainMulA[channel_index] != 1.0) {
whismanoid 55:477ba09475d7 9222 cmdLine.serial().printf("*%4.2f", Platform_MathGainMulA[channel_index]);
whismanoid 55:477ba09475d7 9223 }
whismanoid 55:477ba09475d7 9224 if (Platform_MathGainDivA[channel_index] != 1.0) {
whismanoid 55:477ba09475d7 9225 cmdLine.serial().printf("/%4.2f", Platform_MathGainDivA[channel_index]);
whismanoid 55:477ba09475d7 9226 }
whismanoid 55:477ba09475d7 9227 if (Platform_MathUnitString[channel_index][0] != '\0') {
whismanoid 55:477ba09475d7 9228 cmdLine.serial().printf("_%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9229 }
whismanoid 55:477ba09475d7 9230 #if HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 9231 // Optional custom per-channel header suffix
whismanoid 55:477ba09475d7 9232 // WIP Editable customChannelHeader strings #363 - Datalogger_PrintHeader Platform_AIN_customChannelHeader_ch
whismanoid 55:477ba09475d7 9233 if (Platform_AIN_customChannelHeader_ch[channel_index] && Platform_AIN_customChannelHeader_ch[channel_index][0]) {
whismanoid 55:477ba09475d7 9234 // not a null pointer, and not an empty string
whismanoid 55:477ba09475d7 9235 cmdLine.serial().printf("_%s", Platform_AIN_customChannelHeader_ch[channel_index]);
whismanoid 55:477ba09475d7 9236 # if HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 9237 cmdLine_DAPLINKserial.serial().printf("_%s", Platform_AIN_customChannelHeader_ch[channel_index]);
whismanoid 55:477ba09475d7 9238 # endif // HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 9239 } else {
whismanoid 55:477ba09475d7 9240 // no custom channel name for this channel
whismanoid 55:477ba09475d7 9241 //~ cmdLine.serial().printf("~");
whismanoid 55:477ba09475d7 9242 # if HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 9243 //~ cmdLine_DAPLINKserial.serial().printf("~");
whismanoid 55:477ba09475d7 9244 # endif // HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 9245 }
whismanoid 55:477ba09475d7 9246 #endif // HAS_Platform_AIN_customChannelHeader
whismanoid 55:477ba09475d7 9247 // close quote
whismanoid 55:477ba09475d7 9248 cmdLine.serial().printf("\"");
whismanoid 55:477ba09475d7 9249 # if HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 9250 cmdLine_DAPLINKserial.serial().printf("\"");
whismanoid 55:477ba09475d7 9251 # endif // HAS_DAPLINK_SERIAL
whismanoid 55:477ba09475d7 9252 }
whismanoid 55:477ba09475d7 9253 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9254 //
whismanoid 30:07197a430869 9255 #if USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 9256 // Datalogger_PrintRow() print gstrRemarkText field from recent #remark -- in Datalogger_PrintHeader
whismanoid 30:07197a430869 9257 cmdLine.serial().printf(",\"%s\"", gstrRemarkHeader);
whismanoid 30:07197a430869 9258 #endif // USE_DATALOGGER_REMARK_FIELD
whismanoid 4:d9b05924ad4c 9259 // end of column header line
whismanoid 4:d9b05924ad4c 9260 cmdLine.serial().printf("\r\n");
whismanoid 4:d9b05924ad4c 9261 # if HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9262 cmdLine_DAPLINKserial.serial().printf("\r\n");
whismanoid 4:d9b05924ad4c 9263 # endif // HAS_DAPLINK_SERIAL
whismanoid 4:d9b05924ad4c 9264 } // void Datalogger_PrintHeader()
whismanoid 4:d9b05924ad4c 9265
whismanoid 5:aaf8b5f5fda1 9266 //--------------------------------------------------
whismanoid 5:aaf8b5f5fda1 9267 void Datalogger_AcquireRow()
whismanoid 5:aaf8b5f5fda1 9268 {
whismanoid 5:aaf8b5f5fda1 9269 // CODE GENERATOR: example code: has no member function ScanStandardExternalClock
whismanoid 5:aaf8b5f5fda1 9270 // CODE GENERATOR: example code: has no member function ReadAINcode
whismanoid 5:aaf8b5f5fda1 9271 // CODE GENERATOR: example code: member function Read_All_Voltages
whismanoid 5:aaf8b5f5fda1 9272 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 5:aaf8b5f5fda1 9273 // Measure ADC channels in sequence from AIN0 to channelNumber_0_9.
whismanoid 5:aaf8b5f5fda1 9274 // @param[in] g_MAX11410_device.channelNumber_0_15: AIN Channel Number
whismanoid 5:aaf8b5f5fda1 9275 // @param[in] g_MAX11410_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
whismanoid 5:aaf8b5f5fda1 9276 // @param[in] g_MAX11410_device.chan_id_0_1: ADC_MODE_CONTROL.CHAN_ID
whismanoid 10:04022a61b527 9277 //~ int channelId_0_9 = NUM_DUT_ANALOG_IN_CHANNELS-1+1;
whismanoid 5:aaf8b5f5fda1 9278 //g_MAX11410_device.channelNumber_0_15 = channelId_0_9;
whismanoid 5:aaf8b5f5fda1 9279 //g_MAX11410_device.PowerManagement_0_2 = 0;
whismanoid 5:aaf8b5f5fda1 9280 //g_MAX11410_device.chan_id_0_1 = 1;
whismanoid 5:aaf8b5f5fda1 9281 //----------------------------------------
whismanoid 5:aaf8b5f5fda1 9282 // scan AIN0..AIN9
whismanoid 5:aaf8b5f5fda1 9283 //
whismanoid 10:04022a61b527 9284 #if 1
whismanoid 10:04022a61b527 9285 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[0];
whismanoid 10:04022a61b527 9286 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[0];
whismanoid 10:04022a61b527 9287 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[0];
whismanoid 10:04022a61b527 9288 //
whismanoid 10:04022a61b527 9289 // diagnostic GPIO pulse on MAX11410 GP1 pin (0xc3 = logic 0, 0xc4 = logic 1)
whismanoid 10:04022a61b527 9290 g_MAX11410_device.RegWrite(MAX11410::CMD_r000_0101_dddd_xddd_GP1_CTRL, 0xc3); // GP1 = 0
whismanoid 10:04022a61b527 9291 //
whismanoid 10:04022a61b527 9292 int field_index = 0;
whismanoid 10:04022a61b527 9293 for (int channel_index = 0; channel_index < NUM_DUT_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 10:04022a61b527 9294 if (SPI_AIN_Enable_ch[channel_index] == SPI_AIN_Disable) {
whismanoid 10:04022a61b527 9295 continue;
whismanoid 10:04022a61b527 9296 }
whismanoid 10:04022a61b527 9297 field_index++;
whismanoid 10:04022a61b527 9298 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[channel_index];
whismanoid 10:04022a61b527 9299 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[channel_index];
whismanoid 10:04022a61b527 9300 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[channel_index];
whismanoid 10:04022a61b527 9301 //
whismanoid 10:04022a61b527 9302 // WIP SampleRate_of_FILTER_CONV_START() MAX11410EMC-FW slow ODR 10Sps #262
whismanoid 10:04022a61b527 9303 // adjust the MAX11410.loop_limit value if the sample rate is set to a value slower than 20sps
whismanoid 10:04022a61b527 9304 // SampleRate_of_FILTER_CONV_START(uint8_t FILTER_RegValue, uint8_t CONV_START_RegValue)
whismanoid 10:04022a61b527 9305 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 9306 if (SampleRate < 20.0) {
whismanoid 10:04022a61b527 9307 g_MAX11410_device.loop_limit = 32767; // TODO: is this timeout long enough for the slow output data rates?
whismanoid 10:04022a61b527 9308 }
whismanoid 10:04022a61b527 9309 //
whismanoid 10:04022a61b527 9310 // diagnostic GPIO pulse on MAX11410 GP0 pin (0xc3 = logic 0, 0xc4 = logic 1)
whismanoid 10:04022a61b527 9311 g_MAX11410_device.RegWrite(MAX11410::CMD_r000_0100_dddd_xddd_GP0_CTRL, 0xc3); // GP0 = 0
whismanoid 10:04022a61b527 9312 //
whismanoid 10:04022a61b527 9313 #if SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 10:04022a61b527 9314 // MAX11410 v_ctrl bipolar configuration or unipolar?
whismanoid 10:04022a61b527 9315 if ((SPI_AIN_Cfg_v_ctrl_ch[channel_index] & 0x40) == 0) {
whismanoid 10:04022a61b527 9316 const MAX11410::MAX11410_AINP_SEL_enum_t ainp = (MAX11410::MAX11410_AINP_SEL_enum_t)(channel_index);
whismanoid 10:04022a61b527 9317 const MAX11410::MAX11410_AINN_SEL_enum_t ainn = (MAX11410::MAX11410_AINN_SEL_enum_t)(channel_index^1);
whismanoid 10:04022a61b527 9318 SPI_AIN_Voltage[channel_index] = g_MAX11410_device.Measure_Voltage(ainp, ainn);
whismanoid 10:04022a61b527 9319 // @post AINcode[ainp]: measurement result LSB code
whismanoid 10:04022a61b527 9320 }
whismanoid 10:04022a61b527 9321 else {
whismanoid 10:04022a61b527 9322 const MAX11410::MAX11410_AINP_SEL_enum_t ainp = (MAX11410::MAX11410_AINP_SEL_enum_t)(channel_index);
whismanoid 10:04022a61b527 9323 const MAX11410::MAX11410_AINN_SEL_enum_t ainn = MAX11410::AINN_SEL_1010_GND;
whismanoid 10:04022a61b527 9324 SPI_AIN_Voltage[channel_index] = g_MAX11410_device.Measure_Voltage(ainp, ainn);
whismanoid 10:04022a61b527 9325 // @post AINcode[ainp]: measurement result LSB code
whismanoid 10:04022a61b527 9326 }
whismanoid 10:04022a61b527 9327 #endif // SPI_ADC_DeviceName == MAX11410 // SPI connected ADC
whismanoid 10:04022a61b527 9328 //
whismanoid 10:04022a61b527 9329 // diagnostic GPIO pulse on MAX11410 GP0 pin (0xc3 = logic 0, 0xc4 = logic 1)
whismanoid 10:04022a61b527 9330 g_MAX11410_device.RegWrite(MAX11410::CMD_r000_0100_dddd_xddd_GP0_CTRL, 0xc4); // GP0 = 1
whismanoid 10:04022a61b527 9331 //
whismanoid 10:04022a61b527 9332 }
whismanoid 10:04022a61b527 9333 // diagnostic GPIO pulse on MAX11410 GP1 pin (0xc3 = logic 0, 0xc4 = logic 1)
whismanoid 10:04022a61b527 9334 g_MAX11410_device.RegWrite(MAX11410::CMD_r000_0101_dddd_xddd_GP1_CTRL, 0xc4); // GP1 = 1
whismanoid 10:04022a61b527 9335 #else
whismanoid 5:aaf8b5f5fda1 9336 g_MAX11410_device.Read_All_Voltages();
whismanoid 10:04022a61b527 9337 #endif
whismanoid 10:04022a61b527 9338 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 5:aaf8b5f5fda1 9339 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 5:aaf8b5f5fda1 9340 // mbed
whismanoid 5:aaf8b5f5fda1 9341 // Platform board uses simple analog inputs
whismanoid 5:aaf8b5f5fda1 9342 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 5:aaf8b5f5fda1 9343 Platform_LSB[0] = analogIn0.read();
whismanoid 5:aaf8b5f5fda1 9344 Platform_LSB[1] = analogIn1.read();
whismanoid 5:aaf8b5f5fda1 9345 Platform_LSB[2] = analogIn2.read();
whismanoid 5:aaf8b5f5fda1 9346 Platform_LSB[3] = analogIn3.read();
whismanoid 5:aaf8b5f5fda1 9347 Platform_LSB[4] = analogIn4.read();
whismanoid 5:aaf8b5f5fda1 9348 Platform_LSB[5] = analogIn5.read();
whismanoid 10:04022a61b527 9349 #endif
whismanoid 10:04022a61b527 9350 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 37:3f369235e5bc 9351 #if USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 9352 // #if USE_Platform_AIN_Average -- for (i=0; i<Platform_AIN_Average_N; i++) -- analogIn012345.read()
whismanoid 37:3f369235e5bc 9353 // float normValue_0_1 = analogInPin.read(); but mean of Platform_AIN_Average_N samples
whismanoid 37:3f369235e5bc 9354 float analogIn0_normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 9355 float analogIn1_normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 9356 float analogIn2_normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 9357 float analogIn3_normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 9358 float analogIn4_normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 9359 float analogIn5_normValue_0_1 = 0;
whismanoid 37:3f369235e5bc 9360 for (int i = 0; i < Platform_AIN_Average_N; i++) {
whismanoid 37:3f369235e5bc 9361 analogIn0_normValue_0_1 = analogIn0_normValue_0_1 + analogIn0.read();
whismanoid 37:3f369235e5bc 9362 analogIn1_normValue_0_1 = analogIn1_normValue_0_1 + analogIn1.read();
whismanoid 37:3f369235e5bc 9363 analogIn2_normValue_0_1 = analogIn2_normValue_0_1 + analogIn2.read();
whismanoid 37:3f369235e5bc 9364 analogIn3_normValue_0_1 = analogIn3_normValue_0_1 + analogIn3.read();
whismanoid 37:3f369235e5bc 9365 analogIn4_normValue_0_1 = analogIn4_normValue_0_1 + analogIn4.read();
whismanoid 37:3f369235e5bc 9366 analogIn5_normValue_0_1 = analogIn5_normValue_0_1 + analogIn5.read();
whismanoid 37:3f369235e5bc 9367 }
whismanoid 37:3f369235e5bc 9368 analogIn0_normValue_0_1 = analogIn0_normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 9369 analogIn1_normValue_0_1 = analogIn1_normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 9370 analogIn2_normValue_0_1 = analogIn2_normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 9371 analogIn3_normValue_0_1 = analogIn3_normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 9372 analogIn4_normValue_0_1 = analogIn4_normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 9373 analogIn5_normValue_0_1 = analogIn5_normValue_0_1 / Platform_AIN_Average_N;
whismanoid 37:3f369235e5bc 9374 #else // USE_Platform_AIN_Average
whismanoid 37:3f369235e5bc 9375 float analogIn0_normValue_0_1 = analogIn0.read();
whismanoid 37:3f369235e5bc 9376 float analogIn1_normValue_0_1 = analogIn1.read();
whismanoid 37:3f369235e5bc 9377 float analogIn2_normValue_0_1 = analogIn2.read();
whismanoid 37:3f369235e5bc 9378 float analogIn3_normValue_0_1 = analogIn3.read();
whismanoid 37:3f369235e5bc 9379 float analogIn4_normValue_0_1 = analogIn4.read();
whismanoid 37:3f369235e5bc 9380 float analogIn5_normValue_0_1 = analogIn5.read();
whismanoid 37:3f369235e5bc 9381 #endif // USE_Platform_AIN_Average
whismanoid 34:a1993a1ee904 9382 #if HAS_Platform_AIN_Calibration
whismanoid 34:a1993a1ee904 9383 // apply calibration to normValue_0_1 value
whismanoid 37:3f369235e5bc 9384 Platform_Voltage[0] = CalibratedNormValue(0, analogIn0_normValue_0_1) * adc_full_scale_voltage[0];
whismanoid 37:3f369235e5bc 9385 Platform_Voltage[1] = CalibratedNormValue(1, analogIn1_normValue_0_1) * adc_full_scale_voltage[1];
whismanoid 37:3f369235e5bc 9386 Platform_Voltage[2] = CalibratedNormValue(2, analogIn2_normValue_0_1) * adc_full_scale_voltage[2];
whismanoid 37:3f369235e5bc 9387 Platform_Voltage[3] = CalibratedNormValue(3, analogIn3_normValue_0_1) * adc_full_scale_voltage[3];
whismanoid 37:3f369235e5bc 9388 Platform_Voltage[4] = CalibratedNormValue(4, analogIn4_normValue_0_1) * adc_full_scale_voltage[4];
whismanoid 37:3f369235e5bc 9389 Platform_Voltage[5] = CalibratedNormValue(5, analogIn5_normValue_0_1) * adc_full_scale_voltage[5];
whismanoid 34:a1993a1ee904 9390 #else // HAS_Platform_AIN_Calibration
whismanoid 37:3f369235e5bc 9391 Platform_Voltage[0] = analogIn0_normValue_0_1 * adc_full_scale_voltage[0];
whismanoid 37:3f369235e5bc 9392 Platform_Voltage[1] = analogIn1_normValue_0_1 * adc_full_scale_voltage[1];
whismanoid 37:3f369235e5bc 9393 Platform_Voltage[2] = analogIn2_normValue_0_1 * adc_full_scale_voltage[2];
whismanoid 37:3f369235e5bc 9394 Platform_Voltage[3] = analogIn3_normValue_0_1 * adc_full_scale_voltage[3];
whismanoid 37:3f369235e5bc 9395 Platform_Voltage[4] = analogIn4_normValue_0_1 * adc_full_scale_voltage[4];
whismanoid 37:3f369235e5bc 9396 Platform_Voltage[5] = analogIn5_normValue_0_1 * adc_full_scale_voltage[5];
whismanoid 34:a1993a1ee904 9397 #endif // HAS_Platform_AIN_Calibration
whismanoid 37:3f369235e5bc 9398 #endif // LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 5:aaf8b5f5fda1 9399 #endif // defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 5:aaf8b5f5fda1 9400
whismanoid 5:aaf8b5f5fda1 9401 #if VERIFY_PART_ID_IN_LOOP
whismanoid 5:aaf8b5f5fda1 9402 // PART_ID field: Device ID Validation
whismanoid 5:aaf8b5f5fda1 9403 const uint32_t part_id_expect = 0x000F02;
whismanoid 5:aaf8b5f5fda1 9404 uint32_t part_id_readback;
whismanoid 5:aaf8b5f5fda1 9405 g_MAX11410_device.RegRead(MAX11410::CMD_r001_0001_xxxx_xxxx_xxxx_xxxx_xxxx_xddd_PART_ID, &part_id_readback);
whismanoid 5:aaf8b5f5fda1 9406 #endif // VERIFY_PART_ID_IN_LOOP
whismanoid 5:aaf8b5f5fda1 9407 } // void Datalogger_AcquireRow()
whismanoid 5:aaf8b5f5fda1 9408
whismanoid 17:9397ea3ea7e9 9409 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 9410 //--------------------------------------------------
whismanoid 17:9397ea3ea7e9 9411 // TODO: Datalogger_RunActionTable() between Datalogger_AcquireRow() and Datalogger_PrintRow()
whismanoid 17:9397ea3ea7e9 9412 void Datalogger_RunActionTable()
whismanoid 17:9397ea3ea7e9 9413 {
whismanoid 17:9397ea3ea7e9 9414 if (Datalogger_action_table_enabled == false) {
whismanoid 17:9397ea3ea7e9 9415 return;
whismanoid 17:9397ea3ea7e9 9416 }
whismanoid 17:9397ea3ea7e9 9417 // TODO: verbose Datalogger_RunActionTable() emit a csv column ,"Action"
whismanoid 17:9397ea3ea7e9 9418 // TODO: assert Datalogger_action_table_row_count < ACTION_TABLE_ROW_MAX
whismanoid 17:9397ea3ea7e9 9419 // for Datalogger_action_table[0..Datalogger_action_table_row_count]
whismanoid 17:9397ea3ea7e9 9420 for (int i = 0; i < Datalogger_action_table_row_count; i++)
whismanoid 17:9397ea3ea7e9 9421 {
whismanoid 17:9397ea3ea7e9 9422 // skip if Datalogger_action_table[i].action == action_noop
whismanoid 17:9397ea3ea7e9 9423 if (Datalogger_action_table[i].action == action_noop) {
whismanoid 17:9397ea3ea7e9 9424 continue;
whismanoid 17:9397ea3ea7e9 9425 }
whismanoid 17:9397ea3ea7e9 9426 // TODO: test Datalogger_action_table[i].condition "if="
whismanoid 17:9397ea3ea7e9 9427 // TODO: Could the .condition field also distinguish Platform ADC from SPI ADC?
whismanoid 17:9397ea3ea7e9 9428 // That way we keep both sets of ADC channels in separate lists
whismanoid 17:9397ea3ea7e9 9429 // if=0 -- always
whismanoid 17:9397ea3ea7e9 9430 // if=1,2,3,4,5,6 -- Platform_Voltage[ch] > < == >= <= != threshold
whismanoid 17:9397ea3ea7e9 9431 // if=7,8,9,10,11,12 -- SPI_AIN_Voltage[ch] > < == >= <= != threshold
whismanoid 17:9397ea3ea7e9 9432 // also, are we comparing code or voltage?
whismanoid 17:9397ea3ea7e9 9433 // TODO: selected Datalogger_action_table[i].condition_channel
whismanoid 17:9397ea3ea7e9 9434 // Datalogger could have both platform ADC and external SPI ADC channels
whismanoid 17:9397ea3ea7e9 9435 // if SPI_ADC_DeviceName
whismanoid 17:9397ea3ea7e9 9436 // NUM_DUT_ANALOG_IN_CHANNELS
whismanoid 17:9397ea3ea7e9 9437 // SPI_AIN_Enable_ch[]
whismanoid 17:9397ea3ea7e9 9438 // SPI_AIN_customChannelHeader_ch[]
whismanoid 17:9397ea3ea7e9 9439 // SPI_AIN_Voltage[]
whismanoid 17:9397ea3ea7e9 9440 // if LOG_PLATFORM_AIN
whismanoid 17:9397ea3ea7e9 9441 // NUM_PLATFORM_ANALOG_IN_CHANNELS
whismanoid 17:9397ea3ea7e9 9442 // analogInPin_fullScaleVoltage[]
whismanoid 17:9397ea3ea7e9 9443 // Platform_Enable_ch[]
whismanoid 17:9397ea3ea7e9 9444 // Platform_AIN_customChannelHeader_ch[]
whismanoid 17:9397ea3ea7e9 9445 // Platform_Voltage[]
whismanoid 55:477ba09475d7 9446 // selected Datalogger_action_table[i].condition_threshold
whismanoid 55:477ba09475d7 9447 // WIP Datalog Math -- if channel has its math enabled, compare with the math-adjusted version. Keep it simple. #362
whismanoid 55:477ba09475d7 9448 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 9449 // WIP Datalog Math -- if channel has its math enabled, compare with the math-adjusted version. Keep it simple. #362
whismanoid 55:477ba09475d7 9450 // SPI_AIN_Voltage_test default value SPI_AIN_Voltage[Datalogger_action_table[i].condition_channel]
whismanoid 55:477ba09475d7 9451 double SPI_AIN_Voltage_test = SPI_AIN_Voltage[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9452 // SPI_AIN_Enable_Math_ch[] option to use math, update test_threshold
whismanoid 55:477ba09475d7 9453 // based on g_MAX11410_device.AINcode[] or SPI_AIN_Voltage[]
whismanoid 55:477ba09475d7 9454 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9455 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9456 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9457 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9458 if (SPI_AIN_Enable_Math_ch[Datalogger_action_table[i].condition_channel] == Platform_AIN_Enable_LSB) {
whismanoid 55:477ba09475d7 9459 // Perform calculations based on g_MAX11410_device.AINcode[Datalogger_action_table[i].condition_channel]
whismanoid 55:477ba09475d7 9460 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9461 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9462 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9463 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9464 SPI_AIN_Voltage_test = (Platform_LSB[Datalogger_action_table[i].condition_channel] - SPI_AIN_MathOffsetA[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9465 SPI_AIN_Voltage_test = SPI_AIN_Voltage_test * SPI_AIN_MathGainMulA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9466 if (SPI_AIN_MathGainDivA[Datalogger_action_table[i].condition_channel] != 0) {
whismanoid 55:477ba09475d7 9467 SPI_AIN_Voltage_test = SPI_AIN_Voltage_test / SPI_AIN_MathGainDivA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9468 }
whismanoid 55:477ba09475d7 9469 //
whismanoid 55:477ba09475d7 9470 cmdLine.serial().printf("%d", SPI_AIN_Voltage_test);
whismanoid 55:477ba09475d7 9471 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9472 // cmdLine.serial().printf("%s", SPI_AIN_MathUnitString[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9473 }
whismanoid 55:477ba09475d7 9474 if (SPI_AIN_Enable_Math_ch[Datalogger_action_table[i].condition_channel] == Platform_AIN_Enable_Volt) {
whismanoid 55:477ba09475d7 9475 // Perform calculations based on SPI_AIN_Voltage[Datalogger_action_table[i].condition_channel]
whismanoid 55:477ba09475d7 9476 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9477 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9478 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9479 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9480 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 9481 SPI_AIN_Voltage_test = SPI_AIN_Voltage_test * SPI_AIN_MathGainMulA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9482 if (SPI_AIN_MathGainDivA[Datalogger_action_table[i].condition_channel] != 0) {
whismanoid 55:477ba09475d7 9483 SPI_AIN_Voltage_test = SPI_AIN_Voltage_test / SPI_AIN_MathGainDivA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9484 }
whismanoid 55:477ba09475d7 9485 //
whismanoid 55:477ba09475d7 9486 cmdLine.serial().printf("%6.6f", SPI_AIN_Voltage_test);
whismanoid 55:477ba09475d7 9487 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9488 // cmdLine.serial().printf("%s", SPI_AIN_MathUnitString[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9489 }
whismanoid 55:477ba09475d7 9490 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 9491 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9492 // WIP Datalog Math -- if channel has its math enabled, compare with the math-adjusted version. Keep it simple. #362
whismanoid 55:477ba09475d7 9493 // Platform_Voltage_test default value Platform_Voltage[Datalogger_action_table[i].condition_channel]
whismanoid 55:477ba09475d7 9494 double Platform_Voltage_test = Platform_Voltage[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9495 // Platform_Enable_Math_ch[] option to use math, update test_threshold
whismanoid 55:477ba09475d7 9496 // based on Platform_LSB[] or Platform_Voltage[]
whismanoid 55:477ba09475d7 9497 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9498 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9499 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9500 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9501 if (Platform_Enable_Math_ch[Datalogger_action_table[i].condition_channel] == Platform_AIN_Enable_LSB) {
whismanoid 55:477ba09475d7 9502 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 55:477ba09475d7 9503 // Perform calculations based on Platform_LSB[Datalogger_action_table[i].condition_channel]
whismanoid 55:477ba09475d7 9504 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9505 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9506 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9507 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9508 Platform_Voltage_test = (Platform_LSB[Datalogger_action_table[i].condition_channel] - Platform_MathOffsetA[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9509 Platform_Voltage_test = Platform_Voltage_test * Platform_MathGainMulA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9510 if (Platform_MathGainDivA[Datalogger_action_table[i].condition_channel] != 0) {
whismanoid 55:477ba09475d7 9511 Platform_Voltage_test = Platform_Voltage_test / Platform_MathGainDivA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9512 }
whismanoid 55:477ba09475d7 9513 //
whismanoid 55:477ba09475d7 9514 // cmdLine.serial().printf("%u", Platform_Voltage_test);
whismanoid 55:477ba09475d7 9515 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9516 // cmdLine.serial().printf("%s", Platform_MathUnitString[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9517 #endif
whismanoid 55:477ba09475d7 9518 }
whismanoid 55:477ba09475d7 9519 if (Platform_Enable_Math_ch[Datalogger_action_table[i].condition_channel] == Platform_AIN_Enable_Volt) {
whismanoid 55:477ba09475d7 9520 // Perform calculations based on Platform_Voltage[Datalogger_action_table[i].condition_channel]
whismanoid 55:477ba09475d7 9521 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9522 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9523 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9524 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9525 Platform_Voltage_test = (Platform_Voltage[Datalogger_action_table[i].condition_channel] - Platform_MathOffsetA[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9526 Platform_Voltage_test = Platform_Voltage_test * Platform_MathGainMulA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9527 if (Platform_MathGainDivA[Datalogger_action_table[i].condition_channel] != 0) {
whismanoid 55:477ba09475d7 9528 Platform_Voltage_test = Platform_Voltage_test / Platform_MathGainDivA[Datalogger_action_table[i].condition_channel];
whismanoid 55:477ba09475d7 9529 }
whismanoid 55:477ba09475d7 9530 //
whismanoid 55:477ba09475d7 9531 // cmdLine.serial().printf("%6.6f", Platform_Voltage_test);
whismanoid 55:477ba09475d7 9532 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9533 // cmdLine.serial().printf("%s", Platform_MathUnitString[Datalogger_action_table[i].condition_channel]);
whismanoid 55:477ba09475d7 9534 }
whismanoid 55:477ba09475d7 9535 #endif // PLATFORM_AIN_MATH
whismanoid 17:9397ea3ea7e9 9536 switch(Datalogger_action_table[i].condition)
whismanoid 17:9397ea3ea7e9 9537 {
whismanoid 17:9397ea3ea7e9 9538 case condition_always:
whismanoid 17:9397ea3ea7e9 9539 //~ cmdLine.serial().printf(" always");
whismanoid 17:9397ea3ea7e9 9540 break;
whismanoid 17:9397ea3ea7e9 9541 case condition_if_An_gt_threshold:
whismanoid 17:9397ea3ea7e9 9542 //~ cmdLine.serial().printf(" if A%d > %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9543 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 9544 if (!(Platform_Voltage_test > Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9545 continue;
whismanoid 17:9397ea3ea7e9 9546 }
whismanoid 17:9397ea3ea7e9 9547 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 17:9397ea3ea7e9 9548 break;
whismanoid 17:9397ea3ea7e9 9549 case condition_if_An_lt_threshold:
whismanoid 17:9397ea3ea7e9 9550 //~ cmdLine.serial().printf(" if A%d < %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9551 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 9552 if (!(Platform_Voltage_test < Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9553 continue;
whismanoid 17:9397ea3ea7e9 9554 }
whismanoid 17:9397ea3ea7e9 9555 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 17:9397ea3ea7e9 9556 break;
whismanoid 17:9397ea3ea7e9 9557 case condition_if_An_eq_threshold:
whismanoid 17:9397ea3ea7e9 9558 //~ cmdLine.serial().printf(" if A%d == %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9559 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 9560 if (!(Platform_Voltage_test == Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9561 continue;
whismanoid 17:9397ea3ea7e9 9562 }
whismanoid 17:9397ea3ea7e9 9563 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 17:9397ea3ea7e9 9564 break;
whismanoid 17:9397ea3ea7e9 9565 case condition_if_An_ge_threshold:
whismanoid 17:9397ea3ea7e9 9566 //~ cmdLine.serial().printf(" if A%d >= %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9567 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 9568 if (!(Platform_Voltage_test >= Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9569 continue;
whismanoid 17:9397ea3ea7e9 9570 }
whismanoid 17:9397ea3ea7e9 9571 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 17:9397ea3ea7e9 9572 break;
whismanoid 17:9397ea3ea7e9 9573 case condition_if_An_le_threshold:
whismanoid 17:9397ea3ea7e9 9574 //~ cmdLine.serial().printf(" if A%d <= %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9575 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 55:477ba09475d7 9576 if (!(Platform_Voltage_test <= Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9577 continue;
whismanoid 17:9397ea3ea7e9 9578 }
whismanoid 17:9397ea3ea7e9 9579 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 17:9397ea3ea7e9 9580 break;
whismanoid 17:9397ea3ea7e9 9581 case condition_if_An_ne_threshold:
whismanoid 17:9397ea3ea7e9 9582 //~ cmdLine.serial().printf(" if A%d != %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9583 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 17:9397ea3ea7e9 9584 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 55:477ba09475d7 9585 if (!(Platform_Voltage_test != Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9586 continue;
whismanoid 17:9397ea3ea7e9 9587 }
whismanoid 17:9397ea3ea7e9 9588 break;
whismanoid 17:9397ea3ea7e9 9589 case condition_if_AINn_gt_threshold:
whismanoid 17:9397ea3ea7e9 9590 //~ cmdLine.serial().printf(" if AIN%d > %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9591 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 9592 if (!(SPI_AIN_Voltage_test > Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9593 continue;
whismanoid 17:9397ea3ea7e9 9594 }
whismanoid 17:9397ea3ea7e9 9595 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 17:9397ea3ea7e9 9596 break;
whismanoid 17:9397ea3ea7e9 9597 case condition_if_AINn_lt_threshold:
whismanoid 17:9397ea3ea7e9 9598 //~ cmdLine.serial().printf(" if AIN%d < %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9599 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 9600 if (!(SPI_AIN_Voltage_test < Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9601 continue;
whismanoid 17:9397ea3ea7e9 9602 }
whismanoid 17:9397ea3ea7e9 9603 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 17:9397ea3ea7e9 9604 break;
whismanoid 17:9397ea3ea7e9 9605 case condition_if_AINn_eq_threshold:
whismanoid 17:9397ea3ea7e9 9606 //~ cmdLine.serial().printf(" if AIN%d == %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9607 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 9608 if (!(SPI_AIN_Voltage_test == Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9609 continue;
whismanoid 17:9397ea3ea7e9 9610 }
whismanoid 17:9397ea3ea7e9 9611 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 17:9397ea3ea7e9 9612 break;
whismanoid 17:9397ea3ea7e9 9613 case condition_if_AINn_ge_threshold:
whismanoid 17:9397ea3ea7e9 9614 //~ cmdLine.serial().printf(" if AIN%d >= %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9615 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 9616 if (!(SPI_AIN_Voltage_test >= Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9617 continue;
whismanoid 17:9397ea3ea7e9 9618 }
whismanoid 17:9397ea3ea7e9 9619 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 17:9397ea3ea7e9 9620 break;
whismanoid 17:9397ea3ea7e9 9621 case condition_if_AINn_le_threshold:
whismanoid 17:9397ea3ea7e9 9622 //~ cmdLine.serial().printf(" if AIN%d <= %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9623 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 9624 if (!(SPI_AIN_Voltage_test <= Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9625 continue;
whismanoid 17:9397ea3ea7e9 9626 }
whismanoid 17:9397ea3ea7e9 9627 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 17:9397ea3ea7e9 9628 break;
whismanoid 17:9397ea3ea7e9 9629 case condition_if_AINn_ne_threshold:
whismanoid 17:9397ea3ea7e9 9630 //~ cmdLine.serial().printf(" if AIN%d != %f", Datalogger_action_table[i].condition_channel, Datalogger_action_table[i].condition_threshold);
whismanoid 17:9397ea3ea7e9 9631 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 9632 if (!(SPI_AIN_Voltage_test != Datalogger_action_table[i].condition_threshold)) {
whismanoid 17:9397ea3ea7e9 9633 continue;
whismanoid 17:9397ea3ea7e9 9634 }
whismanoid 17:9397ea3ea7e9 9635 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 17:9397ea3ea7e9 9636 break;
whismanoid 17:9397ea3ea7e9 9637 } // switch(Datalogger_action_table[i].condition)
whismanoid 17:9397ea3ea7e9 9638 // selected Datalogger_action_table[i].digitalOutPin
whismanoid 17:9397ea3ea7e9 9639 // perform selected Datalogger_action_table[i].action
whismanoid 17:9397ea3ea7e9 9640 switch(Datalogger_action_table[i].action)
whismanoid 17:9397ea3ea7e9 9641 {
whismanoid 17:9397ea3ea7e9 9642 case action_noop:
whismanoid 17:9397ea3ea7e9 9643 //~ cmdLine.serial().printf("No_Operation");
whismanoid 17:9397ea3ea7e9 9644 break;
whismanoid 17:9397ea3ea7e9 9645 case action_digitalOutLow:
whismanoid 17:9397ea3ea7e9 9646 {
whismanoid 17:9397ea3ea7e9 9647 //~ cmdLine.serial().printf("digitalOutLow");
whismanoid 17:9397ea3ea7e9 9648 //~ cmdLine.serial().printf(" D%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 17:9397ea3ea7e9 9649 // perform action digitalOutLow
whismanoid 17:9397ea3ea7e9 9650 int pinIndex = Datalogger_action_table[i].digitalOutPin;
whismanoid 17:9397ea3ea7e9 9651 #if ARDUINO_STYLE
whismanoid 17:9397ea3ea7e9 9652 pinMode(pinIndex, OUTPUT); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 17:9397ea3ea7e9 9653 digitalWrite(pinIndex, LOW); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 17:9397ea3ea7e9 9654 #else
whismanoid 17:9397ea3ea7e9 9655 DigitalInOut& digitalInOutPin = find_digitalInOutPin(pinIndex);
whismanoid 17:9397ea3ea7e9 9656 digitalInOutPin.output();
whismanoid 17:9397ea3ea7e9 9657 digitalInOutPin.write(0);
whismanoid 17:9397ea3ea7e9 9658 #endif
whismanoid 17:9397ea3ea7e9 9659 }
whismanoid 17:9397ea3ea7e9 9660 break;
whismanoid 17:9397ea3ea7e9 9661 case action_digitalOutHigh:
whismanoid 17:9397ea3ea7e9 9662 {
whismanoid 17:9397ea3ea7e9 9663 //~ cmdLine.serial().printf("digitalOutHigh");
whismanoid 17:9397ea3ea7e9 9664 //~ cmdLine.serial().printf(" D%d", Datalogger_action_table[i].digitalOutPin);
whismanoid 17:9397ea3ea7e9 9665 // perform action digitalOutHigh
whismanoid 17:9397ea3ea7e9 9666 int pinIndex = Datalogger_action_table[i].digitalOutPin;
whismanoid 17:9397ea3ea7e9 9667 #if ARDUINO_STYLE
whismanoid 17:9397ea3ea7e9 9668 pinMode(pinIndex, OUTPUT); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 17:9397ea3ea7e9 9669 digitalWrite(pinIndex, HIGH); // digital pins 0, 1, 2, .. 13, analog input pins A0, A1, .. A5
whismanoid 17:9397ea3ea7e9 9670 #else
whismanoid 17:9397ea3ea7e9 9671 DigitalInOut& digitalInOutPin = find_digitalInOutPin(pinIndex);
whismanoid 17:9397ea3ea7e9 9672 digitalInOutPin.output();
whismanoid 17:9397ea3ea7e9 9673 digitalInOutPin.write(1);
whismanoid 17:9397ea3ea7e9 9674 #endif
whismanoid 17:9397ea3ea7e9 9675 }
whismanoid 17:9397ea3ea7e9 9676 break;
whismanoid 29:6a9edb6e973b 9677 case action_button: // pin = button index 1, 2, 3
whismanoid 29:6a9edb6e973b 9678 {
whismanoid 30:07197a430869 9679 // don't allow onButton1FallingEdge() command processing to halt the datalog
whismanoid 30:07197a430869 9680 Datalogger_Trigger_enum_t saved_Datalogger_Trigger = Datalogger_Trigger;
whismanoid 29:6a9edb6e973b 9681 #if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9682 switch (Datalogger_action_table[i].digitalOutPin) // pin = button index 1, 2, 3
whismanoid 29:6a9edb6e973b 9683 {
whismanoid 29:6a9edb6e973b 9684 case 1:
whismanoid 29:6a9edb6e973b 9685 onButton1FallingEdge();
whismanoid 29:6a9edb6e973b 9686 break;
whismanoid 29:6a9edb6e973b 9687 #if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9688 case 2:
whismanoid 29:6a9edb6e973b 9689 onButton2FallingEdge();
whismanoid 29:6a9edb6e973b 9690 break;
whismanoid 29:6a9edb6e973b 9691 #endif // HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9692 #if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9693 case 3:
whismanoid 29:6a9edb6e973b 9694 onButton3FallingEdge();
whismanoid 29:6a9edb6e973b 9695 break;
whismanoid 29:6a9edb6e973b 9696 #endif // HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9697 #if HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9698 case 4:
whismanoid 29:6a9edb6e973b 9699 onButton4FallingEdge();
whismanoid 29:6a9edb6e973b 9700 break;
whismanoid 29:6a9edb6e973b 9701 #endif // HAS_BUTTON4_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9702 #if HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9703 case 5:
whismanoid 29:6a9edb6e973b 9704 onButton5FallingEdge();
whismanoid 29:6a9edb6e973b 9705 break;
whismanoid 29:6a9edb6e973b 9706 #endif // HAS_BUTTON5_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9707 #if HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9708 case 6:
whismanoid 29:6a9edb6e973b 9709 onButton6FallingEdge();
whismanoid 29:6a9edb6e973b 9710 break;
whismanoid 29:6a9edb6e973b 9711 #endif // HAS_BUTTON6_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9712 #if HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9713 case 7:
whismanoid 29:6a9edb6e973b 9714 onButton7FallingEdge();
whismanoid 29:6a9edb6e973b 9715 break;
whismanoid 29:6a9edb6e973b 9716 #endif // HAS_BUTTON7_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9717 #if HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9718 case 8:
whismanoid 29:6a9edb6e973b 9719 onButton8FallingEdge();
whismanoid 29:6a9edb6e973b 9720 break;
whismanoid 29:6a9edb6e973b 9721 #endif // HAS_BUTTON8_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9722 #if HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9723 case 9:
whismanoid 29:6a9edb6e973b 9724 onButton9FallingEdge();
whismanoid 29:6a9edb6e973b 9725 break;
whismanoid 29:6a9edb6e973b 9726 #endif // HAS_BUTTON9_DEMO_INTERRUPT
whismanoid 29:6a9edb6e973b 9727 } // switch (Datalogger_action_table[i].digitalOutPin) // pin = button index 1, 2, 3
whismanoid 29:6a9edb6e973b 9728 #endif // HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 30:07197a430869 9729 // don't allow onButton1FallingEdge() command processing to halt the datalog
whismanoid 30:07197a430869 9730 Datalogger_Trigger = saved_Datalogger_Trigger;
whismanoid 29:6a9edb6e973b 9731 } // case action_button
whismanoid 29:6a9edb6e973b 9732 break;
whismanoid 17:9397ea3ea7e9 9733 case action_trigger_Halt:
whismanoid 17:9397ea3ea7e9 9734 //~ cmdLine.serial().printf("trigger_Halt");
whismanoid 17:9397ea3ea7e9 9735 // perform action trigger_Halt
whismanoid 17:9397ea3ea7e9 9736 Datalogger_Trigger = trigger_Halt;
whismanoid 17:9397ea3ea7e9 9737 //~ Datalogger_Need_PrintHeader = true;
whismanoid 17:9397ea3ea7e9 9738 break;
whismanoid 17:9397ea3ea7e9 9739 case action_trigger_FreeRun:
whismanoid 17:9397ea3ea7e9 9740 //~ cmdLine.serial().printf("trigger_FreeRun");
whismanoid 17:9397ea3ea7e9 9741 // perform action trigger_FreeRun
whismanoid 17:9397ea3ea7e9 9742 Datalogger_Trigger = trigger_FreeRun;
whismanoid 17:9397ea3ea7e9 9743 //~ Datalogger_Need_PrintHeader = true;
whismanoid 17:9397ea3ea7e9 9744 break;
whismanoid 17:9397ea3ea7e9 9745 case action_trigger_Timer:
whismanoid 17:9397ea3ea7e9 9746 //~ cmdLine.serial().printf("trigger_Timer");
whismanoid 17:9397ea3ea7e9 9747 //~ // print configuration for trigger_Timer
whismanoid 17:9397ea3ea7e9 9748 //~ cmdLine.serial().printf("(%d x %dmsec)", g_timer_interval_count, g_timer_interval_msec);
whismanoid 17:9397ea3ea7e9 9749 // perform action trigger_Timer
whismanoid 17:9397ea3ea7e9 9750 Datalogger_Trigger = trigger_Timer;
whismanoid 17:9397ea3ea7e9 9751 //~ Datalogger_Need_PrintHeader = true;
whismanoid 17:9397ea3ea7e9 9752 break;
whismanoid 17:9397ea3ea7e9 9753 case action_trigger_PlatformDigitalInput:
whismanoid 17:9397ea3ea7e9 9754 //~ cmdLine.serial().printf("trigger_PlatformDigitalInput");
whismanoid 17:9397ea3ea7e9 9755 //~ // TODO: print configuration for trigger_PlatformDigitalInput
whismanoid 17:9397ea3ea7e9 9756 //~ cmdLine.serial().printf("(%d)", g_config_PlatformDigitalInput);
whismanoid 17:9397ea3ea7e9 9757 // TODO: perform action action_trigger_PlatformDigitalInput
whismanoid 17:9397ea3ea7e9 9758 Datalogger_Trigger = trigger_PlatformDigitalInput;
whismanoid 17:9397ea3ea7e9 9759 //~ Datalogger_Need_PrintHeader = true;
whismanoid 17:9397ea3ea7e9 9760 break;
whismanoid 17:9397ea3ea7e9 9761 case action_trigger_SPIDeviceRegRead:
whismanoid 17:9397ea3ea7e9 9762 //~ cmdLine.serial().printf("trigger_SPIDeviceRegRead");
whismanoid 17:9397ea3ea7e9 9763 //~ // TODO: print configuration for trigger_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 9764 //~ cmdLine.serial().printf("(%d)", g_config_SPIDeviceRegRead);
whismanoid 17:9397ea3ea7e9 9765 // TODO: perform action action_trigger_SPIDeviceRegRead
whismanoid 17:9397ea3ea7e9 9766 Datalogger_Trigger = trigger_SPIDeviceRegRead;
whismanoid 17:9397ea3ea7e9 9767 //~ Datalogger_Need_PrintHeader = true;
whismanoid 17:9397ea3ea7e9 9768 break;
whismanoid 17:9397ea3ea7e9 9769 } // switch(Datalogger_action_table[i].action)
whismanoid 17:9397ea3ea7e9 9770 // consider next row of action table
whismanoid 17:9397ea3ea7e9 9771 } // for ...Datalogger_action_table_row_count
whismanoid 17:9397ea3ea7e9 9772 }
whismanoid 17:9397ea3ea7e9 9773 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 9774
whismanoid 5:aaf8b5f5fda1 9775 //--------------------------------------------------
whismanoid 8:dffee7509bfb 9776 void Datalogger_PrintRow(CmdLine& cmdLine)
whismanoid 5:aaf8b5f5fda1 9777 {
whismanoid 5:aaf8b5f5fda1 9778 int field_index = 0;
whismanoid 5:aaf8b5f5fda1 9779 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 10:04022a61b527 9780 for (int channel_index = 0; channel_index < NUM_DUT_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 10:04022a61b527 9781 if (SPI_AIN_Enable_ch[channel_index] == SPI_AIN_Disable) {
whismanoid 5:aaf8b5f5fda1 9782 continue;
whismanoid 5:aaf8b5f5fda1 9783 }
whismanoid 5:aaf8b5f5fda1 9784 // comma between fields
whismanoid 5:aaf8b5f5fda1 9785 if (field_index > 0) {
whismanoid 5:aaf8b5f5fda1 9786 cmdLine.serial().printf(",");
whismanoid 5:aaf8b5f5fda1 9787 }
whismanoid 10:04022a61b527 9788 field_index++;
whismanoid 10:04022a61b527 9789 if (SPI_AIN_Enable_ch[channel_index] == Platform_AIN_Enable_LSB) {
whismanoid 10:04022a61b527 9790 cmdLine.serial().printf("%d", g_MAX11410_device.AINcode[channel_index]);
whismanoid 10:04022a61b527 9791 }
whismanoid 10:04022a61b527 9792 if (SPI_AIN_Enable_ch[channel_index] == Platform_AIN_Enable_Volt) {
whismanoid 10:04022a61b527 9793 // TODO: report Voltage instead of LSB
whismanoid 10:04022a61b527 9794 // Serial.print(SPI_AIN_Voltage[channel_index]);
whismanoid 10:04022a61b527 9795 static char strOutLineBuffer[16];
whismanoid 10:04022a61b527 9796 cmdLine.serial().printf("%6.6f", SPI_AIN_Voltage[channel_index]);
whismanoid 10:04022a61b527 9797 }
whismanoid 55:477ba09475d7 9798 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_LSB - display math result instead of LSB in channel# position
whismanoid 55:477ba09475d7 9799 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 9800 if (SPI_AIN_Enable_ch[channel_index] == Platform_AIN_Enable_Math_LSB) {
whismanoid 55:477ba09475d7 9801 // Perform calculations based on g_MAX11410_device.AINcode[channel_index]
whismanoid 55:477ba09475d7 9802 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9803 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9804 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9805 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9806 double x = (Platform_LSB[channel_index] - SPI_AIN_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9807 x = x * SPI_AIN_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 9808 if (SPI_AIN_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9809 x = x / SPI_AIN_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 9810 }
whismanoid 55:477ba09475d7 9811 //
whismanoid 55:477ba09475d7 9812 cmdLine.serial().printf("%d", x);
whismanoid 55:477ba09475d7 9813 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9814 // cmdLine.serial().printf("%s", SPI_AIN_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9815 }
whismanoid 55:477ba09475d7 9816 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 9817 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_Volt - display math result instead of volts in channel# position
whismanoid 55:477ba09475d7 9818 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 9819 if (SPI_AIN_Enable_ch[channel_index] == Platform_AIN_Enable_Math_Volt) {
whismanoid 55:477ba09475d7 9820 // Perform calculations based on SPI_AIN_Voltage[channel_index]
whismanoid 55:477ba09475d7 9821 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9822 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9823 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9824 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9825 double x = (SPI_AIN_Voltage[channel_index] - SPI_AIN_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9826 x = x * SPI_AIN_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 9827 if (SPI_AIN_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9828 x = x / SPI_AIN_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 9829 }
whismanoid 55:477ba09475d7 9830 //
whismanoid 55:477ba09475d7 9831 cmdLine.serial().printf("%6.6f", x);
whismanoid 55:477ba09475d7 9832 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9833 // cmdLine.serial().printf("%s", SPI_AIN_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9834 }
whismanoid 55:477ba09475d7 9835 #endif // SPI_AIN_MATH
whismanoid 5:aaf8b5f5fda1 9836 }
whismanoid 5:aaf8b5f5fda1 9837 #if VERIFY_PART_ID_IN_LOOP
whismanoid 5:aaf8b5f5fda1 9838 // PART_ID field: Device ID Validation
whismanoid 5:aaf8b5f5fda1 9839 if (part_id_readback != part_id_expect) {
whismanoid 5:aaf8b5f5fda1 9840 cmdLine.serial().printf(",\"FAIL\"");
whismanoid 9:45f98573eb6d 9841 need_reinit = true;
whismanoid 5:aaf8b5f5fda1 9842 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 5:aaf8b5f5fda1 9843 g_MAX11410_device.Init();
whismanoid 5:aaf8b5f5fda1 9844 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[0];
whismanoid 5:aaf8b5f5fda1 9845 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[0];
whismanoid 5:aaf8b5f5fda1 9846 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[0];
whismanoid 5:aaf8b5f5fda1 9847 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 5:aaf8b5f5fda1 9848 }
whismanoid 5:aaf8b5f5fda1 9849 else {
whismanoid 5:aaf8b5f5fda1 9850 cmdLine.serial().printf(",\"OK\"");
whismanoid 5:aaf8b5f5fda1 9851 }
whismanoid 5:aaf8b5f5fda1 9852 #endif // VERIFY_PART_ID_IN_LOOP
whismanoid 55:477ba09475d7 9853 // MAX40108 Datalog Math #362 -- Datalogger_PrintRow() SPI_AIN_MATH
whismanoid 55:477ba09475d7 9854 // SPI_AIN_Enable_Math_ch[] option to report calculations
whismanoid 55:477ba09475d7 9855 // based on g_MAX11410_device.AINcode[] or SPI_AIN_Voltage[]
whismanoid 55:477ba09475d7 9856 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9857 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9858 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9859 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9860 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 9861 for (int channel_index = 0; channel_index < NUM_DUT_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 55:477ba09475d7 9862 if (SPI_AIN_Enable_Math_ch[channel_index] == SPI_AIN_Disable) {
whismanoid 55:477ba09475d7 9863 continue;
whismanoid 55:477ba09475d7 9864 }
whismanoid 55:477ba09475d7 9865 // comma between fields
whismanoid 55:477ba09475d7 9866 if (field_index > 0) {
whismanoid 55:477ba09475d7 9867 cmdLine.serial().printf(",");
whismanoid 55:477ba09475d7 9868 }
whismanoid 55:477ba09475d7 9869 field_index++;
whismanoid 55:477ba09475d7 9870 if (SPI_AIN_Enable_Math_ch[channel_index] == Platform_AIN_Enable_LSB) {
whismanoid 55:477ba09475d7 9871 // Perform calculations based on g_MAX11410_device.AINcode[channel_index]
whismanoid 55:477ba09475d7 9872 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9873 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9874 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9875 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9876 double x = (Platform_LSB[channel_index] - SPI_AIN_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9877 x = x * SPI_AIN_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 9878 if (SPI_AIN_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9879 x = x / SPI_AIN_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 9880 }
whismanoid 55:477ba09475d7 9881 //
whismanoid 55:477ba09475d7 9882 cmdLine.serial().printf("%d", x);
whismanoid 55:477ba09475d7 9883 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9884 // cmdLine.serial().printf("%s", SPI_AIN_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9885 }
whismanoid 55:477ba09475d7 9886 if (SPI_AIN_Enable_Math_ch[channel_index] == Platform_AIN_Enable_Volt) {
whismanoid 55:477ba09475d7 9887 // Perform calculations based on SPI_AIN_Voltage[channel_index]
whismanoid 55:477ba09475d7 9888 // apply offset SPI_AIN_MathOffsetA[]
whismanoid 55:477ba09475d7 9889 // apply gain SPI_AIN_MathGainMulA[]
whismanoid 55:477ba09475d7 9890 // apply 1/gain SPI_AIN_MathGainDivA[]
whismanoid 55:477ba09475d7 9891 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9892 double x = (SPI_AIN_Voltage[channel_index] - SPI_AIN_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9893 x = x * SPI_AIN_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 9894 if (SPI_AIN_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9895 x = x / SPI_AIN_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 9896 }
whismanoid 55:477ba09475d7 9897 //
whismanoid 55:477ba09475d7 9898 cmdLine.serial().printf("%6.6f", x);
whismanoid 55:477ba09475d7 9899 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9900 // cmdLine.serial().printf("%s", SPI_AIN_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9901 }
whismanoid 55:477ba09475d7 9902 }
whismanoid 55:477ba09475d7 9903 #endif // SPI_AIN_MATH
whismanoid 55:477ba09475d7 9904 //
whismanoid 5:aaf8b5f5fda1 9905 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 5:aaf8b5f5fda1 9906 #if defined(LOG_PLATFORM_AIN) // Datalog Arduino platform analog inputs
whismanoid 9:45f98573eb6d 9907 for (int channel_index = 0; channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 9:45f98573eb6d 9908 if (Platform_Enable_ch[channel_index] == Platform_AIN_Disable) {
whismanoid 9:45f98573eb6d 9909 continue;
whismanoid 9:45f98573eb6d 9910 }
whismanoid 5:aaf8b5f5fda1 9911 // comma between fields
whismanoid 5:aaf8b5f5fda1 9912 if (field_index > 0) {
whismanoid 5:aaf8b5f5fda1 9913 cmdLine.serial().printf(",");
whismanoid 5:aaf8b5f5fda1 9914 }
whismanoid 9:45f98573eb6d 9915 field_index++;
whismanoid 9:45f98573eb6d 9916 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_LSB) {
whismanoid 5:aaf8b5f5fda1 9917 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 9:45f98573eb6d 9918 cmdLine.serial().printf("%u", Platform_LSB[channel_index]);
whismanoid 9:45f98573eb6d 9919 #endif
whismanoid 9:45f98573eb6d 9920 }
whismanoid 9:45f98573eb6d 9921 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Volt) {
whismanoid 9:45f98573eb6d 9922 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 11:2b8adc78618a 9923 // Datalog Volts omit V suffix from numbers #275
whismanoid 11:2b8adc78618a 9924 // because Excel graphs can't handle numbers that have a suffix.
whismanoid 11:2b8adc78618a 9925 cmdLine.serial().printf("%6.6f", Platform_Voltage[channel_index]);
whismanoid 55:477ba09475d7 9926 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9927 // cmdLine.serial().printf("V");
whismanoid 55:477ba09475d7 9928 #endif
whismanoid 55:477ba09475d7 9929 }
whismanoid 55:477ba09475d7 9930 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_LSB - display math result instead of LSB in channel# position
whismanoid 55:477ba09475d7 9931 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Math_LSB) {
whismanoid 55:477ba09475d7 9932 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9933 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 55:477ba09475d7 9934 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 55:477ba09475d7 9935 // Perform calculations based on Platform_LSB[channel_index]
whismanoid 55:477ba09475d7 9936 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9937 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9938 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9939 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9940 double x = (Platform_LSB[channel_index] - Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9941 x = x * Platform_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 9942 if (Platform_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9943 x = x / Platform_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 9944 }
whismanoid 55:477ba09475d7 9945 //
whismanoid 55:477ba09475d7 9946 cmdLine.serial().printf("%u", x);
whismanoid 55:477ba09475d7 9947 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9948 // cmdLine.serial().printf("%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9949 #endif
whismanoid 55:477ba09475d7 9950 #endif
whismanoid 55:477ba09475d7 9951 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9952 }
whismanoid 55:477ba09475d7 9953 // MAX40108 Datalog Math #362 -- Platform_AIN_Enable_Math_Volt - display math result instead of volts in channel# position
whismanoid 55:477ba09475d7 9954 if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Math_Volt) {
whismanoid 55:477ba09475d7 9955 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9956 #if LOG_PLATFORM_ANALOG_IN_VOLTS
whismanoid 55:477ba09475d7 9957 // Perform calculations based on Platform_Voltage[channel_index]
whismanoid 55:477ba09475d7 9958 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9959 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9960 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9961 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9962 double x = (Platform_Voltage[channel_index] - Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 9963 x = x * Platform_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 9964 if (Platform_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 9965 x = x / Platform_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 9966 }
whismanoid 55:477ba09475d7 9967 //
whismanoid 55:477ba09475d7 9968 cmdLine.serial().printf("%6.6f", x);
whismanoid 55:477ba09475d7 9969 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 9970 // cmdLine.serial().printf("%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 9971 #endif
whismanoid 55:477ba09475d7 9972 #endif // PLATFORM_AIN_MATH
whismanoid 9:45f98573eb6d 9973 }
whismanoid 5:aaf8b5f5fda1 9974 }
whismanoid 55:477ba09475d7 9975 // MAX40108 Datalog Math #362 -- Datalogger_PrintRow() PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9976 // Platform_Enable_Math_ch[] option to report calculations
whismanoid 55:477ba09475d7 9977 // based on Platform_LSB[] or Platform_Voltage[]
whismanoid 55:477ba09475d7 9978 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9979 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9980 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9981 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9982 #if PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 9983 for (int channel_index = 0; channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS; channel_index++) {
whismanoid 55:477ba09475d7 9984 if (Platform_Enable_Math_ch[channel_index] == Platform_AIN_Disable) {
whismanoid 55:477ba09475d7 9985 continue;
whismanoid 55:477ba09475d7 9986 }
whismanoid 55:477ba09475d7 9987 // comma between fields
whismanoid 55:477ba09475d7 9988 if (field_index > 0) {
whismanoid 55:477ba09475d7 9989 cmdLine.serial().printf(",");
whismanoid 55:477ba09475d7 9990 }
whismanoid 55:477ba09475d7 9991 field_index++;
whismanoid 55:477ba09475d7 9992 if (Platform_Enable_Math_ch[channel_index] == Platform_AIN_Enable_LSB) {
whismanoid 55:477ba09475d7 9993 #if LOG_PLATFORM_ANALOG_IN_LSB
whismanoid 55:477ba09475d7 9994 // Perform calculations based on Platform_LSB[channel_index]
whismanoid 55:477ba09475d7 9995 // apply offset Platform_MathOffsetA[]
whismanoid 55:477ba09475d7 9996 // apply gain Platform_MathGainMulA[]
whismanoid 55:477ba09475d7 9997 // apply 1/gain Platform_MathGainDivA[]
whismanoid 55:477ba09475d7 9998 // display unit string Platform_MathUnitString[]
whismanoid 55:477ba09475d7 9999 double x = (Platform_LSB[channel_index] - Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 10000 x = x * Platform_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 10001 if (Platform_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 10002 x = x / Platform_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 10003 }
whismanoid 55:477ba09475d7 10004 //
whismanoid 55:477ba09475d7 10005 cmdLine.serial().printf("%u", x);
whismanoid 55:477ba09475d7 10006 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 10007 // cmdLine.serial().printf("%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 10008 #endif
whismanoid 55:477ba09475d7 10009 }
whismanoid 55:477ba09475d7 10010 if (Platform_Enable_Math_ch[channel_index] == Platform_AIN_Enable_Volt) {
whismanoid 55:477ba09475d7 10011 // Perform calculations based on Platform_Voltage[channel_index]
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 double x = (Platform_Voltage[channel_index] - Platform_MathOffsetA[channel_index]);
whismanoid 55:477ba09475d7 10017 x = x * Platform_MathGainMulA[channel_index];
whismanoid 55:477ba09475d7 10018 if (Platform_MathGainDivA[channel_index] != 0) {
whismanoid 55:477ba09475d7 10019 x = x / Platform_MathGainDivA[channel_index];
whismanoid 55:477ba09475d7 10020 }
whismanoid 55:477ba09475d7 10021 //
whismanoid 55:477ba09475d7 10022 cmdLine.serial().printf("%6.6f", x);
whismanoid 55:477ba09475d7 10023 // omit units from datalog numbers, confuses ms-excel #275
whismanoid 55:477ba09475d7 10024 // cmdLine.serial().printf("%s", Platform_MathUnitString[channel_index]);
whismanoid 55:477ba09475d7 10025 }
whismanoid 55:477ba09475d7 10026 }
whismanoid 55:477ba09475d7 10027 #endif // PLATFORM_AIN_MATH
whismanoid 55:477ba09475d7 10028 //
whismanoid 5:aaf8b5f5fda1 10029 #endif // defined(LOG_PLATFORM_AIN)
whismanoid 9:45f98573eb6d 10030 if (need_reinit) {
whismanoid 9:45f98573eb6d 10031 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 10032 if (g_MAX11410_device.Init() == 0) {
whismanoid 9:45f98573eb6d 10033 //~ cmdLine.serial().printf(",\"Init() failed\"");
whismanoid 9:45f98573eb6d 10034 } else {
whismanoid 9:45f98573eb6d 10035 //~ cmdLine.serial().printf(",\"Init() success\"");
whismanoid 9:45f98573eb6d 10036 #if USE_CUSTOM_REG_INIT // custom_reg_init_addr[], custom_reg_init_data[], custom_reg_init_count
whismanoid 9:45f98573eb6d 10037 // in Datalogger_PrintRow(), when part_id test fails,
whismanoid 9:45f98573eb6d 10038 // apply list of custom register writes after re-init
whismanoid 9:45f98573eb6d 10039 // custom_reg_init_addr[], custom_reg_init_data[], custom_reg_init_count
whismanoid 9:45f98573eb6d 10040 for (unsigned int index = 0; index < custom_reg_init_count; index++) {
whismanoid 9:45f98573eb6d 10041 uint8_t regAddress = custom_reg_init_addr[index];
whismanoid 9:45f98573eb6d 10042 uint32_t regData = custom_reg_init_data[index];
whismanoid 9:45f98573eb6d 10043 cmdLine.serial().printf("*%s=0x%06.6x", g_MAX11410_device.RegName(regAddress), regData);
whismanoid 9:45f98573eb6d 10044 g_MAX11410_device.RegWrite((MAX11410::MAX11410_CMD_enum_t)regAddress, regData);
whismanoid 9:45f98573eb6d 10045 }
whismanoid 9:45f98573eb6d 10046 #endif // USE_CUSTOM_REG_INIT
whismanoid 9:45f98573eb6d 10047 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[0];
whismanoid 9:45f98573eb6d 10048 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[0];
whismanoid 9:45f98573eb6d 10049 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[0];
whismanoid 9:45f98573eb6d 10050 need_reinit = false;
whismanoid 9:45f98573eb6d 10051 }
whismanoid 9:45f98573eb6d 10052 #else // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 10053 need_reinit = false;
whismanoid 9:45f98573eb6d 10054 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 9:45f98573eb6d 10055 }
whismanoid 30:07197a430869 10056 #if USE_DATALOGGER_REMARK_FIELD
whismanoid 30:07197a430869 10057 // Datalogger_PrintRow() print gstrRemarkText field from recent #remark -- in void Datalogger_PrintRow()
whismanoid 30:07197a430869 10058 cmdLine.serial().printf(",\"%s\"", gstrRemarkText);
whismanoid 30:07197a430869 10059 #endif // USE_DATALOGGER_REMARK_FIELD
whismanoid 5:aaf8b5f5fda1 10060 cmdLine.serial().printf("\r\n");
whismanoid 9:45f98573eb6d 10061 if (need_reinit) {
whismanoid 9:45f98573eb6d 10062 //~ delay(500); // platform_delay_ms 500ms timing delay function
whismanoid 9:45f98573eb6d 10063 }
whismanoid 5:aaf8b5f5fda1 10064 } // void Datalogger_PrintRow()
whismanoid 5:aaf8b5f5fda1 10065
whismanoid 0:cb44e2e9ec4c 10066 // example code main function
whismanoid 0:cb44e2e9ec4c 10067 int main()
whismanoid 0:cb44e2e9ec4c 10068 {
whismanoid 0:cb44e2e9ec4c 10069 // setup: put your setup code here, to run once
whismanoid 4:d9b05924ad4c 10070 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 10071 // Configure serial ports
whismanoid 4:d9b05924ad4c 10072 cmdLine.clear();
whismanoid 4:d9b05924ad4c 10073 //~ cmdLine.serial().printf("\r\n cmdLine.serial().printf test\r\n");
whismanoid 4:d9b05924ad4c 10074 cmdLine.onEOLcommandParser = main_menu_onEOLcommandParser;
whismanoid 4:d9b05924ad4c 10075 //~ cmdLine.diagnostic_led_EOF = diagnostic_led_EOF;
whismanoid 4:d9b05924ad4c 10076 /// CmdLine::set_immediate_handler(char, functionPointer_void_void_on_immediate_0x21);
whismanoid 4:d9b05924ad4c 10077 //~ cmdLine.on_immediate_0x21 = on_immediate_0x21;
whismanoid 4:d9b05924ad4c 10078 //~ cmdLine.on_immediate_0x7b = on_immediate_0x7b;
whismanoid 4:d9b05924ad4c 10079 //~ cmdLine.on_immediate_0x7d = on_immediate_0x7d;
whismanoid 4:d9b05924ad4c 10080 # if HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 10081 #if 0 // HARD CRASH -- USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 10082 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- init aux baud rate g_auxSerialCom_baud
whismanoid 10:04022a61b527 10083 // TODO: if g_auxSerialCom_baud is other than the default 9600 baud,
whismanoid 10:04022a61b527 10084 // then the auxiliary serial port baud rate should be updated.
whismanoid 10:04022a61b527 10085 # if HAS_AUX_SERIAL
whismanoid 10:04022a61b527 10086 # else
whismanoid 10:04022a61b527 10087 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- init aux baud rate g_auxSerialCom_baud
whismanoid 10:04022a61b527 10088 DAPLINKserial.baud(g_auxSerialCom_baud);
whismanoid 10:04022a61b527 10089 # endif
whismanoid 10:04022a61b527 10090 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 4:d9b05924ad4c 10091 cmdLine_DAPLINKserial.clear();
whismanoid 4:d9b05924ad4c 10092 //~ cmdLine_DAPLINKserial.serial().printf("\r\n cmdLine_DAPLINKserial.serial().printf test\r\n");
whismanoid 4:d9b05924ad4c 10093 cmdLine_DAPLINKserial.onEOLcommandParser = main_menu_onEOLcommandParser;
whismanoid 4:d9b05924ad4c 10094 //~ cmdLine_DAPLINKserial.on_immediate_0x21 = on_immediate_0x21;
whismanoid 4:d9b05924ad4c 10095 //~ cmdLine_DAPLINKserial.on_immediate_0x7b = on_immediate_0x7b;
whismanoid 4:d9b05924ad4c 10096 //~ cmdLine_DAPLINKserial.on_immediate_0x7d = on_immediate_0x7d;
whismanoid 4:d9b05924ad4c 10097 # endif
whismanoid 6:f6d16658342b 10098 # if HAS_AUX_SERIAL
whismanoid 6:f6d16658342b 10099 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial
whismanoid 10:04022a61b527 10100 #if 0 // HARD CRASH -- USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 10101 // Command forwarding to AUX serial TX/RX cmdLine_AUXserial #257 -- init aux baud rate g_auxSerialCom_baud
whismanoid 10:04022a61b527 10102 // TODO: if g_auxSerialCom_baud is other than the default 9600 baud,
whismanoid 10:04022a61b527 10103 // then the auxiliary serial port baud rate should be updated.
whismanoid 10:04022a61b527 10104 AUXserial.baud(g_auxSerialCom_baud);
whismanoid 10:04022a61b527 10105 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 6:f6d16658342b 10106 cmdLine_AUXserial.clear();
whismanoid 6:f6d16658342b 10107 //~ cmdLine_AUXserial.serial().printf("\r\n cmdLine_AUXserial.serial().printf test\r\n");
whismanoid 6:f6d16658342b 10108 cmdLine_AUXserial.onEOLcommandParser = main_menu_onEOLcommandParser;
whismanoid 6:f6d16658342b 10109 //~ cmdLine_AUXserial.on_immediate_0x21 = on_immediate_0x21;
whismanoid 6:f6d16658342b 10110 //~ cmdLine_AUXserial.on_immediate_0x7b = on_immediate_0x7b;
whismanoid 6:f6d16658342b 10111 //~ cmdLine_AUXserial.on_immediate_0x7d = on_immediate_0x7d;
whismanoid 6:f6d16658342b 10112 # endif // HAS_AUX_SERIAL
whismanoid 4:d9b05924ad4c 10113 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 0:cb44e2e9ec4c 10114
whismanoid 0:cb44e2e9ec4c 10115 // example code: serial port banner message
whismanoid 0:cb44e2e9ec4c 10116 wait(3); // 3000ms timing delay function, platform-specific
whismanoid 3:9055e17e181a 10117 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 10118 cmdLine.serial().printf("\r\nDataLogger_MAX11410\r\n"); // instead of Hello_MAX11410
whismanoid 3:9055e17e181a 10119 #else // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 10120 cmdLine.serial().printf("\r\nInternal_DataLogger\r\n"); // instead of Hello_MAX11410
whismanoid 3:9055e17e181a 10121 # if HAS_DAPLINK_SERIAL
whismanoid 3:9055e17e181a 10122 cmdLine_DAPLINKserial.serial().printf("\r\nInternal_DataLogger\r\n"); // instead of Hello_MAX11410
whismanoid 3:9055e17e181a 10123 # endif // HAS_DAPLINK_SERIAL
whismanoid 6:f6d16658342b 10124 # if HAS_AUX_SERIAL
whismanoid 6:f6d16658342b 10125 cmdLine_AUXserial.serial().printf("\r\nInternal_DataLogger\r\n"); // instead of Hello_MAX11410
whismanoid 6:f6d16658342b 10126 # endif // HAS_AUX_SERIAL
whismanoid 3:9055e17e181a 10127 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 10:04022a61b527 10128
whismanoid 1:747f1602abfc 10129 // CODE GENERATOR: get spi properties from device
whismanoid 3:9055e17e181a 10130 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 55:477ba09475d7 10131 // MAX40108 Datalog Math #362 -- initialize enable/offset/gain arrays SPI_AIN_MATH
whismanoid 55:477ba09475d7 10132 #if SPI_AIN_MATH
whismanoid 55:477ba09475d7 10133 for (int ch = 0; ch < NUM_PLATFORM_ANALOG_IN_CHANNELS; ch++)
whismanoid 55:477ba09475d7 10134 {
whismanoid 55:477ba09475d7 10135 SPI_AIN_Enable_Math_ch[ch] = Platform_AIN_Disable;
whismanoid 55:477ba09475d7 10136 SPI_AIN_MathOffsetA[ch] = 0.0;
whismanoid 55:477ba09475d7 10137 SPI_AIN_MathGainMulA[ch] = 1.0;
whismanoid 55:477ba09475d7 10138 SPI_AIN_MathGainDivA[ch] = 1.0;
whismanoid 55:477ba09475d7 10139 }
whismanoid 55:477ba09475d7 10140 };
whismanoid 55:477ba09475d7 10141 #endif // SPI_AIN_MATH
whismanoid 3:9055e17e181a 10142 if (g_SPI_SCLK_Hz > g_MAX11410_device.get_spi_frequency())
whismanoid 3:9055e17e181a 10143 { // Device limits SPI SCLK frequency
whismanoid 3:9055e17e181a 10144 g_SPI_SCLK_Hz = g_MAX11410_device.get_spi_frequency();
whismanoid 3:9055e17e181a 10145 cmdLine.serial().printf("\r\nMAX11410 limits SPI SCLK frequency to %ld Hz\r\n", g_SPI_SCLK_Hz);
whismanoid 3:9055e17e181a 10146
whismanoid 3:9055e17e181a 10147 g_MAX11410_device.Init();
whismanoid 3:9055e17e181a 10148 }
whismanoid 3:9055e17e181a 10149 if (g_MAX11410_device.get_spi_frequency() > g_SPI_SCLK_Hz)
whismanoid 3:9055e17e181a 10150 { // Platform limits SPI SCLK frequency
whismanoid 3:9055e17e181a 10151 g_MAX11410_device.spi_frequency(g_SPI_SCLK_Hz);
whismanoid 3:9055e17e181a 10152 cmdLine.serial().printf("\r\nPlatform limits MAX11410 SPI SCLK frequency to %ld Hz\r\n", g_SPI_SCLK_Hz);
whismanoid 3:9055e17e181a 10153
whismanoid 3:9055e17e181a 10154 g_MAX11410_device.Init();
whismanoid 3:9055e17e181a 10155 }
whismanoid 0:cb44e2e9ec4c 10156 // g_SPI_dataMode = g_MAX11410_device.get_spi_dataMode();
whismanoid 3:9055e17e181a 10157 while (g_MAX11410_device.Init() == 0)
whismanoid 3:9055e17e181a 10158 {
whismanoid 3:9055e17e181a 10159 wait(3); // 3000ms timing delay function, platform-specific
whismanoid 3:9055e17e181a 10160 cmdLine.serial().printf("\r\nMAX11410 Init failed; retry...\r\n");
whismanoid 3:9055e17e181a 10161
whismanoid 3:9055e17e181a 10162 }
whismanoid 0:cb44e2e9ec4c 10163
whismanoid 0:cb44e2e9ec4c 10164 // ---------- CUSTOMIZED from MAX11410_Hello after g_MAX11410_device.Init() ----------
whismanoid 3:9055e17e181a 10165 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 10166 g_MAX11410_device.v_filter = SPI_AIN_Cfg_v_filter_ch[0];
whismanoid 3:9055e17e181a 10167 g_MAX11410_device.v_pga = SPI_AIN_Cfg_v_pga_ch[0];
whismanoid 3:9055e17e181a 10168 g_MAX11410_device.v_ctrl = SPI_AIN_Cfg_v_ctrl_ch[0];
whismanoid 3:9055e17e181a 10169 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 10170 // ---------- CUSTOMIZED from MAX11410_Hello ----------
whismanoid 3:9055e17e181a 10171 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 10172 // CODE GENERATOR: example code: has no member function REF
whismanoid 0:cb44e2e9ec4c 10173 // CODE GENERATOR: example code for ADC: repeat-forever convert and print conversion result, one record per line
whismanoid 0:cb44e2e9ec4c 10174 // CODE GENERATOR: ResolutionBits = 24
whismanoid 0:cb44e2e9ec4c 10175 // CODE GENERATOR: FScode = 0xffffff
whismanoid 0:cb44e2e9ec4c 10176 // CODE GENERATOR: NumChannels = 10
whismanoid 0:cb44e2e9ec4c 10177 // CODE GENERATOR: banner before DataLogHelloCppCodeList while(1)
whismanoid 3:9055e17e181a 10178 #if defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 3:9055e17e181a 10179 cmdLine.serial().printf("v_filter = 0x%2.2x\r\n", g_MAX11410_device.v_filter);
whismanoid 0:cb44e2e9ec4c 10180
whismanoid 3:9055e17e181a 10181 cmdLine.serial().printf("v_pga = 0x%2.2x\r\n", g_MAX11410_device.v_pga);
whismanoid 0:cb44e2e9ec4c 10182
whismanoid 3:9055e17e181a 10183 cmdLine.serial().printf("v_ctrl = 0x%2.2x\r\n", g_MAX11410_device.v_ctrl);
whismanoid 3:9055e17e181a 10184
whismanoid 3:9055e17e181a 10185 #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC
whismanoid 0:cb44e2e9ec4c 10186
whismanoid 3:9055e17e181a 10187 // column header banner for csv data columns
whismanoid 8:dffee7509bfb 10188 Datalogger_Need_PrintHeader = true;
whismanoid 10:04022a61b527 10189
whismanoid 12:2dfc1f2009e0 10190 #if USE_LEDS
whismanoid 12:2dfc1f2009e0 10191 #if defined(TARGET_MAX32630)
whismanoid 12:2dfc1f2009e0 10192 led1 = LED_ON; led2 = LED_OFF; led3 = LED_OFF; // diagnostic rbg led RED
whismanoid 12:2dfc1f2009e0 10193 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10194 led1 = LED_OFF; led2 = LED_ON; led3 = LED_OFF; // diagnostic rbg led GREEN
whismanoid 12:2dfc1f2009e0 10195 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10196 led1 = LED_OFF; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led BLUE
whismanoid 12:2dfc1f2009e0 10197 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10198 led1 = LED_ON; led2 = LED_ON; led3 = LED_ON; // diagnostic rbg led RED+GREEN+BLUE=WHITE
whismanoid 12:2dfc1f2009e0 10199 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10200 led1 = LED_OFF; led2 = LED_ON; led3 = LED_ON; // diagnostic rbg led GREEN+BLUE=CYAN
whismanoid 12:2dfc1f2009e0 10201 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10202 led1 = LED_ON; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led RED+BLUE=MAGENTA
whismanoid 12:2dfc1f2009e0 10203 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10204 led1 = LED_ON; led2 = LED_ON; led3 = LED_OFF; // diagnostic rbg led RED+GREEN=YELLOW
whismanoid 12:2dfc1f2009e0 10205 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10206 led1 = LED_OFF; led2 = LED_OFF; led3 = LED_OFF; // diagnostic rbg led BLACK
whismanoid 12:2dfc1f2009e0 10207 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 19:5ff09c8e9daf 10208 #elif defined(TARGET_MAX32625MBED) || defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
whismanoid 12:2dfc1f2009e0 10209 led1 = LED_ON; led2 = LED_OFF; led3 = LED_OFF; // diagnostic rbg led RED
whismanoid 12:2dfc1f2009e0 10210 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10211 led1 = LED_OFF; led2 = LED_ON; led3 = LED_OFF; // diagnostic rbg led GREEN
whismanoid 12:2dfc1f2009e0 10212 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10213 led1 = LED_OFF; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led BLUE
whismanoid 12:2dfc1f2009e0 10214 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10215 led1 = LED_ON; led2 = LED_ON; led3 = LED_ON; // diagnostic rbg led RED+GREEN+BLUE=WHITE
whismanoid 12:2dfc1f2009e0 10216 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10217 led1 = LED_OFF; led2 = LED_ON; led3 = LED_ON; // diagnostic rbg led GREEN+BLUE=CYAN
whismanoid 12:2dfc1f2009e0 10218 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10219 led1 = LED_ON; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led RED+BLUE=MAGENTA
whismanoid 12:2dfc1f2009e0 10220 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10221 led1 = LED_ON; led2 = LED_ON; led3 = LED_OFF; // diagnostic rbg led RED+GREEN=YELLOW
whismanoid 12:2dfc1f2009e0 10222 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10223 led1 = LED_OFF; led2 = LED_OFF; led3 = LED_OFF; // diagnostic rbg led BLACK
whismanoid 12:2dfc1f2009e0 10224 ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125);
whismanoid 12:2dfc1f2009e0 10225 #else // not defined(TARGET_LPC1768 etc.)
whismanoid 12:2dfc1f2009e0 10226 led1 = LED_ON;
whismanoid 12:2dfc1f2009e0 10227 led2 = LED_OFF;
whismanoid 12:2dfc1f2009e0 10228 led3 = LED_OFF;
whismanoid 12:2dfc1f2009e0 10229 led4 = LED_OFF;
whismanoid 12:2dfc1f2009e0 10230 ThisThread::sleep_for(75); // [since mbed-os-5.10] vs Thread::wait(75);
whismanoid 12:2dfc1f2009e0 10231 //led1 = LED_ON;
whismanoid 12:2dfc1f2009e0 10232 led2 = LED_ON;
whismanoid 12:2dfc1f2009e0 10233 ThisThread::sleep_for(75); // [since mbed-os-5.10] vs Thread::wait(75);
whismanoid 12:2dfc1f2009e0 10234 led1 = LED_OFF;
whismanoid 12:2dfc1f2009e0 10235 //led2 = LED_ON;
whismanoid 12:2dfc1f2009e0 10236 led3 = LED_ON;
whismanoid 12:2dfc1f2009e0 10237 ThisThread::sleep_for(75); // [since mbed-os-5.10] vs Thread::wait(75);
whismanoid 12:2dfc1f2009e0 10238 led2 = LED_OFF;
whismanoid 12:2dfc1f2009e0 10239 //led3 = LED_ON;
whismanoid 12:2dfc1f2009e0 10240 led4 = LED_ON;
whismanoid 12:2dfc1f2009e0 10241 ThisThread::sleep_for(75); // [since mbed-os-5.10] vs Thread::wait(75);
whismanoid 12:2dfc1f2009e0 10242 led3 = LED_OFF;
whismanoid 12:2dfc1f2009e0 10243 led4 = LED_ON;
whismanoid 12:2dfc1f2009e0 10244 //
whismanoid 12:2dfc1f2009e0 10245 #endif // target definition
whismanoid 12:2dfc1f2009e0 10246 #endif
whismanoid 12:2dfc1f2009e0 10247
whismanoid 12:2dfc1f2009e0 10248 if (led1.is_connected()) {
whismanoid 12:2dfc1f2009e0 10249 led1 = LED_ON;
whismanoid 12:2dfc1f2009e0 10250 }
whismanoid 12:2dfc1f2009e0 10251 if (led2.is_connected()) {
whismanoid 12:2dfc1f2009e0 10252 led2 = LED_ON;
whismanoid 12:2dfc1f2009e0 10253 }
whismanoid 12:2dfc1f2009e0 10254 if (led3.is_connected()) {
whismanoid 12:2dfc1f2009e0 10255 led3 = LED_ON;
whismanoid 12:2dfc1f2009e0 10256 }
whismanoid 12:2dfc1f2009e0 10257
whismanoid 46:469d0061df5d 10258 #if HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 10259 // WIP #312 load values from flash_page_configuration_back_up[] during init
whismanoid 48:18647e0516f2 10260 const uint32_t load_arg = load_arg_startup;
whismanoid 46:469d0061df5d 10261 Load_flash_page_configuration_back_up(cmdLine, load_arg);
whismanoid 46:469d0061df5d 10262 #endif // HAS_FLASH_LOAD_SAVE
whismanoid 46:469d0061df5d 10263
whismanoid 4:d9b05924ad4c 10264 while(1) { // this code repeats forever
whismanoid 4:d9b05924ad4c 10265 // this code repeats forever
whismanoid 4:d9b05924ad4c 10266
whismanoid 21:ac062a97a71d 10267 #if HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 21:ac062a97a71d 10268 // avoid runtime error on button1 press [mbed-os-5.11]
whismanoid 21:ac062a97a71d 10269 // instead of using InterruptIn, use DigitalIn and poll in main while(1)
whismanoid 21:ac062a97a71d 10270 # if HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 10271 static int button1_value_prev = 1;
whismanoid 21:ac062a97a71d 10272 static int button1_value_now = 1;
whismanoid 21:ac062a97a71d 10273 button1_value_prev = button1_value_now;
whismanoid 21:ac062a97a71d 10274 button1_value_now = button1.read();
whismanoid 21:ac062a97a71d 10275 if ((button1_value_prev - button1_value_now) == 1)
whismanoid 21:ac062a97a71d 10276 {
whismanoid 21:ac062a97a71d 10277 // on button1 falling edge (button1 press)
whismanoid 21:ac062a97a71d 10278 onButton1FallingEdge();
whismanoid 21:ac062a97a71d 10279 }
whismanoid 21:ac062a97a71d 10280 # endif // HAS_BUTTON1_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 10281 # if HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 10282 static int button2_value_prev = 1;
whismanoid 24:032f3683cb2a 10283 static int button2_value_now = 1;
whismanoid 24:032f3683cb2a 10284 button2_value_prev = button2_value_now;
whismanoid 24:032f3683cb2a 10285 button2_value_now = button2.read();
whismanoid 24:032f3683cb2a 10286 if ((button2_value_prev - button2_value_now) == 1)
whismanoid 24:032f3683cb2a 10287 {
whismanoid 24:032f3683cb2a 10288 // on button2 falling edge (button2 press)
whismanoid 24:032f3683cb2a 10289 onButton2FallingEdge();
whismanoid 24:032f3683cb2a 10290 }
whismanoid 24:032f3683cb2a 10291 # endif // HAS_BUTTON2_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 10292 # if HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 24:032f3683cb2a 10293 static int button3_value_prev = 1;
whismanoid 24:032f3683cb2a 10294 static int button3_value_now = 1;
whismanoid 24:032f3683cb2a 10295 button3_value_prev = button3_value_now;
whismanoid 24:032f3683cb2a 10296 button3_value_now = button3.read();
whismanoid 24:032f3683cb2a 10297 if ((button3_value_prev - button3_value_now) == 1)
whismanoid 24:032f3683cb2a 10298 {
whismanoid 24:032f3683cb2a 10299 // on button3 falling edge (button3 press)
whismanoid 26:13cba69d88eb 10300 onButton3FallingEdge();
whismanoid 24:032f3683cb2a 10301 }
whismanoid 24:032f3683cb2a 10302 # endif // HAS_BUTTON3_DEMO_INTERRUPT
whismanoid 21:ac062a97a71d 10303 #endif // HAS_BUTTON1_DEMO_INTERRUPT_POLLING
whismanoid 4:d9b05924ad4c 10304 #if USE_CMDLINE_MENUS // support CmdLine command menus
whismanoid 4:d9b05924ad4c 10305 // TODO support CmdLine command menus (like on Serial_Tester); help and usual boilerplate
whismanoid 10:04022a61b527 10306 #if USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 10307 // Command forwarding to Auxiliary serial port;
whismanoid 10:04022a61b527 10308 // don't accept commands from Auxiliary serial port
whismanoid 10:04022a61b527 10309 #else // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 10:04022a61b527 10310 // Accept commands from Auxiliary serial port
whismanoid 6:f6d16658342b 10311 # if HAS_AUX_SERIAL
whismanoid 6:f6d16658342b 10312 if (AUXserial.readable()) {
whismanoid 6:f6d16658342b 10313 cmdLine_AUXserial.append(AUXserial.getc());
whismanoid 6:f6d16658342b 10314 }
whismanoid 6:f6d16658342b 10315 # endif // HAS_AUX_SERIAL
whismanoid 6:f6d16658342b 10316 # if HAS_DAPLINK_SERIAL
whismanoid 6:f6d16658342b 10317 if (DAPLINKserial.readable()) {
whismanoid 6:f6d16658342b 10318 cmdLine_DAPLINKserial.append(DAPLINKserial.getc());
whismanoid 6:f6d16658342b 10319 }
whismanoid 6:f6d16658342b 10320 # endif // HAS_DAPLINK_SERIAL
whismanoid 10:04022a61b527 10321 #endif // USE_AUX_SERIAL_CMD_FORWARDING
whismanoid 4:d9b05924ad4c 10322 if (serial.readable()) {
whismanoid 4:d9b05924ad4c 10323 int c = serial.getc(); // instead of getc() or fgetc()
whismanoid 4:d9b05924ad4c 10324 cmdLine.append(c);
whismanoid 4:d9b05924ad4c 10325 // cmdLine.onEOLcommandParser handler implements menus
whismanoid 4:d9b05924ad4c 10326 } // if (Serial.available())
whismanoid 4:d9b05924ad4c 10327 #endif // USE_CMDLINE_MENUS support CmdLine command menus
whismanoid 4:d9b05924ad4c 10328
whismanoid 4:d9b05924ad4c 10329 #if USE_DATALOGGER_TRIGGER // support Datalog trigger
whismanoid 32:80f3e5eb77d4 10330 // Datalog trigger
whismanoid 4:d9b05924ad4c 10331 if (Datalogger_Trigger == trigger_Halt) {
whismanoid 4:d9b05924ad4c 10332 // halt the datalogger; continue accepting commands
whismanoid 3:9055e17e181a 10333 continue;
whismanoid 3:9055e17e181a 10334 }
whismanoid 4:d9b05924ad4c 10335 if (Datalogger_Trigger == trigger_FreeRun) {
whismanoid 4:d9b05924ad4c 10336 // free run as fast as possible
whismanoid 3:9055e17e181a 10337 }
whismanoid 4:d9b05924ad4c 10338 if (Datalogger_Trigger == trigger_Timer) {
whismanoid 4:d9b05924ad4c 10339 // timer (configure interval)
whismanoid 32:80f3e5eb77d4 10340 // if Datalogger_Trigger == trigger_Timer sleep(g_timer_interval_msec)
whismanoid 39:4d285e961435 10341 //
whismanoid 39:4d285e961435 10342 #if USE_DATALOGGER_SLEEP // support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 10343 // USE_DATALOGGER_SLEEP -- support sleep modes in Datalogger_Trigger
whismanoid 45:74bf1fe021e5 10344 // Sleep Mode vs Deep Sleep Mode
whismanoid 39:4d285e961435 10345 // See documentation https://os.mbed.com/docs/mbed-os/v5.15/apis/power-management-sleep.html
whismanoid 41:13a6a097502c 10346 // ThisThread::sleep_for(uint32_t millisec)
whismanoid 41:13a6a097502c 10347 // sleep_manager_can_deep_sleep() // tests whether deep_sleep is locked or not
whismanoid 41:13a6a097502c 10348 // sleep_manager_lock_deep_sleep() // begin section that prevents deep_sleep
whismanoid 41:13a6a097502c 10349 // sleep_manager_unlock_deep_sleep() // end section that prevents deep_sleep
whismanoid 39:4d285e961435 10350 switch(g_timer_sleepmode)
whismanoid 39:4d285e961435 10351 {
whismanoid 39:4d285e961435 10352 case datalogger_Sleep_LP0_Stop: // LT sleep = 0,
whismanoid 45:74bf1fe021e5 10353 // TODO: LP0 stop mode not supported; how would we wake up?
whismanoid 39:4d285e961435 10354 break;
whismanoid 39:4d285e961435 10355 case datalogger_Sleep_LP1_DeepSleep: // LT sleep = 1,
whismanoid 42:89607d5d4e6d 10356 //
whismanoid 45:74bf1fe021e5 10357 // In file mbed-os\targets\TARGET_Maxim\TARGET_MAX32625\sleep.c
whismanoid 45:74bf1fe021e5 10358 // support function hal_deepsleep() just calls hal_sleep(),
whismanoid 45:74bf1fe021e5 10359 // so using LP1 Deep Sleep requires calling the low-level functions directly.
whismanoid 42:89607d5d4e6d 10360 //
whismanoid 41:13a6a097502c 10361 // sleep_manager_can_deep_sleep(); // tests whether deep_sleep is locked or not
whismanoid 41:13a6a097502c 10362 // mbed_file_handle(STDIN_FILENO)->enable_input(false); // (mbed-os-5.15) platform.stdio-buffered-serial prevents deep sleep
whismanoid 45:74bf1fe021e5 10363 #if MBED_VERSION >= MBED_ENCODE_VERSION(5, 15, 0)
whismanoid 41:13a6a097502c 10364 cmdLine.serial().enable_input(false); // (mbed-os-5.15) platform.stdio-buffered-serial prevents deep sleep
whismanoid 41:13a6a097502c 10365 // serial.enable_input(false); // (mbed-os-5.15) platform.stdio-buffered-serial prevents deep sleep
whismanoid 43:4c4733760d4c 10366
whismanoid 43:4c4733760d4c 10367 // configure RTC and start
whismanoid 43:4c4733760d4c 10368 // RTC_Setup();
whismanoid 43:4c4733760d4c 10369 {
whismanoid 43:4c4733760d4c 10370 rtc_cfg_t RTCconfig;
whismanoid 43:4c4733760d4c 10371 RTCconfig.compareCount[0] = 5;//5 second timer -- override with RTC_SetCompare(0,counts)
whismanoid 43:4c4733760d4c 10372 RTCconfig.compareCount[1] = 7;//7 second timer -- override with RTC_SetCompare(1,counts)
whismanoid 43:4c4733760d4c 10373 RTCconfig.prescaler = RTC_PRESCALE_DIV_2_12; //1Hz clock
whismanoid 43:4c4733760d4c 10374 RTCconfig.prescalerMask = RTC_PRESCALE_DIV_2_12;//used for prescaler compare
whismanoid 43:4c4733760d4c 10375 RTCconfig.snoozeCount = 0;
whismanoid 43:4c4733760d4c 10376 RTCconfig.snoozeMode = RTC_SNOOZE_DISABLE;
whismanoid 43:4c4733760d4c 10377 RTC_Init(&RTCconfig);
whismanoid 43:4c4733760d4c 10378 RTC_Start();
whismanoid 43:4c4733760d4c 10379
whismanoid 43:4c4733760d4c 10380 // Clear existing wake-up config
whismanoid 43:4c4733760d4c 10381 LP_ClearWakeUpConfig();
whismanoid 43:4c4733760d4c 10382
whismanoid 43:4c4733760d4c 10383 // Clear any event flags
whismanoid 43:4c4733760d4c 10384 LP_ClearWakeUpFlags();
whismanoid 43:4c4733760d4c 10385
whismanoid 43:4c4733760d4c 10386 // configure wake-up on RTC compare 1
whismanoid 43:4c4733760d4c 10387 // LP_ConfigRTCWakeUp(unsigned int comp0_en, unsigned int comp1_en, unsigned int prescale_cmp_en, unsigned int rollover_en);
whismanoid 43:4c4733760d4c 10388 LP_ConfigRTCWakeUp(0, 1, 0, 0);
whismanoid 43:4c4733760d4c 10389
whismanoid 44:84402faa8eb9 10390 // wait until UART_Busy indicates no ongoing transactions (both ports)
whismanoid 44:84402faa8eb9 10391 while (Console_PrepForSleep() != E_NO_ERROR);
whismanoid 44:84402faa8eb9 10392
whismanoid 43:4c4733760d4c 10393 // set RTC compare 1 value
whismanoid 43:4c4733760d4c 10394 // cmp = RTC_GetCount() + LP1_WakeTime;
whismanoid 43:4c4733760d4c 10395 uint32_t cmp = RTC_GetCount() + ((g_timer_interval_msec + 500.) / 1000.);
whismanoid 43:4c4733760d4c 10396 // RTC_SetCompare(uint8_t compareIndex, uint32_t counts)
whismanoid 43:4c4733760d4c 10397 RTC_SetCompare(1, cmp);
whismanoid 43:4c4733760d4c 10398
whismanoid 43:4c4733760d4c 10399 RTC_ClearFlags(MXC_F_RTC_FLAGS_COMP1);
whismanoid 43:4c4733760d4c 10400 }
whismanoid 43:4c4733760d4c 10401
whismanoid 43:4c4733760d4c 10402 //global disable interrupt
whismanoid 43:4c4733760d4c 10403 __disable_irq();
whismanoid 43:4c4733760d4c 10404
whismanoid 43:4c4733760d4c 10405 LP_EnterLP1();
whismanoid 43:4c4733760d4c 10406
whismanoid 43:4c4733760d4c 10407 //global enable interrupt
whismanoid 43:4c4733760d4c 10408 __enable_irq();
whismanoid 43:4c4733760d4c 10409
whismanoid 43:4c4733760d4c 10410 // stop waking on RTC
whismanoid 43:4c4733760d4c 10411 // LP_ConfigRTCWakeUp(unsigned int comp0_en, unsigned int comp1_en, unsigned int prescale_cmp_en, unsigned int rollover_en);
whismanoid 43:4c4733760d4c 10412 LP_ConfigRTCWakeUp(0, 0, 0, 0);
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 45:74bf1fe021e5 10419
whismanoid 43:4c4733760d4c 10420 RTC_Stop();
whismanoid 43:4c4733760d4c 10421
whismanoid 41:13a6a097502c 10422 // mbed_file_handle(STDIN_FILENO)->enable_input(true); // (mbed-os-5.15)
whismanoid 41:13a6a097502c 10423 cmdLine.serial().enable_input(true); // (mbed-os-5.15)
whismanoid 41:13a6a097502c 10424 // serial.enable_input(true); // (mbed-os-5.15)
whismanoid 39:4d285e961435 10425 break;
whismanoid 45:74bf1fe021e5 10426 #endif // MBED_VERSION >= MBED_ENCODE_VERSION(5, 15, 0)
whismanoid 39:4d285e961435 10427 case datalogger_Sleep_LP2_Sleep: // LT sleep = 2,
whismanoid 41:13a6a097502c 10428 sleep_manager_lock_deep_sleep(); // begin section that prevents deep_sleep
whismanoid 41:13a6a097502c 10429 ThisThread::sleep_for(g_timer_interval_msec); // wait_ms(g_timer_interval_msec); // sleep during delay?
whismanoid 41:13a6a097502c 10430 sleep_manager_unlock_deep_sleep(); // end section that prevents deep_sleep
whismanoid 39:4d285e961435 10431 break;
whismanoid 39:4d285e961435 10432 case datalogger_Sleep_LP3_Run: // LT sleep = 3,
whismanoid 45:74bf1fe021e5 10433 // TODO: USE_DATALOGGER_SLEEP -- ThisThread::sleep_for(uint32_t millisec) instead of wait_ms(g_timer_interval_msec)
whismanoid 41:13a6a097502c 10434 wait_ms(g_timer_interval_msec);
whismanoid 39:4d285e961435 10435 break;
whismanoid 39:4d285e961435 10436 }
whismanoid 39:4d285e961435 10437 #else // USE_DATALOGGER_SLEEP
whismanoid 17:9397ea3ea7e9 10438 wait_ms(g_timer_interval_msec); // sleep during delay?
whismanoid 39:4d285e961435 10439 #endif // USE_DATALOGGER_SLEEP
whismanoid 39:4d285e961435 10440 //
whismanoid 17:9397ea3ea7e9 10441 if (g_timer_interval_counter > 0) {
whismanoid 17:9397ea3ea7e9 10442 g_timer_interval_counter--;
whismanoid 17:9397ea3ea7e9 10443 continue;
whismanoid 17:9397ea3ea7e9 10444 }
whismanoid 17:9397ea3ea7e9 10445 // if time interval not yet reached, continue (continue accepting commands)
whismanoid 32:80f3e5eb77d4 10446 g_timer_interval_counter = g_timer_interval_count-1;
whismanoid 3:9055e17e181a 10447 }
whismanoid 4:d9b05924ad4c 10448 if (Datalogger_Trigger == trigger_PlatformDigitalInput) {
whismanoid 4:d9b05924ad4c 10449 // platform digital input (configure digital input pin reference)
whismanoid 17:9397ea3ea7e9 10450 // TODO: read selected input pin, test value
whismanoid 17:9397ea3ea7e9 10451 // TODO: if no match, continue (continue accepting commands)
whismanoid 3:9055e17e181a 10452 }
whismanoid 4:d9b05924ad4c 10453 if (Datalogger_Trigger == trigger_SPIDeviceRegRead) {
whismanoid 4:d9b05924ad4c 10454 // SPI device register read (configure regaddr, mask value, match value)
whismanoid 17:9397ea3ea7e9 10455 // TODO: SPI transfer regAddr
whismanoid 17:9397ea3ea7e9 10456 // TODO: apply dataMask, compare with testValue
whismanoid 17:9397ea3ea7e9 10457 // TODO: if no match, continue (continue accepting commands)
whismanoid 4:d9b05924ad4c 10458 }
whismanoid 4:d9b05924ad4c 10459 #endif // USE_DATALOGGER_TRIGGER support Datalog trigger
whismanoid 0:cb44e2e9ec4c 10460
whismanoid 8:dffee7509bfb 10461 // column header banner for csv data columns
whismanoid 8:dffee7509bfb 10462 if (Datalogger_Need_PrintHeader) {
whismanoid 8:dffee7509bfb 10463 if (Datalogger_enable_serial) {
whismanoid 8:dffee7509bfb 10464 Datalogger_PrintHeader(cmdLine);
whismanoid 8:dffee7509bfb 10465 }
whismanoid 8:dffee7509bfb 10466 # if HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 10467 if (Datalogger_enable_AUXserial) {
whismanoid 8:dffee7509bfb 10468 Datalogger_PrintHeader(cmdLine_AUXserial);
whismanoid 8:dffee7509bfb 10469 }
whismanoid 8:dffee7509bfb 10470 # endif // HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 10471 # if HAS_DAPLINK_SERIAL
whismanoid 8:dffee7509bfb 10472 if (Datalogger_enable_DAPLINKserial) {
whismanoid 8:dffee7509bfb 10473 Datalogger_PrintHeader(cmdLine_DAPLINKserial);
whismanoid 8:dffee7509bfb 10474 }
whismanoid 8:dffee7509bfb 10475 # endif // HAS_DAPLINK_SERIAL
whismanoid 8:dffee7509bfb 10476 Datalogger_Need_PrintHeader = false;
whismanoid 8:dffee7509bfb 10477 }
whismanoid 5:aaf8b5f5fda1 10478 Datalogger_AcquireRow();
whismanoid 17:9397ea3ea7e9 10479 #if USE_DATALOGGER_ActionTable // Datalogger_RunActionTable() supported actions
whismanoid 17:9397ea3ea7e9 10480 // Datalogger_RunActionTable() between Datalogger_AcquireRow() and Datalogger_PrintRow()
whismanoid 17:9397ea3ea7e9 10481 Datalogger_RunActionTable();
whismanoid 17:9397ea3ea7e9 10482 #endif // USE_DATALOGGER_ActionTable Datalogger_RunActionTable() supported actions
whismanoid 0:cb44e2e9ec4c 10483 // wait(3.0);
whismanoid 0:cb44e2e9ec4c 10484 // CODE GENERATOR: print conversion result
whismanoid 0:cb44e2e9ec4c 10485 // Use Arduino Serial Plotter to view output: Tools | Serial Plotter
whismanoid 8:dffee7509bfb 10486 if (Datalogger_enable_serial) {
whismanoid 8:dffee7509bfb 10487 Datalogger_PrintRow(cmdLine);
whismanoid 8:dffee7509bfb 10488 }
whismanoid 8:dffee7509bfb 10489 # if HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 10490 if (Datalogger_enable_AUXserial) {
whismanoid 8:dffee7509bfb 10491 Datalogger_PrintRow(cmdLine_AUXserial);
whismanoid 8:dffee7509bfb 10492 }
whismanoid 8:dffee7509bfb 10493 # endif // HAS_AUX_SERIAL
whismanoid 8:dffee7509bfb 10494 # if HAS_DAPLINK_SERIAL
whismanoid 8:dffee7509bfb 10495 if (Datalogger_enable_DAPLINKserial) {
whismanoid 8:dffee7509bfb 10496 Datalogger_PrintRow(cmdLine_DAPLINKserial);
whismanoid 8:dffee7509bfb 10497 }
whismanoid 8:dffee7509bfb 10498 # endif // HAS_DAPLINK_SERIAL
whismanoid 0:cb44e2e9ec4c 10499
whismanoid 0:cb44e2e9ec4c 10500 } // this code repeats forever
whismanoid 0:cb44e2e9ec4c 10501 }
whismanoid 0:cb44e2e9ec4c 10502 //---------- CODE GENERATOR: end DataLogHelloCppCodeList