Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3201dada39 | |||
| c37b2157d6 | |||
| 595396f7a9 | |||
| d49874a666 | |||
| 6d6ba43d81 | |||
| 4914498732 | |||
| 85220734de | |||
| 7531a6638b | |||
| 4088a4d38b | |||
| 1b3d057d33 | |||
| 17e1846afa | |||
| 0407690197 | |||
| 55e8b37f13 | |||
| fb4c0a59e8 | |||
| ea3d146c86 | |||
| cddafdffff | |||
| 05e953d6e2 | |||
| 9b7e960bec | |||
| c3aa2f7178 | |||
| 5b4970d814 | |||
| 46c43afa26 | |||
| 6bcfc74d1a | |||
| 4d920209f7 | |||
| 52f8708905 | |||
| b7024363ee | |||
| 1a6d30606c | |||
| e72698dea3 | |||
| 3100dded42 | |||
| 53584f2b5b | |||
| b2d924228a | |||
| f3de02477d | |||
| 77a2bc2d8f | |||
| c56a07ead8 | |||
| 2e3ca56ece | |||
| b8588393b7 | |||
| ea33b37080 | |||
| ea7815dc64 |
+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" name="Compiler version" 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" 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" keepEnvironmentInBuildfile="false" name="GNU Make" 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" name="GNU Make.FlashROM" 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" 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">
|
||||
<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">
|
||||
<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" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE" valueType="definedSymbols">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.1897088" 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" 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">
|
||||
<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">
|
||||
<listOptionValue builtIn="false" value="48"/>
|
||||
</option>
|
||||
<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">
|
||||
<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">
|
||||
<listOptionValue builtIn="false" value="225"/>
|
||||
</option>
|
||||
<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">
|
||||
<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">
|
||||
<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" 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">
|
||||
<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">
|
||||
<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" name="Add <dir> to library search path (--search_path, -i)" 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" 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" name="Suppress diagnostic <id> (--diag_suppress)" 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" 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" 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"/>
|
||||
<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"/>
|
||||
<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" 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"/>
|
||||
<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"/>
|
||||
</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" name="Package repositories (--xdcpath)" 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" 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" 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"/>
|
||||
<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"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
|
||||
#ifndef Elite15_PIN
|
||||
#define Elite_15PIN
|
||||
|
||||
#include "Elite_PIN.h"
|
||||
|
||||
static void update_latch_status (uint32_t latch_num, uint32_t elite_pin, bool highlow) {
|
||||
switch (latch_num) {
|
||||
case LOAD0: {
|
||||
switch (elite_pin) {
|
||||
case D0: {
|
||||
LH.LATCH0[0] = highlow;
|
||||
break;
|
||||
}
|
||||
case D1: {
|
||||
LH.LATCH0[1] = highlow;
|
||||
break;
|
||||
}
|
||||
case D2: {
|
||||
LH.LATCH0[2] = highlow;
|
||||
break;
|
||||
}
|
||||
case D3: {
|
||||
LH.LATCH0[3] = highlow;
|
||||
break;
|
||||
}
|
||||
case D4: {
|
||||
LH.LATCH0[4] = highlow;
|
||||
break;
|
||||
}
|
||||
case D5: {
|
||||
LH.LATCH0[5] = highlow;
|
||||
break;
|
||||
}
|
||||
case D6: {
|
||||
LH.LATCH0[6] = highlow;
|
||||
break;
|
||||
}
|
||||
case D7: {
|
||||
LH.LATCH0[7] = highlow;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOAD1: {
|
||||
switch (elite_pin) {
|
||||
case D0: {
|
||||
LH.LATCH1[0] = highlow;
|
||||
break;
|
||||
}
|
||||
case D1: {
|
||||
LH.LATCH1[1] = highlow;
|
||||
break;
|
||||
}
|
||||
case D2: {
|
||||
LH.LATCH1[2] = highlow;
|
||||
break;
|
||||
}
|
||||
case D3: {
|
||||
LH.LATCH1[3] = highlow;
|
||||
break;
|
||||
}
|
||||
case D4: {
|
||||
LH.LATCH1[4] = highlow;
|
||||
break;
|
||||
}
|
||||
case D5: {
|
||||
LH.LATCH1[5] = highlow;
|
||||
break;
|
||||
}
|
||||
case D6: {
|
||||
LH.LATCH1[6] = highlow;
|
||||
break;
|
||||
}
|
||||
case D7: {
|
||||
LH.LATCH1[7] = highlow;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOAD2: {
|
||||
switch (elite_pin) {
|
||||
case D0: {
|
||||
LH.LATCH2[0] = highlow;
|
||||
break;
|
||||
}
|
||||
case D1: {
|
||||
LH.LATCH2[1] = highlow;
|
||||
break;
|
||||
}
|
||||
case D2: {
|
||||
LH.LATCH2[2] = highlow;
|
||||
break;
|
||||
}
|
||||
case D3: {
|
||||
LH.LATCH2[3] = highlow;
|
||||
break;
|
||||
}
|
||||
case D4: {
|
||||
LH.LATCH2[4] = highlow;
|
||||
break;
|
||||
}
|
||||
case D5: {
|
||||
LH.LATCH2[5] = highlow;
|
||||
break;
|
||||
}
|
||||
case D6: {
|
||||
LH.LATCH2[6] = highlow;
|
||||
break;
|
||||
}
|
||||
case D7: {
|
||||
LH.LATCH2[7] = highlow;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void PIN15_setOutputValue (uint32_t latch_num, uint32_t pin_num, bool highlow) {
|
||||
if(PeriodicEvent){
|
||||
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);
|
||||
switch (latch_num) {
|
||||
case LOAD0: {
|
||||
// PIN_setOutputValue(&ZM_rst, D0, LH.LATCH0[0]);
|
||||
// PIN_setOutputValue(&ZM_rst, D1, LH.LATCH0[1]);
|
||||
// PIN_setOutputValue(&ZM_rst, D2, LH.LATCH0[2]);
|
||||
// PIN_setOutputValue(&ZM_rst, D3, LH.LATCH0[3]);
|
||||
PIN_setOutputValue(pin_handle, D4, LH.LATCH0[4]);
|
||||
PIN_setOutputValue(pin_handle, D5, LH.LATCH0[5]);
|
||||
PIN_setOutputValue(pin_handle, D6, LH.LATCH0[6]);
|
||||
PIN_setOutputValue(pin_handle, D7, LH.LATCH0[7]);
|
||||
break;
|
||||
}
|
||||
case LOAD1: {
|
||||
PIN_setOutputValue(pin_handle, D0, LH.LATCH1[0]);
|
||||
PIN_setOutputValue(pin_handle, D1, LH.LATCH1[1]);
|
||||
PIN_setOutputValue(pin_handle, D2, LH.LATCH1[2]);
|
||||
PIN_setOutputValue(pin_handle, D3, LH.LATCH1[3]);
|
||||
PIN_setOutputValue(pin_handle, D4, LH.LATCH1[4]);
|
||||
PIN_setOutputValue(pin_handle, D5, LH.LATCH1[5]);
|
||||
PIN_setOutputValue(pin_handle, D6, LH.LATCH1[6]);
|
||||
PIN_setOutputValue(pin_handle, D7, LH.LATCH1[7]);
|
||||
break;
|
||||
}
|
||||
case LOAD2: {
|
||||
PIN_setOutputValue(pin_handle, D0, LH.LATCH2[0]);
|
||||
PIN_setOutputValue(pin_handle, D1, LH.LATCH2[1]);
|
||||
PIN_setOutputValue(pin_handle, D2, LH.LATCH2[2]);
|
||||
PIN_setOutputValue(pin_handle, D3, LH.LATCH2[3]);
|
||||
PIN_setOutputValue(pin_handle, D4, LH.LATCH2[4]);
|
||||
PIN_setOutputValue(pin_handle, D5, LH.LATCH2[5]);
|
||||
PIN_setOutputValue(pin_handle, D6, LH.LATCH2[6]);
|
||||
PIN_setOutputValue(pin_handle, D7, LH.LATCH2[7]);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
CPUdelay(10);
|
||||
PIN_setOutputValue(&ZM_rst, latch_num, 0); // Turn off latch
|
||||
remove_elite_pin();
|
||||
|
||||
if(PeriodicEvent){
|
||||
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);
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
+411
-121
@@ -46,8 +46,11 @@ static void ADC_write(uint8_t ADCin) {
|
||||
spi_ADC_txbuf[0] = ADCin;
|
||||
spi_ADC_txbuf[1] = 0b11101011;
|
||||
|
||||
|
||||
ADC_SPI(2, spi_ADC_txbuf, spi_ADC_rxbuf);
|
||||
if(PeriodicEvent){
|
||||
ADC_SPI_TEST(2, spi_ADC_txbuf, spi_ADC_rxbuf);
|
||||
}else{
|
||||
ADC_SPI(2, spi_ADC_txbuf, spi_ADC_rxbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static void ADC_read(uint8_t *ADCdata){
|
||||
@@ -56,34 +59,89 @@ static void ADC_read(uint8_t *ADCdata){
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
ADC_SPI(SPI_ADC_SIZE, spi_ADC_txbuf, ADCdata);
|
||||
if(PeriodicEvent){
|
||||
ADC_SPI_TEST(2, spi_ADC_txbuf, spi_ADC_rxbuf);
|
||||
}else{
|
||||
ADC_SPI(2, spi_ADC_txbuf, spi_ADC_rxbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static void ADCGainControl(uint8_t ADCLevel){
|
||||
if(ADCLevel == 0){
|
||||
// ADC gain level = 0, using 200K resister
|
||||
PIN_setOutputValue(pin_handle, Turnon10K, 0);
|
||||
PIN_setOutputValue(pin_handle, Turnon200R, 0);
|
||||
static void IinADCGainControl(uint8_t IinADCLevel){
|
||||
if(IinADCLevel == 0){
|
||||
// ADC gain level = 0, using 3M resister
|
||||
PIN15_setOutputValue(Turnon_I_LARGE, 0);
|
||||
PIN15_setOutputValue(Turnon_I_MID, 0);
|
||||
PIN15_setOutputValue(Turnon_I_SMALL, 0);
|
||||
}
|
||||
else if(ADCLevel == 1){
|
||||
// ADC gain level = 1, using 10K resister
|
||||
PIN_setOutputValue(pin_handle, Turnon10K, 1);
|
||||
PIN_setOutputValue(pin_handle, Turnon200R, 0);
|
||||
else if(IinADCLevel == 1){
|
||||
// ADC gain level = 1, using 100K resister
|
||||
PIN15_setOutputValue(Turnon_I_LARGE, 0);
|
||||
PIN15_setOutputValue(Turnon_I_MID, 0);
|
||||
PIN15_setOutputValue(Turnon_I_SMALL, 1);
|
||||
}
|
||||
else if(ADCLevel == 2){
|
||||
// ADC gain level = 2, using 200R resister
|
||||
PIN_setOutputValue(pin_handle, Turnon10K, 0);
|
||||
PIN_setOutputValue(pin_handle, Turnon200R, 1);
|
||||
else if(IinADCLevel == 2){
|
||||
// ADC gain level = 2, using 3K resister
|
||||
PIN15_setOutputValue(Turnon_I_LARGE, 0);
|
||||
PIN15_setOutputValue(Turnon_I_MID, 1);
|
||||
PIN15_setOutputValue(Turnon_I_SMALL, 0);
|
||||
}
|
||||
else if(ADCLevel == 3){
|
||||
// ADC gain level = 0, auto gain (using 200R resister)
|
||||
PIN_setOutputValue(pin_handle, Turnon10K, 0);
|
||||
PIN_setOutputValue(pin_handle, Turnon200R, 1);
|
||||
else if(IinADCLevel == 3){
|
||||
// ADC gain level = 3, using 100R resistor
|
||||
PIN15_setOutputValue(Turnon_I_LARGE, 1);
|
||||
PIN15_setOutputValue(Turnon_I_MID, 0);
|
||||
PIN15_setOutputValue(Turnon_I_SMALL, 0);
|
||||
}
|
||||
else if(IinADCLevel == 4){
|
||||
// ADC gain level = 3, auto gain (using 100R resister)
|
||||
PIN15_setOutputValue(Turnon_I_LARGE, 1);
|
||||
PIN15_setOutputValue(Turnon_I_MID, 0);
|
||||
PIN15_setOutputValue(Turnon_I_SMALL, 0);
|
||||
}
|
||||
else{
|
||||
// default using 200R resister
|
||||
PIN_setOutputValue(pin_handle, Turnon10K, 0);
|
||||
PIN_setOutputValue(pin_handle, Turnon200R, 1);
|
||||
// default using 100R resister
|
||||
PIN15_setOutputValue(Turnon_I_LARGE, 1);
|
||||
PIN15_setOutputValue(Turnon_I_MID, 0);
|
||||
PIN15_setOutputValue(Turnon_I_SMALL, 0);
|
||||
}
|
||||
|
||||
if(IinADCLevel == 0 || IinADCLevel == 1 || IinADCLevel == 2 || IinADCLevel == 3){
|
||||
lastIinADCGainLevel = IinADCLevel;
|
||||
}else{
|
||||
lastIinADCGainLevel = 3;
|
||||
}
|
||||
}
|
||||
|
||||
static void VinADCGainControl(uint8_t VinADCLevel){
|
||||
if(VinADCLevel == 0){
|
||||
// Vin ADC gain level = 0, using 1M resister
|
||||
PIN15_setOutputValue(Turnon_V_SMALL, 0);
|
||||
PIN15_setOutputValue(Turnon_V_MID, 0);
|
||||
}
|
||||
else if(VinADCLevel == 1){
|
||||
// Vin ADC gain level = 1, using 30K resister
|
||||
PIN15_setOutputValue(Turnon_V_SMALL, 0);
|
||||
PIN15_setOutputValue(Turnon_V_MID, 1);
|
||||
}
|
||||
else if(VinADCLevel == 2){
|
||||
// Vin ADC gain level = 2, using 1K resister
|
||||
PIN15_setOutputValue(Turnon_V_SMALL, 1);
|
||||
PIN15_setOutputValue(Turnon_V_MID, 0);
|
||||
}
|
||||
else if(VinADCLevel == 3){
|
||||
// Vin ADC gain level = 3, auto gain (using 1K resister)
|
||||
PIN15_setOutputValue(Turnon_V_SMALL, 1);
|
||||
PIN15_setOutputValue(Turnon_V_MID, 0);
|
||||
}
|
||||
else{
|
||||
// default using 1K resister
|
||||
PIN15_setOutputValue(Turnon_V_SMALL, 1);
|
||||
PIN15_setOutputValue(Turnon_V_MID, 0);
|
||||
}
|
||||
|
||||
if(VinADCLevel == 0 || VinADCLevel == 1 || VinADCLevel == 2){
|
||||
lastVinADCGainLevel = VinADCLevel;
|
||||
}else{
|
||||
lastVinADCGainLevel = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,8 +182,20 @@ static void ADCChannelSelect(uint8_t ADCChannel){
|
||||
}
|
||||
}
|
||||
|
||||
static void ReadVolt(uint8_t *buf){
|
||||
static void ReadADCIin(uint8_t *buf){
|
||||
// Read data twice since the first data we get is previous data
|
||||
// IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
ADCChannelSelect(ADC_CH_CURRENT);
|
||||
ADC_read(buf);
|
||||
|
||||
ADCChannelSelect(ADC_CH_CURRENT);
|
||||
ADC_read(buf);
|
||||
}
|
||||
|
||||
static void ReadADCVin(uint8_t *buf){
|
||||
// Read data twice since the first data we get is previous data
|
||||
|
||||
// VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
ADCChannelSelect(ADC_CH_VOLT);
|
||||
ADC_read(buf);
|
||||
|
||||
@@ -133,7 +203,7 @@ static void ReadVolt(uint8_t *buf){
|
||||
ADC_read(buf);
|
||||
}
|
||||
|
||||
static void ReadVoutVolt(uint8_t *buf){
|
||||
static void ReadADCVout(uint8_t *buf){
|
||||
// Read data twice since the first data we get is previous data
|
||||
ADCChannelSelect(ADC_CH_DAC);
|
||||
ADC_read(buf);
|
||||
@@ -142,16 +212,7 @@ static void ReadVoutVolt(uint8_t *buf){
|
||||
ADC_read(buf);
|
||||
}
|
||||
|
||||
static void ReadCurrent(uint8_t *buf){
|
||||
// Read data twice since the first data we get is previous data
|
||||
ADCChannelSelect(ADC_CH_CURRENT);
|
||||
ADC_read(buf);
|
||||
|
||||
ADCChannelSelect(ADC_CH_CURRENT);
|
||||
ADC_read(buf);
|
||||
}
|
||||
|
||||
static void ReadBatVolt(uint8_t *buf){
|
||||
static void ReadADCBat(uint8_t *buf){
|
||||
// Read data twice since the first data we get is previous data
|
||||
ADCChannelSelect(ADC_CH_BAT);
|
||||
ADC_read(buf);
|
||||
@@ -160,133 +221,362 @@ static void ReadBatVolt(uint8_t *buf){
|
||||
ADC_read(buf);
|
||||
}
|
||||
|
||||
/* for Elite1.5-re */
|
||||
// Iin theoretical boundary <2.67, 1.89~80, 63~2600, >1900 (uA)
|
||||
#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
|
||||
|
||||
// theoretical boundary <20, 10~500, >100 (uA)
|
||||
//#define GAIN_SMALL_BOUNDARY 40000 // 40 uA = 40,000,000 pA
|
||||
//#define GAIN_MID_BOUNDARY1 20000 // 20 uA = 20,000,000 pA
|
||||
//#define GAIN_MID_BOUNDARY2 400000 // 400 uA = 400,000,000 pA
|
||||
//#define GAIN_LARGE_BOUNDARY 200000 // 200 uA = 200,000 nA
|
||||
// Vin theoretical boundary <7, 5~200, >100 (mV)
|
||||
#define VIN_GAIN_SMALL_BOUNDARY 7000 // 7 mV = 7,000,000 nV
|
||||
#define VIN_GAIN_MID1_BOUNDARY1 5000 // 5 mV = 5,000,000 nV
|
||||
#define VIN_GAIN_MID1_BOUNDARY2 300000 // 300 mV = 300,000,000 nV
|
||||
#define VIN_GAIN_LARGE_BOUNDARY 250000 // 250 mV = 250,000,000 nV
|
||||
|
||||
//#define GAIN_SMALL_BOUNDARY 8000 // 8 uA = 8,000,000 pA
|
||||
//#define GAIN_MID_BOUNDARY1 3000 // 3 uA = 3,000,000 pA
|
||||
//#define GAIN_MID_BOUNDARY2 90000 // 90 uA = 90,000,000 pA
|
||||
//#define GAIN_LARGE_BOUNDARY 70000 // 70 uA = 70,000 nA
|
||||
static int32_t AutoGainReadIin(uint8_t *buf){
|
||||
int32_t RealCurrent = 0;
|
||||
|
||||
/* for Elite1.4-re which 6.3kohm replaced by 10kohm */
|
||||
// theoretical boundary <40, 30~1350, >1000 (uA)
|
||||
#define GAIN_SMALL_BOUNDARY 35000 // 40 uA = 40,000,000 pA
|
||||
#define GAIN_MID_BOUNDARY1 30000 // 30 uA = 30,000,000 pA
|
||||
#define GAIN_MID_BOUNDARY2 1350000 // 1350 uA = 1350,000,000 pA
|
||||
#define GAIN_LARGE_BOUNDARY 1000000 // 1000 uA = 1000,000 nA
|
||||
if(INSTRUCTION.ADCGainLevel == I_GAIN_AUTO){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_100R;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
}
|
||||
|
||||
static int32_t AutoGainReadCurrent(uint8_t *buf){
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
RealCurrent = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
|
||||
int32_t Real_Current = 0;
|
||||
return RealCurrent;
|
||||
}
|
||||
|
||||
if(INSTRUCTION.ADCGainLevel == GAIN_AUTO){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
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;
|
||||
}
|
||||
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
ReadADCVin(spi_ADC_rxbuf);
|
||||
RealVolt = DecodeADCValue(INSTRUCTION.VinADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
|
||||
return Real_Current;
|
||||
return RealVolt;
|
||||
}
|
||||
|
||||
static void AutoGainChange(int32_t Real_Current){
|
||||
if(INSTRUCTION.ADCGainLevel == GAIN_200R){
|
||||
// switch to mid range current
|
||||
if(Real_Current < GAIN_LARGE_BOUNDARY && Real_Current > -1*GAIN_LARGE_BOUNDARY){
|
||||
// switch to small range current
|
||||
if (Real_Current < GAIN_MID_BOUNDARY1 && Real_Current > -1*GAIN_MID_BOUNDARY1){
|
||||
GAIN_200K_counter++;
|
||||
if(GAIN_200K_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200K;
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
GAIN_200K_counter = 0;
|
||||
static void AutoGainChangeIin(int32_t RealCurrent){
|
||||
// switch to 1 level current(small) 3M
|
||||
// switch to 2 level current 100K
|
||||
// switch to 3 level current 3K
|
||||
// switch to 4 level current(large) 100R
|
||||
if(INSTRUCTION.ADCGainLevel == I_GAIN_100R){
|
||||
if(RealCurrent < I_GAIN_LARGE_BOUNDARY && RealCurrent > -1*I_GAIN_LARGE_BOUNDARY){
|
||||
// switch to 1 level current(small)
|
||||
if (RealCurrent < I_GAIN_MID1_BOUNDARY1 && RealCurrent > -1*I_GAIN_MID1_BOUNDARY1){
|
||||
I_GAIN_3M_counter++;
|
||||
if(I_GAIN_3M_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_3M;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
I_GAIN_3M_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}else{
|
||||
GAIN_10K_counter++;
|
||||
if(GAIN_10K_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_10K;
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
GAIN_10K_counter = 0;
|
||||
}
|
||||
// switch to 2 level current
|
||||
else if (RealCurrent < I_GAIN_MID2_BOUNDARY1 && RealCurrent > -1*I_GAIN_MID2_BOUNDARY1){
|
||||
I_GAIN_100K_counter++;
|
||||
if(I_GAIN_100K_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_100K;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
I_GAIN_100K_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
// switch to 3 level current
|
||||
else{
|
||||
I_GAIN_3K_counter++;
|
||||
if(I_GAIN_3K_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_3K;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
I_GAIN_3K_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(GAIN_200K_counter > 0){
|
||||
GAIN_200K_counter--;
|
||||
if(I_GAIN_3K_counter > 0){
|
||||
I_GAIN_3K_counter--;
|
||||
}
|
||||
if(GAIN_10K_counter > 0){
|
||||
GAIN_10K_counter--;
|
||||
if(I_GAIN_100K_counter > 0){
|
||||
I_GAIN_100K_counter--;
|
||||
}
|
||||
if(I_GAIN_3M_counter > 0){
|
||||
I_GAIN_3M_counter--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.ADCGainLevel == GAIN_10K){
|
||||
// switch to large range current
|
||||
if(Real_Current > GAIN_MID_BOUNDARY2 || Real_Current < -1*GAIN_MID_BOUNDARY2){
|
||||
GAIN_200R_counter++;
|
||||
if(GAIN_200R_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
GAIN_200R_counter = 0;
|
||||
else if(INSTRUCTION.ADCGainLevel == I_GAIN_3K){
|
||||
// switch to 4 level current(large)
|
||||
if(RealCurrent > I_GAIN_MID2_BOUNDARY2 || RealCurrent < -1*I_GAIN_MID2_BOUNDARY2){
|
||||
I_GAIN_100R_counter++;
|
||||
if(I_GAIN_100R_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_100R;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
I_GAIN_100R_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
else if (RealCurrent < I_GAIN_MID2_BOUNDARY1 && RealCurrent > -1*I_GAIN_MID2_BOUNDARY1){
|
||||
// switch to 1 level current(small)
|
||||
if(RealCurrent < I_GAIN_MID1_BOUNDARY1 && RealCurrent > -1*I_GAIN_MID1_BOUNDARY1){
|
||||
I_GAIN_3M_counter++;
|
||||
if(I_GAIN_3M_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_3M;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
I_GAIN_3M_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
// switch to 2 level current
|
||||
else{
|
||||
I_GAIN_100K_counter++;
|
||||
if(I_GAIN_100K_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_100K;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
I_GAIN_100K_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(I_GAIN_100R_counter > 0){
|
||||
I_GAIN_100R_counter--;
|
||||
}
|
||||
if(I_GAIN_100K_counter > 0){
|
||||
I_GAIN_100K_counter--;
|
||||
}
|
||||
if(I_GAIN_3M_counter > 0){
|
||||
I_GAIN_3M_counter--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.ADCGainLevel == I_GAIN_100K){
|
||||
// switch to 1 level current(small)
|
||||
if(RealCurrent < I_GAIN_MID1_BOUNDARY1 && RealCurrent > -1*I_GAIN_MID1_BOUNDARY1){
|
||||
I_GAIN_3M_counter++;
|
||||
if(I_GAIN_3M_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_3M;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
I_GAIN_3M_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
else if (RealCurrent > I_GAIN_MID1_BOUNDARY2 || RealCurrent < -1*I_GAIN_MID1_BOUNDARY2){
|
||||
// switch to 4 level current(large)
|
||||
if(RealCurrent > I_GAIN_MID2_BOUNDARY2 || RealCurrent < -1*I_GAIN_MID2_BOUNDARY2){
|
||||
I_GAIN_100R_counter++;
|
||||
if(I_GAIN_100R_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_100R;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
I_GAIN_100R_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
// switch to 3 level current
|
||||
else{
|
||||
I_GAIN_3K_counter++;
|
||||
if(I_GAIN_3K_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_3K;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
I_GAIN_3K_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(I_GAIN_100R_counter > 0){
|
||||
I_GAIN_100R_counter--;
|
||||
}
|
||||
if(I_GAIN_3K_counter > 0){
|
||||
I_GAIN_3K_counter--;
|
||||
}
|
||||
if(I_GAIN_3M_counter > 0){
|
||||
I_GAIN_3M_counter--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.ADCGainLevel == I_GAIN_3M){
|
||||
if(RealCurrent > I_GAIN_SMALL_BOUNDARY || RealCurrent < -1*I_GAIN_SMALL_BOUNDARY){
|
||||
// switch to 4 level current(large)
|
||||
if(RealCurrent > I_GAIN_MID2_BOUNDARY2 || RealCurrent < -1*I_GAIN_MID2_BOUNDARY2){
|
||||
I_GAIN_100R_counter++;
|
||||
if(I_GAIN_100R_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_100R;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
I_GAIN_100R_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
// switch to 3 level current
|
||||
else if(RealCurrent > I_GAIN_MID1_BOUNDARY2 || RealCurrent < -1*I_GAIN_MID1_BOUNDARY2){
|
||||
I_GAIN_3K_counter++;
|
||||
if(I_GAIN_3K_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_3K;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
I_GAIN_3K_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
// switch to 2 level current
|
||||
else{
|
||||
I_GAIN_100K_counter++;
|
||||
if(I_GAIN_100K_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_100K;
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
I_GAIN_100K_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
|
||||
// switch to small range current
|
||||
else if (Real_Current < GAIN_MID_BOUNDARY1 && Real_Current > -1*GAIN_MID_BOUNDARY1){
|
||||
GAIN_200K_counter++;
|
||||
if(GAIN_200K_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200K;
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
GAIN_200K_counter = 0;
|
||||
}
|
||||
}else{
|
||||
if(I_GAIN_100R_counter > 0){
|
||||
I_GAIN_100R_counter--;
|
||||
}
|
||||
if(I_GAIN_3K_counter > 0){
|
||||
I_GAIN_3K_counter--;
|
||||
}
|
||||
if(I_GAIN_100K_counter > 0){
|
||||
I_GAIN_100K_counter--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void AutoGainChangeVin(int32_t RealVin){
|
||||
// switch to 1 level volt(small) 1M
|
||||
// switch to 2 level volt 30K
|
||||
// switch to 3 level volt(large) 1K
|
||||
if(INSTRUCTION.VinADCGainLevel == VIN_GAIN_1M){
|
||||
if(RealVin > VIN_GAIN_SMALL_BOUNDARY || RealVin < -1*VIN_GAIN_SMALL_BOUNDARY){
|
||||
// switch to 3 level volt(large)
|
||||
if (RealVin > VIN_GAIN_MID1_BOUNDARY2 || RealVin < -1*VIN_GAIN_MID1_BOUNDARY2){
|
||||
VIN_GAIN_1K_counter++;
|
||||
if(VIN_GAIN_1K_counter > 2){
|
||||
INSTRUCTION.VinADCGainLevel = VIN_GAIN_1K;
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
VIN_GAIN_1K_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
// switch to 2 level volt
|
||||
else{
|
||||
VIN_GAIN_30K_counter++;
|
||||
if(VIN_GAIN_30K_counter > 2){
|
||||
INSTRUCTION.VinADCGainLevel = VIN_GAIN_30K;
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
VIN_GAIN_30K_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(VIN_GAIN_1K_counter > 0){
|
||||
VIN_GAIN_1K_counter--;
|
||||
}
|
||||
if(VIN_GAIN_30K_counter > 0){
|
||||
VIN_GAIN_30K_counter--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.VinADCGainLevel == VIN_GAIN_30K){
|
||||
// switch to 1 level volt(small)
|
||||
if(RealVin < VIN_GAIN_MID1_BOUNDARY1 && RealVin > -1*VIN_GAIN_MID1_BOUNDARY1){
|
||||
VIN_GAIN_1M_counter++;
|
||||
if(VIN_GAIN_1M_counter > 2){
|
||||
INSTRUCTION.VinADCGainLevel = VIN_GAIN_1M;
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
VIN_GAIN_1M_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
else if (RealVin > VIN_GAIN_MID1_BOUNDARY2 || RealVin < -1*VIN_GAIN_MID1_BOUNDARY2){
|
||||
// switch to 3 level volt
|
||||
VIN_GAIN_1K_counter++;
|
||||
if(VIN_GAIN_1K_counter > 2){
|
||||
INSTRUCTION.VinADCGainLevel = VIN_GAIN_1K;
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
VIN_GAIN_1K_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
}else{
|
||||
if(GAIN_200R_counter > 0){
|
||||
GAIN_200R_counter--;
|
||||
if(VIN_GAIN_1K_counter > 0){
|
||||
VIN_GAIN_1K_counter--;
|
||||
}
|
||||
if(GAIN_200K_counter > 0){
|
||||
GAIN_200K_counter--;
|
||||
if(VIN_GAIN_1M_counter > 0){
|
||||
VIN_GAIN_1M_counter--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.ADCGainLevel == GAIN_200K){
|
||||
// switch to mid range current
|
||||
if(Real_Current > GAIN_SMALL_BOUNDARY || Real_Current < -1*GAIN_SMALL_BOUNDARY){
|
||||
// switch to large range current
|
||||
if(Real_Current > GAIN_MID_BOUNDARY2 || Real_Current < -1*GAIN_MID_BOUNDARY2){
|
||||
GAIN_200R_counter++;
|
||||
if(GAIN_200R_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
GAIN_200R_counter = 0;
|
||||
else if(INSTRUCTION.VinADCGainLevel == VIN_GAIN_1K){
|
||||
if(RealVin < VIN_GAIN_LARGE_BOUNDARY && RealVin > -1*VIN_GAIN_LARGE_BOUNDARY){
|
||||
// switch to 1 level volt(small)
|
||||
if (RealVin < VIN_GAIN_MID1_BOUNDARY1 && RealVin > -1*VIN_GAIN_MID1_BOUNDARY1){
|
||||
VIN_GAIN_1M_counter++;
|
||||
if(VIN_GAIN_1M_counter > 2){
|
||||
INSTRUCTION.VinADCGainLevel = VIN_GAIN_1M;
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
VIN_GAIN_1M_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
|
||||
}else{
|
||||
GAIN_10K_counter++;
|
||||
if(GAIN_10K_counter > 2){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_10K;
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
GAIN_10K_counter = 0;
|
||||
}
|
||||
// switch to 2 level volt
|
||||
else{
|
||||
VIN_GAIN_30K_counter++;
|
||||
if(VIN_GAIN_30K_counter > 2){
|
||||
INSTRUCTION.VinADCGainLevel = VIN_GAIN_30K;
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
VIN_GAIN_30K_counter = 0;
|
||||
record_flag = false;
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
if(GAIN_200R_counter > 0){
|
||||
GAIN_200R_counter--;
|
||||
}else{
|
||||
if(VIN_GAIN_1M_counter > 0){
|
||||
VIN_GAIN_1M_counter--;
|
||||
}
|
||||
if(GAIN_10K_counter > 0){
|
||||
GAIN_10K_counter--;
|
||||
if(VIN_GAIN_30K_counter > 0){
|
||||
VIN_GAIN_30K_counter--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
// Red light for start acquiring data
|
||||
Elite_led_color(COLOR_RED);
|
||||
|
||||
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]));
|
||||
ADCValueSUM = ADCValueSUM + ADCValueTemp;
|
||||
}
|
||||
|
||||
ADCValueAVG = ADCValueSUM / count;
|
||||
ADCValueAVG_RAW = (uint16_t) (ADCValueAVG & 0x0000FFFF);
|
||||
|
||||
// Blue light for data acquire done
|
||||
Elite_led_color(COLOR_BLUE);
|
||||
|
||||
return ADCValueAVG_RAW;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+43
-68
@@ -19,7 +19,7 @@ static uint16_t CV3Curve(CV3Mode *CV3){
|
||||
}
|
||||
|
||||
INSTRUCTION.VoltConstant = Vout / 40000 + 25000;//5nV=>usercode
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant);
|
||||
|
||||
int32_t RealV2;
|
||||
RealV2 = (int32_t)((Vout - Vin) / 200);//[1uV]
|
||||
@@ -72,82 +72,57 @@ static void CV3_Vscan(CV3Mode *CV3){
|
||||
}
|
||||
|
||||
if(!vscanReset){
|
||||
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 (Vset >= CV3->_Vmax){
|
||||
VmaxCounter++;
|
||||
}else if (Vset <= CV3->_Vmin){
|
||||
VminCounter++;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (CV3->_current_direction_up){
|
||||
Vset = Vset + CV3->_Vstep * GPT.GptimerMultiple;
|
||||
}else{
|
||||
Vset = Vset - CV3->_Vstep * GPT.GptimerMultiple;
|
||||
}
|
||||
|
||||
if (Vset >= CV3->_Vmax){
|
||||
VmaxCounter++;
|
||||
}else if (Vset <= CV3->_Vmin){
|
||||
VminCounter++;
|
||||
}
|
||||
|
||||
if (CV3->_current_direction_up){
|
||||
Vset = Vset + CV3->_Vstep;
|
||||
}else{
|
||||
Vset = Vset - CV3->_Vstep;
|
||||
}
|
||||
|
||||
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 != 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 (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;
|
||||
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(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
|
||||
}
|
||||
}
|
||||
// int32_t RealV;
|
||||
// RealV = (int32_t)(Vset / 500);//[1uV]
|
||||
|
||||
+5
-3
@@ -177,9 +177,9 @@ static void CV_Vscan(CVMode *CV){
|
||||
}
|
||||
|
||||
if (CV->_current_direction_up){
|
||||
Vset = Vset + CV->_Vstep;
|
||||
Vset = Vset + CV->_Vstep * GPT.GptimerMultiple;
|
||||
}else{
|
||||
Vset = Vset - CV->_Vstep;
|
||||
Vset = Vset - CV->_Vstep * GPT.GptimerMultiple;
|
||||
}
|
||||
|
||||
if(VmaxCounter != 0 && VminCounter != 0){
|
||||
@@ -209,7 +209,9 @@ static void CV_Vscan(CVMode *CV){
|
||||
|
||||
/*stop condition*/
|
||||
if(CV->_cycleNumber == 0){
|
||||
reset();
|
||||
PeriodicEvent = false;
|
||||
ELITE15_SPI_CLOSE();
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ static uint16_t CVSCANCurve(CVSCANMode *CVSCAN){
|
||||
}
|
||||
|
||||
INSTRUCTION.VoltConstant = Vout / 40000 + 25000;//5nV=>usercode
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant);
|
||||
|
||||
int32_t RealV2;
|
||||
RealV2 = (int32_t)((Vout - Vin) / 200);//[1uV]
|
||||
|
||||
+52
-1
@@ -51,10 +51,34 @@ static uint16_t DAC_outputV(uint16_t voltLV) {
|
||||
spi_DACtxbuf[1] = v1;
|
||||
spi_DACtxbuf[2] = v2;
|
||||
|
||||
DAC_SPI(SPI_DAC_SIZE, spi_DACtxbuf, spi_rxbuf);
|
||||
if(PeriodicEvent){
|
||||
DAC_SPI_TEST(SPI_DAC_SIZE, spi_DACtxbuf, spi_rxbuf);
|
||||
}else{
|
||||
DAC_SPI(SPI_DAC_SIZE, spi_DACtxbuf, spi_rxbuf);
|
||||
}
|
||||
|
||||
return voltLV;
|
||||
}
|
||||
|
||||
static void VoutGainControl(uint8_t VOUTLevel){
|
||||
if(VOUTLevel == 0){
|
||||
// VOUT gain level = 0, using 240K resister
|
||||
PIN15_setOutputValue(Turon_VOUT_SMALL, 0);
|
||||
}
|
||||
else if(VOUTLevel == 1){
|
||||
// VOUT gain level = 1, using 15K resister
|
||||
PIN15_setOutputValue(Turon_VOUT_SMALL, 1);
|
||||
}
|
||||
else if(VOUTLevel == 2){
|
||||
// VOUT gain level = 2, using 15K resister
|
||||
PIN15_setOutputValue(Turon_VOUT_SMALL, 1);
|
||||
}
|
||||
else{
|
||||
// default using 15K resister
|
||||
PIN15_setOutputValue(Turon_VOUT_SMALL, 1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int32_t User2Real(uint16_t UserCode){
|
||||
@@ -62,4 +86,31 @@ static int32_t User2Real(uint16_t UserCode){
|
||||
return (int32_t)((UserCode - 25000) / 5);
|
||||
}
|
||||
|
||||
|
||||
// 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)
|
||||
|
||||
static void AutoGainChangeVout(int32_t RealVolt){
|
||||
RealVolt = (RealVolt - 25000) * 200; // (RealVolt - 25000) / 5 * 1000
|
||||
// switch to 1 level volt(small) 15K
|
||||
// switch to 2 level volt(large) 240K
|
||||
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)
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_240K;
|
||||
VoutGainControl(INSTRUCTION.VoutGainLevel);
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.VoutGainLevel == VOUT_GAIN_240K){
|
||||
if(RealVolt < DAC_VOUT_GAIN_SMALL_BOUNDARY && RealVolt > -1 * DAC_VOUT_GAIN_SMALL_BOUNDARY ){
|
||||
// switch to 1 level volt(small)
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_15K;
|
||||
VoutGainControl(INSTRUCTION.VoutGainLevel);
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+76
-2385
File diff suppressed because it is too large
Load Diff
+1
@@ -21,6 +21,7 @@ struct _GPT{
|
||||
uint32_t LeadTimeCounter;
|
||||
uint32_t BatteryADCCounter;
|
||||
uint32_t BatteryCheckCounter;
|
||||
uint32_t GptimerMultiple;
|
||||
}GPT = {0};
|
||||
|
||||
static void InitCT(){
|
||||
|
||||
+8
-4
@@ -27,18 +27,22 @@ static void IV_Vscan(IVMode *IV){
|
||||
if(!vscanReset){
|
||||
if(IV->_current_direction_up){
|
||||
if(Vset >= IV->_Vmax){
|
||||
reset();
|
||||
PeriodicEvent = false;
|
||||
ELITE15_SPI_CLOSE();
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}else{
|
||||
if(Vset <= IV->_Vmin){
|
||||
reset();
|
||||
PeriodicEvent = false;
|
||||
ELITE15_SPI_CLOSE();
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}
|
||||
|
||||
if (IV->_current_direction_up){
|
||||
Vset = Vset + IV->_Vstep;
|
||||
Vset = Vset + IV->_Vstep * GPT.GptimerMultiple;
|
||||
}else{
|
||||
Vset = Vset - IV->_Vstep;
|
||||
Vset = Vset - IV->_Vstep * GPT.GptimerMultiple;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+33
-36
@@ -2,16 +2,32 @@
|
||||
#ifndef ELITEINSTRUCTION
|
||||
#define ELITEINSTRUCTION
|
||||
|
||||
/** ADC gain level **/
|
||||
#define GAIN_200K 0x00 // largest gain
|
||||
#define GAIN_10K 0x01
|
||||
#define GAIN_200R 0x02 // the least gain
|
||||
#define GAIN_AUTO 0x03
|
||||
/** Iin, Vin, Vout **/
|
||||
#define IIN_ADC 0x00
|
||||
#define VIN_ADC 0x01
|
||||
#define VOUT_DAC 0x02
|
||||
#define HIGH_Z 0x03
|
||||
|
||||
/** ADC Iin gain level **/
|
||||
#define I_GAIN_3M 0x00 // largest gain
|
||||
#define I_GAIN_100K 0x01
|
||||
#define I_GAIN_3K 0x02
|
||||
#define I_GAIN_100R 0x03 // the least gain
|
||||
#define I_GAIN_AUTO 0x04
|
||||
|
||||
/** ADC Vin gain level **/
|
||||
#define VIN_GAIN_1M 0x00
|
||||
#define VIN_GAIN_30K 0x01
|
||||
#define VIN_GAIN_1K 0x02
|
||||
#define VIN_GAIN_AUTO 0x03
|
||||
|
||||
/** Vout gain level **/
|
||||
#define VOUT_GAIN_240K 0x00
|
||||
#define VOUT_GAIN_15K 0x01
|
||||
#define VOUT_GAIN_AUTO 0x02
|
||||
|
||||
/* DAC reset parameter */
|
||||
#define DAC_ZERO 25000
|
||||
#define DAC_POS_MAX 0x0000
|
||||
#define DAC_NEG_MAX 0xFFFF
|
||||
|
||||
// Step time macro
|
||||
#define STEPTIME_HALF_SEC 5000
|
||||
@@ -44,7 +60,12 @@ struct HEADSTAGE_INSTRUCTION {
|
||||
uint32_t sampleRate;
|
||||
uint8_t VoViSwitch;
|
||||
uint8_t AutoGainEnable;
|
||||
uint8_t VinAutoGainEnable;
|
||||
uint8_t VoutAutoGainEnable;
|
||||
uint8_t ADCGainLevel;
|
||||
// voltage output gain
|
||||
uint16_t VoutGainLevel;
|
||||
uint8_t VinADCGainLevel;
|
||||
|
||||
/** Notify parameter **/
|
||||
uint32_t notifyRate;
|
||||
@@ -86,7 +107,11 @@ static void InitEliteInstruction(){
|
||||
INSTRUCTION.sampleRate = 100;
|
||||
INSTRUCTION.VoViSwitch = 0x01; //0:user see Vo 1: user see Vi
|
||||
INSTRUCTION.AutoGainEnable = 1;
|
||||
INSTRUCTION.ADCGainLevel = GAIN_AUTO;
|
||||
INSTRUCTION.VinAutoGainEnable = 1;
|
||||
INSTRUCTION.VoutAutoGainEnable = 1;
|
||||
INSTRUCTION.ADCGainLevel = I_GAIN_AUTO;
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_AUTO;
|
||||
INSTRUCTION.VinADCGainLevel = VIN_GAIN_AUTO;
|
||||
INSTRUCTION.notifyRate = STEPTIME_ONE_SEC;
|
||||
INSTRUCTION.cycleNumber = 1;
|
||||
INSTRUCTION.charge = 1; //0:discharge 1:charge
|
||||
@@ -94,32 +119,4 @@ static void InitEliteInstruction(){
|
||||
INSTRUCTION.Currentmax = 0;
|
||||
INSTRUCTION.StepTime = STEPTIME_ONE_SEC;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* @fn GetInstructionParameter
|
||||
*
|
||||
* @brief Get Constant Current mode parameter.
|
||||
*
|
||||
* @param ins - instruction including current value and unit
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
static void GetInstructionParameter(uint8 *ins){
|
||||
// CurrentLV=0 => unit is nA
|
||||
// CurrentLV=1 => unit is uA
|
||||
// CurrentLV=2 => unit is mA
|
||||
// INSTRUCTION.CurrentLV = (*ins);
|
||||
|
||||
// ConstantCurrentRange=0 => current value is 0~499
|
||||
// ConstantCurrentRange=1 => current value is 500~999
|
||||
// INSTRUCTION.ConstantCurrentRange = (*ins) & 0x0F;
|
||||
|
||||
// ConstantCurrent divide ConstantCurrentRange into 50000 count (thus each count is 0.01)
|
||||
// e.g. 485.7 uA can be represent by
|
||||
// CurrentLV = 1 (unit is uA)
|
||||
// ConstantCurrentRange = 0 (current range is 0~499)
|
||||
// ConstantCurrent = 48570
|
||||
INSTRUCTION.constantCurrent = (uint32_t) (*(ins+1))<<24 | (uint32_t) (*(ins+2))<<16 | (uint32_t) (*(ins+3))<<8 | (uint32_t) (*(ins+4));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+9
-10
@@ -12,12 +12,12 @@ static bool TurnOnElite(uint8_t key) {
|
||||
uint16_t bat = ((uint16_t)(NotifyVoltBat[2]) << 8 & 0xFF00 ) |
|
||||
((uint16_t)(NotifyVoltBat[3]) & 0x00FF);
|
||||
if( bat < 768 && bat > 20){
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 0);
|
||||
PIN15_setOutputValue(enable_5v, 0);
|
||||
return false;
|
||||
}else{
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 1); // enable 5V
|
||||
PIN15_setOutputValue(enable_5v, 1); // enable 5V
|
||||
TurnOn10V();
|
||||
LEDPowerON();
|
||||
ModeLED(BT_WAIT);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
@@ -26,7 +26,7 @@ static bool TurnOnElite(uint8_t key) {
|
||||
}
|
||||
} else {
|
||||
TurnOnCounter = 0;
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 0);
|
||||
PIN15_setOutputValue(enable_5v, 0); // disable 5V
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -40,20 +40,20 @@ static void EliteKeyPress(uint8_t key) {
|
||||
// press key => bight LED
|
||||
|
||||
if (ShutDownCounter == CLOCK_ONE_SECOND) {
|
||||
KeyWorkModeLED();
|
||||
KEYLED();
|
||||
}
|
||||
|
||||
// press 3~4 sec, shutdown 2650
|
||||
else if (ShutDownCounter > (CLOCK_ONE_SECOND*3) ) {
|
||||
LED_color(DARKLED, 0xFF, 0xFF, 0x00);
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 0); // disable 5V
|
||||
PIN15_setOutputValue(enable_5v, 0); // disable 5V
|
||||
}
|
||||
ShutDownCounter ++;
|
||||
} else {
|
||||
if (OriginEliteFxn == INSTRUCTION.eliteFxn) { // old function == currunt instruction
|
||||
if (ShutDownCounter != 0) {
|
||||
// dark LED
|
||||
WorkModeLED();
|
||||
checkFlafLED();
|
||||
ShutDownCounter = 0;
|
||||
}
|
||||
} else { // old function != currunt instruction
|
||||
@@ -61,15 +61,14 @@ static void EliteKeyPress(uint8_t key) {
|
||||
if (ShutDownCounter != 0) {
|
||||
ShutDownCounter = 0;
|
||||
}
|
||||
// dark mode LED
|
||||
WorkModeLED();
|
||||
checkFlafLED();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void TurnOn10V() {
|
||||
If10Von = true;
|
||||
PIN_setOutputValue(pin_handle, enable_10v, 1);
|
||||
PIN15_setOutputValue(enable_10v, 1);
|
||||
CPUdelay(8000);
|
||||
}
|
||||
|
||||
|
||||
+87
-126
@@ -5,6 +5,8 @@
|
||||
#define DARKLED 0xE1
|
||||
#define LIGHTLED 0xE8
|
||||
|
||||
static void WorkModeLED();
|
||||
|
||||
static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue) {
|
||||
spi_LEDtxbuf[0] = 0x0000;
|
||||
spi_LEDtxbuf[1] = 0x0000;
|
||||
@@ -16,27 +18,36 @@ 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;
|
||||
|
||||
LED_SPI(SPI_LED_SIZE, spi_LEDtxbuf, spi_LEDrxbuf);
|
||||
if(PeriodicEvent){
|
||||
LED_SPI_TEST(SPI_LED_SIZE, spi_LEDtxbuf, spi_LEDrxbuf);
|
||||
}else{
|
||||
LED_SPI(SPI_LED_SIZE, spi_LEDtxbuf, spi_LEDrxbuf);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void Elite_led_color(uint16_t color){
|
||||
switch (color) {
|
||||
case COLOR_RED: {
|
||||
LED_color(DARKLED, 0xFF, 0x00, 0x00);
|
||||
LED_color(DARKLED, 0x50, 0x00, 0x00);
|
||||
break;
|
||||
}
|
||||
case COLOR_ORANGE: {
|
||||
LED_color(DARKLED, 0xFF, 0x58, 0x09);
|
||||
LED_color(DARKLED, 0x50, 0x58, 0x09);
|
||||
break;
|
||||
}
|
||||
case COLOR_YELLOW: {
|
||||
LED_color(LIGHTLED, 0xFF, 0x80, 0x00);
|
||||
LED_color(LIGHTLED, 0x50, 0x80, 0x00);
|
||||
break;
|
||||
}
|
||||
case COLOR_GREEN: {
|
||||
LED_color(DARKLED, 0x00, 0xFA, 0x00);
|
||||
break;
|
||||
}
|
||||
case COLOR_YELLOWGREEN: {
|
||||
LED_color(DARKLED, 0x64, 0xA6, 0x00);
|
||||
break;
|
||||
}
|
||||
case COLOR_BLUE: {
|
||||
LED_color(DARKLED, 0x00, 0x00, 0xAA);
|
||||
break;
|
||||
@@ -46,104 +57,58 @@ static void Elite_led_color(uint16_t color){
|
||||
break;
|
||||
}
|
||||
case COLOR_MAGENTA: {
|
||||
LED_color(DARKLED, 0xFF, 0x00, 0x80);
|
||||
LED_color(DARKLED, 0x50, 0x00, 0x80);
|
||||
break;
|
||||
}
|
||||
case COLOR_PURPLE: {
|
||||
LED_color(DARKLED, 0xFF, 0x00, 0xFF);
|
||||
LED_color(DARKLED, 0x50, 0x00, 0xFF);
|
||||
break;
|
||||
}
|
||||
case COLOR_WHITE: {
|
||||
LED_color(DARKLED, 0xCA, 0xFF, 0xFF);
|
||||
LED_color(DARKLED, 0x50, 0xFF, 0xFF);
|
||||
break;
|
||||
}
|
||||
case COLOR_BLACK: {
|
||||
LED_color(0x00, 0x00, 0x00, 0x00);
|
||||
break;
|
||||
}
|
||||
//dark LED
|
||||
case COLOR_YELLOW_DARK: {
|
||||
LED_color(DARKLED, 0xFF, 0x80, 0x00);
|
||||
break;
|
||||
}
|
||||
case COLOR_GREEN_DARK: {
|
||||
LED_color(DARKLED, 0x00, 0x33, 0x00);
|
||||
break;
|
||||
}
|
||||
case COLOR_BLUE_DARK: {
|
||||
LED_color(DARKLED, 0x00, 0x00, 0x33);
|
||||
break;
|
||||
}
|
||||
case COLOR_CYAN_DARK: {
|
||||
LED_color(DARKLED, 0x00, 0x10, 0x10);
|
||||
break;
|
||||
}
|
||||
case COLOR_PURPLE_DARK: {
|
||||
LED_color(DARKLED, 0x55, 0x00, 0x55);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void WorkModeLED() {
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IV_CURVE: {
|
||||
WORKLED();
|
||||
static void ModeLED(uint16_t modeStatus) {
|
||||
btWaitLedFlag = 0;
|
||||
noEventLedFlag = 0;
|
||||
preWorkLedFlag = 0;
|
||||
workingLedFlag = 0;
|
||||
postWorkLedFlag = 0;
|
||||
|
||||
switch (modeStatus) {
|
||||
case BT_WAIT: {
|
||||
btWaitLedFlag = 1;
|
||||
BT_WAIT_LED();
|
||||
break;
|
||||
}
|
||||
case CV_CURVE: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case DIFFERENTIAL_PULSE_VOLTAMMETRY: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case SQUARE_WAVE_VOLTAMMETRY: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case VOLT_OUTPUT: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case VT_CURVE: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case IT_CURVE: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
Elite_led_color(COLOR_BLUE_DARK);
|
||||
break;
|
||||
}
|
||||
case VIS_RST: {
|
||||
case NO_EVENT: {
|
||||
noEventLedFlag = 1;
|
||||
LEDPowerON();
|
||||
break;
|
||||
}
|
||||
case ADC_TEST: {
|
||||
WORKLED();
|
||||
case PRE_WORK: {
|
||||
preWorkLedFlag = 1;
|
||||
Elite_led_color(COLOR_BLUE);
|
||||
break;
|
||||
}
|
||||
case CYCLIC_VOLTAMMETRY: {
|
||||
WORKLED();
|
||||
case WORKING: {
|
||||
workingLedFlag = 1;
|
||||
WorkModeLED();
|
||||
break;
|
||||
}
|
||||
case LINEAR_SWEEP_VOLTAMMETRY: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case CONSTANT_VSCAN: {
|
||||
WORKLED();
|
||||
case POST_WORK: {
|
||||
postWorkLedFlag = 1;
|
||||
Elite_led_color(COLOR_BLUE);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -153,58 +118,54 @@ static void WorkModeLED() {
|
||||
}
|
||||
}
|
||||
|
||||
static void KeyWorkModeLED() {
|
||||
KEYLED();
|
||||
/*
|
||||
switch(INSTRUCTION.eliteFxn){
|
||||
case IV_CURVE:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case DIFFERENTIAL_PULSE_VOLTAMMETRY:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case SQUARE_WAVE_VOLTAMMETRY:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case VOLT_OUTPUT:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case VT_CURVE:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case IT_CURVE:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
|
||||
case VIS_RST:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case ADC_TEST:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
|
||||
default:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
static void checkFlafLED() {
|
||||
if(btWaitLedFlag == 1){
|
||||
ModeLED(BT_WAIT);
|
||||
}
|
||||
else if(noEventLedFlag == 1){
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
else if(preWorkLedFlag == 1){
|
||||
ModeLED(PRE_WORK);
|
||||
}
|
||||
else if(workingLedFlag == 1){
|
||||
ModeLED(WORKING);
|
||||
}
|
||||
else if(postWorkLedFlag == 1){
|
||||
ModeLED(POST_WORK);
|
||||
}
|
||||
}
|
||||
|
||||
static void WorkModeLED() {
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IV_CURVE:
|
||||
case CV_CURVE:
|
||||
case DIFFERENTIAL_PULSE_VOLTAMMETRY:
|
||||
case SQUARE_WAVE_VOLTAMMETRY:
|
||||
case VOLT_OUTPUT:
|
||||
case ZT_CURVE:
|
||||
case VT_CURVE:
|
||||
case IT_CURVE:
|
||||
case ADC_TEST:
|
||||
case CYCLIC_VOLTAMMETRY:
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:
|
||||
case CONSTANT_VSCAN:{
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
// case VIS_RST: {
|
||||
// LEDPowerON();
|
||||
// break;
|
||||
// }
|
||||
default: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+5
-3
@@ -19,7 +19,7 @@ static uint16_t LSVCurve(LSVMode *LSV){
|
||||
}
|
||||
|
||||
INSTRUCTION.VoltConstant = Vout / 40000 + 25000;//5nV=>usercode
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant);
|
||||
|
||||
int32_t RealV2;
|
||||
RealV2 = (int32_t)((Vout - Vin) / 200);//[1uV]
|
||||
@@ -60,13 +60,14 @@ static void LSV_Vscan(LSVMode *LSV){
|
||||
if(!vscanReset){
|
||||
|
||||
if (LSV->_current_direction_up){
|
||||
Vset = Vset + LSV->_Vstep;
|
||||
Vset = Vset + LSV->_Vstep * GPT.GptimerMultiple;
|
||||
}else{
|
||||
Vset = Vset - LSV->_Vstep;
|
||||
Vset = Vset - LSV->_Vstep * GPT.GptimerMultiple;
|
||||
}
|
||||
|
||||
/*stop condition*/
|
||||
if (Vset >= LSV->_Vmax){
|
||||
ModeLED(POST_WORK);
|
||||
// PeriodicEvent = false;
|
||||
Vset = LSV->_Vmin;
|
||||
InitEliteFlag();
|
||||
@@ -79,6 +80,7 @@ static void LSV_Vscan(LSVMode *LSV){
|
||||
INSTRUCTION.notifyRate = 500;
|
||||
INSTRUCTION.VoViSwitch = 0x02;//read Vscan = Vout - Vin
|
||||
}else if (Vset <= LSV->_Vmin){
|
||||
ModeLED(POST_WORK);
|
||||
// PeriodicEvent = false;
|
||||
Vset = LSV->_Vmax;
|
||||
InitEliteFlag();
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
|
||||
#ifndef ELITE_LATCH_INIT
|
||||
#define ELITE_LATCH_INIT
|
||||
|
||||
static void InitLH() {
|
||||
for (int i=0; i<LATCH_BUFF_SIZE; i++) {
|
||||
LH.LATCH0[i] = 0;
|
||||
LH.LATCH1[i] = 0;
|
||||
LH.LATCH2[i] = 0;
|
||||
}
|
||||
LH.LoadState = 0;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
|
||||
#ifndef ELITE_MACRO_MODE
|
||||
#define ELITE_MACRO_MODE
|
||||
|
||||
static void define_mode_macro(){
|
||||
#ifndef CURRENT_MODE
|
||||
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;
|
||||
}
|
||||
default: {
|
||||
#define CURRENT_MODE NULL
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#error "CURRENT_MODE has already been defined"
|
||||
#endif
|
||||
}
|
||||
|
||||
static void undefine_mode_macro(){
|
||||
#ifndef CURRENT_MODE
|
||||
#error "CURRENT_MODE has NOT been defined"
|
||||
#else
|
||||
#undef CURRENT_MODE
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
+10
-18
@@ -10,11 +10,10 @@
|
||||
#include "headstage.h"
|
||||
|
||||
/*notify's input type*/
|
||||
#define NOTIFY_CURRENT 0
|
||||
#define NOTIFY_VOLT 1
|
||||
#define NOTIFY_IMPEDANCE 2
|
||||
#define NOTIFY_VOLT_BAT 3
|
||||
#define NOTIFY_TEMPERATURE 4
|
||||
#define NOTIFY_CURRENT 0
|
||||
#define NOTIFY_VOLT 1
|
||||
#define NOTIFY_IMPEDANCE 2
|
||||
#define NOTIFY_VOLT_BAT 3
|
||||
|
||||
#define NOT_BUF_OFFSET_INIT 8
|
||||
|
||||
@@ -25,11 +24,10 @@
|
||||
static size_t not_buf_offset = NOT_BUF_OFFSET_INIT;
|
||||
static uint32_t not_time_stamp;
|
||||
|
||||
static uint8_t NotifyCurrent[4] = {0};
|
||||
static uint8_t NotifyVolt[4] = {0};
|
||||
static uint8_t NotifyImpedance[4] = {0};
|
||||
static uint8_t NotifyVoltBat[4] = {0};
|
||||
static uint8_t NotifyTemperature[4] = {0};
|
||||
static uint8_t NotifyCurrent[4] = {0};
|
||||
static uint8_t NotifyVolt[4] = {0};
|
||||
static uint8_t NotifyImpedance[4] = {0};
|
||||
static uint8_t NotifyVoltBat[4] = {0};
|
||||
static uint16_t NotifyCycleNumber = 0;
|
||||
|
||||
// ****************** New Notify Format ******************************** //
|
||||
@@ -119,13 +117,13 @@ static void SendNotify() {
|
||||
|
||||
static void initDATBuf(){
|
||||
for (int i = 0; i < BLE_DAT_BUFF_SIZE; i++){
|
||||
not_buf[i] = 0;
|
||||
not_buf[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void initINSBuf(){
|
||||
for (int i = 0; i < BLE_INS_BUFF_SIZE; i++){
|
||||
ins_buf[i] = 0;
|
||||
ins_buf[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,12 +183,6 @@ static void InputNotify(int NotifyType, int32_t Data){
|
||||
NotifyVoltBat[2] = (uint8_t)((Data & 0x0000FF00) >> 8);
|
||||
NotifyVoltBat[3] = (uint8_t)(Data & 0x000000FF);
|
||||
break;
|
||||
case NOTIFY_TEMPERATURE :
|
||||
NotifyTemperature[0] = (uint8_t)((Data & 0xFF000000) >> 24);
|
||||
NotifyTemperature[1] = (uint8_t)((Data & 0x00FF0000) >> 16);
|
||||
NotifyTemperature[2] = (uint8_t)((Data & 0x0000FF00) >> 8);
|
||||
NotifyTemperature[3] = (uint8_t)(Data & 0x000000FF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+20
-11
@@ -3,14 +3,18 @@
|
||||
#define ELITERESET
|
||||
|
||||
static void reset() {
|
||||
ModeLED(NO_EVENT);
|
||||
InitEliteFlag();
|
||||
InitFlag();
|
||||
InitCT();
|
||||
InitGPT();
|
||||
InitLH();
|
||||
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
LEDPowerON();
|
||||
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
|
||||
initINSBuf();
|
||||
initDATBuf();
|
||||
|
||||
@@ -29,20 +33,25 @@ static void reset() {
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
PIN15_setOutputValue(ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN15_setOutputValue(DAC_CS, 1); // DAC_CS HIGH
|
||||
CPUdelay(1600);
|
||||
}
|
||||
|
||||
static void Eliteinterrupt() {
|
||||
InitEliteFlag();
|
||||
InitFlag();
|
||||
ModeLED(NO_EVENT);
|
||||
|
||||
InitEliteFlag();
|
||||
InitCT();
|
||||
InitGPT();
|
||||
InitLH();
|
||||
|
||||
ADCGainControl(GAIN_AUTO);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
LEDPowerON();
|
||||
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
|
||||
initINSBuf();
|
||||
initDATBuf();
|
||||
|
||||
@@ -61,8 +70,8 @@ static void Eliteinterrupt() {
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
PIN15_setOutputValue(ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN15_setOutputValue(DAC_CS, 1); // DAC_CS HIGH
|
||||
CPUdelay(8000);
|
||||
}
|
||||
#endif
|
||||
|
||||
+77
-12
@@ -36,6 +36,8 @@ static SPI_Params spiParams1;
|
||||
static SPI_Transaction LED_transaction;
|
||||
static SPI_Transaction ADC_DAC_transaction;
|
||||
|
||||
static void ELITE15_SPI_HOLD();
|
||||
static void ELITE15_SPI_CLOSE();
|
||||
|
||||
static void Elite_SPI_init(){
|
||||
SPI_init();
|
||||
@@ -55,6 +57,46 @@ 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
|
||||
|
||||
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
|
||||
ELITE15_SPI_CLOSE();
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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;
|
||||
@@ -62,27 +104,50 @@ static void LED_SPI(uint8_t length, uint16_t *spi_txbuf, uint16_t *spi_rxbuf) {
|
||||
SPI_transfer(spiHandle0, &LED_transaction);
|
||||
}
|
||||
|
||||
static void ADC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
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;
|
||||
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 0); // ADC_CS LOW
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
|
||||
PIN_setOutputValue(pin_handle, D6, 1); // CS_ADC
|
||||
}
|
||||
|
||||
static void DAC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
ADC_DAC_transaction.count = length;
|
||||
ADC_DAC_transaction.txBuf = spi_txbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
static void DAC_SPI_TEST(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
PIN_setOutputValue(pin_handle, D7, 0); // CD_DAC
|
||||
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 0); // DAC_CS LOW
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
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
|
||||
}
|
||||
|
||||
static void ELITE15_SPI_HOLD() {
|
||||
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);
|
||||
}
|
||||
|
||||
#endif // ELITE_SPI
|
||||
|
||||
+76
-24
@@ -8,50 +8,102 @@
|
||||
|
||||
/* SPI Board */
|
||||
#define Board_SPI0_MISO PIN_UNASSIGNED
|
||||
#define Board_SPI0_MOSI IOID_1
|
||||
#define Board_SPI0_CLK IOID_0
|
||||
#define Board_SPI0_MOSI D1
|
||||
#define Board_SPI0_CLK D0
|
||||
#define Board_SPI0_CS PIN_UNASSIGNED
|
||||
|
||||
#define Board_SPI1_MISO IOID_3
|
||||
#define Board_SPI1_MOSI IOID_2
|
||||
#define Board_SPI1_CLK IOID_4
|
||||
#define Board_SPI1_MISO IOID_1
|
||||
#define Board_SPI1_MOSI D3
|
||||
#define Board_SPI1_CLK D2
|
||||
#define Board_SPI1_CS PIN_UNASSIGNED
|
||||
|
||||
#define ADC_CS IOID_8
|
||||
#define DAC_CS IOID_9
|
||||
#define D0 IOID_3
|
||||
#define D1 IOID_4
|
||||
#define D2 IOID_5
|
||||
#define D3 IOID_6
|
||||
#define D4 IOID_7
|
||||
#define D5 IOID_8
|
||||
#define D6 IOID_9
|
||||
#define D7 IOID_10
|
||||
|
||||
#define Turnon200R IOID_5
|
||||
#define Turnon10K IOID_6
|
||||
#define LOAD0 IOID_13
|
||||
#define LOAD1 IOID_12
|
||||
#define LOAD2 IOID_11
|
||||
|
||||
#define ADC_CS LOAD0, D6
|
||||
#define DAC_CS LOAD0, D7
|
||||
#define ADC_DAC_SPI_MOSI LOAD0, D3
|
||||
#define ADC_DAC_SPI_CLK LOAD0, D2
|
||||
#define LED_MOSI LOAD0, D1
|
||||
#define LED_CLK LOAD0, D0
|
||||
#define MEM_HOLD LOAD0, D4
|
||||
#define MEM_CS LOAD0, D5
|
||||
|
||||
#define Turnon_I_MID LOAD2, D0
|
||||
#define Turnon_I_SMALL LOAD2, D4
|
||||
#define Turnon_I_LARGE LOAD2, D1
|
||||
#define Turnon_V_SMALL LOAD2, D2
|
||||
#define Turnon_V_MID LOAD2, D3
|
||||
#define Turon_VOUT_SMALL LOAD2, D7
|
||||
|
||||
//#define Turnon10K Turnon_I_MID
|
||||
//#define Turnon200R Turnon_I_LARGE
|
||||
|
||||
/* I2C */
|
||||
#ifdef ELITE_VERSION_1_4
|
||||
#define Board_I2C0_SCL0 IOID_7
|
||||
#define Board_I2C0_SDA0 IOID_1
|
||||
#define Board_I2C0_SCL0 PIN_UNASSIGNED
|
||||
#define Board_I2C0_SDA0 PIN_UNASSIGNED
|
||||
#endif
|
||||
|
||||
#define shutdown_6994 IOID_10
|
||||
#define switch_on IOID_11
|
||||
#define enable_10v IOID_12
|
||||
#define enable_5v IOID_13
|
||||
#define shutdown_6994 LOAD2, D6
|
||||
#define switch_on IOID_14
|
||||
#define HIGH_Z_MODE LOAD2, D5
|
||||
#define enable_10v LOAD1, D5
|
||||
#define enable_5v LOAD1, D6
|
||||
|
||||
PIN_Handle pin_handle;
|
||||
static PIN_State ZM_rst;
|
||||
|
||||
const PIN_Config BLE_IO[] = {
|
||||
//
|
||||
ADC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, // ADC_CS
|
||||
DAC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, // DAC_CS
|
||||
// D0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
// D1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
// D2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
// D3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
D4 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
D5 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
D6 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
D7 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
|
||||
enable_10v | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, // 10V_enable
|
||||
enable_5v | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, // 5V_enable
|
||||
shutdown_6994 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, // turn off power
|
||||
Turnon200R | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
|
||||
Turnon10K | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
|
||||
switch_on | PIN_INPUT_EN | PIN_PULLDOWN,
|
||||
LOAD0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
LOAD1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
LOAD2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
|
||||
switch_on | PIN_INPUT_EN | PIN_PULLDOWN, // to sense switch
|
||||
|
||||
PIN_TERMINATE
|
||||
};
|
||||
|
||||
static void add_elite_pin() {
|
||||
// PIN_Status elite15_status;
|
||||
PIN_add(pin_handle,
|
||||
D0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL);
|
||||
PIN_add(pin_handle,
|
||||
D1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL);
|
||||
PIN_add(pin_handle,
|
||||
D2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL);
|
||||
PIN_add(pin_handle,
|
||||
D3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL);
|
||||
|
||||
// if(elite15_status != PIN_SUCCESS) {
|
||||
// LED_color(DARKLED, 0x0F, 0x0F, 0x0F);
|
||||
// }
|
||||
}
|
||||
|
||||
static void remove_elite_pin() {
|
||||
PIN_close(pin_handle);
|
||||
pin_handle = PIN_open(&ZM_rst, BLE_IO);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @def BOOSTXL_CC2650MA_SPIName
|
||||
* @brief Enum of SPI names on the CC2650 Booster Pack
|
||||
|
||||
+42
-21
@@ -2,7 +2,7 @@
|
||||
***********************************************************
|
||||
Read battery's method
|
||||
***********************************************************
|
||||
1.ReadBatVolt(spi_ADC_rxbuf)
|
||||
1.ReadADCBat(spi_ADC_rxbuf)
|
||||
let "spi_ADC_rxbuf" be 8000
|
||||
8000 * 187.5uV * 2 = 3000000uV = 3V ;
|
||||
2.AONBatMonBatteryVoltageGet()
|
||||
@@ -34,7 +34,7 @@ static uint8_t headstage_battery_percent() {
|
||||
static void headstage_battery_volt(){
|
||||
uint32_t bat_volt = 0;
|
||||
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
ReadADCBat(spi_ADC_rxbuf);
|
||||
bat_volt = (uint32_t) (spi_ADC_rxbuf[0] << 8) | (uint32_t) (spi_ADC_rxbuf[1]);
|
||||
bat_volt = bat_volt * 12 / 125; //x * 187.5 * 1e-6 * 2 / 125 * 320 * 100 ;
|
||||
InputNotify(NOTIFY_VOLT_BAT, bat_volt);
|
||||
@@ -42,30 +42,51 @@ static void headstage_battery_volt(){
|
||||
|
||||
static void EliteADCBattery(){
|
||||
static uint8_t ADCSwitch = 0;
|
||||
|
||||
if(ADCSwitch == 0){ /**read V**/
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 1){ /**read V**/
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 2){ /**read V(buffer)**/
|
||||
headstage_battery_volt();
|
||||
batteryCheck_flag = false;
|
||||
if(INSTRUCTION.eliteFxn == ADC_TEST){
|
||||
ADCSwitch = 0;
|
||||
}else{
|
||||
if(ADCSwitch == 0){ /**read V**/
|
||||
ReadADCBat(spi_ADC_rxbuf);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 1){ /**read V**/
|
||||
ReadADCBat(spi_ADC_rxbuf);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 2){ /**read V(buffer)**/
|
||||
headstage_battery_volt();
|
||||
batteryCheck_flag = false;
|
||||
ADCSwitch = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t headstage_temperature() {
|
||||
int32_t curTemp;
|
||||
curTemp = AONBatMonTemperatureGetDegC();
|
||||
InputNotify(NOTIFY_TEMPERATURE,curTemp);
|
||||
if(INSTRUCTION.eliteFxn == IT_CURVE){
|
||||
InputNotify(NOTIFY_IMPEDANCE,curTemp);
|
||||
static void measureBat(){
|
||||
GPT.DeltaGptimerCounter = GPT.GptimerCounter - GPT.GptimerCounter0;
|
||||
GPT.GptimerCounter0 = GPT.GptimerCounter;
|
||||
|
||||
GPT.BatteryADCCounter = GPT.BatteryADCCounter + GPT.DeltaGptimerCounter;
|
||||
GPT.BatteryCheckCounter = GPT.BatteryCheckCounter + GPT.DeltaGptimerCounter;
|
||||
|
||||
if(GPT.BatteryCheckCounter >= 50000){//5min=3000000, 5s=50000
|
||||
GPT.BatteryCheckCounter = 0;
|
||||
batteryCheck_flag = true;
|
||||
}
|
||||
|
||||
if(GPT.BatteryADCCounter >= 15 && batteryCheck_flag){
|
||||
GPT.BatteryADCCounter = 0; //To get the data right, ADC must be delay 1.5ms
|
||||
batteryADC_flag = true;
|
||||
if(batteryADC_flag){
|
||||
EliteADCBattery();
|
||||
batteryADC_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t bat = ((uint16_t)(NotifyVoltBat[2]) << 8 & 0xFF00 ) |
|
||||
((uint16_t)(NotifyVoltBat[3]) & 0x00FF);
|
||||
if( bat < 768 && bat > 20){
|
||||
PIN15_setOutputValue(enable_5v, 0);
|
||||
}
|
||||
return curTemp;
|
||||
}
|
||||
|
||||
#endif // HEADSTAGE_BATT_H
|
||||
|
||||
+24
-21
@@ -27,7 +27,7 @@
|
||||
#define VT_CURVE 0x50
|
||||
#define IT_CURVE 0x60
|
||||
#define SET_SAMPLE_RATE 0x70
|
||||
#define SET_ADC_GAIN 0x80
|
||||
#define SET_ADC_DAC_GAIN 0x80
|
||||
#define DIFFERENTIAL_PULSE_VOLTAMMETRY 0xA0
|
||||
#define SQUARE_WAVE_VOLTAMMETRY 0xB0
|
||||
#define CYCLIC_VOLTAMMETRY 0xC0
|
||||
@@ -42,7 +42,6 @@
|
||||
#define CIS_VERSION 0x40
|
||||
#define CIS_VOLT 0x10
|
||||
#define CIS_LED_TEST 0x70
|
||||
#define CIS_TEMPERATURE 0x80
|
||||
|
||||
// mode parameter
|
||||
#define STEP_TO_VSETRATE(step) step2VsetRate(step)
|
||||
@@ -51,29 +50,33 @@
|
||||
#define VDIRECTION(v1,v2) ((v1 > v2) ? 0 : 1)
|
||||
#define AFTER_READ_I 0
|
||||
#define AFTER_READ_V 1
|
||||
#define ReadADCVolt(x) ((x==0)? ReadVoutVolt(spi_ADC_rxbuf) : ReadVolt(spi_ADC_rxbuf))
|
||||
#define ReadADCVolt(x) ((x==0)? ReadADCVout(spi_ADC_rxbuf) : ReadADCVin(spi_ADC_rxbuf))
|
||||
#define PARA_1 0x01
|
||||
#define PARA_2 0x02
|
||||
|
||||
//Elite LED
|
||||
#define COLOR_BLACK 0
|
||||
#define COLOR_RED 1
|
||||
#define COLOR_ORANGE 2
|
||||
#define COLOR_YELLOW 3
|
||||
#define COLOR_GREEN 4
|
||||
#define COLOR_BLUE 5
|
||||
#define COLOR_CYAN 6
|
||||
#define COLOR_MAGENTA 7
|
||||
#define COLOR_PURPLE 8
|
||||
#define COLOR_WHITE 9
|
||||
#define COLOR_YELLOW_DARK 0x0A
|
||||
#define COLOR_GREEN_DARK 0x0B
|
||||
#define COLOR_BLUE_DARK 0x0C
|
||||
#define COLOR_CYAN_DARK 0x0D
|
||||
#define COLOR_PURPLE_DARK 0x0E
|
||||
#define LEDPowerON() Elite_led_color(COLOR_GREEN_DARK)
|
||||
#define WORKLED() Elite_led_color(COLOR_CYAN_DARK)
|
||||
#define KEYLED() Elite_led_color(COLOR_YELLOW_DARK)
|
||||
#define COLOR_BLACK 0x00
|
||||
#define COLOR_RED 0x01
|
||||
#define COLOR_ORANGE 0x02
|
||||
#define COLOR_YELLOW 0x03
|
||||
#define COLOR_GREEN 0x04
|
||||
#define COLOR_BLUE 0x05
|
||||
#define COLOR_CYAN 0x06
|
||||
#define COLOR_MAGENTA 0x07
|
||||
#define COLOR_PURPLE 0x08
|
||||
#define COLOR_WHITE 0x09
|
||||
#define COLOR_YELLOWGREEN 0x0A
|
||||
#define LEDPowerON() Elite_led_color(COLOR_GREEN)
|
||||
#define WORKLED() Elite_led_color(COLOR_CYAN)
|
||||
#define KEYLED() Elite_led_color(COLOR_YELLOW)
|
||||
#define BT_WAIT_LED() Elite_led_color(COLOR_YELLOWGREEN)
|
||||
|
||||
|
||||
#define BT_WAIT 0x01
|
||||
#define NO_EVENT 0x02
|
||||
#define PRE_WORK 0x03
|
||||
#define WORKING 0x04
|
||||
#define POST_WORK 0x05
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
|
||||
#ifndef ELITE_EVENT_H
|
||||
#define ELITE_EVENT_H
|
||||
|
||||
/** event */
|
||||
#define EVT_KEY_DETECT 0x0001
|
||||
#define EVT_LED_CHANGE 0x0002
|
||||
#define EVT_CREATE_MODE 0x0004
|
||||
#define EVT_FREE_MODE 0x0008
|
||||
#define EVT_MODE_ACTIVE 0x0010
|
||||
#define EVT_RESERVED0 0x0020
|
||||
#define EVT_RESERVED1 0x0040
|
||||
|
||||
static uint16_t elite_event = 0x0000;
|
||||
|
||||
/**
|
||||
* test event [flag] has been enabled.
|
||||
*/
|
||||
#define flag_mask(flag) ((elite_event & (flag)) != 0)
|
||||
|
||||
/**
|
||||
* enable event [flag].
|
||||
*/
|
||||
#define flag_enable(flag) \
|
||||
do { \
|
||||
uint8 __key = Hwi_disable(); \
|
||||
elite_event |= (uint16_t)(flag); \
|
||||
Hwi_restore(__key); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* disable event [flag].
|
||||
*/
|
||||
#define flag_disable(flag) \
|
||||
do { \
|
||||
uint8 __key = Hwi_disable(); \
|
||||
elite_event &= ~((uint16_t)(flag)); \
|
||||
Hwi_restore(__key); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* fire a event with [flag].
|
||||
*/
|
||||
#define flag_notify(flag) \
|
||||
do { \
|
||||
uint8 __key = Hwi_disable(); \
|
||||
elite_event |= (uint16_t)(flag); \
|
||||
Hwi_restore(__key); \
|
||||
Semaphore_post(semaphore); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
|
||||
#ifndef ELITE_EVENT_HANDLE_H
|
||||
#define ELITE_EVENT_HANDLE_H
|
||||
|
||||
#include "Elite_event.h"
|
||||
#include "EliteKeyDetect.h"
|
||||
|
||||
static void elite_event_handle(WorkMode *WorkModeData){
|
||||
if (flag_mask(EVT_KEY_DETECT)) {
|
||||
flag_disable(EVT_KEY_DETECT);
|
||||
uint8_t key = PIN_getInputValue(switch_on);
|
||||
// elite_key_handle(key);
|
||||
}
|
||||
|
||||
if (flag_mask(EVT_LED_CHANGE)) {
|
||||
flag_disable(EVT_LED_CHANGE);
|
||||
// elite_led_handle();
|
||||
}
|
||||
|
||||
if(flag_mask(EVT_CREATE_MODE)){
|
||||
flag_disable(EVT_CREATE_MODE);
|
||||
InitWorkMode(WorkModeData);
|
||||
}
|
||||
|
||||
if(flag_mask(EVT_FREE_MODE)){
|
||||
flag_disable(EVT_FREE_MODE);
|
||||
FreeWorkMode(WorkModeData);
|
||||
InitEliteInstruction();
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
}
|
||||
|
||||
if (flag_mask(EVT_MODE_ACTIVE)) {
|
||||
flag_disable(EVT_MODE_ACTIVE);
|
||||
SimpleBLEPeripheral_performPeriodicTask(WorkModeData);
|
||||
}
|
||||
|
||||
if (flag_mask(EVT_UPDATE_WORK_MODE)) {
|
||||
flag_disable(EVT_UPDATE_WORK_MODE);
|
||||
update_work_mode_handle(WorkModeData);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
+70
-33
@@ -20,7 +20,7 @@ static uint16_t OneWayVoltScan() {
|
||||
}
|
||||
|
||||
INSTRUCTION.VoltConstant = Vout / 40000 + 25000; //5nV=>usercode
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant);
|
||||
DAC_outputV(DACOutCode);
|
||||
|
||||
if ((INSTRUCTION.eliteFxn == IV_CURVE)||(INSTRUCTION.eliteFxn == CV_CURVE)||(INSTRUCTION.eliteFxn == CONSTANT_CURRENT)){
|
||||
@@ -105,41 +105,52 @@ static void DACenable(WorkMode *WorkModeData, int32_t VoltData ,uint8_t afterRea
|
||||
}
|
||||
|
||||
static void CC_Plot(WorkMode *WorkModeData){
|
||||
|
||||
void *active_mode;
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IT
|
||||
active_mode = WorkModeData->IT;
|
||||
break;
|
||||
}
|
||||
case VT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->VT
|
||||
active_mode = WorkModeData->VT;
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->RT
|
||||
active_mode = WorkModeData->RT;
|
||||
break;
|
||||
}
|
||||
case IV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IV
|
||||
active_mode = WorkModeData->IV;
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->CV
|
||||
active_mode = WorkModeData->CV;
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
#define CURRENT_MODE WorkModeData->CC
|
||||
active_mode = WorkModeData->CC;
|
||||
break;
|
||||
}
|
||||
case CYCLIC_VOLTAMMETRY:{
|
||||
#define CURRENT_MODE WorkModeData->CV3
|
||||
active_mode = WorkModeData->CV3;
|
||||
break;
|
||||
}
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:{
|
||||
#define CURRENT_MODE WorkModeData->LSV
|
||||
active_mode = WorkModeData->LSV;
|
||||
break;
|
||||
}
|
||||
case CONSTANT_VSCAN:{
|
||||
#define CURRENT_MODE WorkModeData->CVSCAN
|
||||
active_mode = NULL;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -147,6 +158,8 @@ static void CC_Plot(WorkMode *WorkModeData){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static uint8_t ADCSwitch = 0;
|
||||
static uint8_t BatSwitch = 0;
|
||||
static int32_t VoltData = 0;
|
||||
@@ -156,21 +169,21 @@ static void CC_Plot(WorkMode *WorkModeData){
|
||||
if(ADCSwitch == 0){ /**read Iin(buffer),read bat**/
|
||||
readIin(WorkModeData);
|
||||
if(record_flag == false){
|
||||
static int count = 0;
|
||||
count++;
|
||||
if(count == 2){
|
||||
static int recordCount = 0;
|
||||
recordCount++;
|
||||
if(recordCount == 2){
|
||||
record_flag = true;
|
||||
count = 0;
|
||||
recordCount = 0;
|
||||
}
|
||||
}else{
|
||||
InputNotify(NOTIFY_CURRENT, CURRENT_MODE->_measureCurrent);
|
||||
InputNotify(NOTIFY_CURRENT, ()active_mode->_measureCurrent);
|
||||
}
|
||||
DACenable(WorkModeData, VoltData, AFTER_READ_I);
|
||||
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
ReadADCBat(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(ADCSwitch == 1 || ADCSwitch == 3){ /**read Bat**/
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
ReadADCBat(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(ADCSwitch == 2){ /**read V(buffer),read bat**/
|
||||
VoltData = readVinVout(WorkModeData);
|
||||
@@ -183,15 +196,15 @@ static void CC_Plot(WorkMode *WorkModeData){
|
||||
}
|
||||
DACenable(WorkModeData, VoltData, AFTER_READ_V);
|
||||
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
ReadADCBat(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}
|
||||
}else if(BatSwitch == 1){
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
ReadADCBat(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 2){
|
||||
headstage_battery_volt();
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
batteryCheck_flag = false;
|
||||
BatSwitch = 0;
|
||||
ADCSwitch = 3;
|
||||
@@ -201,11 +214,11 @@ static void CC_Plot(WorkMode *WorkModeData){
|
||||
if(ADCSwitch == 0){ /**read Iin(buffer),read V**/
|
||||
readIin(WorkModeData);
|
||||
if(record_flag == false){
|
||||
static int count = 0;
|
||||
count++;
|
||||
if(count == 2){
|
||||
static int recordCount = 0;
|
||||
recordCount++;
|
||||
if(recordCount == 2){
|
||||
record_flag = true;
|
||||
count = 0;
|
||||
recordCount = 0;
|
||||
}
|
||||
}else{
|
||||
InputNotify(NOTIFY_CURRENT, CURRENT_MODE->_measureCurrent);
|
||||
@@ -230,11 +243,11 @@ static void CC_Plot(WorkMode *WorkModeData){
|
||||
}
|
||||
DACenable(WorkModeData, VoltData, AFTER_READ_V);
|
||||
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 3){ /**read Iin**/
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
ADCSwitch = 0;
|
||||
}
|
||||
}
|
||||
@@ -289,18 +302,18 @@ static void IT_Plot(WorkMode *WorkModeData) {
|
||||
if(batteryCheck_flag){
|
||||
EliteADCBattery();
|
||||
if(!batteryCheck_flag){
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
ADCSwitch = 2;
|
||||
}
|
||||
}else{
|
||||
if(ADCSwitch == 0){ /**read Iin(buffer)**/
|
||||
readIin(WorkModeData);
|
||||
if(record_flag == false){
|
||||
static int count = 0;
|
||||
count++;
|
||||
if(count == 2){
|
||||
static int recordCount = 0;
|
||||
recordCount++;
|
||||
if(recordCount == 2){
|
||||
record_flag = true;
|
||||
count = 0;
|
||||
recordCount = 0;
|
||||
}
|
||||
}else{
|
||||
InputNotify(NOTIFY_CURRENT, CURRENT_MODE->_measureCurrent);
|
||||
@@ -308,11 +321,11 @@ static void IT_Plot(WorkMode *WorkModeData) {
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 1){ /**read Iin**/
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 2){ /**read Iin**/
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
ADCSwitch = 0;
|
||||
}
|
||||
}
|
||||
@@ -363,8 +376,8 @@ static void VT_Plot(WorkMode *WorkModeData) {
|
||||
}
|
||||
|
||||
// ADC gain is don't care when measuring voltage
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
// INSTRUCTION.ADCGainLevel = I_GAIN_100R;
|
||||
// IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
|
||||
static uint8_t ADCSwitch = 0;
|
||||
static int32_t VoltData;
|
||||
@@ -378,7 +391,16 @@ static void VT_Plot(WorkMode *WorkModeData) {
|
||||
}else{
|
||||
if(ADCSwitch == 0){ /**read V(buffer)**/
|
||||
VoltData = readVinVout(WorkModeData);
|
||||
InputNotify(NOTIFY_VOLT, VoltData);
|
||||
if(record_flag == false){
|
||||
static int recordCount = 0;
|
||||
recordCount++;
|
||||
if(recordCount == 2){
|
||||
record_flag = true;
|
||||
recordCount = 0;
|
||||
}
|
||||
}else{
|
||||
InputNotify(NOTIFY_VOLT, VoltData);
|
||||
}
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 1){ /**read V**/
|
||||
@@ -437,12 +459,15 @@ static void readIin(WorkMode *WorkModeData){
|
||||
}
|
||||
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
TEMP_MODE->_measureCurrent = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
AutoGainChange(TEMP_MODE->_measureCurrent);
|
||||
TEMP_MODE->_measureCurrent = AutoGainReadIin(spi_ADC_rxbuf);
|
||||
AutoGainChangeIin(TEMP_MODE->_measureCurrent);
|
||||
}else{
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
TEMP_MODE->_measureCurrent = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
if(lastIinADCGainLevel != INSTRUCTION.ADCGainLevel){
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
record_flag = false;
|
||||
}
|
||||
}
|
||||
#undef TEMP_MODE
|
||||
}
|
||||
@@ -491,11 +516,23 @@ static int32_t readVinVout(WorkMode *WorkModeData){
|
||||
}
|
||||
|
||||
static int32_t VoltData;
|
||||
ReadADCVolt(TEMP_MODE->_VoViSwitch);
|
||||
|
||||
if(TEMP_MODE->_VoViSwitch == 0x01 || TEMP_MODE->_VoViSwitch == 0x02){
|
||||
TEMP_MODE->_measureVin = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
if(INSTRUCTION.VinAutoGainEnable){
|
||||
TEMP_MODE->_measureVin = AutoGainReadVin(spi_ADC_rxbuf);
|
||||
AutoGainChangeVin(TEMP_MODE->_measureVin);
|
||||
}else{
|
||||
ReadADCVolt(TEMP_MODE->_VoViSwitch);
|
||||
TEMP_MODE->_measureVin = DecodeADCValue(INSTRUCTION.VinADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
if(lastVinADCGainLevel != INSTRUCTION.VinADCGainLevel){
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
record_flag = false;
|
||||
}
|
||||
|
||||
}
|
||||
VoltData = TEMP_MODE->_measureVin;
|
||||
}else if(TEMP_MODE->_VoViSwitch == 0x00){
|
||||
ReadADCVolt(TEMP_MODE->_VoViSwitch);
|
||||
TEMP_MODE->_measureVout = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_DAC, spi_ADC_rxbuf);
|
||||
VoltData = TEMP_MODE->_measureVout;
|
||||
}
|
||||
|
||||
+6
-6
@@ -3,13 +3,13 @@
|
||||
#define VERSION_DATE
|
||||
|
||||
#define VERSION_DATE_YEAR 20
|
||||
#define VERSION_DATE_MONTH 11
|
||||
#define VERSION_DATE_DAY 3
|
||||
#define VERSION_DATE_HOUR 15
|
||||
#define VERSION_DATE_MINUTE 38
|
||||
#define VERSION_DATE_MONTH 9
|
||||
#define VERSION_DATE_DAY 1
|
||||
#define VERSION_DATE_HOUR 16
|
||||
#define VERSION_DATE_MINUTE 34
|
||||
|
||||
// this is NOT the version hash !!
|
||||
// it's the last version hash
|
||||
#define VERSION_HASH 8808490caa465cc94d14896de28763a5e5c4672b
|
||||
#define VERSION_GIT_BRANCH Elite_OBJ_0.2mv
|
||||
#define VERSION_HASH 595396f7a92da182e8bcfd3ab0b59693f7590e04
|
||||
#define VERSION_GIT_BRANCH Elite1.5_developement_EventHandle
|
||||
#endif
|
||||
|
||||
+198
-106
@@ -435,7 +435,7 @@ characteristic change event
|
||||
#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 5
|
||||
#define MINOR_VERSION_NUMBER 6
|
||||
#define ELITE_VERSION_1_4
|
||||
//#define ELITE_VERSION_1_3
|
||||
|
||||
@@ -470,6 +470,20 @@ static uint8_t ins_buf[BLE_INS_BUFF_SIZE] = {0};
|
||||
static uint8_t not_buf[BLE_DAT_BUFF_SIZE] = {0};
|
||||
static uint8_t cis_buf[BLE_CIS_BUFF_SIZE] = {0};
|
||||
|
||||
/**
|
||||
* Latch initialize
|
||||
*/
|
||||
#define LATCH_BUFF_SIZE 8 // define latch
|
||||
struct _LH{
|
||||
bool LATCH0[LATCH_BUFF_SIZE];
|
||||
bool LATCH1[LATCH_BUFF_SIZE];
|
||||
bool LATCH2[LATCH_BUFF_SIZE];
|
||||
uint8_t LoadState;
|
||||
} LH= {0};
|
||||
static void InitLH();
|
||||
static void Init_Elite15_PIN();
|
||||
|
||||
|
||||
static Clock_Struct periodicClock;
|
||||
static bool PeriodicEvent = false;
|
||||
static bool InitPeriodicEvent = true;
|
||||
@@ -528,7 +542,6 @@ static uint32_t SampleRateTable[6] = {100, 1000, 10000, 50000, 100000, 1000000};
|
||||
static uint32_t VsetRateTable[5] = {2, 10, 100, 1000, 10000};
|
||||
static bool batteryCheck_flag;
|
||||
static bool batteryADC_flag;
|
||||
static bool tempCheck_flag;
|
||||
static bool ADC_flag;
|
||||
static bool vscan_flag;
|
||||
static bool notify_flag;
|
||||
@@ -537,17 +550,34 @@ static bool record_flag;
|
||||
static bool vscanReset;
|
||||
static bool EliteWorkReset;
|
||||
static bool leadTimeReset;
|
||||
static int16_t GAIN_200R_counter;
|
||||
static int16_t GAIN_200K_counter;
|
||||
static int16_t GAIN_10K_counter;
|
||||
static int16_t I_GAIN_100R_counter;
|
||||
static int16_t I_GAIN_3K_counter;
|
||||
static int16_t I_GAIN_100K_counter;
|
||||
static int16_t I_GAIN_3M_counter;
|
||||
static int16_t VIN_GAIN_1M_counter;
|
||||
static int16_t VIN_GAIN_30K_counter;
|
||||
static int16_t VIN_GAIN_1K_counter;
|
||||
static int16_t VOUT_GAIN_240K_counter;
|
||||
static int16_t VOUT_GAIN_15K_counter;
|
||||
static uint8_t lastVinADCGainLevel;
|
||||
static uint8_t lastIinADCGainLevel;
|
||||
static bool btWaitLedFlag = 0;
|
||||
static bool noEventLedFlag = 0;
|
||||
static bool preWorkLedFlag = 0;
|
||||
static bool workingLedFlag = 0;
|
||||
static bool postWorkLedFlag = 0;
|
||||
|
||||
// ADC function
|
||||
static int32_t DecodeADCValue(uint8_t ADCGain, uint8_t ADCChannel, uint8_t *ADC_raw);
|
||||
static void headstage_battery_volt();
|
||||
static void EliteADCBattery();
|
||||
static void VinADCGainControl(uint8_t VinADCLevel);
|
||||
static void VoutGainControl(uint8_t VOUTLevel);
|
||||
static void PIN15_setOutputValue (uint32_t latch_num, uint32_t pin_num, bool highlow);
|
||||
|
||||
// Elite key detection & turn on/ shutdown function (peripheral hardware control)
|
||||
static void Elite_led_color(uint16_t color);
|
||||
static void ModeLED(uint16_t modeStatus);
|
||||
//static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue);
|
||||
static bool If10Von = false;
|
||||
static void TurnOn10V();
|
||||
@@ -584,6 +614,7 @@ static void InitEliteFlag();
|
||||
#include "EliteDAC.h"
|
||||
#include "EliteSPI.h"
|
||||
#include "Elite_PIN.h"
|
||||
#include "Elite15_PIN.h"
|
||||
|
||||
#ifdef ELITE_VERSION_1_4
|
||||
#include "EliteI2C.h"
|
||||
@@ -592,6 +623,7 @@ static void InitEliteFlag();
|
||||
#include "EliteDeviceCorrection.h"
|
||||
#include "EliteNotify.h"
|
||||
#include "EliteFlagCTInit.h"
|
||||
#include "EliteLatchInit.h"
|
||||
#include "EliteReset.h"
|
||||
#include "EliteLED.h"
|
||||
#include "EliteKeyDetect.h"
|
||||
@@ -613,20 +645,16 @@ static void InitEliteFlag();
|
||||
static void update_ZM_instruction(uint8 *ins) {
|
||||
uint8_t ins_type = ins[0] & 0b11110000;
|
||||
uint8_t chip_ID = ins[0] & 0b00001111;
|
||||
INSTRUCTION.chip_id = chip_ID;
|
||||
|
||||
uint8_t oper = ins[1] & 0xF0; // this is don't care in RIS
|
||||
// uint8_t data_length = ins[1] & 0x0F;
|
||||
|
||||
if (!If10Von) {
|
||||
// TurnOn10V();
|
||||
}
|
||||
INSTRUCTION.chip_id = chip_ID;
|
||||
|
||||
switch (ins_type) {
|
||||
|
||||
case INS_TYPE_RIS: {
|
||||
switch (ins[2]) {
|
||||
case IV_CURVE: {
|
||||
ModeLED(WORKING);
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
INSTRUCTION.eliteFxn = IV_CURVE;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.Ve1 = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
@@ -647,6 +675,8 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case CV_CURVE: {
|
||||
ModeLED(WORKING);
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
INSTRUCTION.eliteFxn = CV_CURVE;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.Ve1 = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
@@ -667,12 +697,16 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case VOLT_OUTPUT: {
|
||||
ModeLED(WORKING);
|
||||
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]);
|
||||
break;
|
||||
}
|
||||
|
||||
case ZT_CURVE: {
|
||||
ModeLED(WORKING);
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
INSTRUCTION.eliteFxn = ZT_CURVE;
|
||||
INSTRUCTION.notifyRate = (uint32_t)INSTRUCTION.sampleRate;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
@@ -683,6 +717,7 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case VT_CURVE: {
|
||||
ModeLED(WORKING);
|
||||
INSTRUCTION.eliteFxn = VT_CURVE;
|
||||
INSTRUCTION.notifyRate = (uint32_t)INSTRUCTION.sampleRate;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
@@ -691,6 +726,7 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case IT_CURVE: {
|
||||
ModeLED(WORKING);
|
||||
INSTRUCTION.eliteFxn = IT_CURVE;
|
||||
INSTRUCTION.notifyRate = (uint32_t)INSTRUCTION.sampleRate;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
@@ -699,6 +735,8 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case CONSTANT_CURRENT:{
|
||||
ModeLED(WORKING);
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
INSTRUCTION.eliteFxn = CONSTANT_CURRENT;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.charge = ins[3]; //0:discharge 1:charge
|
||||
@@ -716,6 +754,7 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case CYCLIC_VOLTAMMETRY: {
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
if(ins[3] == PARA_1){
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.Vinit = ((int32_t)(ins[4]) << 8) | (int32_t)(ins[5]);
|
||||
@@ -729,6 +768,7 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
INSTRUCTION.directionInit = 1;
|
||||
}
|
||||
}else if(ins[3] == PARA_2){
|
||||
ModeLED(WORKING);
|
||||
INSTRUCTION.eliteFxn = CYCLIC_VOLTAMMETRY;
|
||||
INSTRUCTION.Currentmax = (int32_t)(ins[10]) << 24 | (int32_t)(ins[11]) << 16 | (int32_t)(ins[12]) << 8 | (int32_t)(ins[13]);
|
||||
INSTRUCTION.notifyRate = (uint32_t)(ins[8]) << 8 | (uint32_t)(ins[9]);
|
||||
@@ -744,6 +784,8 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case HIGH_CYCLE_CYCLIC_VOLTAMMETRY: {
|
||||
ModeLED(WORKING);
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
INSTRUCTION.eliteFxn = CYCLIC_VOLTAMMETRY;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.Vinit = ((int32_t)(ins[3]) << 8) | (int32_t)(ins[4]);
|
||||
@@ -769,6 +811,8 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:{
|
||||
ModeLED(WORKING);
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
INSTRUCTION.eliteFxn = LINEAR_SWEEP_VOLTAMMETRY;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.Ve1 = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
@@ -790,6 +834,8 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case CONSTANT_VSCAN:{
|
||||
ModeLED(WORKING);
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
INSTRUCTION.eliteFxn = CONSTANT_VSCAN;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.Vinit = ((int32_t)(ins[3]) << 8) | (int32_t)(ins[4]);
|
||||
@@ -806,16 +852,17 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case DIFFERENTIAL_PULSE_VOLTAMMETRY: {
|
||||
ModeLED(WORKING);
|
||||
INSTRUCTION.eliteFxn = DIFFERENTIAL_PULSE_VOLTAMMETRY;
|
||||
DACReset = true;
|
||||
|
||||
if (ins[3] | ins[4]) {
|
||||
INSTRUCTION.Ve1 = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
INSTRUCTION.Ve1 = Usercode_Correction_to_DAC(INSTRUCTION.Ve1);
|
||||
INSTRUCTION.Ve1 = Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.Ve1);
|
||||
}
|
||||
if (ins[5] | ins[6]) {
|
||||
INSTRUCTION.Ve2 = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
INSTRUCTION.Ve2 = Usercode_Correction_to_DAC(INSTRUCTION.Ve2);
|
||||
INSTRUCTION.Ve2 = Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.Ve2);
|
||||
}
|
||||
|
||||
if (ins[7] | ins[8]) {
|
||||
@@ -827,7 +874,7 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
if (ins[10] | ins[11]) {
|
||||
Amplitude = ((uint16_t)(ins[10]) << 8) | (uint16_t)(ins[11]);
|
||||
Amplitude = Usercode_Correction_to_DAC(Amplitude);
|
||||
Amplitude = Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, Amplitude);
|
||||
}
|
||||
if (ins[12]) {
|
||||
PulsePeriod = ins[12];
|
||||
@@ -842,16 +889,17 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case SQUARE_WAVE_VOLTAMMETRY: {
|
||||
ModeLED(WORKING);
|
||||
INSTRUCTION.eliteFxn = SQUARE_WAVE_VOLTAMMETRY;
|
||||
DACReset = true;
|
||||
|
||||
if (ins[3] | ins[4]) {
|
||||
INSTRUCTION.Ve1 = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
INSTRUCTION.Ve1 = Usercode_Correction_to_DAC(INSTRUCTION.Ve1);
|
||||
INSTRUCTION.Ve1 = Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.Ve1);
|
||||
}
|
||||
if (ins[5] | ins[6]) {
|
||||
INSTRUCTION.Ve2 = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
INSTRUCTION.Ve2 = Usercode_Correction_to_DAC(INSTRUCTION.Ve2);
|
||||
INSTRUCTION.Ve2 = Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.Ve2);
|
||||
}
|
||||
if (ins[7] | ins[8]) {
|
||||
INSTRUCTION.step = ((uint32_t)(ins[7]) << 8) | (uint32_t)(ins[8]);
|
||||
@@ -862,7 +910,7 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
if (ins[10] | ins[11]) {
|
||||
Amplitude = ((uint16_t)(ins[10]) << 8) | (uint16_t)(ins[11]);
|
||||
Amplitude = Usercode_Correction_to_DAC(Amplitude);
|
||||
Amplitude = Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, Amplitude);
|
||||
}
|
||||
if (ins[12]) {
|
||||
PulseWidth = ins[12];
|
||||
@@ -879,64 +927,138 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
break;
|
||||
}
|
||||
|
||||
case SET_ADC_GAIN: {
|
||||
INSTRUCTION.ADCGainLevel = ins[3];
|
||||
if(INSTRUCTION.ADCGainLevel != GAIN_AUTO){
|
||||
INSTRUCTION.AutoGainEnable = 0;
|
||||
case SET_ADC_DAC_GAIN: {
|
||||
switch(ins[3]){
|
||||
case IIN_ADC :{
|
||||
INSTRUCTION.ADCGainLevel = ins[4];
|
||||
if(INSTRUCTION.ADCGainLevel != I_GAIN_AUTO){
|
||||
INSTRUCTION.AutoGainEnable = 0;
|
||||
}
|
||||
else{
|
||||
INSTRUCTION.AutoGainEnable = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VIN_ADC :{
|
||||
INSTRUCTION.VinADCGainLevel = ins[4];
|
||||
if(INSTRUCTION.VinADCGainLevel != VIN_GAIN_AUTO){
|
||||
INSTRUCTION.VinAutoGainEnable = 0;
|
||||
}
|
||||
else{
|
||||
INSTRUCTION.VinAutoGainEnable = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VOUT_DAC :{
|
||||
INSTRUCTION.VoutGainLevel = ins[4];
|
||||
if(INSTRUCTION.VoutGainLevel != VOUT_GAIN_AUTO){
|
||||
INSTRUCTION.VoutAutoGainEnable = 0;
|
||||
}
|
||||
else{
|
||||
INSTRUCTION.VoutAutoGainEnable = 1;
|
||||
INSTRUCTION.VoutGainLevel = VOUT_GAIN_15K;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HIGH_Z :{
|
||||
switch(ins[4]) {
|
||||
case 0x00 :{
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 0); // 0 => open high_z mode
|
||||
break;
|
||||
}
|
||||
case 0x01 :{
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
break;
|
||||
}
|
||||
default :{
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default :{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
INSTRUCTION.AutoGainEnable = 1;
|
||||
}
|
||||
// if(INSTRUCTION.ADCGainLevel == GAIN_200R){
|
||||
// LED_color(DARKLED, 0x0F, 0x00, 0x00);
|
||||
// }
|
||||
// else if(INSTRUCTION.ADCGainLevel == GAIN_10K){
|
||||
// LED_color(DARKLED, 0x0F, 0x00, 0x0F);
|
||||
// }
|
||||
// else if(INSTRUCTION.ADCGainLevel == GAIN_200K){
|
||||
// LED_color(DARKLED, 0x0F, 0x02, 0xFF);
|
||||
// }
|
||||
break;
|
||||
}
|
||||
|
||||
case ADC_TEST: {
|
||||
ModeLED(WORKING);
|
||||
INSTRUCTION.eliteFxn = ADC_TEST;
|
||||
int32_t ADCRealValue = 0;
|
||||
uint8_t CIS_buf[9] = {0};
|
||||
uint16_t ADCValueAVG_RAW = 0;
|
||||
bool AVG_done = 0;
|
||||
|
||||
// for(int i=0 ; i<10 ; i++){
|
||||
ADCGainControl(ins[3]);
|
||||
ADCChannelSelect(ins[4]);
|
||||
CPUdelay(10);
|
||||
ADC_read(spi_ADC_rxbuf);
|
||||
// CPUdelay(10);
|
||||
//
|
||||
// ADCValueTemp = ( uint16_t) (spi_ADC_rxbuf[0]) << 8 | (uint16_t) (spi_ADC_rxbuf[1]);
|
||||
// ADCValueAVG = ADCValueAVG + ADCValueTemp;
|
||||
// }
|
||||
// ADCValueAVG = ADCValueAVG / 10;
|
||||
// ADCValueTemp = (uint16_t) (ADCValueAVG);
|
||||
switch(ins[3]) {
|
||||
case IIN_ADC :{ // 0x00
|
||||
IinADCGainControl(ins[4]);
|
||||
AVG_done = 1;
|
||||
break;
|
||||
}
|
||||
case VIN_ADC :{ // 0x01
|
||||
VinADCGainControl(ins[4]);
|
||||
AVG_done = 1;
|
||||
break;
|
||||
}
|
||||
case VOUT_DAC :{ // 0x02
|
||||
VoutGainControl(ins[4]);
|
||||
AVG_done = 0;
|
||||
break;
|
||||
}
|
||||
case HIGH_Z :{ // 0x03
|
||||
switch(ins[4]) {
|
||||
case 0x00 :{
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 0); // 0 => open high_z mode
|
||||
break;
|
||||
}
|
||||
case 0x01 :{
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
break;
|
||||
}
|
||||
default :{
|
||||
break;
|
||||
}
|
||||
}
|
||||
AVG_done = 0;
|
||||
break;
|
||||
}
|
||||
default :{
|
||||
AVG_done = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (AVG_done) {
|
||||
ADCValueAVG_RAW = ADC_CURRENT_AVG_calibration(ins[3]);
|
||||
} else {
|
||||
AVG_done = 0;
|
||||
}
|
||||
// ADCChannelSelect(ins[3]);
|
||||
// CPUdelay(10);
|
||||
// ADC_read(spi_ADC_rxbuf);
|
||||
|
||||
CIS_buf[0] = chip_ID;
|
||||
for(int i=0; i<4 ; i++){
|
||||
CIS_buf[i+1] = spi_ADC_rxbuf[i];
|
||||
}
|
||||
// CIS_buf[1] = (uint8_t) ((ADCValueTemp & 0xFF00) >> 8);
|
||||
// CIS_buf[2] = (uint8_t) (ADCValueTemp & 0x00FF);
|
||||
// CIS_buf[3] = spi_ADC_rxbuf[2];
|
||||
// CIS_buf[4] = spi_ADC_rxbuf[3];
|
||||
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[3], ins[4], spi_ADC_rxbuf);
|
||||
ADCRealValue = DecodeADCValue(ins[4], ins[3], spi_ADC_rxbuf);
|
||||
|
||||
// test ADC output through CIS
|
||||
if (ins[4] == ADC_CH_VOLT) {
|
||||
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[4] == ADC_CH_CURRENT) {
|
||||
} 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);
|
||||
@@ -951,7 +1073,6 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, 9, CIS_buf);
|
||||
|
||||
// SendNotify();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -973,14 +1094,10 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case VIS_ASK: {
|
||||
// uint16_t volt = 0;
|
||||
// volt = ( ((uint16_t) (ins[2])) <<8 ) | (uint16_t) (ins[3]);
|
||||
// DAC_outputV(DACOUT, volt);
|
||||
for (int i = 0; i < BLE_DAT_BUFF_SIZE; i++) {
|
||||
not_buf[i] = i;
|
||||
}
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -990,6 +1107,7 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
PeriodicEvent = true;
|
||||
InitEliteFlag();
|
||||
ELITE15_SPI_HOLD();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -999,6 +1117,10 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case VIS_INT: {
|
||||
if(PeriodicEvent){
|
||||
ELITE15_SPI_CLOSE();
|
||||
}
|
||||
|
||||
Eliteinterrupt();
|
||||
for(int i=0 ; i<12 ; i++){
|
||||
FlushNotify();
|
||||
@@ -1006,29 +1128,8 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
break;
|
||||
}
|
||||
|
||||
case VIS_SHIFT_200K: {
|
||||
PIN_setOutputValue(pin_handle, Turnon10K, 0);
|
||||
PIN_setOutputValue(pin_handle, Turnon200R, 0);
|
||||
LED_color(DARKLED, 0xFF, 0xB4, 0x00);
|
||||
break;
|
||||
}
|
||||
|
||||
case VIS_SHIFT_10K: {
|
||||
PIN_setOutputValue(pin_handle, Turnon10K, 1);
|
||||
PIN_setOutputValue(pin_handle, Turnon200R, 0);
|
||||
LED_color(DARKLED, 0x14, 0xC8, 0xFF);
|
||||
break;
|
||||
}
|
||||
|
||||
case VIS_SHIFT_200R: {
|
||||
PIN_setOutputValue(pin_handle, Turnon10K, 0);
|
||||
PIN_setOutputValue(pin_handle, Turnon200R, 1);
|
||||
LED_color(DARKLED, 0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
}
|
||||
|
||||
case VIS_DEVICE_SHINY:{
|
||||
Elite_led_color(COLOR_PURPLE_DARK);
|
||||
Elite_led_color(COLOR_PURPLE);
|
||||
// uint8_t deviceShinySwitch = (ins[2] & 0b11110000) >> 4;//1:open 0:close
|
||||
// if(deviceShinySwitch == 1){
|
||||
// Elite_led_color(COLOR_PURPLE);
|
||||
@@ -1052,6 +1153,8 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
case VIS_CC_ZERO:{
|
||||
ModeLED(PRE_WORK);
|
||||
PIN15_setOutputValue(HIGH_Z_MODE, 1); // 1 => close high_z mode
|
||||
INSTRUCTION.eliteFxn = CONSTANT_CURRENT;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.charge = 0x01;
|
||||
@@ -1107,17 +1210,6 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CIS_TEMPERATURE: { //0x7080
|
||||
initCISBuf();
|
||||
cis_buf[0] = CIS_TEMPERATURE;
|
||||
cis_buf[1] = NotifyTemperature[0];
|
||||
cis_buf[2] = NotifyTemperature[1];
|
||||
cis_buf[3] = NotifyTemperature[2];
|
||||
cis_buf[4] = NotifyTemperature[3];
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, BLE_CIS_BUFF_SIZE, cis_buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1134,6 +1226,18 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ZM_instruction_update_handle(uint8_t characteristic) {
|
||||
switch (characteristic) {
|
||||
case BLE_INS_BUFF_CHAR:
|
||||
// LED_color(0xf8, 0x00, 0xFF, 0xFF);
|
||||
SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR3, ins_buf);
|
||||
update_ZM_instruction(ins_buf);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// static void update_clock_period() {
|
||||
// uint32_t clock_rate = INSTRUCTION.adc_clock_rate;
|
||||
//
|
||||
@@ -1156,18 +1260,6 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
// }
|
||||
//}
|
||||
|
||||
static void ZM_instruction_update_handle(uint8_t characteristic) {
|
||||
switch (characteristic) {
|
||||
case BLE_INS_BUFF_CHAR:
|
||||
// LED_color(0xf8, 0x00, 0xFF, 0xFF);
|
||||
SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR3, ins_buf);
|
||||
update_ZM_instruction(ins_buf);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*===================================
|
||||
==== system function implements ====
|
||||
==================================*/
|
||||
|
||||
+34
-20
@@ -33,7 +33,8 @@ static void SimpleBLEPeripheral_clockHandler(UArg arg) {
|
||||
|
||||
}
|
||||
static void elite_gptimer_callback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask) {
|
||||
events |= SBP_PERIODIC_EVT;
|
||||
// events |= SBP_PERIODIC_EVT;
|
||||
// events |= EVT_KEY_DETECT;
|
||||
Semaphore_post(semaphore);
|
||||
GPT.GptimerCounter++;
|
||||
}
|
||||
@@ -46,15 +47,20 @@ static void ZM_init() {
|
||||
|
||||
// initialize
|
||||
pin_handle = PIN_open(&ZM_rst, BLE_IO);
|
||||
Init_Elite15_PIN();
|
||||
|
||||
PIN_setOutputValue(pin_handle, shutdown_6994, 1); // OFF = 1 => turn off 6994
|
||||
PIN_setOutputValue(pin_handle, enable_10v, 0); // enable 10V
|
||||
PIN15_setOutputValue(shutdown_6994, 1); // OFF = 1 => turn off 6994
|
||||
PIN15_setOutputValue(enable_10v, 0); // enable 10V
|
||||
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
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
|
||||
|
||||
InitEliteInstruction();
|
||||
ADCGainControl(GAIN_AUTO);
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
VoutGainControl(INSTRUCTION.VoutGainLevel);
|
||||
elite_gptimer_open();
|
||||
|
||||
// PIN_registerIntCb(pin_handle, switch_on_callback);
|
||||
@@ -66,7 +72,7 @@ static void ZM_update_instruction_callback(uint8_t ins_type, uint8_t chip_ID, ui
|
||||
|
||||
static void DACCode2Real2Notify(uint16_t DACcode) {
|
||||
int32_t RealV;
|
||||
RealV = DAC_to_realV(DACcode);
|
||||
RealV = DAC_to_realV(INSTRUCTION.VoutGainLevel, DACcode);
|
||||
|
||||
NotifyVolt[0] = (uint8_t)((RealV & 0xFF000000) >> 24);
|
||||
NotifyVolt[1] = (uint8_t)((RealV & 0x00FF0000) >> 16);
|
||||
@@ -116,10 +122,15 @@ static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
|
||||
EliteWorkReset = false;
|
||||
batteryADC_flag = false;
|
||||
record_flag = true;
|
||||
VinADCGainControl(INSTRUCTION.VinADCGainLevel);
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
VoutGainControl(INSTRUCTION.VoutGainLevel);
|
||||
if( Ve1MatchVe2Mode() ){
|
||||
if (INSTRUCTION.Ve1 == INSTRUCTION.Ve2) {
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.Ve1));
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.Ve1));
|
||||
PeriodicEvent = false;
|
||||
ELITE15_SPI_CLOSE();
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,7 +151,12 @@ static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
|
||||
//vscan counter
|
||||
GPT.VscanRateCounter = GPT.VscanRateCounter + GPT.DeltaGptimerCounter;
|
||||
if(GPT.VscanRateCounter >= INSTRUCTION.VsetRate){
|
||||
GPT.VscanRateCounter -= INSTRUCTION.VsetRate; //To get right time
|
||||
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);
|
||||
@@ -154,12 +170,11 @@ static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
|
||||
if(GPT.BatteryCheckCounter >= 50000){
|
||||
GPT.BatteryCheckCounter -= 50000; //To get right time
|
||||
batteryCheck_flag = true;
|
||||
tempCheck_flag = true;
|
||||
}
|
||||
|
||||
uint16_t bat = ((uint16_t)(NotifyVoltBat[2]) << 8 & 0xFF00 ) | ((uint16_t)(NotifyVoltBat[3]) & 0x00FF);
|
||||
if( bat < 768 && bat > 20){
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 0);
|
||||
PIN15_setOutputValue(enable_5v, 0);
|
||||
}
|
||||
|
||||
//ADC counter
|
||||
@@ -171,9 +186,6 @@ static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
|
||||
EliteADCControl(WorkModeData);
|
||||
ADC_flag = false;
|
||||
}
|
||||
}else if(GPT.SampleRateCounter == 12 && tempCheck_flag){
|
||||
headstage_temperature();
|
||||
tempCheck_flag = false;
|
||||
}
|
||||
|
||||
//Notify counter(Notify control, check if we need to send notify)
|
||||
@@ -191,12 +203,13 @@ static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
|
||||
}
|
||||
}
|
||||
|
||||
EliteDone();
|
||||
// EliteDone();
|
||||
}else if(INSTRUCTION.eliteFxn == VOLT_OUTPUT){
|
||||
WorkModeData->VO->_Vset = INSTRUCTION.VoltConstant;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(WorkModeData->VO->_Vset)); //UserCode -> DAC code -> DAC out
|
||||
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();
|
||||
}
|
||||
@@ -250,7 +263,7 @@ static void EliteDone() {
|
||||
if ((INSTRUCTION.eliteFxn == IV_CURVE) || (INSTRUCTION.eliteFxn == CV_CURVE) || (INSTRUCTION.eliteFxn == CYCLIC_VOLTAMMETRY)) {
|
||||
if (!PeriodicEvent) {
|
||||
SendNotify();
|
||||
reset();
|
||||
Eliteinterrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -348,8 +361,9 @@ static void InitEliteFlag() {
|
||||
vscanReset = true;
|
||||
EliteWorkReset = true;
|
||||
leadTimeReset = true;
|
||||
GAIN_200R_counter = 0;
|
||||
GAIN_200K_counter = 0;
|
||||
GAIN_10K_counter = 0;
|
||||
I_GAIN_100R_counter = 0;
|
||||
I_GAIN_3K_counter = 0;
|
||||
I_GAIN_100K_counter = 0;
|
||||
I_GAIN_3M_counter = 0;
|
||||
}
|
||||
#endif /* IMPEDANCE_METER_H_ */
|
||||
|
||||
+14
-36
@@ -174,10 +174,10 @@
|
||||
#ifndef RTOSPARA
|
||||
#define RTOSPARA
|
||||
#define SBP_STATE_CHANGE_EVT 0x0001
|
||||
#define SBP_CHAR_CHANGE_EVT 0x0002
|
||||
#define SBP_PERIODIC_EVT 0x0004
|
||||
#define SBP_CHAR_CHANGE_EVT 0x0002
|
||||
#define SBP_PERIODIC_EVT 0x0004
|
||||
#define SBP_CONN_EVT_END_EVT 0x0008
|
||||
#define SBP_KEY_CHANGE_EVT 0x0010
|
||||
#define SBP_KEY_CHANGE_EVT 0x0010
|
||||
#endif
|
||||
|
||||
// data length extension parameter
|
||||
@@ -548,7 +548,7 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
SimpleBLEPeripheral_init();
|
||||
|
||||
ZM_init();
|
||||
Elite_SPI_init();
|
||||
// Elite_SPI_init();
|
||||
WorkMode *WorkModeData = CreateWorkMode();
|
||||
|
||||
uint8_t key = 0;
|
||||
@@ -556,7 +556,7 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
bool EliteOn = 0;
|
||||
|
||||
// init DAC, set output ~= 0 V
|
||||
DAC_outputV(Usercode_Correction_to_DAC(25000));
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, 25000));
|
||||
elite_gptimer_start();
|
||||
|
||||
// Application main loops
|
||||
@@ -620,43 +620,18 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
if (counter6994 < CLOCK_ONE_SECOND/2) { // counter6994 enable a IC after 35 counts
|
||||
counter6994++;
|
||||
} else if (counter6994 == CLOCK_ONE_SECOND/2) {
|
||||
PIN_setOutputValue(pin_handle, shutdown_6994, 1); // OFF = 1 => turn off 6994
|
||||
PIN15_setOutputValue(shutdown_6994, 1); // OFF = 1 => turn off 6994
|
||||
counter6994++;
|
||||
}
|
||||
EliteKeyPress(key);
|
||||
if(key != 0){ //detect Elite battery power when no periodic event
|
||||
GPT.DeltaGptimerCounter = GPT.GptimerCounter - GPT.GptimerCounter0;
|
||||
GPT.GptimerCounter0 = GPT.GptimerCounter;
|
||||
|
||||
GPT.BatteryADCCounter = GPT.BatteryADCCounter + GPT.DeltaGptimerCounter;
|
||||
GPT.BatteryCheckCounter = GPT.BatteryCheckCounter + GPT.DeltaGptimerCounter;
|
||||
|
||||
if(GPT.BatteryCheckCounter >= 50000){//5min=3000000, 5s=50000
|
||||
GPT.BatteryCheckCounter = 0;
|
||||
batteryCheck_flag = true;
|
||||
}
|
||||
|
||||
if(GPT.BatteryADCCounter >= 15 && batteryCheck_flag){
|
||||
GPT.BatteryADCCounter = 0; //To get the data right, ADC must be delay 1.5ms
|
||||
batteryADC_flag = true;
|
||||
if(batteryADC_flag){
|
||||
EliteADCBattery();
|
||||
batteryADC_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t bat = ((uint16_t)(NotifyVoltBat[2]) << 8 & 0xFF00 ) |
|
||||
((uint16_t)(NotifyVoltBat[3]) & 0x00FF);
|
||||
if( bat < 768 && bat > 20){
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 0);
|
||||
}
|
||||
|
||||
measureBat();
|
||||
}
|
||||
if(Free_Work_Mode){
|
||||
FreeWorkMode(WorkModeData);
|
||||
InitEliteInstruction();
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
IinADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant));
|
||||
|
||||
Free_Work_Mode = false;
|
||||
}
|
||||
@@ -677,6 +652,10 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
}
|
||||
}
|
||||
|
||||
// if(elite_event > 0){
|
||||
// elite_event_handle(WorkModeData);
|
||||
// }
|
||||
|
||||
#ifdef FEATURE_OAD
|
||||
while (!Queue_empty(hOadQ)) {
|
||||
oadTargetWrite_t *oadWriteEvt = Queue_get(hOadQ);
|
||||
@@ -950,7 +929,6 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)
|
||||
|
||||
numActive = linkDB_NumActive();
|
||||
|
||||
|
||||
// uint16_t cxnHandle;
|
||||
//
|
||||
// // requestedPDUSize = LL payload = L2CAP_header + ATT header + BLE_NOT_BUFF_SIZE = 7 + BLE_NOT_BUFF_SIZE //roy
|
||||
@@ -996,7 +974,7 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)
|
||||
|
||||
case GAPROLE_WAITING:
|
||||
SimpleBLEPeripheral_freeAttRsp(bleNotConnected);
|
||||
|
||||
ModeLED(BT_WAIT);
|
||||
break;
|
||||
|
||||
case GAPROLE_WAITING_AFTER_TIMEOUT:
|
||||
|
||||
Reference in New Issue
Block a user