Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 63310bdd03 | |||
| 1954ff8d9e | |||
| c656eebcbc | |||
| e17e78bc18 | |||
| c3235e985f | |||
| 656e0fb485 | |||
| d3dd5270dd | |||
| e588b30c8b | |||
| d3f9aec31c | |||
| ed617c88c9 | |||
| 0b8f4c2414 | |||
| b5449b7404 | |||
| a3c1241f38 | |||
| bbf60ebfed | |||
| 0e9f40bdd5 | |||
| e32897f6b5 | |||
| 6ee4b47d90 | |||
| dac19f62b2 | |||
| 8e6d112729 | |||
| 9e1dc1e3f4 | |||
| 49fb3afc01 | |||
| f3b402fce9 | |||
| ef9a38d7fc | |||
| 67275a7921 | |||
| 0ddaa02414 | |||
| 96d5735164 | |||
| ac32fb9c73 | |||
| 9acc242ff6 | |||
| d8a403c410 | |||
| f1d0acef23 | |||
| 9811572f47 | |||
| 8753e2ddc6 | |||
| f6167c25ca | |||
| cb3894712e | |||
| 995a47e200 | |||
| cde9096018 | |||
| 6c1bd24b92 | |||
| 0c129bc99b | |||
| cbe9bd8211 | |||
| 0293647d0c | |||
| 87d187c3a5 | |||
| 09fbfd9dda | |||
| 74ca631309 | |||
| 03e86e175d | |||
| 1c54525256 |
+41
-41
@@ -34,17 +34,17 @@
|
||||
<listOptionValue builtIn="false" value="LINK_ORDER=TOOLS/ccs_linker_defines.cmd;TOOLS/cc26xx_app.cmd;"/>
|
||||
<listOptionValue builtIn="false" value="RTSC_MBS_VERSION=2.2.0"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.277675815" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="18.1.4.LTS" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.277675815" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="18.1.4.LTS" valueType="string"/>
|
||||
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug.1593934674" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug"/>
|
||||
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug.632414212" name="GNU Make.FlashROM" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug"/>
|
||||
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug.632414212" keepEnvironmentInBuildfile="false" name="GNU Make" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug"/>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.compilerDebug.154623462" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.compilerDebug">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.974280107" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.7M3" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.1783826131" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.16" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.1536570599" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.eabi" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN.1895413316" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.322983319" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.1305400753" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH.1468985930" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH" valueType="includePath">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.974280107" name="Target processor version (--silicon_version, -mv)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.7M3" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.1783826131" name="Designate code state, 16-bit (thumb) or 32-bit (--code_state)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.16" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.1536570599" name="Application binary interface. (--abi)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.eabi" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN.1895413316" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.322983319" name="Optimization level (--opt_level, -O)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.1305400753" name="Speed vs. size trade-offs (--opt_for_speed, -mf)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH.1468985930" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/>
|
||||
<listOptionValue builtIn="false" value="C:\ti\simplelink\ble_sdk_2_02_02_25\src\examples\simple_peripheral\cc26xx\app\headstage"/>
|
||||
<listOptionValue builtIn="false" value="${SRC_EX}/examples/simple_peripheral/cc26xx/app"/>
|
||||
@@ -70,7 +70,7 @@
|
||||
<listOptionValue builtIn="false" value="${SRC_BLE_CORE}/rom"/>
|
||||
<listOptionValue builtIn="false" value="${CC26XXWARE}"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.1897088" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE" valueType="definedSymbols">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.1897088" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="BOARD_DISPLAY_EXCLUDE_UART"/>
|
||||
<listOptionValue builtIn="false" value="POWER_SAVING"/>
|
||||
<listOptionValue builtIn="false" value="BOOSTXL_CC2650MA"/>
|
||||
@@ -86,19 +86,19 @@
|
||||
<listOptionValue builtIn="false" value="xdc_runtime_Assert_DISABLE_ALL"/>
|
||||
<listOptionValue builtIn="false" value="xdc_runtime_Log_DISABLE_ALL"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL.871011287" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.863089168" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.C99" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GCC.1454248503" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GCC" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS.1965115059" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS" valueType="stringList">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL.871011287" name="Debugging model" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.863089168" name="C Dialect" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.C99" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GCC.1454248503" name="Enable support for GCC extensions (DEPRECATED) (--gcc)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GCC" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS.1965115059" name="Suppress diagnostic <id> (--diag_suppress, -pds)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="48"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING.1638011093" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING" valueType="stringList">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING.1638011093" name="Treat diagnostic <id> as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="225"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.1920170652" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER.2038786257" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS.811478344" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS.on" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE.1229809338" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE" valueType="stringList">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.1920170652" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER.2038786257" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS.811478344" name="Place each function in a separate subsection (--gen_func_subsections, -ms)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS.on" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE.1229809338" name="Read options from specified file (--cmd_file, -@)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="${SRC_EX}/config/build_components.opt"/>
|
||||
<listOptionValue builtIn="false" value="${ORG_PROJ_DIR}/build_config.opt"/>
|
||||
<listOptionValue builtIn="false" value="${ORG_PROJ_DIR}/../../ccs/config/ccs_compiler_defines.bcfg"/>
|
||||
@@ -109,48 +109,48 @@
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS.463094612" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS"/>
|
||||
</tool>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1351821865" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE.174129193" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE" value="256" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE.567300083" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE" value="0" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE.1800982811" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE" value=""${ProjName}.map"" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.1091211742" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY.1479599481" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY" valueType="libs">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE.174129193" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE" value="256" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE.567300083" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE" value="0" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE.1800982811" name="Link information (map) listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE" value=""${ProjName}.map"" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.1091211742" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY.1479599481" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="libc.a"/>
|
||||
<listOptionValue builtIn="false" value="${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib"/>
|
||||
<listOptionValue builtIn="false" value="${ROM}/common_rom_releases/03282014/common_rom.symbols"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH.672837228" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH" valueType="libPaths">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH.672837228" name="Add <dir> to library search path (--search_path, -i)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH" valueType="libPaths">
|
||||
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/lib"/>
|
||||
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS.544523272" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS" valueType="stringList">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS.544523272" name="Suppress diagnostic <id> (--diag_suppress)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="10247-D"/>
|
||||
<listOptionValue builtIn="false" value="16002-D"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.1281207998" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER.468817864" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO.1679096029" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO" value=""${ProjName}_linkInfo.xml"" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.254835397" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.on" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.1848192295" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.on" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.1281207998" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER.468817864" name="Emit diagnostic identifier numbers (--display_error_number)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO.1679096029" name="Detailed link information data-base into <file> (--xml_link_info, -xml_link_info)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO" value=""${ProjName}_linkInfo.xml"" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.254835397" name="Aggressively reduce size of the DWARF information (--compress_dwarf)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.on" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.1848192295" name="Eliminate sections not needed in the executable (--unused_section_elimination)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.on" valueType="enumerated"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD_SRCS.1999849945" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD2_SRCS.25027104" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD2_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__GEN_CMDS.888093741" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__GEN_CMDS"/>
|
||||
</tool>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.19288898" name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.11734737" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH" value="8" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH.466140455" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH" value="8" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.824070691" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.INTEL" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.11734737" name="Specify rom width (--romwidth, -romwidth=width)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH" value="8" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH.466140455" name="Specify memory width (--memwidth, -memwidth=width)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH" value="8" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.824070691" name="Output format" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.INTEL" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.1392704063" name="XDCtools" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool">
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH.225737408" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH" valueType="stringList">
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH.225737408" name="Package repositories (--xdcpath)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="${COM_TI_RTSC_TIRTOSCC13XX_CC26XX_REPOS}"/>
|
||||
<listOptionValue builtIn="false" value="${TARGET_CONTENT_BASE}"/>
|
||||
</option>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET.571281110" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET" value="ti.targets.arm.elf.M3" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM.205178830" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM" value="ti.platforms.simplelink:CC2640F128" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW.1097777495" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW" value="ti.platforms.simplelink:CC2640F128" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE.744121344" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE" value="release" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR.165807018" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR" value="${CG_TOOL_ROOT}" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.COMPILE_OPTIONS.391961861" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.COMPILE_OPTIONS" value=""${COMPILER_FLAGS}"" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET.571281110" name="Target (-t)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET" value="ti.targets.arm.elf.M3" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM.205178830" name="Platform (-p)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM" value="ti.platforms.simplelink:CC2640F128" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW.1097777495" name="Platform (-p)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW" value="ti.platforms.simplelink:CC2640F128" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE.744121344" name="Build-profile (-r)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE" value="release" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR.165807018" name="Compiler tools directory (-c)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR" value="${CG_TOOL_ROOT}" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.COMPILE_OPTIONS.391961861" name="Additional compiler options (--compileOptions)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.COMPILE_OPTIONS" value=""${COMPILER_FLAGS}"" valueType="string"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+43
-14
@@ -133,13 +133,11 @@ static void update_latch_status (uint32_t latch_num, uint32_t elite_pin, bool hi
|
||||
}
|
||||
|
||||
static void PIN15_setOutputValue (uint32_t latch_num, uint32_t pin_num, bool highlow) {
|
||||
if(PeriodicEvent){
|
||||
ELITE15_SPI_CLOSE();
|
||||
}
|
||||
ELITE15_SPI_CLOSE();
|
||||
add_elite_pin();
|
||||
update_latch_status (latch_num, pin_num, highlow);
|
||||
PIN_setOutputValue(&ZM_rst, latch_num, 1); // Turn on latch
|
||||
CPUdelay(10);
|
||||
// PIN_setOutputValue(&ZM_rst, latch_num, 1); // Turn on latch
|
||||
|
||||
switch (latch_num) {
|
||||
case LOAD0: {
|
||||
// PIN_setOutputValue(&ZM_rst, D0, LH.LATCH0[0]);
|
||||
@@ -178,23 +176,17 @@ static void PIN15_setOutputValue (uint32_t latch_num, uint32_t pin_num, bool hig
|
||||
break;
|
||||
}
|
||||
}
|
||||
PIN_setOutputValue(&ZM_rst, latch_num, 1); // Turn on latch
|
||||
CPUdelay(10);
|
||||
PIN_setOutputValue(&ZM_rst, latch_num, 0); // Turn off latch
|
||||
remove_elite_pin();
|
||||
|
||||
if(PeriodicEvent){
|
||||
ELITE15_SPI_HOLD();
|
||||
}
|
||||
ELITE15_SPI_HOLD();
|
||||
}
|
||||
|
||||
static void Init_Elite15_PIN () {
|
||||
InitLH();
|
||||
add_elite_pin();
|
||||
|
||||
PIN_setOutputValue(pin_handle, LOAD0, 1);
|
||||
PIN_setOutputValue(pin_handle, LOAD1, 1);
|
||||
PIN_setOutputValue(pin_handle, LOAD2, 1);
|
||||
CPUdelay(10);
|
||||
PIN_setOutputValue(pin_handle, D0, 0);
|
||||
PIN_setOutputValue(pin_handle, D1, 0);
|
||||
PIN_setOutputValue(pin_handle, D2, 0);
|
||||
@@ -203,12 +195,49 @@ static void Init_Elite15_PIN () {
|
||||
PIN_setOutputValue(pin_handle, D5, 0);
|
||||
PIN_setOutputValue(pin_handle, D6, 0);
|
||||
PIN_setOutputValue(pin_handle, D7, 0);
|
||||
CPUdelay(10);
|
||||
PIN_setOutputValue(pin_handle, LOAD0, 0);
|
||||
PIN_setOutputValue(pin_handle, LOAD1, 1);
|
||||
PIN_setOutputValue(pin_handle, LOAD2, 1);
|
||||
CPUdelay(10);
|
||||
PIN_setOutputValue(pin_handle, LOAD1, 0);
|
||||
PIN_setOutputValue(pin_handle, LOAD2, 0);
|
||||
|
||||
|
||||
PIN_setOutputValue(pin_handle, D0, 0);
|
||||
PIN_setOutputValue(pin_handle, D1, 0);
|
||||
PIN_setOutputValue(pin_handle, D2, 0);
|
||||
PIN_setOutputValue(pin_handle, D3, 0);
|
||||
PIN_setOutputValue(pin_handle, D4, 1);
|
||||
PIN_setOutputValue(pin_handle, D5, 1);
|
||||
PIN_setOutputValue(pin_handle, D6, 1);
|
||||
PIN_setOutputValue(pin_handle, D7, 1);
|
||||
CPUdelay(10);
|
||||
PIN_setOutputValue(pin_handle, LOAD0, 1);
|
||||
PIN_setOutputValue(pin_handle, LOAD0, 0);
|
||||
|
||||
remove_elite_pin();
|
||||
|
||||
// InitLH();
|
||||
// add_elite_pin();
|
||||
//
|
||||
// PIN_setOutputValue(pin_handle, LOAD0, 1);
|
||||
// PIN_setOutputValue(pin_handle, LOAD1, 1);
|
||||
// PIN_setOutputValue(pin_handle, LOAD2, 1);
|
||||
// CPUdelay(10);
|
||||
// PIN_setOutputValue(pin_handle, D0, 0);
|
||||
// PIN_setOutputValue(pin_handle, D1, 0);
|
||||
// PIN_setOutputValue(pin_handle, D2, 0);
|
||||
// PIN_setOutputValue(pin_handle, D3, 0);
|
||||
// PIN_setOutputValue(pin_handle, D4, 0);
|
||||
// PIN_setOutputValue(pin_handle, D5, 0);
|
||||
// PIN_setOutputValue(pin_handle, D6, 0);
|
||||
// PIN_setOutputValue(pin_handle, D7, 0);
|
||||
// CPUdelay(10);
|
||||
// PIN_setOutputValue(pin_handle, LOAD0, 0);
|
||||
// PIN_setOutputValue(pin_handle, LOAD1, 0);
|
||||
// PIN_setOutputValue(pin_handle, LOAD2, 0);
|
||||
//
|
||||
// remove_elite_pin();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+62
-38
@@ -46,11 +46,7 @@ static void ADC_write(uint8_t ADCin) {
|
||||
spi_ADC_txbuf[0] = ADCin;
|
||||
spi_ADC_txbuf[1] = 0b11101011;
|
||||
|
||||
if(PeriodicEvent){
|
||||
ADC_SPI_TEST(2, spi_ADC_txbuf, spi_ADC_rxbuf);
|
||||
}else{
|
||||
ADC_SPI(2, spi_ADC_txbuf, spi_ADC_rxbuf);
|
||||
}
|
||||
ADC_SPI(2, spi_ADC_txbuf, spi_ADC_rxbuf);
|
||||
}
|
||||
|
||||
static void ADC_read(uint8_t *ADCdata){
|
||||
@@ -59,13 +55,32 @@ static void ADC_read(uint8_t *ADCdata){
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
if(PeriodicEvent){
|
||||
ADC_SPI_TEST(2, spi_ADC_txbuf, spi_ADC_rxbuf);
|
||||
}else{
|
||||
ADC_SPI(2, spi_ADC_txbuf, spi_ADC_rxbuf);
|
||||
}
|
||||
ADC_SPI(2, spi_ADC_txbuf, spi_ADC_rxbuf);
|
||||
}
|
||||
|
||||
/* Elite1.5 Calibration Usage */
|
||||
static void CAL_ADC_read(uint8_t *ADCdata){
|
||||
for(int i=0 ; i<SPI_ADC_SIZE ; i++){
|
||||
spi_ADC_txbuf[i] = 0;
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
CAL_ADC_SPI(SPI_ADC_SIZE, spi_ADC_txbuf, ADCdata);
|
||||
}
|
||||
|
||||
static void CAL_ADC_write(uint8_t ADCin) {
|
||||
for(int i=0 ; i<SPI_ADC_SIZE ; i++){
|
||||
spi_ADC_txbuf[i] = 0;
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
spi_ADC_txbuf[0] = ADCin;
|
||||
spi_ADC_txbuf[1] = 0b11101011;
|
||||
|
||||
CAL_ADC_SPI(2, spi_ADC_txbuf, spi_ADC_rxbuf);
|
||||
}
|
||||
|
||||
/* Gain Control for Vin & Iin */
|
||||
static void IinADCGainControl(uint8_t IinADCLevel){
|
||||
if(IinADCLevel == 0){
|
||||
// ADC gain level = 0, using 3M resister
|
||||
@@ -223,12 +238,20 @@ static void ReadADCBat(uint8_t *buf){
|
||||
|
||||
/* for Elite1.5-re */
|
||||
// Iin theoretical boundary <2.67, 1.89~80, 63~2600, >1900 (uA)
|
||||
/* Old boundary
|
||||
#define I_GAIN_SMALL_BOUNDARY 4000 // 4 uA = 4,000,000 pA
|
||||
#define I_GAIN_MID1_BOUNDARY1 2000 // 2 uA = 2,000,000 pA
|
||||
#define I_GAIN_MID1_BOUNDARY2 90000 // 90 uA = 90,000,000 pA
|
||||
#define I_GAIN_MID2_BOUNDARY1 70000 // 70 uA = 70,000,000 pA
|
||||
#define I_GAIN_MID2_BOUNDARY2 1800000 // 1800 uA = 1,800,000 nA
|
||||
#define I_GAIN_LARGE_BOUNDARY 950000 // 950 uA = 950,000 nA
|
||||
*/
|
||||
#define I_GAIN_SMALL_BOUNDARY 4000 // 4 uA = 4,000,000 pA
|
||||
#define I_GAIN_MID1_BOUNDARY1 2500 // 2.5 uA = 2,500,000 pA
|
||||
#define I_GAIN_MID1_BOUNDARY2 100000 // 100 uA = 100,000,000 pA
|
||||
#define I_GAIN_MID2_BOUNDARY1 85000 // 85 uA = 85,000,000 pA
|
||||
#define I_GAIN_MID2_BOUNDARY2 2050000 // 2050 uA = 2,050,000 nA
|
||||
#define I_GAIN_LARGE_BOUNDARY 1800000 // 1800 uA = 1,800,000 nA
|
||||
|
||||
// Vin theoretical boundary <7, 5~200, >100 (mV)
|
||||
#define VIN_GAIN_SMALL_BOUNDARY 7000 // 7 mV = 7,000,000 nV
|
||||
@@ -239,11 +262,6 @@ static void ReadADCBat(uint8_t *buf){
|
||||
static int32_t AutoGainReadIin(uint8_t *buf){
|
||||
int32_t RealCurrent = 0;
|
||||
|
||||
if(INSTRUCTION.ADCGainLevel == I_GAIN_AUTO){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_100R;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
}
|
||||
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
RealCurrent = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
|
||||
@@ -253,12 +271,6 @@ static int32_t AutoGainReadIin(uint8_t *buf){
|
||||
static int32_t AutoGainReadVin(uint8_t *buf){
|
||||
int32_t RealVolt = 0;
|
||||
|
||||
if(INSTRUCTION.VinADCGainLevel == VIN_GAIN_AUTO){
|
||||
INSTRUCTION.VinADCGainLevel = VIN_GAIN_1K;
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
record_flag = false;
|
||||
}
|
||||
|
||||
ReadADCVin(spi_ADC_rxbuf);
|
||||
RealVolt = DecodeADCValue(INSTRUCTION.VinADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
|
||||
@@ -547,35 +559,47 @@ static void AutoGainChangeVin(int32_t RealVin){
|
||||
}
|
||||
|
||||
static uint16_t ADC_CURRENT_AVG_calibration (uint8_t ADC_channel) {
|
||||
uint32_t ADCValueTemp = 0;
|
||||
uint32_t ADCValueSUM = 0;
|
||||
uint32_t ADCValueAVG = 0;
|
||||
uint16_t ADCValueAVG_RAW = 0;
|
||||
#define count 10000
|
||||
uint32_t ADCValueTemp = 0;
|
||||
uint32_t ADCValueSUM = 0;
|
||||
uint32_t ADCValueAVG = 0;
|
||||
uint16_t ADCValueAVG_RAW = 0;
|
||||
#define avgcount 10000
|
||||
|
||||
// Red light for start acquiring data
|
||||
Elite_led_color(COLOR_RED);
|
||||
// CPUdelay(10);
|
||||
for(int i=0; i<avgcount; i++){
|
||||
CAL_ADC_write(ADC_channel);
|
||||
CAL_ADC_read(spi_ADC_rxbuf);
|
||||
CPUdelay(10);
|
||||
CAL_ADC_write(ADC_channel);
|
||||
CAL_ADC_read(spi_ADC_rxbuf);
|
||||
CPUdelay(500);
|
||||
|
||||
for(int i=0; i<count; i++){
|
||||
ADCChannelSelect(ADC_channel);
|
||||
CPUdelay(10);
|
||||
ADC_read(spi_ADC_rxbuf);
|
||||
CPUdelay(10);
|
||||
ADCChannelSelect(ADC_channel);
|
||||
CPUdelay(10);
|
||||
ADC_read(spi_ADC_rxbuf);
|
||||
CPUdelay(10);
|
||||
|
||||
ADCValueTemp = 0x0000FFFF & ((uint32_t) (spi_ADC_rxbuf[0]) << 8 | (uint32_t) (spi_ADC_rxbuf[1]));
|
||||
ADCValueTemp = 0x0000FFFF & (((uint32_t) (spi_ADC_rxbuf[0]) << 8) | ((uint32_t) (spi_ADC_rxbuf[1])));
|
||||
ADCValueSUM = ADCValueSUM + ADCValueTemp;
|
||||
}
|
||||
|
||||
ADCValueAVG = ADCValueSUM / count;
|
||||
ADCValueAVG = ADCValueSUM / avgcount;
|
||||
ADCValueAVG_RAW = (uint16_t) (ADCValueAVG & 0x0000FFFF);
|
||||
|
||||
// Blue light for data acquire done
|
||||
Elite_led_color(COLOR_BLUE);
|
||||
|
||||
if (ADCValueAVG_RAW > 0x7FFF) {
|
||||
ADCValueAVG_RAW = 0x0000;
|
||||
}
|
||||
|
||||
// clean data
|
||||
ADCValueAVG = 0;
|
||||
ADCValueSUM = 0;
|
||||
ADCValueTemp = 0;
|
||||
|
||||
// // Blue light for data acquire done
|
||||
// Elite_led_color(COLOR_BLUE);
|
||||
|
||||
|
||||
|
||||
return ADCValueAVG_RAW;
|
||||
}
|
||||
|
||||
|
||||
+67
-42
@@ -72,57 +72,82 @@ static void CV3_Vscan(CV3Mode *CV3){
|
||||
}
|
||||
|
||||
if(!vscanReset){
|
||||
if (Vset >= CV3->_Vmax){
|
||||
VmaxCounter++;
|
||||
}else if (Vset <= CV3->_Vmin){
|
||||
VminCounter++;
|
||||
}
|
||||
if((INSTRUCTION.Vinit < INSTRUCTION.Ve1 && INSTRUCTION.Vinit < INSTRUCTION.Ve2) ||
|
||||
(INSTRUCTION.Vinit > INSTRUCTION.Ve1 && INSTRUCTION.Vinit > INSTRUCTION.Ve2)
|
||||
){
|
||||
if (CV3->_current_direction_up){
|
||||
Vset = Vset + CV3->_Vstep;
|
||||
}else{
|
||||
Vset = Vset - CV3->_Vstep;
|
||||
}
|
||||
|
||||
if (CV3->_current_direction_up){
|
||||
Vset = Vset + CV3->_Vstep * GPT.GptimerMultiple;
|
||||
if(INSTRUCTION.Vinit < INSTRUCTION.Ve1 && INSTRUCTION.Vinit < INSTRUCTION.Ve2){
|
||||
if(Vset == CV3->_Vmin){
|
||||
VminCounter = -1;
|
||||
INSTRUCTION.Vinit = INSTRUCTION.Vmin;
|
||||
CV3->_Vinit = CV3->_Vmin;
|
||||
}
|
||||
}else if(INSTRUCTION.Vinit > INSTRUCTION.Ve1 && INSTRUCTION.Vinit > INSTRUCTION.Ve2){
|
||||
if(Vset == CV3->_Vmax){
|
||||
VmaxCounter = -1;
|
||||
INSTRUCTION.Vinit = INSTRUCTION.Vmax;
|
||||
CV3->_Vinit = CV3->_Vmax;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Vset = Vset - CV3->_Vstep * GPT.GptimerMultiple;
|
||||
}
|
||||
if (Vset >= CV3->_Vmax){
|
||||
VmaxCounter++;
|
||||
}else if (Vset <= CV3->_Vmin){
|
||||
VminCounter++;
|
||||
}
|
||||
|
||||
if(VmaxCounter != 0 && VminCounter != 0){
|
||||
if(VmaxCounter == VminCounter && CV3->_direction_up && CV3->_current_direction_up){
|
||||
if(CycleCounter != VmaxCounter){
|
||||
if(Vset >= CV3->_Vinit){
|
||||
CV3->_cycleNumber--;
|
||||
CycleCounter = VmaxCounter; //VmaxCounter = VminCounter = CycleCounter
|
||||
if (CV3->_current_direction_up){
|
||||
Vset = Vset + CV3->_Vstep * GPT.GptimerMultiple;
|
||||
}else{
|
||||
Vset = Vset - CV3->_Vstep * GPT.GptimerMultiple;
|
||||
}
|
||||
|
||||
if(VmaxCounter != 0 && VminCounter != 0){
|
||||
if(VmaxCounter == VminCounter && CV3->_direction_up && CV3->_current_direction_up){
|
||||
if(CycleCounter != VmaxCounter){
|
||||
if(Vset >= CV3->_Vinit){
|
||||
CV3->_cycleNumber--;
|
||||
CycleCounter = VmaxCounter; //VmaxCounter = VminCounter = CycleCounter
|
||||
}
|
||||
}
|
||||
}
|
||||
if(VmaxCounter == VminCounter && !CV3->_direction_up && !CV3->_current_direction_up){
|
||||
if(CycleCounter != VmaxCounter){
|
||||
if(Vset <= CV3->_Vinit){
|
||||
CV3->_cycleNumber--;
|
||||
CycleCounter = VmaxCounter; //VmaxCounter = VminCounter = CycleCounter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(VmaxCounter == VminCounter && !CV3->_direction_up && !CV3->_current_direction_up){
|
||||
if(CycleCounter != VmaxCounter){
|
||||
if(Vset <= CV3->_Vinit){
|
||||
CV3->_cycleNumber--;
|
||||
CycleCounter = VmaxCounter; //VmaxCounter = VminCounter = CycleCounter
|
||||
}
|
||||
}
|
||||
|
||||
if (Vset >= CV3->_Vmax){
|
||||
CV3->_current_direction_up = false;
|
||||
}else if (Vset <= CV3->_Vmin){
|
||||
CV3->_current_direction_up = true;
|
||||
}
|
||||
|
||||
/*stop condition*/
|
||||
if(CV3->_cycleNumber == 0){
|
||||
// PeriodicEvent = false;
|
||||
ModeLED(POST_WORK);
|
||||
InitEliteFlag();
|
||||
INSTRUCTION.eliteFxn = CONSTANT_CURRENT;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.charge = 0x01;
|
||||
INSTRUCTION.constantCurrent = 0x00;
|
||||
INSTRUCTION.Vmax = 0xC350;
|
||||
INSTRUCTION.Vmin = 0x0000;
|
||||
INSTRUCTION.notifyRate = 500;
|
||||
INSTRUCTION.VoViSwitch = 0x02;//read Vscan = Vout - Vin
|
||||
}
|
||||
}
|
||||
|
||||
if (Vset >= CV3->_Vmax){
|
||||
CV3->_current_direction_up = false;
|
||||
}else if (Vset <= CV3->_Vmin){
|
||||
CV3->_current_direction_up = true;
|
||||
}
|
||||
|
||||
/*stop condition*/
|
||||
if(CV3->_cycleNumber == 0){
|
||||
// PeriodicEvent = false;
|
||||
ModeLED(POST_WORK);
|
||||
InitEliteFlag();
|
||||
INSTRUCTION.eliteFxn = CONSTANT_CURRENT;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.charge = 0x01;
|
||||
INSTRUCTION.constantCurrent = 0x00;
|
||||
INSTRUCTION.Vmax = 0xC350;
|
||||
INSTRUCTION.Vmin = 0x0000;
|
||||
INSTRUCTION.notifyRate = 500;
|
||||
INSTRUCTION.VoViSwitch = 0x02;//read Vscan = Vout - Vin
|
||||
}
|
||||
}
|
||||
// int32_t RealV;
|
||||
// RealV = (int32_t)(Vset / 500);//[1uV]
|
||||
|
||||
-1
@@ -210,7 +210,6 @@ static void CV_Vscan(CVMode *CV){
|
||||
/*stop condition*/
|
||||
if(CV->_cycleNumber == 0){
|
||||
PeriodicEvent = false;
|
||||
ELITE15_SPI_CLOSE();
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}
|
||||
|
||||
+14
-9
@@ -51,11 +51,7 @@ static uint16_t DAC_outputV(uint16_t voltLV) {
|
||||
spi_DACtxbuf[1] = v1;
|
||||
spi_DACtxbuf[2] = v2;
|
||||
|
||||
if(PeriodicEvent){
|
||||
DAC_SPI_TEST(SPI_DAC_SIZE, spi_DACtxbuf, spi_rxbuf);
|
||||
}else{
|
||||
DAC_SPI(SPI_DAC_SIZE, spi_DACtxbuf, spi_rxbuf);
|
||||
}
|
||||
DAC_SPI(SPI_DAC_SIZE, spi_DACtxbuf, spi_rxbuf);
|
||||
|
||||
return voltLV;
|
||||
}
|
||||
@@ -88,13 +84,22 @@ static int32_t User2Real(uint16_t UserCode){
|
||||
|
||||
|
||||
// DAC Vout theoretical boundary <300, 100~ (mV)
|
||||
#define DAC_VOUT_GAIN_SMALL_BOUNDARY 100000 // 100 mV = 25500(usercode)
|
||||
#define DAC_VOUT_GAIN_LARGE_BOUNDARY 300000 // 300 mV = 26500(usercode)
|
||||
#define DAC_VOUT_GAIN_SMALL_BOUNDARY 100000 // 25500(usercode) = 100 mV
|
||||
#define DAC_VOUT_GAIN_LARGE_BOUNDARY 300000 // 26500(usercode) = 300 mV
|
||||
#define DAC_VOUT_GAIN_LARGE_BOUNDARY_USERCODE 26500 // 26500(usercode) = 300 mV
|
||||
#define DAC_VOUT_GAIN_LARGE_BOUNDARY1_USERCODE 23500 // 23500(usercode) = -300 mV
|
||||
|
||||
static void AutoGainChangeVout(int32_t RealVolt){
|
||||
RealVolt = (RealVolt - 25000) * 200; // (RealVolt - 25000) / 5 * 1000
|
||||
static void AutoGainChangeVout(int32_t userCode){
|
||||
int32_t RealVolt = (userCode - 25000) * 200; // (userCode - 25000) / 5 * 1000 [1uV]
|
||||
// switch to 1 level volt(small) 15K
|
||||
// switch to 2 level volt(large) 240K
|
||||
|
||||
if(INSTRUCTION.VoutGainLevel == VOUT_GAIN_AUTO){
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_15K;
|
||||
VoutGainControl(INSTRUCTION.VoutGainLevel);
|
||||
record_flag = false;
|
||||
}
|
||||
|
||||
if(INSTRUCTION.VoutGainLevel == VOUT_GAIN_15K){
|
||||
if(RealVolt > DAC_VOUT_GAIN_LARGE_BOUNDARY || RealVolt < -1 * DAC_VOUT_GAIN_LARGE_BOUNDARY){
|
||||
// switch to 2 level volt(large)
|
||||
|
||||
+83
-23
@@ -29,7 +29,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#define BOARD_C6D4
|
||||
#define BOARD_C771
|
||||
|
||||
typedef struct _formula{
|
||||
|
||||
@@ -49,7 +49,7 @@ struct _correction{
|
||||
|
||||
} Correction =
|
||||
|
||||
#ifdef BOARD_C6E1
|
||||
#ifdef BOARD_C6E1 // not well
|
||||
{
|
||||
.ADC_volt[0].coeff = (-6251051),
|
||||
.ADC_volt[0].offset = 102081366120,
|
||||
@@ -82,36 +82,36 @@ struct _correction{
|
||||
|
||||
#ifdef BOARD_C7A1
|
||||
{
|
||||
.ADC_volt[0].coeff = (6204),
|
||||
.ADC_volt[0].offset = -100237253,
|
||||
.ADC_volt[0].coeff = (6256),
|
||||
.ADC_volt[0].offset = -101532028,
|
||||
|
||||
.ADC_volt[1].coeff = (214511),
|
||||
.ADC_volt[1].offset = -3485722036,
|
||||
.ADC_volt[1].coeff = (215138),
|
||||
.ADC_volt[1].offset = -3501890770,
|
||||
|
||||
.ADC_volt[2].coeff = (6213224),
|
||||
.ADC_volt[2].offset = -101104189300,
|
||||
.ADC_volt[2].coeff = (6245014),
|
||||
.ADC_volt[2].offset = -101751226981,
|
||||
|
||||
.ADC_current[0].coeff = 2078892,
|
||||
.ADC_current[0].offset = (-33685110900),
|
||||
.ADC_current[0].coeff = 3125920,
|
||||
.ADC_current[0].offset = (-50880328288),
|
||||
|
||||
.ADC_current[1].coeff = 64769469,
|
||||
.ADC_current[1].offset = (-1048938859469),
|
||||
.ADC_current[1].coeff = 71636129,
|
||||
.ADC_current[1].offset = (-1166093783868),
|
||||
|
||||
.ADC_current[2].coeff = 2090182091,
|
||||
.ADC_current[2].offset = (-33847893234994),
|
||||
.ADC_current[2].coeff = 1459555637,
|
||||
.ADC_current[2].offset = (-23757721396024),
|
||||
|
||||
.ADC_current[3].coeff = 60030468992,
|
||||
.ADC_current[3].offset = (-972275155887907),
|
||||
.ADC_current[3].coeff = 30723232882,
|
||||
.ADC_current[3].offset = (-500144809348170),
|
||||
|
||||
.Usercode2DAC[0].coeff = (-10512772),
|
||||
.Usercode2DAC[0].offset = 581302323013,
|
||||
.Usercode2DAC[0].coeff = (-10543817),
|
||||
.Usercode2DAC[0].offset = 583163641972,
|
||||
|
||||
.Usercode2DAC[1].coeff = (-178991273),
|
||||
.Usercode2DAC[1].offset = 4794464882260,
|
||||
.Usercode2DAC[1].coeff = (-178077711),
|
||||
.Usercode2DAC[1].offset = 4777894559527,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef BOARD_C6D4
|
||||
#ifdef BOARD_C6D4 // not well
|
||||
{
|
||||
.ADC_volt[0].coeff = (6226),
|
||||
.ADC_volt[0].offset = -100075170,
|
||||
@@ -142,6 +142,68 @@ struct _correction{
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef BOARD_C771
|
||||
{
|
||||
.ADC_volt[0].coeff = (6301),
|
||||
.ADC_volt[0].offset = -102184705,
|
||||
|
||||
.ADC_volt[1].coeff = (216877),
|
||||
.ADC_volt[1].offset = -3519583281,
|
||||
|
||||
.ADC_volt[2].coeff = (6298448),
|
||||
.ADC_volt[2].offset = -102304286091,
|
||||
|
||||
.ADC_current[0].coeff = 3115431,
|
||||
.ADC_current[0].offset = (-50586460394),
|
||||
|
||||
.ADC_current[1].coeff = 71203612,
|
||||
.ADC_current[1].offset = (-1156022105141),
|
||||
|
||||
.ADC_current[2].coeff = 1451318434,
|
||||
.ADC_current[2].offset = (-23560731221983),
|
||||
|
||||
.ADC_current[3].coeff = 30518004246,
|
||||
.ADC_current[3].offset = (-495456618814855),
|
||||
|
||||
.Usercode2DAC[0].coeff = (-10568719),
|
||||
.Usercode2DAC[0].offset = 585036272447,
|
||||
|
||||
.Usercode2DAC[1].coeff = (-179441058),
|
||||
.Usercode2DAC[1].offset = 4807380622351,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef BOARD_C604
|
||||
{
|
||||
.ADC_volt[0].coeff = (6194),
|
||||
.ADC_volt[0].offset = -100974071,
|
||||
|
||||
.ADC_volt[1].coeff = (215506),
|
||||
.ADC_volt[1].offset = -3517864544,
|
||||
|
||||
.ADC_volt[2].coeff = (6243728),
|
||||
.ADC_volt[2].offset = -102012564806,
|
||||
|
||||
.ADC_current[0].coeff = 3139436,
|
||||
.ADC_current[0].offset = (-51217085818),
|
||||
|
||||
.ADC_current[1].coeff = 71622830,
|
||||
.ADC_current[1].offset = (-1168462302473),
|
||||
|
||||
.ADC_current[2].coeff = 1462344785,
|
||||
.ADC_current[2].offset = (-23855062972762),
|
||||
|
||||
.ADC_current[3].coeff = 30689232716,
|
||||
.ADC_current[3].offset = (-500670762245868),
|
||||
|
||||
.Usercode2DAC[0].coeff = (-10507403),
|
||||
.Usercode2DAC[0].offset = 582940058695,
|
||||
|
||||
.Usercode2DAC[1].coeff = (-178479878),
|
||||
.Usercode2DAC[1].offset = 4782895510276,
|
||||
};
|
||||
#endif
|
||||
|
||||
// this function turn ADC measure value (0xXXXX) into real voltage
|
||||
// unit should be uV
|
||||
static int32_t DecodeADCVolt(uint8_t ADCGain, uint16_t ADC_measure){
|
||||
@@ -259,8 +321,6 @@ static void ADC_overflow(uint8_t gain, uint8_t *rawdata){
|
||||
// this function should turn 0~50000 into DACcode which output the exactly voltage user want
|
||||
static uint16_t Usercode_Correction_to_DAC(uint8_t DACGain, uint16_t usercode)
|
||||
{
|
||||
AutoGainChangeVout(usercode);
|
||||
|
||||
long long usercode_32;
|
||||
uint16_t DACcode = 0;
|
||||
|
||||
|
||||
-2
@@ -28,13 +28,11 @@ static void IV_Vscan(IVMode *IV){
|
||||
if(IV->_current_direction_up){
|
||||
if(Vset >= IV->_Vmax){
|
||||
PeriodicEvent = false;
|
||||
ELITE15_SPI_CLOSE();
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}else{
|
||||
if(Vset <= IV->_Vmin){
|
||||
PeriodicEvent = false;
|
||||
ELITE15_SPI_CLOSE();
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}
|
||||
|
||||
+35
@@ -75,9 +75,27 @@ struct HEADSTAGE_INSTRUCTION {
|
||||
uint8_t charge;
|
||||
int32_t constantCurrent;
|
||||
int32_t Currentmax;
|
||||
int32_t t1;
|
||||
int32_t t2;
|
||||
int32_t t3;
|
||||
int32_t t4;
|
||||
int32_t t5;
|
||||
int32_t v1;
|
||||
int32_t v2;
|
||||
int32_t v3;
|
||||
int32_t v4;
|
||||
int32_t v5;
|
||||
int32_t t1Time;
|
||||
int32_t t2Time;
|
||||
int32_t t3Time;
|
||||
int32_t t4Time;
|
||||
int32_t t5Time;
|
||||
uint16_t loop;
|
||||
|
||||
uint16_t StepTime;
|
||||
|
||||
uint8_t AdcChannel;
|
||||
|
||||
} INSTRUCTION = {0};
|
||||
|
||||
/*********************************************************************
|
||||
@@ -118,5 +136,22 @@ static void InitEliteInstruction(){
|
||||
INSTRUCTION.constantCurrent = 0;
|
||||
INSTRUCTION.Currentmax = 0;
|
||||
INSTRUCTION.StepTime = STEPTIME_ONE_SEC;
|
||||
INSTRUCTION.AdcChannel = 0;
|
||||
INSTRUCTION.t1 = 0;
|
||||
INSTRUCTION.t2 = 0;
|
||||
INSTRUCTION.t3 = 0;
|
||||
INSTRUCTION.t4 = 0;
|
||||
INSTRUCTION.t5 = 0;
|
||||
INSTRUCTION.t1Time = 0;
|
||||
INSTRUCTION.t2Time = 0;
|
||||
INSTRUCTION.t3Time = 0;
|
||||
INSTRUCTION.t4Time = 0;
|
||||
INSTRUCTION.t5Time = 0;
|
||||
INSTRUCTION.v1 = DAC_ZERO;
|
||||
INSTRUCTION.v2 = DAC_ZERO;
|
||||
INSTRUCTION.v3 = DAC_ZERO;
|
||||
INSTRUCTION.v4 = DAC_ZERO;
|
||||
INSTRUCTION.v5 = DAC_ZERO;
|
||||
INSTRUCTION.loop = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
+15
-5
@@ -18,11 +18,7 @@ static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue)
|
||||
spi_LEDtxbuf[SPI_LED_SIZE - 2] = 0xffff;
|
||||
spi_LEDtxbuf[SPI_LED_SIZE - 1] = 0xffff;
|
||||
|
||||
if(PeriodicEvent){
|
||||
LED_SPI_TEST(SPI_LED_SIZE, spi_LEDtxbuf, spi_LEDrxbuf);
|
||||
}else{
|
||||
LED_SPI(SPI_LED_SIZE, spi_LEDtxbuf, spi_LEDrxbuf);
|
||||
}
|
||||
LED_SPI(SPI_LED_SIZE, spi_LEDtxbuf, spi_LEDrxbuf);
|
||||
|
||||
}
|
||||
|
||||
@@ -153,10 +149,24 @@ static void WorkModeLED() {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case PULSE_MODE:{
|
||||
// Elite_led_color(COLOR_YELLOW);
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case CALI_ADC_MODE:{
|
||||
if(INSTRUCTION.AdcChannel == IIN_ADC){
|
||||
Elite_led_color(COLOR_RED);
|
||||
}else if(INSTRUCTION.AdcChannel == VIN_ADC){
|
||||
Elite_led_color(COLOR_ORANGE);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// case VIS_RST: {
|
||||
// LEDPowerON();
|
||||
// break;
|
||||
|
||||
+345
@@ -0,0 +1,345 @@
|
||||
#ifndef ELITEPULSE
|
||||
#define ELITEPULSE
|
||||
|
||||
#define Vset INSTRUCTION.Vset
|
||||
|
||||
//static uint16_t CV3Curve(CV3Mode *CV3){
|
||||
// static uint16_t DACOutCode;
|
||||
// static int32_t Vin;
|
||||
// static int32_t Vout;
|
||||
// static int32_t DeltaVout;
|
||||
//
|
||||
// Vin = CV3->_measureVin * 200;//[5nV]
|
||||
// if(DACReset){
|
||||
// Vout = Vset + Vin;
|
||||
// DACReset = false;
|
||||
// }else{
|
||||
// DeltaVout = Vset - (Vout - Vin);
|
||||
// Vout = Vout + DeltaVout;
|
||||
// }
|
||||
//
|
||||
// INSTRUCTION.VoltConstant = Vout / 40000 + 25000;//5nV=>usercode
|
||||
// DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.DacVoutAgcLevel, INSTRUCTION.VoltConstant);
|
||||
//
|
||||
// int32_t RealV2;
|
||||
// RealV2 = (int32_t)((Vout - Vin) / 200);//[1uV]
|
||||
// InputNotify(NOTIFY_VOLT, RealV2);
|
||||
//
|
||||
// int32_t RealV;
|
||||
// RealV = (int32_t)(Vout / 200);//[1uV]
|
||||
// InputNotify(NOTIFY_IMPEDANCE, RealV);
|
||||
//
|
||||
// DAC_outputV(DACOutCode);
|
||||
//
|
||||
// return DACOutCode;
|
||||
//}
|
||||
|
||||
//static void PULSE_Vscan(PULSEMode *PULSE){
|
||||
// static uint16_t lastVolt;
|
||||
// if (vscanReset) {
|
||||
// lastVolt = INSTRUCTION.VoltConstant;
|
||||
// if (PULSE->_tflag == 0) {
|
||||
// PULSE->_tflag = PULSE->_t2;
|
||||
// PULSE->_vflag = PULSE->_v2;
|
||||
// }
|
||||
// else {
|
||||
// PULSE->_tflag = PULSE->_t1;
|
||||
// PULSE->_vflag = PULSE->_v1;
|
||||
// }
|
||||
// INSTRUCTION.VoltConstant = PULSE->_vflag;
|
||||
// if(lastVolt != INSTRUCTION.VoltConstant){
|
||||
// lastVolt = INSTRUCTION.VoltConstant;
|
||||
// DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
// }
|
||||
// vscanReset = false;
|
||||
// }
|
||||
//
|
||||
// if (!vscanReset) {
|
||||
// //vscan counter
|
||||
// if (GPT.VscanRateCounter >= PULSE->_tflag) {
|
||||
// GPT.VscanRateCounter -= PULSE->_tflag; //To get right time
|
||||
// }
|
||||
//
|
||||
// if (PULSE->_loop > 0 && PULSE->_cycleNumber > 0) {
|
||||
// if (PULSE->_tflag == PULSE->_t1) {
|
||||
// PULSE->_tflag = PULSE->_t2;
|
||||
// PULSE->_vflag = PULSE->_v2;
|
||||
// }
|
||||
// else if (PULSE->_tflag == PULSE->_t2) {
|
||||
// PULSE->_tflag = PULSE->_t3;
|
||||
// PULSE->_vflag = PULSE->_v3;
|
||||
// }
|
||||
// else if (PULSE->_tflag == PULSE->_t3) {
|
||||
// PULSE->_cycleNumber -- ;
|
||||
// if (PULSE->_cycleNumber == 0) {
|
||||
// PULSE->_tflag = PULSE->_t4;
|
||||
// PULSE->_vflag = PULSE->_v4;
|
||||
// }
|
||||
// else {
|
||||
// PULSE->_tflag = PULSE->_t2;
|
||||
// PULSE->_vflag = PULSE->_v2;
|
||||
// }
|
||||
// }
|
||||
// INSTRUCTION.VoltConstant = PULSE->_vflag;
|
||||
// if(lastVolt != INSTRUCTION.VoltConstant){
|
||||
// lastVolt = INSTRUCTION.VoltConstant;
|
||||
// DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
// }
|
||||
// }
|
||||
// else if (PULSE->_loop > 0 && PULSE->_cycleNumber <= 0) {
|
||||
// if (PULSE->_tflag == PULSE->_t1) {
|
||||
// PULSE->_tflag = PULSE->_t4;
|
||||
// PULSE->_vflag = PULSE->_v4;
|
||||
// }
|
||||
// else if (PULSE->_tflag == PULSE->_t4) {
|
||||
// PULSE->_loop -- ;
|
||||
// if (PULSE->_loop > 0) {
|
||||
// PULSE->_cycleNumber = INSTRUCTION.cycleNumber;
|
||||
// PULSE->_tflag = PULSE->_t2;
|
||||
// PULSE->_vflag = PULSE->_v2;
|
||||
// }
|
||||
// else {
|
||||
// PULSE->_tflag = PULSE->_t5;
|
||||
// PULSE->_vflag = PULSE->_v5;
|
||||
// }
|
||||
// }
|
||||
// INSTRUCTION.VoltConstant = PULSE->_vflag;
|
||||
// if(lastVolt != INSTRUCTION.VoltConstant){
|
||||
// lastVolt = INSTRUCTION.VoltConstant;
|
||||
// DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
// }
|
||||
// }
|
||||
// else if (PULSE->_loop <= 0) {
|
||||
// if (PULSE->_tflag == PULSE->_t5) {
|
||||
// PeriodicEvent = false;
|
||||
// ELITE15_SPI_CLOSE();
|
||||
// ModeLED(NO_EVENT);
|
||||
// }
|
||||
// }
|
||||
// InputNotify(NOTIFY_IMPEDANCE, PULSE->_vflag);
|
||||
// }
|
||||
//// int32_t RealV;
|
||||
//// RealV = (int32_t)(Vset / 500);//[1uV]
|
||||
//// InputNotify(NOTIFY_VOLT, RealV);
|
||||
//}
|
||||
|
||||
static void PULSE_Vscan(PULSEMode *PULSE)
|
||||
{
|
||||
static uint16_t lastVolt;
|
||||
|
||||
if (vscanReset) {
|
||||
if (PULSE->_tflag == 0) {
|
||||
PULSE->_tflag = PULSE->_t2;
|
||||
PULSE->_vflag = PULSE->_v2;
|
||||
}
|
||||
else {
|
||||
PULSE->_tflag = PULSE->_t1;
|
||||
PULSE->_vflag = PULSE->_v1;
|
||||
}
|
||||
|
||||
lastVolt = INSTRUCTION.VoltConstant;
|
||||
INSTRUCTION.VoltConstant = PULSE->_vflag;
|
||||
|
||||
if (lastVolt != INSTRUCTION.VoltConstant) {
|
||||
lastVolt = INSTRUCTION.VoltConstant;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
}
|
||||
|
||||
vscanReset = false;
|
||||
}
|
||||
|
||||
if (!vscanReset) {
|
||||
if (GPT.VscanRateCounter >= PULSE->_tflag) {
|
||||
GPT.VscanRateCounter -= PULSE->_tflag; //To get right time
|
||||
}
|
||||
|
||||
if (PULSE->_loop > 0 && PULSE->_cycleNumber > 0) {
|
||||
if (PULSE->_tflag == PULSE->_t1) {
|
||||
PULSE->_tflag = PULSE->_t2;
|
||||
PULSE->_vflag = PULSE->_v2;
|
||||
}
|
||||
else if (PULSE->_tflag == PULSE->_t2) {
|
||||
PULSE->_tflag = PULSE->_t3;
|
||||
PULSE->_vflag = PULSE->_v3;
|
||||
}
|
||||
else if (PULSE->_tflag == PULSE->_t3) {
|
||||
PULSE->_cycleNumber -- ;
|
||||
if (PULSE->_cycleNumber == 0) {
|
||||
PULSE->_tflag = PULSE->_t4;
|
||||
PULSE->_vflag = PULSE->_v4;
|
||||
}
|
||||
else {
|
||||
PULSE->_tflag = PULSE->_t2;
|
||||
PULSE->_vflag = PULSE->_v2;
|
||||
}
|
||||
}
|
||||
|
||||
INSTRUCTION.VoltConstant = PULSE->_vflag;
|
||||
if (lastVolt != INSTRUCTION.VoltConstant) {
|
||||
lastVolt = INSTRUCTION.VoltConstant;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
}
|
||||
}
|
||||
else if (PULSE->_loop > 0 && PULSE->_cycleNumber <= 0) {
|
||||
if (PULSE->_tflag == PULSE->_t1) {
|
||||
PULSE->_tflag = PULSE->_t4;
|
||||
PULSE->_vflag = PULSE->_v4;
|
||||
}
|
||||
else if (PULSE->_tflag == PULSE->_t4) {
|
||||
PULSE->_loop -- ;
|
||||
if (PULSE->_loop > 0) {
|
||||
PULSE->_cycleNumber = INSTRUCTION.cycleNumber;
|
||||
PULSE->_tflag = PULSE->_t2;
|
||||
PULSE->_vflag = PULSE->_v2;
|
||||
}
|
||||
else {
|
||||
PULSE->_tflag = PULSE->_t5;
|
||||
PULSE->_vflag = PULSE->_v5;
|
||||
}
|
||||
}
|
||||
|
||||
INSTRUCTION.VoltConstant = PULSE->_vflag;
|
||||
if (lastVolt != INSTRUCTION.VoltConstant) {
|
||||
lastVolt = INSTRUCTION.VoltConstant;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
}
|
||||
}
|
||||
else if (PULSE->_loop <= 0) {
|
||||
if (PULSE->_tflag == PULSE->_t5) {
|
||||
PeriodicEvent = false;
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}
|
||||
|
||||
InputNotify(NOTIFY_IMPEDANCE, PULSE->_vflag);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_Vscan(PULSEMode *PULSE){
|
||||
static uint16_t lastVolt;
|
||||
static uint8_t testV;
|
||||
if(firstTimeReset){
|
||||
firstTimeReset = false;
|
||||
lastVolt = INSTRUCTION.VoltConstant;
|
||||
if (PULSE->_tTime == 0) {
|
||||
PULSE->_tflag = PULSE->_t2;
|
||||
PULSE->_vflag = PULSE->_v2;
|
||||
PULSE->_tTime = PULSE->_t2Time;
|
||||
testV = 1;
|
||||
}
|
||||
else {
|
||||
PULSE->_tflag = PULSE->_t1;
|
||||
PULSE->_vflag = PULSE->_v1;
|
||||
PULSE->_tTime = PULSE->_t1Time;
|
||||
testV = 2;
|
||||
}
|
||||
INSTRUCTION.VoltConstant = PULSE->_vflag;
|
||||
if(lastVolt != INSTRUCTION.VoltConstant){
|
||||
lastVolt = INSTRUCTION.VoltConstant;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(VOUT_GAIN_240K, INSTRUCTION.VoltConstant));
|
||||
DAC_outputV(Usercode_Correction_to_DAC(VOUT_GAIN_240K, INSTRUCTION.VoltConstant));
|
||||
}
|
||||
//InputNotify(NOTIFY_IMPEDANCE, testV);
|
||||
}
|
||||
else if(!firstTimeReset){
|
||||
if(GPT.VscanRateCounter >= PULSE->_tTime){
|
||||
GPT.VscanRateCounter -= PULSE->_tTime; //To get right time
|
||||
|
||||
vscan_flag = true;
|
||||
if(vscan_flag){
|
||||
|
||||
if (PULSE->_loop > 0 && PULSE->_cycleNumber > 0) {
|
||||
if (PULSE->_tflag == PULSE->_t1) {
|
||||
PULSE->_tflag = PULSE->_t2;
|
||||
PULSE->_vflag = PULSE->_v2;
|
||||
PULSE->_tTime = PULSE->_t2Time;
|
||||
testV = 3;
|
||||
}
|
||||
else if (PULSE->_tflag == PULSE->_t2) {
|
||||
PULSE->_tflag = PULSE->_t3;
|
||||
PULSE->_vflag = PULSE->_v3;
|
||||
PULSE->_tTime = PULSE->_t3Time;
|
||||
testV = 4;
|
||||
}
|
||||
else if (PULSE->_tflag == PULSE->_t3) {
|
||||
PULSE->_cycleNumber -- ;
|
||||
if (PULSE->_cycleNumber == 0) {
|
||||
PULSE->_tflag = PULSE->_t4;
|
||||
PULSE->_vflag = PULSE->_v4;
|
||||
PULSE->_tTime = PULSE->_t4Time;
|
||||
if (PULSE->_t4Time == 0) {
|
||||
PULSE->_tflag = PULSE->_t2;
|
||||
PULSE->_vflag = PULSE->_v2;
|
||||
PULSE->_tTime = PULSE->_t2Time;
|
||||
PULSE->_loop--;
|
||||
PULSE->_cycleNumber = INSTRUCTION.cycleNumber;
|
||||
if (PULSE->_loop == 0) {
|
||||
PULSE->_tflag = PULSE->_t5;
|
||||
PULSE->_vflag = PULSE->_v5;
|
||||
PULSE->_tTime = PULSE->_t5Time;
|
||||
if (PULSE->_t5Time == 0) {
|
||||
PeriodicEvent = false;
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
testV = 5;
|
||||
}
|
||||
else {
|
||||
PULSE->_tflag = PULSE->_t2;
|
||||
PULSE->_vflag = PULSE->_v2;
|
||||
PULSE->_tTime = PULSE->_t2Time;
|
||||
testV = 6;
|
||||
}
|
||||
}
|
||||
INSTRUCTION.VoltConstant = PULSE->_vflag;
|
||||
if(lastVolt != INSTRUCTION.VoltConstant){
|
||||
lastVolt = INSTRUCTION.VoltConstant;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
}
|
||||
}
|
||||
else if (PULSE->_loop > 0 && PULSE->_cycleNumber <= 0) {
|
||||
if (PULSE->_tflag == PULSE->_t4) {
|
||||
PULSE->_loop -- ;
|
||||
if (PULSE->_loop > 0) {
|
||||
PULSE->_cycleNumber = INSTRUCTION.cycleNumber;
|
||||
PULSE->_tflag = PULSE->_t2;
|
||||
PULSE->_vflag = PULSE->_v2;
|
||||
PULSE->_tTime = PULSE->_t2Time;
|
||||
testV = 8;
|
||||
}
|
||||
else {
|
||||
PULSE->_tflag = PULSE->_t5;
|
||||
PULSE->_vflag = PULSE->_v5;
|
||||
PULSE->_tTime = PULSE->_t5Time;
|
||||
testV = 9;
|
||||
}
|
||||
}
|
||||
INSTRUCTION.VoltConstant = PULSE->_vflag;
|
||||
if(lastVolt != INSTRUCTION.VoltConstant){
|
||||
lastVolt = INSTRUCTION.VoltConstant;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
}
|
||||
}
|
||||
else if (PULSE->_loop <= 0) {
|
||||
if (PULSE->_tflag == PULSE->_t5) {
|
||||
testV = 10;
|
||||
PeriodicEvent = false;
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}
|
||||
//InputNotify(NOTIFY_IMPEDANCE, testV);
|
||||
vscan_flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
+14
-16
@@ -8,13 +8,16 @@ static void reset() {
|
||||
InitFlag();
|
||||
InitCT();
|
||||
InitGPT();
|
||||
InitLH();
|
||||
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 0 => open high_z mode
|
||||
|
||||
VinADCGainControl(VIN_GAIN_AUTO);
|
||||
IinADCGainControl(I_GAIN_AUTO);
|
||||
VoutGainControl(VOUT_GAIN_AUTO);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 0); // 0 => open high_z mode
|
||||
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_15K;
|
||||
VoutGainControl(INSTRUCTION.VoutGainLevel);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, 25000));
|
||||
|
||||
initINSBuf();
|
||||
initDATBuf();
|
||||
|
||||
@@ -33,25 +36,22 @@ static void reset() {
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
PIN15_setOutputValue(ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN15_setOutputValue(DAC_CS, 1); // DAC_CS HIGH
|
||||
CPUdelay(1600);
|
||||
}
|
||||
|
||||
static void Eliteinterrupt() {
|
||||
InitFlag();
|
||||
ModeLED(NO_EVENT);
|
||||
|
||||
InitFlag();
|
||||
InitEliteFlag();
|
||||
InitCT();
|
||||
InitGPT();
|
||||
InitLH();
|
||||
|
||||
VinADCGainControl(VIN_GAIN_AUTO);
|
||||
IinADCGainControl(I_GAIN_AUTO);
|
||||
VoutGainControl(VOUT_GAIN_AUTO);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 0); // 0 => open high_z mode
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 0 => open high_z mode
|
||||
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_15K;
|
||||
VoutGainControl(INSTRUCTION.VoutGainLevel);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, 25000));
|
||||
|
||||
initINSBuf();
|
||||
initDATBuf();
|
||||
|
||||
@@ -70,8 +70,6 @@ static void Eliteinterrupt() {
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
PIN15_setOutputValue(ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN15_setOutputValue(DAC_CS, 1); // DAC_CS HIGH
|
||||
CPUdelay(8000);
|
||||
}
|
||||
#endif
|
||||
|
||||
+32
-53
@@ -57,20 +57,17 @@ static void Elite_SPI_init(){
|
||||
}
|
||||
|
||||
static void LED_SPI(uint8_t length, uint16_t *spi_txbuf, uint16_t *spi_rxbuf) {
|
||||
ELITE15_SPI_HOLD();
|
||||
|
||||
LED_transaction.count = length;
|
||||
LED_transaction.txBuf = spi_txbuf;
|
||||
LED_transaction.rxBuf = spi_rxbuf;
|
||||
|
||||
SPI_transfer(spiHandle0, &LED_transaction);
|
||||
|
||||
ELITE15_SPI_CLOSE();
|
||||
}
|
||||
|
||||
static void ADC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
ELITE15_SPI_HOLD();
|
||||
PIN_setOutputValue(pin_handle, D6, 0); // CS_ADC
|
||||
// PIN15_setOutputValue(ADC_CS, 0); // ADC_CS LOW
|
||||
PIN_setOutputValue(pin_handle, LOAD0, 1);
|
||||
PIN_setOutputValue(pin_handle, D6, 0); // ADC_CS LOW
|
||||
|
||||
ADC_DAC_transaction.count = length;
|
||||
ADC_DAC_transaction.txBuf = spi_txbuf;
|
||||
@@ -78,13 +75,15 @@ static void ADC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
|
||||
PIN_setOutputValue(pin_handle, D6, 1); // CS_ADC
|
||||
ELITE15_SPI_CLOSE();
|
||||
PIN_setOutputValue(pin_handle, D6, 1); // ADC_CS HOGH
|
||||
update_latch_status (ADC_CS, 1);
|
||||
// PIN15_setOutputValue(ADC_CS, 1); // ADC_CS HIGH
|
||||
}
|
||||
|
||||
static void DAC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
ELITE15_SPI_HOLD();
|
||||
PIN_setOutputValue(pin_handle, D7, 0); // CD_DAC
|
||||
// PIN15_setOutputValue(DAC_CS, 0); // DAC_CS LOW
|
||||
PIN_setOutputValue(pin_handle, LOAD0, 1);
|
||||
PIN_setOutputValue(pin_handle, D7, 0); // DAC_CS LOW
|
||||
|
||||
ADC_DAC_transaction.count = length;
|
||||
ADC_DAC_transaction.txBuf = spi_txbuf;
|
||||
@@ -92,62 +91,42 @@ static void DAC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
|
||||
PIN_setOutputValue(pin_handle, D7, 1); // CD_DAC
|
||||
ELITE15_SPI_CLOSE();
|
||||
}
|
||||
|
||||
static void LED_SPI_TEST(uint8_t length, uint16_t *spi_txbuf, uint16_t *spi_rxbuf) {
|
||||
LED_transaction.count = length;
|
||||
LED_transaction.txBuf = spi_txbuf;
|
||||
LED_transaction.rxBuf = spi_rxbuf;
|
||||
|
||||
SPI_transfer(spiHandle0, &LED_transaction);
|
||||
}
|
||||
|
||||
static void ADC_SPI_TEST(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
PIN_setOutputValue(pin_handle, D6, 0); // CS_ADC
|
||||
|
||||
ADC_DAC_transaction.count = length;
|
||||
ADC_DAC_transaction.txBuf = spi_txbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
|
||||
PIN_setOutputValue(pin_handle, D6, 1); // CS_ADC
|
||||
}
|
||||
|
||||
static void DAC_SPI_TEST(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
PIN_setOutputValue(pin_handle, D7, 0); // CD_DAC
|
||||
|
||||
ADC_DAC_transaction.count = length;
|
||||
ADC_DAC_transaction.txBuf = spi_txbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
|
||||
PIN_setOutputValue(pin_handle, D7, 1); // CD_DAC
|
||||
PIN_setOutputValue(pin_handle, D7, 1); // DAC_CS HOGH
|
||||
update_latch_status (DAC_CS, 1);
|
||||
// PIN15_setOutputValue(DAC_CS, 1); // DAC_CS HIGH
|
||||
}
|
||||
|
||||
static void ELITE15_SPI_HOLD() {
|
||||
Elite_SPI_init();
|
||||
|
||||
PIN_setOutputValue(pin_handle, LOAD0, 1);
|
||||
PIN_setOutputValue(pin_handle, LOAD1, 0);
|
||||
PIN_setOutputValue(pin_handle, LOAD2, 0);
|
||||
PIN_setOutputValue(pin_handle, D4, 1); // HOLD_MEM
|
||||
PIN_setOutputValue(pin_handle, D5, 1); // CS_MEM
|
||||
PIN_setOutputValue(pin_handle, D6, 1); // CS_ADC
|
||||
PIN_setOutputValue(pin_handle, D7, 1); // CD_DAC
|
||||
Elite_SPI_init();
|
||||
}
|
||||
static void ELITE15_SPI_CLOSE() {
|
||||
PIN_setOutputValue(pin_handle, D4, 1); // HOLD_MEM
|
||||
PIN_setOutputValue(pin_handle, D5, 1); // CS_MEM
|
||||
PIN_setOutputValue(pin_handle, D6, 1); // CS_ADC
|
||||
PIN_setOutputValue(pin_handle, D7, 1); // CD_DAC
|
||||
PIN_setOutputValue(pin_handle, LOAD0, 0);
|
||||
PIN_setOutputValue(pin_handle, LOAD1, 0);
|
||||
PIN_setOutputValue(pin_handle, LOAD2, 0);
|
||||
|
||||
SPI_close(spiHandle0);
|
||||
SPI_close(spiHandle1);
|
||||
}
|
||||
|
||||
/* Elite1.5 Calibration SPI */
|
||||
static void CAL_ADC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
// PIN15_setOutputValue(ADC_CS, 0); // ADC_CS LOW
|
||||
PIN_setOutputValue(pin_handle, LOAD0, 1);
|
||||
PIN_setOutputValue(pin_handle, D6, 0); // ADC_CS LOW
|
||||
|
||||
ADC_DAC_transaction.count = length;
|
||||
ADC_DAC_transaction.txBuf = spi_txbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
|
||||
PIN_setOutputValue(pin_handle, D6, 1); // ADC_CS HOGH
|
||||
update_latch_status (ADC_CS, 1);
|
||||
// PIN15_setOutputValue(ADC_CS, 1); // ADC_CS HIGH
|
||||
}
|
||||
|
||||
#endif // ELITE_SPI
|
||||
|
||||
+72
@@ -327,6 +327,66 @@ CVSCANMode * InitCVSCANMode(){
|
||||
}
|
||||
/*End of CONSTANT_VSCAN Mode*/
|
||||
|
||||
/* PULSE_MODE Mode(PULSE_MODE)*/
|
||||
typedef struct _PULSEMode{
|
||||
MEASURE;
|
||||
// int32_t _Vinit;
|
||||
int32_t _Vset;
|
||||
int32_t _t1;
|
||||
int32_t _t2;
|
||||
int32_t _t3;
|
||||
int32_t _t4;
|
||||
int32_t _t5;
|
||||
int32_t _v1;
|
||||
int32_t _v2;
|
||||
int32_t _v3;
|
||||
int32_t _v4;
|
||||
int32_t _v5;
|
||||
int32_t _tflag;
|
||||
int32_t _vflag;
|
||||
uint16_t _cycleNumber;
|
||||
uint16_t _loop;
|
||||
int32_t _t1Time;
|
||||
int32_t _t2Time;
|
||||
int32_t _t3Time;
|
||||
int32_t _t4Time;
|
||||
int32_t _t5Time;
|
||||
int32_t _tTime;
|
||||
}PULSEMode;
|
||||
|
||||
PULSEMode * InitPULSEMode(){
|
||||
PULSEMode *ret = malloc(sizeof(PULSEMode));
|
||||
ret->_measureCurrent = 0;
|
||||
ret->_measureVin = 0;
|
||||
ret->_measureVout = 0;
|
||||
ret->_measureBat = 0;
|
||||
ret->_VoViSwitch = INSTRUCTION.VoViSwitch;
|
||||
// ret->_Vinit = (INSTRUCTION.Vinit - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vset = 0;
|
||||
ret->_t1 = INSTRUCTION.t1;
|
||||
ret->_t2 = INSTRUCTION.t2;
|
||||
ret->_t3 = INSTRUCTION.t3;
|
||||
ret->_t4 = INSTRUCTION.t4;
|
||||
ret->_t5 = INSTRUCTION.t5;
|
||||
ret->_v1 = INSTRUCTION.v1;
|
||||
ret->_v2 = INSTRUCTION.v2;
|
||||
ret->_v3 = INSTRUCTION.v3;
|
||||
ret->_v4 = INSTRUCTION.v4;
|
||||
ret->_v5 = INSTRUCTION.v5;
|
||||
ret->_t1Time = INSTRUCTION.t1Time;
|
||||
ret->_t2Time = INSTRUCTION.t2Time;
|
||||
ret->_t3Time = INSTRUCTION.t3Time;
|
||||
ret->_t4Time = INSTRUCTION.t4Time;
|
||||
ret->_t5Time = INSTRUCTION.t5Time;
|
||||
ret->_tTime = INSTRUCTION.t1Time;
|
||||
ret->_tflag = 1;
|
||||
ret->_vflag = INSTRUCTION.v1;
|
||||
ret->_cycleNumber = INSTRUCTION.cycleNumber;
|
||||
ret->_loop = INSTRUCTION.loop;
|
||||
return ret;
|
||||
}
|
||||
/*End of PULSE_MODE Mode*/
|
||||
|
||||
/* Cycle CC Mode */
|
||||
typedef struct _CCCMode{
|
||||
int32_t _measureCurrent;
|
||||
@@ -423,6 +483,7 @@ typedef union _WorkMode{
|
||||
LSVMode *LSV;
|
||||
CVSCANMode *CVSCAN;
|
||||
PSMode *PS;
|
||||
PULSEMode *PULSE;
|
||||
// CCCMode *CCC;
|
||||
}WorkMode;
|
||||
|
||||
@@ -434,6 +495,7 @@ WorkMode *CreateWorkMode(){
|
||||
void InitWorkMode(WorkMode *WM){
|
||||
switch(INSTRUCTION.eliteFxn){
|
||||
case VOLT_OUTPUT:
|
||||
case CALI_DAC_MODE:
|
||||
WM->VO = InitVoltOutMode();
|
||||
break;
|
||||
case IT_CURVE:
|
||||
@@ -463,6 +525,9 @@ void InitWorkMode(WorkMode *WM){
|
||||
case CONSTANT_VSCAN:
|
||||
WM->CVSCAN = InitCVSCANMode();
|
||||
break;
|
||||
case PULSE_MODE:
|
||||
WM->PULSE = InitPULSEMode();
|
||||
break;
|
||||
// case CYCLE_CONSTANT_CURRENT:
|
||||
// WM->CCC = InitCCCMode();
|
||||
// break;
|
||||
@@ -475,6 +540,7 @@ void InitWorkMode(WorkMode *WM){
|
||||
void FreeWorkMode(WorkMode *WM){
|
||||
switch(INSTRUCTION.eliteFxn){
|
||||
case VOLT_OUTPUT:
|
||||
case CALI_DAC_MODE:
|
||||
if(WM->VO != NULL){
|
||||
free(WM->VO);
|
||||
WM->VO = NULL;
|
||||
@@ -534,6 +600,12 @@ void FreeWorkMode(WorkMode *WM){
|
||||
WM->CVSCAN = NULL;
|
||||
}
|
||||
break;
|
||||
case PULSE_MODE:
|
||||
if(WM->PULSE != NULL){
|
||||
free(WM->PULSE);
|
||||
WM->PULSE = NULL;
|
||||
}
|
||||
break;
|
||||
// case CYCLE_CONSTANT_CURRENT:
|
||||
// if(WM->CCC != NULL){
|
||||
// free(WM->CCC);
|
||||
|
||||
+4
-1
@@ -36,7 +36,10 @@
|
||||
#define HIGH_CYCLE_CYCLIC_VOLTAMMETRY 0x01
|
||||
#define LINEAR_SWEEP_VOLTAMMETRY 0x02
|
||||
#define CONSTANT_VSCAN 0x03
|
||||
#define ADC_TEST 0x90
|
||||
#define ADC_TEST 0x91
|
||||
#define CALI_DAC_MODE 0x93
|
||||
#define CALI_ADC_MODE 0x92
|
||||
#define PULSE_MODE 0x94
|
||||
|
||||
// CIS (control instruction)
|
||||
#define CIS_VERSION 0x40
|
||||
|
||||
+267
-2
@@ -62,7 +62,8 @@ static void DACenable(WorkMode *WorkModeData, int32_t VoltData ,uint8_t afterRea
|
||||
case VT_CURVE:
|
||||
case CYCLIC_VOLTAMMETRY:
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:
|
||||
case CONSTANT_VSCAN:{
|
||||
case CONSTANT_VSCAN:
|
||||
case PULSE_MODE:{
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
@@ -82,7 +83,8 @@ static void DACenable(WorkMode *WorkModeData, int32_t VoltData ,uint8_t afterRea
|
||||
}
|
||||
case IT_CURVE:
|
||||
case VT_CURVE:
|
||||
case CONSTANT_CURRENT:{
|
||||
case CONSTANT_CURRENT:
|
||||
case PULSE_MODE:{
|
||||
break;
|
||||
}
|
||||
case CYCLIC_VOLTAMMETRY:{
|
||||
@@ -142,6 +144,10 @@ static void CC_Plot(WorkMode *WorkModeData){
|
||||
#define CURRENT_MODE WorkModeData->CVSCAN
|
||||
break;
|
||||
}
|
||||
case PULSE_MODE:{
|
||||
#define CURRENT_MODE WorkModeData->PULSE
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
@@ -279,6 +285,10 @@ static void IT_Plot(WorkMode *WorkModeData) {
|
||||
#define CURRENT_MODE WorkModeData->CVSCAN
|
||||
break;
|
||||
}
|
||||
case PULSE_MODE:{
|
||||
#define CURRENT_MODE WorkModeData->PULSE
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
@@ -357,6 +367,10 @@ static void VT_Plot(WorkMode *WorkModeData) {
|
||||
#define CURRENT_MODE WorkModeData->CVSCAN
|
||||
break;
|
||||
}
|
||||
case PULSE_MODE:{
|
||||
#define CURRENT_MODE WorkModeData->PULSE
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
@@ -440,6 +454,10 @@ static void readIin(WorkMode *WorkModeData){
|
||||
#define TEMP_MODE WorkModeData->CVSCAN
|
||||
break;
|
||||
}
|
||||
case PULSE_MODE:{
|
||||
#define TEMP_MODE WorkModeData->PULSE
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
@@ -497,6 +515,10 @@ static int32_t readVinVout(WorkMode *WorkModeData){
|
||||
#define TEMP_MODE WorkModeData->CVSCAN
|
||||
break;
|
||||
}
|
||||
case PULSE_MODE:{
|
||||
#define TEMP_MODE WorkModeData->PULSE
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
@@ -527,4 +549,247 @@ static int32_t readVinVout(WorkMode *WorkModeData){
|
||||
return VoltData;
|
||||
}
|
||||
|
||||
static void cali_IT_plot(WorkMode *WorkModeData) {
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IT
|
||||
break;
|
||||
}
|
||||
case VT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->VT
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->RT
|
||||
break;
|
||||
}
|
||||
case IV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IV
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->CV
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
#define CURRENT_MODE WorkModeData->CC
|
||||
break;
|
||||
}
|
||||
case CYCLIC_VOLTAMMETRY:{
|
||||
#define CURRENT_MODE WorkModeData->CV3
|
||||
break;
|
||||
}
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:{
|
||||
#define CURRENT_MODE WorkModeData->LSV
|
||||
break;
|
||||
}
|
||||
case CONSTANT_VSCAN:{
|
||||
#define CURRENT_MODE WorkModeData->CVSCAN
|
||||
break;
|
||||
}
|
||||
case PULSE_MODE:{
|
||||
#define CURRENT_MODE WorkModeData->PULSE
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
#define CURRENT_MODE WorkModeData->VT
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t ADCSwitch = 0;
|
||||
int32_t ADCValueTemp = 0;
|
||||
static int32_t ADCValueSUM = 0;
|
||||
int32_t ADCValueAVG = 0;
|
||||
int16_t ADCValueAVG_RAW = 0;
|
||||
|
||||
if(ADCSwitch == 0){ /**read Iin(buffer)**/
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
CURRENT_MODE->_measureCurrent = 0xFFFF;
|
||||
}else{
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
CURRENT_MODE->_measureCurrent = (int32_t) (spi_ADC_rxbuf[0] << 8) | (int32_t) (spi_ADC_rxbuf[1]);
|
||||
if(lastIinADCGainLevel != INSTRUCTION.ADCGainLevel){
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(record_flag == false){
|
||||
static int recordCount = 0;
|
||||
recordCount++;
|
||||
if(recordCount == 2){
|
||||
record_flag = true;
|
||||
recordCount = 0;
|
||||
}
|
||||
}else{
|
||||
static uint16_t cali_count = 0;
|
||||
if(cali_count >= 5000){
|
||||
ADCValueAVG = ADCValueSUM / cali_count;
|
||||
|
||||
InputNotify(NOTIFY_CURRENT, ADCValueAVG);
|
||||
SendNotify();
|
||||
|
||||
uint8_t CIS_buf[9] = {0};
|
||||
CIS_buf[0] = INSTRUCTION.chip_id;
|
||||
CIS_buf[1] = (uint8_t) ((ADCValueAVG & 0xFF00) >> 8);
|
||||
CIS_buf[2] = (uint8_t) (ADCValueAVG & 0x00FF);
|
||||
CIS_buf[3] = 0x00;
|
||||
CIS_buf[4] = INSTRUCTION.ADCGainLevel;
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, 9, CIS_buf);
|
||||
ADCValueSUM = 0;
|
||||
cali_count = 0;
|
||||
|
||||
PeriodicEvent = false;
|
||||
ModeLED(NO_EVENT);
|
||||
|
||||
}else{
|
||||
cali_count++;
|
||||
ADCValueSUM = ADCValueSUM + CURRENT_MODE->_measureCurrent;
|
||||
// InputNotify(NOTIFY_CURRENT, CURRENT_MODE->_measureCurrent);
|
||||
// InputNotify(NOTIFY_VOLT, ADCValueSUM);
|
||||
// InputNotify(NOTIFY_IMPEDANCE, (int32_t)cali_count);
|
||||
}
|
||||
|
||||
}
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 1){ /**read Iin**/
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 2){ /**read Iin**/
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
ADCSwitch = 0;
|
||||
}
|
||||
|
||||
#undef CURRENT_MODE
|
||||
}
|
||||
|
||||
static void cali_VT_plot(WorkMode *WorkModeData) {
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IT
|
||||
break;
|
||||
}
|
||||
case VT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->VT
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->RT
|
||||
break;
|
||||
}
|
||||
case IV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IV
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->CV
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
#define CURRENT_MODE WorkModeData->CC
|
||||
break;
|
||||
}
|
||||
case CYCLIC_VOLTAMMETRY:{
|
||||
#define CURRENT_MODE WorkModeData->CV3
|
||||
break;
|
||||
}
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:{
|
||||
#define CURRENT_MODE WorkModeData->LSV
|
||||
break;
|
||||
}
|
||||
case CONSTANT_VSCAN:{
|
||||
#define CURRENT_MODE WorkModeData->CVSCAN
|
||||
break;
|
||||
}
|
||||
case PULSE_MODE:{
|
||||
#define CURRENT_MODE WorkModeData->PULSE
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
#define CURRENT_MODE WorkModeData->VT
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t ADCSwitch = 0;
|
||||
static int32_t VoltData;
|
||||
int32_t ADCValueTemp = 0;
|
||||
static int32_t ADCValueSUM = 0;
|
||||
int32_t ADCValueAVG = 0;
|
||||
int16_t ADCValueAVG_RAW = 0;
|
||||
|
||||
if(ADCSwitch == 0){ /**read Iin(buffer)**/
|
||||
if(CURRENT_MODE->_VoViSwitch == 0x01 || CURRENT_MODE->_VoViSwitch == 0x02){
|
||||
if(INSTRUCTION.VinAutoGainEnable){
|
||||
CURRENT_MODE->_measureVin = 0xFFFF;
|
||||
}else{
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
CURRENT_MODE->_measureVin = (int32_t) (spi_ADC_rxbuf[0] << 8) | (int32_t) (spi_ADC_rxbuf[1]);
|
||||
if(lastVinADCGainLevel != INSTRUCTION.VinADCGainLevel){
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
record_flag = false;
|
||||
}
|
||||
|
||||
}
|
||||
VoltData = CURRENT_MODE->_measureVin;
|
||||
}
|
||||
// else if(CURRENT_MODE->_VoViSwitch == 0x00){
|
||||
// ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
// CURRENT_MODE->_measureVout = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_DAC, spi_ADC_rxbuf);
|
||||
// VoltData = CURRENT_MODE->_measureVout;
|
||||
// }
|
||||
|
||||
if(record_flag == false){
|
||||
static int recordCount = 0;
|
||||
recordCount++;
|
||||
if(recordCount == 2){
|
||||
record_flag = true;
|
||||
recordCount = 0;
|
||||
}
|
||||
}else{
|
||||
static uint16_t cali_count = 0;
|
||||
if(cali_count >= 1000){
|
||||
ADCValueAVG = ADCValueSUM / cali_count;
|
||||
|
||||
InputNotify(NOTIFY_VOLT, ADCValueAVG);
|
||||
SendNotify();
|
||||
|
||||
uint8_t CIS_buf[9] = {0};
|
||||
CIS_buf[0] = INSTRUCTION.chip_id;
|
||||
CIS_buf[1] = (uint8_t) ((ADCValueAVG & 0xFF00) >> 8);
|
||||
CIS_buf[2] = (uint8_t) (ADCValueAVG & 0x00FF);
|
||||
CIS_buf[3] = 0x00;
|
||||
CIS_buf[4] = INSTRUCTION.VinADCGainLevel;
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, 9, CIS_buf);
|
||||
ADCValueSUM = 0;
|
||||
cali_count = 0;
|
||||
|
||||
PeriodicEvent = false;
|
||||
ModeLED(NO_EVENT);
|
||||
}else{
|
||||
cali_count++;
|
||||
ADCValueSUM = ADCValueSUM + CURRENT_MODE->_measureVin;
|
||||
InputNotify(NOTIFY_VOLT, CURRENT_MODE->_measureVin);
|
||||
InputNotify(NOTIFY_CURRENT, ADCValueSUM);
|
||||
InputNotify(NOTIFY_IMPEDANCE, (int32_t)cali_count);
|
||||
}
|
||||
|
||||
}
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 1){ /**read v**/
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 2){ /**read v**/
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
ADCSwitch = 0;
|
||||
}
|
||||
|
||||
#undef CURRENT_MODE
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -3,10 +3,10 @@
|
||||
#define VERSION_DATE
|
||||
|
||||
#define VERSION_DATE_YEAR 20
|
||||
#define VERSION_DATE_MONTH 8
|
||||
#define VERSION_DATE_DAY 28
|
||||
#define VERSION_DATE_HOUR 13
|
||||
#define VERSION_DATE_MINUTE 30
|
||||
#define VERSION_DATE_MONTH 11
|
||||
#define VERSION_DATE_DAY 26
|
||||
#define VERSION_DATE_HOUR 22
|
||||
#define VERSION_DATE_MINUTE 48
|
||||
|
||||
// this is NOT the version hash !!
|
||||
// it's the last version hash
|
||||
|
||||
+221
-49
@@ -430,12 +430,18 @@ characteristic change event
|
||||
#define SBP_KEY_CHANGE_EVT 0x0010
|
||||
#endif
|
||||
|
||||
/**************************
|
||||
controller version
|
||||
EliteZM02 0,2,1,5
|
||||
EliteZM15 0,2,1,6
|
||||
EliteZM_pulsefly 0,2,1,7
|
||||
**************************/
|
||||
// product information
|
||||
#define DEVICE_NAME "Elite"
|
||||
#define MAJOR_PRODUCT_NUMBER 0 //0:Elite ,1:Neulive
|
||||
#define MINOR_PRODUCT_NUMBER 2 //1:Elite_legacy(Ori_Neulive) 2:Elite_zm 3:Elite_bat
|
||||
#define MAJOR_VERSION_NUMBER 1
|
||||
#define MINOR_VERSION_NUMBER 6
|
||||
#define MINOR_VERSION_NUMBER 7
|
||||
#define ELITE_VERSION_1_4
|
||||
//#define ELITE_VERSION_1_3
|
||||
|
||||
@@ -550,6 +556,7 @@ static bool record_flag;
|
||||
static bool vscanReset;
|
||||
static bool EliteWorkReset;
|
||||
static bool leadTimeReset;
|
||||
static bool firstTimeReset;
|
||||
static int16_t I_GAIN_100R_counter;
|
||||
static int16_t I_GAIN_3K_counter;
|
||||
static int16_t I_GAIN_100K_counter;
|
||||
@@ -567,6 +574,8 @@ static bool preWorkLedFlag = 0;
|
||||
static bool workingLedFlag = 0;
|
||||
static bool postWorkLedFlag = 0;
|
||||
|
||||
static void update_latch_status (uint32_t latch_num, uint32_t elite_pin, bool highlow);
|
||||
|
||||
// ADC function
|
||||
static int32_t DecodeADCValue(uint8_t ADCGain, uint8_t ADCChannel, uint8_t *ADC_raw);
|
||||
static void headstage_battery_volt();
|
||||
@@ -600,6 +609,8 @@ static void CalcuResistance(RTMode *RT, int32_t VoltData);
|
||||
static uint16_t CV3Curve(CV3Mode *CV3);
|
||||
static uint16_t LSVCurve(LSVMode *LSV);
|
||||
static uint16_t CVSCANCurve(CVSCANMode *CVSCAN);
|
||||
static void PULSE_Vscan(PULSEMode *PULSE);
|
||||
static void test_Vscan(PULSEMode *PULSE);
|
||||
|
||||
//mode (notify)
|
||||
static void initDATBuf();
|
||||
@@ -638,6 +649,7 @@ static void InitEliteFlag();
|
||||
#include "EliteCV3Mode.h"
|
||||
#include "EliteLSVMode.h"
|
||||
#include "EliteCVSCANMode.h"
|
||||
#include "ElitePulseMode.h"
|
||||
#include "Elite_batt.h"
|
||||
#include "Elite_power.h"
|
||||
|
||||
@@ -671,6 +683,13 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
INSTRUCTION.VsetRate = VsetRateTable[INSTRUCTION.VsetRateIndex];//N
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
INSTRUCTION.cycleNumber = 1;
|
||||
|
||||
if((INSTRUCTION.Ve1 < DAC_VOUT_GAIN_LARGE_BOUNDARY_USERCODE && INSTRUCTION.Ve1 > DAC_VOUT_GAIN_LARGE_BOUNDARY1_USERCODE)
|
||||
&& (INSTRUCTION.Ve2 < DAC_VOUT_GAIN_LARGE_BOUNDARY_USERCODE && INSTRUCTION.Ve2 > DAC_VOUT_GAIN_LARGE_BOUNDARY1_USERCODE)){
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_15K;
|
||||
}else{
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -693,6 +712,13 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
INSTRUCTION.VsetRate = VsetRateTable[INSTRUCTION.VsetRateIndex];//N
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
INSTRUCTION.cycleNumber = ins[10];
|
||||
|
||||
if((INSTRUCTION.Ve1 < DAC_VOUT_GAIN_LARGE_BOUNDARY_USERCODE && INSTRUCTION.Ve1 > DAC_VOUT_GAIN_LARGE_BOUNDARY1_USERCODE)
|
||||
&& (INSTRUCTION.Ve2 < DAC_VOUT_GAIN_LARGE_BOUNDARY_USERCODE && INSTRUCTION.Ve2 > DAC_VOUT_GAIN_LARGE_BOUNDARY1_USERCODE)){
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_15K;
|
||||
}else{
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -701,6 +727,12 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
INSTRUCTION.eliteFxn = VOLT_OUTPUT;
|
||||
INSTRUCTION.VoltConstant = ( ((uint16_t)(ins[3])) << 8) | (uint16_t)(ins[4]);
|
||||
|
||||
if(INSTRUCTION.VoltConstant < DAC_VOUT_GAIN_LARGE_BOUNDARY_USERCODE && INSTRUCTION.VoltConstant > DAC_VOUT_GAIN_LARGE_BOUNDARY1_USERCODE){
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_15K;
|
||||
}else{
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -713,6 +745,14 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
INSTRUCTION.VsetRate = 100;
|
||||
INSTRUCTION.VoltConstant = 25000 + 5000;
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_AUTO;
|
||||
INSTRUCTION.VinADCGainLevel = VIN_GAIN_AUTO;
|
||||
|
||||
if(INSTRUCTION.VoltConstant < DAC_VOUT_GAIN_LARGE_BOUNDARY_USERCODE && INSTRUCTION.VoltConstant > DAC_VOUT_GAIN_LARGE_BOUNDARY1_USERCODE){
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_15K;
|
||||
}else{
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -745,6 +785,8 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
INSTRUCTION.Vmin = (uint32_t)(ins[10]) << 8 | (uint32_t)(ins[11]);
|
||||
INSTRUCTION.notifyRate = 500;
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
/*******************************************************
|
||||
controller instruction
|
||||
ins[3] -> Charge, 0:discharge 1:charge
|
||||
@@ -779,6 +821,8 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
INSTRUCTION.VsetRate = VsetRateTable[INSTRUCTION.VsetRateIndex];//N
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
INSTRUCTION.cycleNumber = ins[14];
|
||||
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -807,6 +851,8 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
INSTRUCTION.VsetRate = VsetRateTable[INSTRUCTION.VsetRateIndex];//N
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
INSTRUCTION.cycleNumber = ins[19] * 100;
|
||||
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -830,6 +876,8 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
INSTRUCTION.VsetRate = VsetRateTable[INSTRUCTION.VsetRateIndex];//N
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
INSTRUCTION.cycleNumber = 1;//ins[17];
|
||||
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -843,6 +891,8 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
INSTRUCTION.notifyRate = 10000 / INSTRUCTION.notifyRate * 10;
|
||||
INSTRUCTION.VsetRate = VsetRateTable[0];
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -936,6 +986,7 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
else{
|
||||
INSTRUCTION.AutoGainEnable = 1;
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_100R;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -946,18 +997,17 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
else{
|
||||
INSTRUCTION.VinAutoGainEnable = 1;
|
||||
INSTRUCTION.VinADCGainLevel = VIN_GAIN_1K;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VOUT_DAC :{
|
||||
// INSTRUCTION.VoutGainLevel = ins[4];
|
||||
// if(INSTRUCTION.VoutGainLevel == VOUT_GAIN_AUTO){
|
||||
// INSTRUCTION.VoutGainLevel = VOUT_GAIN_15K;
|
||||
// }
|
||||
INSTRUCTION.VoutGainLevel = ins[4];
|
||||
if(INSTRUCTION.VoutGainLevel != VOUT_GAIN_AUTO){
|
||||
INSTRUCTION.VoutAutoGainEnable = 0;
|
||||
}
|
||||
else{
|
||||
INSTRUCTION.VoutAutoGainEnable = 1;
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_15K;
|
||||
}
|
||||
VoutGainControl(INSTRUCTION.VoutGainLevel);
|
||||
break;
|
||||
}
|
||||
case HIGH_Z :{
|
||||
@@ -984,22 +1034,24 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case ADC_TEST: {
|
||||
ModeLED(WORKING);
|
||||
INSTRUCTION.eliteFxn = ADC_TEST;
|
||||
int32_t ADCRealValue = 0;
|
||||
// int32_t ADCRealValue = 0;
|
||||
uint8_t CIS_buf[9] = {0};
|
||||
uint16_t ADCValueAVG_RAW = 0;
|
||||
uint8_t ADC_input = 0;
|
||||
bool AVG_done = 0;
|
||||
|
||||
switch(ins[3]) {
|
||||
case IIN_ADC :{ // 0x00
|
||||
IinADCGainControl(ins[4]);
|
||||
AVG_done = 1;
|
||||
ADC_input = CMD_CURRENT_MEASURE;
|
||||
break;
|
||||
}
|
||||
case VIN_ADC :{ // 0x01
|
||||
VinADCGainControl(ins[4]);
|
||||
AVG_done = 1;
|
||||
ADC_input = CMD_VOLT_MEASURE;
|
||||
break;
|
||||
}
|
||||
case VOUT_DAC :{ // 0x02
|
||||
@@ -1031,51 +1083,175 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
if (AVG_done) {
|
||||
ADCValueAVG_RAW = ADC_CURRENT_AVG_calibration(ins[3]);
|
||||
CPUdelay(100);
|
||||
ADCValueAVG_RAW = ADC_CURRENT_AVG_calibration(ADC_input);
|
||||
} else {
|
||||
AVG_done = 0;
|
||||
}
|
||||
// ADCChannelSelect(ins[3]);
|
||||
// CPUdelay(10);
|
||||
// ADC_read(spi_ADC_rxbuf);
|
||||
|
||||
CIS_buf[0] = chip_ID;
|
||||
CIS_buf[1] = (uint8_t) ((ADCValueAVG_RAW & 0xFF00) >> 8);
|
||||
CIS_buf[2] = (uint8_t) (ADCValueAVG_RAW & 0x00FF);
|
||||
CIS_buf[3] = spi_ADC_rxbuf[2];
|
||||
CIS_buf[4] = spi_ADC_rxbuf[3];
|
||||
// for(int i=0; i<4 ; i++){
|
||||
// CIS_buf[i+1] = spi_ADC_rxbuf[i];
|
||||
// }
|
||||
|
||||
// decode ADC measure value
|
||||
ADCRealValue = DecodeADCValue(ins[4], ins[3], spi_ADC_rxbuf);
|
||||
|
||||
// test ADC output through CIS
|
||||
if (ins[3] == ADC_CH_VOLT) {
|
||||
// return ADC volt measure
|
||||
CIS_buf[5] = (uint8_t)(ADCRealValue >> 24);
|
||||
CIS_buf[6] = (uint8_t)((ADCRealValue & 0x00FF0000) >> 16);
|
||||
CIS_buf[7] = (uint8_t)((ADCRealValue & 0x0000FF00) >> 8);
|
||||
CIS_buf[8] = (uint8_t)(ADCRealValue & 0x000000FF);
|
||||
} else if (ins[3] == ADC_CH_CURRENT) {
|
||||
// return ADC current measure
|
||||
CIS_buf[5] = (uint8_t)(ADCRealValue >> 24);
|
||||
CIS_buf[6] = (uint8_t)((ADCRealValue & 0x00FF0000) >> 16);
|
||||
CIS_buf[7] = (uint8_t)((ADCRealValue & 0x0000FF00) >> 8);
|
||||
CIS_buf[8] = (uint8_t)(ADCRealValue & 0x000000FF);
|
||||
} else {
|
||||
// CIS = 0xFF...FF using as an error report
|
||||
for (int i = 1; i < 9; i++) {
|
||||
CIS_buf[i + 1] = 0xFF;
|
||||
CIS_buf[i + 1] = 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
CIS_buf[0] = chip_ID;
|
||||
CIS_buf[1] = (uint8_t) ((ADCValueAVG_RAW & 0xFF00) >> 8);
|
||||
CIS_buf[2] = (uint8_t) (ADCValueAVG_RAW & 0x00FF);
|
||||
CIS_buf[3] = spi_ADC_rxbuf[2];
|
||||
CIS_buf[4] = spi_ADC_rxbuf[3];
|
||||
|
||||
// decode ADC measure value
|
||||
// ADCRealValue = DecodeADCValue(ins[4], ins[3], spi_ADC_rxbuf);
|
||||
|
||||
// test ADC output through CIS
|
||||
// if (ins[3] == ADC_CH_VOLT) {
|
||||
// // return ADC volt measure
|
||||
// CIS_buf[5] = (uint8_t)(ADCRealValue >> 24);
|
||||
// CIS_buf[6] = (uint8_t)((ADCRealValue & 0x00FF0000) >> 16);
|
||||
// CIS_buf[7] = (uint8_t)((ADCRealValue & 0x0000FF00) >> 8);
|
||||
// CIS_buf[8] = (uint8_t)(ADCRealValue & 0x000000FF);
|
||||
// } else if (ins[3] == ADC_CH_CURRENT) {
|
||||
// // return ADC current measure
|
||||
// CIS_buf[5] = (uint8_t)(ADCRealValue >> 24);
|
||||
// CIS_buf[6] = (uint8_t)((ADCRealValue & 0x00FF0000) >> 16);
|
||||
// CIS_buf[7] = (uint8_t)((ADCRealValue & 0x0000FF00) >> 8);
|
||||
// CIS_buf[8] = (uint8_t)(ADCRealValue & 0x000000FF);
|
||||
// } else {
|
||||
// // CIS = 0xFF...FF using as an error report
|
||||
// for (int i = 1; i < 9; i++) {
|
||||
// CIS_buf[i + 1] = 0xFF;
|
||||
// }
|
||||
// }
|
||||
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, 9, CIS_buf);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case CALI_DAC_MODE: {
|
||||
ModeLED(WORKING);
|
||||
INSTRUCTION.eliteFxn = CALI_DAC_MODE;
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
INSTRUCTION.VoltConstant = ( ((uint16_t)(ins[3])) << 8) | (uint16_t)(ins[4]);
|
||||
break;
|
||||
}
|
||||
|
||||
case CALI_ADC_MODE: {
|
||||
switch(ins[3]) {
|
||||
case IIN_ADC :{ // 0x00
|
||||
INSTRUCTION.eliteFxn = CALI_ADC_MODE;
|
||||
INSTRUCTION.AdcChannel = IIN_ADC;
|
||||
INSTRUCTION.notifyRate = 1000;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
ModeLED(WORKING);
|
||||
break;
|
||||
}
|
||||
case VIN_ADC :{ // 0x01
|
||||
INSTRUCTION.eliteFxn = CALI_ADC_MODE;
|
||||
INSTRUCTION.AdcChannel = VIN_ADC;
|
||||
INSTRUCTION.notifyRate = 1000;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
ModeLED(WORKING);
|
||||
break;
|
||||
}
|
||||
default :{
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case PULSE_MODE:{
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
if(ins[3] == PARA_1){
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.notifyRate = 100;
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
INSTRUCTION.t1 = 1;
|
||||
INSTRUCTION.t2 = 2;
|
||||
INSTRUCTION.t3 = 3;
|
||||
INSTRUCTION.t4 = 4;
|
||||
INSTRUCTION.t5 = 5;
|
||||
INSTRUCTION.t1Time = (int32_t)(ins[4]) << 24 | (int32_t)(ins[5]) << 16 | (int32_t)(ins[6]) << 8 | (int32_t)(ins[7]);
|
||||
INSTRUCTION.t2Time = (int32_t)(ins[8]) << 24 | (int32_t)(ins[9]) << 16 | (int32_t)(ins[10]) << 8 | (int32_t)(ins[11]);
|
||||
INSTRUCTION.t3Time = (int32_t)(ins[12]) << 24 | (int32_t)(ins[13]) << 16 | (int32_t)(ins[14]) << 8 | (int32_t)(ins[15]);
|
||||
INSTRUCTION.t4Time = (int32_t)(ins[16]) << 24 | (int32_t)(ins[17]) << 16 | (int32_t)(ins[18]) << 8 | (int32_t)(ins[19]);
|
||||
}else if(ins[3] == PARA_2){
|
||||
INSTRUCTION.eliteFxn = PULSE_MODE;
|
||||
ModeLED(WORKING);
|
||||
INSTRUCTION.v1 = 25000;
|
||||
INSTRUCTION.v2 = 50000;
|
||||
INSTRUCTION.v3 = 25000;
|
||||
INSTRUCTION.v4 = 25000;
|
||||
INSTRUCTION.v5 = 25000;
|
||||
INSTRUCTION.t5Time = (int32_t)(ins[4]) << 24 | (int32_t)(ins[5]) << 16 | (int32_t)(ins[6]) << 8 | (int32_t)(ins[7]);
|
||||
INSTRUCTION.cycleNumber = (uint16_t)(ins[8]);
|
||||
INSTRUCTION.loop = (uint16_t)(ins[9]);
|
||||
INSTRUCTION.VsetRate = 2;
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
// INSTRUCTION.eliteFxn = PULSE_MODE;
|
||||
// ModeLED(WORKING);
|
||||
//
|
||||
// INSTRUCTION.sampleRate = 15;
|
||||
// INSTRUCTION.notifyRate = 1000;
|
||||
// INSTRUCTION.VoViSwitch = 0x01;
|
||||
// INSTRUCTION.t1 = 1;
|
||||
// INSTRUCTION.t2 = 2;
|
||||
// INSTRUCTION.t3 = 3;
|
||||
// INSTRUCTION.t4 = 4;
|
||||
// INSTRUCTION.t5 = 5;
|
||||
// INSTRUCTION.t1Time = ((int32_t)(ins[3]) << 8) | (int32_t)(ins[4]);
|
||||
// INSTRUCTION.t2Time = ((int32_t)(ins[5]) << 8) | (int32_t)(ins[6]);
|
||||
// INSTRUCTION.t3Time = ((int32_t)(ins[7]) << 8) | (int32_t)(ins[8]);
|
||||
// INSTRUCTION.t4Time = ((int32_t)(ins[9]) << 8) | (int32_t)(ins[10]);
|
||||
// INSTRUCTION.t5Time = ((int32_t)(ins[11]) << 8) | (int32_t)(ins[12]);
|
||||
// INSTRUCTION.v1 = 25000;
|
||||
// INSTRUCTION.v2 = 50000;
|
||||
// INSTRUCTION.v3 = 25000;
|
||||
// INSTRUCTION.v4 = 25000;
|
||||
// INSTRUCTION.v5 = 25000;
|
||||
// INSTRUCTION.cycleNumber = (uint16_t)(ins[13]);
|
||||
// INSTRUCTION.loop = (uint16_t)(ins[14]);
|
||||
// INSTRUCTION.VsetRate = 2;
|
||||
//
|
||||
// INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
// INSTRUCTION.eliteFxn = PULSE_MODE;
|
||||
// ModeLED(WORKING);
|
||||
//
|
||||
// INSTRUCTION.sampleRate = 15;
|
||||
// INSTRUCTION.notifyRate = 1000;
|
||||
// INSTRUCTION.VoViSwitch = 0x01;
|
||||
// INSTRUCTION.t1 = 1;
|
||||
// INSTRUCTION.t1Time = 20000;
|
||||
// INSTRUCTION.t2 = 2;
|
||||
// INSTRUCTION.t2Time = 20000;
|
||||
// INSTRUCTION.t3 = 3;
|
||||
// INSTRUCTION.t3Time = 20000;
|
||||
// INSTRUCTION.t4 = 4;
|
||||
// INSTRUCTION.t4Time = 20000;
|
||||
// INSTRUCTION.t5 = 5;
|
||||
// INSTRUCTION.t5Time = 20000;
|
||||
// INSTRUCTION.v1 = 25000; //1V
|
||||
// INSTRUCTION.v2 = 50000; //2V
|
||||
// INSTRUCTION.v3 = 25000; //3V
|
||||
// INSTRUCTION.v4 = 25000;
|
||||
// INSTRUCTION.v5 = 25000;
|
||||
// INSTRUCTION.cycleNumber = 5;
|
||||
// INSTRUCTION.loop = 2;
|
||||
// INSTRUCTION.VsetRate = 2;
|
||||
//
|
||||
// INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
/** **/
|
||||
break;
|
||||
@@ -1107,7 +1283,6 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
PeriodicEvent = true;
|
||||
InitEliteFlag();
|
||||
ELITE15_SPI_HOLD();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1117,10 +1292,6 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case VIS_INT: {
|
||||
if(PeriodicEvent){
|
||||
ELITE15_SPI_CLOSE();
|
||||
}
|
||||
|
||||
Eliteinterrupt();
|
||||
for(int i=0 ; i<12 ; i++){
|
||||
FlushNotify();
|
||||
@@ -1163,6 +1334,7 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
INSTRUCTION.Vmin = 0x0000;
|
||||
INSTRUCTION.notifyRate = 500;
|
||||
INSTRUCTION.VoViSwitch = 0x02;//read Vscan = Vout - Vin
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+138
-11
@@ -47,14 +47,11 @@ static void ZM_init() {
|
||||
// initialize
|
||||
pin_handle = PIN_open(&ZM_rst, BLE_IO);
|
||||
Init_Elite15_PIN();
|
||||
ELITE15_SPI_HOLD();
|
||||
|
||||
PIN15_setOutputValue(shutdown_6994, 1); // OFF = 1 => turn off 6994
|
||||
PIN15_setOutputValue(enable_10v, 0); // enable 10V
|
||||
|
||||
PIN15_setOutputValue(ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN15_setOutputValue(DAC_CS, 1); // DAC_CS HIGH
|
||||
PIN15_setOutputValue(MEM_CS, 1); // MEM_CS HIGH
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 0); // HIGH Z MODE
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // HIGH Z MODE // 1 => close high_z mode
|
||||
|
||||
InitEliteInstruction();
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
@@ -88,7 +85,8 @@ static void DACCode2Real2Notify(uint16_t DACcode) {
|
||||
(INSTRUCTION.eliteFxn == CONSTANT_CURRENT) || \
|
||||
(INSTRUCTION.eliteFxn == CYCLIC_VOLTAMMETRY) || \
|
||||
(INSTRUCTION.eliteFxn == LINEAR_SWEEP_VOLTAMMETRY) || \
|
||||
(INSTRUCTION.eliteFxn == CONSTANT_VSCAN) \
|
||||
(INSTRUCTION.eliteFxn == CONSTANT_VSCAN) || \
|
||||
(INSTRUCTION.eliteFxn == CALI_ADC_MODE) \
|
||||
)
|
||||
|
||||
#define Ve1MatchVe2Mode() ( \
|
||||
@@ -121,6 +119,7 @@ static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
|
||||
EliteWorkReset = false;
|
||||
batteryADC_flag = false;
|
||||
record_flag = true;
|
||||
firstTimeReset = true;
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
VoutGainControl(INSTRUCTION.VoutGainLevel);
|
||||
@@ -128,7 +127,6 @@ static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
|
||||
if (INSTRUCTION.Ve1 == INSTRUCTION.Ve2) {
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.Ve1));
|
||||
PeriodicEvent = false;
|
||||
ELITE15_SPI_CLOSE();
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}
|
||||
@@ -203,14 +201,126 @@ static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
|
||||
}
|
||||
|
||||
// EliteDone();
|
||||
}else if(INSTRUCTION.eliteFxn == VOLT_OUTPUT){
|
||||
}
|
||||
else if (INSTRUCTION.eliteFxn == PULSE_MODE){
|
||||
/** Periodic Event **/
|
||||
// Default working flow is vscan -> ADC read -> send notify
|
||||
// We will need a flag to control vscan, ADC and notify
|
||||
|
||||
GPT.DeltaGptimerCounter = GPT.GptimerCounter - GPT.GptimerCounter0;
|
||||
GPT.GptimerCounter0 = GPT.GptimerCounter;
|
||||
|
||||
if(EliteWorkReset){
|
||||
InitEliteGPtimer();
|
||||
EliteWorkReset = false;
|
||||
batteryADC_flag = false;
|
||||
record_flag = true;
|
||||
firstTimeReset = true;
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
VoutGainControl(INSTRUCTION.VoutGainLevel);
|
||||
if( Ve1MatchVe2Mode() ){
|
||||
if (INSTRUCTION.Ve1 == INSTRUCTION.Ve2) {
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.Ve1));
|
||||
PeriodicEvent = false;
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GPT.LeadTimeCounter = GPT.LeadTimeCounter + GPT.DeltaGptimerCounter;
|
||||
if(leadTimeReset && GPT.LeadTimeCounter <= 2000){
|
||||
vscanReset = true;
|
||||
}else{
|
||||
if(notifyFirst_flag){
|
||||
GPT.NotifyCounter = INSTRUCTION.notifyRate - 20;
|
||||
notifyFirst_flag = false;
|
||||
}
|
||||
vscanReset = false;
|
||||
leadTimeReset = false;
|
||||
}
|
||||
|
||||
//vscan counter
|
||||
GPT.VscanRateCounter = GPT.VscanRateCounter + GPT.DeltaGptimerCounter;
|
||||
|
||||
if (vscanReset) {
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, 25000));
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, 25000));
|
||||
//vscanReset = false;
|
||||
}else{
|
||||
test_Vscan(WorkModeData->PULSE);
|
||||
}
|
||||
|
||||
// if(GPT.VscanRateCounter >= INSTRUCTION.VsetRate){
|
||||
// if(GPT.VscanRateCounter >= INSTRUCTION.VsetRate * 2){
|
||||
// GPT.GptimerMultiple = GPT.VscanRateCounter / INSTRUCTION.VsetRate;
|
||||
// }else{
|
||||
// GPT.GptimerMultiple = 1;
|
||||
// }
|
||||
// GPT.VscanRateCounter -= INSTRUCTION.VsetRate * GPT.GptimerMultiple; //To get right time
|
||||
// vscan_flag = true;
|
||||
// if(vscan_flag){
|
||||
// EliteVscanControl(WorkModeData);
|
||||
// vscan_flag = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
//battery counter
|
||||
GPT.BatteryADCCounter = GPT.BatteryADCCounter + GPT.DeltaGptimerCounter;
|
||||
GPT.BatteryCheckCounter = GPT.BatteryCheckCounter + GPT.DeltaGptimerCounter;
|
||||
if(GPT.BatteryCheckCounter >= 50000){
|
||||
GPT.BatteryCheckCounter -= 50000; //To get right time
|
||||
batteryCheck_flag = true;
|
||||
}
|
||||
|
||||
uint16_t bat = ((uint16_t)(NotifyVoltBat[2]) << 8 & 0xFF00 ) | ((uint16_t)(NotifyVoltBat[3]) & 0x00FF);
|
||||
if( bat < 768 && bat > 20){
|
||||
PIN15_setOutputValue(enable_5v, 0);
|
||||
}
|
||||
|
||||
//ADC counter
|
||||
GPT.SampleRateCounter = GPT.SampleRateCounter + GPT.DeltaGptimerCounter;
|
||||
if(GPT.SampleRateCounter >= INSTRUCTION.sampleRate){
|
||||
GPT.SampleRateCounter = 0; //To get right data, ADC must be delay 1.5ms
|
||||
ADC_flag = true;
|
||||
if(ADC_flag){
|
||||
EliteADCControl(WorkModeData);
|
||||
ADC_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Notify counter(Notify control, check if we need to send notify)
|
||||
//please don't put Notify counter before ADC counter, maybe get wrong data
|
||||
GPT.NotifyCounter = GPT.NotifyCounter + GPT.DeltaGptimerCounter;
|
||||
if(GPT.NotifyCounter >= INSTRUCTION.notifyRate){
|
||||
GPT.NotifyCounter -= INSTRUCTION.notifyRate; //To get right time
|
||||
notify_flag = true;
|
||||
if(vscanReset){
|
||||
notify_flag = false;
|
||||
}
|
||||
if(notify_flag){
|
||||
SendNotify();
|
||||
notify_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
// EliteDone();
|
||||
}
|
||||
else if(INSTRUCTION.eliteFxn == VOLT_OUTPUT){
|
||||
VoutGainControl(INSTRUCTION.VoutGainLevel);
|
||||
WorkModeData->VO->_Vset = INSTRUCTION.VoltConstant;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, WorkModeData->VO->_Vset)); //UserCode -> DAC code -> DAC out
|
||||
FreeWorkMode(WorkModeData);
|
||||
PeriodicEvent = false;
|
||||
ELITE15_SPI_CLOSE();
|
||||
}else{
|
||||
InitFlag();
|
||||
}
|
||||
else if(INSTRUCTION.eliteFxn == CALI_DAC_MODE){
|
||||
DAC_outputV(INSTRUCTION.VoltConstant); //UserCode -> DAC code -> DAC out
|
||||
FreeWorkMode(WorkModeData);
|
||||
PeriodicEvent = false;
|
||||
}
|
||||
else{
|
||||
// InitFlag();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,6 +362,19 @@ static void EliteADCControl(WorkMode *WorkModeData) {
|
||||
CC_Plot(WorkModeData);
|
||||
break;
|
||||
}
|
||||
case CALI_ADC_MODE:{
|
||||
if(INSTRUCTION.AdcChannel == IIN_ADC){
|
||||
cali_IT_plot(WorkModeData);
|
||||
}else if(INSTRUCTION.AdcChannel == VIN_ADC){
|
||||
cali_VT_plot(WorkModeData);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case PULSE_MODE:{
|
||||
CC_Plot(WorkModeData);
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
@@ -297,6 +420,10 @@ static void EliteVscanControl(WorkMode *WorkModeData) {
|
||||
CVSCAN_Vscan(WorkModeData->CVSCAN);
|
||||
break;
|
||||
}
|
||||
case PULSE_MODE:{
|
||||
PULSE_Vscan(WorkModeData->PULSE);
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
|
||||
+11
-10
@@ -546,17 +546,18 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
|
||||
// Initialize application
|
||||
SimpleBLEPeripheral_init();
|
||||
|
||||
ZM_init();
|
||||
// Elite_SPI_init();
|
||||
WorkMode *WorkModeData = CreateWorkMode();
|
||||
|
||||
// init DAC, set output ~= 0 V
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_15K;
|
||||
VoutGainControl(INSTRUCTION.VoutGainLevel);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, 25000));
|
||||
|
||||
uint8_t key = 0;
|
||||
uint16_t counter6994 = 0;
|
||||
bool EliteOn = 0;
|
||||
|
||||
// init DAC, set output ~= 0 V
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, 25000));
|
||||
elite_gptimer_start();
|
||||
|
||||
// Application main loops
|
||||
@@ -617,22 +618,22 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
if (!PeriodicEvent) { // if there is no periodic event
|
||||
key = PIN_getInputValue(switch_on);
|
||||
if (EliteOn) {
|
||||
if (counter6994 < CLOCK_ONE_SECOND/2) { // counter6994 enable a IC after 35 counts
|
||||
if (counter6994 < CLOCK_ONE_SECOND*5) { // counter6994 enable a IC after 35 counts
|
||||
counter6994++;
|
||||
} else if (counter6994 == CLOCK_ONE_SECOND/2) {
|
||||
PIN15_setOutputValue(shutdown_6994, 1); // OFF = 1 => turn off 6994
|
||||
} else if (counter6994 == CLOCK_ONE_SECOND*5) {
|
||||
PIN15_setOutputValue(shutdown_6994, 0); // OFF = 1 => turn off 6994
|
||||
counter6994++;
|
||||
} else if (counter6994 > CLOCK_ONE_SECOND*5) {
|
||||
counter6994 = 0;
|
||||
}
|
||||
EliteKeyPress(key);
|
||||
|
||||
if(key != 0){ //detect Elite battery power when no periodic event
|
||||
measureBat();
|
||||
}
|
||||
if(Free_Work_Mode){
|
||||
FreeWorkMode(WorkModeData);
|
||||
InitEliteInstruction();
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
|
||||
Free_Work_Mode = false;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user