Compare commits
249 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 283cb69a6b | |||
| 4bfa35858d | |||
| d6068f8e5c | |||
| 2ea33f0269 | |||
| f9da0bbad4 | |||
| 46bd7e04cf | |||
| e3a04ad8e5 | |||
| 6cfde66c24 | |||
| f9f0aeaf87 | |||
| 1856096cf3 | |||
| eb1b4ddf30 | |||
| e960b0859a | |||
| bcebfaa777 | |||
| 5be3e2ec10 | |||
| 49f2f6b1ea | |||
| 9afe79edfb | |||
| fc67ea915e | |||
| 7b866d025a | |||
| 13864e766a | |||
| ee0ff789f3 | |||
| 7f6a871501 | |||
| d4681171b4 | |||
| 52139ec1b1 | |||
| 9b61eda6c2 | |||
| 142c8c38e1 | |||
| e1acbf5681 | |||
| 0bc5b8bfb8 | |||
| 3e8bbbeaf8 | |||
| 4c88d96928 | |||
| ffeb980a39 | |||
| b0ced97ffb | |||
| 1876714222 | |||
| 075e65604b | |||
| 7dbc090909 | |||
| c95e379cd1 | |||
| 9284cfacfc | |||
| dcced24976 | |||
| 286164a76d | |||
| 51d2e88978 | |||
| 29b73a88ae | |||
| 99f2e53b34 | |||
| 6d14af0e18 | |||
| 43282ac881 | |||
| 67a82d0cb1 | |||
| aec07f750b | |||
| 5c38dd785a | |||
| 46473fbae0 | |||
| cf876bfaf9 | |||
| 2fe991a23b | |||
| b9f8938c0e | |||
| 14129b8b3c | |||
| 502daf7204 | |||
| 3013e88dca | |||
| d37cf0f694 | |||
| 4cf062fb06 | |||
| 4a8e090ff1 | |||
| 576df09f24 | |||
| 3a01d5cc2c | |||
| 165c89e6aa | |||
| 9eaedfc0e5 | |||
| 5eba9eff3a | |||
| b985a09863 | |||
| 68aa82bbd8 | |||
| 6b1c0ca9aa | |||
| d176628edb | |||
| 8548712049 | |||
| bc819082cc | |||
| 64fb0fc78a | |||
| 0a4303dff0 | |||
| caa0bfaf8d | |||
| c6e300bfff | |||
| cf1d92d9ec | |||
| 25796a879d | |||
| f6e8385a8f | |||
| b52ea2fe1e | |||
| 2a6920a3d3 | |||
| fac1427eb6 | |||
| ed13172c92 | |||
| 07ebae4f64 | |||
| 1391ebd695 | |||
| 6cf988a54c | |||
| 76b74b53f9 | |||
| 786991d971 | |||
| c33b46521e | |||
| fc41b62329 | |||
| ab2eeb7f96 | |||
| bc3106fc26 | |||
| f2d404ed60 | |||
| 53038c0c84 | |||
| b835a0136b | |||
| e12102a8a7 | |||
| 728b9ae8bf | |||
| 9f5a6a09de | |||
| d26da674f5 | |||
| b781023863 | |||
| a42f6441fa | |||
| 2c4122bb77 | |||
| a05b81a7b4 | |||
| 2c8cc334e2 | |||
| 59786e995f | |||
| ebc1d29195 | |||
| 2d8d706141 | |||
| eb25a2e674 | |||
| 241ff38555 | |||
| 059bc76536 | |||
| 4678e304ee | |||
| db7d1e1141 | |||
| 218997b6b3 | |||
| f05c37d53e | |||
| 90767f36e5 | |||
| 81b1ff935a | |||
| 0f5f228707 | |||
| f0ea8bfcf5 | |||
| a2f0d62819 | |||
| e238d117a9 | |||
| 82dbe82bd1 | |||
| 8ba6180c8c | |||
| e2d5470b47 | |||
| 2532e703ae | |||
| 10497683c8 | |||
| 53932d4cb3 | |||
| 7b0f5ce687 | |||
| 653c2059e2 | |||
| 5c949be67c | |||
| c73ab1bbd4 | |||
| 083cbb0611 | |||
| f998c01010 | |||
| faf57cba6a | |||
| 83b70de310 | |||
| b4fb63f1e8 | |||
| 832fe1695f | |||
| d6b6b65e5f | |||
| 1698f0b544 | |||
| d10a6d16a8 | |||
| f864acfa26 | |||
| ba7703a772 | |||
| b7739ab42d | |||
| a6208f00d0 | |||
| c53a2d8872 | |||
| 9c69e16046 | |||
| cc57bc47a6 | |||
| b2b07ae05f | |||
| fec9ddcdf8 | |||
| 3eb17d14e6 | |||
| 8ca4eb3812 | |||
| 8341560686 | |||
| 39f39773b8 | |||
| a01c9b9dc0 | |||
| 124ca6ea84 | |||
| befb4f80e2 | |||
| 5a7980dca5 | |||
| 889a3d4147 | |||
| 0245adae4a | |||
| 8b94eaa6dd | |||
| 323dc2cf77 | |||
| e89cd406e4 | |||
| 8de29a213c | |||
| 571edc35aa | |||
| ee04ca568e | |||
| 67ef9adad1 | |||
| 4ec0bb12f7 | |||
| 5f5921e411 | |||
| da6a3f90f9 | |||
| 21135acf32 | |||
| b8e052de0d | |||
| cf33bcba2a | |||
| 45e7e2d5b7 | |||
| 04286e891d | |||
| 2e4720c607 | |||
| 5333cd9c98 | |||
| a116cbfa3e | |||
| bae6a4bce3 | |||
| bc10083c25 | |||
| 6f7cea2590 | |||
| f3c010ebf8 | |||
| ffbdd27df0 | |||
| 4f9fb2b8fb | |||
| f7d2b168d4 | |||
| 5a9a3754e7 | |||
| 97040855af | |||
| 77ee73a878 | |||
| cbd8f96f60 | |||
| 631396c50e | |||
| d25103373e | |||
| 8ddb66393d | |||
| f8d37fcf20 | |||
| a22253e384 | |||
| 116d4cfb76 | |||
| bd070a4ce8 | |||
| 5beb62613f | |||
| e27204bd50 | |||
| 34e9c644c5 | |||
| 74d2024731 | |||
| 7615f141ef | |||
| 38a45cdb1d | |||
| 9623751337 | |||
| dbf25c5712 | |||
| 7b2a51ee24 | |||
| bf57c10785 | |||
| 854e82a198 | |||
| 3107807268 | |||
| dff6c0a9e2 | |||
| 8480f60266 | |||
| 8808490caa | |||
| 59a4d9dafe | |||
| 1d8d987d22 | |||
| 5538e13e69 | |||
| 1b75ccb056 | |||
| 131051e227 | |||
| e0e116b1d1 | |||
| 9a9cf40c74 | |||
| 246052bf9c | |||
| 66229c2821 | |||
| 347259fe7e | |||
| d1b3aa9506 | |||
| 6cdecd9e87 | |||
| 56937a0780 | |||
| cb1ca49985 | |||
| 7e9dfbc4c2 | |||
| d86b008bb1 | |||
| ceac955327 | |||
| 64effd5a02 | |||
| c7d531f0a5 | |||
| 37caa92565 | |||
| 4c04c57728 | |||
| 9bc16f7687 | |||
| e11eae5302 | |||
| 2269a2b4d7 | |||
| 3ffa567f1b | |||
| de4d766ed5 | |||
| 7b5d46edff | |||
| 7399ddce01 | |||
| 7e16a54533 | |||
| 778495a07a | |||
| 527a90f732 | |||
| 4e01c27e8e | |||
| a71e456e81 | |||
| df1c1f9f7e | |||
| 06584e7d1c | |||
| 5ea5b16d89 | |||
| 10e2d12bc2 | |||
| 857388b204 | |||
| 78d788cab2 | |||
| 02185083f5 | |||
| aeca114c5f | |||
| 7b4f2b5828 | |||
| 7b075f40a3 | |||
| 6c68c67f0e | |||
| fd9f0ef321 |
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
#path=$(pwd)
|
||||
#folder=$($path | awk -F"/" '{$NF}')
|
||||
folder=$(basename "$(pwd)")
|
||||
|
||||
if [ "$folder" == "bioprocc2650" ]; then
|
||||
year=$(date +%-y)
|
||||
month=$(date +%-m)
|
||||
day=$(date +%-d)
|
||||
hour=$(date +%-H)
|
||||
minute=$(date +%-M)
|
||||
|
||||
hash=$(git rev-parse HEAD)
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
sed -i "5c #define VERSION_DATE_YEAR ${year}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
sed -i "6c #define VERSION_DATE_MONTH ${month}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
sed -i "7c #define VERSION_DATE_DAY ${day}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
sed -i "8c #define VERSION_DATE_HOUR ${hour}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
sed -i "9c #define VERSION_DATE_MINUTE ${minute}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
sed -i "13c #define VERSION_HASH ${hash}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
sed -i "14c #define VERSION_GIT_BRANCH ${branch}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
#cat ./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
fi
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<configurations XML_version="1.2" id="configurations_0">
|
||||
<configuration XML_version="1.2" id="configuration_0">
|
||||
<instance XML_version="1.2" desc="Texas Instruments XDS100v3 USB Debug Probe" href="connections/TIXDS100v3_Dot7_Connection.xml" id="Texas Instruments XDS100v3 USB Debug Probe" xml="TIXDS100v3_Dot7_Connection.xml" xmlpath="connections"/>
|
||||
<connection XML_version="1.2" id="Texas Instruments XDS100v3 USB Debug Probe">
|
||||
<instance XML_version="1.2" href="drivers/tixds100v2icepick_c.xml" id="drivers" xml="tixds100v2icepick_c.xml" xmlpath="drivers"/>
|
||||
<instance XML_version="1.2" href="drivers/tixds100v2cs_dap.xml" id="drivers" xml="tixds100v2cs_dap.xml" xmlpath="drivers"/>
|
||||
<instance XML_version="1.2" href="drivers/tixds100v2cortexM.xml" id="drivers" xml="tixds100v2cortexM.xml" xmlpath="drivers"/>
|
||||
<property Type="choicelist" Value="2" id="The Converter Usage">
|
||||
<choice Name="Generate 1149.7 2-pin advanced modes" value="enable">
|
||||
<property Type="choicelist" Value="1" id="The Converter 1149.7 Frequency">
|
||||
<choice Name="Overclock with user specified value" value="unused">
|
||||
<property Type="choicelist" Value="5" id="-- Choose a value from 1.0MHz to 50.0MHz"/>
|
||||
</choice>
|
||||
</property>
|
||||
<property Type="choicelist" Value="5" id="The Target Scan Format"/>
|
||||
</choice>
|
||||
</property>
|
||||
<platform XML_version="1.2" id="platform_0">
|
||||
<instance XML_version="1.2" desc="CC2640F128" href="devices/cc2640f128.xml" id="CC2640F128" xml="cc2640f128.xml" xmlpath="devices"/>
|
||||
</platform>
|
||||
</connection>
|
||||
</configuration>
|
||||
</configurations>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
|
||||
on the device and connection settings specified in your project on the Properties > General page.
|
||||
|
||||
Please note that in automatic target-configuration management, changes to the project's device and/or
|
||||
connection settings will either modify an existing or generate a new target-configuration file. Thus,
|
||||
if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
|
||||
you may create your own target-configuration file for this project and manage it manually. You can
|
||||
always switch back to automatic target-configuration management by checking the "Manage the project's
|
||||
target-configuration automatically" checkbox on the project's Properties > General page.
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<configurations XML_version="1.2" id="configurations_0">
|
||||
<configuration XML_version="1.2" id="configuration_0">
|
||||
<instance XML_version="1.2" desc="Texas Instruments XDS100v3 USB Debug Probe" href="connections/TIXDS100v3_Dot7_Connection.xml" id="Texas Instruments XDS100v3 USB Debug Probe" xml="TIXDS100v3_Dot7_Connection.xml" xmlpath="connections"/>
|
||||
<connection XML_version="1.2" id="Texas Instruments XDS100v3 USB Debug Probe">
|
||||
<instance XML_version="1.2" href="drivers/tixds100v2icepick_c.xml" id="drivers" xml="tixds100v2icepick_c.xml" xmlpath="drivers"/>
|
||||
<instance XML_version="1.2" href="drivers/tixds100v2cs_dap.xml" id="drivers" xml="tixds100v2cs_dap.xml" xmlpath="drivers"/>
|
||||
<instance XML_version="1.2" href="drivers/tixds100v2cortexM.xml" id="drivers" xml="tixds100v2cortexM.xml" xmlpath="drivers"/>
|
||||
<property Type="choicelist" Value="2" id="The Converter Usage">
|
||||
<choice Name="Generate 1149.7 2-pin advanced modes" value="enable">
|
||||
<property Type="choicelist" Value="1" id="The Converter 1149.7 Frequency">
|
||||
<choice Name="Overclock with user specified value" value="unused">
|
||||
<property Type="choicelist" Value="5" id="-- Choose a value from 1.0MHz to 50.0MHz"/>
|
||||
</choice>
|
||||
</property>
|
||||
<property Type="choicelist" Value="5" id="The Target Scan Format"/>
|
||||
</choice>
|
||||
</property>
|
||||
<platform XML_version="1.2" id="platform_0">
|
||||
<instance XML_version="1.2" desc="CC2640F128" href="devices/cc2640f128.xml" id="CC2640F128" xml="cc2640f128.xml" xmlpath="devices"/>
|
||||
</platform>
|
||||
</connection>
|
||||
</configuration>
|
||||
</configurations>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
|
||||
on the device and connection settings specified in your project on the Properties > General page.
|
||||
|
||||
Please note that in automatic target-configuration management, changes to the project's device and/or
|
||||
connection settings will either modify an existing or generate a new target-configuration file. Thus,
|
||||
if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
|
||||
you may create your own target-configuration file for this project and manage it manually. You can
|
||||
always switch back to automatic target-configuration management by checking the "Manage the project's
|
||||
target-configuration automatically" checkbox on the project's Properties > General page.
|
||||
+55
-55
@@ -18,8 +18,8 @@
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" errorParsers="org.eclipse.rtsc.xdctools.parsers.ErrorParser;com.ti.rtsc.XDCtools.parsers.ErrorParser;com.ti.ccstudio.errorparser.CoffErrorParser;com.ti.ccstudio.errorparser.LinkErrorParser;com.ti.ccstudio.errorparser.AsmErrorParser;org.eclipse.cdt.core.GmakeErrorParser" id="com.ti.ccstudio.buildDefinitions.TMS470.Default.67178137" name="FlashROM" parent="com.ti.ccstudio.buildDefinitions.TMS470.Default" postbuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out" prebuildStep="">
|
||||
<folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Default.67178137." name="/" resourcePath="">
|
||||
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain.1369151231" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.223507680">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.732777020" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
|
||||
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain.410623502" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1351821865">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1751124300" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex M.CC2650F128"/>
|
||||
<listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>
|
||||
<listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>
|
||||
@@ -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.579299287" 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.2112816025" 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.1418617668" 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.1368914557" 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.872349905" 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.1023813954" 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.1674413144" 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.184317276" 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.1068578615" 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.1943600764" 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.644525479" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH" valueType="includePath">
|
||||
<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" 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" 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.1330623088" 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,71 +86,71 @@
|
||||
<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.1308360247" 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.504235202" 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.105967788" 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.698913237" 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.1399241416" 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.867926379" 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.980626282" 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.374992114" 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.1890491357" 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"/>
|
||||
</option>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS.263445006" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS.1235873701" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS.207268648" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS.1068957263" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS.1540775079" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS.319000695" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS.270651019" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS"/>
|
||||
<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.223507680" 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.698430423" 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.402182782" 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.1628689699" 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.2141951901" 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.679112687" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY" valueType="libs">
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1351821865" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE.174129193" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE" value="256" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE.567300083" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE" value="0" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE.1800982811" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE" value=""${ProjName}.map"" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.1091211742" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY.1479599481" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY" valueType="libs">
|
||||
<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.650613345" 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.782343525" 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.1555270082" 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.16105060" 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.1713299511" 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.68776981" 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.1860389255" 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.152379533" 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.158095632" 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.978853236" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__GEN_CMDS"/>
|
||||
<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.2015106526" name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.1270425102" 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.16813235" 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.318851558" 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 id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.19288898" name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.11734737" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH" value="8" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH.466140455" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH" value="8" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.824070691" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.INTEL" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.927640565" name="XDCtools" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool">
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH.1908494509" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH" valueType="stringList">
|
||||
<tool id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.1392704063" name="XDCtools" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool">
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH.225737408" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH" valueType="stringList">
|
||||
<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.1746187707" 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.884959194" 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.943624305" 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.1521167272" 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.1901654533" 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.138005453" 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>
|
||||
|
||||
+104
-47
@@ -12,7 +12,7 @@
|
||||
#define CMD_CURRENT_MEASURE 0xC5
|
||||
#define CMD_VOLT_MEASURE 0xD5
|
||||
#define CMD_DAC_MEASURE 0xE5
|
||||
#define CMD_BATTERY_MEASURE 0xF5
|
||||
#define CMD_BATTERY_MEASURE 0xF1
|
||||
|
||||
// controller command, these are command from control box
|
||||
#define ADC_CH_CURRENT 0x00
|
||||
@@ -129,11 +129,18 @@ static void ADCChannelSelect(uint8_t ADCChannel){
|
||||
static void ReadVolt(uint8_t *buf){
|
||||
// Read data twice since the first data we get is previous data
|
||||
ADCChannelSelect(ADC_CH_VOLT);
|
||||
CPUdelay(10);
|
||||
ADC_read(buf);
|
||||
|
||||
ADCChannelSelect(ADC_CH_VOLT);
|
||||
CPUdelay(10);
|
||||
ADC_read(buf);
|
||||
}
|
||||
|
||||
static void ReadVoutVolt(uint8_t *buf){
|
||||
// Read data twice since the first data we get is previous data
|
||||
ADCChannelSelect(ADC_CH_DAC);
|
||||
ADC_read(buf);
|
||||
|
||||
ADCChannelSelect(ADC_CH_DAC);
|
||||
ADC_read(buf);
|
||||
}
|
||||
|
||||
@@ -141,89 +148,139 @@ static void ReadCurrent(uint8_t *buf){
|
||||
// Read data twice since the first data we get is previous data
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
ADCChannelSelect(ADC_CH_CURRENT);
|
||||
CPUdelay(10);
|
||||
ADC_read(buf);
|
||||
|
||||
ADCChannelSelect(ADC_CH_CURRENT);
|
||||
CPUdelay(10);
|
||||
ADC_read(buf);
|
||||
}
|
||||
|
||||
static void ReadBatVolt(uint8_t *buf){
|
||||
// Read data twice since the first data we get is previous data
|
||||
ADCChannelSelect(ADC_CH_BAT);
|
||||
ADC_read(buf);
|
||||
|
||||
ADCChannelSelect(ADC_CH_BAT);
|
||||
ADC_read(buf);
|
||||
}
|
||||
|
||||
|
||||
// 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
|
||||
//#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
|
||||
|
||||
//#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
|
||||
|
||||
/* for Elite1.4-re which 6.3kohm replaced by 10kohm */
|
||||
// theoretical boundary <40, 30~1350, >1000 (uA)
|
||||
#define GAIN_SMALL_BOUNDARY 40000 // 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
|
||||
|
||||
static int32_t AutoGainReadCurrent(uint8_t *buf){
|
||||
|
||||
int32_t Real_Current = 0;
|
||||
|
||||
if(INSTRUCTION.ADCGainLevel == GAIN_AUTO){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
}
|
||||
|
||||
if(INSTRUCTION.ADCGainLevel == GAIN_200R){
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
|
||||
return Real_Current;
|
||||
}
|
||||
|
||||
|
||||
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){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_10K;
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
// LED_color(DARKLED, 0x00, 0xFF, 0x00);
|
||||
|
||||
// // switch to small range current
|
||||
// if (Real_Current < GAIN_MID_BOUNDARY1 && Real_Current > -1*GAIN_MID_BOUNDARY1){
|
||||
// INSTRUCTION.ADCGainLevel = GAIN_200K;
|
||||
// ReadCurrent(spi_ADC_rxbuf);
|
||||
// Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
// LED_color(DARKLED, 0xFF, 0x00, 0x00);
|
||||
// }
|
||||
// switch to small range current
|
||||
if (Real_Current < GAIN_MID_BOUNDARY1 && Real_Current > -1*GAIN_MID_BOUNDARY1){
|
||||
GAIN_200K_counter++;
|
||||
if(GAIN_200K_counter > 5){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200K;
|
||||
GAIN_200K_counter = 0;
|
||||
}
|
||||
}else{
|
||||
GAIN_10K_counter++;
|
||||
if(GAIN_10K_counter > 5){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_10K;
|
||||
GAIN_10K_counter = 0;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(GAIN_200K_counter > 0){
|
||||
GAIN_200K_counter--;
|
||||
}
|
||||
if(GAIN_10K_counter > 0){
|
||||
GAIN_10K_counter--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.ADCGainLevel == GAIN_10K){
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
|
||||
// switch to large range current
|
||||
if(Real_Current > GAIN_MID_BOUNDARY2 || Real_Current < -1*GAIN_MID_BOUNDARY2){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
GAIN_200R_counter++;
|
||||
if(GAIN_200R_counter > 5){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
GAIN_200R_counter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// switch to small range current
|
||||
else if (Real_Current < GAIN_MID_BOUNDARY1 && Real_Current > -1*GAIN_MID_BOUNDARY1){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200K;
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
GAIN_200K_counter++;
|
||||
if(GAIN_200K_counter > 5){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200K;
|
||||
GAIN_200K_counter = 0;
|
||||
}
|
||||
|
||||
}else{
|
||||
if(GAIN_200R_counter > 0){
|
||||
GAIN_200R_counter--;
|
||||
}
|
||||
if(GAIN_200K_counter > 0){
|
||||
GAIN_200K_counter--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.ADCGainLevel == GAIN_200K){
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
|
||||
// switch to mid range current
|
||||
if(Real_Current > GAIN_SMALL_BOUNDARY || Real_Current < -1*GAIN_SMALL_BOUNDARY){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_10K;
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
// switch to large range current
|
||||
// if(Real_Current > GAIN_MID_BOUNDARY2 || Real_Current < -1*GAIN_MID_BOUNDARY2){
|
||||
// INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
// ReadCurrent(spi_ADC_rxbuf);
|
||||
// Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
// }
|
||||
}
|
||||
// switch to large range current
|
||||
if(Real_Current > GAIN_MID_BOUNDARY2 || Real_Current < -1*GAIN_MID_BOUNDARY2){
|
||||
GAIN_200R_counter++;
|
||||
if(GAIN_200R_counter > 5){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
GAIN_200R_counter = 0;
|
||||
}
|
||||
|
||||
}else{
|
||||
GAIN_10K_counter++;
|
||||
if(GAIN_10K_counter > 5){
|
||||
INSTRUCTION.ADCGainLevel = GAIN_10K;
|
||||
GAIN_10K_counter = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
if(GAIN_200R_counter > 0){
|
||||
GAIN_200R_counter--;
|
||||
}
|
||||
if(GAIN_10K_counter > 0){
|
||||
GAIN_10K_counter--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Real_Current;
|
||||
}
|
||||
|
||||
#define ReadADCVolt(x) ((x==0)? ReadVoutVolt(spi_ADC_rxbuf) : ReadVolt(spi_ADC_rxbuf))
|
||||
|
||||
#endif
|
||||
|
||||
+236
-117
@@ -2,119 +2,8 @@
|
||||
#ifndef ELITECCMODE
|
||||
#define ELITECCMODE
|
||||
|
||||
static void CCModeDACControl(CCMode *CC, int32_t IUC_Measure_Difference);
|
||||
|
||||
static int32_t CCModeReadCurrent(CCMode *CC){
|
||||
|
||||
static uint8_t VoltCurrentSwitch = 0;
|
||||
|
||||
CCModeDACEnable = 1; // This flag will control DAC working
|
||||
|
||||
// decode ADC value and put it into notify buffer
|
||||
// Use 5-th measure value as real-measure value
|
||||
// because some value in the begin are garbage
|
||||
if(VoltCurrentSwitch < 5){
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
VoltCurrentSwitch ++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 5){
|
||||
// read current
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
CC->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
CC->_MeasureData = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
VoltCurrentSwitch ++;
|
||||
}
|
||||
else if(VoltCurrentSwitch <10){
|
||||
// read volt
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
VoltCurrentSwitch++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 10){
|
||||
/** read battery voltage **/
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
CC->BatteryV = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
|
||||
// if Iin have a offset if current !=0
|
||||
CC->BatteryV = CC->BatteryV - (CC->value - CC_ZERO_POINT)*10/1e5; // I_set * 10R = V_Iin2GND (mA * ohm)
|
||||
VoltCurrentSwitch++;
|
||||
// NotifyReady = true;
|
||||
}
|
||||
else{
|
||||
VoltCurrentSwitch = 0;
|
||||
}
|
||||
NotifyVolt[0] = (uint8_t) (CC->BatteryV >> 24);
|
||||
NotifyVolt[1] = (uint8_t) ((CC->BatteryV & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t) ((CC->BatteryV & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t) (CC->BatteryV & 0x000000FF);
|
||||
return CC->_MeasureData;
|
||||
}
|
||||
|
||||
static int32_t CCModeVoltOut(CCMode *CC){
|
||||
int32_t IUCCurrent = 0;
|
||||
|
||||
if(!CCModeDACEnable){
|
||||
// DAC should not work now
|
||||
return 0;
|
||||
}
|
||||
IUCCurrent = CC->_Transform2RealnA( (struct CCModePara *) CC);
|
||||
|
||||
CCModeDACControl(CC, IUCCurrent - CC->_MeasureData);
|
||||
|
||||
CCModeDACEnable = 0;
|
||||
return CC->_MeasureData;
|
||||
}
|
||||
|
||||
static void CCModeDACControl(CCMode *CC, int32_t IUC_Measure_Difference){
|
||||
int32_t step;
|
||||
|
||||
if(IUC_Measure_Difference < 300 && IUC_Measure_Difference > -300){
|
||||
step = 0;
|
||||
}
|
||||
else if( CC->Charge && CC->BatteryV >= ( (int32_t) (CC->VMax - DAC_ZERO)/5 ) ){
|
||||
CC->value = 0;
|
||||
step = (IUC_Measure_Difference > 0) ? 1:-1;
|
||||
}
|
||||
else if( (!CC->Charge) && CC->BatteryV <= ( (int32_t) (CC->VMin - DAC_ZERO)/5 ) ){
|
||||
// Ignore VMin condition
|
||||
if(CC->Done < 25000){
|
||||
CC->Done ++;
|
||||
step = (IUC_Measure_Difference > 0) ? 2:-2;
|
||||
}
|
||||
// after ignore few second, active VMin condition
|
||||
else{
|
||||
CC->value = 0;
|
||||
step = (IUC_Measure_Difference > 0) ? 1:-1;
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
step = (IUC_Measure_Difference > 0) ? 1:-1;
|
||||
}
|
||||
// over/under flow
|
||||
if( (INSTRUCTION.VoltConstant + step) > MAX_DAC_UC || (INSTRUCTION.VoltConstant + step) < MIN_DAC_UC ){
|
||||
if(step > 0){
|
||||
INSTRUCTION.VoltConstant = (INSTRUCTION.VoltConstant + MAX_DAC_UC)/2;
|
||||
}
|
||||
else{
|
||||
INSTRUCTION.VoltConstant = (INSTRUCTION.VoltConstant + MIN_DAC_UC)/2;
|
||||
}
|
||||
}
|
||||
else{
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant + step;
|
||||
}
|
||||
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
|
||||
// step = CC->Done;
|
||||
// NotifyImpedance[0] = (uint8_t) (step >> 24);
|
||||
// NotifyImpedance[1] = (uint8_t) ((step & 0x00FF0000) >> 16);
|
||||
// NotifyImpedance[2] = (uint8_t) ((step & 0x0000FF00) >> 8);
|
||||
// NotifyImpedance[3] = (uint8_t) (step & 0x000000FF);
|
||||
}
|
||||
#define Vset INSTRUCTION.Vset
|
||||
#define DELTAVOLTMAX 100000
|
||||
|
||||
/* Transform setting CC into IUC
|
||||
*
|
||||
@@ -122,11 +11,241 @@ static void CCModeDACControl(CCMode *CC, int32_t IUC_Measure_Difference){
|
||||
* Real current value : -15.00000 ~ 15.00000 mA
|
||||
* => user code = 1500000 mapping to 0.00000 mA
|
||||
*/
|
||||
static void CCCurrent2IUC(CCMode *CC){
|
||||
int32_t CurrentValue = 0;
|
||||
static void CC_Plot(WorkMode *WorkModeData){
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IT
|
||||
break;
|
||||
}
|
||||
case VT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->VT
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->RT
|
||||
break;
|
||||
}
|
||||
case IV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IV
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->CV
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
#define CURRENT_MODE WorkModeData->CC
|
||||
break;
|
||||
}
|
||||
case CYCLIC_VOLTAMMETRY:{
|
||||
#define CURRENT_MODE WorkModeData->CV3
|
||||
break;
|
||||
}
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:{
|
||||
#define CURRENT_MODE WorkModeData->LSV
|
||||
break;
|
||||
}
|
||||
case CONSTANT_VSCAN:{
|
||||
#define CURRENT_MODE WorkModeData->CVSCAN
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CC->value = INSTRUCTION.ConstantCurrent;
|
||||
CurrentValue = CC->value - CC_ZERO_POINT;
|
||||
static uint8_t ADCSwitch = 0;
|
||||
static uint8_t BatSwitch = 0;
|
||||
static int32_t VoltData = 0;
|
||||
|
||||
if(batteryCheck_flag){
|
||||
if(ADCSwitch == 0){
|
||||
if(BatSwitch == 0){ /**read Iin(buffer),read bat**/
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
CURRENT_MODE->_measureCurrent = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
AutoGainChange(CURRENT_MODE->_measureCurrent);
|
||||
}else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
CURRENT_MODE->_measureCurrent = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
InputNotify(NOTIFY_CURRENT, CURRENT_MODE->_measureCurrent);
|
||||
DACenable(WorkModeData, VoltData, AFTER_READ_I);
|
||||
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 1){
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 2){
|
||||
headstage_battery_volt();
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
batteryCheck_flag = false;
|
||||
BatSwitch = 0;
|
||||
ADCSwitch = 3;
|
||||
}
|
||||
}
|
||||
else if(ADCSwitch == 1 || ADCSwitch == 3){
|
||||
if(BatSwitch == 0){ /**read Bat**/
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 1){
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 2){
|
||||
headstage_battery_volt();
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
batteryCheck_flag = false;
|
||||
BatSwitch = 0;
|
||||
ADCSwitch = 3;
|
||||
}
|
||||
}
|
||||
else if(ADCSwitch == 2){
|
||||
if(BatSwitch == 0){ /**read V(buffer),read bat**/
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
if(CURRENT_MODE->_VoViSwitch == 0x01){
|
||||
CURRENT_MODE->_measureVin = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
VoltData = CURRENT_MODE->_measureVin;
|
||||
}else if(CURRENT_MODE->_VoViSwitch == 0x00){
|
||||
CURRENT_MODE->_measureVout = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_DAC, spi_ADC_rxbuf);
|
||||
VoltData = CURRENT_MODE->_measureVout;
|
||||
}
|
||||
InputNotify(NOTIFY_VOLT, VoltData);
|
||||
DACenable(WorkModeData, VoltData, AFTER_READ_V);
|
||||
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 1){
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 2){
|
||||
headstage_battery_volt();
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
batteryCheck_flag = false;
|
||||
BatSwitch = 0;
|
||||
ADCSwitch = 3;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
BatSwitch = 0;
|
||||
if(ADCSwitch == 0){ /**read Iin(buffer),read V**/
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
CURRENT_MODE->_measureCurrent = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
AutoGainChange(CURRENT_MODE->_measureCurrent);
|
||||
}else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
CURRENT_MODE->_measureCurrent = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
|
||||
InputNotify(NOTIFY_CURRENT, CURRENT_MODE->_measureCurrent);
|
||||
|
||||
DACenable(WorkModeData, VoltData, AFTER_READ_I);
|
||||
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 1){ /**read V**/
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 2){ /**read V(buffer),read Iin**/
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
if(CURRENT_MODE->_VoViSwitch == 0x01 || CURRENT_MODE->_VoViSwitch == 0x02){
|
||||
CURRENT_MODE->_measureVin = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
VoltData = CURRENT_MODE->_measureVin;
|
||||
}else if(CURRENT_MODE->_VoViSwitch == 0x00){
|
||||
CURRENT_MODE->_measureVout = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_DAC, spi_ADC_rxbuf);
|
||||
VoltData = CURRENT_MODE->_measureVout;
|
||||
}
|
||||
|
||||
if(INSTRUCTION.VoViSwitch == 0x02){
|
||||
int32_t Vscan = (Vset / 200 - CURRENT_MODE->_measureVin);
|
||||
Vscan = (int32_t)(Vscan);//[1uV]
|
||||
InputNotify(NOTIFY_VOLT, Vscan);
|
||||
}else{
|
||||
InputNotify(NOTIFY_VOLT, VoltData);
|
||||
}
|
||||
|
||||
DACenable(WorkModeData, VoltData, AFTER_READ_V);
|
||||
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 3){ /**read Iin**/
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ADCSwitch = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#undef CURRENT_MODE
|
||||
}
|
||||
|
||||
static void CC_Vscan(CCMode *CC){
|
||||
static int32_t Iin = 0;
|
||||
static int32_t deltaI = 0;
|
||||
static int32_t deltaV = 0;
|
||||
uint16_t divisionRate;
|
||||
|
||||
if(vscanReset){
|
||||
Vset = 0;
|
||||
|
||||
if(CC->_charge == 0){
|
||||
CC->_Iset *= -1;
|
||||
}
|
||||
|
||||
Iin = CC->_measureCurrent * 20; //[50pA] nA => 50pA
|
||||
deltaI = Iin - CC->_Iset;
|
||||
|
||||
if(deltaI > 20000000 || deltaI < -20000000){ //1mA
|
||||
divisionRate = 1000;
|
||||
}else{
|
||||
divisionRate = 10;
|
||||
}
|
||||
|
||||
deltaV = -1 * (deltaI / divisionRate); //-5 * deltaI / 5000 //pV=> 5nV
|
||||
|
||||
if(deltaV > DELTAVOLTMAX){ //100000 = 500uV
|
||||
deltaV = DELTAVOLTMAX;
|
||||
}else if(deltaV < (-DELTAVOLTMAX)){
|
||||
deltaV = (-DELTAVOLTMAX);
|
||||
}
|
||||
|
||||
Vset = Vset + deltaV; //[5nV]
|
||||
|
||||
if(Vset <= CC->_Vmin){
|
||||
Vset = CC->_Vmin;
|
||||
}else if(Vset >= CC->_Vmax){
|
||||
Vset = CC->_Vmax;
|
||||
}
|
||||
}
|
||||
|
||||
if(!vscanReset){
|
||||
Iin = CC->_measureCurrent * 20; //[50pA] nA => 50pA
|
||||
deltaI = Iin - CC->_Iset;
|
||||
|
||||
if(deltaI > 20000000 || deltaI < -20000000){ //1mA
|
||||
divisionRate = 1000;
|
||||
}else{
|
||||
divisionRate = 10;
|
||||
}
|
||||
|
||||
deltaV = -1 * (deltaI / divisionRate); //-5 * deltaI / 5000 //pV=> 5nV
|
||||
|
||||
if(deltaV > DELTAVOLTMAX){ //100000 = 500uV
|
||||
deltaV = DELTAVOLTMAX;
|
||||
}else if(deltaV < (-DELTAVOLTMAX)){
|
||||
deltaV = (-DELTAVOLTMAX);
|
||||
}
|
||||
|
||||
Vset = Vset + deltaV; //[5nV]
|
||||
|
||||
if(Vset <= CC->_Vmin){
|
||||
Vset = CC->_Vmin;
|
||||
}else if(Vset >= CC->_Vmax){
|
||||
Vset = CC->_Vmax;
|
||||
}
|
||||
}
|
||||
// int32_t RealV;
|
||||
// RealV = (int32_t)(deltaV);
|
||||
// InputNotify(NOTIFY_IMPEDANCE, RealV);
|
||||
}
|
||||
#endif
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
#ifndef ELITECV3
|
||||
#define ELITECV3
|
||||
|
||||
#define Vset INSTRUCTION.Vset
|
||||
|
||||
static uint16_t CV3Curve(CV3Mode *CV3){
|
||||
static uint16_t DACOutCode;
|
||||
static int32_t Vin;
|
||||
static int32_t Vout;
|
||||
static int32_t DeltaVout;
|
||||
|
||||
Vin = CV3->_measureVin * 200;//[5nV]
|
||||
if(DACReset){
|
||||
Vout = Vset + Vin;
|
||||
DACReset = false;
|
||||
}else{
|
||||
DeltaVout = Vset - (Vout - Vin);
|
||||
Vout = Vout + DeltaVout;
|
||||
}
|
||||
|
||||
INSTRUCTION.VoltConstant = Vout / 40000 + 25000;//5nV=>usercode
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
|
||||
int32_t RealV2;
|
||||
RealV2 = (int32_t)((Vout - Vin) / 200);//[1uV]
|
||||
InputNotify(NOTIFY_VOLT, RealV2);
|
||||
|
||||
int32_t RealV;
|
||||
RealV = (int32_t)(Vout / 200);//[1uV]
|
||||
InputNotify(NOTIFY_IMPEDANCE, RealV);
|
||||
|
||||
DAC_outputV(DACOutCode);
|
||||
|
||||
return DACOutCode;
|
||||
}
|
||||
|
||||
static void CV3_Vscan(CV3Mode *CV3){
|
||||
static int16_t VminCounter;
|
||||
static int16_t VmaxCounter;
|
||||
static uint16_t CycleCounter;
|
||||
|
||||
NotifyCycleNumber = (INSTRUCTION.cycleNumber - CV3->_cycleNumber + 1);
|
||||
|
||||
if(vscanReset){
|
||||
VmaxCounter = 0;
|
||||
VminCounter = 0;
|
||||
CycleCounter = 0;
|
||||
|
||||
if(INSTRUCTION.directionInit == 1){
|
||||
CV3->_direction_up = true;
|
||||
CV3->_current_direction_up = true;
|
||||
}else{
|
||||
CV3->_direction_up = false;
|
||||
CV3->_current_direction_up = false;
|
||||
}
|
||||
|
||||
//Vsetp = x * 20 * N, x=xmV ; N=VscanRate
|
||||
if(INSTRUCTION.step <= 10){
|
||||
CV3->_Vstep = INSTRUCTION.step * INSTRUCTION.VsetRate / 5;
|
||||
}else{
|
||||
CV3->_Vstep = INSTRUCTION.step / 5 * INSTRUCTION.VsetRate;
|
||||
}
|
||||
|
||||
if(CV3->_Vmin == CV3->_Vinit){
|
||||
VminCounter = -1;
|
||||
}
|
||||
if(CV3->_Vmax == CV3->_Vinit){
|
||||
VmaxCounter = -1;
|
||||
}
|
||||
|
||||
Vset = CV3->_Vinit;
|
||||
}
|
||||
|
||||
if(!vscanReset){
|
||||
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 (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
|
||||
}
|
||||
}
|
||||
// int32_t RealV;
|
||||
// RealV = (int32_t)(Vset / 500);//[1uV]
|
||||
// InputNotify(NOTIFY_VOLT, RealV);
|
||||
}
|
||||
#endif
|
||||
+78
-261
@@ -10,9 +10,9 @@ static uint16_t SWVCurve(WorkMode *WorkModeData) {
|
||||
|
||||
// reset origin volt at the begin
|
||||
if (DACReset) {
|
||||
Volt = INSTRUCTION.VoltOrigin;
|
||||
outputV = INSTRUCTION.VoltOrigin;
|
||||
if (INSTRUCTION.VoltOrigin < INSTRUCTION.VoltFinal)
|
||||
Volt = INSTRUCTION.Ve1;
|
||||
outputV = INSTRUCTION.Ve1;
|
||||
if (INSTRUCTION.Ve1 < INSTRUCTION.Ve2)
|
||||
direction_up = true;
|
||||
else
|
||||
direction_up = false;
|
||||
@@ -32,7 +32,7 @@ static uint16_t SWVCurve(WorkMode *WorkModeData) {
|
||||
// VoltValue = (ramp1*16 + ramp0/16) * 3.05;
|
||||
|
||||
// check if we reach the final volt
|
||||
if ((outputV >= INSTRUCTION.VoltFinal && direction_up) || (outputV <= INSTRUCTION.VoltFinal && !direction_up)) {
|
||||
if ((outputV >= INSTRUCTION.Ve2 && direction_up) || (outputV <= INSTRUCTION.Ve2 && !direction_up)) {
|
||||
PeriodicEvent = false;
|
||||
DACReset = true;
|
||||
}
|
||||
@@ -42,14 +42,14 @@ static uint16_t SWVCurve(WorkMode *WorkModeData) {
|
||||
if (counter == PulseWidth)
|
||||
Volt = Volt + Amplitude;
|
||||
else if (counter == 2 * PulseWidth)
|
||||
Volt = Volt - (Amplitude - INSTRUCTION.Step);
|
||||
Volt = Volt - (Amplitude - INSTRUCTION.step);
|
||||
else
|
||||
Volt = Volt;
|
||||
} else {
|
||||
if (counter == PulseWidth)
|
||||
Volt = Volt - Amplitude;
|
||||
else if (counter == 2 * PulseWidth)
|
||||
Volt = Volt + (Amplitude - INSTRUCTION.Step);
|
||||
Volt = Volt + (Amplitude - INSTRUCTION.step);
|
||||
else
|
||||
Volt = Volt;
|
||||
}
|
||||
@@ -66,16 +66,16 @@ static uint16_t DPVCurve(WorkMode *WorkModeData) {
|
||||
|
||||
// reset origin volt at the begin
|
||||
if (DACReset) {
|
||||
if (INSTRUCTION.VoltOrigin < INSTRUCTION.VoltFinal)
|
||||
if (INSTRUCTION.Ve1 < INSTRUCTION.Ve2)
|
||||
direction_up = true;
|
||||
else
|
||||
direction_up = false;
|
||||
|
||||
Volt1 = INSTRUCTION.VoltOrigin;
|
||||
Volt1 = INSTRUCTION.Ve1;
|
||||
if (direction_up)
|
||||
Volt2 = INSTRUCTION.VoltOrigin + Amplitude;
|
||||
Volt2 = INSTRUCTION.Ve1 + Amplitude;
|
||||
else
|
||||
Volt2 = INSTRUCTION.VoltOrigin - Amplitude;
|
||||
Volt2 = INSTRUCTION.Ve1 - Amplitude;
|
||||
|
||||
counter = 1;
|
||||
DACReset = false;
|
||||
@@ -99,30 +99,30 @@ static uint16_t DPVCurve(WorkMode *WorkModeData) {
|
||||
// VoltValue = (ramp1*16 + ramp0/16) * 3.05;
|
||||
|
||||
// check if we reach the final volt
|
||||
if (((outputV >= INSTRUCTION.VoltFinal) && direction_up) || ((outputV <= INSTRUCTION.VoltFinal) && !direction_up)) {
|
||||
if (((outputV >= INSTRUCTION.Ve2) && direction_up) || ((outputV <= INSTRUCTION.Ve2) && !direction_up)) {
|
||||
PeriodicEvent = false;
|
||||
DACReset = true;
|
||||
}
|
||||
|
||||
// check overflow/underflow and prepare for next output
|
||||
if (direction_up) {
|
||||
if (Volt1 + INSTRUCTION.Step < Volt1)
|
||||
if (Volt1 + INSTRUCTION.step < Volt1)
|
||||
Volt1 = 0xffff;
|
||||
else
|
||||
Volt1 = Volt1 + INSTRUCTION.Step;
|
||||
if (Volt2 + INSTRUCTION.Step < Volt2)
|
||||
Volt1 = Volt1 + INSTRUCTION.step;
|
||||
if (Volt2 + INSTRUCTION.step < Volt2)
|
||||
Volt2 = 0xffff;
|
||||
else
|
||||
Volt2 = Volt2 + INSTRUCTION.Step;
|
||||
Volt2 = Volt2 + INSTRUCTION.step;
|
||||
} else {
|
||||
if (Volt1 - INSTRUCTION.Step > Volt1)
|
||||
if (Volt1 - INSTRUCTION.step > Volt1)
|
||||
Volt1 = 0x0000;
|
||||
else
|
||||
Volt1 = Volt1 - INSTRUCTION.Step;
|
||||
if (Volt2 - INSTRUCTION.Step > Volt2)
|
||||
Volt1 = Volt1 - INSTRUCTION.step;
|
||||
if (Volt2 - INSTRUCTION.step > Volt2)
|
||||
Volt2 = 0x0000;
|
||||
else
|
||||
Volt2 = Volt2 - INSTRUCTION.Step;
|
||||
Volt2 = Volt2 - INSTRUCTION.step;
|
||||
}
|
||||
|
||||
if (counter + 1 <= (PulsePeriod - PulseWidth)) {
|
||||
@@ -132,268 +132,85 @@ static uint16_t DPVCurve(WorkMode *WorkModeData) {
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t CVCurve(CVMode *CV) {
|
||||
static uint16_t DACOutCode;
|
||||
static bool direction_up; // direction_up = true, if Vfinal > Vorigin
|
||||
static bool current_direction_up; // current_direction_up = true, Vstep => positive. vice versa
|
||||
static void CV_Vscan(CVMode *CV){
|
||||
static int16_t VminCounter;
|
||||
static int16_t VmaxCounter;
|
||||
static uint16_t CycleCounter;
|
||||
|
||||
// reset origin volt at the begin
|
||||
if (DACReset) {
|
||||
DACUserCode = CV->_VOrigin;
|
||||
if (CV->_VStop > CV->_VOrigin) {
|
||||
direction_up = true;
|
||||
current_direction_up = true;
|
||||
} else {
|
||||
direction_up = false;
|
||||
current_direction_up = false;
|
||||
NotifyCycleNumber = (INSTRUCTION.cycleNumber - CV->_cycleNumber + 1);
|
||||
|
||||
if(vscanReset){
|
||||
VmaxCounter = 0;
|
||||
VminCounter = 0;
|
||||
CycleCounter = 0;
|
||||
|
||||
if(INSTRUCTION.directionInit == 1){
|
||||
CV->_direction_up = true;
|
||||
CV->_current_direction_up = true;
|
||||
}else if(INSTRUCTION.directionInit == 0){
|
||||
CV->_direction_up = false;
|
||||
CV->_current_direction_up = false;
|
||||
}
|
||||
|
||||
DACOutCode = Usercode_Correction_to_DAC(DACUserCode);
|
||||
DAC_outputV(DACOutCode); // output VOLT_ORIGIN
|
||||
DACReset = false;
|
||||
//Vsetp = x * 20 * N, x=xmV ; N=VscanRate
|
||||
if(INSTRUCTION.step <= 10){
|
||||
CV->_Vstep = INSTRUCTION.step * INSTRUCTION.VsetRate / 5;
|
||||
}else{
|
||||
CV->_Vstep = INSTRUCTION.step / 5 * INSTRUCTION.VsetRate;
|
||||
}
|
||||
|
||||
return DACOutCode;
|
||||
if(CV->_Vmin == CV->_Vinit){
|
||||
VminCounter = -1;
|
||||
}
|
||||
if(CV->_Vmax == CV->_Vinit){
|
||||
VmaxCounter = -1;
|
||||
}
|
||||
|
||||
Vset = CV->_Vinit;
|
||||
}
|
||||
|
||||
if (CT.StepTimeCounter == CV->_StepTime) {
|
||||
if(!vscanReset){
|
||||
if (Vset >= CV->_Vmax){
|
||||
VmaxCounter++;
|
||||
}else if (Vset <= CV->_Vmin){
|
||||
VminCounter++;
|
||||
}
|
||||
|
||||
// Decide next direction
|
||||
if (CV->_VoVi_Switch == 0x00){ //user see Vout
|
||||
if (direction_up) {
|
||||
if (DACUserCode >= CV->_VStop) {
|
||||
current_direction_up = false; // problem occurs when origin == 0000 final == ffff!!!!!!
|
||||
} else if (DACUserCode <= CV->_VOrigin) {
|
||||
current_direction_up = true;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
} else {
|
||||
if (DACUserCode <= CV->_VStop) {
|
||||
current_direction_up = true; // problem occurs when origin == 0000 final == ffff!!!!!!
|
||||
} else if (DACUserCode >= CV->_VOrigin) {
|
||||
current_direction_up = false;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
}
|
||||
if (CV->_current_direction_up){
|
||||
Vset = Vset + CV->_Vstep;
|
||||
}else{
|
||||
Vset = Vset - CV->_Vstep;
|
||||
}
|
||||
else if (CV->_VoVi_Switch == 0x01){ //user see Vin
|
||||
if (direction_up) {
|
||||
if (CV->MeasureVolt >= ((int32_t)(CV->_VStop) - DAC_ZERO)/5) {
|
||||
current_direction_up = false; // problem occurs when origin == 0000 final == ffff!!!!!!
|
||||
} else if (CV->MeasureVolt <= ((int32_t)(CV->_VOrigin) - DAC_ZERO)/5) {
|
||||
current_direction_up = true;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
} else {
|
||||
if (CV->MeasureVolt <= ((int32_t)(CV->_VStop) - DAC_ZERO)/5) {
|
||||
current_direction_up = true; // problem occurs when origin == 0000 final == ffff!!!!!!
|
||||
} else if (CV->MeasureVolt >= ((int32_t)(CV->_VOrigin) - DAC_ZERO)/5){
|
||||
current_direction_up = false;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (current_direction_up == true){
|
||||
LED_color(DARKLED, 255, 0, 0);
|
||||
}
|
||||
else if (current_direction_up == false){
|
||||
LED_color(DARKLED, 255, 0, 255);
|
||||
}
|
||||
|
||||
// Next output voltage
|
||||
if (CV->_VoVi_Switch == 0x00){
|
||||
if (direction_up) {
|
||||
if (current_direction_up) {
|
||||
// DACUserCode overflow ?
|
||||
if (DACUserCode + CV->_Step < DACUserCode) {
|
||||
DACUserCode = CV->_VStop;
|
||||
}
|
||||
// reach Vfinal ?
|
||||
else if (DACUserCode + CV->_Step > CV->_VStop) {
|
||||
DACUserCode =CV->_VStop;
|
||||
}
|
||||
else {
|
||||
DACUserCode = DACUserCode + CV->_Step;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// DACUserCode underflow ?
|
||||
if (DACUserCode - CV->_Step > DACUserCode) {
|
||||
DACUserCode = CV->_VOrigin;
|
||||
}
|
||||
|
||||
// reach Vorigin ?
|
||||
else if (DACUserCode - CV->_Step < CV->_VOrigin) {
|
||||
DACUserCode = CV->_VOrigin;
|
||||
}
|
||||
else {
|
||||
DACUserCode = DACUserCode - CV->_Step;
|
||||
if(VmaxCounter != 0 && VminCounter != 0){
|
||||
if(VmaxCounter == VminCounter && CV->_direction_up && CV->_current_direction_up){
|
||||
if(CycleCounter != VmaxCounter){
|
||||
if(Vset >= CV->_Vinit){
|
||||
CV->_cycleNumber--;
|
||||
CycleCounter = VmaxCounter; //VmaxCounter = VminCounter = CycleCounter
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (current_direction_up) {
|
||||
if (DACUserCode + CV->_Step < DACUserCode) {
|
||||
DACUserCode = CV->_VOrigin;
|
||||
}
|
||||
else if (DACUserCode + CV->_Step > CV->_VOrigin) {
|
||||
DACUserCode = CV->_VOrigin;
|
||||
}
|
||||
else {
|
||||
DACUserCode = DACUserCode + CV->_Step;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (DACUserCode - CV->_Step > DACUserCode) {
|
||||
DACUserCode = CV->_VStop ;
|
||||
}
|
||||
else if (DACUserCode - CV->_Step < CV->_VStop) {
|
||||
DACUserCode = CV->_VStop;
|
||||
}
|
||||
else {
|
||||
DACUserCode = DACUserCode - CV->_Step;
|
||||
if(VmaxCounter == VminCounter && !CV->_direction_up && !CV->_current_direction_up){
|
||||
if(CycleCounter != VmaxCounter){
|
||||
if(Vset <= CV->_Vinit){
|
||||
CV->_cycleNumber--;
|
||||
CycleCounter = VmaxCounter; //VmaxCounter = VminCounter = CycleCounter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (CV->_VoVi_Switch == 0x01){
|
||||
if (direction_up) {
|
||||
if (current_direction_up) {
|
||||
// DACUserCode overflow ?
|
||||
if (DACUserCode + CV->_Step < DACUserCode) {
|
||||
DACUserCode = CV->_VStop;
|
||||
}
|
||||
// reach Vfinal ?
|
||||
else if (CV->MeasureVolt + ((int32_t)(CV->_Step) - DAC_ZERO)/5 > ((int32_t)(CV->_VStop) - DAC_ZERO)/5) {
|
||||
DACUserCode =CV->_VStop;
|
||||
}
|
||||
else {
|
||||
DACUserCode = DACUserCode + CV->_Step;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// DACUserCode underflow ?
|
||||
if (DACUserCode - CV->_Step > DACUserCode) {
|
||||
DACUserCode = CV->_VOrigin;
|
||||
}
|
||||
|
||||
// reach Vorigin ?
|
||||
else if (CV->MeasureVolt - ((int32_t)(CV->_Step) - DAC_ZERO)/5 < ((int32_t)(CV->_VOrigin) - DAC_ZERO)/5) {
|
||||
DACUserCode = CV->_VOrigin;
|
||||
}
|
||||
else {
|
||||
DACUserCode = DACUserCode - CV->_Step;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (current_direction_up) {
|
||||
if (DACUserCode + CV->_Step < DACUserCode) {
|
||||
DACUserCode = CV->_VOrigin;
|
||||
}
|
||||
else if (CV->MeasureVolt + ((int32_t)(CV->_Step) - DAC_ZERO)/5 > ((int32_t)(CV->_VOrigin) - DAC_ZERO)/5) {
|
||||
DACUserCode = CV->_VOrigin;
|
||||
}
|
||||
else {
|
||||
DACUserCode = DACUserCode + CV->_Step;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (DACUserCode - CV->_Step > DACUserCode) {
|
||||
DACUserCode = CV->_VStop ;
|
||||
}
|
||||
else if (CV->MeasureVolt - ((int32_t)(CV->_Step) - DAC_ZERO)/5 < ((int32_t)(CV->_VStop) - DAC_ZERO)/5) {
|
||||
DACUserCode = CV->_VStop;
|
||||
}
|
||||
else {
|
||||
DACUserCode = DACUserCode - CV->_Step;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Vset >= CV->_Vmax){
|
||||
CV->_current_direction_up = false;
|
||||
}else if (Vset <= CV->_Vmin){
|
||||
CV->_current_direction_up = true;
|
||||
}
|
||||
|
||||
DACOutCode = Usercode_Correction_to_DAC(DACUserCode);
|
||||
DAC_outputV(DACOutCode);
|
||||
}
|
||||
return DACOutCode;
|
||||
}
|
||||
|
||||
static void CV_Plot(CVMode *CV){
|
||||
static uint8_t PreviousGain = GAIN_200R;
|
||||
|
||||
static uint8_t VoltCurrentSwitch = 0;
|
||||
uint16_t ADC_measure = 0;
|
||||
|
||||
if(VoltCurrentSwitch < 5){
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
VoltCurrentSwitch ++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 5){
|
||||
// read current
|
||||
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
CV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
if(PreviousGain != INSTRUCTION.ADCGainLevel){
|
||||
PreviousGain = INSTRUCTION.ADCGainLevel;
|
||||
CV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
CV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
if(PreviousGain != INSTRUCTION.ADCGainLevel){
|
||||
PreviousGain = INSTRUCTION.ADCGainLevel;
|
||||
CV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
CV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
/*stop condition*/
|
||||
if(CV->_cycleNumber == 0){
|
||||
reset();
|
||||
}
|
||||
else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
CV->_MeasureData = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
VoltCurrentSwitch ++;
|
||||
}
|
||||
else if(VoltCurrentSwitch < 9){
|
||||
// read volt
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
VoltCurrentSwitch++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 9){
|
||||
/** read battery voltage **/
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
ADC_measure = (uint16_t) (spi_ADC_rxbuf[0] << 8) | (uint16_t) (spi_ADC_rxbuf[1]);
|
||||
//CV->MeasureVolt = 20000;
|
||||
CV->MeasureVolt = DecodeADCVolt(ADC_measure);
|
||||
VoltCurrentSwitch++;
|
||||
}
|
||||
else{
|
||||
VoltCurrentSwitch = 0;
|
||||
}
|
||||
|
||||
NotifyCurrent[0] = (uint8_t) (CV->_MeasureData >> 24);
|
||||
NotifyCurrent[1] = (uint8_t) ((CV->_MeasureData & 0x00FF0000) >> 16);
|
||||
NotifyCurrent[2] = (uint8_t) ((CV->_MeasureData & 0x0000FF00) >> 8);
|
||||
NotifyCurrent[3] = (uint8_t) (CV->_MeasureData & 0x000000FF);
|
||||
|
||||
if (CV->_VoVi_Switch == 0x01){ //user see Vin
|
||||
NotifyVolt[0] = (uint8_t) (CV->MeasureVolt >> 24);
|
||||
NotifyVolt[1] = (uint8_t) ((CV->MeasureVolt & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t) ((CV->MeasureVolt & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t) (CV->MeasureVolt & 0x000000FF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#ifndef ELITECVSCAN
|
||||
#define ELITECVSCAN
|
||||
|
||||
#define Vset INSTRUCTION.Vset
|
||||
|
||||
static uint16_t CVSCANCurve(CVSCANMode *CVSCAN){
|
||||
static uint16_t DACOutCode;
|
||||
static int32_t Vin;
|
||||
static int32_t Vout;
|
||||
static int32_t DeltaVout;
|
||||
|
||||
Vin = CVSCAN->_measureVin * 200;//[5nV]
|
||||
if(DACReset){
|
||||
Vout = Vset + Vin;
|
||||
DACReset = false;
|
||||
}else{
|
||||
DeltaVout = Vset - (Vout - Vin);
|
||||
Vout = Vout + DeltaVout;
|
||||
}
|
||||
|
||||
INSTRUCTION.VoltConstant = Vout / 40000 + 25000;//5nV=>usercode
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
|
||||
int32_t RealV2;
|
||||
RealV2 = (int32_t)((Vout - Vin) / 200);//[1uV]
|
||||
InputNotify(NOTIFY_VOLT, RealV2);
|
||||
|
||||
int32_t RealV;
|
||||
RealV = (int32_t)(Vout / 200);//[1uV]
|
||||
InputNotify(NOTIFY_IMPEDANCE, RealV);
|
||||
|
||||
DAC_outputV(DACOutCode);
|
||||
|
||||
return DACOutCode;
|
||||
}
|
||||
|
||||
static void CVSCAN_Vscan(CVSCANMode *CVSCAN){
|
||||
|
||||
if(vscanReset){
|
||||
Vset = CVSCAN->_Vinit;
|
||||
}
|
||||
|
||||
if(!vscanReset){
|
||||
Vset = CVSCAN->_Vinit;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+1
-1
@@ -59,7 +59,7 @@ static uint16_t DAC_outputV(uint16_t voltLV) {
|
||||
|
||||
static int32_t User2Real(uint16_t UserCode){
|
||||
/* transfer usercode to real voltage value (mV) */
|
||||
return (int32_t) ((UserCode - 25000)*2)/10;
|
||||
return (int32_t)((UserCode - 25000) / 5);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+1537
-97
File diff suppressed because it is too large
Load Diff
+31
-9
@@ -2,6 +2,27 @@
|
||||
#ifndef ELITE_FLAG_CT_INIT
|
||||
#define ELITE_FLAG_CT_INIT
|
||||
|
||||
// CT counter
|
||||
struct _CT{
|
||||
uint32_t SampleRate_counter;
|
||||
uint16_t StepTimeCounter;
|
||||
uint16_t NotifyCounter;
|
||||
uint32_t StandByCounter;
|
||||
}CT = {0};
|
||||
|
||||
// GPT counter
|
||||
struct _GPT{
|
||||
uint32_t GptimerCounter;
|
||||
uint32_t GptimerCounter0;
|
||||
uint8_t DeltaGptimerCounter;
|
||||
uint32_t SampleRateCounter;
|
||||
uint32_t NotifyCounter;
|
||||
uint32_t VscanRateCounter;
|
||||
uint32_t LeadTimeCounter;
|
||||
uint32_t BatteryADCCounter;
|
||||
uint32_t BatteryCheckCounter;
|
||||
}GPT = {0};
|
||||
|
||||
static void InitCT(){
|
||||
CT.SampleRate_counter = 1;
|
||||
CT.StepTimeCounter = 1;
|
||||
@@ -9,14 +30,15 @@ static void InitCT(){
|
||||
CT.StandByCounter = 0;
|
||||
}
|
||||
|
||||
static void InitFlag(){
|
||||
PeriodicEvent = false; // is there an PeriodicEvent?
|
||||
InitPeriodicEvent = true; // need to create a WorkModeData?
|
||||
DACReset = true;
|
||||
CCModeDACEnable = 0; // to make sure DAC work after ADC
|
||||
Free_Work_Mode = true; // Free(WorkModeData)
|
||||
// NotifyReady = false;
|
||||
// DiscardIVFirstData = 0;
|
||||
static void InitGPT(){
|
||||
GPT.GptimerCounter = 0;
|
||||
GPT.GptimerCounter0 = 0;
|
||||
GPT.DeltaGptimerCounter = 0;
|
||||
GPT.SampleRateCounter = 0;
|
||||
GPT.NotifyCounter = 0;
|
||||
GPT.VscanRateCounter = 0;
|
||||
GPT.LeadTimeCounter = 0;
|
||||
GPT.BatteryADCCounter = 0;
|
||||
GPT.BatteryCheckCounter = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ static void elite_gptimer_callback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_In
|
||||
#define elite_gptimer_start() GPTimerCC26XX_start(gptimer_handle)
|
||||
#define elite_gptimer_stop() GPTimerCC26XX_stop(gptimer_handle)
|
||||
#define elite_gptimer_close() GPTimerCC26XX_close(gptimer_handle)
|
||||
#define CLOCK_FREQ 4000 // clock freq = 0.1 ms
|
||||
#define CLOCK_FREQ 4800 // clock freq = 0.1 ms
|
||||
|
||||
#define elite_gptimer_open() \
|
||||
do { \
|
||||
|
||||
+68
-73
@@ -2,83 +2,78 @@
|
||||
#ifndef ELITEIT
|
||||
#define ELITEIT
|
||||
|
||||
#define absolute(a) ((a<0)? -a:a)
|
||||
|
||||
//static int32_t IT_Plot() {
|
||||
// // read ADC current
|
||||
// int32_t Real_Current = 0;
|
||||
// ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
// ADCChannelSelect(ADC_CH_CURRENT);
|
||||
// CPUdelay(10);
|
||||
// ADC_read(spi_ADC_rxbuf);
|
||||
//
|
||||
// // check if ADC over/under flow
|
||||
// // let the output saturate if over/under flow
|
||||
//// ADC_overflow(INSTRUCTION.ADCGainLevel, spi_ADC_rxbuf);
|
||||
//
|
||||
// // decode ADC value and put it into notify buffer
|
||||
// Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
//
|
||||
// return Real_Current;
|
||||
//}
|
||||
|
||||
static int32_t IT_Plot(WorkMode *WorkModeData) {
|
||||
|
||||
static void IT_Plot(WorkMode *WorkModeData) {
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IV
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->CV
|
||||
break;
|
||||
}
|
||||
case IT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IT
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
#define CURRENT_MODE WorkModeData->IT
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// read ADC current
|
||||
int32_t RealCurrent = 0, RealVolt = 0;
|
||||
static uint8_t PreviousGain = GAIN_200R;
|
||||
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
RealCurrent = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
if(PreviousGain != INSTRUCTION.ADCGainLevel){
|
||||
PreviousGain = INSTRUCTION.ADCGainLevel;
|
||||
CURRENT_MODE->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
CURRENT_MODE->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
case IT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IT
|
||||
break;
|
||||
}
|
||||
if(PreviousGain != INSTRUCTION.ADCGainLevel){
|
||||
PreviousGain = INSTRUCTION.ADCGainLevel;
|
||||
CURRENT_MODE->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
CURRENT_MODE->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
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: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
RealCurrent = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
|
||||
static uint8_t ADCSwitch = 0;
|
||||
|
||||
if(batteryCheck_flag){
|
||||
EliteADCBattery();
|
||||
if(!batteryCheck_flag){
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ADCSwitch = 2;
|
||||
}
|
||||
}else{
|
||||
if(ADCSwitch == 0){ /**read Iin(buffer)**/
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
CURRENT_MODE->_measureCurrent = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
AutoGainChange(CURRENT_MODE->_measureCurrent);
|
||||
}else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
CURRENT_MODE->_measureCurrent = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
InputNotify(NOTIFY_CURRENT, CURRENT_MODE->_measureCurrent);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 1){ /**read Iin**/
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 2){ /**read Iin**/
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ADCSwitch = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CURRENT_MODE->_MeasureData = RealCurrent;
|
||||
|
||||
|
||||
// if(INSTRUCTION.eliteFxn == IV_CURVE){
|
||||
// // RealVo = Vo - RealCurrent * 100R
|
||||
// RealVolt = (INSTRUCTION.VoltConstant - DAC_ZERO)/5 - 200*(RealCurrent/1e6);
|
||||
//
|
||||
// NotifyVolt[0] = (uint8_t) (RealVolt >> 24);
|
||||
// NotifyVolt[1] = (uint8_t) ((RealVolt & 0x00FF0000) >> 16);
|
||||
// NotifyVolt[2] = (uint8_t) ((RealVolt & 0x0000FF00) >> 8);
|
||||
// NotifyVolt[3] = (uint8_t) (RealVolt & 0x000000FF);
|
||||
// }
|
||||
return RealCurrent;
|
||||
#undef CURRENT_MODE
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+173
-147
@@ -2,182 +2,208 @@
|
||||
#ifndef ELITEIV
|
||||
#define ELITEIV
|
||||
|
||||
static uint16_t VoltScan(WorkMode *WorkModeData) {
|
||||
uint16_t Voltage;
|
||||
if (INSTRUCTION.VoltOrigin == INSTRUCTION.VoltFinal) {
|
||||
Voltage = Usercode_Correction_to_DAC(INSTRUCTION.VoltOrigin);
|
||||
DAC_outputV(Voltage);
|
||||
PeriodicEvent = false;
|
||||
return Voltage;
|
||||
} else if (INSTRUCTION.eliteFxn == SQUARE_WAVE_VOLTAMMETRY) {
|
||||
Voltage = SWVCurve(WorkModeData);
|
||||
} else if (INSTRUCTION.eliteFxn == DIFFERENTIAL_PULSE_VOLTAMMETRY) {
|
||||
Voltage = DPVCurve(WorkModeData);
|
||||
} else if (INSTRUCTION.eliteFxn == CV_CURVE) {
|
||||
Voltage = CVCurve(WorkModeData->CV);
|
||||
}
|
||||
#define Vset INSTRUCTION.Vset
|
||||
|
||||
// IV plot mode
|
||||
else {
|
||||
Voltage = OneWayVoltScan(WorkModeData->IV);
|
||||
static void DACenable(WorkMode *WorkModeData, int32_t VoltData ,uint8_t afterRead){
|
||||
if(afterRead == AFTER_READ_I){
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case CONSTANT_CURRENT:{
|
||||
CC_Vscan(WorkModeData->CC);
|
||||
OneWayVoltScan();
|
||||
break;
|
||||
}
|
||||
case IV_CURVE:
|
||||
case CV_CURVE:
|
||||
case ZT_CURVE:
|
||||
case IT_CURVE:
|
||||
case VT_CURVE:
|
||||
case CYCLIC_VOLTAMMETRY:
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:
|
||||
case CONSTANT_VSCAN:{
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else if(afterRead == AFTER_READ_V){
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IV_CURVE:
|
||||
case CV_CURVE:{
|
||||
OneWayVoltScan();
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
CalcuResistance(WorkModeData->RT, VoltData);
|
||||
break;
|
||||
}
|
||||
case IT_CURVE:
|
||||
case VT_CURVE:
|
||||
case CONSTANT_CURRENT:{
|
||||
break;
|
||||
}
|
||||
case CYCLIC_VOLTAMMETRY:{
|
||||
CV3Curve(WorkModeData->CV3);
|
||||
break;
|
||||
}
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:{
|
||||
LSVCurve(WorkModeData->LSV);
|
||||
break;
|
||||
}
|
||||
case CONSTANT_VSCAN:{
|
||||
CVSCANCurve(WorkModeData->CVSCAN);
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Voltage;
|
||||
}
|
||||
|
||||
static uint16_t OneWayVoltScan(IVMode *IV) {
|
||||
uint16_t DACOutCode;
|
||||
static void CalcuResistance(RTMode *RT, int32_t VoltData){
|
||||
/* Elite 100 = 100R
|
||||
Elite 1000 = 1KR
|
||||
Elite 10000 = 10KR
|
||||
Elite 100000 = 100KR
|
||||
Elite 1000000 = 1MR
|
||||
*/
|
||||
static int32_t resister_32 = 0;
|
||||
int32_t Vtemp;
|
||||
Vtemp = (VoltData * 1000) - (RT->_measureCurrent * 10); //V = Vin - Iin * 10
|
||||
resister_32 = Vtemp / RT->_measureCurrent; //R = V / Iin;
|
||||
InputNotify(NOTIFY_IMPEDANCE, resister_32);
|
||||
}
|
||||
|
||||
// reset origin volt at the begin
|
||||
if (DACReset) {
|
||||
// DACUserCode = IV->GetVOrigin((struct VoltOutPara *) IV);
|
||||
INSTRUCTION.VoltConstant = IV->_VOrigin;
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DACReset = false;
|
||||
static uint16_t OneWayVoltScan() {
|
||||
static uint16_t DACOutCode;
|
||||
static int32_t Vout;
|
||||
static int32_t DeltaVout;
|
||||
|
||||
// output VOLT_ORIGIN
|
||||
DAC_outputV(DACOutCode);
|
||||
return DACOutCode;
|
||||
if(DACReset){
|
||||
Vout = Vset;
|
||||
DACReset = false;
|
||||
}else{
|
||||
DeltaVout = Vset - (Vout);
|
||||
Vout = Vout + DeltaVout;
|
||||
}
|
||||
|
||||
if (CT.StepTimeCounter == IV->_StepTime){
|
||||
if (IV->_VOrigin < IV->_VStop) {
|
||||
// output the next output volt
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant + IV->_Step;
|
||||
// Only used in two-wire IV
|
||||
// if(INSTRUCTION.VoltConstant > IV->_VStop){
|
||||
// INSTRUCTION.VoltConstant = IV->_VStop;
|
||||
// }
|
||||
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DAC_outputV(DACOutCode);
|
||||
|
||||
// end IV task if we reach INSTRUCTION.VoltFinal
|
||||
// if (INSTRUCTION.VoltConstant >= IV->_VStop) {
|
||||
// PeriodicEvent = false;
|
||||
// DACReset = true;
|
||||
// }
|
||||
} else {
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant - IV->_Step;
|
||||
|
||||
// check if DACUserCode underflow
|
||||
if(INSTRUCTION.VoltConstant >= 60000){
|
||||
INSTRUCTION.VoltConstant = IV->_VStop;
|
||||
}
|
||||
|
||||
// output the next output volt
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DAC_outputV(DACOutCode);
|
||||
|
||||
// end IV task if we reach INSTRUCTION.VoltFinal
|
||||
// if (INSTRUCTION.VoltConstant <= IV->_VStop){
|
||||
// PeriodicEvent = false;
|
||||
// DACReset = true;
|
||||
//// reset();
|
||||
// }
|
||||
}
|
||||
if (IV->_VoVi_Switch == 0x00){ //user see Vout
|
||||
if (IV->_VOrigin < IV->_VStop) {
|
||||
if(INSTRUCTION.VoltConstant >= IV->_VStop){
|
||||
PeriodicEvent = false;
|
||||
DACReset = true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(INSTRUCTION.VoltConstant <= IV->_VStop){
|
||||
PeriodicEvent = false;
|
||||
DACReset = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
INSTRUCTION.VoltConstant = Vout / 40000 + 25000; //5nV=>usercode
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DAC_outputV(DACOutCode);
|
||||
|
||||
if ((INSTRUCTION.eliteFxn == IV_CURVE)||(INSTRUCTION.eliteFxn == CV_CURVE)||(INSTRUCTION.eliteFxn == CONSTANT_CURRENT)){
|
||||
int32_t RealV;
|
||||
RealV = DAC_to_realV(DACOutCode);
|
||||
NotifyVolt[0] = (uint8_t)((RealV & 0xFF000000) >> 24);
|
||||
NotifyVolt[1] = (uint8_t)((RealV & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t)((RealV & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t)(RealV & 0x000000FF);
|
||||
|
||||
RealV = (int32_t)(Vout / 200);//[1uV]
|
||||
InputNotify(NOTIFY_IMPEDANCE, RealV);
|
||||
}
|
||||
|
||||
|
||||
return DACOutCode;
|
||||
}
|
||||
|
||||
static void IV_Plot(IVMode *IV) {
|
||||
/**********************************************
|
||||
CURRENT_MODE->_VoViSwitch : 1 read Vin volt
|
||||
->_VoViSwitch : 0 read Vout volt
|
||||
|
||||
***********************************************/
|
||||
static uint8_t VoltCurrentSwitch = 0;
|
||||
static uint8_t PreviousGain = GAIN_200R;
|
||||
uint16_t ADC_measure = 0;
|
||||
|
||||
if(VoltCurrentSwitch < 5){
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
VoltCurrentSwitch ++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 5){
|
||||
if(VoltCurrentSwitch == 0){ /**read Iin(buffer),read Vin**/
|
||||
// read current
|
||||
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
IV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
if(PreviousGain != INSTRUCTION.ADCGainLevel){
|
||||
PreviousGain = INSTRUCTION.ADCGainLevel;
|
||||
IV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
IV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
if(PreviousGain != INSTRUCTION.ADCGainLevel){
|
||||
PreviousGain = INSTRUCTION.ADCGainLevel;
|
||||
IV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
IV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
}
|
||||
else{
|
||||
IV->_measureCurrent = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
AutoGainChange(IV->_measureCurrent);
|
||||
}else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
IV->_MeasureData = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
IV->_measureCurrent = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
VoltCurrentSwitch ++;
|
||||
}
|
||||
else if(VoltCurrentSwitch < 9){
|
||||
// read volt
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
|
||||
OneWayVoltScan();
|
||||
|
||||
InputNotify(NOTIFY_CURRENT, IV->_measureCurrent);
|
||||
|
||||
// read Volt
|
||||
if(IV->_VoViSwitch == 0x01){
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
}else if(IV->_VoViSwitch == 0x00){
|
||||
ReadVoutVolt(spi_ADC_rxbuf);
|
||||
}
|
||||
|
||||
VoltCurrentSwitch++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 9){
|
||||
/** read battery voltage **/
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
ADC_measure = (uint16_t) (spi_ADC_rxbuf[0] << 8) | (uint16_t) (spi_ADC_rxbuf[1]);
|
||||
IV->MeasureVolt = DecodeADCVolt(ADC_measure);
|
||||
else if(VoltCurrentSwitch == 1){ /**read Vin**/
|
||||
// read Volt
|
||||
if(IV->_VoViSwitch == 0x01){
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
}else if(IV->_VoViSwitch == 0x00){
|
||||
ReadVoutVolt(spi_ADC_rxbuf);
|
||||
}
|
||||
|
||||
VoltCurrentSwitch++;
|
||||
}
|
||||
else{
|
||||
else if(VoltCurrentSwitch == 2){ /**read Vin(buffer),read Iin**/
|
||||
// read Volt
|
||||
if(IV->_VoViSwitch == 0x01){
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
IV->_measureVin = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
}else if(IV->_VoViSwitch == 0x00){
|
||||
ReadVoutVolt(spi_ADC_rxbuf);
|
||||
IV->_measureVin = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_DAC, spi_ADC_rxbuf);
|
||||
}
|
||||
|
||||
InputNotify(NOTIFY_VOLT, IV->_measureVin);
|
||||
|
||||
// read current
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
|
||||
VoltCurrentSwitch++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 3){ /**read Iin**/
|
||||
// read current
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
|
||||
VoltCurrentSwitch = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NotifyCurrent[0] = (uint8_t) (IV->_MeasureData >> 24);
|
||||
NotifyCurrent[1] = (uint8_t) ((IV->_MeasureData & 0x00FF0000) >> 16);
|
||||
NotifyCurrent[2] = (uint8_t) ((IV->_MeasureData & 0x0000FF00) >> 8);
|
||||
NotifyCurrent[3] = (uint8_t) (IV->_MeasureData & 0x000000FF);
|
||||
|
||||
if (IV->_VoVi_Switch == 0x01){ //user see Vin
|
||||
NotifyVolt[0] = (uint8_t) (IV->MeasureVolt >> 24);
|
||||
NotifyVolt[1] = (uint8_t) ((IV->MeasureVolt & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t) ((IV->MeasureVolt & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t) (IV->MeasureVolt & 0x000000FF);
|
||||
|
||||
if (IV->_VOrigin < IV->_VStop) {
|
||||
if(IV->MeasureVolt >= ((int32_t) (IV->_VStop) - DAC_ZERO)/5){
|
||||
PeriodicEvent = false;
|
||||
DACReset = true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(IV->MeasureVolt <= ((int32_t) (IV->_VStop) - DAC_ZERO)/5){
|
||||
PeriodicEvent = false;
|
||||
DACReset = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void IV_Vscan(IVMode *IV){
|
||||
if(vscanReset){
|
||||
if(INSTRUCTION.directionInit == 1){
|
||||
IV->_direction_up = true;
|
||||
IV->_current_direction_up = true;
|
||||
}else if(INSTRUCTION.directionInit == 0){
|
||||
IV->_direction_up = false;
|
||||
IV->_current_direction_up = false;
|
||||
}
|
||||
|
||||
//Vsetp = x * 20 * N, x=xmV ; N=VscanRate
|
||||
if(INSTRUCTION.step <= 10){
|
||||
IV->_Vstep = INSTRUCTION.step * INSTRUCTION.VsetRate / 5;
|
||||
}else{
|
||||
IV->_Vstep = INSTRUCTION.step / 5 * INSTRUCTION.VsetRate;
|
||||
}
|
||||
|
||||
Vset = IV->_Vinit;
|
||||
}
|
||||
|
||||
if(!vscanReset){
|
||||
if(IV->_current_direction_up){
|
||||
if(Vset >= IV->_Vmax){
|
||||
reset();
|
||||
}
|
||||
}else{
|
||||
if(Vset <= IV->_Vmin){
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
if (IV->_current_direction_up){
|
||||
Vset = Vset + IV->_Vstep;
|
||||
}else{
|
||||
Vset = Vset - IV->_Vstep;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+50
-64
@@ -8,20 +8,8 @@
|
||||
#define GAIN_200R 0x02 // the least gain
|
||||
#define GAIN_AUTO 0x03
|
||||
|
||||
/** Resister meter **/
|
||||
#define RESISTER_METER_SMALL 0x00
|
||||
#define RESISTER_METER_MIDDLE1 0x01
|
||||
#define RESISTER_METER_MIDDLE2 0x02
|
||||
#define RESISTER_METER_LARGE 0x03
|
||||
|
||||
/** CC mode parameter **/
|
||||
// CurrentLV
|
||||
#define CURRENT_LV_NA 0x00
|
||||
#define CURRENT_LV_UA 0x01
|
||||
#define CURRENT_LV_MA 0x02
|
||||
|
||||
/* DAC reset parameter */
|
||||
#define DAC_ZERO 25000
|
||||
#define DAC_ZERO 25000
|
||||
#define DAC_POS_MAX 0x0000
|
||||
#define DAC_NEG_MAX 0xFFFF
|
||||
|
||||
@@ -34,48 +22,40 @@
|
||||
==== headstage instruction ====
|
||||
=============================*/
|
||||
struct HEADSTAGE_INSTRUCTION {
|
||||
/** chip ID */
|
||||
uint8_t chip_id;
|
||||
|
||||
/** Sample rate **/
|
||||
// SampleRate = SampleRateTable[SampleRateIndex]
|
||||
uint8_t SampleRateIndex;
|
||||
uint32_t SampleRate;
|
||||
uint8_t chip_id;
|
||||
uint8_t eliteFxn;
|
||||
|
||||
/** DAC parameter **/
|
||||
// volt san parameter
|
||||
uint16_t VoltOrigin;
|
||||
uint16_t VoltFinal;
|
||||
uint16_t Step;
|
||||
uint16_t StepTime;
|
||||
|
||||
// constant volt
|
||||
// which is used in CC mode as VMax and VMin
|
||||
uint8_t VsetRateIndex;
|
||||
uint32_t VsetRate;
|
||||
int32_t Vset;
|
||||
uint16_t VoltConstant;
|
||||
uint8_t directionInit;
|
||||
uint32_t step;
|
||||
uint16_t Ve1;
|
||||
uint16_t Ve2;
|
||||
int32_t Vinit;
|
||||
int32_t Vmax;
|
||||
int32_t Vmin;
|
||||
|
||||
/** ADC parameter **/
|
||||
uint8_t ADCGainLevel;
|
||||
|
||||
uint8_t AutoGainEnable;
|
||||
uint8_t sampleRateIndex;
|
||||
uint32_t sampleRate;
|
||||
uint8_t VoViSwitch;
|
||||
uint8_t AutoGainEnable;
|
||||
uint8_t ADCGainLevel;
|
||||
|
||||
/** Notify parameter **/
|
||||
uint16_t NotifyRate;
|
||||
uint32_t notifyRate;
|
||||
|
||||
/** Constant Current Parameter **/
|
||||
// Charge is a bool; true => current > 0, vice versa
|
||||
uint8_t Charge;
|
||||
int32_t ConstantCurrent;
|
||||
uint16_t VoltLimit;
|
||||
/** mode parameter **/
|
||||
uint16_t cycleNumber;
|
||||
uint8_t charge;
|
||||
int32_t constantCurrent;
|
||||
int32_t Currentmax;
|
||||
|
||||
/** Resister Measure **/
|
||||
uint8_t ResisterMeter;
|
||||
|
||||
// elite function
|
||||
uint8_t eliteFxn;
|
||||
|
||||
uint8_t CycleNumber;
|
||||
|
||||
uint8_t VoVi_Switch;
|
||||
uint16_t StepTime;
|
||||
|
||||
} INSTRUCTION = {0};
|
||||
|
||||
@@ -89,24 +69,30 @@ struct HEADSTAGE_INSTRUCTION {
|
||||
* @return None.
|
||||
*/
|
||||
static void InitEliteInstruction(){
|
||||
INSTRUCTION.chip_id = 0;
|
||||
INSTRUCTION.SampleRateIndex = 1;
|
||||
INSTRUCTION.SampleRate = 100;
|
||||
INSTRUCTION.VoltOrigin = DAC_ZERO;
|
||||
INSTRUCTION.VoltFinal = DAC_ZERO;
|
||||
INSTRUCTION.Step = 0x0005; // 0x0005 = 1mV
|
||||
INSTRUCTION.StepTime = STEPTIME_ONE_SEC; // about 0.5 sec
|
||||
INSTRUCTION.VoltConstant = DAC_ZERO; // is about 0V
|
||||
INSTRUCTION.ADCGainLevel = GAIN_AUTO;
|
||||
INSTRUCTION.AutoGainEnable = 1;
|
||||
INSTRUCTION.NotifyRate = STEPTIME_ONE_SEC/10;
|
||||
INSTRUCTION.ResisterMeter = RESISTER_METER_LARGE;
|
||||
INSTRUCTION.Charge = 1;
|
||||
INSTRUCTION.ConstantCurrent = 0x00000000;
|
||||
INSTRUCTION.VoltLimit = 0x0000;
|
||||
INSTRUCTION.eliteFxn = 0; // default is a null event
|
||||
INSTRUCTION.CycleNumber = 0;
|
||||
INSTRUCTION.VoVi_Switch = 0x01; //VoVi_Switch == 0 => user see Vo / VoVi_Switch == 1 => user see Vi
|
||||
INSTRUCTION.chip_id = 0;
|
||||
INSTRUCTION.eliteFxn = 0; //default is a null event
|
||||
INSTRUCTION.VsetRateIndex = 0;
|
||||
INSTRUCTION.VsetRate = 2;
|
||||
INSTRUCTION.Vset = 0;
|
||||
INSTRUCTION.VoltConstant = DAC_ZERO; //DAC_ZERO is about 0V
|
||||
INSTRUCTION.directionInit = 1; //0:reverse 1:forward
|
||||
INSTRUCTION.step = 0;
|
||||
INSTRUCTION.Ve1 = DAC_ZERO;
|
||||
INSTRUCTION.Ve2 = DAC_ZERO;
|
||||
INSTRUCTION.Vinit = 0;
|
||||
INSTRUCTION.Vmax = 0;
|
||||
INSTRUCTION.Vmin = 0;
|
||||
INSTRUCTION.sampleRateIndex = 1;
|
||||
INSTRUCTION.sampleRate = 100;
|
||||
INSTRUCTION.VoViSwitch = 0x01; //0:user see Vo 1: user see Vi
|
||||
INSTRUCTION.AutoGainEnable = 1;
|
||||
INSTRUCTION.ADCGainLevel = GAIN_AUTO;
|
||||
INSTRUCTION.notifyRate = STEPTIME_ONE_SEC;
|
||||
INSTRUCTION.cycleNumber = 1;
|
||||
INSTRUCTION.charge = 1; //0:discharge 1:charge
|
||||
INSTRUCTION.constantCurrent = 0;
|
||||
INSTRUCTION.Currentmax = 0;
|
||||
INSTRUCTION.StepTime = STEPTIME_ONE_SEC;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
@@ -133,7 +119,7 @@ static void GetInstructionParameter(uint8 *ins){
|
||||
// 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));
|
||||
INSTRUCTION.constantCurrent = (uint32_t) (*(ins+1))<<24 | (uint32_t) (*(ins+2))<<16 | (uint32_t) (*(ins+3))<<8 | (uint32_t) (*(ins+4));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+14
-8
@@ -2,25 +2,31 @@
|
||||
#ifndef ELITEKEYDETECT
|
||||
#define ELITEKEYDETECT
|
||||
|
||||
#define CLOCK_ONE_SECOND 10000
|
||||
|
||||
static bool TurnOnElite(uint8_t key) {
|
||||
static uint16_t TurnOnCounter = 0;
|
||||
|
||||
if (key == 0) {
|
||||
// press 1 sec, power on LED
|
||||
// press 1 sec, power on LED, read bat power
|
||||
if (TurnOnCounter >= CLOCK_ONE_SECOND) {
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 1); // enable 5V
|
||||
TurnOn10V();
|
||||
LEDPowerON();
|
||||
return true;
|
||||
headstage_battery_volt();
|
||||
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);
|
||||
return false;
|
||||
}else{
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 1); // enable 5V
|
||||
TurnOn10V();
|
||||
LEDPowerON();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
TurnOnCounter++;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
TurnOnCounter = 0;
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 0); // enable 5V
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+14
-2
@@ -58,7 +58,8 @@ static void WorkModeLED() {
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
WORKLED();
|
||||
// WORKLED();
|
||||
LED_color(0xE2, 0x00, 0x00, 0xAA);
|
||||
break;
|
||||
}
|
||||
case VIS_RST: {
|
||||
@@ -69,7 +70,18 @@ static void WorkModeLED() {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
|
||||
case CYCLIC_VOLTAMMETRY: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case LINEAR_SWEEP_VOLTAMMETRY: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case CONSTANT_VSCAN: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
LEDPowerON();
|
||||
break;
|
||||
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
#ifndef ELITELSV
|
||||
#define ELITELSV
|
||||
|
||||
#define Vset INSTRUCTION.Vset
|
||||
|
||||
static uint16_t LSVCurve(LSVMode *LSV){
|
||||
static uint16_t DACOutCode;
|
||||
static int32_t Vin;
|
||||
static int32_t Vout;
|
||||
static int32_t DeltaVout;
|
||||
|
||||
Vin = LSV->_measureVin * 200;//[5nV]
|
||||
if(DACReset){
|
||||
Vout = Vset + Vin;
|
||||
DACReset = false;
|
||||
}else{
|
||||
DeltaVout = Vset - (Vout - Vin);
|
||||
Vout = Vout + DeltaVout;
|
||||
}
|
||||
|
||||
INSTRUCTION.VoltConstant = Vout / 40000 + 25000;//5nV=>usercode
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
|
||||
int32_t RealV2;
|
||||
RealV2 = (int32_t)((Vout - Vin) / 200);//[1uV]
|
||||
InputNotify(NOTIFY_VOLT, RealV2);
|
||||
|
||||
int32_t RealV;
|
||||
RealV = (int32_t)(Vout / 200);//[1uV]
|
||||
InputNotify(NOTIFY_IMPEDANCE, RealV);
|
||||
|
||||
DAC_outputV(DACOutCode);
|
||||
//
|
||||
return DACOutCode;
|
||||
}
|
||||
|
||||
static void LSV_Vscan(LSVMode *LSV){
|
||||
|
||||
NotifyCycleNumber = (INSTRUCTION.cycleNumber - LSV->_cycleNumber + 1);
|
||||
|
||||
if(vscanReset){
|
||||
if(INSTRUCTION.directionInit == 1){
|
||||
LSV->_direction_up = true;
|
||||
LSV->_current_direction_up = true;
|
||||
}else{
|
||||
LSV->_direction_up = false;
|
||||
LSV->_current_direction_up = false;
|
||||
}
|
||||
|
||||
//Vsetp = x * 20 * N, x=xmV ; N=VscanRate
|
||||
if(INSTRUCTION.step <= 10){
|
||||
LSV->_Vstep = INSTRUCTION.step * INSTRUCTION.VsetRate / 5;
|
||||
}else{
|
||||
LSV->_Vstep = INSTRUCTION.step / 5 * INSTRUCTION.VsetRate;
|
||||
}
|
||||
|
||||
Vset = LSV->_Vinit;
|
||||
}
|
||||
|
||||
if(!vscanReset){
|
||||
|
||||
if (LSV->_current_direction_up){
|
||||
Vset = Vset + LSV->_Vstep;
|
||||
}else{
|
||||
Vset = Vset - LSV->_Vstep;
|
||||
}
|
||||
|
||||
/*stop condition*/
|
||||
if (Vset >= LSV->_Vmax){
|
||||
// PeriodicEvent = false;
|
||||
Vset = LSV->_Vmin;
|
||||
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
|
||||
}else if (Vset <= LSV->_Vmin){
|
||||
// PeriodicEvent = false;
|
||||
Vset = LSV->_Vmax;
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+90
-37
@@ -1,15 +1,19 @@
|
||||
|
||||
#ifndef ELITENOTIFY
|
||||
#define ELITENOTIFY
|
||||
|
||||
#include "headstage.h"
|
||||
|
||||
/**
|
||||
* notify data buffer.
|
||||
* the length equals to the characteristic 4 which value is 20 bytes.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ELITENOTIFY
|
||||
#define ELITENOTIFY
|
||||
|
||||
#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 NOT_BUF_OFFSET_INIT 8
|
||||
|
||||
@@ -17,18 +21,14 @@
|
||||
* the index where to start insert data into buffer.
|
||||
* start from 6.
|
||||
*/
|
||||
static size_t not_buf_offset = NOT_BUF_OFFSET_INIT;
|
||||
|
||||
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};
|
||||
|
||||
/**
|
||||
* counter of notify send.
|
||||
*/
|
||||
static uint32_t notify_counter = 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 ******************************** //
|
||||
/*
|
||||
@@ -81,12 +81,14 @@ static uint32_t notify_counter = 0;
|
||||
0xFF
|
||||
|
||||
* header = device ID
|
||||
* I = current (0.001nA), V = voltage (mV),
|
||||
* Z = impedance (k ohm), T = time (ms)
|
||||
* I = current (nA), V = voltage (uV),
|
||||
* Z = impedance (ohm), T = time (ms)
|
||||
*
|
||||
*
|
||||
*/
|
||||
static void SendNotify() {
|
||||
initDATBuf();
|
||||
|
||||
not_buf[0] = INSTRUCTION.chip_id;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
@@ -103,33 +105,84 @@ static void SendNotify() {
|
||||
not_buf[15] = (not_time_stamp >> 16) & 0xff;
|
||||
not_buf[16] = (not_time_stamp >> 24) & 0xff;
|
||||
|
||||
// cyclic voltametry cycle number
|
||||
not_buf[17] = INSTRUCTION.CycleNumber;
|
||||
not_buf[17] = (NotifyCycleNumber >> 8) & 0xff;
|
||||
not_buf[18] = NotifyCycleNumber & 0xff;
|
||||
not_buf[19] = 0;
|
||||
not_buf[20] = 0;
|
||||
not_buf[21] = 0;
|
||||
not_buf[22] = 0;
|
||||
|
||||
SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
|
||||
}
|
||||
|
||||
static void initDATBuf(){
|
||||
for (int i = 0; i < BLE_DAT_BUFF_SIZE; i++){
|
||||
not_buf[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void initINSBuf(){
|
||||
for (int i = 0; i < BLE_INS_BUFF_SIZE; i++){
|
||||
ins_buf[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void initCISBuf(){
|
||||
for (int i = 0; i < BLE_CIS_BUFF_SIZE; i++){
|
||||
cis_buf[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void initRawDataBuf(){
|
||||
not_time_stamp = 0;
|
||||
NotifyCycleNumber = 0;
|
||||
|
||||
for (int i = 0; i < 4; i++){
|
||||
NotifyCurrent[i] = 0;
|
||||
NotifyVolt[i] = 0;
|
||||
NotifyImpedance[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void FlushNotify(){
|
||||
initRawDataBuf();
|
||||
initDATBuf();
|
||||
|
||||
not_buf[0] = INSTRUCTION.chip_id;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
not_buf[i + 1] = 0;
|
||||
not_buf[i + 5] = 0;
|
||||
not_buf[i + 9] = 0;
|
||||
}
|
||||
|
||||
// 1 Timestamp = 32 usec; 31 Timestamp ~= 1 msec
|
||||
not_time_stamp = 0; // msec
|
||||
|
||||
not_buf[13] = not_time_stamp & 0xff;
|
||||
not_buf[14] = (not_time_stamp >> 8) & 0xff;
|
||||
not_buf[15] = (not_time_stamp >> 16) & 0xff;
|
||||
not_buf[16] = (not_time_stamp >> 24) & 0xff;
|
||||
|
||||
// cyclic voltametry cycle number
|
||||
not_buf[17] = 0x00;
|
||||
|
||||
SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
|
||||
}
|
||||
|
||||
static void InputNotify(int NotifyType, int32_t Data){
|
||||
|
||||
switch (NotifyType) {
|
||||
case NOTIFY_CURRENT:
|
||||
NotifyCurrent[0] = (uint8_t)((Data & 0xFF000000) >> 24);
|
||||
NotifyCurrent[1] = (uint8_t)((Data & 0x00FF0000) >> 16);
|
||||
NotifyCurrent[2] = (uint8_t)((Data & 0x0000FF00) >> 8);
|
||||
NotifyCurrent[3] = (uint8_t)(Data & 0x000000FF);
|
||||
break;
|
||||
|
||||
case NOTIFY_IMPEDANCE:
|
||||
NotifyImpedance[0] = (uint8_t)((Data & 0xFF000000) >> 24);
|
||||
NotifyImpedance[1] = (uint8_t)((Data & 0x00FF0000) >> 16);
|
||||
NotifyImpedance[2] = (uint8_t)((Data & 0x0000FF00) >> 8);
|
||||
NotifyImpedance[3] = (uint8_t)(Data & 0x000000FF);
|
||||
break;
|
||||
|
||||
case NOTIFY_VOLT :
|
||||
NotifyVolt[0] = (uint8_t)((Data & 0xFF000000) >> 24);
|
||||
NotifyVolt[1] = (uint8_t)((Data & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t)((Data & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t)(Data & 0x000000FF);
|
||||
break;
|
||||
|
||||
case NOTIFY_VOLT_BAT :
|
||||
NotifyVoltBat[0] = (uint8_t)((Data & 0xFF000000) >> 24);
|
||||
NotifyVoltBat[1] = (uint8_t)((Data & 0x00FF0000) >> 16);
|
||||
NotifyVoltBat[2] = (uint8_t)((Data & 0x0000FF00) >> 8);
|
||||
NotifyVoltBat[3] = (uint8_t)(Data & 0x000000FF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+8
-63
@@ -3,26 +3,16 @@
|
||||
#define ELITERESET
|
||||
|
||||
static void reset() {
|
||||
InitEliteFlag();
|
||||
InitFlag();
|
||||
InitCT();
|
||||
|
||||
// IV/CV mode reset
|
||||
DiscardIVFirstData = 0;
|
||||
avg_number = 0;
|
||||
ADCRealCurrent_long = 0;
|
||||
InitGPT();
|
||||
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
|
||||
if (INSTRUCTION.eliteFxn == CONSTANT_CURRENT){
|
||||
INSTRUCTION.eliteFxn = 0;
|
||||
|
||||
}
|
||||
|
||||
LEDPowerON();
|
||||
for (int i = 0; i < BLE_INS_BUFF_SIZE; i++) {
|
||||
ins_buf[i] = 0;
|
||||
}
|
||||
initINSBuf();
|
||||
initDATBuf();
|
||||
|
||||
for (int i = 0; i < SPI_LED_SIZE; i++) {
|
||||
spi_LEDtxbuf[i] = 0;
|
||||
@@ -39,30 +29,22 @@ static void reset() {
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < BLE_DAT_BUFF_SIZE; i++) {
|
||||
not_buf[i] = 0;
|
||||
}
|
||||
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
CPUdelay(1600);
|
||||
}
|
||||
|
||||
static void Eliteinterrupt() {
|
||||
InitEliteFlag();
|
||||
InitFlag();
|
||||
InitCT();
|
||||
InitGPT();
|
||||
|
||||
// IV/CV mode reset
|
||||
DiscardIVFirstData = 0;
|
||||
avg_number = 0;
|
||||
ADCRealCurrent_long = 0;
|
||||
ADCGainControl(GAIN_AUTO);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
|
||||
LEDPowerON();
|
||||
for (int i = 0; i < BLE_INS_BUFF_SIZE; i++) {
|
||||
ins_buf[i] = 0;
|
||||
}
|
||||
initINSBuf();
|
||||
initDATBuf();
|
||||
|
||||
for (int i = 0; i < SPI_LED_SIZE; i++) {
|
||||
spi_LEDtxbuf[i] = 0;
|
||||
@@ -79,45 +61,8 @@ static void Eliteinterrupt() {
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < BLE_DAT_BUFF_SIZE; i++) {
|
||||
not_buf[i] = 0;
|
||||
}
|
||||
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
CPUdelay(8000);
|
||||
}
|
||||
|
||||
static void CleanBuffer() {
|
||||
InitFlag();
|
||||
InitEliteInstruction();
|
||||
InitCT();
|
||||
DiscardIVFirstData = 0;
|
||||
avg_number = 0;
|
||||
ADCRealCurrent_long = 0;
|
||||
|
||||
for (int i = 0; i < SPI_LED_SIZE; i++) {
|
||||
spi_LEDtxbuf[i] = 0;
|
||||
spi_LEDrxbuf[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < SPI_DAC_SIZE; i++) {
|
||||
spi_DACtxbuf[i] = 0;
|
||||
spi_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < SPI_ADC_SIZE; i++) {
|
||||
spi_ADC_txbuf[i] = 0;
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < BLE_DAT_BUFF_SIZE; i++) {
|
||||
not_buf[i] = 0;
|
||||
}
|
||||
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
CPUdelay(8000);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+74
-11
@@ -2,21 +2,84 @@
|
||||
#ifndef ELITEVT
|
||||
#define ELITEVT
|
||||
|
||||
static void VT_Plot(VTMode *VT) {
|
||||
static void VT_Plot(WorkMode *WorkModeData) {
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IT
|
||||
break;
|
||||
}
|
||||
case VT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->VT
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->RT
|
||||
break;
|
||||
}
|
||||
case IV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IV
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->CV
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
#define CURRENT_MODE WorkModeData->CC
|
||||
break;
|
||||
}
|
||||
case CYCLIC_VOLTAMMETRY:{
|
||||
#define CURRENT_MODE WorkModeData->CV3
|
||||
break;
|
||||
}
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:{
|
||||
#define CURRENT_MODE WorkModeData->LSV
|
||||
break;
|
||||
}
|
||||
case CONSTANT_VSCAN:{
|
||||
#define CURRENT_MODE WorkModeData->CVSCAN
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ADC gain is don't care when measuring voltage
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
|
||||
// read ADC volt
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
static uint8_t ADCSwitch = 0;
|
||||
static int32_t VoltData;
|
||||
|
||||
// decode ADC value and put it into notify buffer
|
||||
VT->_MeasureData = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
|
||||
NotifyVolt[0] = (uint8_t) (VT->_MeasureData >> 24);
|
||||
NotifyVolt[1] = (uint8_t) ((VT->_MeasureData & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t) ((VT->_MeasureData & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t) (VT->_MeasureData & 0x000000FF);
|
||||
if(batteryCheck_flag){
|
||||
EliteADCBattery();
|
||||
if(!batteryCheck_flag){
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
ADCSwitch = 2;
|
||||
}
|
||||
}else{
|
||||
if(ADCSwitch == 0){ /**read V(buffer)**/
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
if(CURRENT_MODE->_VoViSwitch == 0x01){
|
||||
CURRENT_MODE->_measureVin = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
VoltData = CURRENT_MODE->_measureVin;
|
||||
}else if(CURRENT_MODE->_VoViSwitch == 0x00){
|
||||
CURRENT_MODE->_measureVout = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_DAC, spi_ADC_rxbuf);
|
||||
VoltData = CURRENT_MODE->_measureVout;
|
||||
}
|
||||
InputNotify(NOTIFY_VOLT, VoltData);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 1){ /**read V**/
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 2){ /**read V**/
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
ADCSwitch = 0;
|
||||
}
|
||||
}
|
||||
#undef CURRENT_MODE
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+289
-360
@@ -1,90 +1,33 @@
|
||||
/**
|
||||
*
|
||||
* struct WorkMode{
|
||||
* // Measure Only
|
||||
* ITMode;
|
||||
* VTMode;
|
||||
*
|
||||
* // Measure + VoltOut
|
||||
* RTMode;
|
||||
* IVMode;
|
||||
* CVMode;
|
||||
*
|
||||
* // Volt out only
|
||||
* VOutMode
|
||||
* }
|
||||
*
|
||||
* -------------------------------
|
||||
* // Measure Only
|
||||
* struct ITMode{
|
||||
* MeasureData
|
||||
* SetMeasureData()
|
||||
* GetMeasureData()
|
||||
* }
|
||||
*
|
||||
* -------------------------------
|
||||
* // VoltOut parameter
|
||||
* stuct VOutMode{
|
||||
* Vout_UC
|
||||
* VoltOrigin
|
||||
* Vstop;
|
||||
* Step;
|
||||
* StepTime;
|
||||
* CycleNumber;
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ELITE_WORK_DATA
|
||||
#define ELITE_WORK_DATA
|
||||
|
||||
#define CLOCK_ONE_SECOND 10000
|
||||
|
||||
#include "EliteInstruction.h"
|
||||
#define IV_CURVE 0b00010000
|
||||
#define CV_CURVE 0b00100000
|
||||
#define VOLT_OUTPUT 0b00110000
|
||||
#define ZT_CURVE 0b01000000
|
||||
#define VT_CURVE 0b01010000
|
||||
#define IT_CURVE 0b01100000
|
||||
#define SET_SAMPLE_RATE 0b01110000
|
||||
#define SET_ADC_GAIN 0b10000000
|
||||
#define DIFFERENTIAL_PULSE_VOLTAMMETRY 0b10100000
|
||||
#define SQUARE_WAVE_VOLTAMMETRY 0b10110000
|
||||
#define POTENTIAL_STATE 0b11000000
|
||||
#define CONSTANT_CURRENT 0b11010000
|
||||
#define SET_RESISTER_LEVEL 0b11100000
|
||||
|
||||
static bool Free_Work_Mode = false;
|
||||
typedef void (*InitWorkData) ();
|
||||
|
||||
/***** Template of Measure and VoltOut parameter *****/
|
||||
#define MEASURE \
|
||||
int32_t _MeasureData; \
|
||||
uint16_t _VoVi_Switch
|
||||
// void (*SetMeasureData) (struct Measure *, int32_t); \
|
||||
// int32_t (*GetMeasureData) (struct Measure *)
|
||||
#define MEASURE \
|
||||
int32_t _measureCurrent; \
|
||||
int32_t _measureVin; \
|
||||
int32_t _measureVout; \
|
||||
int32_t _measureBat; \
|
||||
uint8_t _VoViSwitch
|
||||
|
||||
/* VoltOut is an UserCode */
|
||||
/* VOrigin, VStop, Step are all UserCode */
|
||||
#define VOUT_PARA \
|
||||
uint16_t _VoltOut; \
|
||||
uint16_t _VOrigin; \
|
||||
uint16_t _VStop; \
|
||||
uint16_t _Step; \
|
||||
uint16_t _StepTime; \
|
||||
uint16_t _CycleNumber
|
||||
// void (*SetVoltOut) (struct VoltOutPara *, uint16_t); \
|
||||
// uint16_t (*GetVoltOut) (struct VoltOutPara *); \
|
||||
// void (*SetVOrigin) (struct VoltOutPara *, uint16_t); \
|
||||
// uint16_t (*GetVOrigin) (struct VoltOutPara *); \
|
||||
// void (*SetVStop) (struct VoltOutPara *, uint16_t); \
|
||||
// uint16_t (*GetVStop) (struct VoltOutPara *); \
|
||||
// void (*SetStep) (struct VoltOutPara *, uint16_t); \
|
||||
// uint16_t (*GetStep) (struct VoltOutPara *); \
|
||||
// void (*SetStepTime) (struct VoltOutPara *, uint16_t); \
|
||||
// uint16_t (*GetStepTime) (struct VoltOutPara *); \
|
||||
// void (*SetCycleNumber) (struct VoltOutPara *, uint16_t); \
|
||||
// uint16_t (*GetCycleNumber) (struct VoltOutPara *)
|
||||
#define VOUT_PARA \
|
||||
int32_t _Vinit; \
|
||||
int32_t _Vmax; \
|
||||
int32_t _Vmin; \
|
||||
int32_t _Vset; \
|
||||
uint32_t _Vstep; \
|
||||
bool _direction_up; \
|
||||
bool _current_direction_up; \
|
||||
uint16_t _cycleNumber
|
||||
|
||||
// direction_up = true, if directionInit=1
|
||||
// current_direction_up = true, Vstep => positive. vice versa
|
||||
|
||||
/* CC Mode parameter
|
||||
* @ Measure : measure current value (nA)
|
||||
@@ -104,16 +47,19 @@ typedef void (*InitWorkData) ();
|
||||
* @_Transform2RealnA : transform a current user code (IUC) to real current in nA
|
||||
*/
|
||||
#define CC_PARA \
|
||||
MEASURE; \
|
||||
int32_t _measureCurrent; \
|
||||
uint8_t _VoViSwitch; \
|
||||
uint8_t Charge; \
|
||||
int32_t BatteryV; \
|
||||
int32_t value; \
|
||||
uint16_t Done; \
|
||||
uint16_t VMax; \
|
||||
uint32_t VMax; \
|
||||
uint16_t VMin; \
|
||||
int32_t _measureVin; \
|
||||
int32_t Vset; \
|
||||
int32_t Iset; \
|
||||
int32_t (*_Transform2RealnA)(struct CCModePara *)
|
||||
|
||||
|
||||
#define LIMIT \
|
||||
uint32_t _LimitValue; \
|
||||
void (*SetLimitValue) (struct Limit *, uint32_t); \
|
||||
@@ -136,17 +82,6 @@ struct CCModePara{
|
||||
};
|
||||
/***** End of Measure and VoltOut parameter *****/
|
||||
|
||||
|
||||
/***** Measure Only Mode *****/
|
||||
//void _SetMeasureData(struct Measure *self, int32_t Data){
|
||||
// self->_MeasureData = Data;
|
||||
//}
|
||||
//
|
||||
//int32_t _GetMeasureData(struct Measure *self){
|
||||
// return self->_MeasureData;
|
||||
//}
|
||||
|
||||
|
||||
/**** Limit Mode ****/
|
||||
//LimitValue
|
||||
void _SetLimitValue(struct Limit *self, uint32_t LimitValue){
|
||||
@@ -156,22 +91,31 @@ uint32_t _GetLimitValue(struct Limit *self){
|
||||
return self->_LimitValue;
|
||||
}
|
||||
|
||||
|
||||
/* VoltOut Mode Data */
|
||||
typedef struct _VoltOutMode{
|
||||
uint16_t _Vset;
|
||||
}VoltOutMode;
|
||||
|
||||
VoltOutMode *InitVoltOutMode(){
|
||||
VoltOutMode *ret = malloc(sizeof(VoltOutMode));
|
||||
ret->_Vset = INSTRUCTION.VoltConstant;
|
||||
return ret;
|
||||
}
|
||||
/* End of VoltOut Mode Data */
|
||||
|
||||
/* IT Mode Data */
|
||||
typedef struct _ITMode{
|
||||
MEASURE;
|
||||
LIMIT;
|
||||
}ITMode;
|
||||
|
||||
ITMode * InitITMode(){
|
||||
ITMode *ret = malloc(sizeof(ITMode));
|
||||
ret->_MeasureData = 0;
|
||||
// ret->SetMeasureData = &_SetMeasureData;
|
||||
// ret->GetMeasureData = &_GetMeasureData;
|
||||
|
||||
ret->_LimitValue = 0;
|
||||
|
||||
ret->SetLimitValue = &_SetLimitValue;
|
||||
ret->GetLimitValue = &_GetLimitValue;
|
||||
ret->_measureCurrent = 0;
|
||||
ret->_measureVin = 0;
|
||||
ret->_measureVout = 0;
|
||||
ret->_measureBat = 0;
|
||||
ret->_VoViSwitch = INSTRUCTION.VoViSwitch;
|
||||
return ret;
|
||||
}
|
||||
/* End of IT Mode Data */
|
||||
@@ -183,228 +127,87 @@ typedef struct _VTMode{
|
||||
|
||||
VTMode * InitVTMode(){
|
||||
VTMode *ret = malloc(sizeof(VTMode));
|
||||
ret->_MeasureData = 0;
|
||||
// ret->SetMeasureData = &_SetMeasureData;
|
||||
// ret->GetMeasureData = &_GetMeasureData;
|
||||
ret->_measureCurrent = 0;
|
||||
ret->_measureVin = 0;
|
||||
ret->_measureVout = 0;
|
||||
ret->_measureBat = 0;
|
||||
ret->_VoViSwitch = INSTRUCTION.VoViSwitch;
|
||||
return ret;
|
||||
}
|
||||
/* End of VT Mode Data */
|
||||
/***** End of Measure Only Mode *****/
|
||||
|
||||
|
||||
/**** VoltOut Only Mode ****/
|
||||
//// VoltOut
|
||||
//void _SetVoltOut(struct VoltOutPara *self, uint16_t VoltOut){
|
||||
// self->_VoltOut = VoltOut;
|
||||
//}
|
||||
//uint16_t _GetVoltOut(struct VoltOutPara *self){
|
||||
// return self->_VoltOut;
|
||||
//}
|
||||
//
|
||||
//// VOrigin
|
||||
//void _SetVOrigin(struct VoltOutPara *self, uint16_t VOrigin){
|
||||
// self->_VOrigin = VOrigin;
|
||||
//}
|
||||
//uint16_t _GetVOrigin(struct VoltOutPara *self){
|
||||
// return self->_VOrigin;
|
||||
//}
|
||||
//
|
||||
//// VStop
|
||||
//void _SetVStop(struct VoltOutPara *self, uint16_t VStop){
|
||||
// self->_VStop = VStop;
|
||||
//}
|
||||
//uint16_t _GetVStop(struct VoltOutPara *self){
|
||||
// return self->_VStop;
|
||||
//}
|
||||
//
|
||||
//// Step
|
||||
//void _SetStep(struct VoltOutPara *self, uint16_t Step){
|
||||
// self->_Step = Step;
|
||||
//}
|
||||
//uint16_t _GetStep(struct VoltOutPara *self){
|
||||
// return self->_Step;
|
||||
//}
|
||||
//
|
||||
//// StepTime
|
||||
//void _SetStepTime(struct VoltOutPara *self, uint16_t StepTime){
|
||||
// self->_StepTime = StepTime;
|
||||
//}
|
||||
//uint16_t _GetStepTime(struct VoltOutPara *self){
|
||||
// return self->_StepTime;
|
||||
//}
|
||||
//
|
||||
//// CycleNumber
|
||||
//void _SetCycleNumber(struct VoltOutPara *self, uint16_t CycleNumber){
|
||||
// self->_CycleNumber = CycleNumber;
|
||||
//}
|
||||
//uint16_t _GetCycleNumber(struct VoltOutPara *self){
|
||||
// return self->_CycleNumber;
|
||||
//}
|
||||
|
||||
|
||||
/* VoltOut Mode Data */
|
||||
typedef struct _VoltOutMode{
|
||||
VOUT_PARA;
|
||||
}VoltOutMode;
|
||||
|
||||
VoltOutMode *InitVoltOutMode(){
|
||||
VoltOutMode *ret = malloc(sizeof(VoltOutMode));
|
||||
ret->_VoltOut = INSTRUCTION.VoltConstant; // 25000 is DAC_ZERO
|
||||
ret->_VOrigin = DAC_ZERO;
|
||||
ret->_VStop = DAC_ZERO;
|
||||
ret->_Step = 0;
|
||||
ret->_StepTime = 10000; // STEPTIME_ONE_SEC
|
||||
ret->_CycleNumber = 1;
|
||||
|
||||
// ret->SetVoltOut = &_SetVoltOut;
|
||||
// ret->GetVoltOut = &_GetVoltOut;
|
||||
// ret->SetVOrigin = &_SetVOrigin;
|
||||
// ret->GetVOrigin = &_GetVOrigin;
|
||||
// ret->SetVStop = &_SetVStop;
|
||||
// ret->GetVStop = &_GetVStop;
|
||||
// ret->SetStep = &_SetStep;
|
||||
// ret->GetStep = &_GetStep;
|
||||
// ret->SetStepTime = &_SetStepTime;
|
||||
// ret->GetStepTime = &_GetStepTime;
|
||||
// ret->SetCycleNumber = &_SetCycleNumber;
|
||||
// ret->GetCycleNumber = &_GetCycleNumber;
|
||||
return ret;
|
||||
}
|
||||
/* End of VoltOut Mode Data */
|
||||
/**** End of VoltOut Only Mode ****/
|
||||
|
||||
|
||||
/**** Measure + VoltOut Mode ****/
|
||||
/* IV Mode Data */
|
||||
typedef struct _IVMode{
|
||||
MEASURE;
|
||||
int32_t MeasureVolt;
|
||||
VOUT_PARA;
|
||||
LIMIT;
|
||||
}IVMode;
|
||||
|
||||
IVMode *InitIVMode(){
|
||||
IVMode *ret = malloc(sizeof(IVMode));
|
||||
ret->_MeasureData = 0;
|
||||
ret->MeasureVolt = (INSTRUCTION.VoltOrigin - DAC_ZERO)/5;
|
||||
ret->_VoVi_Switch = INSTRUCTION.VoVi_Switch;
|
||||
|
||||
ret->_VoltOut = DAC_ZERO;
|
||||
ret->_VOrigin = INSTRUCTION.VoltOrigin;
|
||||
ret->_VStop = INSTRUCTION.VoltFinal;
|
||||
ret->_Step = INSTRUCTION.Step;
|
||||
ret->_StepTime = INSTRUCTION.StepTime;
|
||||
ret->_CycleNumber = 1;
|
||||
|
||||
|
||||
// ret->SetVoltOut = &_SetVoltOut;
|
||||
// ret->GetVoltOut = &_GetVoltOut;
|
||||
// ret->SetVOrigin = &_SetVOrigin;
|
||||
// ret->GetVOrigin = &_GetVOrigin;
|
||||
// ret->SetVStop = &_SetVStop;
|
||||
// ret->GetVStop = &_GetVStop;
|
||||
// ret->SetStep = &_SetStep;
|
||||
// ret->GetStep = &_GetStep;
|
||||
// ret->SetStepTime = &_SetStepTime;
|
||||
// ret->GetStepTime = &_GetStepTime;
|
||||
// ret->SetCycleNumber = &_SetCycleNumber;
|
||||
// ret->GetCycleNumber = &_GetCycleNumber;
|
||||
|
||||
ret->_LimitValue = 1e5;
|
||||
|
||||
ret->SetLimitValue = &_SetLimitValue;
|
||||
ret->GetLimitValue = &_GetLimitValue;
|
||||
return ret;
|
||||
}
|
||||
/* End of IV Mode Data */
|
||||
|
||||
/* RT Mode Data */
|
||||
typedef struct _RTMode{
|
||||
MEASURE;
|
||||
VOUT_PARA;
|
||||
int32_t _Vset;
|
||||
}RTMode;
|
||||
|
||||
RTMode * InitRTMode(){
|
||||
RTMode *ret = malloc(sizeof(RTMode));
|
||||
ret->_MeasureData = 0;
|
||||
// ret->SetMeasureData = &_SetMeasureData;
|
||||
// ret->GetMeasureData = &_GetMeasureData;
|
||||
|
||||
ret->_VoltOut = DAC_ZERO; // 25000 is DAC_ZERO
|
||||
ret->_VOrigin = DAC_ZERO;
|
||||
ret->_VStop = DAC_ZERO;
|
||||
ret->_Step = 0;
|
||||
ret->_StepTime = 10000; // STEPTIME_ONE_SEC
|
||||
ret->_CycleNumber = 1;
|
||||
|
||||
// ret->SetVoltOut = &_SetVoltOut;
|
||||
// ret->GetVoltOut = &_GetVoltOut;
|
||||
// ret->SetVOrigin = &_SetVOrigin;
|
||||
// ret->GetVOrigin = &_GetVOrigin;
|
||||
// ret->SetVStop = &_SetVStop;
|
||||
// ret->GetVStop = &_GetVStop;
|
||||
// ret->SetStep = &_SetStep;
|
||||
// ret->GetStep = &_GetStep;
|
||||
// ret->SetStepTime = &_SetStepTime;
|
||||
// ret->GetStepTime = &_GetStepTime;
|
||||
// ret->SetCycleNumber = &_SetCycleNumber;
|
||||
// ret->GetCycleNumber = &_GetCycleNumber;
|
||||
ret->_measureCurrent = 0;
|
||||
ret->_measureVin = 0;
|
||||
ret->_measureVout = 0;
|
||||
ret->_measureBat = 0;
|
||||
ret->_VoViSwitch = INSTRUCTION.VoViSwitch;
|
||||
ret->_Vset = INSTRUCTION.VoltConstant;
|
||||
return ret;
|
||||
}
|
||||
/* End of RT Mode Data */
|
||||
|
||||
/* CV Mode*/
|
||||
/* IV Mode Data */
|
||||
typedef struct _IVMode{
|
||||
MEASURE;
|
||||
VOUT_PARA;
|
||||
}IVMode;
|
||||
|
||||
IVMode *InitIVMode(){
|
||||
IVMode *ret = malloc(sizeof(IVMode));
|
||||
ret->_measureCurrent = 0;
|
||||
ret->_measureVin = 0;
|
||||
ret->_measureVout = 0;
|
||||
ret->_measureBat = 0;
|
||||
ret->_VoViSwitch = INSTRUCTION.VoViSwitch;
|
||||
ret->_Vinit = (INSTRUCTION.Vinit - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vmax = (INSTRUCTION.Vmax - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vmin = (INSTRUCTION.Vmin - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vset = 0;
|
||||
ret->_Vstep = 0;
|
||||
ret->_direction_up = true;
|
||||
ret->_current_direction_up = true;
|
||||
ret->_cycleNumber = INSTRUCTION.cycleNumber;
|
||||
return ret;
|
||||
}
|
||||
/* End of IV Mode Data */
|
||||
|
||||
/* CV Mode(CYCLE_IV)*/
|
||||
typedef struct _CVMode{
|
||||
MEASURE;
|
||||
int32_t MeasureVolt;
|
||||
VOUT_PARA;
|
||||
}CVMode;
|
||||
|
||||
CVMode * InitCVMode(){
|
||||
CVMode *ret = malloc(sizeof(CVMode));
|
||||
ret->_MeasureData = (INSTRUCTION.VoltOrigin- DAC_ZERO)/5;
|
||||
// ret->SetMeasureData = &_SetMeasureData;
|
||||
// ret->GetMeasureData = &_GetMeasureData;
|
||||
ret->MeasureVolt = 20000;
|
||||
|
||||
ret->_VoltOut = DAC_ZERO; // 25000 is DAC_ZERO
|
||||
ret->_VOrigin = INSTRUCTION.VoltOrigin;
|
||||
ret->_VStop = INSTRUCTION.VoltFinal;
|
||||
ret->_Step = INSTRUCTION.Step;
|
||||
ret->_StepTime = INSTRUCTION.StepTime; // STEPTIME_ONE_SEC
|
||||
ret->_CycleNumber = INSTRUCTION.CycleNumber;
|
||||
ret->_VoVi_Switch = INSTRUCTION.VoVi_Switch;
|
||||
|
||||
// ret->SetVoltOut = &_SetVoltOut;
|
||||
// ret->GetVoltOut = &_GetVoltOut;
|
||||
// ret->SetVOrigin = &_SetVOrigin;
|
||||
// ret->GetVOrigin = &_GetVOrigin;
|
||||
// ret->SetVStop = &_SetVStop;
|
||||
// ret->GetVStop = &_GetVStop;
|
||||
// ret->SetStep = &_SetStep;
|
||||
// ret->GetStep = &_GetStep;
|
||||
// ret->SetStepTime = &_SetStepTime;
|
||||
// ret->GetStepTime = &_GetStepTime;
|
||||
// ret->SetCycleNumber = &_SetCycleNumber;
|
||||
// ret->GetCycleNumber = &_GetCycleNumber;
|
||||
ret->_measureCurrent = 0;
|
||||
ret->_measureVin = 0;
|
||||
ret->_measureVout = 0;
|
||||
ret->_measureBat = 0;
|
||||
ret->_VoViSwitch = INSTRUCTION.VoViSwitch;
|
||||
ret->_Vinit = (INSTRUCTION.Vinit - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vmax = (INSTRUCTION.Vmax - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vmin = (INSTRUCTION.Vmin - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vset = 0;
|
||||
ret->_Vstep = 0;
|
||||
ret->_direction_up = true;
|
||||
ret->_current_direction_up = true;
|
||||
ret->_cycleNumber = INSTRUCTION.cycleNumber;
|
||||
return ret;
|
||||
}
|
||||
/*End of CV Mode*/
|
||||
|
||||
/* Const Current Mode */
|
||||
/* CC Mode(CONSTANT_CURRENT)*/
|
||||
#define CC_ZERO_POINT 0
|
||||
#define MAX_DAC_UC 50000
|
||||
#define MIN_DAC_UC 0
|
||||
|
||||
/*********************************************************************
|
||||
* @struct Constant Current Code
|
||||
*
|
||||
* @brief A struct to handle CC mode command
|
||||
*/
|
||||
typedef struct _CCMode{
|
||||
CC_PARA;
|
||||
}CCMode;
|
||||
|
||||
/*********************************************************************
|
||||
* @fn Transform2RealnA
|
||||
*
|
||||
@@ -427,24 +230,117 @@ int32_t _Transform2RealnA(struct CCModePara *self){
|
||||
return IUCReal;
|
||||
}
|
||||
|
||||
typedef struct _CCMode{
|
||||
MEASURE;
|
||||
int32_t _Vmax;
|
||||
int32_t _Vmin;
|
||||
int32_t _Vset;
|
||||
int32_t _Iset;
|
||||
uint8_t _charge;
|
||||
int32_t (*_Transform2RealnA)(struct CCModePara *);
|
||||
}CCMode;
|
||||
|
||||
CCMode * InitCCMode(){
|
||||
CCMode *ret = malloc(sizeof(CCMode));
|
||||
ret->_MeasureData = 0;
|
||||
ret->Charge = INSTRUCTION.Charge;
|
||||
ret->BatteryV = 0;
|
||||
ret->Done = 0;
|
||||
|
||||
ret->value = INSTRUCTION.ConstantCurrent;
|
||||
ret->VMax = INSTRUCTION.VoltLimit + DAC_ZERO;
|
||||
ret->VMin = INSTRUCTION.VoltLimit + DAC_ZERO;
|
||||
ret->_measureCurrent = 0;
|
||||
ret->_measureVin = 0;
|
||||
ret->_measureVout = 0;
|
||||
ret->_measureBat = 0;
|
||||
ret->_VoViSwitch = INSTRUCTION.VoViSwitch;
|
||||
ret->_Vmax = (INSTRUCTION.Vmax - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vmin = (INSTRUCTION.Vmin - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vset = 0;
|
||||
ret->_Iset = INSTRUCTION.constantCurrent * 200 ; //[50pA] //controller UI 15000uA => Elite 1500000 => 1500000 * 10 * 1000 / 50 [50pA]
|
||||
ret->_charge = INSTRUCTION.charge;
|
||||
ret->_Transform2RealnA = &_Transform2RealnA;
|
||||
return ret;
|
||||
}
|
||||
/*End of Const Current Mode Mode*/
|
||||
/*End of CC Mode*/
|
||||
|
||||
/* CV3 Mode(CYCLIC_VOLTAMMETRY)*/
|
||||
typedef struct _CV3Mode{
|
||||
MEASURE;
|
||||
VOUT_PARA;
|
||||
}CV3Mode;
|
||||
|
||||
CV3Mode * InitCV3Mode(){
|
||||
CV3Mode *ret = malloc(sizeof(CV3Mode));
|
||||
ret->_measureCurrent = 0;
|
||||
ret->_measureVin = 0;
|
||||
ret->_measureVout = 0;
|
||||
ret->_measureBat = 0;
|
||||
ret->_VoViSwitch = INSTRUCTION.VoViSwitch;
|
||||
ret->_Vinit = (INSTRUCTION.Vinit - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vmax = (INSTRUCTION.Vmax - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vmin = (INSTRUCTION.Vmin - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vset = 0;
|
||||
ret->_Vstep = 0;
|
||||
ret->_direction_up = true;
|
||||
ret->_current_direction_up = true;
|
||||
ret->_cycleNumber = INSTRUCTION.cycleNumber;
|
||||
return ret;
|
||||
}
|
||||
/*End of CV3 Mode*/
|
||||
|
||||
/* LSV Mode(LINEAR_SWEEP_VOLTAMMETRY)*/
|
||||
typedef struct _LSVMode{
|
||||
MEASURE;
|
||||
VOUT_PARA;
|
||||
}LSVMode;
|
||||
|
||||
LSVMode * InitLSVMode(){
|
||||
LSVMode *ret = malloc(sizeof(LSVMode));
|
||||
ret->_measureCurrent = 0;
|
||||
ret->_measureVin = 0;
|
||||
ret->_measureVout = 0;
|
||||
ret->_measureBat = 0;
|
||||
ret->_VoViSwitch = INSTRUCTION.VoViSwitch;
|
||||
ret->_Vinit = (INSTRUCTION.Vinit - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vmax = (INSTRUCTION.Vmax - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vmin = (INSTRUCTION.Vmin - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vset = 0;
|
||||
ret->_Vstep = 0;
|
||||
ret->_direction_up = true;
|
||||
ret->_current_direction_up = true;
|
||||
ret->_cycleNumber = INSTRUCTION.cycleNumber;
|
||||
return ret;
|
||||
}
|
||||
/*End of LSV Mode*/
|
||||
|
||||
/* CONSTANT_VSCAN Mode(CONSTANT_VSCAN)*/
|
||||
typedef struct _CVSCANMode{
|
||||
MEASURE;
|
||||
int32_t _Vinit;
|
||||
int32_t _Vset;
|
||||
}CVSCANMode;
|
||||
|
||||
CVSCANMode * InitCVSCANMode(){
|
||||
CVSCANMode *ret = malloc(sizeof(CVSCANMode));
|
||||
ret->_measureCurrent = 0;
|
||||
ret->_measureVin = 0;
|
||||
ret->_measureVout = 0;
|
||||
ret->_measureBat = 0;
|
||||
ret->_VoViSwitch = INSTRUCTION.VoViSwitch;
|
||||
ret->_Vinit = (INSTRUCTION.Vinit - 25000) * 4 * 10000; //[5nV]
|
||||
ret->_Vset = 0;
|
||||
return ret;
|
||||
}
|
||||
/*End of CONSTANT_VSCAN Mode*/
|
||||
|
||||
/* Cycle CC Mode */
|
||||
typedef struct _CCCMode{
|
||||
CC_PARA;
|
||||
int32_t _measureCurrent;
|
||||
uint8_t _VoViSwitch;
|
||||
uint8_t Charge;
|
||||
int32_t BatteryV;
|
||||
int32_t value;
|
||||
uint16_t Done;
|
||||
uint32_t VMax;
|
||||
uint32_t VMin;
|
||||
int32_t _measureVin;
|
||||
int32_t Vset;
|
||||
int32_t Iset;
|
||||
int32_t (*_Transform2RealnA)(struct CCModePara *);
|
||||
|
||||
/* Vmax and Vmin */
|
||||
// Vmax protect battery charge
|
||||
@@ -461,7 +357,7 @@ typedef struct _CCCMode{
|
||||
|
||||
CCCMode * InitCCCMode(){
|
||||
CCCMode *ret = malloc(sizeof(CCCMode));
|
||||
ret->_MeasureData = 0;
|
||||
ret->_measureCurrent = 0;
|
||||
ret->Charge = 1;
|
||||
ret->BatteryV = 0;
|
||||
|
||||
@@ -476,52 +372,58 @@ CCCMode * InitCCCMode(){
|
||||
ret->_Transform2RealnA = &_Transform2RealnA;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* End of Cycle CC Mode */
|
||||
|
||||
/** Potential State Mode **/
|
||||
typedef struct _PS{
|
||||
// measure
|
||||
MEASURE; // circuit current
|
||||
int32_t _measureCurrent;
|
||||
uint8_t _VoViSwitch;
|
||||
int32_t ReferenceVolt;
|
||||
int32_t _MeasureVolt;
|
||||
VOUT_PARA;
|
||||
uint16_t _VoltOut;
|
||||
uint16_t _originVolt;
|
||||
uint16_t _stopVolt;
|
||||
uint16_t _step;
|
||||
uint16_t _StepTime;
|
||||
uint16_t _cycleNumber;
|
||||
}PSMode;
|
||||
|
||||
PSMode *InitPSMode(){
|
||||
PSMode *ret = malloc(sizeof(PSMode));
|
||||
ret->_MeasureData = 0;
|
||||
// ret->SetMeasureData = &_SetMeasureData;
|
||||
// ret->GetMeasureData = &_GetMeasureData;
|
||||
ret->_measureCurrent = 0;
|
||||
ret->ReferenceVolt = 0;
|
||||
ret->_MeasureVolt = INSTRUCTION.VoltOrigin;
|
||||
ret->_MeasureVolt = INSTRUCTION.Ve1;
|
||||
|
||||
ret->_VoltOut = DAC_ZERO; // 25000 is DAC_ZERO
|
||||
ret->_VOrigin = INSTRUCTION.VoltOrigin;
|
||||
ret->_VStop = INSTRUCTION.VoltFinal;
|
||||
ret->_Step = INSTRUCTION.Step;
|
||||
ret->_originVolt = INSTRUCTION.Ve1;
|
||||
ret->_stopVolt = INSTRUCTION.Ve2;
|
||||
ret->_step = INSTRUCTION.step;
|
||||
ret->_StepTime = INSTRUCTION.StepTime; // STEPTIME_ONE_SEC
|
||||
ret->_CycleNumber = INSTRUCTION.CycleNumber;
|
||||
ret->_cycleNumber = INSTRUCTION.cycleNumber;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** End of Potential State Mode **/
|
||||
|
||||
typedef union _WorkMode{
|
||||
// Measure only
|
||||
ITMode *IT;
|
||||
VTMode *VT;
|
||||
|
||||
// Output Only
|
||||
VoltOutMode *VO;
|
||||
|
||||
// Measure only
|
||||
ITMode *IT;
|
||||
VTMode *VT;
|
||||
|
||||
// Measure + Output
|
||||
RTMode *RT;
|
||||
IVMode *IV;
|
||||
CVMode *CV;
|
||||
RTMode *RT;
|
||||
CCMode *CC;
|
||||
// CCCMode *CCC;
|
||||
CV3Mode *CV3;
|
||||
LSVMode *LSV;
|
||||
CVSCANMode *CVSCAN;
|
||||
PSMode *PS;
|
||||
// CCCMode *CCC;
|
||||
}WorkMode;
|
||||
|
||||
WorkMode *CreateWorkMode(){
|
||||
@@ -531,27 +433,36 @@ WorkMode *CreateWorkMode(){
|
||||
|
||||
void InitWorkMode(WorkMode *WM){
|
||||
switch(INSTRUCTION.eliteFxn){
|
||||
case VOLT_OUTPUT:
|
||||
WM->VO = InitVoltOutMode();
|
||||
break;
|
||||
case IT_CURVE:
|
||||
WM->IT = InitITMode();
|
||||
break;
|
||||
case VT_CURVE:
|
||||
WM->VT = InitVTMode();
|
||||
break;
|
||||
case ZT_CURVE:
|
||||
WM->RT = InitRTMode();
|
||||
break;
|
||||
case IV_CURVE:
|
||||
WM->IV = InitIVMode();
|
||||
break;
|
||||
case CV_CURVE:
|
||||
WM->CV = InitCVMode();
|
||||
break;
|
||||
case VOLT_OUTPUT:
|
||||
WM->VO = InitVoltOutMode();
|
||||
break;
|
||||
case ZT_CURVE:
|
||||
WM->RT = InitRTMode();
|
||||
break;
|
||||
case VT_CURVE:
|
||||
WM->VT = InitVTMode();
|
||||
break;
|
||||
case IT_CURVE:
|
||||
WM->IT = InitITMode();
|
||||
break;
|
||||
case CONSTANT_CURRENT:
|
||||
WM->CC = InitCCMode();
|
||||
break;
|
||||
case CYCLIC_VOLTAMMETRY:
|
||||
WM->CV3 = InitCV3Mode();
|
||||
break;
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:
|
||||
WM->LSV = InitLSVMode();
|
||||
break;
|
||||
case CONSTANT_VSCAN:
|
||||
WM->CVSCAN = InitCVSCANMode();
|
||||
break;
|
||||
// case CYCLE_CONSTANT_CURRENT:
|
||||
// WM->CCC = InitCCCMode();
|
||||
// break;
|
||||
@@ -563,6 +474,30 @@ void InitWorkMode(WorkMode *WM){
|
||||
|
||||
void FreeWorkMode(WorkMode *WM){
|
||||
switch(INSTRUCTION.eliteFxn){
|
||||
case VOLT_OUTPUT:
|
||||
if(WM->VO != NULL){
|
||||
free(WM->VO);
|
||||
WM->VO = NULL;
|
||||
}
|
||||
break;
|
||||
case IT_CURVE:
|
||||
if(WM->IT != NULL){
|
||||
free(WM->IT);
|
||||
WM->IT = NULL;
|
||||
}
|
||||
break;
|
||||
case VT_CURVE:
|
||||
if(WM->VT != NULL){
|
||||
free(WM->VT);
|
||||
WM->VT = NULL;
|
||||
}
|
||||
break;
|
||||
case ZT_CURVE:
|
||||
if(WM->RT != NULL){
|
||||
free(WM->RT);
|
||||
WM->RT = NULL;
|
||||
}
|
||||
break;
|
||||
case IV_CURVE:
|
||||
if(WM->IV != NULL){
|
||||
free(WM->IV);
|
||||
@@ -575,36 +510,30 @@ void FreeWorkMode(WorkMode *WM){
|
||||
WM->CV = NULL;
|
||||
}
|
||||
break;
|
||||
case VOLT_OUTPUT:
|
||||
if(WM->VO != NULL){
|
||||
free(WM->VO);
|
||||
WM->VO = NULL;
|
||||
}
|
||||
break;
|
||||
case ZT_CURVE:
|
||||
if(WM->RT != NULL){
|
||||
free(WM->RT);
|
||||
WM->RT = NULL;
|
||||
}
|
||||
break;
|
||||
case VT_CURVE:
|
||||
if(WM->VT != NULL){
|
||||
free(WM->VT);
|
||||
WM->VT = NULL;
|
||||
}
|
||||
break;
|
||||
case IT_CURVE:
|
||||
if(WM->IT != NULL){
|
||||
free(WM->IT);
|
||||
WM->IT = NULL;
|
||||
}
|
||||
break;
|
||||
case CONSTANT_CURRENT:
|
||||
if(WM->CC != NULL){
|
||||
free(WM->CC);
|
||||
WM->CC = NULL;
|
||||
}
|
||||
break;
|
||||
case CYCLIC_VOLTAMMETRY:
|
||||
if(WM->CV3 != NULL){
|
||||
free(WM->CV3);
|
||||
WM->CV3 = NULL;
|
||||
}
|
||||
break;
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:
|
||||
if(WM->LSV != NULL){
|
||||
free(WM->LSV);
|
||||
WM->LSV = NULL;
|
||||
}
|
||||
break;
|
||||
case CONSTANT_VSCAN:
|
||||
if(WM->CVSCAN != NULL){
|
||||
free(WM->CVSCAN);
|
||||
WM->CVSCAN = NULL;
|
||||
}
|
||||
break;
|
||||
// case CYCLE_CONSTANT_CURRENT:
|
||||
// if(WM->CCC != NULL){
|
||||
// free(WM->CCC);
|
||||
@@ -612,13 +541,13 @@ void FreeWorkMode(WorkMode *WM){
|
||||
// }
|
||||
// break;
|
||||
default:
|
||||
if(WM->IV != NULL){
|
||||
free(WM->IV);
|
||||
WM->IV = NULL;
|
||||
if(WM->VT != NULL){
|
||||
free(WM->VT);
|
||||
WM->VT = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// free(WM);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+160
-86
@@ -2,108 +2,182 @@
|
||||
#ifndef ELITEZT
|
||||
#define ELITEZT
|
||||
|
||||
static void ZT_notify(int32_t impedance);
|
||||
|
||||
// output a certain voltage e.g. 2v
|
||||
// and measure the input voltage
|
||||
// => calculate the resister
|
||||
// change the output voltage step
|
||||
// => get a R-T curve (with resolution = 1 sample/volt step )
|
||||
static void ZT_Plot(RTMode *RT) {
|
||||
// int32_t Real_Resister = 0;
|
||||
// static uint16_t CurrentMeasure=0, VoltMeasure=0;
|
||||
// uint8_t SPICurrent[SPI_ADC_SIZE]={0}, SPIVolt[SPI_ADC_SIZE]={0};
|
||||
// static uint8_t VoltCurrentSwitch = 0;
|
||||
|
||||
int32_t volt_32 = 0;
|
||||
int32_t current_32 = 0;
|
||||
int32_t resister_32 = 0;
|
||||
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
current_32 = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
current_32 = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
static void ZT_Plot(WorkMode *WorkModeData) {
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IT
|
||||
break;
|
||||
}
|
||||
case VT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->VT
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->RT
|
||||
break;
|
||||
}
|
||||
case IV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IV
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->CV
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
#define CURRENT_MODE WorkModeData->CC
|
||||
break;
|
||||
}
|
||||
case CYCLIC_VOLTAMMETRY:{
|
||||
#define CURRENT_MODE WorkModeData->CV3
|
||||
break;
|
||||
}
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:{
|
||||
#define CURRENT_MODE WorkModeData->LSV
|
||||
break;
|
||||
}
|
||||
case CONSTANT_VSCAN:{
|
||||
#define CURRENT_MODE WorkModeData->CVSCAN
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t ADCSwitch = 0;
|
||||
static uint8_t BatSwitch = 0;
|
||||
static int32_t VoltData = 0;
|
||||
|
||||
volt_32 = User2Real(INSTRUCTION.VoltConstant)*1e4;
|
||||
// ReadVolt(SPIVolt);
|
||||
// VoltMeasure = (uint16_t) (SPIVolt[0] << 8) | (uint16_t) (SPIVolt[1]);
|
||||
// volt_32 = DecodeADCVolt(VoltMeasure)*1e4;
|
||||
resister_32 = volt_32 / current_32;
|
||||
volt_32 = volt_32 / 1e4;
|
||||
if(batteryCheck_flag){
|
||||
if(ADCSwitch == 0){
|
||||
if(BatSwitch == 0){ /**read Iin(buffer),read bat**/
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
CURRENT_MODE->_measureCurrent = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
AutoGainChange(CURRENT_MODE->_measureCurrent);
|
||||
}else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
CURRENT_MODE->_measureCurrent = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
InputNotify(NOTIFY_CURRENT, CURRENT_MODE->_measureCurrent);
|
||||
DACenable(WorkModeData, VoltData, AFTER_READ_I);
|
||||
|
||||
NotifyVolt[0] = (uint8_t) (volt_32 >> 24);
|
||||
NotifyVolt[1] = (uint8_t) ((volt_32 & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t) ((volt_32 & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t) (volt_32 & 0x000000FF);
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 1){
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 2){
|
||||
headstage_battery_volt();
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
batteryCheck_flag = false;
|
||||
BatSwitch = 0;
|
||||
ADCSwitch = 3;
|
||||
}
|
||||
}
|
||||
else if(ADCSwitch == 1 || ADCSwitch == 3){
|
||||
if(BatSwitch == 0){ /**read Bat**/
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 1){
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 2){
|
||||
headstage_battery_volt();
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
batteryCheck_flag = false;
|
||||
BatSwitch = 0;
|
||||
ADCSwitch = 3;
|
||||
}
|
||||
}
|
||||
else if(ADCSwitch == 2){
|
||||
if(BatSwitch == 0){ /**read V(buffer),read bat**/
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
if(CURRENT_MODE->_VoViSwitch == 0x01){
|
||||
CURRENT_MODE->_measureVin = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
VoltData = CURRENT_MODE->_measureVin;
|
||||
}else if(CURRENT_MODE->_VoViSwitch == 0x00){
|
||||
CURRENT_MODE->_measureVout = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_DAC, spi_ADC_rxbuf);
|
||||
VoltData = CURRENT_MODE->_measureVout;
|
||||
}
|
||||
InputNotify(NOTIFY_VOLT, VoltData);
|
||||
DACenable(WorkModeData, VoltData, AFTER_READ_V);
|
||||
|
||||
NotifyCurrent[0] = (uint8_t) (current_32 >> 24);
|
||||
NotifyCurrent[1] = (uint8_t) ((current_32 & 0x00FF0000) >> 16);
|
||||
NotifyCurrent[2] = (uint8_t) ((current_32 & 0x0000FF00) >> 8);
|
||||
NotifyCurrent[3] = (uint8_t) (current_32 & 0x000000FF);
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 1){
|
||||
ReadBatVolt(spi_ADC_rxbuf);
|
||||
BatSwitch++;
|
||||
}else if(BatSwitch == 2){
|
||||
headstage_battery_volt();
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
batteryCheck_flag = false;
|
||||
BatSwitch = 0;
|
||||
ADCSwitch = 3;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
BatSwitch = 0;
|
||||
if(ADCSwitch == 0){ /**read Iin(buffer),read V**/
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
CURRENT_MODE->_measureCurrent = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
AutoGainChange(CURRENT_MODE->_measureCurrent);
|
||||
}else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
CURRENT_MODE->_measureCurrent = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
|
||||
NotifyImpedance[0] = (uint8_t) (resister_32 >> 24);
|
||||
NotifyImpedance[1] = (uint8_t) ((resister_32 & 0x00FF0000) >> 16);
|
||||
NotifyImpedance[2] = (uint8_t) ((resister_32 & 0x0000FF00) >> 8);
|
||||
NotifyImpedance[3] = (uint8_t) (resister_32 & 0x000000FF);
|
||||
InputNotify(NOTIFY_CURRENT, CURRENT_MODE->_measureCurrent);
|
||||
|
||||
// set ADC GAIN
|
||||
// if(INSTRUCTION.ResisterMeter == RESISTER_METER_LARGE){
|
||||
// INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
// }
|
||||
// else if(INSTRUCTION.ResisterMeter == RESISTER_METER_MIDDLE2){
|
||||
// INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
// }
|
||||
// else if(INSTRUCTION.ResisterMeter == RESISTER_METER_MIDDLE1){
|
||||
// INSTRUCTION.ADCGainLevel = GAIN_10K;
|
||||
// }
|
||||
// else{
|
||||
// INSTRUCTION.ADCGainLevel = GAIN_200K;
|
||||
// }
|
||||
// ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
DACenable(WorkModeData, VoltData, AFTER_READ_I);
|
||||
|
||||
// Use 9-th measure value as real-measure value
|
||||
// because some value in the begin are garbage
|
||||
// if(VoltCurrentSwitch < 9){
|
||||
// ADCChannelSelect(ADC_CH_CURRENT);
|
||||
// CPUdelay(10);
|
||||
// ADC_read(SPICurrent);
|
||||
// VoltCurrentSwitch ++;
|
||||
// }
|
||||
// else if(VoltCurrentSwitch == 9){
|
||||
// // read current
|
||||
// ADCChannelSelect(ADC_CH_CURRENT);
|
||||
// CPUdelay(10);
|
||||
// ADC_read(SPICurrent);
|
||||
// CurrentMeasure = (uint16_t) (SPICurrent[0] << 8) | (uint16_t) (SPICurrent[1]);
|
||||
// VoltCurrentSwitch ++;
|
||||
// }
|
||||
// else if(VoltCurrentSwitch <18){
|
||||
// // read volt
|
||||
// ADCChannelSelect(ADC_CH_VOLT);
|
||||
// CPUdelay(10);
|
||||
// ADC_read(SPIVolt);
|
||||
// VoltCurrentSwitch++;
|
||||
// }
|
||||
// else if(VoltCurrentSwitch == 18){
|
||||
// // read volt
|
||||
// ADCChannelSelect(ADC_CH_VOLT);
|
||||
// CPUdelay(10);
|
||||
// ADC_read(SPIVolt);
|
||||
// VoltMeasure = (uint16_t) (SPIVolt[0] << 8) | (uint16_t) (SPIVolt[1]);
|
||||
// VoltCurrentSwitch++;
|
||||
// }
|
||||
// else{
|
||||
// VoltCurrentSwitch = 0;
|
||||
// }
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 1){ /**read V**/
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 2){ /**read V(buffer),read Iin**/
|
||||
ReadADCVolt(CURRENT_MODE->_VoViSwitch);
|
||||
if(CURRENT_MODE->_VoViSwitch == 0x01){
|
||||
CURRENT_MODE->_measureVin = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
VoltData = CURRENT_MODE->_measureVin;
|
||||
}else if(CURRENT_MODE->_VoViSwitch == 0x00){
|
||||
CURRENT_MODE->_measureVout = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_DAC, spi_ADC_rxbuf);
|
||||
VoltData = CURRENT_MODE->_measureVout;
|
||||
}
|
||||
|
||||
// decode ADC value and put it into notify buffer
|
||||
// DecodeResister(INSTRUCTION.ADCGainLevel, CurrentMeasure, VoltMeasure);
|
||||
// Real_Resister = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
InputNotify(NOTIFY_VOLT, VoltData);
|
||||
|
||||
DACenable(WorkModeData, VoltData, AFTER_READ_V);
|
||||
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 3){ /**read Iin**/
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
ADCSwitch = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#undef CURRENT_MODE
|
||||
}
|
||||
|
||||
static void ZT_Vscan(RTMode *RT){
|
||||
if(vscanReset){
|
||||
Vset = ((int32_t)(INSTRUCTION.VoltConstant) - 25000) * 4 * 10000; //[5nV]
|
||||
OneWayVoltScan();
|
||||
}
|
||||
|
||||
if(!vscanReset){
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
***********************************************************
|
||||
Read battery's method
|
||||
***********************************************************
|
||||
1.ReadBatVolt(spi_ADC_rxbuf)
|
||||
let "spi_ADC_rxbuf" be 8000
|
||||
8000 * 187.5uV * 2 = 3V ;
|
||||
2.AONBatMonBatteryVoltageGet()
|
||||
let "AONBatMonBatteryVoltageGet()" be 768
|
||||
768 * 125 / 320 / 100 = 3V ;
|
||||
|
||||
if you want to use first method, and get value 768
|
||||
conversion: 8000 * 187.5 * 1e-6 * 2 / 125 * 320 * 100 = 768
|
||||
=> 8000 * 12 / 125 = 768
|
||||
*/
|
||||
|
||||
#ifndef HEADSTAGE_BATT_H
|
||||
#define HEADSTAGE_BATT_H
|
||||
|
||||
#include <driverlib/aon_batmon.h>
|
||||
#define MAX_BATTERY_CAPACITY 4200
|
||||
|
||||
static uint8_t headstage_battery_percent() {
|
||||
static uint8_t battery_percent = 100;
|
||||
uint8_t internal_battery_percent;
|
||||
uint32_t internal_batt_sense = AONBatMonBatteryVoltageGet();
|
||||
internal_batt_sense = (internal_batt_sense * 125) >> 5;
|
||||
internal_batt_sense = (internal_batt_sense * 100) / MAX_BATTERY_CAPACITY;
|
||||
internal_battery_percent = internal_batt_sense & 0xFF;
|
||||
if (internal_battery_percent < battery_percent) battery_percent = internal_battery_percent;
|
||||
return battery_percent;
|
||||
}
|
||||
|
||||
static void headstage_battery_volt(){
|
||||
uint32_t bat_volt = 0;
|
||||
|
||||
ReadBatVolt(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);
|
||||
}
|
||||
|
||||
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;
|
||||
ADCSwitch = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HEADSTAGE_BATT_H
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#ifndef HEADSTAGE_POWER_H
|
||||
#define HEADSTAGE_POWER_H
|
||||
|
||||
#include <ti/drivers/Power.h>
|
||||
#include <ti/drivers/power/PowerCC26XX.h>
|
||||
|
||||
#define headstage_power_shutdown() Power_shutdown(NULL, 0)
|
||||
|
||||
#endif // HEADSTAGE_POWER_H
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
|
||||
#ifndef VERSION_DATE
|
||||
#define VERSION_DATE
|
||||
|
||||
#define VERSION_DATE_YEAR 20
|
||||
#define VERSION_DATE_MONTH 7
|
||||
#define VERSION_DATE_DAY 17
|
||||
#define VERSION_DATE_HOUR 10
|
||||
#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
|
||||
#endif
|
||||
+449
-351
@@ -369,72 +369,6 @@ characteristic change event
|
||||
INSTRUCTION -> spi_txbuf
|
||||
|
||||
*/
|
||||
|
||||
#ifndef HEADSTAGE_H
|
||||
#define HEADSTAGE_H
|
||||
|
||||
// product information
|
||||
#define DEVICE_NAME "Elite-ZM-v1.4-re"
|
||||
#define MAJOR_PRODUCT_NUMBER 0
|
||||
#define MINOR_PRODUCT_NUMBER 2
|
||||
#define MAJOR_VERSION_NUMBER 1
|
||||
#define MINOR_VERSION_NUMBER 2
|
||||
|
||||
#define ELITE_VERSION_1_4
|
||||
//#define ELITE_VERSION_1_3
|
||||
|
||||
#include <driverlib/timer.h>
|
||||
#include <ti/drivers/SPI.h>
|
||||
#include <ti/drivers/dma/UDMACC26XX.h>
|
||||
#include <ti/drivers/spi/SPICC26XXDMA.h>
|
||||
#include <ti/drivers/timer/GPTimerCC26XX.h>
|
||||
#include <ti/sysbios/BIOS.h>
|
||||
#include <ti/sysbios/knl/Semaphore.h>
|
||||
#include <xdc/runtime/Timestamp.h>
|
||||
#include <xdc/runtime/Types.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <ti/sysbios/knl/Clock.h>
|
||||
#ifdef ICALL_EVENTS
|
||||
#include <ti/sysbios/knl/Event.h>
|
||||
#else //! ICALL_EVENTS
|
||||
#include <ti/sysbios/knl/Semaphore.h>
|
||||
#endif // ICALL_EVENTS
|
||||
#include <ti/sysbios/hal/Hwi.h>
|
||||
#include <ti/sysbios/knl/Queue.h>
|
||||
|
||||
#define DARKLED 0xE1
|
||||
#define LIGHTLED 0xE8
|
||||
static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue);
|
||||
#define LEDPowerON() LED_color(DARKLED, 0x00, 0xFA, 0x00)
|
||||
|
||||
#ifdef USE_ICALL
|
||||
#include <icall.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
// Internal Events for RTOS application
|
||||
#ifndef RTOSPARA
|
||||
#define RTOSPARA
|
||||
#define SBP_STATE_CHANGE_EVT 0x0001
|
||||
#define SBP_CHAR_CHANGE_EVT 0x0002
|
||||
#define SBP_PERIODIC_EVT 0x0004
|
||||
#define SBP_CONN_EVT_END_EVT 0x0008
|
||||
#define SBP_KEY_CHANGE_EVT 0x0010
|
||||
#endif
|
||||
|
||||
static Clock_Struct periodicClock;
|
||||
|
||||
#include "bcomdef.h"
|
||||
|
||||
#include "simple_gatt_profile.h"
|
||||
|
||||
static bool PeriodicEvent = false;
|
||||
static bool InitPeriodicEvent = true;
|
||||
static ICall_Semaphore semaphore;
|
||||
static uint16_t events;
|
||||
|
||||
/*================
|
||||
==== gptimer ====
|
||||
===============*/
|
||||
@@ -454,44 +388,142 @@ static uint16_t events;
|
||||
|
||||
/* system use SPI parameters */
|
||||
|
||||
#ifndef HEADSTAGE_H
|
||||
#define HEADSTAGE_H
|
||||
|
||||
#include <driverlib/timer.h>
|
||||
#include <ti/drivers/SPI.h>
|
||||
#include <ti/drivers/dma/UDMACC26XX.h>
|
||||
#include <ti/drivers/spi/SPICC26XXDMA.h>
|
||||
#include <ti/drivers/timer/GPTimerCC26XX.h>
|
||||
#include <ti/sysbios/BIOS.h>
|
||||
#include <ti/sysbios/knl/Semaphore.h>
|
||||
#include <xdc/runtime/Timestamp.h>
|
||||
#include <xdc/runtime/Types.h>
|
||||
#include <stdbool.h>
|
||||
#include <ti/sysbios/knl/Clock.h>
|
||||
#include <ti/sysbios/hal/Hwi.h>
|
||||
#include <ti/sysbios/knl/Queue.h>
|
||||
#ifdef ICALL_EVENTS
|
||||
#include <ti/sysbios/knl/Event.h>
|
||||
#else //! ICALL_EVENTS
|
||||
#include <ti/sysbios/knl/Semaphore.h>
|
||||
#endif // ICALL_EVENTS
|
||||
#ifdef USE_ICALL
|
||||
#include <icall.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include "bcomdef.h"
|
||||
#include "simple_gatt_profile.h"
|
||||
|
||||
/*===================================
|
||||
==== headstage general variable ====
|
||||
==================================*/
|
||||
// Internal Events for RTOS application
|
||||
#ifndef RTOSPARA
|
||||
#define RTOSPARA
|
||||
#define SBP_STATE_CHANGE_EVT 0x0001
|
||||
#define SBP_CHAR_CHANGE_EVT 0x0002
|
||||
#define SBP_PERIODIC_EVT 0x0004
|
||||
#define SBP_CONN_EVT_END_EVT 0x0008
|
||||
#define SBP_KEY_CHANGE_EVT 0x0010
|
||||
#endif
|
||||
|
||||
// product information
|
||||
#define DEVICE_NAME "Elite"
|
||||
#define MAJOR_PRODUCT_NUMBER 0 //0:Elite ,1:Neulive
|
||||
#define MINOR_PRODUCT_NUMBER 2 //1:Elite_legacy(Ori_Neulive) 2:Elite_zm 3:Elite_bat
|
||||
#define MAJOR_VERSION_NUMBER 1
|
||||
#define MINOR_VERSION_NUMBER 5
|
||||
#define ELITE_VERSION_1_4
|
||||
//#define ELITE_VERSION_1_3
|
||||
|
||||
// buffer size
|
||||
#define BLE_CIS_BUFF_CHAR SIMPLEPROFILE_CHAR2
|
||||
|
||||
#define BLE_INS_BUFF_CHAR SIMPLEPROFILE_CHAR3
|
||||
|
||||
#define BLE_DAT_BUFF_CHAR SIMPLEPROFILE_CHAR4
|
||||
|
||||
#define BLE_CIS_BUFF_SIZE SIMPLEPROFILE_CHAR2_LEN
|
||||
|
||||
#define BLE_INS_BUFF_SIZE SIMPLEPROFILE_CHAR3_LEN
|
||||
|
||||
//#ifndef BLE_DAT_BUFF_SIZE
|
||||
#define BLE_DAT_BUFF_SIZE SIMPLEPROFILE_CHAR4_LEN
|
||||
//#endif
|
||||
#define CHANNEL_COUNT 16
|
||||
|
||||
// define BT instruction
|
||||
#define INS_TYPE_RIS 0x30
|
||||
#define INS_TYPE_VIS 0xC0
|
||||
#define INS_TYPE_CIS 0x70
|
||||
|
||||
// VIS (virtual instruction)
|
||||
#define VIS_RST 0xF0
|
||||
#define VIS_ASK 0x30
|
||||
#define VIS_STI 0xC0
|
||||
#define VIS_FUH 0x90
|
||||
#define VIS_INT 0x60
|
||||
#define VIS_SHIFT_200K 0xA0
|
||||
#define VIS_SHIFT_10K 0xE0
|
||||
#define VIS_SHIFT_200R 0x80
|
||||
#define VIS_DEVICE_SHINY 0x10
|
||||
#define VIS_SHINY_DIS 0x20
|
||||
#define VIS_CC_ZERO 0x40
|
||||
|
||||
// RIS (real instruction)
|
||||
#define IV_CURVE 0x10
|
||||
#define CV_CURVE 0x20
|
||||
#define VOLT_OUTPUT 0x30
|
||||
#define ZT_CURVE 0x40
|
||||
#define VT_CURVE 0x50
|
||||
#define IT_CURVE 0x60
|
||||
#define SET_SAMPLE_RATE 0x70
|
||||
#define SET_ADC_GAIN 0x80
|
||||
#define DIFFERENTIAL_PULSE_VOLTAMMETRY 0xA0
|
||||
#define SQUARE_WAVE_VOLTAMMETRY 0xB0
|
||||
#define CYCLIC_VOLTAMMETRY 0xC0
|
||||
#define CONSTANT_CURRENT 0xD0
|
||||
#define CYCLE_CONSTANT_CURRENT 0xF0
|
||||
#define HIGH_CYCLE_CYCLIC_VOLTAMMETRY 0x01
|
||||
#define LINEAR_SWEEP_VOLTAMMETRY 0x02
|
||||
#define CONSTANT_VSCAN 0x03
|
||||
#define ADC_TEST 0x90
|
||||
|
||||
// CIS (control instruction)
|
||||
#define CIS_VERSION 0x40
|
||||
#define CIS_VOLT 0x10
|
||||
|
||||
#define DARKLED 0xE1
|
||||
#define LIGHTLED 0xE8
|
||||
#define LEDPowerON() LED_color(DARKLED, 0x00, 0xFA, 0x00)
|
||||
#define STEP_TO_VSETRATE(step) step2VsetRate(step)
|
||||
#define VMAX(v1,v2) ((v1 >= v2) ? v1 : v2)
|
||||
#define VMIN(v1,v2) ((v1 < v2) ? v1 : v2)
|
||||
#define VDIRECTION(v1,v2) ((v1 > v2) ? 0 : 1)
|
||||
#define AFTER_READ_I 0
|
||||
#define AFTER_READ_V 1
|
||||
#include "EliteWorkData.h"
|
||||
|
||||
/**
|
||||
* application use instruction receive buffer.
|
||||
* the length equals to the characteristic 3 which value is 12 bytes.
|
||||
*/
|
||||
static uint8_t ins_buf[BLE_INS_BUFF_SIZE] = {0};
|
||||
|
||||
#define CHANNEL_COUNT 16
|
||||
* the pointer to point which channel is used currently.
|
||||
* -1 for not beginning.
|
||||
*/
|
||||
static int8 channel_pointer = -1;
|
||||
|
||||
/**
|
||||
* boolean array for indicate which channel is enable.
|
||||
*/
|
||||
* boolean array for indicate which channel is enable.
|
||||
*/
|
||||
static uint8 channel_table[CHANNEL_COUNT] = {0};
|
||||
|
||||
/**
|
||||
* the pointer to point which channel is used currently.
|
||||
* -1 for not beginning.
|
||||
*/
|
||||
static int8 channel_pointer = -1;
|
||||
* application use instruction receive buffer.
|
||||
* the length equals to the characteristic 3 which value is 12 bytes.
|
||||
*/
|
||||
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};
|
||||
|
||||
static Clock_Struct periodicClock;
|
||||
static bool PeriodicEvent = false;
|
||||
static bool InitPeriodicEvent = true;
|
||||
static ICall_Semaphore semaphore;
|
||||
static uint16_t events;
|
||||
|
||||
/*=====================================
|
||||
==== headstage function prototype ====
|
||||
@@ -523,153 +555,108 @@ static bool update_ins_rec_buffer();
|
||||
* send instruction to Z meter
|
||||
*/
|
||||
|
||||
// periodic event control
|
||||
static void EliteDACControl();
|
||||
static void EliteADCControl();
|
||||
static void EliteNotifyControl();
|
||||
|
||||
// ADC function
|
||||
static void ADC_write(uint8_t ADCin);
|
||||
static void ADC_read(uint8_t *ADCdata);
|
||||
static void ADC_test_read(uint8_t *ADCdata); // for auto shifting
|
||||
|
||||
static void ADCGainControl(uint8_t ADCLevel);
|
||||
static void ADCChannelSelect(uint8_t ADCChannel);
|
||||
static int32_t DecodeADCVolt(uint16_t ADC_measure);
|
||||
static int32_t DecodeADCCurrent(uint8_t ADCGain, uint16_t ADC_measure);
|
||||
static void Impedance_Calculate(uint16_t Voltage, int32_t Current);
|
||||
static int32_t DecodeADCValue(uint8_t ADCGain, uint8_t ADCChannel, uint8_t *ADC_raw);
|
||||
static void ADC_overflow(uint8_t gain, uint8_t *rawdata);
|
||||
|
||||
// DAC function
|
||||
static uint16_t Usercode_Correction_to_DAC(uint16_t usercode);
|
||||
|
||||
// Elite key detection & turn on/ shutdown function
|
||||
static void EliteKeyPress(uint8_t key);
|
||||
static bool TurnOnElite(uint8_t key);
|
||||
static void WorkModeLED();
|
||||
static void KeyWorkModeLED();
|
||||
|
||||
/*=====================================
|
||||
==== instruction update function ====
|
||||
====================================*/
|
||||
|
||||
// callback for Z meter
|
||||
typedef void (*update_instruction_callback_type)(uint8_t ins_type, uint8_t ins_len, uint8_t *ins);
|
||||
|
||||
static update_instruction_callback_type update_instruction_callback = NULL;
|
||||
|
||||
static void set_update_instruction_callback(update_instruction_callback_type callback) {
|
||||
update_instruction_callback = callback;
|
||||
}
|
||||
|
||||
// define BT instruction
|
||||
#define INS_TYPE_RIS 0b00110000
|
||||
#define INS_TYPE_VIS 0b11000000
|
||||
#define INS_TYPE_CIS 0b01110000
|
||||
|
||||
// virtual instruction
|
||||
#define VIS_RST 0b11110000
|
||||
#define VIS_ASK 0b00110000
|
||||
#define VIS_STI 0b11000000
|
||||
#define VIS_FUH 0b10010000
|
||||
#define VIS_INT 0b01100000
|
||||
#define VIS_SHIFT_200K 0b10100000
|
||||
#define VIS_SHIFT_10K 0b11100000
|
||||
#define VIS_SHIFT_200R 0b10000000
|
||||
|
||||
// real instruction
|
||||
#define IV_CURVE 0b00010000
|
||||
#define CV_CURVE 0b00100000
|
||||
#define VOLT_OUTPUT 0b00110000
|
||||
#define ZT_CURVE 0b01000000
|
||||
#define VT_CURVE 0b01010000
|
||||
#define IT_CURVE 0b01100000
|
||||
#define SET_SAMPLE_RATE 0b01110000
|
||||
#define SET_ADC_GAIN 0b10000000
|
||||
#define DIFFERENTIAL_PULSE_VOLTAMMETRY 0b10100000
|
||||
#define SQUARE_WAVE_VOLTAMMETRY 0b10110000
|
||||
#define POTENTIAL_STATE 0b11000000
|
||||
#define CONSTANT_CURRENT 0b11010000
|
||||
#define SET_RESISTER_LEVEL 0b11100000
|
||||
#define CYCLE_CONSTANT_CURRENT 0b11110000
|
||||
|
||||
// CIS instruction
|
||||
|
||||
// test instruction
|
||||
#define ADC_TEST 0b10010000
|
||||
|
||||
// DAC and ADC function
|
||||
static uint16_t DAC_outputV(uint16_t voltLV);
|
||||
static int32_t DAC_to_realV(uint16_t DACcode);
|
||||
|
||||
static uint16_t DACUserCode = 0x0000;
|
||||
|
||||
static uint32_t SampleRateTable[6] = {100, 1000, 10000, 50000, 100000, 1000000}; // 100 =>100 Hz, 1000000=>0.01 Hz
|
||||
|
||||
// record value for IV curve to calculate average current
|
||||
static uint8_t DiscardIVFirstData = 1;
|
||||
static uint16_t avg_number = 0;
|
||||
static long long ADCRealCurrent_long = 0;
|
||||
|
||||
// Constant Current Mode function
|
||||
static uint8_t CCModeDACEnable = 0;
|
||||
static int32_t CCModeReadCurrent();
|
||||
static int32_t CCModeVoltOut();
|
||||
static void CCCurrent2IUC();
|
||||
|
||||
// for DPVCurve SWVCurve
|
||||
static uint16_t Amplitude;
|
||||
static uint8_t PulseWidth;
|
||||
static uint16_t PulseWidth_16;
|
||||
static uint8_t PulsePeriod;
|
||||
static uint16_t PulsePeriod_16;
|
||||
static uint32_t SampleRateTable[6] = {100, 1000, 10000, 50000, 100000, 1000000}; // 100 =>100 Hz, 1000000=>0.01 Hz
|
||||
static uint32_t VsetRateTable[5] = {2, 10, 100, 1000, 10000};
|
||||
static bool batteryCheck_flag;
|
||||
static bool batteryADC_flag;
|
||||
static bool ADC_flag;
|
||||
static bool vscan_flag;
|
||||
static bool notify_flag;
|
||||
static bool notifyFirst_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;
|
||||
|
||||
// counter
|
||||
struct _CT{
|
||||
uint32_t SampleRate_counter;
|
||||
uint16_t StepTimeCounter;
|
||||
uint16_t NotifyCounter;
|
||||
uint32_t StandByCounter;
|
||||
}CT = {0};
|
||||
// ADC function
|
||||
static void ADC_write(uint8_t ADCin);
|
||||
static void ADC_read(uint8_t *ADCdata);
|
||||
static void ADCGainControl(uint8_t ADCLevel);
|
||||
static void ADCChannelSelect(uint8_t ADCChannel);
|
||||
static void AutoGainChange();
|
||||
static int32_t DecodeADCVolt(uint16_t ADC_measure);
|
||||
static int32_t DecodeADCVoutVolt(uint16_t ADC_measure);
|
||||
static int32_t DecodeADCCurrent(uint8_t ADCGain, uint16_t ADC_measure);
|
||||
static int32_t DecodeADCValue(uint8_t ADCGain, uint8_t ADCChannel, uint8_t *ADC_raw);
|
||||
static void headstage_battery_volt();
|
||||
static void EliteADCBattery();
|
||||
|
||||
//static bool NotifyReady = false;
|
||||
static void InitFlag();
|
||||
static void InitCT();
|
||||
|
||||
#include "EliteWorkData.h"
|
||||
// real instruction fxn
|
||||
static uint16_t VoltScan(WorkMode *WorkModeData); // used in I-V and cyclic
|
||||
// DAC function
|
||||
static uint16_t DAC_outputV(uint16_t voltLV);
|
||||
static int32_t DAC_to_realV(uint16_t DACcode);
|
||||
static uint16_t Usercode_Correction_to_DAC(uint16_t usercode);
|
||||
static void DACCode2Real2Notify(uint16_t DACcode); // send notify voltage after VoltScan()
|
||||
|
||||
//static void VOLT_OUTPUT();
|
||||
static void ZT_Plot(RTMode *RT);
|
||||
static void VT_Plot(VTMode *VT);
|
||||
static int32_t IT_PlotIT_Plot(WorkMode *WorkModeData);
|
||||
|
||||
// the following fxn do the same thing
|
||||
// IVCurve_T is called if Vorigin > Vfinal, vice versa
|
||||
static uint16_t OldDAC2UserCode(uint16_t OldDAC);
|
||||
static uint16_t StepCode2DACcode(uint16_t StepCode);
|
||||
static uint8_t OldStep2NewStep(uint8_t OldStep);
|
||||
static uint16_t OldStep2NewStepTime(uint8_t StepTime);
|
||||
static uint8_t IVdone = 0;
|
||||
|
||||
static uint16_t OneWayVoltScan(IVMode *IV);
|
||||
static void ramp_test();
|
||||
static uint16_t DPVCurve(WorkMode *WorkModeData);
|
||||
static uint16_t CVCurve(CVMode *CV);
|
||||
static uint16_t SWVCurve(WorkMode *WorkModeData);
|
||||
|
||||
static void reset();
|
||||
static void Eliteinterrupt();
|
||||
static void CleanBuffer();
|
||||
|
||||
static void SendNotify();
|
||||
|
||||
// Elite key detection & turn on/ shutdown function (peripheral hardware control)
|
||||
static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue);
|
||||
static void WorkModeLED();
|
||||
static void KeyWorkModeLED();
|
||||
static void EliteKeyPress(uint8_t key);
|
||||
static bool TurnOnElite(uint8_t key);
|
||||
static bool If10Von = false;
|
||||
static void TurnOn10V();
|
||||
|
||||
// periodic event control
|
||||
static void EliteADCControl();
|
||||
static void EliteVscanControl();
|
||||
static void EliteDone();
|
||||
|
||||
//mode (Vset)
|
||||
static void LSV_Vscan(LSVMode *LSV);
|
||||
static void CVSCAN_Vscan(CVSCANMode *CVSCAN);
|
||||
static void CV3_Vscan(CV3Mode *CV3);
|
||||
static void CC_Vscan(CCMode *CC);
|
||||
|
||||
//mode (DAC)
|
||||
static void DACenable(WorkMode *WorkModeData, int32_t VoltData, uint8_t afterRead);
|
||||
static uint16_t OneWayVoltScan();
|
||||
static void CalcuResistance(RTMode *RT, int32_t VoltData);
|
||||
static uint16_t CV3Curve(CV3Mode *CV3);
|
||||
static uint16_t LSVCurve(LSVMode *LSV);
|
||||
static uint16_t CVSCANCurve(CVSCANMode *CVSCAN);
|
||||
static uint16_t SWVCurve(WorkMode *WorkModeData);
|
||||
static uint16_t DPVCurve(WorkMode *WorkModeData);
|
||||
|
||||
//mode (notify)
|
||||
static void SendNotify();
|
||||
static void FlushNotify();
|
||||
static void initDATBuf();
|
||||
static void initINSBuf();
|
||||
static void initCISBuf();
|
||||
static void initRawDataBuf();
|
||||
|
||||
//mode (step)
|
||||
static uint32_t OldStep2NewStepTime(uint32_t StepTime);
|
||||
static void step2VsetRate(uint32_t step);
|
||||
|
||||
//init parameter
|
||||
static void InitCT();
|
||||
static void InitGPT();
|
||||
static void InitEliteGPtimer();
|
||||
static void InitFlag();
|
||||
static void InitEliteFlag();
|
||||
static void reset();
|
||||
static void Eliteinterrupt();
|
||||
|
||||
#include "EliteInstruction.h"
|
||||
#include "EliteADC.h"
|
||||
@@ -695,6 +682,12 @@ static void TurnOn10V();
|
||||
#include "EliteZTCurve.h"
|
||||
#include "EliteCCCMode.h"
|
||||
#include "impedance_meter.h"
|
||||
#include "Elite_version.h"
|
||||
#include "EliteCV3Mode.h"
|
||||
#include "EliteLSVMode.h"
|
||||
#include "EliteCVSCANMode.h"
|
||||
#include "Elite_batt.h"
|
||||
#include "Elite_power.h"
|
||||
|
||||
// update instruction for Z meter
|
||||
static void update_ZM_instruction(uint8 *ins) {
|
||||
@@ -710,56 +703,200 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
}
|
||||
|
||||
switch (ins_type) {
|
||||
/*** These are real instruction ***/
|
||||
|
||||
case INS_TYPE_RIS: {
|
||||
switch (ins[2]) {
|
||||
case IV_CURVE: {
|
||||
// CleanBuffer();
|
||||
INSTRUCTION.eliteFxn = IV_CURVE;
|
||||
DACReset = true;
|
||||
INSTRUCTION.SampleRate = 100;
|
||||
INSTRUCTION.eliteFxn = IV_CURVE;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.Ve1 = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
INSTRUCTION.Ve2 = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
INSTRUCTION.Vinit = (int32_t)INSTRUCTION.Ve1;
|
||||
INSTRUCTION.Vmax = (int32_t)VMAX(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
INSTRUCTION.Vmin = (int32_t)VMIN(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
INSTRUCTION.directionInit = VDIRECTION(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
INSTRUCTION.notifyRate = (uint32_t)(ins[9]);
|
||||
INSTRUCTION.notifyRate = OldStep2NewStepTime(INSTRUCTION.notifyRate); //5000;10000;20000;
|
||||
INSTRUCTION.step = ((uint32_t)(ins[7]) << 8) | (uint32_t)(ins[8]);//1~1000 = 0.1mv ~ 100mv
|
||||
INSTRUCTION.step = INSTRUCTION.step * 100000 / INSTRUCTION.notifyRate;
|
||||
STEP_TO_VSETRATE(INSTRUCTION.step);
|
||||
INSTRUCTION.VsetRate = VsetRateTable[INSTRUCTION.VsetRateIndex];//N
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
INSTRUCTION.cycleNumber = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
// if (ins[3] | ins[4]) {
|
||||
INSTRUCTION.VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
// INSTRUCTION.VoltOrigin = Usercode_Correction_to_DAC(INSTRUCTION.VoltOrigin);
|
||||
// }
|
||||
// if (ins[5] | ins[6]) {
|
||||
INSTRUCTION.VoltFinal = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
// INSTRUCTION.VoltFinal = Usercode_Correction_to_DAC(INSTRUCTION.VoltFinal);
|
||||
// }
|
||||
case CV_CURVE: {
|
||||
INSTRUCTION.eliteFxn = CV_CURVE;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.Ve1 = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
INSTRUCTION.Ve2 = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
INSTRUCTION.Vinit = (int32_t)INSTRUCTION.Ve1;
|
||||
INSTRUCTION.Vmax = (int32_t)VMAX(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
INSTRUCTION.Vmin = (int32_t)VMIN(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
INSTRUCTION.directionInit = VDIRECTION(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
INSTRUCTION.notifyRate = (uint32_t)(ins[9]);
|
||||
INSTRUCTION.notifyRate = OldStep2NewStepTime(INSTRUCTION.notifyRate); //5000;10000;20000;
|
||||
INSTRUCTION.step = ((uint32_t)(ins[7]) << 8) | (uint32_t)(ins[8]);//1~1000 = 0.1mv ~ 100mv
|
||||
INSTRUCTION.step = INSTRUCTION.step * 100000 / INSTRUCTION.notifyRate;
|
||||
STEP_TO_VSETRATE(INSTRUCTION.step);
|
||||
INSTRUCTION.VsetRate = VsetRateTable[INSTRUCTION.VsetRateIndex];//N
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
INSTRUCTION.cycleNumber = ins[10];
|
||||
break;
|
||||
}
|
||||
|
||||
if (ins[7] | ins[8]) {
|
||||
INSTRUCTION.Step = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
|
||||
INSTRUCTION.Step = StepCode2DACcode(INSTRUCTION.Step);
|
||||
case VOLT_OUTPUT: {
|
||||
INSTRUCTION.eliteFxn = VOLT_OUTPUT;
|
||||
INSTRUCTION.VoltConstant = ( ((uint16_t)(ins[3])) << 8) | (uint16_t)(ins[4]);
|
||||
break;
|
||||
}
|
||||
|
||||
case ZT_CURVE: {
|
||||
INSTRUCTION.eliteFxn = ZT_CURVE;
|
||||
INSTRUCTION.notifyRate = (uint32_t)INSTRUCTION.sampleRate;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.VsetRate = 100;
|
||||
INSTRUCTION.VoltConstant = 25000 + 5000;
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
break;
|
||||
}
|
||||
|
||||
case VT_CURVE: {
|
||||
INSTRUCTION.eliteFxn = VT_CURVE;
|
||||
INSTRUCTION.notifyRate = (uint32_t)INSTRUCTION.sampleRate;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
break;
|
||||
}
|
||||
|
||||
case IT_CURVE: {
|
||||
INSTRUCTION.eliteFxn = IT_CURVE;
|
||||
INSTRUCTION.notifyRate = (uint32_t)INSTRUCTION.sampleRate;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
break;
|
||||
}
|
||||
|
||||
case CONSTANT_CURRENT:{
|
||||
INSTRUCTION.eliteFxn = CONSTANT_CURRENT;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.charge = ins[3]; //0:discharge 1:charge
|
||||
INSTRUCTION.constantCurrent = (uint32_t)(ins[4]) << 24 | (uint32_t)(ins[5]) << 16 | (uint32_t)(ins[6]) << 8 | (uint32_t)(ins[7]);
|
||||
INSTRUCTION.Vmax = (uint32_t)(ins[8]) << 8 | (uint32_t)(ins[9]);
|
||||
INSTRUCTION.Vmin = (uint32_t)(ins[10]) << 8 | (uint32_t)(ins[11]);
|
||||
INSTRUCTION.notifyRate = 500;
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
/*******************************************************
|
||||
controller instruction
|
||||
ins[3] -> Charge, 0:discharge 1:charge
|
||||
ins[6:9] -> ConstantCurrent, 0 ~ 15000uA : 0 ~ 1500000
|
||||
********************************************************/
|
||||
break;
|
||||
}
|
||||
|
||||
case CYCLIC_VOLTAMMETRY: {
|
||||
INSTRUCTION.eliteFxn = CYCLIC_VOLTAMMETRY;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.Vinit = ((int32_t)(ins[3]) << 8) | (int32_t)(ins[4]);
|
||||
INSTRUCTION.Ve1 = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
INSTRUCTION.Ve2 = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
|
||||
INSTRUCTION.Vmax = (int32_t)VMAX(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
INSTRUCTION.Vmin = (int32_t)VMIN(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
if(INSTRUCTION.Vinit > INSTRUCTION.Ve1 || INSTRUCTION.Vinit == INSTRUCTION.Vmax){
|
||||
INSTRUCTION.directionInit = 0;//0:reverse 1:forward
|
||||
}else if(INSTRUCTION.Vinit <= INSTRUCTION.Ve1 || INSTRUCTION.Vinit == INSTRUCTION.Vmin){
|
||||
INSTRUCTION.directionInit = 1;
|
||||
}
|
||||
// if (ins[9]) {
|
||||
INSTRUCTION.StepTime = ins[9];
|
||||
INSTRUCTION.StepTime = OldStep2NewStepTime(INSTRUCTION.StepTime);
|
||||
// }
|
||||
// if(ins[10]) {
|
||||
//INSTRUCTION.VoVi_Switch = ins[10];
|
||||
INSTRUCTION.VoVi_Switch = 0x01;
|
||||
// }
|
||||
INSTRUCTION.Currentmax = (int32_t)(ins[15]) << 24 | (int32_t)(ins[16]) << 16 | (int32_t)(ins[17]) << 8 | (int32_t)(ins[18]);
|
||||
INSTRUCTION.notifyRate = (uint32_t)(ins[13]) << 8 | (uint32_t)(ins[14]);
|
||||
INSTRUCTION.notifyRate = 10000 / INSTRUCTION.notifyRate * 10;
|
||||
//controller UI 0.01~1000mv send to Elite 1~100000
|
||||
INSTRUCTION.step = (uint32_t)(ins[9]) << 24 | (uint32_t)(ins[10]) << 16 | (uint32_t)(ins[11]) << 8 | (uint32_t)(ins[12]);
|
||||
STEP_TO_VSETRATE(INSTRUCTION.step);
|
||||
INSTRUCTION.VsetRate = VsetRateTable[INSTRUCTION.VsetRateIndex];//N
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
INSTRUCTION.cycleNumber = ins[19];
|
||||
break;
|
||||
}
|
||||
|
||||
case HIGH_CYCLE_CYCLIC_VOLTAMMETRY: {
|
||||
INSTRUCTION.eliteFxn = CYCLIC_VOLTAMMETRY;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.Vinit = ((int32_t)(ins[3]) << 8) | (int32_t)(ins[4]);
|
||||
INSTRUCTION.Ve1 = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
INSTRUCTION.Ve2 = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
|
||||
INSTRUCTION.Vmax = (int32_t)VMAX(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
INSTRUCTION.Vmin = (int32_t)VMIN(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
if(INSTRUCTION.Vinit > INSTRUCTION.Ve1 || INSTRUCTION.Vinit == INSTRUCTION.Vmax){
|
||||
INSTRUCTION.directionInit = 0;//0:reverse 1:forward
|
||||
}else if(INSTRUCTION.Vinit <= INSTRUCTION.Ve1 || INSTRUCTION.Vinit == INSTRUCTION.Vmin){
|
||||
INSTRUCTION.directionInit = 1;
|
||||
}
|
||||
INSTRUCTION.Currentmax = (int32_t)(ins[15]) << 24 | (int32_t)(ins[16]) << 16 | (int32_t)(ins[17]) << 8 | (int32_t)(ins[18]);
|
||||
INSTRUCTION.notifyRate = (uint32_t)(ins[13]) << 8 | (uint32_t)(ins[14]);
|
||||
INSTRUCTION.notifyRate = 10000 / INSTRUCTION.notifyRate * 10;
|
||||
//controller UI 0.01~1000mv send to Elite 1~100000
|
||||
INSTRUCTION.step = (uint32_t)(ins[9]) << 24 | (uint32_t)(ins[10]) << 16 | (uint32_t)(ins[11]) << 8 | (uint32_t)(ins[12]);
|
||||
STEP_TO_VSETRATE(INSTRUCTION.step);
|
||||
INSTRUCTION.VsetRate = VsetRateTable[INSTRUCTION.VsetRateIndex];//N
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
INSTRUCTION.cycleNumber = ins[19] * 100;
|
||||
break;
|
||||
}
|
||||
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:{
|
||||
INSTRUCTION.eliteFxn = LINEAR_SWEEP_VOLTAMMETRY;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.Ve1 = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
INSTRUCTION.Ve2 = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
INSTRUCTION.Vinit = (int32_t)INSTRUCTION.Ve1;
|
||||
INSTRUCTION.Vmax = (int32_t)VMAX(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
INSTRUCTION.Vmin = (int32_t)VMIN(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
INSTRUCTION.directionInit = VDIRECTION(INSTRUCTION.Ve1,INSTRUCTION.Ve2);
|
||||
INSTRUCTION.Currentmax = (int32_t)(ins[13]) << 24 | (int32_t)(ins[14]) << 16 | (int32_t)(ins[15]) << 8 | (int32_t)(ins[16]);
|
||||
INSTRUCTION.notifyRate = (uint32_t)(ins[11]) << 8 | (uint32_t)(ins[12]);
|
||||
INSTRUCTION.notifyRate = 10000 / INSTRUCTION.notifyRate * 10;
|
||||
//controller UI 0.01~1000mv send to Elite 1~100000
|
||||
INSTRUCTION.step = (uint32_t)(ins[7]) << 24 | (uint32_t)(ins[8]) << 16 | (uint32_t)(ins[9]) << 8 | (uint32_t)(ins[10]);
|
||||
STEP_TO_VSETRATE(INSTRUCTION.step);
|
||||
INSTRUCTION.VsetRate = VsetRateTable[INSTRUCTION.VsetRateIndex];//N
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
INSTRUCTION.cycleNumber = 1;//ins[17];
|
||||
break;
|
||||
}
|
||||
|
||||
case CONSTANT_VSCAN:{
|
||||
INSTRUCTION.eliteFxn = CONSTANT_VSCAN;
|
||||
INSTRUCTION.sampleRate = 15;
|
||||
INSTRUCTION.Vinit = ((int32_t)(ins[3]) << 8) | (int32_t)(ins[4]);
|
||||
INSTRUCTION.notifyRate = (uint32_t)(ins[5]) << 8 | (uint32_t)(ins[6]);
|
||||
INSTRUCTION.notifyRate = 10000 / INSTRUCTION.notifyRate * 10;
|
||||
INSTRUCTION.VsetRate = VsetRateTable[0];
|
||||
INSTRUCTION.VoViSwitch = 0x01;
|
||||
break;
|
||||
}
|
||||
|
||||
case CYCLE_CONSTANT_CURRENT:{
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case DIFFERENTIAL_PULSE_VOLTAMMETRY: {
|
||||
// CleanBuffer();
|
||||
INSTRUCTION.eliteFxn = DIFFERENTIAL_PULSE_VOLTAMMETRY;
|
||||
DACReset = true;
|
||||
|
||||
if (ins[3] | ins[4]) {
|
||||
INSTRUCTION.VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
INSTRUCTION.VoltOrigin = Usercode_Correction_to_DAC(INSTRUCTION.VoltOrigin);
|
||||
INSTRUCTION.Ve1 = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
INSTRUCTION.Ve1 = Usercode_Correction_to_DAC(INSTRUCTION.Ve1);
|
||||
}
|
||||
if (ins[5] | ins[6]) {
|
||||
INSTRUCTION.VoltFinal = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
INSTRUCTION.VoltFinal = Usercode_Correction_to_DAC(INSTRUCTION.VoltFinal);
|
||||
INSTRUCTION.Ve2 = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
INSTRUCTION.Ve2 = Usercode_Correction_to_DAC(INSTRUCTION.Ve2);
|
||||
}
|
||||
|
||||
if (ins[7] | ins[8]) {
|
||||
INSTRUCTION.Step = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
|
||||
INSTRUCTION.Step = StepCode2DACcode(INSTRUCTION.Step);
|
||||
INSTRUCTION.step = ((uint32_t)(ins[7]) << 8) | (uint32_t)(ins[8]);
|
||||
}
|
||||
if (ins[9]) {
|
||||
INSTRUCTION.StepTime = ins[9];
|
||||
@@ -776,27 +913,25 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
PulseWidth = ins[13];
|
||||
}
|
||||
if(ins[14]) {
|
||||
INSTRUCTION.VoVi_Switch = ins[14];
|
||||
}
|
||||
INSTRUCTION.VoViSwitch = ins[14];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SQUARE_WAVE_VOLTAMMETRY: {
|
||||
// CleanBuffer();
|
||||
INSTRUCTION.eliteFxn = SQUARE_WAVE_VOLTAMMETRY;
|
||||
DACReset = true;
|
||||
|
||||
if (ins[3] | ins[4]) {
|
||||
INSTRUCTION.VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
INSTRUCTION.VoltOrigin = Usercode_Correction_to_DAC(INSTRUCTION.VoltOrigin);
|
||||
INSTRUCTION.Ve1 = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
INSTRUCTION.Ve1 = Usercode_Correction_to_DAC(INSTRUCTION.Ve1);
|
||||
}
|
||||
if (ins[5] | ins[6]) {
|
||||
INSTRUCTION.VoltFinal = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
INSTRUCTION.VoltFinal = Usercode_Correction_to_DAC(INSTRUCTION.VoltFinal);
|
||||
INSTRUCTION.Ve2 = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
INSTRUCTION.Ve2 = Usercode_Correction_to_DAC(INSTRUCTION.Ve2);
|
||||
}
|
||||
if (ins[7] | ins[8]) {
|
||||
INSTRUCTION.Step = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
|
||||
INSTRUCTION.Step = StepCode2DACcode(INSTRUCTION.Step);
|
||||
INSTRUCTION.step = ((uint32_t)(ins[7]) << 8) | (uint32_t)(ins[8]);
|
||||
}
|
||||
if (ins[9]) {
|
||||
INSTRUCTION.StepTime = ins[9];
|
||||
@@ -810,111 +945,17 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
PulseWidth = ins[12];
|
||||
}
|
||||
if ( ins[13]) {
|
||||
INSTRUCTION.VoVi_Switch = ins[13];
|
||||
INSTRUCTION.VoViSwitch = ins[13];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CV_CURVE: {
|
||||
// CleanBuffer();
|
||||
INSTRUCTION.eliteFxn = CV_CURVE;
|
||||
DACReset = true;
|
||||
INSTRUCTION.SampleRate = 500;
|
||||
|
||||
// if (ins[3] | ins[4]) {
|
||||
INSTRUCTION.VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
|
||||
// INSTRUCTION.VoltOrigin = Usercode_Correction_to_DAC(INSTRUCTION.VoltOrigin);
|
||||
// }
|
||||
// if (ins[5] | ins[6]) {
|
||||
INSTRUCTION.VoltFinal = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
|
||||
// INSTRUCTION.VoltFinal = Usercode_Correction_to_DAC(INSTRUCTION.VoltFinal);
|
||||
// }
|
||||
|
||||
if (ins[7] | ins[8]) {
|
||||
INSTRUCTION.Step = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
|
||||
INSTRUCTION.Step = StepCode2DACcode(INSTRUCTION.Step);
|
||||
}
|
||||
// if (ins[9]) {
|
||||
INSTRUCTION.StepTime = ins[9];
|
||||
INSTRUCTION.StepTime = OldStep2NewStepTime(INSTRUCTION.StepTime);
|
||||
// }
|
||||
if (ins[10]) {
|
||||
INSTRUCTION.CycleNumber = ins[10];
|
||||
}
|
||||
// if(ins[11]) {
|
||||
//INSTRUCTION.VoVi_Switch = ins[11];
|
||||
INSTRUCTION.VoVi_Switch = 0x01;
|
||||
// }
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case VOLT_OUTPUT: {
|
||||
INSTRUCTION.eliteFxn = VOLT_OUTPUT;
|
||||
INSTRUCTION.VoltConstant = ( ((uint16_t)(ins[3])) << 8) | (uint16_t)(ins[4]);
|
||||
break;
|
||||
}
|
||||
|
||||
// impedance test
|
||||
case ZT_CURVE: {
|
||||
// CleanBuffer();
|
||||
INSTRUCTION.eliteFxn = ZT_CURVE;
|
||||
// INSTRUCTION.VoltConstant = ( ((uint16_t)(ins[3])) << 8) | (uint16_t)(ins[4]);
|
||||
break;
|
||||
}
|
||||
|
||||
case VT_CURVE: {
|
||||
// CleanBuffer();
|
||||
INSTRUCTION.eliteFxn = VT_CURVE;
|
||||
// SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
|
||||
// VT_Plot(); // enable 10v = 0
|
||||
break;
|
||||
}
|
||||
|
||||
case IT_CURVE: {
|
||||
// CleanBuffer();
|
||||
INSTRUCTION.eliteFxn = IT_CURVE;
|
||||
// IT_Plot(); // enable 10v = 1
|
||||
break;
|
||||
}
|
||||
case SET_SAMPLE_RATE: {
|
||||
INSTRUCTION.SampleRateIndex = ins[3];
|
||||
INSTRUCTION.SampleRate = SampleRateTable[INSTRUCTION.SampleRateIndex];
|
||||
CT.SampleRate_counter = 1;
|
||||
break;
|
||||
}
|
||||
case POTENTIAL_STATE: {
|
||||
INSTRUCTION.eliteFxn = POTENTIAL_STATE;
|
||||
|
||||
// test
|
||||
not_buf[0] = ins[3];
|
||||
not_buf[1] = ins[4];
|
||||
not_buf[2] = ins[5];
|
||||
not_buf[3] = ins[6];
|
||||
// SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
|
||||
INSTRUCTION.sampleRateIndex = ins[3];
|
||||
INSTRUCTION.sampleRate = SampleRateTable[INSTRUCTION.sampleRateIndex];
|
||||
break;
|
||||
}
|
||||
|
||||
case CONSTANT_CURRENT:{
|
||||
INSTRUCTION.eliteFxn = CONSTANT_CURRENT;
|
||||
INSTRUCTION.SampleRate = 2;
|
||||
INSTRUCTION.Charge = ins[3];
|
||||
INSTRUCTION.VoltLimit = ((uint16_t) ins[4] << 8) | ((uint16_t) ins[5]);
|
||||
INSTRUCTION.ConstantCurrent = ( (uint32_t) (ins[6])<<24 | (uint32_t) (ins[7])<<16 | (uint32_t) (ins[8])<<8 | (uint32_t) (ins[9]) );
|
||||
INSTRUCTION.NotifyRate = 1000;
|
||||
|
||||
// if(!INSTRUCTION.Charge){
|
||||
// INSTRUCTION.VoltConstant = 50000;
|
||||
// }
|
||||
// GetInstructionParameter(ins+2);
|
||||
// CCCurrent2IUC();
|
||||
break;
|
||||
}
|
||||
|
||||
case CYCLE_CONSTANT_CURRENT:{
|
||||
|
||||
break;
|
||||
}
|
||||
case SET_ADC_GAIN: {
|
||||
INSTRUCTION.ADCGainLevel = ins[3];
|
||||
if(INSTRUCTION.ADCGainLevel != GAIN_AUTO){
|
||||
@@ -935,11 +976,6 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
break;
|
||||
}
|
||||
|
||||
case SET_RESISTER_LEVEL:{
|
||||
INSTRUCTION.ResisterMeter = ins[3];
|
||||
break;
|
||||
}
|
||||
|
||||
case ADC_TEST: {
|
||||
INSTRUCTION.eliteFxn = ADC_TEST;
|
||||
int32_t ADCRealValue = 0;
|
||||
@@ -1030,6 +1066,7 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
FlushNotify();
|
||||
}
|
||||
PeriodicEvent = true;
|
||||
InitEliteFlag();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1067,6 +1104,42 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
break;
|
||||
}
|
||||
|
||||
case VIS_DEVICE_SHINY:{
|
||||
LED_color(DARKLED, 0xFF, 0x00, 0xFF);
|
||||
// uint8_t deviceShinySwitch = (ins[2] & 0b11110000) >> 4;//1:open 0:close
|
||||
// if(deviceShinySwitch == 1){
|
||||
// LED_color(DARKLED, 0xFF, 0x00, 0xFF);
|
||||
// }else if(deviceShinySwitch == 0){
|
||||
// if(PeriodicEvent){
|
||||
// WORKLED();
|
||||
// }else if(!PeriodicEvent){
|
||||
// LEDPowerON();
|
||||
// }
|
||||
// }
|
||||
break;
|
||||
}
|
||||
|
||||
case VIS_SHINY_DIS:{
|
||||
if(PeriodicEvent){
|
||||
WORKLED();
|
||||
}else if(!PeriodicEvent){
|
||||
LEDPowerON();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case VIS_CC_ZERO:{
|
||||
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
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
@@ -1080,11 +1153,31 @@ static void update_ZM_instruction(uint8 *ins) {
|
||||
I2CWrite(0x01, 0xAB);
|
||||
break;
|
||||
}
|
||||
|
||||
case CIS_VERSION:{
|
||||
initCISBuf();
|
||||
cis_buf[0] = VERSION_DATE_YEAR;
|
||||
cis_buf[1] = VERSION_DATE_MONTH;
|
||||
cis_buf[2] = VERSION_DATE_DAY;
|
||||
cis_buf[3] = VERSION_DATE_HOUR;
|
||||
cis_buf[4] = VERSION_DATE_MINUTE;
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, BLE_CIS_BUFF_SIZE, cis_buf);
|
||||
break;
|
||||
}
|
||||
|
||||
case CIS_VOLT: {
|
||||
initCISBuf();
|
||||
cis_buf[0] = CIS_VOLT;
|
||||
cis_buf[1] = NotifyVoltBat[3];
|
||||
cis_buf[2] = NotifyVoltBat[2];
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, BLE_CIS_BUFF_SIZE, cis_buf);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*** end of test instruction ***/
|
||||
default: {
|
||||
// unknown instruction
|
||||
break;
|
||||
@@ -1293,7 +1386,7 @@ static void headstage_init_device_info() {
|
||||
for (unsigned int i = 0; i < sizeof(DEVICE_NAME) - 1; i++) {
|
||||
*p++ = DEVICE_NAME[i];
|
||||
}
|
||||
*p++ = 11;
|
||||
*p++ = 16;
|
||||
*p++ = GAP_ADTYPE_MANUFACTURER_SPECIFIC;
|
||||
*p++ = 'B';
|
||||
*p++ = 'P';
|
||||
@@ -1305,6 +1398,11 @@ static void headstage_init_device_info() {
|
||||
*p++ = MINOR_VERSION_NUMBER;
|
||||
*p++ = year;
|
||||
*p++ = month;
|
||||
*p++ = 'B';
|
||||
*p++ = 'A';
|
||||
*p++ = 'T';
|
||||
*p++ = NotifyVoltBat[3];
|
||||
*p++ = NotifyVoltBat[2];
|
||||
|
||||
GGS_SetParameter(GGS_DEVICE_NAME_ATT, sizeof(DEVICE_NAME), DEVICE_NAME);
|
||||
|
||||
|
||||
+242
-172
@@ -20,6 +20,7 @@
|
||||
#include <ti/drivers/PIN.h>
|
||||
#include "board.h"
|
||||
#include "EliteWorkData.h"
|
||||
#include <driverlib/aon_batmon.h>
|
||||
|
||||
static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData);
|
||||
|
||||
@@ -34,6 +35,7 @@ static void SimpleBLEPeripheral_clockHandler(UArg arg) {
|
||||
static void elite_gptimer_callback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask) {
|
||||
events |= SBP_PERIODIC_EVT;
|
||||
Semaphore_post(semaphore);
|
||||
GPT.GptimerCounter++;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,13 +74,35 @@ static void DACCode2Real2Notify(uint16_t DACcode) {
|
||||
NotifyVolt[3] = (uint8_t)(RealV & 0x000000FF);
|
||||
}
|
||||
|
||||
#define IsPeriodicMode() ( \
|
||||
(INSTRUCTION.eliteFxn == IV_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == CV_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == IT_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == VT_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == ZT_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == CONSTANT_CURRENT) \
|
||||
#define IsPeriodicMode() ( \
|
||||
(INSTRUCTION.eliteFxn == IV_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == CV_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == IT_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == VT_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == ZT_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == CONSTANT_CURRENT) || \
|
||||
(INSTRUCTION.eliteFxn == CYCLIC_VOLTAMMETRY) || \
|
||||
(INSTRUCTION.eliteFxn == LINEAR_SWEEP_VOLTAMMETRY) || \
|
||||
(INSTRUCTION.eliteFxn == CONSTANT_VSCAN) \
|
||||
)
|
||||
|
||||
#define Ve1MatchVe2Mode() ( \
|
||||
(INSTRUCTION.eliteFxn == IV_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == CV_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == CYCLIC_VOLTAMMETRY) || \
|
||||
(INSTRUCTION.eliteFxn == LINEAR_SWEEP_VOLTAMMETRY) \
|
||||
)
|
||||
|
||||
#define SendLastDataMode() ( \
|
||||
(INSTRUCTION.eliteFxn == IV_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == CV_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == IT_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == VT_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == ZT_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == CONSTANT_CURRENT) || \
|
||||
(INSTRUCTION.eliteFxn == CYCLIC_VOLTAMMETRY) || \
|
||||
(INSTRUCTION.eliteFxn == LINEAR_SWEEP_VOLTAMMETRY) || \
|
||||
(INSTRUCTION.eliteFxn == CONSTANT_VSCAN) \
|
||||
)
|
||||
|
||||
/*********************************************************************
|
||||
@@ -92,201 +116,247 @@ static void DACCode2Real2Notify(uint16_t DACcode) {
|
||||
*/
|
||||
static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
|
||||
if ( IsPeriodicMode() ){
|
||||
|
||||
// DAC counter
|
||||
if (CT.StepTimeCounter == INSTRUCTION.StepTime){
|
||||
CT.StepTimeCounter = 1;
|
||||
}
|
||||
else{
|
||||
CT.StepTimeCounter++;
|
||||
}
|
||||
|
||||
// ADC counter
|
||||
if (CT.SampleRate_counter == INSTRUCTION.SampleRate){
|
||||
CT.SampleRate_counter = 1;
|
||||
}
|
||||
else{
|
||||
CT.SampleRate_counter++;
|
||||
}
|
||||
|
||||
// notify counter
|
||||
if (CT.NotifyCounter == INSTRUCTION.NotifyRate){
|
||||
CT.NotifyCounter = 1;
|
||||
}
|
||||
else{
|
||||
CT.NotifyCounter ++;
|
||||
}
|
||||
|
||||
/** Periodic Event **/
|
||||
// Default working flow is DAC out -> ADC read -> send notify
|
||||
// We will need a flag to control DAC, if we want to exchange to ADC -> DAC -> notify
|
||||
// This flag can be named by FxnNameDACReset
|
||||
// Default working flow is vscan -> ADC read -> send notify
|
||||
// We will need a flag to control vscan, ADC and notify
|
||||
|
||||
// In IV, CV, and func-gen mode, DAC will output voltage
|
||||
// else DAC do nothing.
|
||||
EliteDACControl(WorkModeData);
|
||||
GPT.DeltaGptimerCounter = GPT.GptimerCounter - GPT.GptimerCounter0;
|
||||
GPT.GptimerCounter0 = GPT.GptimerCounter;
|
||||
|
||||
// Control ADC to sample rate
|
||||
EliteADCControl(WorkModeData);
|
||||
if(EliteWorkReset){
|
||||
InitEliteGPtimer();
|
||||
EliteWorkReset = false;
|
||||
batteryADC_flag = false;
|
||||
if( Ve1MatchVe2Mode() ){
|
||||
if (INSTRUCTION.Ve1 == INSTRUCTION.Ve2) {
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.Ve1));
|
||||
PeriodicEvent = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Notify control, check if we need to send notify
|
||||
EliteNotifyControl();
|
||||
|
||||
}
|
||||
GPT.LeadTimeCounter = GPT.LeadTimeCounter + GPT.DeltaGptimerCounter;
|
||||
if(leadTimeReset && GPT.LeadTimeCounter <= 2000){
|
||||
vscanReset = true;
|
||||
}else{
|
||||
if(notifyFirst_flag){
|
||||
GPT.NotifyCounter = INSTRUCTION.notifyRate - 20;
|
||||
notifyFirst_flag = false;
|
||||
}
|
||||
vscanReset = false;
|
||||
leadTimeReset = false;
|
||||
}
|
||||
|
||||
else if(INSTRUCTION.eliteFxn == VOLT_OUTPUT){
|
||||
// assign WorkModeData->VO = INSTRUCTION.VoltConstant
|
||||
WorkModeData->VO->_VoltOut = INSTRUCTION.VoltConstant;
|
||||
// UserCode -> DAC code -> DAC out
|
||||
DAC_outputV(Usercode_Correction_to_DAC(WorkModeData->VO->_VoltOut));
|
||||
// DAC_outputV(WorkModeData->VO->_VoltOut); // for voltage output calibration
|
||||
//vscan counter
|
||||
GPT.VscanRateCounter = GPT.VscanRateCounter + GPT.DeltaGptimerCounter;
|
||||
if(GPT.VscanRateCounter >= INSTRUCTION.VsetRate){
|
||||
GPT.VscanRateCounter -= INSTRUCTION.VsetRate; //To get right time
|
||||
vscan_flag = true;
|
||||
if(vscan_flag){
|
||||
EliteVscanControl(WorkModeData);
|
||||
vscan_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
//battery counter
|
||||
GPT.BatteryADCCounter = GPT.BatteryADCCounter + GPT.DeltaGptimerCounter;
|
||||
GPT.BatteryCheckCounter = GPT.BatteryCheckCounter + GPT.DeltaGptimerCounter;
|
||||
if(GPT.BatteryCheckCounter >= 50000){
|
||||
GPT.BatteryCheckCounter -= 50000; //To get right time
|
||||
batteryCheck_flag = true;
|
||||
}
|
||||
|
||||
uint16_t bat = ((uint16_t)(NotifyVoltBat[2]) << 8 & 0xFF00 ) | ((uint16_t)(NotifyVoltBat[3]) & 0x00FF);
|
||||
if( bat < 768 && bat > 20){
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 0);
|
||||
}
|
||||
|
||||
//ADC counter
|
||||
GPT.SampleRateCounter = GPT.SampleRateCounter + GPT.DeltaGptimerCounter;
|
||||
if(GPT.SampleRateCounter >= INSTRUCTION.sampleRate){
|
||||
GPT.SampleRateCounter = 0; //To get right data, ADC must be delay 1.5ms
|
||||
ADC_flag = true;
|
||||
if(ADC_flag){
|
||||
EliteADCControl(WorkModeData);
|
||||
ADC_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Notify counter(Notify control, check if we need to send notify)
|
||||
//please don't put Notify counter before ADC counter, maybe get wrong data
|
||||
GPT.NotifyCounter = GPT.NotifyCounter + GPT.DeltaGptimerCounter;
|
||||
if(GPT.NotifyCounter >= INSTRUCTION.notifyRate){
|
||||
GPT.NotifyCounter -= INSTRUCTION.notifyRate; //To get right time
|
||||
notify_flag = true;
|
||||
if(vscanReset){
|
||||
notify_flag = false;
|
||||
}
|
||||
if(notify_flag){
|
||||
SendNotify();
|
||||
notify_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
EliteDone();
|
||||
}else if(INSTRUCTION.eliteFxn == VOLT_OUTPUT){
|
||||
WorkModeData->VO->_Vset = INSTRUCTION.VoltConstant;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(WorkModeData->VO->_Vset)); //UserCode -> DAC code -> DAC out
|
||||
FreeWorkMode(WorkModeData);
|
||||
PeriodicEvent = false;
|
||||
InitPeriodicEvent = true;
|
||||
}
|
||||
else{
|
||||
PeriodicEvent = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void EliteDACControl(WorkMode *WorkModeData) {
|
||||
if (INSTRUCTION.eliteFxn == IV_CURVE) {
|
||||
// output a certain voltage and put it into NotifyVolt
|
||||
if(WorkModeData->IV->_VoVi_Switch == 0x00){ //user see Vout
|
||||
//DACCode2Real2Notify(VoltScan(WorkModeData));
|
||||
uint16_t DACcode;
|
||||
DACcode = VoltScan(WorkModeData);
|
||||
|
||||
}
|
||||
else if (WorkModeData->IV->_VoVi_Switch == 0x01){ //user see Vin
|
||||
VoltScan(WorkModeData);
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.eliteFxn == CV_CURVE){
|
||||
if (WorkModeData->CV->_VoVi_Switch == 0x00){
|
||||
DACCode2Real2Notify(VoltScan(WorkModeData));
|
||||
}
|
||||
else if (WorkModeData->CV->_VoVi_Switch == 0x01){
|
||||
VoltScan(WorkModeData);
|
||||
}
|
||||
}
|
||||
else if (INSTRUCTION.eliteFxn == ZT_CURVE){
|
||||
if(INSTRUCTION.ResisterMeter == RESISTER_METER_SMALL){
|
||||
// output 1V
|
||||
if (DACReset) {
|
||||
INSTRUCTION.VoltConstant = 25000 + 5000;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
DACReset = false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
// output 1V
|
||||
if (DACReset) {
|
||||
INSTRUCTION.VoltConstant = 25000 + 5000;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
DACReset = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.eliteFxn == CONSTANT_CURRENT){
|
||||
if (DACReset) {
|
||||
DAC_outputV(Usercode_Correction_to_DAC(25000));
|
||||
DACReset = false;
|
||||
}
|
||||
CCModeVoltOut(WorkModeData->CC);
|
||||
}
|
||||
|
||||
else{
|
||||
// IT, VT need only ADC measure
|
||||
return;
|
||||
}else{
|
||||
InitFlag();
|
||||
}
|
||||
}
|
||||
|
||||
static void EliteADCControl(WorkMode *WorkModeData) {
|
||||
if (CT.SampleRate_counter == INSTRUCTION.SampleRate - 1) {
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IV_CURVE:{
|
||||
IV_Plot(WorkModeData->IV);
|
||||
// IT_Plot(WorkModeData);
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
CV_Plot(WorkModeData->CV);
|
||||
break;
|
||||
}
|
||||
case IT_CURVE:{
|
||||
IT_Plot(WorkModeData);
|
||||
// NotifyReady = true;
|
||||
break;
|
||||
}
|
||||
case VT_CURVE:{
|
||||
// read volt through ADC and put it into notify buffer
|
||||
VT_Plot(WorkModeData->VT);
|
||||
// NotifyReady = true;
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
ZT_Plot(WorkModeData->RT);
|
||||
// NotifyReady = true;
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
CCModeReadCurrent(WorkModeData->CC);
|
||||
// CCModeReverseCurrent(WorkModeData->CC);
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
IT_Plot(WorkModeData);
|
||||
// NotifyReady = true;
|
||||
break;
|
||||
}
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IV_CURVE:{
|
||||
ZT_Plot(WorkModeData);
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
ZT_Plot(WorkModeData);
|
||||
break;
|
||||
}
|
||||
case IT_CURVE:{
|
||||
IT_Plot(WorkModeData);
|
||||
break;
|
||||
}
|
||||
case VT_CURVE:{
|
||||
VT_Plot(WorkModeData);
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
ZT_Plot(WorkModeData);
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
CC_Plot(WorkModeData);
|
||||
break;
|
||||
}
|
||||
case CYCLIC_VOLTAMMETRY:{
|
||||
CC_Plot(WorkModeData);
|
||||
break;
|
||||
}
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:{
|
||||
CC_Plot(WorkModeData);
|
||||
break;
|
||||
}
|
||||
case CONSTANT_VSCAN:{
|
||||
CC_Plot(WorkModeData);
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void EliteNotifyControl() {
|
||||
if ((INSTRUCTION.eliteFxn == IV_CURVE) || (INSTRUCTION.eliteFxn == CV_CURVE)) {
|
||||
// output the last notify, and reset Elite
|
||||
static void EliteDone() {
|
||||
if ((INSTRUCTION.eliteFxn == IV_CURVE) || (INSTRUCTION.eliteFxn == CV_CURVE) || (INSTRUCTION.eliteFxn == CYCLIC_VOLTAMMETRY)) {
|
||||
if (!PeriodicEvent) {
|
||||
SendNotify();
|
||||
reset();
|
||||
} else if (CT.StepTimeCounter == INSTRUCTION.StepTime/2) {
|
||||
SendNotify();
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.eliteFxn == CONSTANT_CURRENT){
|
||||
if(CT.NotifyCounter == INSTRUCTION.NotifyRate){
|
||||
SendNotify();
|
||||
}
|
||||
}
|
||||
else if (CT.SampleRate_counter == INSTRUCTION.SampleRate) {
|
||||
SendNotify();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint16_t StepCode2DACcode(uint16_t StepCode){
|
||||
return (StepCode * 0x0005);
|
||||
static void EliteVscanControl(WorkMode *WorkModeData) {
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IV_CURVE:{
|
||||
IV_Vscan(WorkModeData->IV);
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
CV_Vscan(WorkModeData->CV);
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
ZT_Vscan(WorkModeData->RT);
|
||||
break;
|
||||
}
|
||||
case CYCLIC_VOLTAMMETRY:{
|
||||
CV3_Vscan(WorkModeData->CV3);
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
CC_Vscan(WorkModeData->CC);
|
||||
break;
|
||||
}
|
||||
case LINEAR_SWEEP_VOLTAMMETRY:{
|
||||
LSV_Vscan(WorkModeData->LSV);
|
||||
break;
|
||||
}
|
||||
case CONSTANT_VSCAN:{
|
||||
CVSCAN_Vscan(WorkModeData->CVSCAN);
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t OldStep2NewStepTime(uint8_t StepTime) {
|
||||
static uint32_t OldStep2NewStepTime(uint32_t StepTime){
|
||||
uint8_t StepTimeLevel = 0;
|
||||
StepTimeLevel = StepTime / 0x12;
|
||||
|
||||
switch (StepTimeLevel) {
|
||||
case 0: { //0.5 sec
|
||||
return STEPTIME_HALF_SEC;
|
||||
}
|
||||
case 1: { //1 sec
|
||||
return STEPTIME_ONE_SEC;
|
||||
}
|
||||
case 2: { //2 sec
|
||||
return STEPTIME_TWO_SEC;
|
||||
}
|
||||
default: { //1 sec
|
||||
return STEPTIME_ONE_SEC;
|
||||
}
|
||||
case 0: { //0.5 sec
|
||||
return STEPTIME_HALF_SEC;
|
||||
}
|
||||
case 1: { //1 sec
|
||||
return STEPTIME_ONE_SEC;
|
||||
}
|
||||
case 2: { //2 sec
|
||||
return STEPTIME_TWO_SEC;
|
||||
}
|
||||
default: { //1 sec
|
||||
return STEPTIME_ONE_SEC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void step2VsetRate(uint32_t step){
|
||||
/*step = 100 mv, index = 0, n = 2
|
||||
10 mv, index = 1, n = 10
|
||||
1 mv, index = 2, n = 100
|
||||
0.1 mv, index = 3, n = 1000
|
||||
0.01mv, index = 4, n = 10000 */
|
||||
|
||||
if(step >= 10000){
|
||||
INSTRUCTION.VsetRateIndex = 0;
|
||||
}else if (step >= 1000){
|
||||
INSTRUCTION.VsetRateIndex = 1;
|
||||
}else if (step >= 100){
|
||||
INSTRUCTION.VsetRateIndex = 2;
|
||||
}else if (step >= 10){
|
||||
INSTRUCTION.VsetRateIndex = 3;
|
||||
}else if (step >= 1){
|
||||
INSTRUCTION.VsetRateIndex = 4;
|
||||
}
|
||||
}
|
||||
|
||||
static void InitFlag(){
|
||||
PeriodicEvent = false; // is there an PeriodicEvent?
|
||||
Free_Work_Mode = true; // Free(WorkModeData)
|
||||
}
|
||||
|
||||
static void InitEliteGPtimer() {
|
||||
GPT.SampleRateCounter = INSTRUCTION.sampleRate - 10;
|
||||
GPT.VscanRateCounter = INSTRUCTION.VsetRate - 1;
|
||||
notifyFirst_flag = true;
|
||||
}
|
||||
|
||||
static void InitEliteFlag() {
|
||||
InitPeriodicEvent = true; // need to create a WorkModeData?
|
||||
DACReset = true;
|
||||
vscanReset = true;
|
||||
EliteWorkReset = true;
|
||||
leadTimeReset = true;
|
||||
GAIN_200R_counter = 0;
|
||||
GAIN_200K_counter = 0;
|
||||
GAIN_10K_counter = 0;
|
||||
}
|
||||
#endif /* IMPEDANCE_METER_H_ */
|
||||
|
||||
+52
-26
@@ -127,11 +127,11 @@
|
||||
#ifndef FEATURE_OAD
|
||||
// Minimum connection interval (units of 1.25ms, 80=100ms) if automatic
|
||||
// parameter update request is enabled
|
||||
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 6
|
||||
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 8
|
||||
|
||||
// Maximum connection interval (units of 1.25ms, 800=1000ms) if automatic
|
||||
// parameter update request is enabled
|
||||
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 6
|
||||
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 30
|
||||
#else //! FEATURE_OAD
|
||||
// Minimum connection interval (units of 1.25ms, 8=10ms) if automatic
|
||||
// parameter update request is enabled
|
||||
@@ -544,24 +544,27 @@ static void SimpleBLEPeripheral_init(void) {
|
||||
|
||||
static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
|
||||
#define CLOCK_ONE_SECOND 10000
|
||||
// Initialize application
|
||||
SimpleBLEPeripheral_init();
|
||||
headstage_init_device_info();
|
||||
|
||||
ZM_init();
|
||||
Elite_SPI_init();
|
||||
WorkMode *WorkModeData = CreateWorkMode();
|
||||
|
||||
uint8_t key = 0;
|
||||
uint8_t key = 0;
|
||||
uint16_t counter6994 = 0;
|
||||
bool EliteOn = 0;
|
||||
bool EliteOn = 0;
|
||||
|
||||
// init DAC, set output ~= 0 V
|
||||
DAC_outputV(Usercode_Correction_to_DAC(25000));
|
||||
elite_gptimer_start();
|
||||
|
||||
// Application main loops
|
||||
GPT.GptimerCounter0 = GPT.GptimerCounter;
|
||||
batteryADC_flag = false;
|
||||
headstage_battery_volt();
|
||||
headstage_init_device_info();
|
||||
|
||||
for (;;) {
|
||||
// Waits for a signal to the semaphore associated with the calling thread.
|
||||
// Note that the semaphore associated with a thread is signaled when a
|
||||
@@ -611,35 +614,57 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
}
|
||||
if(events & SBP_PERIODIC_EVT){
|
||||
events &= ~SBP_PERIODIC_EVT;
|
||||
if (!PeriodicEvent) { // if there is no periodic event
|
||||
if (!PeriodicEvent) { // if there is no periodic event
|
||||
key = PIN_getInputValue(switch_on);
|
||||
if (EliteOn) {
|
||||
if (counter6994 < CLOCK_ONE_SECOND/2) { // counter6994 enable a IC after 35 counts
|
||||
counter6994++;
|
||||
} else if (counter6994 == CLOCK_ONE_SECOND/2) {
|
||||
PIN_setOutputValue(pin_handle, shutdown_6994, 1); // OFF = 1 => turn off 6994
|
||||
// #ifdef ELITE_VERSION_1_4
|
||||
// SPI_close(spiHandle0);
|
||||
// I2Cinit();
|
||||
// I2C_close(I2Chandle);
|
||||
// spiHandle0 = SPI_open(Board_SPI0, &spiParams0); // LED SPI
|
||||
// #endif
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
if(Free_Work_Mode){
|
||||
FreeWorkMode(WorkModeData);
|
||||
InitEliteInstruction();
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
|
||||
Free_Work_Mode = false;
|
||||
}
|
||||
} else {
|
||||
EliteOn = TurnOnElite(key);
|
||||
}
|
||||
}
|
||||
// if there is periodic event
|
||||
else {
|
||||
else { // if there is periodic event
|
||||
if(InitPeriodicEvent){
|
||||
InitWorkMode(WorkModeData);
|
||||
InitPeriodicEvent = false;
|
||||
@@ -647,22 +672,11 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
|
||||
// Perform periodic application task
|
||||
SimpleBLEPeripheral_performPeriodicTask(WorkModeData);
|
||||
|
||||
key = PIN_getInputValue(switch_on);
|
||||
EliteKeyPress(key); // onPress=> key = 0; 1.lighten LED 2.long press shut down 2650
|
||||
}
|
||||
}
|
||||
|
||||
// if (events & SBP_PERIODIC_EVT)
|
||||
// {
|
||||
// events &= ~SBP_PERIODIC_EVT;
|
||||
// Util_startClock(&periodicClock);
|
||||
// Perform periodic application task
|
||||
// SimpleBLEPeripheral_performPeriodicTask();
|
||||
// }
|
||||
|
||||
// headstage_gptimer_main_handle();
|
||||
|
||||
#ifdef FEATURE_OAD
|
||||
while (!Queue_empty(hOadQ)) {
|
||||
oadTargetWrite_t *oadWriteEvt = Queue_get(hOadQ);
|
||||
@@ -936,6 +950,18 @@ 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
|
||||
uint16_t requestedPDUSize = 251; //251 roy
|
||||
uint16_t requestTxTime = 2120; // (LL payload + 14) * 8 //2120 roy
|
||||
GAPRole_GetParameter(GAPROLE_CONNHANDLE, &cxnHandle);
|
||||
|
||||
if (SUCCESS == HCI_LE_SetDataLenCmd(cxnHandle, requestedPDUSize, requestTxTime)) {
|
||||
// LED_color(DARKLED, 0xFF, 0x00, 0xFF);
|
||||
}
|
||||
|
||||
// Use numActive to determine the connection handle of the last
|
||||
// connection
|
||||
if (linkDB_GetInfo(numActive - 1, &linkInfo) == SUCCESS) {
|
||||
|
||||
@@ -85,7 +85,7 @@ extern "C"
|
||||
|
||||
// Length of Characteristic 5 in bytes
|
||||
#define SIMPLEPROFILE_CHAR5_LEN 5
|
||||
#define SIMPLEPROFILE_CHAR4_LEN 20
|
||||
#define SIMPLEPROFILE_CHAR4_LEN 200
|
||||
#define SIMPLEPROFILE_CHAR3_LEN 20
|
||||
#define SIMPLEPROFILE_CHAR2_LEN 20
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
#input="./Elite_test.txt"
|
||||
input="D:/Elite/Calibration_data/$1.txt"
|
||||
output="./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteDeviceCorrection.h"
|
||||
|
||||
#variable
|
||||
declare -i current_line=79
|
||||
declare -i col_index=0
|
||||
declare -i row_index=0
|
||||
#declare -i coeff=1
|
||||
#declare -i offset=0
|
||||
|
||||
declare -i current_gain=0
|
||||
#declare -i vin_gain=0
|
||||
#declare -i vout_gain=0
|
||||
MAC="MAC"
|
||||
|
||||
#constant
|
||||
declare -i ADC_CURRENT_GAIN_NUMBER=3
|
||||
declare -i ADC_VOLTAGE_GAIN_NUMBER=1
|
||||
declare -i DAC_GAIN_NUMBER=1
|
||||
|
||||
while read -r line; do
|
||||
for word in $line; do
|
||||
# get device MAC
|
||||
if [ $row_index -eq 0 ] && [ $col_index -eq 1 ];then
|
||||
MAC=$word
|
||||
sed -i "${current_line} i {" "$output"
|
||||
sed -i "${current_line} i \\\n#ifdef BOARD_${MAC}" "$output"
|
||||
sed -i 's/:/_/g' "$output"
|
||||
current_line=$current_line+3
|
||||
fi
|
||||
|
||||
#get ADC current cali data
|
||||
declare -i Iin_range=2+$ADC_CURRENT_GAIN_NUMBER
|
||||
if [ $row_index -gt 1 ] && [ $row_index -lt $Iin_range ];then
|
||||
|
||||
if [ $col_index -eq 1 ];then
|
||||
sed -i "${current_line} i \\\t.ADC_current[${current_gain}].coeff = ($word)," "$output"
|
||||
current_line=$current_line+1
|
||||
|
||||
elif [ $col_index -eq 2 ];then
|
||||
sed -i "${current_line} i \\\t.ADC_current[${current_gain}].offset = ($word)," "$output"
|
||||
current_line=$current_line+1
|
||||
|
||||
if [ $current_gain -lt 2 ];then
|
||||
current_gain=$current_gain+1
|
||||
else
|
||||
current_gain=0
|
||||
fi
|
||||
fi
|
||||
|
||||
#get DAC Vout cali data
|
||||
declare -i Vout_range=$Iin_range+$DAC_GAIN_NUMBER
|
||||
elif [ $row_index -gt 1 ] && [ $row_index -lt $Vout_range ];then
|
||||
if [ $col_index -eq 1 ];then
|
||||
sed -i "${current_line} i \\\t.Usercode2DAC.coeff = ($word)," "$output"
|
||||
current_line=$current_line+1
|
||||
|
||||
elif [ $col_index -eq 2 ];then
|
||||
sed -i "${current_line} i \\\t.Usercode2DAC.offset = ($word)," "$output"
|
||||
current_line=$current_line+1
|
||||
fi
|
||||
|
||||
#get ADC Vin cali data
|
||||
declare -i Vin_range=$Vout_range+$ADC_VOLTAGE_GAIN_NUMBER
|
||||
elif [ $row_index -gt 1 ] && [ $row_index -lt $Vin_range ];then
|
||||
if [ $col_index -eq 1 ];then
|
||||
sed -i "${current_line} i \\\t.ADC_volt.coeff = ($word)," "$output"
|
||||
current_line=$current_line+1
|
||||
|
||||
elif [ $col_index -eq 2 ];then
|
||||
sed -i "${current_line} i \\\t.ADC_volt.offset = ($word)," "$output"
|
||||
current_line=$current_line+1
|
||||
fi
|
||||
fi
|
||||
|
||||
#update index
|
||||
if [ $col_index -lt 2 ];then
|
||||
col_index=$col_index+1
|
||||
else
|
||||
col_index=0
|
||||
row_index=$row_index+1
|
||||
fi
|
||||
done
|
||||
done < $input
|
||||
|
||||
sed -i "${current_line} i };" "$output"
|
||||
current_line=$current_line+1
|
||||
sed -i "${current_line} i #endif" "$output"
|
||||
Reference in New Issue
Block a user