Compare commits

..

95 Commits

Author SHA1 Message Date
weiting2 f4d18daf67 send calibration coeff to controller from CIS 2020-01-08 14:00:47 +08:00
weiting2 ee9ba737b2 send calibration coeff to controller 2020-01-08 10:38:02 +08:00
weiting2 3acb175b76 send calibration coeff to controller 2020-01-07 17:07:40 +08:00
weiting2 b05b5e5a4f check LSK speed 2020-01-06 17:54:53 +08:00
weiting2 f39c2e2e03 new way to detect LSK 2020-01-06 16:38:22 +08:00
weiting2 d60ae2a72e new way to detect LSK 2020-01-06 16:01:45 +08:00
weiting2 17ae7862fc new way to detect LSK 2020-01-06 15:54:58 +08:00
weiting2 e9f568f301 new way to detect LSK 2020-01-06 15:35:06 +08:00
weiting2 f9947d2335 new way to detect LSK 2020-01-06 14:15:21 +08:00
yichin beaa81af70 error fix 2020-01-06 13:55:28 +08:00
yichin f918df6520 error fix 2020-01-06 13:54:35 +08:00
yichin 42782dbcdd error fix 2020-01-06 13:54:16 +08:00
weiting2 2758db39aa calibration table 2020-01-06 13:49:26 +08:00
yichin 6c82c6447c calibration table 2020-01-06 11:31:10 +08:00
yichin eaffe0b917 calibration 2020-01-06 11:30:34 +08:00
weiting2 bad7c412c8 Merge remote-tracking branch 'origin/neulive/development' into neulive/development 2020-01-06 10:56:00 +08:00
weiting2 71fcd7bffe new LSK decoder testing 2020-01-04 14:57:35 +08:00
yichin d5d2952fec error fix 2020-01-03 19:08:46 +08:00
yichin f130a9ce2a error fix 2020-01-03 18:50:43 +08:00
weiting2 9eebdcfa24 new LSK decoder testing 2020-01-03 18:13:22 +08:00
weiting2 12dca5bde4 new LSK decoder testing 2020-01-03 17:42:58 +08:00
weiting2 c5756104c0 new LSK decoder testing 2020-01-03 17:38:28 +08:00
weiting2 9f50fe43f7 new LSK decoder testing 2020-01-03 17:04:00 +08:00
weiting2 e28d246b60 new LSK decoder testing 2020-01-03 17:00:59 +08:00
weiting2 eb12cda156 new LSK decoder testing 2020-01-03 16:59:27 +08:00
weiting2 c0125497b3 new LSK decoder testing 2020-01-03 16:51:44 +08:00
weiting2 629f78f9e2 new LSK decoder testing 2020-01-03 16:08:45 +08:00
weiting2 5b0b11fb74 Merge remote-tracking branch 'origin/neulive/development' into neulive/development 2020-01-03 15:50:57 +08:00
weiting2 17ba44da8b error fix 2020-01-03 15:50:49 +08:00
yichin 09b40fa24a error fix 2020-01-03 15:38:47 +08:00
weiting2 92901e6963 error fix 2020-01-03 15:11:00 +08:00
weiting2 c94ae4a6d9 update LSK decode 2020-01-03 15:05:33 +08:00
weiting2 e1e2855d6f update LSK decode 2020-01-03 14:17:07 +08:00
weiting2 efa948a95b use preamble correctly 2020-01-03 12:19:47 +08:00
weiting2 222bb3a966 use preamble correctly 2020-01-02 19:25:28 +08:00
weiting2 ec7e082b27 check LSK to decide restart or not 2020-01-02 18:59:10 +08:00
weiting2 891d0c3f9a check LSK to decide restart or not 2020-01-02 18:38:37 +08:00
weiting2 e087cec666 check LSK to decide restart or not 2020-01-02 17:27:50 +08:00
weiting2 4da9b99cf6 check LSK to decide restart or not 2020-01-02 17:02:32 +08:00
weiting2 13c60bdaca check LSK to decide restart or not 2020-01-02 16:33:00 +08:00
weiting2 54bd693c87 check LSK to decide restart or not 2020-01-02 16:17:46 +08:00
weiting2 8ebca1228c check LSK to decide restart or not 2020-01-02 16:08:34 +08:00
weiting2 5c3a110c3c Merge remote-tracking branch 'origin/neulive/development' into neulive/development 2020-01-02 15:40:47 +08:00
weiting2 47b68817e2 check LSK to decide restart or not 2020-01-02 15:40:36 +08:00
yichin 4a5c76f13e Merge remote-tracking branch 'origin/neulive/development' into neulive/development 2020-01-02 15:29:26 +08:00
weiting2 2fd9b80a20 check LSK to decide restart or not 2020-01-02 15:29:11 +08:00
yichin 2fdd61c23c error fix 2020-01-02 15:23:12 +08:00
yichin 9ebf171d9b error fix 2020-01-02 15:21:56 +08:00
weiting2 28553126ef check LSK to decide restart or not 2020-01-02 15:20:39 +08:00
weiting2 04d2a60ea6 check LSK to decide restart or not 2020-01-02 14:18:08 +08:00
yichin 2eab4b6227 error fix 2020-01-02 13:40:07 +08:00
yichin 74e417136c Merge remote-tracking branch 'origin/neulive/development' into neulive/development 2020-01-02 13:34:35 +08:00
weiting2 91d4e8c42d check LSK to decide restart or not 2020-01-02 13:33:09 +08:00
yichin 3cb98ed6bb Merge remote-tracking branch 'origin/neulive/development' into neulive/development 2020-01-02 11:23:30 +08:00
weiting2 e9c8175e91 check LSK to decide restart or not 2020-01-02 11:12:40 +08:00
yichin 1347d89577 Merge remote-tracking branch 'origin/neulive/development' into neulive/development 2019-12-31 13:46:55 +08:00
weiting2 6e2a275f31 send recording para only 2019-12-31 13:44:42 +08:00
yichin f869c1ae3c Merge remote-tracking branch 'origin/neulive/development' into neulive/development 2019-12-31 11:50:31 +08:00
weiting2 6e9d4685fc go to config done directly 2019-12-31 11:49:37 +08:00
yichin cc55716b6e Merge remote-tracking branch 'origin/neulive/development' into neulive/development 2019-12-31 11:44:09 +08:00
weiting2 7a469c3231 go to config done directly 2019-12-31 11:42:18 +08:00
yichin f6400ee6c6 change ADC level timeOK 2019-12-31 11:28:35 +08:00
weiting2 7dd490adc1 go to config done directly 2019-12-31 11:25:10 +08:00
weiting2 224c2494c0 2650 send recording (amp) parameter only 2019-12-31 10:41:44 +08:00
weiting2 eff7e84dd7 2650 send recording (amp) parameter only 2019-12-30 11:07:37 +08:00
weiting2 c159b8b0d6 Merge remote-tracking branch 'origin/neulive/development' into neulive/development 2019-12-27 18:43:33 +08:00
weiting2 7918644b08 DBS using VIS break "start" instruction 2019-12-27 18:43:20 +08:00
YiChin 5a2b9a0061 error fix 2019-12-27 18:40:51 +08:00
YiChin 3292c9bcec error fix 2019-12-27 18:39:09 +08:00
weiting2 3effed2d65 DBS using VIS break "start" instruction 2019-12-27 18:37:11 +08:00
weiting2 f2d07eea76 DBS using VIS break "start" instruction 2019-12-27 16:42:29 +08:00
weiting2 0005e654c1 DBS interrupt & restart testing 2019-12-27 12:38:28 +08:00
weiting2 7a7f848930 DBS interrupt & restart testing 2019-12-27 12:28:13 +08:00
weiting2 e4e08ffbdc DBS interrupt & restart testing 2019-12-27 12:27:43 +08:00
weiting2 8774bad1b1 DBS interrupt & restart testing 2019-12-27 11:47:29 +08:00
weiting2 618e3ad01a DBS interrupt & restart testing 2019-12-27 10:33:59 +08:00
weiting2 8ed8201c0c VIS_FUH call DBS interrupt 2019-12-26 15:10:07 +08:00
YiChin c8f6ec239d error fix 2019-12-26 14:45:17 +08:00
weiting2 4930e8845b VIS_FUH call DBS interrupt 2019-12-26 14:38:51 +08:00
YiChin 5549d07208 error fix 2019-12-26 11:57:01 +08:00
weiting2 9380ecacec VIS_FUH call DBS interrupt 2019-12-26 11:51:52 +08:00
weiting2 e4a25a6225 DBS interrupt => back to configure => check if MUX configure correctly 2019-12-26 11:01:02 +08:00
weiting2 338b21fd65 read LSK directly to check restart issue 2019-12-25 17:16:15 +08:00
weiting2 b5762c0f65 FlushSPIrx(); make sure lsk pass check correct 2019-12-25 16:52:18 +08:00
weiting2 5799223d69 check configure instruction work well 2019-12-25 15:15:46 +08:00
weiting2 e72463b60a check configure instruction work well 2019-12-25 15:06:53 +08:00
weiting2 634f2fbd47 check configure instruction work well 2019-12-25 15:05:00 +08:00
weiting2 9aa508c6cf check configure instruction work well 2019-12-25 14:37:54 +08:00
weiting2 65a380cbca check configure instruction work well 2019-12-25 11:52:46 +08:00
weiting2 f1eb0dd727 check configure instruction work well 2019-12-25 11:19:21 +08:00
weiting2 a190f3212e add debug state in lsk; check every MISO SPI 2019-12-25 10:24:56 +08:00
weiting2 c5e55c4e96 add debug state in lsk; check every MISO SPI 2019-12-24 15:39:15 +08:00
weiting2 2a321cbd0e start PWM after turn on; add debug state in lsk 2019-12-24 15:23:47 +08:00
weiting2 468e4c491a test PWM (system clk) 2019-12-23 17:04:12 +08:00
weiting2 828f96c96c test PWM (system clk) 2019-12-23 16:49:35 +08:00
43 changed files with 1144 additions and 3121 deletions
+1 -2
View File
@@ -6,5 +6,4 @@ ccsv8/
simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/app/.config/
# CSS build files
FlashROM/
/Elite_test.txt
FlashROM/
-7
View File
@@ -1,7 +0,0 @@
MAC 18:04:ED:37:C6:6A .
. coeff offset
ADC_C1 311760871.760443 -50619.5024488329
ADC_C2 0.065484773376246 -1061.19682828209
ADC_C3 0.003142283837061 -50.9228211021286
DAC -1.05569320115838 -0.000624379961454
ADC_V1 56126.9201379636 10.1198174952741
-39
View File
@@ -1,39 +0,0 @@
#!/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/headstage_version.h
sed -i "6c #define VERSION_DATE_MONTH ${month}"\
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage_version.h
sed -i "7c #define VERSION_DATE_DAY ${day}"\
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage_version.h
sed -i "8c #define VERSION_DATE_HOUR ${hour}"\
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage_version.h
sed -i "9c #define VERSION_DATE_MINUTE ${minute}"\
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage_version.h
sed -i "13c #define VERSION_HASH ${hash}"\
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage_version.h
sed -i "14c #define VERSION_GIT_BRANCH ${branch}"\
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage_version.h
#cat ./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage_version.h
fi
@@ -1,9 +1,10 @@
/*
** Stack Frontier Generator 1.1.0 (2016-03-03 16:08:48.603000)
** Stack Frontier Generator 1.1.0 (2019-12-27 16:40:05.273000)
**
** WARNING - Auto-generated file. Modifications could be lost!
*/
--define=ICALL_STACK0_ADDR=0xd001
--define=ICALL_STACK0_START=0xd000
--define=ICALL_RAM0_START=0x200041e0
--define=ICALL_RAM0_START=0x20004160
@@ -1,9 +1,10 @@
/*
** Stack Frontier Generator 1.1.0 (2016-03-03 16:08:48.603000)
** Stack Frontier Generator 1.1.0 (2019-12-27 16:40:05.273000)
**
** WARNING - Auto-generated file. Modifications could be lost!
*/
--define=ICALL_RAM0_START=0x200041e0
--define=ICALL_RAM0_START=0x20004160
--define=ICALL_STACK0_START=0xd000
--define=ICALL_STACK0_ADDR=0xd001
@@ -18,11 +18,11 @@
<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.508772074"
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain.1709087891"
name="TI Build Tools"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain"
targetTool="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.253004641">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.307496426"
targetTool="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.592637328">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.187891791"
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"/>
@@ -40,44 +40,44 @@
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.1440951273"
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.469507241"
superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION"
value="18.1.5.LTS" valueType="string"/>
<targetPlatform
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug.1602976043"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug.99739349"
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.1636245865"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug.1796363579"
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.970988650"
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.compilerDebug.912613276"
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.1857210705"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.728819715"
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.714636443"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.1616377459"
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.261228559"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.1976507365"
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.1228981473"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN.452052562"
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.605071558"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.737944281"
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.108821138"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.2110497520"
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.957532787"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH.1752465424"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH"
valueType="includePath">
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/>
@@ -108,7 +108,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.1105424988"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.958203846"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE"
valueType="definedSymbols">
<listOptionValue builtIn="false" value="BOARD_DISPLAY_EXCLUDE_UART"/>
@@ -130,39 +130,39 @@
<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.1032444705"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL.1087634147"
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.1070661718"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.377303910"
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.476728347"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GCC.723459219"
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.1028582292"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS.919200658"
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.1576358748"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING.1430944716"
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.839364861"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.1887447155"
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.1520544614"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER.565376519"
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.632756283"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS.1229454694"
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.1953982293"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE.532606003"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE"
valueType="stringList">
<listOptionValue builtIn="false" value="${SRC_EX}/config/build_components.opt"/>
@@ -171,38 +171,38 @@
value="${ORG_PROJ_DIR}/../../ccs/config/ccs_compiler_defines.bcfg"/>
</option>
<inputType
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS.311618182"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS.2040949282"
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.1172126406"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS.895597825"
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.1875232524"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS.1325128518"
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.1021129889"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS.246253993"
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.253004641"
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.592637328"
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.163894365"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE.655691751"
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.446557062"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE.1472363766"
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.1183163963"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE.957386741"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE"
value="&quot;${ProjName}.map&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.1489194034"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.2087532765"
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.83785030"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY.1685845719"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY"
valueType="libs">
<listOptionValue builtIn="false" value="libc.a"/>
@@ -211,86 +211,86 @@
<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.531184787"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH.2103736078"
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.1981415630"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS.590476821"
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.649902168"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.1116110693"
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.1729779528"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER.1780443887"
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.1878611611"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO.1365571559"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO"
value="&quot;${ProjName}_linkInfo.xml&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.202293784"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.472342113"
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.320082858"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.183676739"
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.1085231487"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD_SRCS.816325003"
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.1108737317"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD2_SRCS.228816199"
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.75789309"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__GEN_CMDS.2004850048"
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.1993143283"
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.1041100349"
name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.1082701845"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.1878555334"
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.1869306517"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH.1303276943"
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.823229474"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.448647073"
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.91063780" name="XDCtools"
<tool id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.1642099341" name="XDCtools"
superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool">
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH.1479641733"
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH.1034906850"
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.141072820"
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET.1318413439"
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.29309402"
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM.1046279113"
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.655405343"
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW.645098492"
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.2098255943"
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE.1655263222"
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.1106331477"
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR.1686967050"
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.803098937"
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.COMPILE_OPTIONS.2031730779"
superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.COMPILE_OPTIONS"
value="&quot;${COMPILER_FLAGS}&quot;" valueType="string"/>
</tool>
@@ -17,11 +17,6 @@
<property Type="choicelist" Value="1" id="XDS110 Aux Port"/>
</choice>
</property>
<property Type="choicelist" Value="1" id="Debug Probe Selection">
<choice Name="Select by serial number" value="0">
<property Type="stringfield" Value="L1000537" id="-- Enter the serial number"/>
</choice>
</property>
<platform XML_version="1.2" id="platform_0">
<instance XML_version="1.2" desc="CC2650F128_0" href="devices/cc2650f128.xml" id="CC2650F128_0" xml="cc2650f128.xml" xmlpath="devices"/>
</platform>
@@ -13,14 +13,20 @@
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Default.1209999684" name="FlashROM" parent="com.ti.ccstudio.buildDefinitions.TMS470.Default" postannouncebuildStep="" postbuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TOOLS_BLE}/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${ORG_PROJ_DIR}/../../ccs/config/ccs_compiler_defines.bcfg ${ORG_PROJ_DIR}/../../ccs/config/ccs_linker_defines.cmd" preannouncebuildStep="" prebuildStep="&quot;${TOOLS_BLE}/lib_search/lib_search.exe&quot; ${ORG_PROJ_DIR}/build_config.opt &quot;${TOOLS_BLE}/lib_search/params_split_cc2640.xml&quot; ${SRC_BLE_CORE}/../blelib &quot;${ORG_PROJ_DIR}/../../ccs/config/lib_linker.cmd&quot;">
<folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Default.1209999684." name="/"
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties=""
cleanCommand="${CG_CLEAN_CMD}" description=""
id="com.ti.ccstudio.buildDefinitions.TMS470.Default.1209999684" name="FlashROM"
parent="com.ti.ccstudio.buildDefinitions.TMS470.Default" postannouncebuildStep=""
postbuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TOOLS_BLE}/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${ORG_PROJ_DIR}/../../ccs/config/ccs_compiler_defines.bcfg ${ORG_PROJ_DIR}/../../ccs/config/ccs_linker_defines.cmd"
preannouncebuildStep=""
prebuildStep="&quot;${TOOLS_BLE}/lib_search/lib_search.exe&quot; ${ORG_PROJ_DIR}/build_config.opt &quot;${TOOLS_BLE}/lib_search/params_split_cc2640.xml&quot; ${SRC_BLE_CORE}/../blelib &quot;${ORG_PROJ_DIR}/../../ccs/config/lib_linker.cmd&quot;">
<folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Default.1209999684." name="/"
resourcePath="">
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain.832046861"
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain.1559304320"
name="TI Build Tools"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain"
targetTool="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1662665503">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.361513614"
targetTool="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1852625411">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1086881235"
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"/>
@@ -32,44 +38,53 @@
<listOptionValue builtIn="false" value="LINKER_COMMAND_FILE="/>
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.1409784186"
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.649543706"
name="Compiler version"
superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION"
value="18.1.4.LTS" valueType="string"/>
<targetPlatform
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug.1097216259"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug.111961287"
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.988453068"
name="GNU Make.FlashROM" parallelBuildOn="true" parallelizationNumber="optimal"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug.707210004"
keepEnvironmentInBuildfile="false" name="GNU Make" parallelBuildOn="true"
parallelizationNumber="optimal"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug"/>
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.compilerDebug.772298983"
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.compilerDebug.1071730275"
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.1310942383"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.1796388867"
name="Target processor version (--silicon_version, -mv)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.7M3"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.746618886"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.982642710"
name="Designate code state, 16-bit (thumb) or 32-bit (--code_state)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.16"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.1515548706"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.598060242"
name="Application binary interface. (--abi)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.eabi"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN.607163911"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN.1990088850"
name="Little endian code [See 'General' page to edit] (--little_endian, -me)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN"
value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.318297824"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.244600603"
name="Optimization level (--opt_level, -O)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.4"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.631719280"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.1629603334"
name="Speed vs. size trade-offs (--opt_for_speed, -mf)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.0"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH.1577402438"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH.1891480534"
name="Add dir to #include search path (--include_path, -I)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH"
valueType="includePath">
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/>
@@ -84,9 +99,9 @@
<listOptionValue builtIn="false" value="${SRC_COMMON}/osal/src/inc"/>
<listOptionValue builtIn="false" value="${SRC_COMMON}/services/src/nv/cc26xx"/>
<listOptionValue builtIn="false" value="${SRC_COMMON}/services/src/nv"/>
<listOptionValue builtIn="false" value="${SRC_COMMON}/services/src/saddr"/>
<listOptionValue builtIn="false" value="${SRC_COMMON}/icall/src/inc"/>
<listOptionValue builtIn="false" value="${SRC_BLE_CORE}/inc"/>
<listOptionValue builtIn="false" value="${SRC_COMMON}/services/src/saddr"/>
<listOptionValue builtIn="false" value="${SRC_COMMON}/icall/src/inc"/>
<listOptionValue builtIn="false" value="${SRC_BLE_CORE}/inc"/>
<listOptionValue builtIn="false" value="${SRC_BLE_CORE}/rom"/>
<listOptionValue builtIn="false" value="${SRC_BLE_CORE}/controller/cc26xx/inc"/>
<listOptionValue builtIn="false" value="${SRC_COMMON}/services/src/aes/cc26xx"/>
@@ -97,7 +112,8 @@
<listOptionValue builtIn="false" value="${SRC_EX}/profiles/roles"/>
<listOptionValue builtIn="false" value="${CC26XXWARE}"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.257493390"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.2049411711"
name="Pre-define NAME (--define, -D)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE"
valueType="definedSymbols">
<listOptionValue builtIn="false" value="CC26XX"/>
@@ -110,7 +126,7 @@
<listOptionValue builtIn="false" value="FLASH_ROM_BUILD"/>
<listOptionValue builtIn="false" value="INCLUDE_AES_DECRYPT"/>
<listOptionValue builtIn="false" value="NEAR_FUNC="/>
<listOptionValue builtIn="false" value="OSAL_CBTIMER_NUM_TASKS=1"/>
<listOptionValue builtIn="false" value="OSAL_CBTIMER_NUM_TASKS=1"/>
<listOptionValue builtIn="false" value="OSAL_SNV=1"/>
<listOptionValue builtIn="false" value="USE_ICALL"/>
<listOptionValue builtIn="false" value="xDEBUG"/>
@@ -121,67 +137,78 @@
<listOptionValue builtIn="false" value="xTESTMODES"/>
<listOptionValue builtIn="false" value="xTEST_BLEBOARD"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.174341808"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.706882445"
name="C Dialect"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.C99"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS.368319864"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS.970002376"
name="Suppress diagnostic &lt;id&gt; (--diag_suppress, -pds)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS"
valueType="stringList">
<listOptionValue builtIn="false" value="48"/>
<listOptionValue builtIn="false" value="16004"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING.1796876384"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING.593508122"
name="Treat diagnostic &lt;id&gt; as warning (--diag_warning, -pdsw)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING"
valueType="stringList">
<listOptionValue builtIn="false" value="225"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.1202072403"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.1665686728"
name="Wrap diagnostic messages (--diag_wrap)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.off"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER.746142779"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER.981942367"
name="Emit diagnostic identifier numbers (--display_error_number, -pden)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER"
value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE.2057721302"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE.822258685"
name="Read options from specified file (--cmd_file, -@)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE"
valueType="stringList">
<listOptionValue builtIn="false" value="${SRC_EX}/config/build_components.opt"/>
<listOptionValue builtIn="false" value="${ORG_PROJ_DIR}/build_config.opt"/>
</option>
<inputType
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS.193620484"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS.1611178351"
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.1071304751"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS.719858209"
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.1900538416"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS.1727820922"
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.1395617758"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS.226678329"
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.1662665503"
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1852625411"
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.1043297041"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE.1116602715"
name="Set C system stack size (--stack_size, -stack)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE"
value="256" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE.30321841"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE.453097232"
name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE"
value="0" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE.1098985537"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE.1766042498"
name="Link information (map) listed into &lt;file&gt; (--map_file, -m)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE"
value="&quot;${ProjName}.map&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.207849780"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.1085668260"
name="Specify output file name (--output_file, -o)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE"
value="${ProjName}.out" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY.1730405570"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY.1465601902"
name="Include library file or command file as input (--library, -l)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY"
valueType="libs">
<listOptionValue builtIn="false" value="libc.a"/>
@@ -192,13 +219,15 @@
<listOptionValue builtIn="false"
value="${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH.1642862213"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH.104670659"
name="Add &lt;dir&gt; to library search path (--search_path, -i)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH"
valueType="libPaths">
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/lib"/>
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS.931842322"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS.694076948"
name="Suppress diagnostic &lt;id&gt; (--diag_suppress)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS"
valueType="stringList">
<listOptionValue builtIn="false" value="16002-D"/>
@@ -206,60 +235,70 @@
<listOptionValue builtIn="false" value="10325-D"/>
<listOptionValue builtIn="false" value="10229-D"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.628793954"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.1793504671"
name="Wrap diagnostic messages (--diag_wrap)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.off"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER.1795637117"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER.1064066608"
name="Emit diagnostic identifier numbers (--display_error_number)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER"
value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO.1568690558"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO.1985154852"
name="Detailed link information data-base into &lt;file&gt; (--xml_link_info, -xml_link_info)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO"
value="&quot;${ProjName}_linkInfo.xml&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.ENTRY_POINT.790669318"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.ENTRY_POINT.1240213933"
name="Specify program entry point for the output module (--entry_point, -e)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.ENTRY_POINT"
value="startup_entry" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.636942967"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.274912320"
name="Aggressively reduce size of the DWARF information (--compress_dwarf)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.on"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.1245052655"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.101724544"
name="Eliminate sections not needed in the executable (--unused_section_elimination)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.on"
valueType="enumerated"/>
<inputType
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD_SRCS.1776037702"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD_SRCS.1747499519"
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.2125995458"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD2_SRCS.428284916"
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.1674943097"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__GEN_CMDS.755369992"
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.1597342378"
name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.1896669298"
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.995125643" name="ARM Hex Utility"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.1812746902"
name="Specify rom width (--romwidth, -romwidth=width)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH" value="8"
valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH.2112595558"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH.535955299"
name="Specify memory width (--memwidth, -memwidth=width)"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH" value="8"
valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.1916629122"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.137845789"
name="Output format"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.INTEL"
valueType="enumerated"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="cc26x0f128.cmd" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
</folderInfo>
<sourceEntries>
<entry excluding="cc26x0f128.cmd" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath"
name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
@@ -17,11 +17,6 @@
<property Type="choicelist" Value="1" id="XDS110 Aux Port"/>
</choice>
</property>
<property Type="choicelist" Value="1" id="Debug Probe Selection">
<choice Name="Select by serial number" value="0">
<property Type="stringfield" Value="L1000537" id="-- Enter the serial number"/>
</choice>
</property>
<platform XML_version="1.2" id="platform_0">
<instance XML_version="1.2" desc="CC2650F128_0" href="devices/cc2650f128.xml" id="CC2650F128_0" xml="cc2650f128.xml" xmlpath="devices"/>
</platform>
@@ -51,7 +51,6 @@ extern "C" {
#include <ti/drivers/PIN.h>
#include <driverlib/ioc.h>
#define HEADSTAGE_UNI_2_0
#ifdef HEADSTAGE_UNI_2_0
#include "neu/headstage_pin.h"
#else
@@ -1,51 +0,0 @@
#!/bin/bash
input="./Elite_test.txt"
declare -i col_index=0
declare -i row_index=0
declare -i channel=0
declare -i gain=0
declare -i current_line=2
declare -a value
MAC="MAC"
while read -r line; do
for word in $line; do
# get device MAC
if [ $row_index -eq 1 ] && [ $col_index -eq 0 ];then
MAC=$word
sed -i "${current_line} i \\\n#elif defined(BOARD_${MAC}){" ./test.txt
sed -i 's/:/_/g' ./test.txt
current_line=$current_line+2
# if [ $row_index -gt 0 ];then
# # row 1~8 is the least gain clai data
# channel=`expr $row_index - 1`
# channel=`expr $channel % 8`
#
# gain=`expr $row_index - 1`
# gain=`expr $gain / 8`
#
# if [ $col_index -eq 4 ];then
# sed -i "${current_line} i \\\t.Ch[${channel}].Gain[${gain}] = $word," ./test.txt
# current_line=$current_line+1
# elif [ $col_index -eq 6 ];then
# sed -i "${current_line} i \\\t.Ch[${channel}].Offset[${gain}] = $word," ./test.txt
# current_line=$current_line+1
# fi
fi
#update index
if [ $col_index -lt 5 ];then
col_index=$col_index+1
else
col_index=0
row_index=$row_index+1
fi
done
done < $input
#sed -i "${current_line} i }" ./test.txt
@@ -188,13 +188,16 @@ extern ICall_Semaphore semaphore;
#define VIS_CAL 0xA0
#define VIS_STI 0xC0
#define VIS_RST 0xF0
#define VIS_PAU 0x10 // pause
#define VIS_HANDSHAKE_TO_CONFIG 0x20
#define VIS_CONFIG 0x40
#define VIS_CONFIG2 0x70
// CIS operator
#define CIS_NOP 0x00
#define CIS_VOLT 0x10
#define CIS_LED 0x20
#define CIS_CALI 0x30
#define CIS_VERSION 0x40
// CIS return status code
#define CDR_SUCCESS 0x0
@@ -318,7 +321,7 @@ typedef struct {
==== device implement implement header ====
=========================================*/
#include "headstage_neu.h"
#include "headstage_uni.h"
/*!
* main function
@@ -380,14 +383,7 @@ static void headstage_update_instruction(uint8_t *instruction) {
break;
}
case INS_TYPE_CIS: {
if(ins_oper == CIS_CALI){
// CIS has only 20 byte now
// need ins[2] to choose return gain or offset
SendCaliValue(instruction[2]);
}
else{
headstage_update_cis_instruction(ins_oper);
}
headstage_update_cis_instruction(ins_oper);
break;
}
}
@@ -0,0 +1,45 @@
#ifndef NEU_CALI
#define NEU_CALI
#include "neulive13_CalibrationTable.h"
/*
*
* How to define Calibration()
*
* let y be DBS ADC raw data, which has value 0~1023
* x is UI display value, x = (y-512)/1000
* r is the real voltage value
*
* Before calibration we have r = (x - offset) / gain
*
* we want to have y' = Calibration(y), such that r = x_WithCali = (y' - 512)/1000
*
* => r = (x_WithOutCali - offset)/gain = x_WithCali = (y'-512)/1000
*
* => (x_WithOutCali - offset)/gain = ((y-512)/1000 - Offset)/gain = (y'-512)/1000
*
* => y' = 512 + [1000 * ((y-512)/1000 - Offset) / gain ]
*
* => y' = 512 + (y-512)/gain - [(1000 * Offset)/gain]
*
* => y' = (y-512)/gain + 512 - [(1000 * Offset)/gain]
*
*/
static uint16_t Calibration(uint8_t* DataBuf, uint8_t ch, uint8_t gain){
uint32_t raw, ret;
raw = (DataBuf[1] & 0x0f) << 6 | (DataBuf[2] & 0xFC) >> 2;
ret = 1000 * (raw-512)/CaliTable.Ch[ch].Gain[gain] + 512000 - 1000*1000*CaliTable.Ch[ch].Offset[gain] / CaliTable.Ch[ch].Gain[gain];
ret = ret / 1000;
// ret = ret * 10;
// ret = 1000 * (ret - CaliTable.Ch[ch].Offset[gain]) / CaliTable.Ch[ch].Gain[gain];
return (uint16_t) (ret);
}
#endif
@@ -1,14 +0,0 @@
#ifndef BIT_COUNT
#define BIT_COUNT
static uint8_t BitCount(uint8_t u8_value){
uint8_t ret = 0;
for(int i=0 ; i<8 ; i++){
if(u8_value & (1 << i)){
ret ++;
}
}
return ret;
}
#endif
@@ -12,31 +12,9 @@ static uint8_t headstage_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;
internal_battery_percent = internal_batt_sense & 0xff;
if (internal_battery_percent < battery_percent) battery_percent = internal_battery_percent;
return battery_percent;
}
static uint8_t battery_volt = 256;
static uint8_t headstage_battery_volt1() {
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;
battery_volt = internal_battery_percent;
return battery_volt;
}
static uint8_t headstage_battery_volt2() {
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 >> 8) & 0xFF;
battery_volt = internal_battery_percent;
return battery_volt;
}
#endif // HEADSTAGE_BATT_H
@@ -1,106 +0,0 @@
#ifndef HEAD_BLAST_DATA
#define HEAD_BLAST_DATA
// L2CAP Header(2) + L2CAP CID(2) + ATT Opcode(1) + ATT handle(2)
#define TOTAL_PACKET_OVERHEAD 7
static void SimpleBLEPeripheral_performPeriodicTask();
/*********************************************************************
* @fn SimpleBLEPeripheral_blastData
*
* @brief Sends ATT notifications in a tight while loop to demo
* throughput
*
* @param none
*
* @return none
*/
static void SimpleBLEPeripheral_blastData() {
// Subtract the total packet overhead of ATT and L2CAP layer from notification payload
uint16_t len = MAX_PDU_SIZE - TOTAL_PACKET_OVERHEAD;
attHandleValueNoti_t noti;
bStatus_t status;
noti.handle = 0x27;
noti.len = len;
uint32_t not_time_stamp;
// Store hte connection handle for future reference
uint16_t connectionHandle;
GAPRole_GetParameter(GAPROLE_CONNHANDLE, &connectionHandle);
// If RTOS queue is not empty, process app message.
// We need to process the app message here in the case of a keypress
while (!Queue_empty(appMsgQueue)) {
sbpEvt_t *pMsg = (sbpEvt_t *)Util_dequeueMsg(appMsgQueue);
if (pMsg) {
// Process message.
SimpleBLEPeripheral_processAppMsg(pMsg);
// Free the space from the message.
ICall_free(pMsg);
}
}
not_time_stamp = Timestamp_get32() / 2;
noti.pValue = (uint8 *)GATT_bm_alloc(connectionHandle, ATT_HANDLE_VALUE_NOTI, GATT_MAX_MTU, &len);
if (noti.pValue != NULL) // if allocated
{
// Place index
noti.pValue[2] = not_time_stamp & 0xFF;
noti.pValue[3] = (not_time_stamp >> 8) & 0xFF;
noti.pValue[4] = (not_time_stamp >> 16) & 0xFF;
noti.pValue[5] = (not_time_stamp >> 24) & 0xFF;
noti.pValue[6] = 100;
noti.pValue[7] = 0;
// Attempt to send the notification
status = GATT_Notification(connectionHandle, &noti, GATT_NO_AUTHENTICATION);
if (status != SUCCESS) // if noti not sent
{
// PIN_setOutputValue(hSbpPins, Board_LED1, Board_LED_ON);
GATT_bm_free((gattMsg_t *)&noti, ATT_HANDLE_VALUE_NOTI);
} else {
// Notification is successfully sent, increment counters
// Display_print0(dispHandle, 4, 0, "success");
// PIN_setOutputValue(hSbpPins, Board_LED2, Board_LED_ON);
msg_counter++;
}
} else {
// bleNoResources was returned
asm(" NOP ");
}
// Reset debug pins
// PIN_setOutputValue(hSbpPins, Board_LED1, Board_LED_OFF);
// PIN_setOutputValue(hSbpPins, Board_LED2, Board_LED_OFF);
}
static void SimpleBLEPeripheral_performPeriodicTask(){
SimpleBLEPeripheral_blastData();
}
/*********************************************************************
* @fn SimpleBLEPeripheral_clockHandler
*
* @brief Handler function for clock timeouts.
*
* @param arg - event type
*
* @return None.
*/
static void SimpleBLEPeripheral_clockHandler(UArg arg) {
// Store the event.
events |= arg;
// Wake up the application.
Semaphore_post(sem);
}
#endif
@@ -1,48 +0,0 @@
#ifndef NEU_CALI_FXN
#define NEU_CALI_FXN
#include "headstage_cali_table.h"
static void CaliTable2u8(uint8_t* cali){
for(int i=0 ; i<12 ; i++){
for(int j=0 ; j<3 ; j++){
*(cali + 12*i + 2*j) = (uint8_t) (CaliTable.Ch[i].Gain[j] | 0xFF00) >> 8;
*(cali + 12*i + 2*j+1) = (uint8_t) (CaliTable.Ch[i].Gain[j] | 0x00FF);
*(cali + 12*i + 2*j+6) = (uint8_t) (CaliTable.Ch[i].Offset[j] | 0xFF00) >> 8;
*(cali + 12*i + 2*j+7) = (uint8_t) (CaliTable.Ch[i].Offset[j] | 0x00FF);
}
}
}
/*
* SendCaliValue
* CaliNumber : 0~23
* - 0: ch1 gain value
* - 1: ch1 offset value
* - 2: ch2 gain
* - .......
*/
static void SendCaliValue(uint8_t CaliNumber){
uint8_t ch, gain_offset;
uint8_t cdr_buf[10];
ch = 2 * (CaliNumber % 4);
uint8_t gain_level = CaliNumber / 4; // 0:gain, 1:offset
cdr_buf[0] = CHIP_ID;
cdr_buf[1] = (uint8_t) (CaliTable.Ch[ch].Gain[gain_level] >> 8) & 0xFF;
cdr_buf[2] = (uint8_t) CaliTable.Ch[ch].Gain[gain_level] & 0x00FF;
cdr_buf[3] = (uint8_t) (CaliTable.Ch[ch].Offset[gain_level] >> 8) & 0xFF;
cdr_buf[4] = (uint8_t) CaliTable.Ch[ch].Offset[gain_level] & 0x00FF;
cdr_buf[5] = (uint8_t) (CaliTable.Ch[ch+1].Gain[gain_level] >> 8) & 0xFF;
cdr_buf[6] = (uint8_t) CaliTable.Ch[ch+1].Gain[gain_level] & 0x00FF;
cdr_buf[7] = (uint8_t) (CaliTable.Ch[ch+1].Offset[gain_level] >> 8) & 0xFF;
cdr_buf[8] = (uint8_t) CaliTable.Ch[ch+1].Offset[gain_level] & 0x00FF;
cdr_buf[9] = 0; // don't care
SimpleProfile_SetParameter(BLE_CDR_BUFF_CHAR, BLE_CDR_BUFF_SIZE, cdr_buf);
}
#endif
@@ -1,971 +0,0 @@
#ifndef NEU_CALI_TABLE
#define NEU_CALI_TABLE
#define BOARD_TEST
typedef struct _SingleChannelCali{
uint16_t Gain[4];
int16_t Offset[4];
}SingleChannelCali;
struct _CaliTable{
SingleChannelCali Ch[8];
}CaliTable =
#ifdef BOARD_TEST
{
.Ch[0].Gain[0] = 1,
.Ch[0].Offset[0] = 0,
.Ch[1].Gain[0] = 1,
.Ch[1].Offset[0] = 0,
.Ch[2].Gain[0] = 1,
.Ch[2].Offset[0] = 0,
.Ch[3].Gain[0] = 1,
.Ch[3].Offset[0] = 0,
.Ch[4].Gain[0] = 1,
.Ch[4].Offset[0] = 0,
.Ch[5].Gain[0] = 1,
.Ch[5].Offset[0] = 0,
.Ch[6].Gain[0] = 1,
.Ch[6].Offset[0] = 0,
.Ch[7].Gain[0] = 1,
.Ch[7].Offset[0] = 0,
.Ch[0].Gain[1] = 1,
.Ch[0].Offset[1] = 0,
.Ch[1].Gain[1] = 1,
.Ch[1].Offset[1] = 0,
.Ch[2].Gain[1] = 1,
.Ch[2].Offset[1] = 0,
.Ch[3].Gain[1] = 1,
.Ch[3].Offset[1] = 0,
.Ch[4].Gain[1] = 1,
.Ch[4].Offset[1] = 0,
.Ch[5].Gain[1] = 1,
.Ch[5].Offset[1] = 0,
.Ch[6].Gain[1] = 1,
.Ch[6].Offset[1] = 0,
.Ch[7].Gain[1] = 1,
.Ch[7].Offset[1] = 0,
.Ch[0].Gain[2] = 1,
.Ch[0].Offset[2] = 0,
.Ch[1].Gain[2] = 1,
.Ch[1].Offset[2] = 0,
.Ch[2].Gain[2] = 1,
.Ch[2].Offset[2] = 0,
.Ch[3].Gain[2] = 1,
.Ch[3].Offset[2] = 0,
.Ch[4].Gain[2] = 1,
.Ch[4].Offset[2] = 0,
.Ch[5].Gain[2] = 1,
.Ch[5].Offset[2] = 0,
.Ch[6].Gain[2] = 1,
.Ch[6].Offset[2] = 0,
.Ch[7].Gain[2] = 1,
.Ch[7].Offset[2] = 0,
.Ch[0].Gain[3] = 1,
.Ch[0].Offset[3] = 0,
.Ch[1].Gain[3] = 1,
.Ch[1].Offset[3] = 0,
.Ch[2].Gain[3] = 1,
.Ch[2].Offset[3] = 0,
.Ch[3].Gain[3] = 1,
.Ch[3].Offset[3] = 0,
.Ch[4].Gain[3] = 1,
.Ch[4].Offset[3] = 0,
.Ch[5].Gain[3] = 1,
.Ch[5].Offset[3] = 0,
.Ch[6].Gain[3] = 1,
.Ch[6].Offset[3] = 0,
.Ch[7].Gain[3] = 1,
.Ch[7].Offset[3] = 0
};
#elif defined(BOARD_18_04_ED_37_C7_38)
{
.Ch[0].Gain[0] = 48,
.Ch[0].Offset[0] = 49,
.Ch[1].Gain[0] = 49,
.Ch[1].Offset[0] = 36,
.Ch[2].Gain[0] = 48,
.Ch[2].Offset[0] = 55,
.Ch[3].Gain[0] = 48,
.Ch[3].Offset[0] = 50,
.Ch[4].Gain[0] = 48,
.Ch[4].Offset[0] = 51,
.Ch[5].Gain[0] = 48,
.Ch[5].Offset[0] = 76,
.Ch[6].Gain[0] = 47,
.Ch[6].Offset[0] = 44,
.Ch[7].Gain[0] = 47,
.Ch[7].Offset[0] = 49,
.Ch[0].Gain[1] = 359,
.Ch[0].Offset[1] = 44,
.Ch[1].Gain[1] = 359,
.Ch[1].Offset[1] = -56,
.Ch[2].Gain[1] = 359,
.Ch[2].Offset[1] = 82,
.Ch[3].Gain[1] = 361,
.Ch[3].Offset[1] = 49,
.Ch[4].Gain[1] = 360,
.Ch[4].Offset[1] = 56,
.Ch[5].Gain[1] = 358,
.Ch[5].Offset[1] = 239,
.Ch[6].Gain[1] = 347,
.Ch[6].Offset[1] = 5,
.Ch[7].Gain[1] = 346,
.Ch[7].Offset[1] = 40,
.Ch[0].Gain[2] = 1494,
.Ch[0].Offset[2] = 14,
.Ch[1].Gain[2] = 1486,
.Ch[1].Offset[2] = -394,
.Ch[2].Gain[2] = 1473,
.Ch[2].Offset[2] = 185,
.Ch[3].Gain[2] = 1480,
.Ch[3].Offset[2] = 54,
.Ch[4].Gain[2] = 1478,
.Ch[4].Offset[2] = 75,
.Ch[5].Gain[2] = 1445,
.Ch[5].Offset[2] = 824,
.Ch[6].Gain[2] = 1437,
.Ch[6].Offset[2] = -138,
.Ch[7].Gain[2] = 1439,
.Ch[7].Offset[2] = 5,
.Ch[0].Gain[3] = 3027,
.Ch[0].Offset[3] = -36,
.Ch[1].Gain[3] = 2810,
.Ch[1].Offset[3] = -823,
.Ch[2].Gain[3] = 2945,
.Ch[2].Offset[3] = 319,
.Ch[3].Gain[3] = 2949,
.Ch[3].Offset[3] = 59,
.Ch[4].Gain[3] = 2947,
.Ch[4].Offset[3] = 102,
.Ch[5].Gain[3] = 1860,
.Ch[5].Offset[3] = 1443,
.Ch[6].Gain[3] = 2862,
.Ch[6].Offset[3] = -328,
.Ch[7].Gain[3] = 2890,
.Ch[7].Offset[3] = -41
};
#elif defined(BOARD_18_04_ED_37_C5_ED)
{
.Ch[0].Gain[0] = 95,
.Ch[0].Offset[0] = 2013,
.Ch[1].Gain[0] = 48,
.Ch[1].Offset[0] = -10,
.Ch[2].Gain[0] = 48,
.Ch[2].Offset[0] = -15,
.Ch[3].Gain[0] = 48,
.Ch[3].Offset[0] = -26,
.Ch[4].Gain[0] = 48,
.Ch[4].Offset[0] = -18,
.Ch[5].Gain[0] = 48,
.Ch[5].Offset[0] = -23,
.Ch[6].Gain[0] = 45,
.Ch[6].Offset[0] = -23,
.Ch[7].Gain[0] = 45,
.Ch[7].Offset[0] = -35,
.Ch[0].Gain[1] = 355,
.Ch[0].Offset[1] = 9,
.Ch[1].Gain[1] = 356,
.Ch[1].Offset[1] = 57,
.Ch[2].Gain[1] = 355,
.Ch[2].Offset[1] = 25,
.Ch[3].Gain[1] = 357,
.Ch[3].Offset[1] = -70,
.Ch[4].Gain[1] = 356,
.Ch[4].Offset[1] = -1,
.Ch[5].Gain[1] = 354,
.Ch[5].Offset[1] = -39,
.Ch[6].Gain[1] = 345,
.Ch[6].Offset[1] = -37,
.Ch[7].Gain[1] = 334,
.Ch[7].Offset[1] = -130,
.Ch[0].Gain[2] = 1540,
.Ch[0].Offset[2] = 60,
.Ch[1].Gain[2] = 1542,
.Ch[1].Offset[2] = 314,
.Ch[2].Gain[2] = 1529,
.Ch[2].Offset[2] = 174,
.Ch[3].Gain[2] = 1539,
.Ch[3].Offset[2] = -199,
.Ch[4].Gain[2] = 1541,
.Ch[4].Offset[2] = 50,
.Ch[5].Gain[2] = 1521,
.Ch[5].Offset[2] = -97,
.Ch[6].Gain[2] = 1480,
.Ch[6].Offset[2] = -92,
.Ch[7].Gain[2] = 1485,
.Ch[7].Offset[2] = -497,
.Ch[0].Gain[3] = 3310,
.Ch[0].Offset[3] = 222,
.Ch[1].Gain[3] = 3164,
.Ch[1].Offset[3] = 690,
.Ch[2].Gain[3] = 3220,
.Ch[2].Offset[3] = 467,
.Ch[3].Gain[3] = 3255,
.Ch[3].Offset[3] = -401,
.Ch[4].Gain[3] = 3311,
.Ch[4].Offset[3] = 160,
.Ch[5].Gain[3] = 3232,
.Ch[5].Offset[3] = 78,
.Ch[6].Gain[3] = 3253,
.Ch[6].Offset[3] = -178,
.Ch[7].Gain[3] = 2667,
.Ch[7].Offset[3] = -985
};
#elif defined(BOARD_00_81_F9_E4_9B_EF)
{
.Ch[0].Gain[0] = 48,
.Ch[0].Offset[0] = 98,
.Ch[1].Gain[0] = 47,
.Ch[1].Offset[0] = 85,
.Ch[2].Gain[0] = 47,
.Ch[2].Offset[0] = 76,
.Ch[3].Gain[0] = 47,
.Ch[3].Offset[0] = 95,
.Ch[4].Gain[0] = 47,
.Ch[4].Offset[0] = 81,
.Ch[5].Gain[0] = 47,
.Ch[5].Offset[0] = 64,
.Ch[6].Gain[0] = 45,
.Ch[6].Offset[0] = 65,
.Ch[7].Gain[0] = 1,
.Ch[7].Offset[0] = 79,
.Ch[0].Gain[1] = 353,
.Ch[0].Offset[1] = 206,
.Ch[1].Gain[1] = 353,
.Ch[1].Offset[1] = 106,
.Ch[2].Gain[1] = 353,
.Ch[2].Offset[1] = 31,
.Ch[3].Gain[1] = 354,
.Ch[3].Offset[1] = 176,
.Ch[4].Gain[1] = 355,
.Ch[4].Offset[1] = 73,
.Ch[5].Gain[1] = 351,
.Ch[5].Offset[1] = -50,
.Ch[6].Gain[1] = 343,
.Ch[6].Offset[1] = -45,
.Ch[7].Gain[1] = 222,
.Ch[7].Offset[1] = -44,
.Ch[0].Gain[2] = 1467,
.Ch[0].Offset[2] = 573,
.Ch[1].Gain[2] = 1469,
.Ch[1].Offset[2] = 160,
.Ch[2].Gain[2] = 1448,
.Ch[2].Offset[2] = -130,
.Ch[3].Gain[2] = 1468,
.Ch[3].Offset[2] = 495,
.Ch[4].Gain[2] = 1480,
.Ch[4].Offset[2] = 40,
.Ch[5].Gain[2] = 1444,
.Ch[5].Offset[2] = -444,
.Ch[6].Gain[2] = 1407,
.Ch[6].Offset[2] = -442,
.Ch[7].Gain[2] = 5736,
.Ch[7].Offset[2] = -592,
.Ch[0].Gain[3] = 2698,
.Ch[0].Offset[3] = 1047,
.Ch[1].Gain[3] = 3016,
.Ch[1].Offset[3] = 251,
.Ch[2].Gain[3] = 2915,
.Ch[2].Offset[3] = -327,
.Ch[3].Gain[3] = 2852,
.Ch[3].Offset[3] = 868,
.Ch[4].Gain[3] = 3035,
.Ch[4].Offset[3] = -19,
.Ch[5].Gain[3] = 2518,
.Ch[5].Offset[3] = -938,
.Ch[6].Gain[3] = 2387,
.Ch[6].Offset[3] = -936,
.Ch[7].Gain[3] = 11166,
.Ch[7].Offset[3] = -656
};
#elif defined(BOARD_00_81_F9_E4_9B_97)
{
.Ch[0].Gain[0] = 48,
.Ch[0].Offset[0] = 34,
.Ch[1].Gain[0] = 48,
.Ch[1].Offset[0] = 25,
.Ch[2].Gain[0] = 48,
.Ch[2].Offset[0] = 31,
.Ch[3].Gain[0] = 47,
.Ch[3].Offset[0] = 44,
.Ch[4].Gain[0] = 48,
.Ch[4].Offset[0] = 29,
.Ch[5].Gain[0] = 47,
.Ch[5].Offset[0] = 40,
.Ch[6].Gain[0] = 45,
.Ch[6].Offset[0] = 10,
.Ch[7].Gain[0] = 45,
.Ch[7].Offset[0] = 12,
.Ch[0].Gain[1] = 349,
.Ch[0].Offset[1] = 67,
.Ch[1].Gain[1] = 349,
.Ch[1].Offset[1] = -7,
.Ch[2].Gain[1] = 350,
.Ch[2].Offset[1] = 37,
.Ch[3].Gain[1] = 350,
.Ch[3].Offset[1] = 133,
.Ch[4].Gain[1] = 351,
.Ch[4].Offset[1] = 30,
.Ch[5].Gain[1] = 350,
.Ch[5].Offset[1] = 102,
.Ch[6].Gain[1] = 331,
.Ch[6].Offset[1] = -114,
.Ch[7].Gain[1] = 339,
.Ch[7].Offset[1] = -100,
.Ch[0].Gain[2] = 1443,
.Ch[0].Offset[2] = 181,
.Ch[1].Gain[2] = 1439,
.Ch[1].Offset[2] = -140,
.Ch[2].Gain[2] = 1445,
.Ch[2].Offset[2] = 54,
.Ch[3].Gain[2] = 1417,
.Ch[3].Offset[2] = 457,
.Ch[4].Gain[2] = 1442,
.Ch[4].Offset[2] = 38,
.Ch[5].Gain[2] = 1443,
.Ch[5].Offset[2] = 338,
.Ch[6].Gain[2] = 1377,
.Ch[6].Offset[2] = -558,
.Ch[7].Gain[2] = 1364,
.Ch[7].Offset[2] = -514,
.Ch[0].Gain[3] = 2914,
.Ch[0].Offset[3] = 323,
.Ch[1].Gain[3] = 2877,
.Ch[1].Offset[3] = -320,
.Ch[2].Gain[3] = 2910,
.Ch[2].Offset[3] = 73,
.Ch[3].Gain[3] = 2655,
.Ch[3].Offset[3] = 865,
.Ch[4].Gain[3] = 2884,
.Ch[4].Offset[3] = 44,
.Ch[5].Gain[3] = 2863,
.Ch[5].Offset[3] = 659,
.Ch[6].Gain[3] = 2282,
.Ch[6].Offset[3] = -1079,
.Ch[7].Gain[3] = 2420,
.Ch[7].Offset[3] = -1034
};
#elif defined(BOARD_00_81_F9_E4_8B_50)
{
.Ch[0].Gain[0] = 50,
.Ch[0].Offset[0] = 0,
.Ch[1].Gain[0] = 50,
.Ch[1].Offset[0] = 6,
.Ch[2].Gain[0] = 50,
.Ch[2].Offset[0] = 18,
.Ch[3].Gain[0] = 50,
.Ch[3].Offset[0] = 25,
.Ch[4].Gain[0] = 50,
.Ch[4].Offset[0] = 0,
.Ch[5].Gain[0] = 50,
.Ch[5].Offset[0] = 20,
.Ch[6].Gain[0] = 48,
.Ch[6].Offset[0] = 3,
.Ch[7].Gain[0] = 48,
.Ch[7].Offset[0] = -3,
.Ch[0].Gain[1] = 362,
.Ch[0].Offset[1] = -58,
.Ch[1].Gain[1] = 362,
.Ch[1].Offset[1] = -12,
.Ch[2].Gain[1] = 363,
.Ch[2].Offset[1] = 78,
.Ch[3].Gain[1] = 363,
.Ch[3].Offset[1] = 125,
.Ch[4].Gain[1] = 364,
.Ch[4].Offset[1] = -60,
.Ch[5].Gain[1] = 361,
.Ch[5].Offset[1] = 91,
.Ch[6].Gain[1] = 341,
.Ch[6].Offset[1] = -32,
.Ch[7].Gain[1] = 352,
.Ch[7].Offset[1] = -83,
.Ch[0].Gain[2] = 1484,
.Ch[0].Offset[2] = -271,
.Ch[1].Gain[2] = 1482,
.Ch[1].Offset[2] = -88,
.Ch[2].Gain[2] = 1460,
.Ch[2].Offset[2] = 288,
.Ch[3].Gain[2] = 1471,
.Ch[3].Offset[2] = 487,
.Ch[4].Gain[2] = 1474,
.Ch[4].Offset[2] = -270,
.Ch[5].Gain[2] = 1463,
.Ch[5].Offset[2] = 340,
.Ch[6].Gain[2] = 1426,
.Ch[6].Offset[2] = -158,
.Ch[7].Gain[2] = 1424,
.Ch[7].Offset[2] = -363,
.Ch[0].Gain[3] = 2918,
.Ch[0].Offset[3] = -530,
.Ch[1].Gain[3] = 2937,
.Ch[1].Offset[3] = -177,
.Ch[2].Gain[3] = 2839,
.Ch[2].Offset[3] = 549,
.Ch[3].Gain[3] = 2713,
.Ch[3].Offset[3] = 926,
.Ch[4].Gain[3] = 2888,
.Ch[4].Offset[3] = -549,
.Ch[5].Gain[3] = 2823,
.Ch[5].Offset[3] = 665,
.Ch[6].Gain[3] = 2814,
.Ch[6].Offset[3] = -319,
.Ch[7].Gain[3] = 2817,
.Ch[7].Offset[3] = -744
};
#elif defined(BOARD_18_04_ED_37_C6_52)
{
.Ch[0].Gain[0] = 48,
.Ch[0].Offset[0] = 21,
.Ch[1].Gain[0] = 48,
.Ch[1].Offset[0] = 31,
.Ch[2].Gain[0] = 48,
.Ch[2].Offset[0] = 4,
.Ch[3].Gain[0] = 48,
.Ch[3].Offset[0] = 37,
.Ch[4].Gain[0] = 48,
.Ch[4].Offset[0] = 11,
.Ch[5].Gain[0] = 48,
.Ch[5].Offset[0] = 26,
.Ch[6].Gain[0] = 12,
.Ch[6].Offset[0] = 14,
.Ch[7].Gain[0] = 47,
.Ch[7].Offset[0] = -23,
.Ch[0].Gain[1] = 359,
.Ch[0].Offset[1] = -20,
.Ch[1].Gain[1] = 360,
.Ch[1].Offset[1] = 57,
.Ch[2].Gain[1] = 360,
.Ch[2].Offset[1] = -151,
.Ch[3].Gain[1] = 361,
.Ch[3].Offset[1] = 100,
.Ch[4].Gain[1] = 361,
.Ch[4].Offset[1] = -90,
.Ch[5].Gain[1] = 358,
.Ch[5].Offset[1] = 20,
.Ch[6].Gain[1] = 89,
.Ch[6].Offset[1] = -73,
.Ch[7].Gain[1] = 348,
.Ch[7].Offset[1] = -352,
.Ch[0].Gain[2] = 1562,
.Ch[0].Offset[2] = -170,
.Ch[1].Gain[2] = 1556,
.Ch[1].Offset[2] = 150,
.Ch[2].Gain[2] = 1506,
.Ch[2].Offset[2] = -725,
.Ch[3].Gain[2] = 1551,
.Ch[3].Offset[2] = 341,
.Ch[4].Gain[2] = 1539,
.Ch[4].Offset[2] = -476,
.Ch[5].Gain[2] = 1541,
.Ch[5].Offset[2] = -19,
.Ch[6].Gain[2] = 399,
.Ch[6].Offset[2] = -403,
.Ch[7].Gain[2] = 897,
.Ch[7].Offset[2] = -1430,
.Ch[0].Gain[3] = 3345,
.Ch[0].Offset[3] = -412,
.Ch[1].Gain[3] = 3352,
.Ch[1].Offset[3] = 296,
.Ch[2].Gain[3] = 1885,
.Ch[2].Offset[3] = -1344,
.Ch[3].Gain[3] = 3184,
.Ch[3].Offset[3] = 695,
.Ch[4].Gain[3] = 2760,
.Ch[4].Offset[3] = -994,
.Ch[5].Gain[3] = 3301,
.Ch[5].Offset[3] = -74,
.Ch[6].Gain[3] = 815,
.Ch[6].Offset[3] = -906,
.Ch[7].Gain[3] = 311,
.Ch[7].Offset[3] = -1815
};
#elif defined(BOARD_18_04_ED_37_C6_94)
{
.Ch[0].Gain[0] = 50,
.Ch[0].Offset[0] = 72,
.Ch[1].Gain[0] = 50,
.Ch[1].Offset[0] = 66,
.Ch[2].Gain[0] = 50,
.Ch[2].Offset[0] = 53,
.Ch[3].Gain[0] = 51,
.Ch[3].Offset[0] = 54,
.Ch[4].Gain[0] = 51,
.Ch[4].Offset[0] = 43,
.Ch[5].Gain[0] = 50,
.Ch[5].Offset[0] = 65,
.Ch[6].Gain[0] = 48,
.Ch[6].Offset[0] = 56,
.Ch[7].Gain[0] = 47,
.Ch[7].Offset[0] = 52,
.Ch[0].Gain[1] = 376,
.Ch[0].Offset[1] = 218,
.Ch[1].Gain[1] = 376,
.Ch[1].Offset[1] = 156,
.Ch[2].Gain[1] = 377,
.Ch[2].Offset[1] = 65,
.Ch[3].Gain[1] = 377,
.Ch[3].Offset[1] = 69,
.Ch[4].Gain[1] = 378,
.Ch[4].Offset[1] = -10,
.Ch[5].Gain[1] = 376,
.Ch[5].Offset[1] = 145,
.Ch[6].Gain[1] = 347,
.Ch[6].Offset[1] = 86,
.Ch[7].Gain[1] = 351,
.Ch[7].Offset[1] = 42,
.Ch[0].Gain[2] = 1561,
.Ch[0].Offset[2] = 711,
.Ch[1].Gain[2] = 1560,
.Ch[1].Offset[2] = 496,
.Ch[2].Gain[2] = 1569,
.Ch[2].Offset[2] = 146,
.Ch[3].Gain[2] = 1554,
.Ch[3].Offset[2] = 131,
.Ch[4].Gain[2] = 1563,
.Ch[4].Offset[2] = -198,
.Ch[5].Gain[2] = 1564,
.Ch[5].Offset[2] = 452,
.Ch[6].Gain[2] = 1482,
.Ch[6].Offset[2] = 196,
.Ch[7].Gain[2] = 1510,
.Ch[7].Offset[2] = 6,
.Ch[0].Gain[3] = 2287,
.Ch[0].Offset[3] = 1323,
.Ch[1].Gain[3] = 2956,
.Ch[1].Offset[3] = 944,
.Ch[2].Gain[3] = 3169,
.Ch[2].Offset[3] = 268,
.Ch[3].Gain[3] = 3119,
.Ch[3].Offset[3] = 205,
.Ch[4].Gain[3] = 3124,
.Ch[4].Offset[3] = -449,
.Ch[5].Gain[3] = 3036,
.Ch[5].Offset[3] = 864,
.Ch[6].Gain[3] = 2983,
.Ch[6].Offset[3] = 273,
.Ch[7].Gain[3] = 3126,
.Ch[7].Offset[3] = -38
};
#elif defined(BOARD_18_04_ED_37_C6_BE)
{
.Ch[0].Gain[0] = 48,
.Ch[0].Offset[0] = 21,
.Ch[1].Gain[0] = 48,
.Ch[1].Offset[0] = 11,
.Ch[2].Gain[0] = 48,
.Ch[2].Offset[0] = 25,
.Ch[3].Gain[0] = 48,
.Ch[3].Offset[0] = 24,
.Ch[4].Gain[0] = 48,
.Ch[4].Offset[0] = 8,
.Ch[5].Gain[0] = 48,
.Ch[5].Offset[0] = 20,
.Ch[6].Gain[0] = 46,
.Ch[6].Offset[0] = 10,
.Ch[7].Gain[0] = 46,
.Ch[7].Offset[0] = 37,
.Ch[0].Gain[1] = 356,
.Ch[0].Offset[1] = -11,
.Ch[1].Gain[1] = 357,
.Ch[1].Offset[1] = -88,
.Ch[2].Gain[1] = 357,
.Ch[2].Offset[1] = 8,
.Ch[3].Gain[1] = 357,
.Ch[3].Offset[1] = 5,
.Ch[4].Gain[1] = 358,
.Ch[4].Offset[1] = -112,
.Ch[5].Gain[1] = 356,
.Ch[5].Offset[1] = -17,
.Ch[6].Gain[1] = 342,
.Ch[6].Offset[1] = -94,
.Ch[7].Gain[1] = 345,
.Ch[7].Offset[1] = 106,
.Ch[0].Gain[2] = 1518,
.Ch[0].Offset[2] = -146,
.Ch[1].Gain[2] = 1507,
.Ch[1].Offset[2] = -454,
.Ch[2].Gain[2] = 1504,
.Ch[2].Offset[2] = -50,
.Ch[3].Gain[2] = 1515,
.Ch[3].Offset[2] = -55,
.Ch[4].Gain[2] = 1500,
.Ch[4].Offset[2] = -575,
.Ch[5].Gain[2] = 1517,
.Ch[5].Offset[2] = -165,
.Ch[6].Gain[2] = 1431,
.Ch[6].Offset[2] = -480,
.Ch[7].Gain[2] = 1479,
.Ch[7].Offset[2] = 376,
.Ch[0].Gain[3] = 3186,
.Ch[0].Offset[3] = -338,
.Ch[1].Gain[3] = 2732,
.Ch[1].Offset[3] = -941,
.Ch[2].Gain[3] = 3115,
.Ch[2].Offset[3] = -125,
.Ch[3].Gain[3] = 3140,
.Ch[3].Offset[3] = -150,
.Ch[4].Gain[3] = 2359,
.Ch[4].Offset[3] = -1136,
.Ch[5].Gain[3] = 3175,
.Ch[5].Offset[3] = -397,
.Ch[6].Gain[3] = 2533,
.Ch[6].Offset[3] = -979,
.Ch[7].Gain[3] = 2889,
.Ch[7].Offset[3] = 741
};
#elif defined(BOARD_18_04_ED_37_C6_DF)
{
.Ch[0].Gain[0] = 50,
.Ch[0].Offset[0] = 17,
.Ch[1].Gain[0] = 50,
.Ch[1].Offset[0] = 24,
.Ch[2].Gain[0] = 49,
.Ch[2].Offset[0] = 47,
.Ch[3].Gain[0] = 50,
.Ch[3].Offset[0] = 33,
.Ch[4].Gain[0] = 50,
.Ch[4].Offset[0] = 27,
.Ch[5].Gain[0] = 12,
.Ch[5].Offset[0] = 48,
.Ch[6].Gain[0] = 48,
.Ch[6].Offset[0] = 21,
.Ch[7].Gain[0] = 48,
.Ch[7].Offset[0] = 28,
.Ch[0].Gain[1] = 371,
.Ch[0].Offset[1] = -70,
.Ch[1].Gain[1] = 371,
.Ch[1].Offset[1] = -24,
.Ch[2].Gain[1] = 370,
.Ch[2].Offset[1] = 143,
.Ch[3].Gain[1] = 372,
.Ch[3].Offset[1] = 37,
.Ch[4].Gain[1] = 374,
.Ch[4].Offset[1] = 2,
.Ch[5].Gain[1] = 90,
.Ch[5].Offset[1] = 150,
.Ch[6].Gain[1] = 355,
.Ch[6].Offset[1] = -41,
.Ch[7].Gain[1] = 353,
.Ch[7].Offset[1] = 4,
.Ch[0].Gain[2] = 3167,
.Ch[0].Offset[2] = 1231,
.Ch[1].Gain[2] = 1585,
.Ch[1].Offset[2] = -210,
.Ch[2].Gain[2] = 1566,
.Ch[2].Offset[2] = 520,
.Ch[3].Gain[2] = 1589,
.Ch[3].Offset[2] = 51,
.Ch[4].Gain[2] = 1592,
.Ch[4].Offset[2] = -96,
.Ch[5].Gain[2] = 391,
.Ch[5].Offset[2] = 552,
.Ch[6].Gain[2] = 1512,
.Ch[6].Offset[2] = -281,
.Ch[7].Gain[2] = 1544,
.Ch[7].Offset[2] = -80,
.Ch[0].Gain[3] = 3062,
.Ch[0].Offset[3] = -884,
.Ch[1].Gain[3] = 3340,
.Ch[1].Offset[3] = -474,
.Ch[2].Gain[3] = 2885,
.Ch[2].Offset[3] = 1009,
.Ch[3].Gain[3] = 3336,
.Ch[3].Offset[3] = 78,
.Ch[4].Gain[3] = 3372,
.Ch[4].Offset[3] = -229,
.Ch[5].Gain[3] = 745,
.Ch[5].Offset[3] = 1118,
.Ch[6].Gain[3] = 3103,
.Ch[6].Offset[3] = -634,
.Ch[7].Gain[3] = 3195,
.Ch[7].Offset[3] = -205
};
#elif defined(BOARD_18_04_ED_37_C7_6F)
{
.Ch[0].Gain[0] = 49,
.Ch[0].Offset[0] = -15,
.Ch[1].Gain[0] = 48,
.Ch[1].Offset[0] = -38,
.Ch[2].Gain[0] = 49,
.Ch[2].Offset[0] = -13,
.Ch[3].Gain[0] = 49,
.Ch[3].Offset[0] = -5,
.Ch[4].Gain[0] = 48,
.Ch[4].Offset[0] = -24,
.Ch[5].Gain[0] = 48,
.Ch[5].Offset[0] = -27,
.Ch[6].Gain[0] = 46,
.Ch[6].Offset[0] = -32,
.Ch[7].Gain[0] = 0,
.Ch[7].Offset[0] = -44,
.Ch[0].Gain[1] = 358,
.Ch[0].Offset[1] = -31,
.Ch[1].Gain[1] = 357,
.Ch[1].Offset[1] = -74,
.Ch[2].Gain[1] = 359,
.Ch[2].Offset[1] = 29,
.Ch[3].Gain[1] = 359,
.Ch[3].Offset[1] = 96,
.Ch[4].Gain[1] = 358,
.Ch[4].Offset[1] = -49,
.Ch[5].Gain[1] = 357,
.Ch[5].Offset[1] = -80,
.Ch[6].Gain[1] = 346,
.Ch[6].Offset[1] = -119,
.Ch[7].Gain[1] = 341,
.Ch[7].Offset[1] = -118,
.Ch[0].Gain[2] = 1517,
.Ch[0].Offset[2] = -73,
.Ch[1].Gain[2] = 1496,
.Ch[1].Offset[2] = -255,
.Ch[2].Gain[2] = 1500,
.Ch[2].Offset[2] = 177,
.Ch[3].Gain[2] = 1497,
.Ch[3].Offset[2] = 459,
.Ch[4].Gain[2] = 1496,
.Ch[4].Offset[2] = -151,
.Ch[5].Gain[2] = 1495,
.Ch[5].Offset[2] = -283,
.Ch[6].Gain[2] = 1438,
.Ch[6].Offset[2] = -436,
.Ch[7].Gain[2] = 0,
.Ch[7].Offset[2] = -24,
.Ch[0].Gain[3] = 3171,
.Ch[0].Offset[3] = -127,
.Ch[1].Gain[3] = 3054,
.Ch[1].Offset[3] = -501,
.Ch[2].Gain[3] = 3061,
.Ch[2].Offset[3] = 387,
.Ch[3].Gain[3] = 2702,
.Ch[3].Offset[3] = 920,
.Ch[4].Gain[3] = 3046,
.Ch[4].Offset[3] = -303,
.Ch[5].Gain[3] = 3035,
.Ch[5].Offset[3] = -551,
.Ch[6].Gain[3] = 2782,
.Ch[6].Offset[3] = -879,
.Ch[7].Gain[3] = 0,
.Ch[7].Offset[3] = -23
};
#elif defined(BOARD_00_81_F9_E4_8C_D0)
{
.Ch[0].Gain[0] = 49,
.Ch[0].Offset[0] = -52,
.Ch[1].Gain[0] = 49,
.Ch[1].Offset[0] = -40,
.Ch[2].Gain[0] = 49,
.Ch[2].Offset[0] = -23,
.Ch[3].Gain[0] = 49,
.Ch[3].Offset[0] = -32,
.Ch[4].Gain[0] = 13,
.Ch[4].Offset[0] = -21,
.Ch[5].Gain[0] = 49,
.Ch[5].Offset[0] = -14,
.Ch[6].Gain[0] = 47,
.Ch[6].Offset[0] = -45,
.Ch[7].Gain[0] = 47,
.Ch[7].Offset[0] = -47,
.Ch[0].Gain[1] = 363,
.Ch[0].Offset[1] = -174,
.Ch[1].Gain[1] = 363,
.Ch[1].Offset[1] = -90,
.Ch[2].Gain[1] = 363,
.Ch[2].Offset[1] = 43,
.Ch[3].Gain[1] = 364,
.Ch[3].Offset[1] = -39,
.Ch[4].Gain[1] = 95,
.Ch[4].Offset[1] = 61,
.Ch[5].Gain[1] = 363,
.Ch[5].Offset[1] = 109,
.Ch[6].Gain[1] = 349,
.Ch[6].Offset[1] = -122,
.Ch[7].Gain[1] = 352,
.Ch[7].Offset[1] = -132,
.Ch[0].Gain[2] = 1512,
.Ch[0].Offset[2] = -644,
.Ch[1].Gain[2] = 1519,
.Ch[1].Offset[2] = -412,
.Ch[2].Gain[2] = 1530,
.Ch[2].Offset[2] = 292,
.Ch[3].Gain[2] = 1520,
.Ch[3].Offset[2] = -58,
.Ch[4].Gain[2] = 399,
.Ch[4].Offset[2] = 367,
.Ch[5].Gain[2] = 1498,
.Ch[5].Offset[2] = 559,
.Ch[6].Gain[2] = 1491,
.Ch[6].Offset[2] = -403,
.Ch[7].Gain[2] = 1457,
.Ch[7].Offset[2] = -451,
.Ch[0].Gain[3] = 2194,
.Ch[0].Offset[3] = -1174,
.Ch[1].Gain[3] = 3091,
.Ch[1].Offset[3] = -536,
.Ch[2].Gain[3] = 3000,
.Ch[2].Offset[3] = 614,
.Ch[3].Gain[3] = 3130,
.Ch[3].Offset[3] = -90,
.Ch[4].Gain[3] = 784,
.Ch[4].Offset[3] = 791,
.Ch[5].Gain[3] = 2205,
.Ch[5].Offset[3] = 1071,
.Ch[6].Gain[3] = 2802,
.Ch[6].Offset[3] = -766,
.Ch[7].Gain[3] = 2731,
.Ch[7].Offset[3] = -856
};
#elif defined(BOARD_18_04_ED_37_C6_C7)
{
.Ch[0].Gain[0] = 48,
.Ch[0].Offset[0] = -21,
.Ch[1].Gain[0] = 48,
.Ch[1].Offset[0] = -21,
.Ch[2].Gain[0] = 48,
.Ch[2].Offset[0] = -20,
.Ch[3].Gain[0] = 48,
.Ch[3].Offset[0] = -40,
.Ch[4].Gain[0] = 48,
.Ch[4].Offset[0] = -37,
.Ch[5].Gain[0] = 48,
.Ch[5].Offset[0] = -45,
.Ch[6].Gain[0] = 46,
.Ch[6].Offset[0] = -62,
.Ch[7].Gain[0] = 46,
.Ch[7].Offset[0] = -37,
.Ch[0].Gain[1] = 360,
.Ch[0].Offset[1] = 41,
.Ch[1].Gain[1] = 360,
.Ch[1].Offset[1] = 45,
.Ch[2].Gain[1] = 361,
.Ch[2].Offset[1] = 55,
.Ch[3].Gain[1] = 361,
.Ch[3].Offset[1] = -99,
.Ch[4].Gain[1] = 362,
.Ch[4].Offset[1] = -64,
.Ch[5].Gain[1] = 358,
.Ch[5].Offset[1] = -144,
.Ch[6].Gain[1] = 346,
.Ch[6].Offset[1] = -261,
.Ch[7].Gain[1] = 341,
.Ch[7].Offset[1] = -81,
.Ch[0].Gain[2] = 1536,
.Ch[0].Offset[2] = 359,
.Ch[1].Gain[2] = 1535,
.Ch[1].Offset[2] = 293,
.Ch[2].Gain[2] = 1535,
.Ch[2].Offset[2] = 387,
.Ch[3].Gain[2] = 1539,
.Ch[3].Offset[2] = -317,
.Ch[4].Gain[2] = 1545,
.Ch[4].Offset[2] = -151,
.Ch[5].Gain[2] = 1512,
.Ch[5].Offset[2] = -515,
.Ch[6].Gain[2] = 1349,
.Ch[6].Offset[2] = -994,
.Ch[7].Gain[2] = 1457,
.Ch[7].Offset[2] = -245,
.Ch[0].Gain[3] = 3027,
.Ch[0].Offset[3] = 729,
.Ch[1].Gain[3] = 3125,
.Ch[1].Offset[3] = 650,
.Ch[2].Gain[3] = 3006,
.Ch[2].Offset[3] = 794,
.Ch[3].Gain[3] = 3159,
.Ch[3].Offset[3] = -621,
.Ch[4].Gain[3] = 3237,
.Ch[4].Offset[3] = -314,
.Ch[5].Gain[3] = 2751,
.Ch[5].Offset[3] = -993,
.Ch[6].Gain[3] = 992,
.Ch[6].Offset[3] = -1615,
.Ch[7].Gain[3] = 3141,
.Ch[7].Offset[3] = -490
};
// gain=1, offset = 0, if any channel has no calibration data
#else
{
.Ch[0].Gain[0] = 1,
.Ch[0].Offset[0] = 0,
.Ch[1].Gain[0] = 1,
.Ch[1].Offset[0] = 0,
.Ch[2].Gain[0] = 1,
.Ch[2].Offset[0] = 0,
.Ch[3].Gain[0] = 1,
.Ch[3].Offset[0] = 0,
.Ch[4].Gain[0] = 1,
.Ch[4].Offset[0] = 0,
.Ch[5].Gain[0] = 1,
.Ch[5].Offset[0] = 0,
.Ch[6].Gain[0] = 1,
.Ch[6].Offset[0] = 0,
.Ch[7].Gain[0] = 1,
.Ch[7].Offset[0] = 0,
.Ch[0].Gain[1] = 1,
.Ch[0].Offset[1] = 0,
.Ch[1].Gain[1] = 1,
.Ch[1].Offset[1] = 0,
.Ch[2].Gain[1] = 1,
.Ch[2].Offset[1] = 0,
.Ch[3].Gain[1] = 1,
.Ch[3].Offset[1] = 0,
.Ch[4].Gain[1] = 1,
.Ch[4].Offset[1] = 0,
.Ch[5].Gain[1] = 1,
.Ch[5].Offset[1] = 0,
.Ch[6].Gain[1] = 1,
.Ch[6].Offset[1] = 0,
.Ch[7].Gain[1] = 1,
.Ch[7].Offset[1] = 0,
.Ch[0].Gain[2] = 1,
.Ch[0].Offset[2] = 0,
.Ch[1].Gain[2] = 1,
.Ch[1].Offset[2] = 0,
.Ch[2].Gain[2] = 1,
.Ch[2].Offset[2] = 0,
.Ch[3].Gain[2] = 1,
.Ch[3].Offset[2] = 0,
.Ch[4].Gain[2] = 1,
.Ch[4].Offset[2] = 0,
.Ch[5].Gain[2] = 1,
.Ch[5].Offset[2] = 0,
.Ch[6].Gain[2] = 1,
.Ch[6].Offset[2] = 0,
.Ch[7].Gain[2] = 1,
.Ch[7].Offset[2] = 0,
.Ch[0].Gain[3] = 1,
.Ch[0].Offset[3] = 0,
.Ch[1].Gain[3] = 1,
.Ch[1].Offset[3] = 0,
.Ch[2].Gain[3] = 1,
.Ch[2].Offset[3] = 0,
.Ch[3].Gain[3] = 1,
.Ch[3].Offset[3] = 0,
.Ch[4].Gain[3] = 1,
.Ch[4].Offset[3] = 0,
.Ch[5].Gain[3] = 1,
.Ch[5].Offset[3] = 0,
.Ch[6].Gain[3] = 1,
.Ch[6].Offset[3] = 0,
.Ch[7].Gain[3] = 1,
.Ch[7].Offset[3] = 0
};
#endif
#endif
@@ -0,0 +1,90 @@
#ifndef NEU_CHECK_LSK
#define NEU_CHECK_LSK
#define LSK_CHECKING_ERROR 0
#define LSK_NO_ERROR 1
#define LSK_ERROR 2
#define CHECK_NUMBER 50
#define VALUE_OFFSET 512
static uint16_t CheckLSKBuf[CHECK_NUMBER] = {0};
static uint8_t CheckLSKBufIndex = 0;
/***************************************
* @fn static void headstage_uni_delay()
* @brief make some delay
***************************************/
static void headstage_uni_delay() {
for (uint16_t i = 0; i < 1023; i++)
;
}
static uint8_t CheckLSK(uint8_t* data_buf){
uint16_t Data = 0;
// check LSK data preamble ( 0b0110_0000_1 ) 58(01011000) 2c(00101100)
// sometimes we lose the first bit , it means we only receive
// 0110_0000_1010_1xxx_xxxx_xxxX_XXXX_XXXX and
// 1100_0001_0101_xxxx_xxxx_xxXX_XXXX_XXXX
if ( data_buf[0] == 0x60 && ((data_buf[1] & 0xF8) == 0xA8) ) {
headstage_led_spi_color_debug(0xE1, 0xFF, 0x00, 0xFF);
Data = ((data_buf[1] & 0x07) << 7) | ((data_buf[2] & 0xFE) >> 1);
}
else if ( data_buf[0] == 0xC1 && ((data_buf[1] & 0xF0) == 0x50) ) {
headstage_led_spi_color_debug(0xE1, 0xFF, 0x00, 0xFF);
Data = ((data_buf[1] & 0x0F) << 6) | ((data_buf[2] & 0xFC) >> 2);
}
else if ( data_buf[0] == 0x30 && ((data_buf[1] & 0xFC) == 0x54) ) {
headstage_led_spi_color_debug(0xE1, 0xFF, 0x00, 0xFF);
Data = ((data_buf[1] & 0x03) << 8) | ((data_buf[2] & 0xFF));
}
else{
return LSK_CHECKING_ERROR;
}
headstage_led_spi_color_debug(0x0F, 0xFF, 0x0F, 0x0F);
// uint8_t channel;
//
// if ((INSTRUCTION.enable_channel_number == 1) || (dat_buf[0] == 0xc1)) {
// channel = reverse_channel[INSTRUCTION.last_enable_channel];
// } else {
// uint8_t channel_pointer = (INSTRUCTION.channel_pointer + 1) % INSTRUCTION.last_enable_channel;
// channel = reverse_channel[INSTRUCTION.channel_mux[channel_pointer]];
// INSTRUCTION.channel_pointer = channel_pointer;
// }
CheckLSKBuf[CheckLSKBufIndex] = Data;
CheckLSKBufIndex ++;
if(CheckLSKBufIndex >= CHECK_NUMBER){
CheckLSKBufIndex = 0;
// check LSK work well or not
uint32_t avg = 0;
uint8_t avgNumber = 0;
// sum all value that abs value < 100 mv
for(int i=0 ; i<CHECK_NUMBER ; i++){
if(-100+VALUE_OFFSET < CheckLSKBuf[i] && CheckLSKBuf[i] < 100+VALUE_OFFSET){
avg = avg + CheckLSKBuf[i];
avgNumber ++;
}
}
avg = avg / avgNumber;
if(10+VALUE_OFFSET < avg && avg < 30+VALUE_OFFSET){
return LSK_ERROR;
}
else if(-10+VALUE_OFFSET < avg && avg < -30+VALUE_OFFSET){
return LSK_ERROR;
}
else{
return LSK_NO_ERROR;
}
}
return LSK_CHECKING_ERROR;
}
#endif
@@ -1,52 +0,0 @@
#ifndef NEU_CHECK_INSTRUCTION
#define NEU_CHECK_INSTRUCTION
#include "headstage_instruction.h"
#include "neu/headstage_spi.h"
#include "neu/headstage_reset.h"
static uint8_t check_ins(uint16_t trans_ins){
uint16_t recv_ins;
recv_ins = spi_rxbuf[1] << 8 | spi_rxbuf[2];
return (trans_ins == recv_ins);
}
static void check_register(uint8_t register_to_check, uint16_t instruction_to_fit, uint8_t next_state){
if(spi_state_counter < 6){
SPICallBack = CONTINUOUS_TRANS;
spi_txbuf[0] = register_to_check;
spi_txbuf[1] = register_to_check;
spi_txbuf[2] = register_to_check;
spi_state_counter ++;
headstage_spi_transaction(3);
}
else{
spi_state_counter = 0;
if(check_ins(instruction_to_fit)){
NEULIVE_STATE.state = next_state;
SPICallBack = ONE_SHOT_SPI;
}
else{
// resend instruction
SPI_close(headstage_spi_handle);
DBSReset();
// NEULIVE_STATE.state = NEU_WRITE_INSTRUCTION;
// NEULIVE_STATE.config_type = NEU_SET_STI_CUR;
// if(STI){
// INSTRUCTION.ins_opcode = T_ZE;
// }
// else{
// INSTRUCTION.ins_opcode = BIAS_ONE;
// }
NEULIVE_STATE.state = NEU_DATA_RATE_TEST;
SPICallBack = ONE_SHOT_SPI;
ReopenSPI();
}
headstage_spi_transaction(3);
}
}
#endif
@@ -1,96 +0,0 @@
#ifndef NEU_INSTRUCTION
#define NEU_INSTRUCTION
/** amounts of channel */
#define NEU_STI_CHANNEL_COUNTS 9 // channel 0~7 is current sti; channel 8 = voltage sti
#define NEU_REC_CHANNEL_COUNTS 16 /**< recording channel counts */
struct HEADSTAGE_PARAMETER_TABLE {
uint8_t current_sti_cycle[NEU_STI_CHANNEL_COUNTS]; /** stimulation times will be executed. */
// sti_tx[0~7] is current stimulate
// sti_tx[8] assign to voltage mode channel. */
uint16_t sti_t1[NEU_STI_CHANNEL_COUNTS]; /**< first stimulation pulse duration, it can't be 0. */
uint16_t sti_t2[NEU_STI_CHANNEL_COUNTS]; /**< interval between biphasic pulses. */
uint16_t sti_t3[NEU_STI_CHANNEL_COUNTS]; /**< second stimulation pulse duration. */
uint32_t sti_t4[NEU_STI_CHANNEL_COUNTS]; /**< discharge time per stimulation. */
uint16_t sti_t5[NEU_STI_CHANNEL_COUNTS]; /**< discharge time after final stimulation. */
bool sti_mode; /**< if true: continuous mode, else limited mode. */
bool sti_h_bridge; /**< if true: enable h bridge, else single ended. */
bool sti_ref; /**< if true: reference cell body to gnd, else single ended is used. */
uint16_t current_sti_polarity; /**<
* default : low side.
* define which channel is high side or low side.
*/
uint8_t voltage_sti_channel; /**<
* voltage_channel[7:4] represent pmos channel,
* voltage_channel[3:0] represent nmos channel
*/
uint8_t amplifier_gain; /**<
* parameter table to represent actual amplifier gain
* ----------
* | bit |mean|
* ----------
* |0b00 | 100|
* ----------
* |0b01 | 400|
* ----------
* |0b10 | 800|
* -----------
* |0b11 | 25 |
* -----------
*/
/**< these parameter define the bias voltage of amplifier. */
uint8_t vgrp;
uint8_t vgrn;
uint8_t vgr_int_old;
uint8_t vgr_intp;
uint8_t vgr_intn;
uint8_t ins_opcode; /**< check instruction opcode which is transmitted to DBS. */
uint8_t voltage_sti_amplitude; /**< voltage mode stimulation amplitude control. */
uint16_t arbitrary_index; /**< this index to keep address of arbitrary data we have already stored. */
uint16_t arbitrary_en; /**< if true: enable arbitrary mode stimulation. */
uint16_t recording_channel; /**< recording_channel[17] represent enabling channel 17. */
uint16_t sti_amplitude_h; /**< positive side amplitude. */
uint16_t sti_amplitude_l; /**< negative side amplitude. */
uint16_t sys_clk_ratio; /**< frequency divider ratio for digital core clock. */
uint16_t adc_clock_ratio; /**< frequency divider ratio for adc clock. */
uint16_t sti_clock_ratio; /**< frequency divider ratio for stimulation clock. */
uint16_t chopper_ratio; /**< freqeuncy divider for chopper. */
uint16_t sti_channel; /**<
* if stimulation[7] == true, stimulation channel 7 is enabled .
* if stimulation[4] == true. stimulation channel 4 is enabled .
*/
uint8_t sti_ch_config_done; // number of stimulate channel which is config done
} INSTRUCTION = {0};
/**
* @brief:
* manage which operation to be conducted
*/
struct HEADSTAGE_STATE {
uint8_t state;
uint8_t config_type;
uint8_t index;
} NEULIVE_STATE = {0};
static bool STI = false;
static uint8_t spi_state_counter = 0;
static bool ConnectState = false;
static bool IsFirstData = true;
#endif
@@ -82,7 +82,6 @@ static uint16_t headstage_led_set_buffer(uint16_t *ins_buf, uint8_t repeat, LEDP
#define COLOR_BLUE 5
#define COLOR_CYAN 6
#define COLOR_MAGENTA 7
#define COLOR_PURPLE 8
#define COLOR_WHITE 9
// clang-format on
@@ -94,7 +93,7 @@ static uint8_t headstage_led_set_color(uint16_t *ins_buf, uint8_t repeat, uint8_
parameter = (LEDParameter){.luminance = 0xE1, .red = 0xFF, .green = 0x00, .blue = 0x00};
break;
case COLOR_ORANGE:
parameter = (LEDParameter){.luminance = 0xE1, .red = 0xFF, .green = 0x98, .blue = 0x00};
parameter = (LEDParameter){.luminance = 0xE1, .red = 0xFF, .green = 0x03, .blue = 0x00};
break;
case COLOR_YELLOW:
parameter = (LEDParameter){.luminance = 0xE1, .red = 0x0F, .green = 0x0F, .blue = 0x00};
@@ -114,9 +113,6 @@ static uint8_t headstage_led_set_color(uint16_t *ins_buf, uint8_t repeat, uint8_
case COLOR_WHITE:
parameter = (LEDParameter){.luminance = 0xE1, .red = 0x0F, .green = 0x7F, .blue = 0x1F};
break;
case COLOR_PURPLE:
parameter = (LEDParameter){.luminance = 0xE1, .red = 0x98, .green = 0x33, .blue = 0xFA};
break;
default:
case COLOR_BLACK:
parameter = (LEDParameter){.luminance = 0x00, .red = 0x00, .green = 0x00, .blue = 0x00};
@@ -196,7 +192,7 @@ static void headstage_led_color(uint8_t color) {
==== LED implement (GPIO) ====
============================*/
#ifdef HEADSTAGE_UNI_H
#if defined (HEADSTAGE_UNI_H) || defined(HEADSTAGE_TEST_DATA_H)
#define HEADSTAGE_LED_USE_GPIO
#endif
@@ -226,6 +222,13 @@ static void headstage_led_spi_color(uint8_t color) {
headstage_led_spi_transmit();
}
static void headstage_led_spi_color_debug(uint8_t brightness, uint8_t red, uint8_t green, uint8_t blue) {
LEDParameter parameter;
parameter = (LEDParameter){.luminance = brightness, .red = red, .green = green, .blue = blue};
headstage_led_set_buffer(headstage_spi_led_txbuf, SPI_LED_REPEAT, &parameter);
headstage_led_spi_transmit();
}
#endif // HEADSTAGE_LED_USE_GPIO
#endif // HEADSTAGE_LED_H
@@ -44,61 +44,31 @@ static uint8_t headstage_notify_buffer[BLE_NOT_BUFF_SIZE] = {0};
*
*/
static void headstage_notify_send() {
//#ifdef HEADSTAGE_NOTIFY_USE_ATT
// uint16_t buffer_size = BLE_NOT_BUFF_SIZE;
// uint8_t *value = (uint8 *)GATT_bm_alloc(CONNECT_HANDLE, ATT_HANDLE_VALUE_NOTI, GATT_MAX_MTU, &buffer_size);
//
// if (value != NULL) {
// memcpy(value, headstage_notify_buffer, buffer_size);
//
// attHandleValueNoti_t notify = {
// // clang-format off
// .handle = 0x1E,
// .len = buffer_size,
// .pValue = value
// // clang-format on
// };
//
// if (GATT_Notification(CONNECT_HANDLE, &notify, 0) != SUCCESS) {
// // notify not send
// GATT_bm_free((gattMsg_t *)&notify, ATT_HANDLE_VALUE_NOTI);
// }
// }
//
//#else
SimpleProfile_SetParameter(BLE_NOT_BUFF_CHAR, BLE_NOT_BUFF_SIZE, headstage_notify_buffer);
#ifdef HEADSTAGE_NOTIFY_USE_ATT
uint16_t buffer_size = BLE_NOT_BUFF_SIZE;
uint8_t *value = (uint8 *)GATT_bm_alloc(CONNECT_HANDLE, ATT_HANDLE_VALUE_NOTI, GATT_MAX_MTU, &buffer_size);
//#endif
}
if (value != NULL) {
memcpy(value, headstage_notify_buffer, buffer_size);
/*
// | | 1 | 2 | 3 |
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
// -----------------------------------------------------------------
// | header | length = N |
// | timestamp |
// | time delta |
// | data [0] | data[1] |
// | ............................ | data[15] |
*/
static void FlushNotify(){
// headstage_notify_buffer[0] = INSTRUCTION.chip_id;
headstage_notify_buffer[0] = CHIP_ID;
headstage_notify_buffer[1] = 1; // data length = 1 when flushing notify
attHandleValueNoti_t notify = {
// clang-format off
.handle = 0x1E,
.len = buffer_size,
.pValue = value
// clang-format on
};
for (int i = 2; i < BLE_NOT_BUFF_SIZE ; i++) {
headstage_notify_buffer[i] = 0;
if (GATT_Notification(CONNECT_HANDLE, &notify, 0) != SUCCESS) {
// notify not send
GATT_bm_free((gattMsg_t *)&notify, ATT_HANDLE_VALUE_NOTI);
}
}
// 1 Timestamp = 32 usec; 31 Timestamp ~= 1 msec
uint32_t flush_time_stamp = 0; // msec
headstage_notify_buffer[2] = flush_time_stamp & 0xFF;
headstage_notify_buffer[3] = (flush_time_stamp >> 8) & 0xFF;
headstage_notify_buffer[4] = (flush_time_stamp >> 16) & 0xFF;
headstage_notify_buffer[5] = (flush_time_stamp >> 24) & 0xFF;
#else
SimpleProfile_SetParameter(BLE_NOT_BUFF_CHAR, BLE_NOT_BUFF_SIZE, headstage_notify_buffer);
#endif
}
#endif // HEADSTAGE_NOTIFY_H
@@ -4,6 +4,6 @@
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#define headstage_power_shutdown() Power_shutdown(NULL, 0)
#define headstage_power_shutdown() Power_shutdown(0, 0)
#endif // HEADSTAGE_POWER_H
@@ -123,9 +123,7 @@
#include "uni/headstage_spi.h"
#include "uni/headstage_pwm.h"
#include "uni/uni1.3_parameter.h"
#include "neulive13_CalibrationTable.h"
#include "headstage_calibration_CIS.h"
#include "headstage_version.h"
#include "headstage_checkLSK.h"
/************************************
* instruction building macro
@@ -291,6 +289,8 @@
#define RIS_UMC_TRIG 0xC0 /**< control box to cc2650 instruction opcode, trigger stimulation */
#define RIS_DEBUG 0xE0 /* largest value of RIS, (RIS = ins[1] & 0xE0) */
/***********************
* stimulation waveform
***********************/
@@ -305,8 +305,8 @@
/*******************************
* reserved virtual instruction
*******************************/
#define VIS_BLE_T 0b10100000
#define VIS_SHIFT_T 0b01010000
#define VIS_BLE_T 0xA0
#define VIS_SHIFT_T 0x50
/// all the categories of instruction we can change .
@@ -507,14 +507,10 @@ struct HEADSTAGE_PARAMETER_TABLE {
bool amp_rst;
} INSTRUCTION = {0};
/***************************************
* @fn static void headstage_uni_delay()
* @brief make some delay
***************************************/
static void headstage_uni_delay() {
for (uint16_t i = 0; i < 1023; i++)
;
}
static uint8_t build_umn_ins_config(uint8_t config_type, uint32_t* value);
static uint8_t StartSync = 0;
static uint8_t SingleCh = 0;
static void rearrange_channel_mux_table() {
uint8_t enable_channel_number = 0;
@@ -537,6 +533,7 @@ static void rearrange_channel_mux_table() {
if (enable_channel_number == 1) {
INSTRUCTION.channel_mux[0] = last_enable_channel;
SingleCh = 1;
return;
}
@@ -550,6 +547,7 @@ static void rearrange_channel_mux_table() {
int8_t i = next_enable_channel - 1;
while (i >= 0) {
// find largest enable ch number
if (INSTRUCTION.channel_table[i]) {
next_enable_channel = i;
break;
@@ -589,8 +587,13 @@ static void rearrange_channel_mux_table() {
#define UMC_STATE_LIMITED 0x08
#define UMC_STATE_TRIGGER 0x09
#define UMC_STATE_WAIT_TRIGGER 0x0A
#define UMC_STATE_PAUSE 0x0B
#define UMC_STATE_RESTART 0x0C
#define UMC_STATE_INTERRUPT 0x0D
#define UMC_STATE_CHECK_LSK 0x0E
#define UMC_STATE_REC_STI 0x0F
#define UPDATE_DONE 0xFF
#define DEBUG 0xEE
// clang-format on
/*******************
@@ -601,9 +604,9 @@ struct {
uint8_t state;
uint8_t config_type;
uint8_t trigger_times;
uint8_t reset_flag;
} UMC_STATE = {0};
@@ -672,14 +675,16 @@ static void headstage_spi_lsk_callback(SPI_Handle handle, SPI_Transaction* trans
}
static void headstage_reset() {
headstage_led_spi_color(COLOR_GREEN);
memset(&INSTRUCTION, 0, sizeof(struct HEADSTAGE_PARAMETER_TABLE));
memset(spi_txbuf, 0, SPI_BUFFER_SIZE);
memset(spi_rxbuf, 0, SPI_BUFFER_SIZE);
memset(headstage_debug_buffer, 0, SPI_BUFFER_SIZE);
UMC_STATE.reset_flag = 1;
StartSync = 0;
headstage_spi_transaction_cancel(headstage_spi_lsk_handle);
headstage_pwm_stop(headstage_poly_r_pwm_handle);
headstage_pwm_stop(headstage_system_pwm_handle);
// headstage_pwm_stop(headstage_poly_r_pwm_handle);
// headstage_pwm_stop(headstage_system_pwm_handle);
headstage_pin_output(PIN_RESET, 0);
headstage_cpu_delay_ms(1);
headstage_pin_output(PIN_RESET, 1);
@@ -702,6 +707,8 @@ static void headstage_init() {
headstage_pin_output(PIN_STI_SEL, 1); // chip select is ok
headstage_pin_output(PIN_VGRP, 1);
headstage_pin_output(PIN_FASTSET, 0);
headstage_pwm_start(headstage_system_pwm_handle);
headstage_pwm_start(headstage_poly_r_pwm_handle);
}
static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t* instruction) {
@@ -732,8 +739,8 @@ static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t* instructi
uint8_t amp_gain = (instruction[0] & 0x1C) >> 2;
uint8_t pulse_width = ((instruction[0] & 0x03) << 2) | ((instruction[1] & 0xC0) >> 6);
uint8_t sti_times = (instruction[1] & 0x3F);
uint8_t sti_freq = (instruction[2] & 0x3F);
uint8_t mode = (instruction[2] & 0xC0) >> 6;
uint8_t sti_freq = (instruction[2] & 0x3F);
uint8_t cha = (instruction[3] & 0x0F);
uint8_t chb = (instruction[4] & 0xF0) >> 4;
uint8_t chc = (instruction[4] & 0x0F);
@@ -765,12 +772,25 @@ static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t* instructi
headstage_spi_ask_transaction(4);
break;
}
case RIS_DEBUG:{
headstage_state = DEBUG;
headstage_led_spi_color(COLOR_BLUE);
uint32_t value;
uint8_t new_config_type = build_umn_ins_config(CONFIG_DONE, &value);
tx_put_u32(0, value);
headstage_spi_ask_transaction(4);
break;
}
default:
break;
}
}
static uint8_t VIS_START = 0;
static void headstage_update_vis_instruction(uint8_t vis_oper) {
uint32_t value;
uint8_t new_config_type;
switch (vis_oper) {
// reset
case VIS_RST:
@@ -780,6 +800,7 @@ static void headstage_update_vis_instruction(uint8_t vis_oper) {
break;
case VIS_STI:
if (headstage_state == UMC_STATE_INTERRUPT) {
// go back to configure state by DBS interrupt
headstage_state = UMC_STATE_INITIAL;
rearrange_channel_mux_table();
UMC_STATE.config_type = CONFIG_AMP_MUX;
@@ -789,20 +810,30 @@ static void headstage_update_vis_instruction(uint8_t vis_oper) {
} else {
headstage_state = UMC_STATE_HANDSHAKE;
rearrange_channel_mux_table();
headstage_pwm_start(headstage_system_pwm_handle);
headstage_pwm_start(headstage_poly_r_pwm_handle);
UMC_STATE.config_type = CONFIG_AMP_MUX;
UMC_STATE.reset_flag = 0;
headstage_led_spi_color(COLOR_BLUE);
flag_notify(EVT_UMC_LSK);
}
VIS_START = 0;
break;
// interrupt
case VIS_INT:
headstage_reset();
headstage_state = UMC_STATE_HANDSHAKE;
VIS_START = 0;
break;
case VIS_PAU:
// go back to configure state by DBS interrupt
headstage_state = UMC_STATE_PAUSE;
// rearrange_channel_mux_table();
UMC_STATE.config_type = CONFIG_AMP_MUX;
tx_put_u32(0, build_configure_instruction(UMC_IRQ, UMC_IRQ_CODE));
headstage_spi_ask_transaction(4);
break;
case VIS_BLE_T:
@@ -812,9 +843,44 @@ static void headstage_update_vis_instruction(uint8_t vis_oper) {
break;
case VIS_SHIFT_T:
// headstage_led_spi_color(COLOR_BLUE);
// uint32_t value;
// uint8_t new_config_type = build_umn_ins_config(CONFIG_DONE, &value);
// tx_put_u32(0, value);
// headstage_spi_ask_transaction(4);
break;
case VIS_FUH:
// send config done to DBS
headstage_state = UMC_STATE_WAIT_START;
new_config_type = build_umn_ins_config(CONFIG_DONE, &value);
tx_put_u32(0, value);
headstage_spi_ask_transaction(4);
break;
case VIS_HANDSHAKE_TO_CONFIG:
VIS_START = 1;
headstage_state = UMC_STATE_HANDSHAKE;
rearrange_channel_mux_table();
UMC_STATE.config_type = CONFIG_AMP_MUX;
UMC_STATE.reset_flag = 0;
headstage_led_spi_color(COLOR_BLUE);
flag_notify(EVT_UMC_LSK);
break;
case VIS_CONFIG:
// choose recording channel
headstage_state = DEBUG;
UMC_STATE.config_type = CONFIG_AMP_MUX;
UMC_STATE.config_type = build_umn_ins_config(CONFIG_AMP_MUX, &value);
tx_put_u32(0, value);
headstage_spi_ask_transaction(4);
break;
case VIS_CONFIG2:
// set gain and other amp parameter
headstage_state = UMC_STATE_CONFIGURE;
UMC_STATE.config_type = build_umn_ins_config(UMC_STATE.config_type, &value);
tx_put_u32(0, value);
headstage_spi_ask_transaction(4);
break;
default:
break;
}
@@ -855,13 +921,9 @@ static void headstage_update_cis_instruction(uint8_t cis_oper) {
break;
}
#endif
case CIS_VERSION:{
cdr_buf[0] = VERSION_DATE_YEAR;
cdr_buf[1] = VERSION_DATE_MONTH;
cdr_buf[2] = VERSION_DATE_DAY;
cdr_buf[3] = VERSION_DATE_HOUR;
cdr_buf[4] = VERSION_DATE_MINUTE;
case CIS_CALI:{
cdr_buf[0] = 87;
cdr_buf[1] = 187;
SimpleProfile_SetParameter(BLE_CDR_BUFF_CHAR, BLE_CDR_BUFF_SIZE, cdr_buf);
break;
}
@@ -889,40 +951,60 @@ static uint8_t headstage_debug_instruction(uint8_t* ins_buf) {
// todo: check data length extension with this function -> this function should be
static void headstage_uni_umc_data_append_notify_buffer(uint8_t* dat_buf) {
// check LSK data preamble ( 0b01100_0001 ) 58(01011000) 2c(00101100)
// check LSK data preamble ( 0b0110_0000_1 ) 58(01011000) 2c(00101100)
// sometimes we lose the first bit , it means we only receive
// 0110_0000_1010_1xxx_xxxx_xxxX_XXXX_XXXX and
// 1100_0001_0101_xxxx_xxxx_xxXX_XXXX_XXXX
if (((dat_buf[0] & 0xC1) != 0xC1) && (dat_buf[0] != 0x00)) {
headstage_led_spi_color(COLOR_CYAN);
headstage_uni_delay();
} else {
if ((dat_buf[1] & 0x28) == 0x28) {
// headstage_led_spi_color(COLOR_YELLOW);
dat_buf[0] = (dat_buf[0] << 1) | ((dat_buf[1] >> 7) & 0x01);
dat_buf[1] = (dat_buf[1] << 1) | ((dat_buf[2] >> 7) & 0x01);
dat_buf[2] = (dat_buf[2] << 1) | ((dat_buf[3] >> 7) & 0x01);
// if (((dat_buf[0] & 0xC1) != 0xC1) && (dat_buf[0] != 0x00)) {
//// headstage_led_spi_color(COLOR_CYAN);
// headstage_uni_delay();
// } else
// dat_buf[0] = (dat_buf[0] << 1) | ((dat_buf[1] >> 7) & 0x01);
// dat_buf[2] = ((dat_buf[1] & 0b00000111) << 2) | (dat_buf[2] & 0b11100000);
// dat_buf[1] = (dat_buf[1] >> 3) & 0b00001111;
if(!StartSync){
// headstage_led_spi_color(COLOR_RED);
if(SingleCh){
if((dat_buf[1] & 0b01111000) == 0b00101000){
StartSync = 1;
}
}
// multi channel should read preamble to allocate every channel
else{
if((dat_buf[0] & 0xFF) == 0x60 && (dat_buf[1] & 0xF8) == 0xA8){
StartSync = 1;
}
}
}
if(StartSync){
// check header, which is also a sync for single channel
dat_buf[0] = (dat_buf[0] << 1) | ((dat_buf[1] >> 7) & 0x01);
dat_buf[1] = (dat_buf[1] << 1) | ((dat_buf[2] >> 7) & 0x01);
dat_buf[2] = (dat_buf[2] << 1) | ((dat_buf[3] >> 7) & 0x01);
uint8_t channel;
if ((INSTRUCTION.enable_channel_number == 1) || (dat_buf[0] == 0xc1)) {
if ((INSTRUCTION.enable_channel_number == 1)) {
channel = reverse_channel[INSTRUCTION.last_enable_channel];
} else {
uint8_t channel_pointer = (INSTRUCTION.channel_pointer + 1) % INSTRUCTION.last_enable_channel;
channel = reverse_channel[INSTRUCTION.channel_mux[channel_pointer]];
INSTRUCTION.channel_pointer = channel_pointer;
}
uint8_t data_size = headstage_notify_append_data(channel, dat_buf);
// SimpleProfile_SetParameter(BLE_NOT_BUFF_CHAR, BLE_NOT_BUFF_SIZE, headstage_notify_buffer);
uint8_t data_size = headstage_notify_append_data(channel, dat_buf, INSTRUCTION.amp_gain);
// headstage_notify_buffer[0] = CHIP_ID;
// headstage_notify_buffer[1] = 200;
// headstage_notify_send();
if (data_size >= BLE_NOT_BUFF_SIZE) {
headstage_notify_flip_buffer();
headstage_notify_send();
// headstage_led_spi_color(COLOR_YELLOW);
// headstage_led_spi_color(COLOR_CYAN);
}
}
else{
headstage_uni_delay();
}
// uint16_t data_value = (uint16_t)(((dat_buf[1] & 0x0F) << 6) | ((dat_buf[2] & 0xFC) >> 2));
headstage_spi_lsk_transaction(3);
}
@@ -945,7 +1027,8 @@ static uint8_t build_umn_ins_config(uint8_t config_type, uint32_t* value) {
case CONFIG_AMP_GAIN:
*value = build_configure_instruction(CONFIG_AMP_GAIN, amp_gain_table[INSTRUCTION.amp_gain]);
return CONFIG_STI_VOLT;
// return CONFIG_STI_VOLT;
return CONFIG_AMP_BAND;
case CONFIG_STI_VOLT:
*value = build_configure_instruction(CONFIG_STI_VOLT, INSTRUCTION.sti_volt);
@@ -953,7 +1036,8 @@ static uint8_t build_umn_ins_config(uint8_t config_type, uint32_t* value) {
case CONFIG_AMP_BAND:
*value = build_configure_instruction(CONFIG_AMP_BAND, amp_band_table[INSTRUCTION.amp_low_band_freq]);
return CONFIG_STI_PULSE_WIDTH;
// return CONFIG_STI_PULSE_WIDTH;
return CONFIG_ADC_RATE;
case CONFIG_STI_PULSE_WIDTH:
*value = build_configure_instruction(CONFIG_STI_PULSE_WIDTH, sti_pulse_width_table[INSTRUCTION.pulse_width]);
@@ -965,7 +1049,8 @@ static uint8_t build_umn_ins_config(uint8_t config_type, uint32_t* value) {
case CONFIG_ADC_RATE:
*value = build_configure_instruction(CONFIG_ADC_RATE, adc_clock_table[INSTRUCTION.frequency]);
return CONFIG_STI_CHANNEL_P;
// return CONFIG_STI_CHANNEL_P;
return CONFIG_DONE;
case CONFIG_STI_CHANNEL:
case CONFIG_STI_CHANNEL_P:
@@ -1037,6 +1122,8 @@ static void headstage_umc_state_transfer_ask() {
case UMC_STATE_WAIT_START:
headstage_spi_lsk_transaction(8);
break;
case UMC_STATE_CHECK_LSK:
case UMC_STATE_REC_STI:
case UMC_STATE_TRIGGER:
case UMC_STATE_CONTINUOUS:
case UMC_STATE_LIMITED:
@@ -1046,6 +1133,12 @@ static void headstage_umc_state_transfer_ask() {
headstage_state = UMC_STATE_TRIGGER;
headstage_spi_lsk_transaction(3);
break;
case UMC_STATE_PAUSE:
headstage_spi_lsk_transaction(8);
break;
case UMC_STATE_RESTART:
headstage_spi_lsk_transaction(8);
break;
default:
break;
}
@@ -1054,6 +1147,8 @@ static void headstage_umc_state_transfer_ask() {
/**
* @fn headstage_umc_state_transfer_lsk
*/
static uint8_t TestCounter = 0;
static uint8_t PassCheck = 0; // PassCheck=1 => DBS receive ASK, else ASK failed
static void headstage_umc_state_transfer_lsk() {
switch (headstage_state) {
case UMC_STATE_IDLE:
@@ -1063,8 +1158,10 @@ static void headstage_umc_state_transfer_lsk() {
case UMC_STATE_HANDSHAKE:
// if we receive handshake data , prepare handshake echo and call spi_tx transfer
if (umc_handshake_check(spi_rxbuf)) {
FlushSPIrx();
tx_put_u32(0, UMC_HAND_SHAKE_RECV);
headstage_state = UMC_STATE_HANDSHAKE_RECEIVE;
// headstage_state = DEBUG;
headstage_spi_ask_transaction(4); // transmit handshake echo
} else {
headstage_spi_lsk_transaction(2); // listen to LSK for handshake data again
@@ -1074,10 +1171,10 @@ static void headstage_umc_state_transfer_lsk() {
case UMC_STATE_HANDSHAKE_RECEIVE:
/**< if we success to receive handshake data */
if (umc_pass_check()) {
FlushSPIrx();
tx_put_u32(0, build_configure_instruction(UMC_CALIB_DONE, UMC_MODE_LSK_OUT));
headstage_state = UMC_STATE_INITIAL;
headstage_spi_ask_transaction(4);
} else {
headstage_spi_ask_transaction(4);
@@ -1086,12 +1183,17 @@ static void headstage_umc_state_transfer_lsk() {
case UMC_STATE_INITIAL:
if (umc_pass_check()) {
FlushSPIrx();
TestCounter = 0;
headstage_state = UMC_STATE_CONFIGURE;
if(VIS_START){
headstage_state = DEBUG;
}
headstage_spi_ask_transaction(4);
} else {
headstage_spi_ask_transaction(4);
}
TestCounter ++;
break;
case UMC_STATE_CONFIGURE:
@@ -1108,69 +1210,98 @@ static void headstage_umc_state_transfer_lsk() {
if (new_config_type == CONFIG_DONE) {
headstage_state = UMC_STATE_WAIT_START;
if(VIS_START){ headstage_state = DEBUG; }
} else {
headstage_state = UMC_STATE_CONFIGURE;
}
TestCounter = 0;
headstage_spi_ask_transaction(4);
}
} else {
headstage_spi_ask_transaction(4);
}
TestCounter ++;
break;
/**
* conservative instruction need golden key to trigger DBS
*/
// conservative instruction need golden key to trigger DBS
case UMC_STATE_WAIT_START:
if (headstage_debug_buffer[1] > 18) {
// this transaction make cause amplifier data right shift
switch (INSTRUCTION.mode) {
case 0:
// continuous mode
headstage_state = UMC_STATE_TRIGGER;
UMC_STATE.trigger_times = 0;
headstage_spi_lsk_transaction(3);
break;
case 1:
// trigger mode
headstage_state = UMC_STATE_TRIGGER;
UMC_STATE.trigger_times = 0;
headstage_spi_lsk_transaction(3);
break;
case 2:
// limited mode
headstage_state = UMC_STATE_LIMITED;
UMC_STATE.trigger_times = INSTRUCTION.sti_times;
headstage_spi_lsk_transaction(3);
break;
case 3:
// continuous mode
headstage_state = UMC_STATE_CONTINUOUS;
UMC_STATE.trigger_times = 0;
headstage_spi_lsk_transaction(3);
break;
default:
headstage_state = UMC_STATE_CONTINUOUS;
UMC_STATE.trigger_times = 0;
headstage_spi_lsk_transaction(3);
break;
}
// headstage_state = UMC_STATE_CHECK_LSK;
headstage_state = UMC_STATE_REC_STI;
headstage_spi_lsk_transaction(3);
} else if (headstage_debug_buffer[1] > 10) {
headstage_debug_buffer[1] += 1;
tx_put_u32(0, UMC_GOLDEN_KEY);
headstage_spi_ask_transaction(4);
} else {
headstage_debug_buffer[1] += 1;
headstage_debug_buffer[1] ++;
tx_put_u32(0, build_configure_instruction(CONFIG_DONE, 0xFF));
headstage_spi_ask_transaction(4);
}
break;
// check lsk, make sure DBS chip have no error
case UMC_STATE_CHECK_LSK:{
uint8_t NoError = 0;
NoError = CheckLSK(spi_rxbuf);
if(NoError == LSK_NO_ERROR){
headstage_state = UMC_STATE_REC_STI;
headstage_led_spi_color_debug(0xE1, 0x00, 0x00, 0xFF);
}
else if(NoError == LSK_CHECKING_ERROR){
headstage_state = UMC_STATE_CHECK_LSK;
headstage_led_spi_color(COLOR_GREEN);
}
else if(NoError == LSK_ERROR){
headstage_state = UMC_STATE_REC_STI;
headstage_led_spi_color_debug(0xE1, 0xF1, 0x00, 0x00);
}
else{
headstage_led_spi_color_debug(0xE1, 0xF1, 0xF1, 0xF1);
headstage_state = UMC_STATE_REC_STI;
}
headstage_spi_lsk_transaction(3);
break;
}
case UMC_STATE_REC_STI:
// this transaction make cause amplifier data right shift
switch (INSTRUCTION.mode) {
case 0:
// continuous mode
headstage_state = UMC_STATE_TRIGGER;
UMC_STATE.trigger_times = 0;
headstage_spi_lsk_transaction(3);
break;
case 1:
// trigger mode
headstage_state = UMC_STATE_TRIGGER;
UMC_STATE.trigger_times = 0;
headstage_spi_lsk_transaction(3);
break;
case 2:
// limited mode
headstage_state = UMC_STATE_LIMITED;
UMC_STATE.trigger_times = INSTRUCTION.sti_times;
headstage_spi_lsk_transaction(3);
break;
case 3:
// continuous mode
headstage_state = UMC_STATE_CONTINUOUS;
UMC_STATE.trigger_times = 0;
headstage_spi_lsk_transaction(3);
break;
default:
headstage_state = UMC_STATE_CONTINUOUS;
UMC_STATE.trigger_times = 0;
headstage_spi_lsk_transaction(3);
break;
}
break;
case UMC_STATE_TRIGGER:
// headstage_led_spi_color(COLOR_GREEN);
headstage_uni_umc_data_append_notify_buffer(spi_rxbuf);
break;
@@ -1192,6 +1323,30 @@ static void headstage_umc_state_transfer_lsk() {
break;
case UMC_STATE_INTERRUPT:
break;
case DEBUG:
UMC_STATE.reset_flag = 1;
break;
case UMC_STATE_PAUSE:
if (umc_pass_check()) {
headstage_led_spi_color(COLOR_RED);
// headstage_state = UMC_STATE_RESTART;
}
else {
headstage_spi_ask_transaction(4);
}
break;
case UMC_STATE_RESTART:
// if (umc_pass_check()) {
// headstage_led_spi_color(COLOR_YELLOW);
INSTRUCTION.mode = 0;
headstage_state = UMC_STATE_WAIT_START;
headstage_spi_ask_transaction(4);
// } else {
// headstage_spi_ask_transaction(4);
// }
break;
default:
break;
}
@@ -1,16 +0,0 @@
#ifndef VERSION_DATE
#define VERSION_DATE
#define VERSION_DATE_YEAR 20
#define VERSION_DATE_MONTH 4
#define VERSION_DATE_DAY 24
#define VERSION_DATE_HOUR 11
#define VERSION_DATE_MINUTE 53
// this is NOT the version hash !!
// it's the last version hash
#define VERSION_HASH 404d8d8d9d0b04eb9ed6fcc656ba52180d13d8c8
#define VERSION_GIT_BRANCH neulive20_blastData
#endif
@@ -1,23 +0,0 @@
#ifndef CHECK_MOSI
#define CHECK_MOSI
#include "headstage_led.h"
/*
* MOSI channel meet with INSTRUCTION.recording_channel ?
*/
static uint8_t CheckMOSI(uint8_t* MOSI){
uint8_t ch = MOSI[0];
uint16_t selectCh = 0x0001 << ch;
if(selectCh & INSTRUCTION.recording_channel){
return 1;
}
else{
// headstage_led_color(COLOR_RED);
// headstage_led_color(COLOR_GREEN);
return 0;
}
}
#endif
@@ -10,27 +10,20 @@
#define NOT_BUF_OFFSET_INIT 8
static uint8_t not_buf_offset = NOT_BUF_OFFSET_INIT;
static uint32_t not_buf_offset = NOT_BUF_OFFSET_INIT;
static uint32_t not_time_stamp = 0;
static uint32_t data_counter = 0;
static void headstage_notify_set_timestamp() {
not_time_stamp = headstage_time_stamp_us();
// headstage_notify_buffer[2] = not_time_stamp & 0xFF;
// headstage_notify_buffer[3] = (not_time_stamp >> 8) & 0xFF;
// headstage_notify_buffer[4] = (not_time_stamp >> 16) & 0xFF;
// headstage_notify_buffer[5] = (not_time_stamp >> 24) & 0xFF;
headstage_notify_buffer[5] = data_counter & 0xFF;
headstage_notify_buffer[4] = (data_counter >> 8) & 0xFF;
headstage_notify_buffer[3] = (data_counter >> 16) & 0xFF;
headstage_notify_buffer[2] = (data_counter >> 24) & 0xFF;
data_counter ++;
headstage_notify_buffer[2] = not_time_stamp & 0xFF;
headstage_notify_buffer[3] = (not_time_stamp >> 8) & 0xFF;
headstage_notify_buffer[4] = (not_time_stamp >> 16) & 0xFF;
headstage_notify_buffer[5] = (not_time_stamp >> 24) & 0xFF;
}
static void headstage_notify_flip_buffer() {
uint8_t data_count = (not_buf_offset - NOT_BUF_OFFSET_INIT) / 3;
uint8_t data_count = (not_buf_offset - NOT_BUF_OFFSET_INIT) / 2;
headstage_notify_buffer[0] = CHIP_ID;
headstage_notify_buffer[1] = data_count;
@@ -46,15 +39,13 @@ static uint8_t headstage_notify_append_data(uint8_t *data_value) {
if (data_value == NULL) {
headstage_notify_buffer[not_buf_offset++] = 0x00;
headstage_notify_buffer[not_buf_offset++] = 0x00;
headstage_notify_buffer[not_buf_offset++] = 0x00;
headstage_notify_buffer[not_buf_offset++] = 0x03;
} else {
headstage_notify_buffer[not_buf_offset++] = data_value[0];
headstage_notify_buffer[not_buf_offset++] = data_value[1];
headstage_notify_buffer[not_buf_offset++] = data_value[2];
}
if (not_buf_offset >= BLE_NOT_BUFF_SIZE - 1) {
if (not_buf_offset == BLE_NOT_BUFF_SIZE) {
uint32_t current = headstage_time_stamp_us();
uint32_t time_delta = ((current - not_time_stamp)) & 0xFFFF;
@@ -25,19 +25,19 @@
// clang-format off
#define PIN_LED_SDI IOID_0 // SPI1 to receive LSK
#define PIN_LED_CLK IOID_1 // SPI1 clock
#define PIN_RESET IOID_0 // SPI1 to receive LSK
#define PIN_EN_ADC_SPI_CLK IOID_1 // SPI1 clock
#define PIN_DC_DC IOID_2 // STI select need
#define PIN_EN_ADC_SPI_CLK IOID_3 //
#define PIN_BATT_HALF IOID_4 //
#define PIN_SPI_MISO IOID_7 //
#define PIN_SPI_MOSI IOID_8 //
#define PIN_SPI_CS IOID_9 //
#define PIN_SPI_CLK IOID_10 //
#define PIN_SYS_CLK IOID_11 //
#define PIN_RESET IOID_12 //
#define PIN_AMP_VCK IOID_13 //
#define PIN_STI_CLK IOID_14 //
#define PIN_BATT_HALF IOID_3 //
#define PIN_AMP_VCK IOID_4 //
#define PIN_LED_SDI IOID_7 //
#define PIN_LED_CLK IOID_8 //
#define PIN_STI_CLK IOID_9 //
#define PIN_SPI_MISO IOID_10 //
#define PIN_SPI_MOSI IOID_11 //
#define PIN_SPI_CS IOID_12 //
#define PIN_SPI_CLK IOID_13 //
#define PIN_SYS_CLK IOID_14 //
// clang-format on
#endif
@@ -47,8 +47,7 @@
#define Board_SPI0_MISO PIN_SPI_MISO
#define Board_SPI0_MOSI PIN_SPI_MOSI
#define Board_SPI0_CLK PIN_SPI_CLK
//#define Board_SPI0_CSN PIN_SPI_CS
#define Board_SPI0_CSN PIN_UNASSIGNED
#define Board_SPI0_CSN PIN_SPI_CS
/*
* SPI1 interface work with LED
@@ -1,110 +0,0 @@
#ifndef NEU_2_RST
#define NEU_2_RST
#include "headstage_instruction.h"
#include "neu/headstage_spi.h"
static void ResetINSTRUCTION();
static void MCUReset(){
// Reset INSTRUCTION & NEULIVE_STATE
ResetINSTRUCTION();
// global variable reset
IsFirstData = true;
STI = false;
// SPI reset
SPI_close(headstage_spi_handle);
spi_state_counter = 0;
for(int i=0 ; i<SPI_BUFFER_SIZE ; i++ ){
spi_txbuf[i] = 0;
spi_rxbuf[i] = 0;
}
SPICallBack = ONE_SHOT_SPI;
ReopenSPI();
for(int i=0 ; i<SPI_LED_BUFF_SIZE ; i++){
headstage_spi_led_txbuf[i] = 0;
}
// CIS buffer reset
for(int i=0 ; i<BLE_CDR_BUFF_SIZE ; i++){
cdr_buf[i] = 0;
}
// Notify Buffer reset
for(int i=0 ; i<BLE_NOT_BUFF_SIZE ; i++){
headstage_notify_buffer[i] = 0;
}
not_buf_offset = NOT_BUF_OFFSET_INIT;
not_time_stamp = 0;
if(ConnectState){
headstage_led_color(COLOR_CYAN);
}
else{
headstage_led_color(COLOR_GREEN); // color green
}
// this flag is set by SimpleBLEPeripheral_processStateChangeEvt() in simple_peripheral.c
// ConnectState = false;
}
static void DBSReset(){
headstage_pin_output(PIN_RESET, 0);
headstage_cpu_delay_ms(10);
headstage_pin_output(PIN_DC_DC, 1);
headstage_pin_output(PIN_EN_ADC_SPI_CLK, 1);
headstage_pin_output(PIN_RESET, 1);
}
static void Neu2Reset(){
DBSReset();
MCUReset();
}
static void ResetINSTRUCTION(){
INSTRUCTION.vgrp = 16;
INSTRUCTION.vgrn = 16;
INSTRUCTION.vgr_intp = 16;
INSTRUCTION.vgr_intn = 16;
INSTRUCTION.vgr_int_old = 16;
INSTRUCTION.recording_channel = 0b0000000000000000;
INSTRUCTION.adc_clock_ratio = 100;
INSTRUCTION.sys_clk_ratio = 10;
INSTRUCTION.sti_clock_ratio = 10;
INSTRUCTION.amplifier_gain = 0;
INSTRUCTION.chopper_ratio = 2;
INSTRUCTION.sti_t1[1] = 1;
INSTRUCTION.sti_t2[1] = 0;
INSTRUCTION.sti_t3[1] = 0;
INSTRUCTION.sti_t4[1] = 0;
INSTRUCTION.sti_t5[1] = 0;
INSTRUCTION.sti_channel = 2;
INSTRUCTION.arbitrary_en = 0;
INSTRUCTION.arbitrary_index = 0;
INSTRUCTION.sti_h_bridge = 0;
INSTRUCTION.sti_mode = 0;
INSTRUCTION.sti_ref = 0;
INSTRUCTION.current_sti_polarity = 2;
INSTRUCTION.sti_amplitude_h = 0;
INSTRUCTION.sti_amplitude_l = 0;
INSTRUCTION.ins_opcode = BIAS_ONE;
INSTRUCTION.sti_ch_config_done = 0;
uint8_t voltage_sti_channel = 0;
uint8_t voltage_sti_amplitude = 0;
for(int i=0 ; i<NEU_STI_CHANNEL_COUNTS ; i++){
INSTRUCTION.current_sti_cycle[i] = 0;
}
NEULIVE_STATE.state = NEU_IDLE;
NEULIVE_STATE.config_type = 0;
NEULIVE_STATE.index = 0;
}
#endif
@@ -12,7 +12,7 @@
#include <ti/drivers/dma/UDMACC26XX.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#define SPI_BUFFER_SIZE 3
#define SPI_BUFFER_SIZE 20
static uint8_t spi_txbuf[SPI_BUFFER_SIZE] = {0};
static uint8_t spi_rxbuf[SPI_BUFFER_SIZE] = {0};
@@ -22,7 +22,6 @@ static SPI_Handle headstage_spi_handle = NULL;
static SPI_Transaction headstage_spi_transaction;
static void headstage_spi_callback(SPI_Handle handle, SPI_Transaction* transaction);
static bool OpenSPI = false;
// SPI parameters initialize
#define headstage_spi_open() \
@@ -39,14 +38,14 @@ static bool OpenSPI = false;
headstage_spi_handle = SPI_open(Board_SPI0, &spi_parameter); \
} while (0)
//#define headstage_spi_transaction(handle, length, tx, rx) \
// ({ \
// SPI_Transaction transaction = headstage_spi_transaction ; \
// transaction.count = (length); \
// transaction.txBuf = (tx); \
// transaction.rxBuf = (rx); \
// SPI_transfer(handle, &transaction); \
// })
#define headstage_spi_transaction(handle, length, tx, rx) \
({ \
SPI_Transaction transaction = headstage_spi_transaction ; \
transaction.count = (length); \
transaction.txBuf = (tx); \
transaction.rxBuf = (rx); \
SPI_transfer(handle, &transaction); \
})
#define headstage_spi_transaction(length) \
({ \
@@ -71,54 +70,4 @@ static bool OpenSPI = false;
} \
} while (0)
static void ReopenSPI(){
SPI_init();
SPI_Params spi_parameter;
SPI_Params_init(&spi_parameter);
spi_parameter.transferMode = SPI_MODE_CALLBACK;
spi_parameter.mode = SPI_SLAVE;
spi_parameter.bitRate = NEU_SPI_FREQ;
spi_parameter.dataSize = 8;
spi_parameter.frameFormat = SPI_POL0_PHA1;
spi_parameter.transferCallbackFxn = headstage_spi_callback;
headstage_spi_handle = SPI_open(Board_SPI0, &spi_parameter);
}
//static void WriteSPI(uint8_t length){
// if(OpenSPI){
// ReopenSPI();
// }
//
// for(int i=length ; i<SPI_BUFFER_SIZE ; i++){
// spi_rxbuf[i] = 0x00;
// }
//
// SPICallBack = FLUSH_BUFFER;
// headstage_spi_transaction.count = 3;
// headstage_spi_transaction.txBuf = spi_txbuf;
// headstage_spi_transaction.rxBuf = spi_rxbuf;
//
// SPI_transfer(headstage_spi_handle, &headstage_spi_transaction);
//}
//static void ReadSPI(){
// if(OpenSPI){
// ReopenSPI();
// }
//
// SPICallBack = READ_REG;
// headstage_spi_transaction.count = 3;
// headstage_spi_transaction.txBuf = spi_txbuf;
// headstage_spi_transaction.rxBuf = spi_rxbuf;
//
// SPI_transfer(headstage_spi_handle, &headstage_spi_transaction);
//}
static void AppendSPITX(uint8_t index, uint32_t value){
tx_put_u24(index, value);
for(int i=3 ; i<SPI_BUFFER_SIZE ; i++){
spi_txbuf[i] = 0;
}
}
#endif
#endif
@@ -0,0 +1,107 @@
#ifndef NEU_CALI_TABLE
#define NEU_CALI_TABLE
#define BOARD_NAME
typedef struct _SingleChannelCali{
uint16_t Gain[3];
int16_t Offset[3];
}SingleChannelCali;
struct _CaliTable{
SingleChannelCali Ch[12];
}CaliTable =
#ifdef BOARD_NAME
{
.Ch[0].Gain[0] = 23,
.Ch[0].Offset[0] = -3,
.Ch[0].Gain[1] = 106,
.Ch[0].Offset[1] = -13,
.Ch[0].Gain[2] = 233,
.Ch[0].Offset[2] = -27,
.Ch[1].Gain[0] = 23,
.Ch[1].Offset[0] = 1,
.Ch[1].Gain[1] = 109,
.Ch[1].Offset[1] = 6,
.Ch[1].Gain[2] = 241,
.Ch[1].Offset[2] = 16,
.Ch[2].Gain[0] = 24,
.Ch[2].Offset[0] = -14,
.Ch[2].Gain[1] = 112,
.Ch[2].Offset[1] = -60,
.Ch[2].Gain[2] = 241,
.Ch[2].Offset[2] = -131,
.Ch[3].Gain[0] = 23,
.Ch[3].Offset[0] = 16,
.Ch[3].Gain[1] = 110,
.Ch[3].Offset[1] =70,
.Ch[3].Gain[2] = 231,
.Ch[3].Offset[2] = 156,
.Ch[4].Gain[0] = 69,
.Ch[4].Offset[0] = 0,
.Ch[4].Gain[1] = 322,
.Ch[4].Offset[1] = 10,
.Ch[4].Gain[2] = 665,
.Ch[4].Offset[2] = 15,
.Ch[5].Gain[0] = 69,
.Ch[5].Offset[0] = 9,
.Ch[5].Gain[1] = 320,
.Ch[5].Offset[1] = 35,
.Ch[5].Gain[2] = 632,
.Ch[5].Offset[2] = 75,
.Ch[6].Gain[0] = 69,
.Ch[6].Offset[0] = 21,
.Ch[6].Gain[1] = 323,
.Ch[6].Offset[1] = 86,
.Ch[6].Gain[2] = 551,
.Ch[6].Offset[2] = 167,
.Ch[7].Gain[0] = 69,
.Ch[7].Offset[0] = -20,
.Ch[7].Gain[1] = 316,
.Ch[7].Offset[1] = -82,
.Ch[7].Gain[2] = 577,
.Ch[7].Offset[2] = -148,
.Ch[8].Gain[0] = 69,
.Ch[8].Offset[0] = 12,
.Ch[8].Gain[1] = 322,
.Ch[8].Offset[1] = 58,
.Ch[8].Gain[2] = 613,
.Ch[8].Offset[2] = 105,
.Ch[9].Gain[0] = 69,
.Ch[9].Offset[0] = -6,
.Ch[9].Gain[1] = 325,
.Ch[9].Offset[1] = -15,
.Ch[9].Gain[2] = 622,
.Ch[9].Offset[2] = -14,
.Ch[10].Gain[0] = 24,
.Ch[10].Offset[0] = -5,
.Ch[10].Gain[1] = 103,
.Ch[10].Offset[1] = -24,
.Ch[10].Gain[2] = 209,
.Ch[10].Offset[2] = -50,
.Ch[11].Gain[0] = 116,
.Ch[11].Offset[0] = 49,
.Ch[11].Gain[1] = 388,
.Ch[11].Offset[1] = 202,
.Ch[11].Gain[2] = 340,
.Ch[11].Offset[2] = 273
};
#endif
#else
{0};
#endif
@@ -8,9 +8,11 @@
#error "headstage/headstage_notify.h not included"
#endif
#include "headstage13_calibration.h"
#define NOT_BUF_OFFSET_INIT 8
static uint8_t not_buf_offset = NOT_BUF_OFFSET_INIT;
static uint32_t not_buf_offset = NOT_BUF_OFFSET_INIT;
static uint32_t not_time_stamp = 0;
static void headstage_notify_set_timestamp() {
@@ -31,7 +33,9 @@ static void headstage_notify_flip_buffer() {
not_buf_offset = NOT_BUF_OFFSET_INIT;
}
static uint8_t headstage_notify_append_data(uint8_t channel, uint8_t *data_value) {
static uint8_t headstage_notify_append_data(uint8_t channel, uint8_t *data_value, uint8_t gain) {
uint16_t data;
if (not_buf_offset <= NOT_BUF_OFFSET_INIT) {
headstage_notify_set_timestamp();
not_buf_offset = NOT_BUF_OFFSET_INIT;
@@ -41,8 +45,13 @@ static uint8_t headstage_notify_append_data(uint8_t channel, uint8_t *data_value
headstage_notify_buffer[not_buf_offset++] = ((channel & 0x0F) << 4);
headstage_notify_buffer[not_buf_offset++] = 0x03;
} else {
headstage_notify_buffer[not_buf_offset++] = ((channel & 0x0f) << 4) | (data_value[1] & 0x0f);
headstage_notify_buffer[not_buf_offset++] = data_value[2] & 0xFC;
// data = Calibration(data_value, channel, gain);
data = (data_value[1] & 0x0F) << 6 | (data_value[2] & 0xFC) >>2;
data = not_buf_offset;
// headstage_notify_buffer[not_buf_offset++] = ((channel & 0x0F) << 4) | (data_value[1] & 0x0F);
// headstage_notify_buffer[not_buf_offset++] = data_value[2] & 0xFC;
headstage_notify_buffer[not_buf_offset++] = ((channel & 0x0F) << 4) | (data & 0x03C0) >> 6;
headstage_notify_buffer[not_buf_offset++] = (data & 0x003F) << 2;
}
if (not_buf_offset == BLE_NOT_BUFF_SIZE) {
@@ -76,14 +76,14 @@
#endif
//static PIN_Config headstage_pin_configuration[] = { //
// PIN_STI_SEL | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
// PIN_RESET | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
// PIN_VGRP | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
// PIN_FASTSET | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
// PIN_LED_CLK | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
// PIN_LED_OUT | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
// //
// PIN_TERMINATE};
static PIN_Config headstage_pin_configuration[] = { //
PIN_STI_SEL | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
PIN_RESET | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
PIN_VGRP | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
PIN_FASTSET | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
PIN_LED_CLK | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
PIN_LED_OUT | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
//
PIN_TERMINATE};
#endif // HEADSTAGE_PIN_UNI_H
@@ -89,4 +89,12 @@ static void headstage_spi_lsk_callback(SPI_Handle handle, SPI_Transaction* trans
} \
} while (0)
static void FlushSPIrx(){
for(int i=0 ; i<SPI_BUFFER_SIZE ; i++){
spi_rxbuf[i] = 0;
}
}
#endif // HEADSTAGE_SPI_H
@@ -114,30 +114,21 @@
#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 6
// 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 320
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 6
#else //! FEATURE_OAD
// Minimum connection interval (units of 1.25ms, 8=10ms) if automatic
// parameter update request is enabled
//#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 80
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 8
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 80
// Maximum connection interval (units of 1.25ms, 8=10ms) if automatic
// parameter update request is enabled
//#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 80
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 16
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 80
#endif // FEATURE_OAD
//#define SBP_PERIODIC_EVT_PERIOD DEFAULT_DESIRED_MIN_CONN_INTERVAL*1.25 + 2
#define SBP_PERIODIC_EVT_PERIOD 8
// Slave latency to use if automatic parameter update request is enabled
#define DEFAULT_DESIRED_SLAVE_LATENCY 0
@@ -169,7 +160,6 @@
#define SBP_STATE_CHANGE_EVT 0x0001
#define SBP_CHAR_CHANGE_EVT 0x0002
#define SBP_CONN_EVT_END_EVT 0x0004
#define SBP_PERIODIC_EVT 0x0008
// clang-format on
/*********************************************************************
@@ -189,16 +179,12 @@ typedef struct {
* LOCAL VARIABLES
*/
// Entity ID globally used to check for source and/or destination of messages
static ICall_EntityID self;
// Semaphore globally used to post events to the application thread
ICall_Semaphore semaphore;
// Clock instances for internal periodic events.
static Clock_Struct periodicClock;
// Queue object used for app messages
static Queue_Struct application_message;
static Queue_Handle application_message_queue;
@@ -209,9 +195,6 @@ static Queue_Struct oad_queue;
static Queue_Handle oad_queue_handle;
#endif // FEATURE_OAD
// events flag for internal application events.
static uint16_t events;
// Task configuration
Task_Struct sbpTask;
Char sbpTaskStack[SBP_TASK_STACK_SIZE];
@@ -238,10 +221,6 @@ static void SimpleBLEPeripheral_freeAttRsp(uint8_t status);
static void SimpleBLEPeripheral_stateChangeCB(gaprole_States_t newState);
static void SimpleBLEPeripheral_enqueueMsg(uint8_t event, uint8_t state);
static void SimpleBLEPeripheral_performPeriodicTask(void);
static void SimpleBLEPeripheral_clockHandler(UArg arg);
#ifndef FEATURE_OAD_ONCHIP
static void SimpleBLEPeripheral_charValueChangeCB(uint8_t paramID);
#endif //! FEATURE_OAD_ONCHIP
@@ -336,11 +315,8 @@ static void SimpleBLEPeripheral_init(void) {
// Create an RTOS queue for message from profile to be sent to app.
application_message_queue = Util_constructQueue(&application_message);
// Util_constructClock(&periodicClock, SimpleBLEPeripheral_clockHandler, SBP_PERIODIC_EVT_PERIOD, 0, false, SBP_PERIODIC_EVT);
// Util_constructClock(&periodicClock, SimpleBLEPeripheral_clockHandler, 100, 0, false, SBP_PERIODIC_EVT);
// Setup the GAP
GAP_SetParamValue(TGAP_CONN_PAUSE_PERIPHERAL, DEFAULT_CONN_PAUSE_PERIPHERAL);
GAP_SetParamValue(TGAP_GAP_SetParamValueCONN_PAUSE_PERIPHERAL, DEFAULT_CONN_PAUSE_PERIPHERAL);
// Setup the GAP Peripheral Role Profile
{
@@ -431,9 +407,7 @@ static void SimpleBLEPeripheral_init(void) {
// Register for GATT local events and ATT Responses pending for transmission
GATT_RegisterForMsgs(self);
HCI_LE_WriteSuggestedDefaultDataLenCmd(251, 2120); // this is used for data length extension
//
HCI_LE_ReadMaxDataLenCmd();
headstage_led_spi_color(COLOR_GREEN);
}
@@ -525,7 +499,7 @@ static void headstage_init_device_info() {
break;
}
uint8_t scanRspData[64];
uint8_t scanRspData[120];
uint8_t *p = scanRspData;
*p++ = sizeof(DEVICE_NAME);
*p++ = GAP_ADTYPE_LOCAL_NAME_COMPLETE;
@@ -533,7 +507,7 @@ static void headstage_init_device_info() {
for (unsigned int i = 0; i < sizeof(DEVICE_NAME) - 1; i++) {
*p++ = DEVICE_NAME[i];
}
*p++ = 16;
*p++ = 15;
*p++ = GAP_ADTYPE_MANUFACTURER_SPECIFIC;
// unsafe_memcpy(p, "BPHS", 4);
*p++ = 'B';
@@ -549,9 +523,7 @@ static void headstage_init_device_info() {
*p++ = 'B';
*p++ = 'A';
*p++ = 'T';
*p++ = headstage_battery_volt1();
*p++ = headstage_battery_volt2();
*p++ = headstage_battery_percent();
GGS_SetParameter(GGS_DEVICE_NAME_ATT, sizeof(DEVICE_NAME), DEVICE_NAME);
@@ -627,15 +599,6 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
headstage_event_handle();
}
// if (events & SBP_PERIODIC_EVT) {
// events &= ~SBP_PERIODIC_EVT;
//
// Util_startClock(&periodicClock);
//
// // Perform periodic application task
// SimpleBLEPeripheral_performPeriodicTask();
// }
#ifdef FEATURE_OAD
while (!Queue_empty(oad_queue_handle)) {
oadTargetWrite_t *oadWriteEvt = Queue_get(oad_queue_handle);
@@ -714,7 +677,6 @@ static uint8_t SimpleBLEPeripheral_processGATTMsg(gattMsgEvent_t *message) {
} else if (message->method == ATT_MTU_UPDATED_EVENT) {
// MTU size updated
} else if (message->method == ATT_HANDLE_VALUE_CFM) {
// quick pass
}
@@ -801,7 +763,6 @@ static void SimpleBLEPeripheral_processAppMsg(sbpEvt_t *message) {
break;
case SBP_CHAR_CHANGE_EVT:
// Util_startClock(&periodicClock);
headstage_characteristic_updated(message->hdr.state);
break;
}
@@ -862,15 +823,12 @@ 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
uint16_t requestedPDUSize = 251;
uint16_t requestTxTime = 2120; // (LL payload + 14) * 8
uint16_t requestTxTime = 2120;
GAPRole_GetParameter(GAPROLE_CONNHANDLE, &cxnHandle);
if (SUCCESS == HCI_LE_SetDataLenCmd(cxnHandle, requestedPDUSize, requestTxTime)) {
ConnectState = true;
// headstage_led_color(COLOR_CYAN);
headstage_led_spi_color(COLOR_CYAN);
}
// Use numActive to determine the connection handle of the last
// connection
@@ -885,20 +843,18 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)
case GAPROLE_WAITING:
// Device is started but not advertising, is in waiting period before advertising again
SimpleBLEPeripheral_freeAttRsp(bleNotConnected);
ConnectState = false;
headstage_led_color(COLOR_GREEN);
break;
case GAPROLE_WAITING_AFTER_TIMEOUT:
// Device just timed out from a connection but is not yet advertising, is in waiting period before advertising again
// disconnected
SimpleBLEPeripheral_freeAttRsp(bleNotConnected);
headstage_led_color(COLOR_RED);
headstage_led_spi_color(COLOR_RED); /** for neulive1.3 call headstage_led_spi_color ; for neulive2.0 call headstage_led_color */
CONNECT_HANDLE = 0xFFFF;
flag_notify(EVT_DISCONNECTED);
break;
case GAPROLE_ERROR: // Error occurred - invalid state
headstage_led_color(COLOR_RED);
headstage_led_spi_color(COLOR_RED);
break;
case GAPROLE_INIT: // Waiting to be started
case GAPROLE_ADVERTISING: // Currently Advertising
@@ -980,25 +936,3 @@ static void SimpleBLEPeripheral_enqueueMsg(uint8_t event, uint8_t state) {
Util_enqueueMsg(application_message_queue, semaphore, (uint8 *)message);
}
}
static void SimpleBLEPeripheral_performPeriodicTask(){
SimpleBLEPeripheral_blastData();
}
/*********************************************************************
* @fn SimpleBLEPeripheral_clockHandler
*
* @brief Handler function for clock timeouts.
*
* @param arg - event type
*
* @return None.
*/
static void SimpleBLEPeripheral_clockHandler(UArg arg) {
// Store the event.
events |= arg;
// Wake up the application.
Semaphore_post(semaphore);
}
@@ -1,289 +0,0 @@
/******************************************************************************
@file main.c
@brief main entry of the BLE stack sample application.
Group: WCS, BTS
Target Device: CC2650, CC2640
******************************************************************************
Copyright (c) 2013-2018, Texas Instruments Incorporated
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Texas Instruments Incorporated nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************
Release Name: ble_sdk_2_02_02_25
Release Date: 2018-04-02 18:03:35
*****************************************************************************/
/*******************************************************************************
* INCLUDES
*/
#include <xdc/runtime/Error.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include <ti/sysbios/BIOS.h>
#include "icall.h"
#include "hal_assert.h"
#include "central.h"
#include "simple_central.h"
/* Header files required to enable instruction fetch cache */
#include <inc/hw_memmap.h>
#include <driverlib/vims.h>
#ifndef USE_DEFAULT_USER_CFG
#include "ble_user_config.h"
// BLE user defined configuration
bleUserCfg_t user0Cfg = BLE_USER_CFG;
#endif // USE_DEFAULT_USER_CFG
#include <ti/mw/display/Display.h>
#ifdef USE_FPGA
#include <inc/hw_prcm.h>
#endif // USE_FPGA
/*******************************************************************************
* MACROS
*/
/*******************************************************************************
* CONSTANTS
*/
#if defined( USE_FPGA )
#define RFC_MODE_BLE PRCM_RFCMODESEL_CURR_MODE1
#define RFC_MODE_ANT PRCM_RFCMODESEL_CURR_MODE4
#define RFC_MODE_EVERYTHING_BUT_ANT PRCM_RFCMODESEL_CURR_MODE5
#define RFC_MODE_EVERYTHING PRCM_RFCMODESEL_CURR_MODE6
//
#define SET_RFC_BLE_MODE(mode) HWREG( PRCM_BASE + PRCM_O_RFCMODESEL ) = (mode)
#endif // USE_FPGA
/*******************************************************************************
* TYPEDEFS
*/
/*******************************************************************************
* LOCAL VARIABLES
*/
/*******************************************************************************
* GLOBAL VARIABLES
*/
/*******************************************************************************
* EXTERNS
*/
extern void AssertHandler(uint8 assertCause, uint8 assertSubcause);
extern Display_Handle dispHandle;
/*******************************************************************************
* @fn Main
*
* @brief Application Main
*
* input parameters
*
* @param None.
*
* output parameters
*
* @param None.
*
* @return None.
*/
int main()
{
#if defined( USE_FPGA )
HWREG(PRCM_BASE + PRCM_O_PDCTL0) &= ~PRCM_PDCTL0_RFC_ON;
HWREG(PRCM_BASE + PRCM_O_PDCTL1) &= ~PRCM_PDCTL1_RFC_ON;
#endif // USE_FPGA
/* Register Application callback to trap asserts raised in the Stack */
RegisterAssertCback(AssertHandler);
PIN_init(BoardGpioInitTable);
#if defined( USE_FPGA )
// set RFC mode to support BLE
// Note: This must be done before the RF Core is released from reset!
SET_RFC_BLE_MODE(RFC_MODE_BLE);
#endif // USE_FPGA
// Enable iCache prefetching
VIMSConfigure(VIMS_BASE, TRUE, TRUE);
// Enable cache
VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);
#if !defined( POWER_SAVING ) || defined( USE_FPGA )
/* Set constraints for Standby, powerdown and idle mode */
// PowerCC26XX_SB_DISALLOW may be redundant
Power_setConstraint(PowerCC26XX_SB_DISALLOW);
Power_setConstraint(PowerCC26XX_IDLE_PD_DISALLOW);
#endif // POWER_SAVING | USE_FPGA
/* Initialize ICall module */
ICall_init();
/* Start tasks of external images - Priority 5 */
ICall_createRemoteTasks();
/* Kick off profile - Priority 3 */
GAPCentralRole_createTask();
/* Kick off application - Priority 1 */
SimpleBLECentral_createTask();
/* enable interrupts and start SYS/BIOS */
BIOS_start();
return 0;
}
/*******************************************************************************
* @fn AssertHandler
*
* @brief This is the Application's callback handler for asserts raised
* in the stack. When EXT_HAL_ASSERT is defined in the Stack
* project this function will be called when an assert is raised,
* and can be used to observe or trap a violation from expected
* behavior.
*
* As an example, for Heap allocation failures the Stack will raise
* HAL_ASSERT_CAUSE_OUT_OF_MEMORY as the assertCause and
* HAL_ASSERT_SUBCAUSE_NONE as the assertSubcause. An application
* developer could trap any malloc failure on the stack by calling
* HAL_ASSERT_SPINLOCK under the matching case.
*
* An application developer is encouraged to extend this function
* for use by their own application. To do this, add hal_assert.c
* to your project workspace, the path to hal_assert.h (this can
* be found on the stack side). Asserts are raised by including
* hal_assert.h and using macro HAL_ASSERT(cause) to raise an
* assert with argument assertCause. the assertSubcause may be
* optionally set by macro HAL_ASSERT_SET_SUBCAUSE(subCause) prior
* to asserting the cause it describes. More information is
* available in hal_assert.h.
*
* input parameters
*
* @param assertCause - Assert cause as defined in hal_assert.h.
* @param assertSubcause - Optional assert subcause (see hal_assert.h).
*
* output parameters
*
* @param None.
*
* @return None.
*/
void AssertHandler(uint8 assertCause, uint8 assertSubcause)
{
// Open the display if the app has not already done so
if ( !dispHandle )
{
dispHandle = Display_open(Display_Type_LCD, NULL);
}
Display_print0(dispHandle, 0, 0, ">>>STACK ASSERT");
// check the assert cause
switch (assertCause)
{
case HAL_ASSERT_CAUSE_OUT_OF_MEMORY:
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> OUT OF MEMORY!");
break;
case HAL_ASSERT_CAUSE_INTERNAL_ERROR:
// check the subcause
if (assertSubcause == HAL_ASSERT_SUBCAUSE_FW_INERNAL_ERROR)
{
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> INTERNAL FW ERROR!");
}
else
{
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> INTERNAL ERROR!");
}
break;
case HAL_ASSERT_CAUSE_ICALL_ABORT:
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> ICALL ABORT!");
HAL_ASSERT_SPINLOCK;
break;
default:
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> DEFAULT SPINLOCK!");
HAL_ASSERT_SPINLOCK;
}
return;
}
/*******************************************************************************
* @fn smallErrorHook
*
* @brief Error handler to be hooked into TI-RTOS.
*
* input parameters
*
* @param eb - Pointer to Error Block.
*
* output parameters
*
* @param None.
*
* @return None.
*/
void smallErrorHook(Error_Block *eb)
{
for (;;);
}
/*******************************************************************************
*/
@@ -1,120 +0,0 @@
/******************************************************************************
@file main.c
@brief main entry of the BLE stack sample application.
Group: WCS, BTS
Target Device: CC2650, CC2640
******************************************************************************
Copyright (c) 2013-2018, Texas Instruments Incorporated
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Texas Instruments Incorporated nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************
Release Name: ble_sdk_2_02_02_25
Release Date: 2018-04-02 18:03:35
*****************************************************************************/
/*================
==== include ====
===============*/
// clang-format off
#include <xdc/runtime/Error.h>
#include <ti/drivers/PIN.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include <ti/sysbios/BIOS.h>
#include "icall.h"
#include "bcomdef.h"
#include "peripheral.h"
#include "simple_peripheral.h"
/* Header files required to enable instruction fetch cache */
#include <inc/hw_memmap.h>
#include <driverlib/vims.h>
// clang-format on
#ifndef USE_DEFAULT_USER_CFG
#include "ble_user_config.h"
// BLE user defined configuration
bleUserCfg_t user0Cfg = BLE_USER_CFG;
#endif // USE_DEFAULT_USER_CFG
extern const PIN_Config BoardGpioInitTable[];
/**
* @fn Main
*
* @brief Application Main
*
* input parameters
*
* @param None.
*
* output parameters
*
* @param None.
*
* @return None.
*/
int main() {
PIN_init(BoardGpioInitTable);
// Enable iCache prefetching
VIMSConfigure(VIMS_BASE, TRUE, TRUE);
// Enable cache
VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);
/* Initialize ICall module */
ICall_init();
/* Start tasks of external images - Priority 5 */
ICall_createRemoteTasks();
/* Kick off profile - Priority 3 */
GAPRole_createTask();
SimpleBLEPeripheral_createTask();
/* enable interrupts and start SYS/BIOS */
BIOS_start();
return 0;
}
@@ -85,7 +85,6 @@ extern "C" {
#define SIMPLEPROFILE_CHAR2_LEN 10
#define SIMPLEPROFILE_CHAR3_LEN 20
#define SIMPLEPROFILE_CHAR4_LEN 200
//#define SIMPLEPROFILE_CHAR4_LEN 20
#define SIMPLEPROFILE_CHAR5_LEN 20
/*********************************************************************