Compare commits
569 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c24db94db2 | |||
| ecfd6b23ec | |||
| ced7a357e5 | |||
| cf21efb331 | |||
| 08a758b77e | |||
| 50d0398d5a | |||
| 37c556bcd3 | |||
| ac14aa1e1e | |||
| 49f99fb9f6 | |||
| 3553e2c5e3 | |||
| d155fab875 | |||
| 464e80310e | |||
| 8b1ee78b63 | |||
| 30deffd0a3 | |||
| c9683added | |||
| 37f56b3acd | |||
| c30c735c9a | |||
| f1e1593a9a | |||
| 6f952b0600 | |||
| 427a1f8ee8 | |||
| 0a8c570027 | |||
| 6b32b71bfa | |||
| 98daa4a268 | |||
| 25b3caa8b5 | |||
| 7abe679d8a | |||
| ed0e856542 | |||
| cd630d4125 | |||
| 39f2847485 | |||
| 13418b6663 | |||
| 78b6fc9de2 | |||
| a27bc9523e | |||
| 65679c5974 | |||
| 8db68f9794 | |||
| 8c0d8255a7 | |||
| 010c89e862 | |||
| 0e27334394 | |||
| 8bb4484570 | |||
| eeefd47b44 | |||
| 04270b85b3 | |||
| f6c8e06776 | |||
| 9cb791976d | |||
| dba6cde440 | |||
| 312a961f94 | |||
| 97a344c349 | |||
| f84a4dab27 | |||
| 0afe5f764a | |||
| 2d40295688 | |||
| aeee554ac2 | |||
| ed8900c38d | |||
| 9cb1c1d1e7 | |||
| b843e05c39 | |||
| 4d7f3054b1 | |||
| f57397cb38 | |||
| 6159d35cb3 | |||
| 98a14c7ef8 | |||
| 89d7a7b012 | |||
| c7a5ead820 | |||
| 15fc8d8e42 | |||
| be19d969ad | |||
| bf38d2f4ea | |||
| 76de153299 | |||
| 1e919a7211 | |||
| c91d1ccf21 | |||
| a5dad54034 | |||
| c9783e48a1 | |||
| 1051ffd8fc | |||
| 162048a009 | |||
| 3f3107e7e0 | |||
| 839647c2a6 | |||
| 563ed5f724 | |||
| ef4eaa6b2d | |||
| f4df61ec6d | |||
| d760414837 | |||
| 21dfcc8c03 | |||
| db7c35c294 | |||
| 47c8303c9d | |||
| a9cd19727b | |||
| 3e067bc1c4 | |||
| d7fc95b90b | |||
| 883c7759b0 | |||
| be0fba2947 | |||
| f1c03ea972 | |||
| 837741d3e3 | |||
| 5157a83bbe | |||
| 2b2fc8f3ec | |||
| f552bdacab | |||
| 2679cdead2 | |||
| cfa25627bd | |||
| 88fd446fef | |||
| c5f084a93c | |||
| 0eb46585d8 | |||
| 8ff9884301 | |||
| 2054421b78 | |||
| 45131f3e8d | |||
| 61da4e107d | |||
| daff7d5929 | |||
| 4eaade4d8a | |||
| 54bcb0efe2 | |||
| e8d10e9e87 | |||
| ce3462b2b3 | |||
| 0c3af8b70e | |||
| 15cc5a4b82 | |||
| 7e2e7467bd | |||
| 339282d568 | |||
| 780d0afa6a | |||
| 02089810f2 | |||
| 18c35e27d0 | |||
| ce3b4f50a7 | |||
| 31c897c9dc | |||
| 8443648d48 | |||
| 2d877ea62d | |||
| 37df7d21e3 | |||
| 0e8707bbd1 | |||
| 479a4d6de1 | |||
| dffe29f80d | |||
| 31dff11f6e | |||
| 8f075f477b | |||
| c133fa74c3 | |||
| 7edcb7517a | |||
| 6cb1e18b7a | |||
| 980aba0010 | |||
| c6800f8f4f | |||
| 3ee0945114 | |||
| 09c47df3bb | |||
| 5b68f374e7 | |||
| 8d6e639c99 | |||
| 5616203743 | |||
| cbd103794c | |||
| a6c980cb0b | |||
| d812b3eea2 | |||
| 50a9034b38 | |||
| b799ef44cc | |||
| 5fc157e66d | |||
| 7234964ba1 | |||
| 5a472c1e5b | |||
| 9fc5858073 | |||
| f7570eda95 | |||
| 8e5369389f | |||
| 71c00ac6b3 | |||
| fa0d47c241 | |||
| 96d94f79b7 | |||
| bd96102ec2 | |||
| 79239bd4a7 | |||
| 02e72276aa | |||
| df3b074539 | |||
| 4bf451b64c | |||
| d06895e074 | |||
| e2672cf2b2 | |||
| 495fca7e90 | |||
| 3ef9f32df6 | |||
| 9ebe9c902f | |||
| 9ea1f6e40d | |||
| 2bc7184d4d | |||
| 27ffda9adf | |||
| 1f8b280b2c | |||
| a6950c2b74 | |||
| 5f3e5bbd6b | |||
| d379f0b5f7 | |||
| 9130c9edc2 | |||
| fb8fdd5d5b | |||
| 53305aaec5 | |||
| 51e8f8f4fa | |||
| 8c31d345fc | |||
| 3d00ed87c7 | |||
| aa8023d3a1 | |||
| 331fb14342 | |||
| 540a53e917 | |||
| c9d1efa1f7 | |||
| 5093fb354f | |||
| 209fd3239e | |||
| 2bf8a1781b | |||
| 520e0939f6 | |||
| 03cef16fd6 | |||
| e59a0b76bf | |||
| 247e5e50b7 | |||
| 495f1e3834 | |||
| d0061e7d5c | |||
| 8af6af1849 | |||
| 6f4d8818b5 | |||
| 75cd2faf91 | |||
| 12241635a3 | |||
| 18eba87064 | |||
| d313f48eaa | |||
| 117336020f | |||
| cf3172f99a | |||
| 8b32a6d2d1 | |||
| 3e7d3abed7 | |||
| 6ac29b48c2 | |||
| d0d83e6ae6 | |||
| 0e181aaa07 | |||
| a7b0b3965c | |||
| dbbb44e0d2 | |||
| 156927e8f9 | |||
| daab3bed0b | |||
| 7c6d7c68de | |||
| eff1e4a43e | |||
| 9678266e59 | |||
| 6f74dc2c05 | |||
| 910576ac6d | |||
| 9377dc517f | |||
| e44d3d8e60 | |||
| f5416d5e1f | |||
| 0d60074697 | |||
| 3c74358634 | |||
| 398f9977b8 | |||
| 89db7e4575 | |||
| 2b99b96f0f | |||
| 1b67c809a9 | |||
| 59aac611f6 | |||
| 6f5baf38ce | |||
| 05f8eb4c51 | |||
| 9bd536bb68 | |||
| 81d9aaab1f | |||
| 341c5939ac | |||
| c50c0b4dec | |||
| 1639eddc6d | |||
| cc50bbc0a4 | |||
| 913d269a32 | |||
| 5938d6645f | |||
| 3fda9fff6c | |||
| 6f6346ac45 | |||
| 4ca15b1ec9 | |||
| 4c0cdcbfe9 | |||
| ccb6939b34 | |||
| 27baa87562 | |||
| ea862012b8 | |||
| d8c0d5e420 | |||
| 43c606577a | |||
| 72a64479d4 | |||
| c6b45ecca4 | |||
| 11d828bfc7 | |||
| 79bca317c2 | |||
| ea254423d6 | |||
| f151d5a74d | |||
| 5cc2d878be | |||
| 18eeeec7cc | |||
| 81d753b5f0 | |||
| 0841d08972 | |||
| de5bb460fc | |||
| eb45ca6d81 | |||
| b0d2697c92 | |||
| 0dc0b66234 | |||
| 11da60ab8f | |||
| 41c7db8776 | |||
| 916a8f5dc7 | |||
| 25cc8b16fa | |||
| 67bf8b67dd | |||
| 13dfdbd502 | |||
| e0ae30d40d | |||
| 2c3a0a7ee8 | |||
| f1086df363 | |||
| 6345ee875a | |||
| 69061f9afd | |||
| 3aecb50b47 | |||
| e030578fd8 | |||
| c05fefe71c | |||
| 177b56e8f9 | |||
| aeb7a8afaf | |||
| 0edaa77857 | |||
| c656eebcbc | |||
| e17e78bc18 | |||
| c3235e985f | |||
| 656e0fb485 | |||
| d3dd5270dd | |||
| e588b30c8b | |||
| d3f9aec31c | |||
| ed617c88c9 | |||
| 0b8f4c2414 | |||
| b5449b7404 | |||
| a3c1241f38 | |||
| bbf60ebfed | |||
| 0e9f40bdd5 | |||
| e32897f6b5 | |||
| 6ee4b47d90 | |||
| dac19f62b2 | |||
| 8e6d112729 | |||
| 9e1dc1e3f4 | |||
| 49fb3afc01 | |||
| f3b402fce9 | |||
| ef9a38d7fc | |||
| 67275a7921 | |||
| 0ddaa02414 | |||
| 96d5735164 | |||
| ac32fb9c73 | |||
| 9acc242ff6 | |||
| d8a403c410 | |||
| f1d0acef23 | |||
| 9811572f47 | |||
| 8753e2ddc6 | |||
| f6167c25ca | |||
| cb3894712e | |||
| 995a47e200 | |||
| cde9096018 | |||
| 6c1bd24b92 | |||
| 0c129bc99b | |||
| cbe9bd8211 | |||
| 0293647d0c | |||
| 87d187c3a5 | |||
| 09fbfd9dda | |||
| 74ca631309 | |||
| 03e86e175d | |||
| 1c54525256 | |||
| d49874a666 | |||
| 6d6ba43d81 | |||
| 4914498732 | |||
| 85220734de | |||
| 7531a6638b | |||
| 4088a4d38b | |||
| 1b3d057d33 | |||
| 17e1846afa | |||
| 0407690197 | |||
| 55e8b37f13 | |||
| fb4c0a59e8 | |||
| ea3d146c86 | |||
| cddafdffff | |||
| 05e953d6e2 | |||
| 9b7e960bec | |||
| c3aa2f7178 | |||
| 5b4970d814 | |||
| 46c43afa26 | |||
| 6bcfc74d1a | |||
| 4d920209f7 | |||
| 52f8708905 | |||
| b7024363ee | |||
| 1a6d30606c | |||
| e72698dea3 | |||
| 3100dded42 | |||
| 53584f2b5b | |||
| b2d924228a | |||
| f3de02477d | |||
| 77a2bc2d8f | |||
| c56a07ead8 | |||
| 2e3ca56ece | |||
| b8588393b7 | |||
| ea33b37080 | |||
| ea7815dc64 | |||
| 2340b0e88c | |||
| d05d42415a | |||
| e34db21efd | |||
| f6a1a9fa4e | |||
| a567483ffa | |||
| 9dc0a0109a | |||
| afd9ac1223 | |||
| 30ff3a6d69 | |||
| 50781513dc | |||
| fab091d3ec | |||
| b734f2d44c | |||
| 576c6e5177 | |||
| 70a8640327 | |||
| 72d95dac61 | |||
| 84367ae2d3 | |||
| c06a9a996e | |||
| 699c6d1365 | |||
| cbad40dc5a | |||
| 53afd6dd2f | |||
| 5f12e4b10d | |||
| 28f6c39288 | |||
| ec7bd09b70 | |||
| dc6ac4cf19 | |||
| 15cde79313 | |||
| ac6767f082 | |||
| 4f7c2205b0 | |||
| f576158d38 | |||
| 47fc620923 | |||
| 897270dab4 | |||
| 3becd44444 | |||
| 4bfa35858d | |||
| d6068f8e5c | |||
| 2ea33f0269 | |||
| f9da0bbad4 | |||
| 46bd7e04cf | |||
| e3a04ad8e5 | |||
| 6cfde66c24 | |||
| f9f0aeaf87 | |||
| 1856096cf3 | |||
| eb1b4ddf30 | |||
| e960b0859a | |||
| bcebfaa777 | |||
| 5be3e2ec10 | |||
| 49f2f6b1ea | |||
| 9afe79edfb | |||
| fc67ea915e | |||
| 7b866d025a | |||
| 13864e766a | |||
| ee0ff789f3 | |||
| 7f6a871501 | |||
| d4681171b4 | |||
| 52139ec1b1 | |||
| 9b61eda6c2 | |||
| 142c8c38e1 | |||
| e1acbf5681 | |||
| 0bc5b8bfb8 | |||
| 3e8bbbeaf8 | |||
| 4c88d96928 | |||
| ffeb980a39 | |||
| b0ced97ffb | |||
| 1876714222 | |||
| 075e65604b | |||
| 7dbc090909 | |||
| c95e379cd1 | |||
| 9284cfacfc | |||
| dcced24976 | |||
| 286164a76d | |||
| 51d2e88978 | |||
| 29b73a88ae | |||
| 99f2e53b34 | |||
| 6d14af0e18 | |||
| 43282ac881 | |||
| 67a82d0cb1 | |||
| aec07f750b | |||
| 5c38dd785a | |||
| 46473fbae0 | |||
| cf876bfaf9 | |||
| 2fe991a23b | |||
| b9f8938c0e | |||
| 14129b8b3c | |||
| 502daf7204 | |||
| 3013e88dca | |||
| d37cf0f694 | |||
| 4cf062fb06 | |||
| 4a8e090ff1 | |||
| 576df09f24 | |||
| 3a01d5cc2c | |||
| 165c89e6aa | |||
| 9eaedfc0e5 | |||
| 5eba9eff3a | |||
| b985a09863 | |||
| 68aa82bbd8 | |||
| 6b1c0ca9aa | |||
| d176628edb | |||
| 8548712049 | |||
| bc819082cc | |||
| 64fb0fc78a | |||
| 0a4303dff0 | |||
| caa0bfaf8d | |||
| c6e300bfff | |||
| cf1d92d9ec | |||
| 25796a879d | |||
| f6e8385a8f | |||
| b52ea2fe1e | |||
| 2a6920a3d3 | |||
| fac1427eb6 | |||
| ed13172c92 | |||
| 07ebae4f64 | |||
| 1391ebd695 | |||
| 6cf988a54c | |||
| 76b74b53f9 | |||
| 786991d971 | |||
| c33b46521e | |||
| fc41b62329 | |||
| ab2eeb7f96 | |||
| bc3106fc26 | |||
| f2d404ed60 | |||
| 53038c0c84 | |||
| b835a0136b | |||
| e12102a8a7 | |||
| 728b9ae8bf | |||
| 9f5a6a09de | |||
| d26da674f5 | |||
| b781023863 | |||
| a42f6441fa | |||
| 2c4122bb77 | |||
| a05b81a7b4 | |||
| 2c8cc334e2 | |||
| 59786e995f | |||
| ebc1d29195 | |||
| 2d8d706141 | |||
| eb25a2e674 | |||
| 241ff38555 | |||
| 059bc76536 | |||
| 4678e304ee | |||
| db7d1e1141 | |||
| 218997b6b3 | |||
| f05c37d53e | |||
| 90767f36e5 | |||
| 81b1ff935a | |||
| 0f5f228707 | |||
| f0ea8bfcf5 | |||
| a2f0d62819 | |||
| e238d117a9 | |||
| 82dbe82bd1 | |||
| 8ba6180c8c | |||
| e2d5470b47 | |||
| 2532e703ae | |||
| 10497683c8 | |||
| 53932d4cb3 | |||
| 7b0f5ce687 | |||
| 653c2059e2 | |||
| 5c949be67c | |||
| c73ab1bbd4 | |||
| 083cbb0611 | |||
| f998c01010 | |||
| faf57cba6a | |||
| 83b70de310 | |||
| b4fb63f1e8 | |||
| 832fe1695f | |||
| d6b6b65e5f | |||
| 1698f0b544 | |||
| d10a6d16a8 | |||
| f864acfa26 | |||
| ba7703a772 | |||
| b7739ab42d | |||
| a6208f00d0 | |||
| c53a2d8872 | |||
| 9c69e16046 | |||
| cc57bc47a6 | |||
| b2b07ae05f | |||
| fec9ddcdf8 | |||
| 3eb17d14e6 | |||
| 8ca4eb3812 | |||
| 8341560686 | |||
| 39f39773b8 | |||
| a01c9b9dc0 | |||
| 124ca6ea84 | |||
| befb4f80e2 | |||
| 5a7980dca5 | |||
| 889a3d4147 | |||
| 0245adae4a | |||
| 8b94eaa6dd | |||
| 323dc2cf77 | |||
| e89cd406e4 | |||
| 8de29a213c | |||
| 571edc35aa | |||
| ee04ca568e | |||
| 67ef9adad1 | |||
| 4ec0bb12f7 | |||
| 5f5921e411 | |||
| da6a3f90f9 | |||
| 21135acf32 | |||
| b8e052de0d | |||
| cf33bcba2a | |||
| 45e7e2d5b7 | |||
| 04286e891d | |||
| 2e4720c607 | |||
| 5333cd9c98 | |||
| a116cbfa3e | |||
| bae6a4bce3 | |||
| bc10083c25 | |||
| 6f7cea2590 | |||
| f3c010ebf8 | |||
| ffbdd27df0 | |||
| 4f9fb2b8fb | |||
| f7d2b168d4 | |||
| 5a9a3754e7 | |||
| 97040855af | |||
| 77ee73a878 | |||
| cbd8f96f60 | |||
| 631396c50e | |||
| d25103373e | |||
| 8ddb66393d | |||
| f8d37fcf20 | |||
| a22253e384 | |||
| 116d4cfb76 | |||
| bd070a4ce8 | |||
| 5beb62613f | |||
| e27204bd50 | |||
| 34e9c644c5 | |||
| 74d2024731 | |||
| 7615f141ef | |||
| 38a45cdb1d | |||
| 9623751337 | |||
| dbf25c5712 | |||
| 7b2a51ee24 | |||
| bf57c10785 | |||
| 854e82a198 | |||
| 3107807268 | |||
| dff6c0a9e2 | |||
| 8480f60266 | |||
| 8808490caa |
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
#path=$(pwd)
|
||||
#folder=$($path | awk -F"/" '{$NF}')
|
||||
folder=$(basename "$(pwd)")
|
||||
|
||||
if [ "$folder" == "bioprocc2650" ]; then
|
||||
year=$(date +%-y)
|
||||
month=$(date +%-m)
|
||||
day=$(date +%-d)
|
||||
hour=$(date +%-H)
|
||||
minute=$(date +%-M)
|
||||
|
||||
hash=$(git rev-parse HEAD)
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
sed -i "5c #define VERSION_DATE_YEAR ${year}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
sed -i "6c #define VERSION_DATE_MONTH ${month}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
sed -i "7c #define VERSION_DATE_DAY ${day}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
sed -i "8c #define VERSION_DATE_HOUR ${hour}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
sed -i "9c #define VERSION_DATE_MINUTE ${minute}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
sed -i "13c #define VERSION_HASH ${hash}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
sed -i "14c #define VERSION_GIT_BRANCH ${branch}"\
|
||||
./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
|
||||
#cat ./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h
|
||||
fi
|
||||
+55
-55
@@ -18,8 +18,8 @@
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" errorParsers="org.eclipse.rtsc.xdctools.parsers.ErrorParser;com.ti.rtsc.XDCtools.parsers.ErrorParser;com.ti.ccstudio.errorparser.CoffErrorParser;com.ti.ccstudio.errorparser.LinkErrorParser;com.ti.ccstudio.errorparser.AsmErrorParser;org.eclipse.cdt.core.GmakeErrorParser" id="com.ti.ccstudio.buildDefinitions.TMS470.Default.67178137" name="FlashROM" parent="com.ti.ccstudio.buildDefinitions.TMS470.Default" postbuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out" prebuildStep="">
|
||||
<folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Default.67178137." name="/" resourcePath="">
|
||||
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain.1369151231" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.223507680">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.732777020" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
|
||||
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain.410623502" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1351821865">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1751124300" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex M.CC2650F128"/>
|
||||
<listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>
|
||||
<listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>
|
||||
@@ -34,17 +34,17 @@
|
||||
<listOptionValue builtIn="false" value="LINK_ORDER=TOOLS/ccs_linker_defines.cmd;TOOLS/cc26xx_app.cmd;"/>
|
||||
<listOptionValue builtIn="false" value="RTSC_MBS_VERSION=2.2.0"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.579299287" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="18.1.4.LTS" valueType="string"/>
|
||||
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug.2112816025" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug"/>
|
||||
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug.1418617668" name="GNU Make.FlashROM" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug"/>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.compilerDebug.1368914557" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.compilerDebug">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.872349905" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.7M3" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.1023813954" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.16" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.1674413144" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.eabi" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN.184317276" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.1068578615" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.1943600764" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH.644525479" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH" valueType="includePath">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.277675815" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="18.1.4.LTS" valueType="string"/>
|
||||
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug.1593934674" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug"/>
|
||||
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug.632414212" keepEnvironmentInBuildfile="false" name="GNU Make" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug"/>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.compilerDebug.154623462" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.compilerDebug">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.974280107" name="Target processor version (--silicon_version, -mv)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.7M3" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.1783826131" name="Designate code state, 16-bit (thumb) or 32-bit (--code_state)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.16" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.1536570599" name="Application binary interface. (--abi)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.eabi" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN.1895413316" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.322983319" name="Optimization level (--opt_level, -O)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.1305400753" name="Speed vs. size trade-offs (--opt_for_speed, -mf)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH.1468985930" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/>
|
||||
<listOptionValue builtIn="false" value="C:\ti\simplelink\ble_sdk_2_02_02_25\src\examples\simple_peripheral\cc26xx\app\headstage"/>
|
||||
<listOptionValue builtIn="false" value="${SRC_EX}/examples/simple_peripheral/cc26xx/app"/>
|
||||
@@ -70,7 +70,7 @@
|
||||
<listOptionValue builtIn="false" value="${SRC_BLE_CORE}/rom"/>
|
||||
<listOptionValue builtIn="false" value="${CC26XXWARE}"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.1330623088" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE" valueType="definedSymbols">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.1897088" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="BOARD_DISPLAY_EXCLUDE_UART"/>
|
||||
<listOptionValue builtIn="false" value="POWER_SAVING"/>
|
||||
<listOptionValue builtIn="false" value="BOOSTXL_CC2650MA"/>
|
||||
@@ -86,71 +86,71 @@
|
||||
<listOptionValue builtIn="false" value="xdc_runtime_Assert_DISABLE_ALL"/>
|
||||
<listOptionValue builtIn="false" value="xdc_runtime_Log_DISABLE_ALL"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL.1308360247" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.504235202" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.C99" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GCC.105967788" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GCC" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS.698913237" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS" valueType="stringList">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL.871011287" name="Debugging model" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.863089168" name="C Dialect" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.C99" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GCC.1454248503" name="Enable support for GCC extensions (DEPRECATED) (--gcc)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GCC" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS.1965115059" name="Suppress diagnostic <id> (--diag_suppress, -pds)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="48"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING.1399241416" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING" valueType="stringList">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING.1638011093" name="Treat diagnostic <id> as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="225"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.867926379" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER.980626282" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS.374992114" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS.on" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE.1890491357" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE" valueType="stringList">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.1920170652" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER.2038786257" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS.811478344" name="Place each function in a separate subsection (--gen_func_subsections, -ms)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.GEN_FUNC_SUBSECTIONS.on" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE.1229809338" name="Read options from specified file (--cmd_file, -@)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="${SRC_EX}/config/build_components.opt"/>
|
||||
<listOptionValue builtIn="false" value="${ORG_PROJ_DIR}/build_config.opt"/>
|
||||
<listOptionValue builtIn="false" value="${ORG_PROJ_DIR}/../../ccs/config/ccs_compiler_defines.bcfg"/>
|
||||
</option>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS.263445006" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS.1235873701" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS.207268648" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS.1068957263" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS.1540775079" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS.319000695" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS.270651019" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS.463094612" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS"/>
|
||||
</tool>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.223507680" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE.698430423" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE" value="256" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE.402182782" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE" value="0" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE.1628689699" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE" value=""${ProjName}.map"" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.2141951901" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY.679112687" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY" valueType="libs">
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1351821865" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE.174129193" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE" value="256" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE.567300083" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE" value="0" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE.1800982811" name="Link information (map) listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE" value=""${ProjName}.map"" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.1091211742" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY.1479599481" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="libc.a"/>
|
||||
<listOptionValue builtIn="false" value="${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib"/>
|
||||
<listOptionValue builtIn="false" value="${ROM}/common_rom_releases/03282014/common_rom.symbols"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH.650613345" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH" valueType="libPaths">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH.672837228" name="Add <dir> to library search path (--search_path, -i)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH" valueType="libPaths">
|
||||
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/lib"/>
|
||||
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS.782343525" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS" valueType="stringList">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS.544523272" name="Suppress diagnostic <id> (--diag_suppress)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="10247-D"/>
|
||||
<listOptionValue builtIn="false" value="16002-D"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.1555270082" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER.16105060" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO.1713299511" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO" value=""${ProjName}_linkInfo.xml"" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.68776981" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.on" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.1860389255" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.on" valueType="enumerated"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD_SRCS.152379533" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD2_SRCS.158095632" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD2_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__GEN_CMDS.978853236" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__GEN_CMDS"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.1281207998" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER.468817864" name="Emit diagnostic identifier numbers (--display_error_number)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO.1679096029" name="Detailed link information data-base into <file> (--xml_link_info, -xml_link_info)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO" value=""${ProjName}_linkInfo.xml"" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.254835397" name="Aggressively reduce size of the DWARF information (--compress_dwarf)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.on" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.1848192295" name="Eliminate sections not needed in the executable (--unused_section_elimination)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.on" valueType="enumerated"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD_SRCS.1999849945" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD2_SRCS.25027104" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD2_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__GEN_CMDS.888093741" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__GEN_CMDS"/>
|
||||
</tool>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.2015106526" name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.1270425102" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH" value="8" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH.16813235" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH" value="8" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.318851558" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.INTEL" valueType="enumerated"/>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.19288898" name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.11734737" name="Specify rom width (--romwidth, -romwidth=width)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH" value="8" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH.466140455" name="Specify memory width (--memwidth, -memwidth=width)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH" value="8" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.824070691" name="Output format" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.INTEL" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.927640565" name="XDCtools" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool">
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH.1908494509" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH" valueType="stringList">
|
||||
<tool id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.1392704063" name="XDCtools" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool">
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH.225737408" name="Package repositories (--xdcpath)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="${COM_TI_RTSC_TIRTOSCC13XX_CC26XX_REPOS}"/>
|
||||
<listOptionValue builtIn="false" value="${TARGET_CONTENT_BASE}"/>
|
||||
</option>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET.1746187707" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET" value="ti.targets.arm.elf.M3" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM.884959194" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM" value="ti.platforms.simplelink:CC2640F128" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW.943624305" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW" value="ti.platforms.simplelink:CC2640F128" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE.1521167272" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE" value="release" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR.1901654533" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR" value="${CG_TOOL_ROOT}" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.COMPILE_OPTIONS.138005453" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.COMPILE_OPTIONS" value=""${COMPILER_FLAGS}"" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET.571281110" name="Target (-t)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET" value="ti.targets.arm.elf.M3" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM.205178830" name="Platform (-p)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM" value="ti.platforms.simplelink:CC2640F128" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW.1097777495" name="Platform (-p)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW" value="ti.platforms.simplelink:CC2640F128" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE.744121344" name="Build-profile (-r)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE" value="release" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR.165807018" name="Compiler tools directory (-c)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR" value="${CG_TOOL_ROOT}" valueType="string"/>
|
||||
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.COMPILE_OPTIONS.391961861" name="Additional compiler options (--compileOptions)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.COMPILE_OPTIONS" value=""${COMPILER_FLAGS}"" valueType="string"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
|
||||
+4
@@ -3,16 +3,20 @@
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <PropertyValues> <property id="ConnectOnStartup"> <curValue>1</curValue> </property> <property id="EnableInstalledBreakpoint"> <curValue>1</curValue> </property> <property id="IgnoreSoftLaunchFailures"> <curValue>0</curValue> </property> </PropertyValues> "/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <PropertyValues> <property id="ConnectOnStartup"> <curValue>1</curValue> </property> <property id="EnableInstalledBreakpoint"> <curValue>1</curValue> </property> <property id="IgnoreSoftLaunchFailures"> <curValue>0</curValue> </property> </PropertyValues> "/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <PropertyValues> <property id="ConnectOnStartup"> <curValue>1</curValue> </property> <property id="EnableInstalledBreakpoint"> <curValue>1</curValue> </property> <property id="IgnoreSoftLaunchFailures"> <curValue>0</curValue> </property> </PropertyValues> "/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <PropertyValues> <property id="ConnectOnStartup"> <curValue>1</curValue> </property> <property id="EnableInstalledBreakpoint"> <curValue>1</curValue> </property> <property id="IgnoreSoftLaunchFailures"> <curValue>0</curValue> </property> </PropertyValues> "/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="${build_artifact:simple_peripheral_cc2650em_app}"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="${build_artifact:simple_peripheral_cc2650em_app}"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="${build_artifact:simple_peripheral_cc2650em_app}"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="${build_artifact:simple_peripheral_cc2650em_app}"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="simple_peripheral_cc2650em_app"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="simple_peripheral_cc2650em_app"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="simple_peripheral_cc2650em_app"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="simple_peripheral_cc2650em_app"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_TARGET_CONFIG" value="${target_config_active_default:simple_peripheral_cc2650em_app}"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="C:/ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\FlashROM\simple_peripheral_cc2650em_app.out"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="C:/ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\FlashROM\simple_peripheral_cc2650em_app.out"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="C:/ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\FlashROM\simple_peripheral_cc2650em_app.out"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\app\FlashROM\simple_peripheral_cc2650em_app.out"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/simple_peripheral_cc2650em_app"/>
|
||||
</listAttribute>
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+4
@@ -3,16 +3,20 @@
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <PropertyValues> <property id="ConnectOnStartup"> <curValue>1</curValue> </property> <property id="EnableInstalledBreakpoint"> <curValue>1</curValue> </property> <property id="IgnoreSoftLaunchFailures"> <curValue>0</curValue> </property> </PropertyValues> "/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <PropertyValues> <property id="ConnectOnStartup"> <curValue>1</curValue> </property> <property id="EnableInstalledBreakpoint"> <curValue>1</curValue> </property> <property id="IgnoreSoftLaunchFailures"> <curValue>0</curValue> </property> </PropertyValues> "/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <PropertyValues> <property id="ConnectOnStartup"> <curValue>1</curValue> </property> <property id="EnableInstalledBreakpoint"> <curValue>1</curValue> </property> <property id="IgnoreSoftLaunchFailures"> <curValue>0</curValue> </property> </PropertyValues> "/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <PropertyValues> <property id="ConnectOnStartup"> <curValue>1</curValue> </property> <property id="EnableInstalledBreakpoint"> <curValue>1</curValue> </property> <property id="IgnoreSoftLaunchFailures"> <curValue>0</curValue> </property> </PropertyValues> "/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="${build_artifact:simple_peripheral_cc2650em_stack}"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="${build_artifact:simple_peripheral_cc2650em_stack}"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="${build_artifact:simple_peripheral_cc2650em_stack}"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="${build_artifact:simple_peripheral_cc2650em_stack}"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="simple_peripheral_cc2650em_stack"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="simple_peripheral_cc2650em_stack"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="simple_peripheral_cc2650em_stack"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="simple_peripheral_cc2650em_stack"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_TARGET_CONFIG" value="${target_config_active_default:simple_peripheral_cc2650em_stack}"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="C:/ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\FlashROM\simple_peripheral_cc2650em_stack.out"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="C:/ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\FlashROM\simple_peripheral_cc2650em_stack.out"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="C:/ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\FlashROM\simple_peripheral_cc2650em_stack.out"/>
|
||||
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\FlashROM\simple_peripheral_cc2650em_stack.out"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/simple_peripheral_cc2650em_stack"/>
|
||||
</listAttribute>
|
||||
|
||||
+247
@@ -0,0 +1,247 @@
|
||||
|
||||
#ifndef AD5940
|
||||
#define AD5940
|
||||
|
||||
static void AD5940_init(){
|
||||
select_REG(0x0908);//initiation
|
||||
w16_REG(0x02C9);
|
||||
select_REG(0x0C08);
|
||||
w16_REG(0x206C);
|
||||
select_REG(0x21F0);
|
||||
w16_REG(0x0010);
|
||||
select_REG(0x0410);
|
||||
w16_REG(0x02C9);
|
||||
select_REG(0x0A28);
|
||||
w16_REG(0x0009);
|
||||
select_REG(0x238C);
|
||||
w16_REG(0x0104);
|
||||
select_REG(0x0A04);
|
||||
w16_REG(0x4859);
|
||||
select_REG(0x0A04);
|
||||
w16_REG(0xF27B);
|
||||
select_REG(0x0A00);
|
||||
w16_REG(0x8009);
|
||||
select_REG(0x0A04);
|
||||
w16_REG(0x4859);
|
||||
select_REG(0x22F0);
|
||||
w16_REG(0x0000);
|
||||
}
|
||||
|
||||
static void AD5940_sftreset(){
|
||||
select_REG(0x0424);
|
||||
w16_REG(0xA158);
|
||||
CPUdelay(200);
|
||||
}
|
||||
|
||||
static void AD5940_HWReset(){
|
||||
PIN_setOutputValue(pin_handle, AD_reset, 0);
|
||||
CPUdelay(2000); // 200us
|
||||
PIN_setOutputValue(pin_handle, AD_reset, 1);
|
||||
CPUdelay(5000); // 500us
|
||||
}
|
||||
|
||||
static void setEIS_EIS (void)
|
||||
{
|
||||
select_REG(LPDACCON0); //2128 //DC on
|
||||
w32_REG(0x00000001); //LPDAC enabled
|
||||
select_REG(LPDACSW0); //2124 //operation
|
||||
w32_REG(0b111111); //0b101011
|
||||
|
||||
select_REG(HSRTIACON);
|
||||
w32_REG(0x00000000); //200R //1pF
|
||||
|
||||
select_REG(ADCCON); //21A8
|
||||
w32_REG(0x00000101);
|
||||
select_REG(DFTCON);
|
||||
w32_REG(0x00000091);
|
||||
select_REG(SWCON); //200C
|
||||
w32_REG(0x00026355); //D5 | P5 | N3 | T6 | T9 0b010 0110 0011 0101 0101
|
||||
|
||||
if (instru.ADCGainLv != HSRTIA_GAIN_AUTO) {
|
||||
instru.AutoGainEnable = 0;
|
||||
HSTIAGainCtrl(instru.ADCGainLv);
|
||||
} else {
|
||||
instru.AutoGainEnable = 1;
|
||||
instru.ADCGainLv = HSRTIA_200R;
|
||||
HSTIAGainCtrl(instru.ADCGainLv);
|
||||
}
|
||||
|
||||
DAC_outputV(instru.dcbias + CaliTable.DAC_offset * 200);
|
||||
SetWGAmp(instru.acamp);
|
||||
|
||||
select_REG(0x2000); //2000
|
||||
w32_REG(0x0031CFC0);
|
||||
|
||||
//HIGH POWER MODE
|
||||
select_REG(0x22F0); //PWMB
|
||||
w32_REG(0x0000000D); //switch to active high power mode
|
||||
select_REG(0x0414);
|
||||
w16_REG(0x0000);
|
||||
select_REG(0x0420);
|
||||
w16_REG(0xA815);
|
||||
select_REG(0x0408); //16bit system clock divider
|
||||
w16_REG(0x0442); //set divider = 2
|
||||
select_REG(0x20BC); //HSOSCCON
|
||||
w32_REG(0x00000000); //switch to 32MHz output
|
||||
select_REG(0x2044);
|
||||
w32_REG(0x00000311);
|
||||
select_REG(0x2010); //HSDACCON
|
||||
w32_REG(0x0000000E); //DAC gain = 2, > 80 kHz
|
||||
select_REG(0x238C); //ADCBUFCON
|
||||
w32_REG(0x005F3D0F); //recommended
|
||||
SetEISHIGHZ(0);
|
||||
}
|
||||
|
||||
static void setEIS_CV (void)
|
||||
{
|
||||
//Clock and Ref
|
||||
select_REG(0x0414); //CLKSEL
|
||||
w16_REG(0x0);
|
||||
select_REG(0x20BC); //HSOSCCON
|
||||
w32_REG(0x00000004); //16 MHz output
|
||||
select_REG(0x2180); //BUFSENCON
|
||||
w32_REG(0x00000037); //0b110110
|
||||
|
||||
//Configure LPDAC LPTIA
|
||||
select_REG(0x2050); //LPREFBUFCON
|
||||
w32_REG(0x0); //enable lpref and lp 2.5V buffer
|
||||
select_REG(0x2124); //LPDACSW0
|
||||
w32_REG(0x0000003E);
|
||||
select_REG(0x20E4); //LPTIASW0
|
||||
w32_REG(0x00008034); // SW2 | SW4 | SW5
|
||||
select_REG(0x20EC); //LPTIACON0
|
||||
w32_REG(0x00000038); //RF 0 | RTIA 200R | Rload 0 | High Current Mode
|
||||
select_REG(0x2128); //LPDACCON0
|
||||
w32_REG(0x00000001);
|
||||
|
||||
//Configure ADC | ADCDAT (0x2074)
|
||||
select_REG(0x21A8); //ADCCON
|
||||
w32_REG(0x00001021); //PGA = 1 | VZERO | LPTIA_OUT
|
||||
select_REG(0x2044); //ADCFILTERCON
|
||||
w32_REG(0x00002011); // Sinc3 En | SINC3OSR2 | SINC2OSR22
|
||||
select_REG(0x20D0); //DFTCON
|
||||
w32_REG(0x00000001); // Sinc2 to DFT | DFTNUM4
|
||||
|
||||
//AFE and PWMB
|
||||
select_REG(0x2000); //AFECON
|
||||
w32_REG(0x00098780); //ADC on //0b10011000011110000000
|
||||
select_REG(0x22F0); //PWMB
|
||||
w32_REG(0x00000005);//fc 50kHz, low power mode
|
||||
|
||||
|
||||
// //Clock and Ref
|
||||
// select_REG(CLKSEL); //CLKSEL
|
||||
// w16_REG(0x0);
|
||||
// select_REG(HSOSCCON); //HSOSCCON
|
||||
// w32_REG(0x00000004); //16 MHz output
|
||||
// select_REG(0x2180); //BUFSENCON
|
||||
// w32_REG(0x00000037); //0b110110
|
||||
//
|
||||
// //Configure LPDAC LPTIA
|
||||
// select_REG(LPREFBUFCON); //LPREFBUFCON
|
||||
// w32_REG(0x0); //enable lpref and lp 2.5V buffer
|
||||
// select_REG(LPDACSW0); //LPDACSW0
|
||||
// w32_REG(0x0000003E);
|
||||
// select_REG(LPTIASW0); //LPTIASW0
|
||||
// w32_REG(0x00008034); // SW2 | SW4 | SW5
|
||||
// select_REG(LPTIACON0); //LPTIACON0
|
||||
// w32_REG(0x00000038); //RF 0 | RTIA 200R | Rload 0 | High Current Mode
|
||||
// select_REG(LPDACCON0); //LPDACCON0
|
||||
// w32_REG(0x00000001);
|
||||
//
|
||||
// //Configure ADC | ADCDAT (0x2074)
|
||||
// select_REG(ADCCON); //ADCCON
|
||||
// w32_REG(0x00001021); //PGA = 1 | VZERO | LPTIA_OUT
|
||||
// select_REG(ADCFILTERCON); //ADCFILTERCON
|
||||
// w32_REG(0x00014091); //AVR 4 | Sinc3 En | OSR 5
|
||||
//// w32_REG(0x00012011); //Disable avr | sinc3 enable | osr 2
|
||||
// select_REG(DFTCON); //DFTCON
|
||||
// w32_REG(0x00100031); //sinc3 + average input for DFT | DFTNUM 32
|
||||
//
|
||||
// //AFE and PMWB
|
||||
// select_REG(AFECON); //AFECON
|
||||
// w32_REG(0x00098780); //ADC on //0b10011000011110000000
|
||||
// select_REG(PMBW); //PMWB
|
||||
// w32_REG(0x00000005);//fc 50kHz, low power mode
|
||||
}
|
||||
|
||||
static void HS_cali_config (void)
|
||||
{
|
||||
select_REG(LPDACCON0); //2128 //DC on
|
||||
w32_REG(0x00000001); //LPDAC enabled
|
||||
select_REG(LPDACSW0); //2124 //operation
|
||||
w32_REG(0b111111); //0b101011
|
||||
|
||||
select_REG(DE0RESCON); //20F8 //DE0's gain
|
||||
w32_REG(0x000000FF);
|
||||
// select_REG(HSRTIACON);
|
||||
// w32_REG(0x00000200); //4pF + 200R
|
||||
|
||||
select_REG(ADCCON); //21A8
|
||||
w32_REG(0x00000101);
|
||||
select_REG(DFTCON); //20D0
|
||||
w32_REG(0x00000091);
|
||||
select_REG(SWCON); //200C
|
||||
w32_REG(0x00026355); //D5 | P5 | N3 | T6 | T9 0b010 0110 0011 0101 0101
|
||||
// w32_REG(0x00026905); //0b010 0110 1001 0000 0101
|
||||
|
||||
select_REG(AFECON); //2000
|
||||
w32_REG(0x0030CFC0);
|
||||
|
||||
//HIGH POWER MODE
|
||||
select_REG(PMBW); //PMWB
|
||||
w32_REG(0x0000000D); //switch to active high power mode
|
||||
select_REG(CLKSEL);
|
||||
w16_REG(0x0000);
|
||||
select_REG(CLKCON0KEY);
|
||||
w16_REG(0xA815);
|
||||
select_REG(CLKCON0); //16bit system clock divider
|
||||
w16_REG(0x0442); //set divider = 2
|
||||
select_REG(HSOSCCON); //HSOSCCON
|
||||
w32_REG(0x00000000); //switch to 32MHz output
|
||||
select_REG(ADCFILTERCON); //ADCFILTERCON
|
||||
w32_REG(0x000000D0); //ADC data rate = 1.6MHz // 2 samples to average
|
||||
select_REG(HSDACCON); //HSDACCON
|
||||
w32_REG(0x0000000E); //DAC gain = 2, > 80 kHz
|
||||
select_REG(ADCBUFCON); //ADCBUFCON
|
||||
w32_REG(0x005F3D0F); //recommended
|
||||
}
|
||||
static void LP_cali_config (void)
|
||||
{
|
||||
//Clock and Ref
|
||||
select_REG(0x0414); //CLKSEL
|
||||
w16_REG(0x0);
|
||||
select_REG(0x20BC); //HSOSCCON
|
||||
w32_REG(0x00000004); //16 MHz output
|
||||
select_REG(0x2180); //BUFSENCON
|
||||
w32_REG(0x00000037); //0b110110
|
||||
|
||||
//Configure LPDAC LPTIA
|
||||
select_REG(0x2050); //LPREFBUFCON
|
||||
w32_REG(0x0); //enable lpref and lp 2.5V buffer
|
||||
select_REG(0x2124); //LPDACSW0
|
||||
w32_REG(0x0000003E);
|
||||
select_REG(0x20E4); //LPTIASW0
|
||||
w32_REG(0x00008034); // SW2 | SW4 | SW5
|
||||
select_REG(0x20EC); //LPTIACON0
|
||||
w32_REG(0x00000038); //RF 0 | RTIA 200R | Rload 0 | High Current Mode
|
||||
select_REG(0x2128); //LPDACCON0
|
||||
w32_REG(0x00000001);
|
||||
|
||||
//Configure ADC | ADCDAT (0x2074)
|
||||
select_REG(0x21A8); //ADCCON
|
||||
w32_REG(0x00001021); //PGA = 1 | VZERO | LPTIA_OUT
|
||||
select_REG(0x2044); //ADCFILTERCON
|
||||
w32_REG(0x00006091); //AVR 4 | Sinc3 En | OSR 2
|
||||
// w32_REG(0x00012011); //Disable avr | sinc3 enable | osr 2
|
||||
select_REG(0x20D0); //DFTCON
|
||||
w32_REG(0x001000C1); //sinc3 + average input for DFT | dftnum max
|
||||
|
||||
//AFE and PWMB
|
||||
select_REG(0x2000); //AFECON
|
||||
w32_REG(0x00098780); //ADC on //0b10011000011110000000
|
||||
select_REG(0x22F0); //PWMB
|
||||
w32_REG(0x00000005);//fc 50kHz, low power mode
|
||||
}
|
||||
|
||||
#endif
|
||||
+246
@@ -0,0 +1,246 @@
|
||||
//
|
||||
//#ifndef Elite15_PIN
|
||||
//#define Elite_15PIN
|
||||
//
|
||||
//#include "Elite_PIN.h"
|
||||
//
|
||||
//static void update_latch_status (uint32_t latch_num, uint32_t elite_pin, bool highlow) {
|
||||
// switch (latch_num) {
|
||||
// case LOAD0: {
|
||||
// switch (elite_pin) {
|
||||
// case D0: {
|
||||
// LH.LATCH0[0] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D1: {
|
||||
// LH.LATCH0[1] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D2: {
|
||||
// LH.LATCH0[2] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D3: {
|
||||
// LH.LATCH0[3] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D4: {
|
||||
// LH.LATCH0[4] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D5: {
|
||||
// LH.LATCH0[5] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D6: {
|
||||
// LH.LATCH0[6] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D7: {
|
||||
// LH.LATCH0[7] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// default: {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// case LOAD1: {
|
||||
// switch (elite_pin) {
|
||||
// case D0: {
|
||||
// LH.LATCH1[0] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D1: {
|
||||
// LH.LATCH1[1] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D2: {
|
||||
// LH.LATCH1[2] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D3: {
|
||||
// LH.LATCH1[3] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D4: {
|
||||
// LH.LATCH1[4] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D5: {
|
||||
// LH.LATCH1[5] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D6: {
|
||||
// LH.LATCH1[6] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D7: {
|
||||
// LH.LATCH1[7] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// default: {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// case LOAD2: {
|
||||
// switch (elite_pin) {
|
||||
// case D0: {
|
||||
// LH.LATCH2[0] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D1: {
|
||||
// LH.LATCH2[1] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D2: {
|
||||
// LH.LATCH2[2] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D3: {
|
||||
// LH.LATCH2[3] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D4: {
|
||||
// LH.LATCH2[4] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D5: {
|
||||
// LH.LATCH2[5] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D6: {
|
||||
// LH.LATCH2[6] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// case D7: {
|
||||
// LH.LATCH2[7] = highlow;
|
||||
// break;
|
||||
// }
|
||||
// default: {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// default: {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//static void PIN15_setOutputValue (uint32_t latch_num, uint32_t pin_num, bool highlow) {
|
||||
// ELITE15_SPI_CLOSE();
|
||||
// add_elite_pin();
|
||||
// update_latch_status (latch_num, pin_num, highlow);
|
||||
//// PIN_setOutputValue(&ZM_rst, latch_num, 1); // Turn on latch
|
||||
//
|
||||
// switch (latch_num) {
|
||||
// case LOAD0: {
|
||||
//// PIN_setOutputValue(&ZM_rst, D0, LH.LATCH0[0]);
|
||||
//// PIN_setOutputValue(&ZM_rst, D1, LH.LATCH0[1]);
|
||||
//// PIN_setOutputValue(&ZM_rst, D2, LH.LATCH0[2]);
|
||||
//// PIN_setOutputValue(&ZM_rst, D3, LH.LATCH0[3]);
|
||||
// PIN_setOutputValue(pin_handle, D4, LH.LATCH0[4]);
|
||||
// PIN_setOutputValue(pin_handle, D5, LH.LATCH0[5]);
|
||||
// PIN_setOutputValue(pin_handle, D6, LH.LATCH0[6]);
|
||||
// PIN_setOutputValue(pin_handle, D7, LH.LATCH0[7]);
|
||||
// break;
|
||||
// }
|
||||
// case LOAD1: {
|
||||
// PIN_setOutputValue(pin_handle, D0, LH.LATCH1[0]);
|
||||
// PIN_setOutputValue(pin_handle, D1, LH.LATCH1[1]);
|
||||
// PIN_setOutputValue(pin_handle, D2, LH.LATCH1[2]);
|
||||
// PIN_setOutputValue(pin_handle, D3, LH.LATCH1[3]);
|
||||
// PIN_setOutputValue(pin_handle, D4, LH.LATCH1[4]);
|
||||
// PIN_setOutputValue(pin_handle, D5, LH.LATCH1[5]);
|
||||
// PIN_setOutputValue(pin_handle, D6, LH.LATCH1[6]);
|
||||
// PIN_setOutputValue(pin_handle, D7, LH.LATCH1[7]);
|
||||
// break;
|
||||
// }
|
||||
// case LOAD2: {
|
||||
// PIN_setOutputValue(pin_handle, D0, LH.LATCH2[0]);
|
||||
// PIN_setOutputValue(pin_handle, D1, LH.LATCH2[1]);
|
||||
// PIN_setOutputValue(pin_handle, D2, LH.LATCH2[2]);
|
||||
// PIN_setOutputValue(pin_handle, D3, LH.LATCH2[3]);
|
||||
// PIN_setOutputValue(pin_handle, D4, LH.LATCH2[4]);
|
||||
// PIN_setOutputValue(pin_handle, D5, LH.LATCH2[5]);
|
||||
// PIN_setOutputValue(pin_handle, D6, LH.LATCH2[6]);
|
||||
// PIN_setOutputValue(pin_handle, D7, LH.LATCH2[7]);
|
||||
// break;
|
||||
// }
|
||||
// default: {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// PIN_setOutputValue(&ZM_rst, latch_num, 1); // Turn on latch
|
||||
//// CPUdelay(10);
|
||||
// PIN_setOutputValue(&ZM_rst, latch_num, 0); // Turn off latch
|
||||
// remove_elite_pin();
|
||||
// ELITE15_SPI_HOLD();
|
||||
//}
|
||||
//
|
||||
//static void Init_Elite15_PIN () {
|
||||
// InitLH();
|
||||
// add_elite_pin();
|
||||
//
|
||||
// PIN_setOutputValue(pin_handle, D0, 0);
|
||||
// PIN_setOutputValue(pin_handle, D1, 0);
|
||||
// PIN_setOutputValue(pin_handle, D2, 0);
|
||||
// PIN_setOutputValue(pin_handle, D3, 0);
|
||||
// PIN_setOutputValue(pin_handle, D4, 0);
|
||||
// PIN_setOutputValue(pin_handle, D5, 0);
|
||||
// PIN_setOutputValue(pin_handle, D6, 0);
|
||||
// PIN_setOutputValue(pin_handle, D7, 0);
|
||||
// PIN_setOutputValue(pin_handle, LOAD0, 0);
|
||||
// PIN_setOutputValue(pin_handle, LOAD1, 1);
|
||||
// PIN_setOutputValue(pin_handle, LOAD2, 1);
|
||||
// CPUdelay(10);
|
||||
// PIN_setOutputValue(pin_handle, LOAD1, 0);
|
||||
// PIN_setOutputValue(pin_handle, LOAD2, 0);
|
||||
//
|
||||
//
|
||||
// PIN_setOutputValue(pin_handle, D0, 0);
|
||||
// PIN_setOutputValue(pin_handle, D1, 0);
|
||||
// PIN_setOutputValue(pin_handle, D2, 0);
|
||||
// PIN_setOutputValue(pin_handle, D3, 0);
|
||||
// PIN_setOutputValue(pin_handle, D4, 1);
|
||||
// PIN_setOutputValue(pin_handle, D5, 1);
|
||||
// PIN_setOutputValue(pin_handle, D6, 1);
|
||||
// PIN_setOutputValue(pin_handle, D7, 1);
|
||||
// CPUdelay(10);
|
||||
// PIN_setOutputValue(pin_handle, LOAD0, 1);
|
||||
// PIN_setOutputValue(pin_handle, LOAD0, 0);
|
||||
//
|
||||
// remove_elite_pin();
|
||||
//
|
||||
//// InitLH();
|
||||
//// add_elite_pin();
|
||||
////
|
||||
//// PIN_setOutputValue(pin_handle, LOAD0, 1);
|
||||
//// PIN_setOutputValue(pin_handle, LOAD1, 1);
|
||||
//// PIN_setOutputValue(pin_handle, LOAD2, 1);
|
||||
//// CPUdelay(10);
|
||||
//// PIN_setOutputValue(pin_handle, D0, 0);
|
||||
//// PIN_setOutputValue(pin_handle, D1, 0);
|
||||
//// PIN_setOutputValue(pin_handle, D2, 0);
|
||||
//// PIN_setOutputValue(pin_handle, D3, 0);
|
||||
//// PIN_setOutputValue(pin_handle, D4, 0);
|
||||
//// PIN_setOutputValue(pin_handle, D5, 0);
|
||||
//// PIN_setOutputValue(pin_handle, D6, 0);
|
||||
//// PIN_setOutputValue(pin_handle, D7, 0);
|
||||
//// CPUdelay(10);
|
||||
//// PIN_setOutputValue(pin_handle, LOAD0, 0);
|
||||
//// PIN_setOutputValue(pin_handle, LOAD1, 0);
|
||||
//// PIN_setOutputValue(pin_handle, LOAD2, 0);
|
||||
////
|
||||
//// remove_elite_pin();
|
||||
//}
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//#endif
|
||||
+1112
-221
File diff suppressed because it is too large
Load Diff
-32
@@ -1,32 +0,0 @@
|
||||
|
||||
#ifndef ELITECCC
|
||||
#define ELITECCC
|
||||
|
||||
#include "EliteCCMode.h"
|
||||
|
||||
|
||||
// XXX : should we reset DAC output after STOP?
|
||||
static void CCModeReverseCurrent(CCCMode *CCC){
|
||||
if(CCC->StandBy){
|
||||
if(CT.StandByCounter == CCC->StandByTime){
|
||||
CCC->StandBy = false;
|
||||
CT.StandByCounter = 0;
|
||||
}
|
||||
else{
|
||||
CT.StandByCounter ++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
// reverse charge/discharge
|
||||
if(CCC->BatteryV == CCC->VMax){
|
||||
CCC->StandBy = true;
|
||||
CCC->value = CCC->DischargeCurrent;
|
||||
}
|
||||
else if(CCC->BatteryV == CCC->VMin){
|
||||
CCC->StandBy = true;
|
||||
CCC->value = CCC->ChargeCurrent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
-132
@@ -1,132 +0,0 @@
|
||||
|
||||
#ifndef ELITECCMODE
|
||||
#define ELITECCMODE
|
||||
|
||||
static void CCModeDACControl(CCMode *CC, int32_t IUC_Measure_Difference);
|
||||
|
||||
static int32_t CCModeReadCurrent(CCMode *CC){
|
||||
|
||||
static uint8_t VoltCurrentSwitch = 0;
|
||||
|
||||
CCModeDACEnable = 1; // This flag will control DAC working
|
||||
|
||||
// decode ADC value and put it into notify buffer
|
||||
// Use 5-th measure value as real-measure value
|
||||
// because some value in the begin are garbage
|
||||
if(VoltCurrentSwitch < 5){
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
VoltCurrentSwitch ++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 5){
|
||||
// read current
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
CC->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
CC->_MeasureData = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
VoltCurrentSwitch ++;
|
||||
}
|
||||
else if(VoltCurrentSwitch <10){
|
||||
// read volt
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
VoltCurrentSwitch++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 10){
|
||||
/** read battery voltage **/
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
CC->BatteryV = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
|
||||
// if Iin have a offset if current !=0
|
||||
CC->BatteryV = CC->BatteryV - (CC->value - CC_ZERO_POINT)*10/1e5; // I_set * 10R = V_Iin2GND (mA * ohm)
|
||||
VoltCurrentSwitch++;
|
||||
// NotifyReady = true;
|
||||
}
|
||||
else{
|
||||
VoltCurrentSwitch = 0;
|
||||
}
|
||||
NotifyVolt[0] = (uint8_t) (CC->BatteryV >> 24);
|
||||
NotifyVolt[1] = (uint8_t) ((CC->BatteryV & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t) ((CC->BatteryV & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t) (CC->BatteryV & 0x000000FF);
|
||||
return CC->_MeasureData;
|
||||
}
|
||||
|
||||
static int32_t CCModeVoltOut(CCMode *CC){
|
||||
int32_t IUCCurrent = 0;
|
||||
|
||||
if(!CCModeDACEnable){
|
||||
// DAC should not work now
|
||||
return 0;
|
||||
}
|
||||
IUCCurrent = CC->_Transform2RealnA( (struct CCModePara *) CC);
|
||||
|
||||
CCModeDACControl(CC, IUCCurrent - CC->_MeasureData);
|
||||
|
||||
CCModeDACEnable = 0;
|
||||
return CC->_MeasureData;
|
||||
}
|
||||
|
||||
static void CCModeDACControl(CCMode *CC, int32_t IUC_Measure_Difference){
|
||||
int32_t step;
|
||||
|
||||
if(IUC_Measure_Difference < 300 && IUC_Measure_Difference > -300){
|
||||
step = 0;
|
||||
}
|
||||
else if( CC->Charge && CC->BatteryV >= ( (int32_t) (CC->VMax - DAC_ZERO)/5 ) ){
|
||||
CC->value = 0;
|
||||
step = (IUC_Measure_Difference > 0) ? 1:-1;
|
||||
}
|
||||
else if( (!CC->Charge) && CC->BatteryV <= ( (int32_t) (CC->VMin - DAC_ZERO)/5 ) ){
|
||||
// Ignore VMin condition
|
||||
if(CC->Done < 25000){
|
||||
CC->Done ++;
|
||||
step = (IUC_Measure_Difference > 0) ? 2:-2;
|
||||
}
|
||||
// after ignore few second, active VMin condition
|
||||
else{
|
||||
CC->value = 0;
|
||||
step = (IUC_Measure_Difference > 0) ? 1:-1;
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
step = (IUC_Measure_Difference > 0) ? 1:-1;
|
||||
}
|
||||
// over/under flow
|
||||
if( (INSTRUCTION.VoltConstant + step) > MAX_DAC_UC || (INSTRUCTION.VoltConstant + step) < MIN_DAC_UC ){
|
||||
if(step > 0){
|
||||
INSTRUCTION.VoltConstant = (INSTRUCTION.VoltConstant + MAX_DAC_UC)/2;
|
||||
}
|
||||
else{
|
||||
INSTRUCTION.VoltConstant = (INSTRUCTION.VoltConstant + MIN_DAC_UC)/2;
|
||||
}
|
||||
}
|
||||
else{
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant + step;
|
||||
}
|
||||
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
|
||||
// step = CC->Done;
|
||||
// NotifyImpedance[0] = (uint8_t) (step >> 24);
|
||||
// NotifyImpedance[1] = (uint8_t) ((step & 0x00FF0000) >> 16);
|
||||
// NotifyImpedance[2] = (uint8_t) ((step & 0x0000FF00) >> 8);
|
||||
// NotifyImpedance[3] = (uint8_t) (step & 0x000000FF);
|
||||
}
|
||||
|
||||
/* Transform setting CC into IUC
|
||||
*
|
||||
* User code in CC mode : 0 ~ 3000000
|
||||
* Real current value : -15.00000 ~ 15.00000 mA
|
||||
* => user code = 1500000 mapping to 0.00000 mA
|
||||
*/
|
||||
static void CCCurrent2IUC(CCMode *CC){
|
||||
int32_t CurrentValue = 0;
|
||||
|
||||
CC->value = INSTRUCTION.ConstantCurrent;
|
||||
CurrentValue = CC->value - CC_ZERO_POINT;
|
||||
}
|
||||
|
||||
#endif
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
#ifndef ELITECV3
|
||||
#define ELITECV3
|
||||
|
||||
#define Vset instru.Vset
|
||||
|
||||
static void cv_vscan(void)
|
||||
{
|
||||
struct wm_cv_ctx_t *cv = (struct wm_cv_ctx_t *)wm_get();
|
||||
static bool VminCounter;
|
||||
static bool VmaxCounter;
|
||||
|
||||
NotifyCycleNumber = (instru.cycleNumber - cv->_cycleNumber + 1);
|
||||
|
||||
if (vscanReset) {
|
||||
VmaxCounter = false;
|
||||
VminCounter = false;
|
||||
|
||||
if (instru.directionInit == 1) {
|
||||
cv->_direction_up = true;
|
||||
cv->_current_direction_up = true;
|
||||
} else {
|
||||
cv->_direction_up = false;
|
||||
cv->_current_direction_up = false;
|
||||
}
|
||||
|
||||
// Vstep = x * 20 * N, x=xmV ; N=VscanRate Vstep unit [5nV]/[0.1ms]
|
||||
if (instru.step <= 10) {
|
||||
cv->_Vstep = instru.step * instru.VsetRate / 5;
|
||||
} else {
|
||||
cv->_Vstep = instru.step / 5 * instru.VsetRate;
|
||||
}
|
||||
|
||||
|
||||
if (cv->_Vmin == cv->_Vinit) {
|
||||
VminCounter = true;
|
||||
}
|
||||
if (cv->_Vmax == cv->_Vinit) {
|
||||
VmaxCounter = true;
|
||||
}
|
||||
|
||||
Vset = cv->_Vinit;
|
||||
}
|
||||
|
||||
if (!vscanReset) {
|
||||
cv->bFirst = false;
|
||||
if ((instru.Vinit < instru.Ve1 && instru.Vinit < instru.Ve2) ||
|
||||
(instru.Vinit > instru.Ve1 && instru.Vinit > instru.Ve2)
|
||||
) {
|
||||
if (cv->_current_direction_up) {
|
||||
Vset = Vset + cv->_Vstep; //* GPT.GptimerMultiple;
|
||||
} else {
|
||||
Vset = Vset - cv->_Vstep; //* GPT.GptimerMultiple;
|
||||
}
|
||||
|
||||
if (instru.Vinit < instru.Ve1 && instru.Vinit < instru.Ve2) {
|
||||
if (Vset == cv->_Vmin) {
|
||||
VminCounter = true;
|
||||
instru.Vinit = instru.Vmin;
|
||||
cv->_Vinit = cv->_Vmin;
|
||||
}
|
||||
} else if (instru.Vinit > instru.Ve1 && instru.Vinit > instru.Ve2) {
|
||||
if (Vset == cv->_Vmax) {
|
||||
VmaxCounter = true;
|
||||
instru.Vinit = instru.Vmax;
|
||||
cv->_Vinit = cv->_Vmax;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Vset >= cv->_Vmax) {
|
||||
VmaxCounter = true;
|
||||
} else if (Vset <= cv->_Vmin) {
|
||||
VminCounter = true;
|
||||
}
|
||||
|
||||
if (cv->_current_direction_up) {
|
||||
Vset = Vset + cv->_Vstep;// * GPT.GptimerMultiple;
|
||||
} else {
|
||||
Vset = Vset - cv->_Vstep;// * GPT.GptimerMultiple;
|
||||
}
|
||||
|
||||
if (VmaxCounter && VminCounter) {
|
||||
if (cv->_direction_up && cv->_current_direction_up) {
|
||||
if (Vset >= cv->_Vinit) {
|
||||
cv->_cycleNumber--;
|
||||
VminCounter = false;
|
||||
VmaxCounter = false;
|
||||
}
|
||||
}
|
||||
if (!cv->_direction_up && !cv->_current_direction_up) {
|
||||
if (Vset <= cv->_Vinit) {
|
||||
cv->_cycleNumber--;
|
||||
VminCounter = false;
|
||||
VmaxCounter = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Vset >= cv->_Vmax) {
|
||||
cv->_current_direction_up = false;
|
||||
} else if (Vset <= cv->_Vmin) {
|
||||
cv->_current_direction_up = true;
|
||||
}
|
||||
|
||||
/*stop condition*/
|
||||
if (cv->_cycleNumber == 0) {
|
||||
PeriodicEvent = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
-598
@@ -1,598 +0,0 @@
|
||||
|
||||
#ifndef ELITECV
|
||||
#define ELITECV
|
||||
|
||||
static uint16_t SWVCurve(WorkMode *WorkModeData) {
|
||||
static uint8_t counter;
|
||||
static uint16_t outputV;
|
||||
static uint16_t Volt;
|
||||
static bool direction_up;
|
||||
|
||||
// reset origin volt at the begin
|
||||
if (DACReset) {
|
||||
Volt = INSTRUCTION.VoltOrigin;
|
||||
outputV = INSTRUCTION.VoltOrigin;
|
||||
if (INSTRUCTION.VoltOrigin < INSTRUCTION.VoltFinal)
|
||||
direction_up = true;
|
||||
else
|
||||
direction_up = false;
|
||||
counter = 1;
|
||||
DACReset = false;
|
||||
}
|
||||
|
||||
if (counter == 2 * PulseWidth)
|
||||
counter = 1;
|
||||
else
|
||||
counter++;
|
||||
|
||||
// output a certain volt
|
||||
outputV = Volt;
|
||||
DAC_outputV(outputV);
|
||||
|
||||
// VoltValue = (ramp1*16 + ramp0/16) * 3.05;
|
||||
|
||||
// check if we reach the final volt
|
||||
if ((outputV >= INSTRUCTION.VoltFinal && direction_up) || (outputV <= INSTRUCTION.VoltFinal && !direction_up)) {
|
||||
PeriodicEvent = false;
|
||||
DACReset = true;
|
||||
}
|
||||
|
||||
// prepare the next output volt
|
||||
if (direction_up) {
|
||||
if (counter == PulseWidth)
|
||||
Volt = Volt + Amplitude;
|
||||
else if (counter == 2 * PulseWidth)
|
||||
Volt = Volt - (Amplitude - INSTRUCTION.Step);
|
||||
else
|
||||
Volt = Volt;
|
||||
} else {
|
||||
if (counter == PulseWidth)
|
||||
Volt = Volt - Amplitude;
|
||||
else if (counter == 2 * PulseWidth)
|
||||
Volt = Volt + (Amplitude - INSTRUCTION.Step);
|
||||
else
|
||||
Volt = Volt;
|
||||
}
|
||||
|
||||
return outputV;
|
||||
}
|
||||
|
||||
static uint16_t DPVCurve(WorkMode *WorkModeData) {
|
||||
static uint8_t counter;
|
||||
static uint16_t Volt1;
|
||||
static uint16_t Volt2;
|
||||
static uint16_t outputV;
|
||||
static bool direction_up;
|
||||
|
||||
// reset origin volt at the begin
|
||||
if (DACReset) {
|
||||
if (INSTRUCTION.VoltOrigin < INSTRUCTION.VoltFinal)
|
||||
direction_up = true;
|
||||
else
|
||||
direction_up = false;
|
||||
|
||||
Volt1 = INSTRUCTION.VoltOrigin;
|
||||
if (direction_up)
|
||||
Volt2 = INSTRUCTION.VoltOrigin + Amplitude;
|
||||
else
|
||||
Volt2 = INSTRUCTION.VoltOrigin - Amplitude;
|
||||
|
||||
counter = 1;
|
||||
DACReset = false;
|
||||
}
|
||||
|
||||
if (counter == PulsePeriod)
|
||||
counter = 1;
|
||||
else
|
||||
counter++;
|
||||
|
||||
// output a certain volt
|
||||
if (counter <= (PulsePeriod - PulseWidth)) {
|
||||
outputV = Volt1;
|
||||
DAC_outputV(Volt1);
|
||||
} else {
|
||||
outputV = Volt2;
|
||||
DAC_outputV(Volt2);
|
||||
}
|
||||
|
||||
|
||||
// VoltValue = (ramp1*16 + ramp0/16) * 3.05;
|
||||
|
||||
// check if we reach the final volt
|
||||
if (((outputV >= INSTRUCTION.VoltFinal) && direction_up) || ((outputV <= INSTRUCTION.VoltFinal) && !direction_up)) {
|
||||
PeriodicEvent = false;
|
||||
DACReset = true;
|
||||
}
|
||||
|
||||
// check overflow/underflow and prepare for next output
|
||||
if (direction_up) {
|
||||
if (Volt1 + INSTRUCTION.Step < Volt1)
|
||||
Volt1 = 0xffff;
|
||||
else
|
||||
Volt1 = Volt1 + INSTRUCTION.Step;
|
||||
if (Volt2 + INSTRUCTION.Step < Volt2)
|
||||
Volt2 = 0xffff;
|
||||
else
|
||||
Volt2 = Volt2 + INSTRUCTION.Step;
|
||||
} else {
|
||||
if (Volt1 - INSTRUCTION.Step > Volt1)
|
||||
Volt1 = 0x0000;
|
||||
else
|
||||
Volt1 = Volt1 - INSTRUCTION.Step;
|
||||
if (Volt2 - INSTRUCTION.Step > Volt2)
|
||||
Volt2 = 0x0000;
|
||||
else
|
||||
Volt2 = Volt2 - INSTRUCTION.Step;
|
||||
}
|
||||
|
||||
if (counter + 1 <= (PulsePeriod - PulseWidth)) {
|
||||
return Volt1;
|
||||
} else {
|
||||
return Volt2;
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t CVCurve(CVMode *CV) {
|
||||
static uint16_t DACOutCode;
|
||||
static bool direction_up; // direction_up = true, if Vfinal > Vorigin
|
||||
static bool current_direction_up; // current_direction_up = true, Vstep => positive. vice versa
|
||||
static bool firstADCData; //firstADCdata=true,when min<x<max,cyclenumber--
|
||||
// reset origin volt at the begin
|
||||
if (DACReset) {
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
if (CV->_VStop > CV->_VOrigin) {
|
||||
direction_up = true;
|
||||
current_direction_up = true;
|
||||
} else {
|
||||
direction_up = false;
|
||||
current_direction_up = false;
|
||||
}
|
||||
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DAC_outputV(DACOutCode); // output VOLT_ORIGIN
|
||||
DACReset = false;
|
||||
firstADCData = true;
|
||||
return DACOutCode;
|
||||
}
|
||||
|
||||
if (CT.StepTimeCounter == CV->_StepTime) {
|
||||
// Decide next direction
|
||||
if (CV->_VoVi_Switch == 0x00){ //user see Vout
|
||||
if (direction_up) {
|
||||
if (INSTRUCTION.VoltConstant >= CV->_VStop) {
|
||||
current_direction_up = false; // problem occurs when origin == 0000 final == ffff!!!!!!
|
||||
firstADCData = false;
|
||||
}
|
||||
else if (INSTRUCTION.VoltConstant <= CV->_VOrigin) {
|
||||
current_direction_up = true;
|
||||
firstADCData = false;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
|
||||
|
||||
else if(current_direction_up){
|
||||
if(INSTRUCTION.VoltConstant + CV->_Step > CV->_VStop){
|
||||
current_direction_up = false;
|
||||
}
|
||||
}
|
||||
else if(!current_direction_up){
|
||||
if(INSTRUCTION.VoltConstant - CV->_Step < CV->_VOrigin){
|
||||
current_direction_up = true;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
}
|
||||
if (firstADCData){
|
||||
CV->_CycleNumber--;
|
||||
firstADCData = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (INSTRUCTION.VoltConstant < CV->_VStop) {
|
||||
current_direction_up = true; // problem occurs when origin == 0000 final == ffff!!!!!!
|
||||
firstADCData = false;
|
||||
}
|
||||
else if (INSTRUCTION.VoltConstant > CV->_VOrigin) {
|
||||
current_direction_up = false;
|
||||
firstADCData = false;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
else if(current_direction_up){
|
||||
if(INSTRUCTION.VoltConstant + CV->_Step > CV->_VOrigin){
|
||||
current_direction_up = false;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
}
|
||||
else if(!current_direction_up){
|
||||
if(INSTRUCTION.VoltConstant - CV->_Step < CV->_VStop){
|
||||
current_direction_up = true;
|
||||
}
|
||||
}
|
||||
if (firstADCData){//first data =2899mv,CV->_CycleNumber--;
|
||||
CV->_CycleNumber--;
|
||||
firstADCData = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (CV->_VoVi_Switch == 0x01){ //user see Vin
|
||||
if (direction_up) {
|
||||
if (INSTRUCTION.VoltConstant >= CV->_VStop) {
|
||||
current_direction_up = false; // problem occurs when origin == 0000 final == ffff!!!!!!
|
||||
firstADCData = false;
|
||||
}
|
||||
else if (INSTRUCTION.VoltConstant <= CV->_VOrigin) {
|
||||
current_direction_up = true;
|
||||
firstADCData = false;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
|
||||
|
||||
else if(current_direction_up){
|
||||
if(INSTRUCTION.VoltConstant + CV->_Step > CV->_VStop){
|
||||
current_direction_up = false;
|
||||
}
|
||||
}
|
||||
else if(!current_direction_up){
|
||||
if(INSTRUCTION.VoltConstant - CV->_Step < CV->_VOrigin){
|
||||
current_direction_up = true;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
}
|
||||
if (firstADCData){
|
||||
CV->_CycleNumber--;
|
||||
firstADCData = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (INSTRUCTION.VoltConstant < CV->_VStop) {
|
||||
current_direction_up = true; // problem occurs when origin == 0000 final == ffff!!!!!!
|
||||
firstADCData = false;
|
||||
}
|
||||
else if (INSTRUCTION.VoltConstant > CV->_VOrigin){
|
||||
current_direction_up = false;
|
||||
firstADCData = false;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
else if(current_direction_up){
|
||||
if(INSTRUCTION.VoltConstant + CV->_Step > CV->_VOrigin){
|
||||
current_direction_up = false;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
}
|
||||
else if(!current_direction_up){
|
||||
if(INSTRUCTION.VoltConstant - CV->_Step < CV->_VStop){
|
||||
current_direction_up = true;
|
||||
}
|
||||
}
|
||||
if (firstADCData){//first data =2899mv,CV->_CycleNumber--;
|
||||
CV->_CycleNumber--;
|
||||
firstADCData = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (current_direction_up == true){
|
||||
// LED_color(DARKLED, 255, 0, 0);
|
||||
// }
|
||||
// else if (current_direction_up == false){
|
||||
// LED_color(DARKLED, 255, 0, 255);
|
||||
// }
|
||||
|
||||
// Next output voltage
|
||||
if (CV->_VoVi_Switch == 0x00){
|
||||
if (direction_up) {
|
||||
if (current_direction_up) {
|
||||
// DACUserCode overflow ?
|
||||
if (INSTRUCTION.VoltConstant + CV->_Step < INSTRUCTION.VoltConstant) {
|
||||
INSTRUCTION.VoltConstant = CV->_VStop;
|
||||
}
|
||||
// reach Vfinal ?
|
||||
else if (INSTRUCTION.VoltConstant + CV->_Step > CV->_VStop) {
|
||||
INSTRUCTION.VoltConstant =CV->_VStop;
|
||||
}
|
||||
else if (INSTRUCTION.VoltConstant >= CV->_VStop){
|
||||
INSTRUCTION.VoltConstant =CV->_VStop;
|
||||
}
|
||||
else {
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant + CV->_Step;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// DACUserCode underflow ?
|
||||
if (INSTRUCTION.VoltConstant - CV->_Step > INSTRUCTION.VoltConstant) {
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
}
|
||||
// reach Vorigin ?
|
||||
else if (INSTRUCTION.VoltConstant - CV->_Step < CV->_VOrigin) {
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
}
|
||||
else if (INSTRUCTION.VoltConstant <= CV->_VOrigin){
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
}
|
||||
else {
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant - CV->_Step;
|
||||
if(INSTRUCTION.VoltConstant > 60000){
|
||||
INSTRUCTION.VoltConstant = 0;
|
||||
current_direction_up = true;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (current_direction_up) {
|
||||
|
||||
if (INSTRUCTION.VoltConstant + CV->_Step < INSTRUCTION.VoltConstant) {
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
}
|
||||
|
||||
else if (INSTRUCTION.VoltConstant + CV->_Step > CV->_VOrigin) {
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
}
|
||||
else if (INSTRUCTION.VoltConstant >= CV->_VOrigin){
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
}
|
||||
else {
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant + CV->_Step;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (INSTRUCTION.VoltConstant - CV->_Step > INSTRUCTION.VoltConstant) {
|
||||
INSTRUCTION.VoltConstant = CV->_VStop ;
|
||||
}
|
||||
else if (INSTRUCTION.VoltConstant - CV->_Step < CV->_VStop) {
|
||||
INSTRUCTION.VoltConstant = CV->_VStop;
|
||||
}
|
||||
else if(INSTRUCTION.VoltConstant <= CV->_VStop){
|
||||
INSTRUCTION.VoltConstant = CV->_VStop;
|
||||
}
|
||||
else {
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant - CV->_Step;
|
||||
|
||||
if(INSTRUCTION.VoltConstant > 60000){
|
||||
INSTRUCTION.VoltConstant = 0;
|
||||
current_direction_up = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (CV->_VoVi_Switch == 0x01){
|
||||
if (direction_up) {
|
||||
if (current_direction_up) {
|
||||
// DACUserCode overflow ?
|
||||
if (INSTRUCTION.VoltConstant + CV->_Step < INSTRUCTION.VoltConstant) {
|
||||
INSTRUCTION.VoltConstant = CV->_VStop;
|
||||
}
|
||||
// reach Vfinal ?
|
||||
else if (INSTRUCTION.VoltConstant + CV->_Step > CV->_VStop) {
|
||||
INSTRUCTION.VoltConstant =CV->_VStop;
|
||||
}
|
||||
else if (INSTRUCTION.VoltConstant >= CV->_VStop){
|
||||
INSTRUCTION.VoltConstant =CV->_VStop;
|
||||
}
|
||||
else {
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant + CV->_Step;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// DACUserCode underflow ?
|
||||
if (INSTRUCTION.VoltConstant - CV->_Step > INSTRUCTION.VoltConstant) {
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
}
|
||||
// reach Vorigin ?
|
||||
else if (INSTRUCTION.VoltConstant - CV->_Step < CV->_VOrigin) {
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
}
|
||||
else if (INSTRUCTION.VoltConstant <= CV->_VOrigin){
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
}
|
||||
else {
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant - CV->_Step;
|
||||
if(INSTRUCTION.VoltConstant > 60000){
|
||||
INSTRUCTION.VoltConstant = 0;
|
||||
current_direction_up = true;
|
||||
if (CV->_CycleNumber == 0) {
|
||||
PeriodicEvent = false; // periodic event end
|
||||
DACReset = true;
|
||||
}
|
||||
CV->_CycleNumber--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (current_direction_up) {
|
||||
// DACUserCode overflow ?
|
||||
if (INSTRUCTION.VoltConstant + CV->_Step < INSTRUCTION.VoltConstant) {
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
}
|
||||
// ex:command 3->1V ,when 1 to 3V, 2.99+0.1 > 3V
|
||||
else if (INSTRUCTION.VoltConstant + CV->_Step > CV->_VOrigin) {
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
}
|
||||
else if (INSTRUCTION.VoltConstant >= CV->_VOrigin){
|
||||
INSTRUCTION.VoltConstant = CV->_VOrigin;
|
||||
}
|
||||
else {
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant + CV->_Step;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (INSTRUCTION.VoltConstant - CV->_Step > INSTRUCTION.VoltConstant) {
|
||||
INSTRUCTION.VoltConstant = CV->_VStop ;
|
||||
}
|
||||
else if (INSTRUCTION.VoltConstant - CV->_Step < CV->_VStop) {
|
||||
INSTRUCTION.VoltConstant = CV->_VStop;
|
||||
}
|
||||
else if(INSTRUCTION.VoltConstant <= CV->_VStop){
|
||||
INSTRUCTION.VoltConstant = CV->_VStop;
|
||||
}
|
||||
else {
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant - CV->_Step;
|
||||
|
||||
if(INSTRUCTION.VoltConstant > 60000){
|
||||
INSTRUCTION.VoltConstant = 0;
|
||||
current_direction_up = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NotifyImpedance[0] = 0x00;
|
||||
// NotifyImpedance[1] = 0x00;
|
||||
// NotifyImpedance[2] = (uint8_t)((DACOutCode & 0xFF00) >> 8);
|
||||
// NotifyImpedance[3] = (uint8_t)(DACOutCode & 0x00FF);
|
||||
|
||||
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DAC_outputV(DACOutCode);
|
||||
}
|
||||
return DACOutCode;
|
||||
}
|
||||
|
||||
static void CV_Plot(CVMode *CV){
|
||||
static uint8_t PreviousGain = GAIN_200R;
|
||||
|
||||
static uint8_t VoltCurrentSwitch = 0;
|
||||
uint16_t ADC_measure = 0;
|
||||
|
||||
if(VoltCurrentSwitch < 5){
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
VoltCurrentSwitch ++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 5){
|
||||
// read current
|
||||
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
CV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
if(PreviousGain != INSTRUCTION.ADCGainLevel){
|
||||
PreviousGain = INSTRUCTION.ADCGainLevel;
|
||||
CV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
CV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
if(PreviousGain != INSTRUCTION.ADCGainLevel){
|
||||
PreviousGain = INSTRUCTION.ADCGainLevel;
|
||||
CV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
CV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
}
|
||||
else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
CV->_MeasureData = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
VoltCurrentSwitch ++;
|
||||
}
|
||||
// else if(VoltCurrentSwitch < 9){
|
||||
// // read volt
|
||||
// ReadVolt(spi_ADC_rxbuf);
|
||||
// VoltCurrentSwitch++;
|
||||
// }
|
||||
// else if(VoltCurrentSwitch == 9){
|
||||
// /** read battery voltage **/
|
||||
// ReadVolt(spi_ADC_rxbuf);
|
||||
// ADC_measure = (uint16_t) (spi_ADC_rxbuf[0] << 8) | (uint16_t) (spi_ADC_rxbuf[1]);
|
||||
// //CV->MeasureVolt = 20000;
|
||||
// CV->MeasureVolt = DecodeADCVolt(ADC_measure);
|
||||
// VoltCurrentSwitch++;
|
||||
// }
|
||||
else if(VoltCurrentSwitch < 9){
|
||||
if(CV->_VoVi_Switch == 0x01){
|
||||
// read vin volt
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
}else if(CV->_VoVi_Switch == 0x00){
|
||||
// read vout volt
|
||||
ReadVoutVolt(spi_ADC_rxbuf);
|
||||
}
|
||||
VoltCurrentSwitch++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 9){
|
||||
if(CV->_VoVi_Switch == 0x01){
|
||||
// read vin volt
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
ADC_measure = (uint16_t) (spi_ADC_rxbuf[0] << 8) | (uint16_t) (spi_ADC_rxbuf[1]);
|
||||
//CV->MeasureVolt = 20000;
|
||||
CV->MeasureVolt = DecodeADCVolt(ADC_measure);
|
||||
}else if(CV->_VoVi_Switch == 0x00){
|
||||
// read vout volt
|
||||
ReadVoutVolt(spi_ADC_rxbuf);
|
||||
ADC_measure = (uint16_t) (spi_ADC_rxbuf[0] << 8) | (uint16_t) (spi_ADC_rxbuf[1]);
|
||||
CV->MeasureVolt = DecodeADCVoutVolt(ADC_measure);
|
||||
}
|
||||
VoltCurrentSwitch++;
|
||||
}
|
||||
// else if (VoltCurrentSwitch < 13){
|
||||
// ReadBatVolt(spi_ADC_rxbuf);
|
||||
// VoltCurrentSwitch ++;
|
||||
// }
|
||||
// else if (VoltCurrentSwitch == 13){
|
||||
// // read battery volt
|
||||
// ReadBatVolt(spi_ADC_rxbuf);
|
||||
// ADC_measure = (uint16_t) (spi_ADC_rxbuf[0] << 8) | (uint16_t) (spi_ADC_rxbuf[1]);
|
||||
// CV->_MeasureBatvolt = DecodeADCBatVolt(ADC_measure);
|
||||
// CV->_MeasureBatvolt = CV->_MeasureBatvolt/10 - 250; // (5.00V) 5000->250 usercode
|
||||
// VoltCurrentSwitch ++;
|
||||
// }
|
||||
else{
|
||||
VoltCurrentSwitch = 0;
|
||||
}
|
||||
|
||||
NotifyCurrent[0] = (uint8_t) (CV->_MeasureData >> 24);
|
||||
NotifyCurrent[1] = (uint8_t) ((CV->_MeasureData & 0x00FF0000) >> 16);
|
||||
NotifyCurrent[2] = (uint8_t) ((CV->_MeasureData & 0x0000FF00) >> 8);
|
||||
NotifyCurrent[3] = (uint8_t) (CV->_MeasureData & 0x000000FF);
|
||||
|
||||
if ((CV->_VoVi_Switch == 0x01) || (CV->_VoVi_Switch == 0x00)){ //user see Vin || user see Vout
|
||||
// NotifyVolt[0] = (uint8_t) (CV->MeasureVolt >> 24);
|
||||
// NotifyVolt[1] = (uint8_t) ((CV->MeasureVolt & 0x00FF0000) >> 16);
|
||||
// NotifyVolt[2] = (uint8_t) ((CV->MeasureVolt & 0x0000FF00) >> 8);
|
||||
// NotifyVolt[3] = (uint8_t) (CV->MeasureVolt & 0x000000FF);
|
||||
|
||||
int32_t RealV;
|
||||
RealV = (int32_t)(INSTRUCTION.VoltConstant - 25000)*1000/5;
|
||||
NotifyVolt[0] = (uint8_t)((RealV & 0xFF000000) >> 24);
|
||||
NotifyVolt[1] = (uint8_t)((RealV & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t)((RealV & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t)(RealV & 0x000000FF);
|
||||
}
|
||||
|
||||
// NotifyBatVolt = (uint8_t) (CV->_MeasureBatvolt & 0x000000FF);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
+326
-26
@@ -29,37 +29,337 @@ static bool DACReset;
|
||||
//}
|
||||
//#endif
|
||||
|
||||
#ifdef ELITE_VERSION_1_4
|
||||
#define DACCLS 0x02
|
||||
#define DACOUT 0x31
|
||||
//#ifdef ELITE_VERSION_1_4
|
||||
//#define DACCLS 0x02
|
||||
//#define DACOUT 0x31
|
||||
//
|
||||
//static uint16_t DAC_outputV(uint16_t voltLV) {
|
||||
// // C = command, X = don't care, D = data
|
||||
// // CCCC CCCC = command
|
||||
// // DDDD DDDD = v1
|
||||
// // DDDD DDDD = v2
|
||||
//
|
||||
// // command
|
||||
// // 0x02 = clear
|
||||
// // 0x31 = output voltage
|
||||
//
|
||||
// uint8_t v1, v2 = 0;
|
||||
// v1 = (uint8_t) ((voltLV & 0xFF00) >> 8);
|
||||
// v2 = (uint8_t) (voltLV & 0x00FF);
|
||||
//
|
||||
// spi_DACtxbuf[0] = DACOUT;
|
||||
// spi_DACtxbuf[1] = v1;
|
||||
// spi_DACtxbuf[2] = v2;
|
||||
//
|
||||
// DAC_SPI(SPI_DAC_SIZE, spi_DACtxbuf, spi_rxbuf);
|
||||
//
|
||||
// return voltLV;
|
||||
//}
|
||||
//#endif
|
||||
|
||||
static uint16_t DAC_outputV(uint16_t voltLV) {
|
||||
// C = command, X = don't care, D = data
|
||||
// CCCC CCCC = command
|
||||
// DDDD DDDD = v1
|
||||
// DDDD DDDD = v2
|
||||
|
||||
// command
|
||||
// 0x02 = clear
|
||||
// 0x31 = output voltage
|
||||
#define VBIAS_LSB 107422 // 2200/4096 [mV] = 107422 [5nV]
|
||||
#define VZERO_LSB 6875008 // VBIAS_LSB * 64
|
||||
#define DAC12BIT_LSB 107422
|
||||
|
||||
uint8_t v1, v2 = 0;
|
||||
v1 = (uint8_t) ((voltLV & 0xFF00) >> 8);
|
||||
v2 = (uint8_t) (voltLV & 0x00FF);
|
||||
static int32_t DAC_outputV(int32_t voltLV) { // LPDAC output, voltLV = Vbias-Vzero
|
||||
static int32_t vztemp, vscan;
|
||||
static uint32_t vb, vz, vbcode, vzcode, DACOutCode = 0;
|
||||
|
||||
spi_DACtxbuf[0] = DACOUT;
|
||||
spi_DACtxbuf[1] = v1;
|
||||
spi_DACtxbuf[2] = v2;
|
||||
vztemp = (-0.45 * voltLV) + 249000000;
|
||||
if (voltLV < 0) {
|
||||
vztemp -= DAC12BIT_LSB;
|
||||
}
|
||||
vzcode = (vztemp - 40000000 + VZERO_LSB / 2) / VZERO_LSB;
|
||||
vz = vzcode * VZERO_LSB + 40000000;
|
||||
|
||||
DAC_SPI(SPI_DAC_SIZE, spi_DACtxbuf, spi_rxbuf);
|
||||
return voltLV;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int32_t User2Real(uint16_t UserCode){
|
||||
/* transfer usercode to real voltage value (mV) */
|
||||
return (int32_t) ((UserCode - 25000)*2)/10;
|
||||
vb = voltLV + vz;
|
||||
vbcode = ((vb - 40000000 + VBIAS_LSB / 2) / VBIAS_LSB);
|
||||
DACOutCode = (0x0003FFFF & ((vzcode << 12) + vbcode));
|
||||
|
||||
DACOutCode = Cali_LPDAC(DACOutCode);
|
||||
|
||||
select_REG(LPDACDAT0);
|
||||
w32_REG(DACOutCode);
|
||||
|
||||
vscan = (int32_t)(vb - vz) / 200;
|
||||
return vscan;
|
||||
}
|
||||
|
||||
static uint32_t DAC_outputF(uint32_t freq) {
|
||||
select_REG(WGFCW);
|
||||
w32_REG(freq);
|
||||
return freq;
|
||||
}
|
||||
|
||||
static void VoutGainControl(uint8_t VOUTLevel){
|
||||
if(VOUTLevel == 0){
|
||||
// VOUT gain level = 0, using 240K resister
|
||||
PIN_setOutputValue(pin_handle, Turon_VOUT_SMALL, 0);
|
||||
}
|
||||
else if(VOUTLevel == 1){
|
||||
// VOUT gain level = 1, using 15K resister
|
||||
PIN_setOutputValue(pin_handle, Turon_VOUT_SMALL, 1);
|
||||
}
|
||||
else if(VOUTLevel == 2){
|
||||
// VOUT gain level = 2, using 15K resister
|
||||
PIN_setOutputValue(pin_handle, Turon_VOUT_SMALL, 1);
|
||||
}
|
||||
else{
|
||||
// default using 15K resister
|
||||
PIN_setOutputValue(pin_handle, Turon_VOUT_SMALL, 1);
|
||||
}
|
||||
record_flag = false;
|
||||
}
|
||||
|
||||
static uint32_t CalcPeriod(uint32_t freq){ //One Second = 10000
|
||||
|
||||
uint32_t period;
|
||||
|
||||
if (freq == 1) {
|
||||
period = 666667;
|
||||
} else {
|
||||
period = (1000000 + freq / 2) / freq; // [sec]
|
||||
}
|
||||
|
||||
if (period < 20){
|
||||
period = 20;
|
||||
}
|
||||
|
||||
return period;
|
||||
}
|
||||
|
||||
static uint32_t CalcDelayTime(uint32_t freq){
|
||||
uint32_t delayTime, decadeSamplingTime;
|
||||
delayTime = CalcPeriod(freq) * instru.delay; //get delay time
|
||||
if (delayTime < 20) {
|
||||
delayTime = 20;
|
||||
} else {
|
||||
delayTime = (delayTime + 5) / 10;
|
||||
}
|
||||
|
||||
// 1000Hz
|
||||
if (freq >= 100000) {
|
||||
decadeSamplingTime = 1025;
|
||||
}
|
||||
|
||||
// 100Hz
|
||||
else if (freq >= 10000) {
|
||||
decadeSamplingTime = 1025;
|
||||
}
|
||||
|
||||
// 10Hz
|
||||
else if (freq >= 1000) {
|
||||
decadeSamplingTime = 11393;
|
||||
}
|
||||
|
||||
// 1Hz
|
||||
else if (freq >= 100) {
|
||||
decadeSamplingTime = 91034;
|
||||
}
|
||||
|
||||
//0.1Hz
|
||||
else if (freq >= 10) {
|
||||
decadeSamplingTime = 550000;
|
||||
}
|
||||
|
||||
// 0.015Hz | 136s
|
||||
else if (freq >= 1) {
|
||||
decadeSamplingTime = 1360000;
|
||||
}
|
||||
|
||||
delayTime += decadeSamplingTime; //delay+reading time
|
||||
|
||||
return delayTime;
|
||||
}
|
||||
|
||||
static uint32_t User2Freq(uint32_t UserCode){
|
||||
uint32_t freq;
|
||||
freq = (UserCode * 149 + 50)/ 100;
|
||||
return freq; //[100mHz]
|
||||
}
|
||||
|
||||
static uint32_t Freq2DAC(uint32_t freq){
|
||||
uint32_t code;
|
||||
code = (freq * 100 + 75) / 149;
|
||||
return code; //return code
|
||||
}
|
||||
|
||||
// DAC Vout theoretical boundary <300, 100~ (mV)
|
||||
#define DAC_VOUT_GAIN_SMALL_BOUNDARY 100000 // 25500(usercode) = 100 mV
|
||||
#define DAC_VOUT_GAIN_LARGE_BOUNDARY 300000 // 26500(usercode) = 300 mV
|
||||
#define DAC_VOUT_GAIN_LARGE_BOUNDARY_USERCODE 26500 // 26500(usercode) = 300 mV
|
||||
#define DAC_VOUT_GAIN_LARGE_BOUNDARY1_USERCODE 23500 // 23500(usercode) = -300 mV
|
||||
|
||||
static void AutoGainChangeVout(int32_t userCode){
|
||||
int32_t RealVolt = (userCode - 25000) * 200; // (userCode - 25000) / 5 * 1000 [1uV]
|
||||
// switch to 1 level volt(small) 15K
|
||||
// switch to 2 level volt(large) 240K
|
||||
|
||||
if(instru.VoutGainLevel == VOUT_GAIN_AUTO){
|
||||
instru.VoutGainLevel = VOUT_GAIN_15K;
|
||||
VoutGainControl(instru.VoutGainLevel);
|
||||
}
|
||||
|
||||
if(instru.VoutGainLevel == VOUT_GAIN_15K){
|
||||
if(RealVolt > DAC_VOUT_GAIN_LARGE_BOUNDARY || RealVolt < -1 * DAC_VOUT_GAIN_LARGE_BOUNDARY){
|
||||
// switch to 2 level volt(large)
|
||||
instru.VoutGainLevel = VOUT_GAIN_240K;
|
||||
VoutGainControl(instru.VoutGainLevel);
|
||||
}
|
||||
}
|
||||
else if(instru.VoutGainLevel == VOUT_GAIN_240K){
|
||||
if(RealVolt < DAC_VOUT_GAIN_SMALL_BOUNDARY && RealVolt > -1 * DAC_VOUT_GAIN_SMALL_BOUNDARY ){
|
||||
// switch to 1 level volt(small)
|
||||
instru.VoutGainLevel = VOUT_GAIN_15K;
|
||||
VoutGainControl(instru.VoutGainLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void SetWGAmp(uint16_t ampcode){
|
||||
// uint32_t amplitude = Cali_HSAMP(ampcode);
|
||||
|
||||
// static uint64_t amp_cutoff = 40000000;
|
||||
// uint32_t corrected_amp;
|
||||
//
|
||||
// corrected_amp = ((uint64_t)ampcode * 800 * 1000 / 2047) * (1 + ((uint64_t)instru.fset * (uint64_t)instru.fset) / (amp_cutoff * amp_cutoff)); //[uV]
|
||||
//
|
||||
// ampcode = corrected_amp * 2047 / 800000;
|
||||
|
||||
select_REG(WGCON);
|
||||
w32_REG(0x0); // 0x0: DC disable ac first
|
||||
select_REG(WGAMPLITUDE);
|
||||
w32_REG(ampcode);
|
||||
select_REG(WGCON);
|
||||
w32_REG(0x00000004); //0x4: Sinusoid
|
||||
}
|
||||
|
||||
static void SetEISHIGHZ(uint8_t ret){
|
||||
uint32_t code;
|
||||
|
||||
select_REG(LPTIASW0); //LPTIASW0
|
||||
code = r32_REG();
|
||||
code = (code & (~(1 << 2))) | (ret << 2); //ret = 0 HighZ on | ret = 1 HighZ off
|
||||
w32_REG(code);
|
||||
}
|
||||
|
||||
static void HSDAC_GainControl(uint8_t G_EXA_PGA) {
|
||||
/* Set the Gain value of PGA and Excitation amp */
|
||||
uint32_t reg = 0;
|
||||
uint8_t DACUpdateRate = 0x07;
|
||||
|
||||
switch (G_EXA_PGA) {
|
||||
case 0x00:{
|
||||
reg = 0x00000000;
|
||||
break;
|
||||
}
|
||||
case 0x01:{
|
||||
reg = 0x00000001;
|
||||
break;
|
||||
}
|
||||
case 0x10:{
|
||||
reg = 0x00001000;
|
||||
break;
|
||||
}
|
||||
case 0x11:{
|
||||
reg = 0x00001001;
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
reg = 0x0000000E; // Default update rate = 7
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
reg = reg | ((uint32_t)(DACUpdateRate) << 1);
|
||||
select_REG(HSDACCON); // HSDACCON address
|
||||
w32_REG(reg);
|
||||
}
|
||||
|
||||
static void HSDAC_output(uint16_t amp) {
|
||||
/* Set and write the amplitude of HSDAC. Full scale: 0x0200 ~ 0x0E00, 0x0800 = 0V */
|
||||
/* Set and write the amplitude of HSDAC. Full scale: 512 ~ 3584, 2048 = 0V */
|
||||
uint32_t amplitude = 0;
|
||||
|
||||
if (amp > 0x0E00) {
|
||||
amplitude = 0x00000E00;
|
||||
} else if (amp < 0x0200) {
|
||||
amplitude = 0x00000200;
|
||||
} else {
|
||||
amplitude = (uint32_t) (amp & 0x0FFF);
|
||||
}
|
||||
|
||||
select_REG(HSDACDAT); // HSDACDAT address
|
||||
w32_REG(amplitude);
|
||||
}
|
||||
|
||||
static void PowerMode_CutoffFrequencyControl (uint8_t bandwidth, uint8_t PowerMode) {
|
||||
uint32_t reg = 0;
|
||||
|
||||
switch (bandwidth) {
|
||||
case cutoff_auto :{
|
||||
reg = (((uint32_t)(cutoff_auto)) & 0x0000000F) << 2;
|
||||
break;
|
||||
}
|
||||
case cutoff_50k :{
|
||||
reg = (((uint32_t)(cutoff_50k)) & 0x0000000F) << 2;
|
||||
break;
|
||||
}
|
||||
case cutoff_100k :{
|
||||
reg = (((uint32_t)(cutoff_100k)) & 0x0000000F) << 2;
|
||||
break;
|
||||
}
|
||||
case cutoff_250k :{
|
||||
reg = (((uint32_t)(cutoff_250k)) & 0x0000000F) << 2;
|
||||
break;
|
||||
}
|
||||
default :{
|
||||
reg = (((uint32_t)(cutoff_auto)) & 0x0000000F) << 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (PowerMode) {
|
||||
case LOW_PW_MODE :{
|
||||
reg = reg | ((uint32_t)(LOW_PW_MODE) & 0x00000000F);
|
||||
break;
|
||||
}
|
||||
case HIGH_PW_MODE :{
|
||||
reg = reg | ((uint32_t)(HIGH_PW_MODE) & 0x00000000F);
|
||||
break;
|
||||
}
|
||||
default :{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
select_REG(PMBW);
|
||||
w32_REG(reg);
|
||||
}
|
||||
|
||||
static int32_t cali_DAC_outputV(int32_t voltLV) { // LPDAC output, voltLV = Vbias-Vzero
|
||||
static int32_t vztemp, vscan;
|
||||
static uint32_t vb, vz, vbcode, vzcode, DACOutCode = 0;
|
||||
|
||||
vztemp = (-0.45 * voltLV) + 249000000;
|
||||
if (voltLV < 0) {
|
||||
vztemp -= DAC12BIT_LSB;
|
||||
}
|
||||
vzcode = (vztemp - 40000000 + VZERO_LSB / 2) / VZERO_LSB;
|
||||
vz = vzcode * VZERO_LSB + 40000000;
|
||||
|
||||
vb = voltLV + vz;
|
||||
vbcode = ((vb - 40000000 + VBIAS_LSB / 2) / VBIAS_LSB);
|
||||
DACOutCode = (0x0003FFFF & ((vzcode << 12) + vbcode));
|
||||
|
||||
select_REG(LPDACDAT0);
|
||||
w32_REG(DACOutCode);
|
||||
|
||||
vscan = (int32_t)(vb - vz) / 200;
|
||||
// InputNotify(NOTIFY_VOLT, voltLV);
|
||||
// InputNotify(NOTIFY_CURRENT, vztemp);
|
||||
return vscan;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+613
-1212
File diff suppressed because it is too large
Load Diff
+150
@@ -0,0 +1,150 @@
|
||||
|
||||
#ifndef ELITEEIS
|
||||
#define ELITEEIS
|
||||
|
||||
static void eis_fscan(void)
|
||||
{
|
||||
struct wm_eis_ctx_t *eis = (struct wm_eis_ctx_t *)wm_get();
|
||||
|
||||
if (vscanReset) {
|
||||
eis->_in_reset_flag = true;
|
||||
|
||||
eis->_f1 = User2Freq(eis->_f1);
|
||||
eis->_f2 = User2Freq(eis->_f2);
|
||||
eis->_fmax = User2Freq(eis->_fmax);
|
||||
eis->_fmin = User2Freq(eis->_fmin);
|
||||
|
||||
if (instru.directionInit == 1) {
|
||||
eis->_direction_up = true;
|
||||
} else if (instru.directionInit == 0) {
|
||||
eis->_direction_up = false;
|
||||
}
|
||||
|
||||
eis->_decades = CalcDecade(instru.fmin, instru.fmax);
|
||||
|
||||
instru.fset = eis->_f1;
|
||||
|
||||
vscanReset = false;
|
||||
}
|
||||
|
||||
if (!vscanReset) {
|
||||
if(eis->_direction_up) {
|
||||
if(eis->_sweepIndex == 0){
|
||||
if(eis->_decadeIndex < eis->_decades) {
|
||||
eis->_fd1 = eis->_f1 * TenPowerTable[eis->_decadeIndex];
|
||||
eis->_fd2 = eis->_f1 * TenPowerTable[eis->_decadeIndex + 1];
|
||||
} else if (eis->_decadeIndex == eis->_decades) {
|
||||
eis->_fd1 = eis->_fd2;//eis->_f1 * TenPowerTable[decadeIndex];
|
||||
eis->_fd2 = eis->_fmax;
|
||||
}
|
||||
}
|
||||
|
||||
if(eis->_decadeIndex != 0 && eis->_sweepIndex == 0){
|
||||
eis->_sweepIndex++;
|
||||
}
|
||||
|
||||
if(instru.scale == 0) { // logarithm
|
||||
if (eis->_ppd == 10) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable10[eis->_sweepIndex] + 500)/ 1000;
|
||||
}
|
||||
else if (eis->_ppd == 9){
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable9[eis->_sweepIndex] + 500)/ 1000;
|
||||
}
|
||||
else if (eis->_ppd == 8) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable8[eis->_sweepIndex] + 500)/ 1000;
|
||||
}
|
||||
else if (eis->_ppd == 7) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable7[eis->_sweepIndex] + 500)/ 1000;
|
||||
}
|
||||
else if (eis->_ppd == 6) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable6[eis->_sweepIndex] + 500)/ 1000;
|
||||
}
|
||||
else if (eis->_ppd == 5) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable5[eis->_sweepIndex] + 500)/ 1000;
|
||||
}
|
||||
else if (eis->_ppd == 4) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable4[eis->_sweepIndex] + 500)/ 1000;
|
||||
}
|
||||
else if (eis->_ppd == 3) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable3[eis->_sweepIndex] + 500)/ 1000;
|
||||
}
|
||||
else if (eis->_ppd == 2) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable2[eis->_sweepIndex] + 500)/ 1000;
|
||||
}
|
||||
}
|
||||
else if (instru.scale == 1) { // linear
|
||||
instru.fset = eis->_fd1 + eis->_sweepIndex * ((eis->_fd2 - eis->_fd1) / (eis->_ppd - 1));
|
||||
}
|
||||
|
||||
if(instru.fset > eis->_fmax){
|
||||
instru.fset = eis->_fmax;
|
||||
}
|
||||
|
||||
} else { //reverse
|
||||
if(eis->_sweepIndex == 0){
|
||||
if(eis->_decadeIndex < eis->_decades){
|
||||
eis->_fd1 = eis->_f1 / TenPowerTable[eis->_decadeIndex];
|
||||
eis->_fd2 = eis->_f1 / TenPowerTable[eis->_decadeIndex + 1];
|
||||
} else if (eis->_decadeIndex == eis->_decades){
|
||||
eis->_fd1 = eis->_fd2; //eis->_f1 / TenPowerTable[eis->_decadeIndex];
|
||||
eis->_fd2 = eis->_fmin;
|
||||
}
|
||||
}
|
||||
|
||||
if(eis->_decadeIndex != 0 && eis->_sweepIndex == 0){
|
||||
eis->_sweepIndex++;
|
||||
}
|
||||
|
||||
if(instru.scale == 0) { // logarithm
|
||||
if (eis->_ppd == 10) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable10[9 - eis->_sweepIndex] + 5000)/ 10000;
|
||||
}
|
||||
else if (eis->_ppd == 9) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable9[8 - eis->_sweepIndex] + 5000)/ 10000;
|
||||
}
|
||||
else if (eis->_ppd == 8) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable8[7 - eis->_sweepIndex] + 5000)/ 10000;
|
||||
}
|
||||
else if (eis->_ppd == 7) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable7[6 - eis->_sweepIndex] + 5000)/ 10000;
|
||||
}
|
||||
else if (eis->_ppd == 6) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable6[5 - eis->_sweepIndex] + 5000)/ 10000;
|
||||
}
|
||||
else if (eis->_ppd == 5) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable5[4 - eis->_sweepIndex] + 5000)/ 10000;
|
||||
}
|
||||
else if (eis->_ppd == 4) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable4[3 - eis->_sweepIndex] + 5000)/ 10000;
|
||||
}
|
||||
else if (eis->_ppd == 3) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable3[2 - eis->_sweepIndex] + 5000)/ 10000;
|
||||
}
|
||||
else if (eis->_ppd == 2) {
|
||||
instru.fset = ((uint64_t)eis->_fd1 * LogSpacingTable2[1 - eis->_sweepIndex] + 5000)/ 10000;
|
||||
}
|
||||
}
|
||||
else if(instru.scale == 1) { // linear
|
||||
instru.fset = eis->_fd1 - eis->_sweepIndex * ((eis->_fd1 - eis->_fd2) / (eis->_ppd - 1));
|
||||
}
|
||||
|
||||
if(instru.fset < eis->_fmin){
|
||||
instru.fset = eis->_fmin;
|
||||
}
|
||||
}
|
||||
if (!gainChange_flag) {
|
||||
if (++eis->_sweepIndex == eis->_ppd) {
|
||||
eis->_sweepIndex = 0;
|
||||
eis->_decadeIndex ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SetSamplingTime(instru.fset);
|
||||
|
||||
instru.sampleRate = 2000;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+34
-15
@@ -2,21 +2,40 @@
|
||||
#ifndef ELITE_FLAG_CT_INIT
|
||||
#define ELITE_FLAG_CT_INIT
|
||||
|
||||
static void InitCT(){
|
||||
CT.SampleRate_counter = 1;
|
||||
CT.StepTimeCounter = 1;
|
||||
CT.NotifyCounter = 1;
|
||||
CT.StandByCounter = 0;
|
||||
}
|
||||
// CT counter
|
||||
struct _CT{
|
||||
uint32_t SampleRate_counter;
|
||||
uint16_t StepTimeCounter;
|
||||
uint16_t NotifyCounter;
|
||||
}CT = {0};
|
||||
|
||||
static void InitFlag(){
|
||||
PeriodicEvent = false; // is there an PeriodicEvent?
|
||||
InitPeriodicEvent = true; // need to create a WorkModeData?
|
||||
DACReset = true;
|
||||
CCModeDACEnable = 0; // to make sure DAC work after ADC
|
||||
Free_Work_Mode = true; // Free(WorkModeData)
|
||||
// NotifyReady = false;
|
||||
// DiscardIVFirstData = 0;
|
||||
}
|
||||
// GPT counter
|
||||
struct _GPT{
|
||||
uint32_t GptimerCounter;
|
||||
uint32_t GptimerCounter0;
|
||||
uint8_t DeltaGptimerCounter;
|
||||
uint32_t SampleRateCounter;
|
||||
uint32_t NotifyCounter;
|
||||
uint32_t VscanRateCounter;
|
||||
uint32_t LeadTimeCounter;
|
||||
uint32_t DelayTimeCounter;
|
||||
uint32_t BatteryADCCounter;
|
||||
uint32_t BatteryCheckCounter;
|
||||
uint32_t GptimerMultiple;
|
||||
uint32_t StiCounter;
|
||||
}GPT = {0};
|
||||
|
||||
static void InitGPT(){
|
||||
GPT.GptimerCounter = 0;
|
||||
GPT.GptimerCounter0 = 0;
|
||||
GPT.DeltaGptimerCounter = 0;
|
||||
GPT.SampleRateCounter = 0;
|
||||
GPT.NotifyCounter = 0;
|
||||
GPT.VscanRateCounter = 0;
|
||||
GPT.LeadTimeCounter = 0;
|
||||
GPT.DelayTimeCounter = 0;
|
||||
GPT.BatteryADCCounter = 0;
|
||||
GPT.BatteryCheckCounter = 0;
|
||||
GPT.StiCounter = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ static void elite_gptimer_callback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_In
|
||||
#define elite_gptimer_start() GPTimerCC26XX_start(gptimer_handle)
|
||||
#define elite_gptimer_stop() GPTimerCC26XX_stop(gptimer_handle)
|
||||
#define elite_gptimer_close() GPTimerCC26XX_close(gptimer_handle)
|
||||
#define CLOCK_FREQ 4000 // clock freq = 0.1 ms
|
||||
#define CLOCK_FREQ 4769 // clock freq = 0.1 ms(4800), Measured(4769)
|
||||
|
||||
#define elite_gptimer_open() \
|
||||
do { \
|
||||
|
||||
-84
@@ -1,84 +0,0 @@
|
||||
|
||||
#ifndef ELITEIT
|
||||
#define ELITEIT
|
||||
|
||||
#define absolute(a) ((a<0)? -a:a)
|
||||
|
||||
//static int32_t IT_Plot() {
|
||||
// // read ADC current
|
||||
// int32_t Real_Current = 0;
|
||||
// ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
// ADCChannelSelect(ADC_CH_CURRENT);
|
||||
// CPUdelay(10);
|
||||
// ADC_read(spi_ADC_rxbuf);
|
||||
//
|
||||
// // check if ADC over/under flow
|
||||
// // let the output saturate if over/under flow
|
||||
//// ADC_overflow(INSTRUCTION.ADCGainLevel, spi_ADC_rxbuf);
|
||||
//
|
||||
// // decode ADC value and put it into notify buffer
|
||||
// Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
//
|
||||
// return Real_Current;
|
||||
//}
|
||||
|
||||
static int32_t IT_Plot(WorkMode *WorkModeData) {
|
||||
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IV
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->CV
|
||||
break;
|
||||
}
|
||||
case IT_CURVE:{
|
||||
#define CURRENT_MODE WorkModeData->IT
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
#define CURRENT_MODE WorkModeData->IT
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// read ADC current
|
||||
int32_t RealCurrent = 0, RealVolt = 0;
|
||||
static uint8_t PreviousGain = GAIN_200R;
|
||||
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
RealCurrent = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
if(PreviousGain != INSTRUCTION.ADCGainLevel){
|
||||
PreviousGain = INSTRUCTION.ADCGainLevel;
|
||||
CURRENT_MODE->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
CURRENT_MODE->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
if(PreviousGain != INSTRUCTION.ADCGainLevel){
|
||||
PreviousGain = INSTRUCTION.ADCGainLevel;
|
||||
CURRENT_MODE->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
CURRENT_MODE->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
}
|
||||
else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
RealCurrent = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
|
||||
CURRENT_MODE->_MeasureData = RealCurrent;
|
||||
|
||||
|
||||
// if(INSTRUCTION.eliteFxn == IV_CURVE){
|
||||
// // RealVo = Vo - RealCurrent * 100R
|
||||
// RealVolt = (INSTRUCTION.VoltConstant - DAC_ZERO)/5 - 200*(RealCurrent/1e6);
|
||||
//
|
||||
// NotifyVolt[0] = (uint8_t) (RealVolt >> 24);
|
||||
// NotifyVolt[1] = (uint8_t) ((RealVolt & 0x00FF0000) >> 16);
|
||||
// NotifyVolt[2] = (uint8_t) ((RealVolt & 0x0000FF00) >> 8);
|
||||
// NotifyVolt[3] = (uint8_t) (RealVolt & 0x000000FF);
|
||||
// }
|
||||
return RealCurrent;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
+10
-253
@@ -2,262 +2,19 @@
|
||||
#ifndef ELITEIV
|
||||
#define ELITEIV
|
||||
|
||||
static uint16_t VoltScan(WorkMode *WorkModeData) {
|
||||
uint16_t Voltage;
|
||||
if (INSTRUCTION.VoltOrigin == INSTRUCTION.VoltFinal) {
|
||||
Voltage = Usercode_Correction_to_DAC(INSTRUCTION.VoltOrigin);
|
||||
DAC_outputV(Voltage);
|
||||
PeriodicEvent = false;
|
||||
return Voltage;
|
||||
} else if (INSTRUCTION.eliteFxn == SQUARE_WAVE_VOLTAMMETRY) {
|
||||
Voltage = SWVCurve(WorkModeData);
|
||||
} else if (INSTRUCTION.eliteFxn == DIFFERENTIAL_PULSE_VOLTAMMETRY) {
|
||||
Voltage = DPVCurve(WorkModeData);
|
||||
} else if (INSTRUCTION.eliteFxn == CV_CURVE) {
|
||||
Voltage = CVCurve(WorkModeData->CV);
|
||||
#define Vset instru.Vset
|
||||
|
||||
static void vo_vscan(void)
|
||||
{
|
||||
struct wm_vo_ctx_t *vo = (struct wm_vo_ctx_t *)wm_get();
|
||||
|
||||
if (vscanReset) {
|
||||
Vset = vo->_Vinit;
|
||||
}
|
||||
|
||||
// IV plot mode
|
||||
else {
|
||||
Voltage = OneWayVoltScan(WorkModeData->IV);
|
||||
if(!vscanReset) {
|
||||
Vset = vo->_Vinit;
|
||||
}
|
||||
|
||||
return Voltage;
|
||||
}
|
||||
|
||||
static uint16_t OneWayVoltScan(IVMode *IV) {
|
||||
uint16_t DACOutCode;
|
||||
|
||||
// reset origin volt at the begin
|
||||
if (DACReset) {
|
||||
// DACUserCode = IV->GetVOrigin((struct VoltOutPara *) IV);
|
||||
INSTRUCTION.VoltConstant = IV->_VOrigin;
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DACReset = false;
|
||||
|
||||
// output VOLT_ORIGIN
|
||||
DAC_outputV(DACOutCode);
|
||||
return DACOutCode;
|
||||
}
|
||||
|
||||
if (CT.StepTimeCounter == IV->_StepTime){
|
||||
if (IV->_VOrigin < IV->_VStop) {//4~5V
|
||||
// output the next output volt
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant + IV->_Step;
|
||||
// Only used in two-wire IV
|
||||
// if(INSTRUCTION.VoltConstant > IV->_VStop){
|
||||
// INSTRUCTION.VoltConstant = IV->_VStop;
|
||||
// }
|
||||
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DAC_outputV(DACOutCode);
|
||||
|
||||
// end IV task if we reach INSTRUCTION.VoltFinal
|
||||
// if (INSTRUCTION.VoltConstant >= IV->_VStop) {
|
||||
// PeriodicEvent = false;
|
||||
// DACReset = true;
|
||||
// }
|
||||
} else {
|
||||
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant - IV->_Step;
|
||||
|
||||
// check if DACUserCode underflow
|
||||
if(INSTRUCTION.VoltConstant >= 60000){
|
||||
INSTRUCTION.VoltConstant = IV->_VStop;
|
||||
}
|
||||
|
||||
// output the next output volt
|
||||
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant);
|
||||
DAC_outputV(DACOutCode);
|
||||
|
||||
// end IV task if we reach INSTRUCTION.VoltFinal
|
||||
// if (INSTRUCTION.VoltConstant <= IV->_VStop){
|
||||
// PeriodicEvent = false;
|
||||
// DACReset = true;
|
||||
//// reset();
|
||||
// }
|
||||
}
|
||||
|
||||
// if (IV->_VoVi_Switch == 0x00 || IV->_VoVi_Switch == 0x01){ //user see Vout/user see Vin
|
||||
// if (IV->_VOrigin < IV->_VStop) {
|
||||
// if(INSTRUCTION.VoltConstant >= IV->_VStop){
|
||||
// PeriodicEvent = false;
|
||||
// DACReset = true;
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// if(INSTRUCTION.VoltConstant <= IV->_VStop){
|
||||
// PeriodicEvent = false;
|
||||
// DACReset = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// int32_t RealV;
|
||||
// RealV = DAC_to_realV(DACOutCode);
|
||||
// NotifyVolt[0] = (uint8_t)((RealV & 0xFF000000) >> 24);
|
||||
// NotifyVolt[1] = (uint8_t)((RealV & 0x00FF0000) >> 16);
|
||||
// NotifyVolt[2] = (uint8_t)((RealV & 0x0000FF00) >> 8);
|
||||
// NotifyVolt[3] = (uint8_t)(RealV & 0x000000FF);
|
||||
|
||||
// int32_t RealV;
|
||||
// RealV = (int32_t)(INSTRUCTION.VoltConstant - 25000)/5*1000;
|
||||
// NotifyVolt[0] = (uint8_t)((RealV & 0xFF000000) >> 24);
|
||||
// NotifyVolt[1] = (uint8_t)((RealV & 0x00FF0000) >> 16);
|
||||
// NotifyVolt[2] = (uint8_t)((RealV & 0x0000FF00) >> 8);
|
||||
// NotifyVolt[3] = (uint8_t)(RealV & 0x000000FF);
|
||||
|
||||
|
||||
// NotifyImpedance[0] = 0x00;
|
||||
// NotifyImpedance[1] = 0x00;
|
||||
// NotifyImpedance[2] = (uint8_t)((INSTRUCTION.VoltConstant & 0xFF00) >> 8);
|
||||
// NotifyImpedance[3] = (uint8_t)(INSTRUCTION.VoltConstant & 0x00FF);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return DACOutCode;
|
||||
}
|
||||
|
||||
static void IV_Plot(IVMode *IV) {
|
||||
static uint8_t VoltCurrentSwitch = 0;
|
||||
static uint8_t PreviousGain = GAIN_200R;
|
||||
uint16_t ADC_measure = 0;
|
||||
|
||||
if(VoltCurrentSwitch < 5){
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
VoltCurrentSwitch ++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 5){
|
||||
// read current
|
||||
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
IV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
if(PreviousGain != INSTRUCTION.ADCGainLevel){
|
||||
PreviousGain = INSTRUCTION.ADCGainLevel;
|
||||
IV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
IV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
if(PreviousGain != INSTRUCTION.ADCGainLevel){
|
||||
PreviousGain = INSTRUCTION.ADCGainLevel;
|
||||
IV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
IV->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
}
|
||||
else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
IV->_MeasureData = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
VoltCurrentSwitch ++;
|
||||
}
|
||||
// else if(VoltCurrentSwitch < 9){
|
||||
// // read volt
|
||||
// ReadVolt(spi_ADC_rxbuf);
|
||||
// VoltCurrentSwitch++;
|
||||
// }
|
||||
// else if(VoltCurrentSwitch == 9){
|
||||
// /** read battery voltage **/
|
||||
// ReadVolt(spi_ADC_rxbuf);
|
||||
// ADC_measure = (uint16_t) (spi_ADC_rxbuf[0] << 8) | (uint16_t) (spi_ADC_rxbuf[1]);
|
||||
// IV->MeasureVolt = DecodeADCVolt(ADC_measure);
|
||||
// VoltCurrentSwitch++;
|
||||
// }
|
||||
else if(VoltCurrentSwitch < 9){
|
||||
if(IV->_VoVi_Switch == 0x01){
|
||||
// read vin volt
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
}else if(IV->_VoVi_Switch == 0x00){
|
||||
// read vout volt
|
||||
ReadVoutVolt(spi_ADC_rxbuf);
|
||||
}
|
||||
VoltCurrentSwitch++;
|
||||
}
|
||||
else if(VoltCurrentSwitch == 9){
|
||||
if(IV->_VoVi_Switch == 0x01){
|
||||
// read vin volt
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
ADC_measure = (uint16_t) (spi_ADC_rxbuf[0] << 8) | (uint16_t) (spi_ADC_rxbuf[1]);
|
||||
IV->MeasureVolt = DecodeADCVolt(ADC_measure);
|
||||
}else if(IV->_VoVi_Switch == 0x00){
|
||||
// read vout volt
|
||||
ReadVoutVolt(spi_ADC_rxbuf);
|
||||
ADC_measure = (uint16_t) (spi_ADC_rxbuf[0] << 8) | (uint16_t) (spi_ADC_rxbuf[1]);
|
||||
IV->MeasureVolt = DecodeADCVoutVolt(ADC_measure);
|
||||
}
|
||||
VoltCurrentSwitch++;
|
||||
}
|
||||
// else if (VoltCurrentSwitch < 13){
|
||||
// ReadBatVolt(spi_ADC_rxbuf);
|
||||
// VoltCurrentSwitch ++;
|
||||
// }
|
||||
// else if (VoltCurrentSwitch == 13){
|
||||
// // read battery volt
|
||||
// ReadBatVolt(spi_ADC_rxbuf);
|
||||
// ADC_measure = (uint16_t) (spi_ADC_rxbuf[0] << 8) | (uint16_t) (spi_ADC_rxbuf[1]);
|
||||
// IV->_MeasureBatvolt = DecodeADCBatVolt(ADC_measure);
|
||||
// IV->_MeasureBatvolt = IV->_MeasureBatvolt/10 - 250; // (5.00V) 5000->250 usercode
|
||||
// VoltCurrentSwitch ++;
|
||||
// }
|
||||
else{
|
||||
VoltCurrentSwitch = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NotifyCurrent[0] = (uint8_t) (IV->_MeasureData >> 24);
|
||||
NotifyCurrent[1] = (uint8_t) ((IV->_MeasureData & 0x00FF0000) >> 16);
|
||||
NotifyCurrent[2] = (uint8_t) ((IV->_MeasureData & 0x0000FF00) >> 8);
|
||||
NotifyCurrent[3] = (uint8_t) (IV->_MeasureData & 0x000000FF);
|
||||
|
||||
// if((IV->_VoVi_Switch == 0x01) || (IV->_VoVi_Switch == 0x00)){ //user see Vin || user see Vout
|
||||
//// NotifyVolt[0] = (uint8_t) (IV->MeasureVolt >> 24);
|
||||
//// NotifyVolt[1] = (uint8_t) ((IV->MeasureVolt & 0x00FF0000) >> 16);
|
||||
//// NotifyVolt[2] = (uint8_t) ((IV->MeasureVolt & 0x0000FF00) >> 8);
|
||||
//// NotifyVolt[3] = (uint8_t) (IV->MeasureVolt & 0x000000FF);
|
||||
// int32_t RealV;
|
||||
// RealV = (int32_t)(INSTRUCTION.VoltConstant - 25000)/5*1000;
|
||||
// NotifyVolt[0] = (uint8_t)((RealV & 0xFF000000) >> 24);
|
||||
// NotifyVolt[1] = (uint8_t)((RealV & 0x00FF0000) >> 16);
|
||||
// NotifyVolt[2] = (uint8_t)((RealV & 0x0000FF00) >> 8);
|
||||
// NotifyVolt[3] = (uint8_t)(RealV & 0x000000FF);
|
||||
//
|
||||
// if (IV->_VOrigin < IV->_VStop) {
|
||||
// if((IV->MeasureVolt/1000) >= ((int32_t) (IV->_VStop) - DAC_ZERO)/5){
|
||||
// PeriodicEvent = false;
|
||||
// DACReset = true;
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// if((IV->MeasureVolt/1000) <= ((int32_t) (IV->_VStop) - DAC_ZERO)/5){
|
||||
// PeriodicEvent = false;
|
||||
// DACReset = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (IV->_VoVi_Switch == 0x00 || IV->_VoVi_Switch == 0x01){ //user see Vout/user see Vin
|
||||
int32_t RealV;
|
||||
RealV = (int32_t)(INSTRUCTION.VoltConstant - 25000)*1000/5;
|
||||
NotifyVolt[0] = (uint8_t)((RealV & 0xFF000000) >> 24);
|
||||
NotifyVolt[1] = (uint8_t)((RealV & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t)((RealV & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t)(RealV & 0x000000FF);
|
||||
|
||||
if (IV->_VOrigin < IV->_VStop) {
|
||||
if(INSTRUCTION.VoltConstant >= IV->_VStop){
|
||||
PeriodicEvent = false;
|
||||
DACReset = true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(INSTRUCTION.VoltConstant <= IV->_VStop){
|
||||
PeriodicEvent = false;
|
||||
DACReset = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NotifyBatVolt = (uint8_t) (IV->_MeasureBatvolt & 0x000000FF);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+270
-104
@@ -1,84 +1,215 @@
|
||||
#ifndef __INSTR_H__
|
||||
#define __INSTR_H__
|
||||
|
||||
#ifndef ELITEINSTRUCTION
|
||||
#define ELITEINSTRUCTION
|
||||
|
||||
/** ADC gain level **/
|
||||
#define GAIN_200K 0x00 // largest gain
|
||||
#define GAIN_10K 0x01
|
||||
#define GAIN_200R 0x02 // the least gain
|
||||
#define GAIN_AUTO 0x03
|
||||
|
||||
/** Resister meter **/
|
||||
#define RESISTER_METER_SMALL 0x00
|
||||
#define RESISTER_METER_MIDDLE1 0x01
|
||||
#define RESISTER_METER_MIDDLE2 0x02
|
||||
#define RESISTER_METER_LARGE 0x03
|
||||
|
||||
/** CC mode parameter **/
|
||||
// CurrentLV
|
||||
#define CURRENT_LV_NA 0x00
|
||||
#define CURRENT_LV_UA 0x01
|
||||
#define CURRENT_LV_MA 0x02
|
||||
|
||||
/* DAC reset parameter */
|
||||
#define DAC_ZERO 25000
|
||||
#define DAC_POS_MAX 0x0000
|
||||
#define DAC_NEG_MAX 0xFFFF
|
||||
|
||||
// Step time macro
|
||||
#define STEPTIME_HALF_SEC 5000
|
||||
#define STEPTIME_ONE_SEC 10000
|
||||
#define STEPTIME_TWO_SEC 20000
|
||||
#ifdef __cpulsplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*==============================
|
||||
==== headstage instruction ====
|
||||
=============================*/
|
||||
struct HEADSTAGE_INSTRUCTION {
|
||||
/** chip ID */
|
||||
uint8_t chip_id;
|
||||
|
||||
/** Sample rate **/
|
||||
// SampleRate = SampleRateTable[SampleRateIndex]
|
||||
uint8_t SampleRateIndex;
|
||||
uint32_t SampleRate;
|
||||
uint8_t chip_id;
|
||||
uint8_t eliteFxn;
|
||||
|
||||
/** DAC parameter **/
|
||||
// volt san parameter
|
||||
uint16_t VoltOrigin;
|
||||
uint16_t VoltFinal;
|
||||
uint16_t Step;
|
||||
uint16_t StepTime;
|
||||
|
||||
// constant volt
|
||||
// which is used in CC mode as VMax and VMin
|
||||
uint8_t VsetRateIndex;
|
||||
uint32_t VsetRate;
|
||||
int32_t Vset;
|
||||
uint16_t VoltConstant;
|
||||
uint8_t directionInit;
|
||||
uint32_t step;
|
||||
uint16_t Ve1;
|
||||
uint16_t Ve2;
|
||||
int32_t Vinit;
|
||||
int32_t Vmax;
|
||||
int32_t Vmin;
|
||||
|
||||
/** EIS **/
|
||||
uint32_t f1;
|
||||
uint32_t f2;
|
||||
uint32_t fmax;
|
||||
uint32_t fmin;
|
||||
uint32_t fset;
|
||||
uint16_t dcbias;
|
||||
uint16_t delay;
|
||||
uint16_t acamp;
|
||||
uint8_t avgnum;
|
||||
uint8_t rtia;
|
||||
uint16_t ppd;
|
||||
uint8_t scale;
|
||||
int32_t real;
|
||||
int32_t imag;
|
||||
uint8_t periodIndex;
|
||||
uint32_t delayTime;
|
||||
uint8_t settingIndex;
|
||||
|
||||
|
||||
/** ADC parameter **/
|
||||
uint8_t ADCGainLevel;
|
||||
uint8_t notifyRateIndex;
|
||||
uint32_t sampleRate;
|
||||
uint8_t VoViSwitch;
|
||||
uint8_t AutoGainEnable;
|
||||
uint8_t VinAutoGainEnable;
|
||||
uint8_t VoutAutoGainEnable;
|
||||
uint8_t ADCGainLv;
|
||||
|
||||
uint8_t AutoGainEnable;
|
||||
// voltage output gain
|
||||
uint16_t VoutGainLevel;
|
||||
uint8_t VinADCGainLv;
|
||||
|
||||
/** Notify parameter **/
|
||||
uint16_t NotifyRate;
|
||||
uint32_t notifyRate;
|
||||
|
||||
/** Constant Current Parameter **/
|
||||
// Charge is a bool; true => current > 0, vice versa
|
||||
uint8_t Charge;
|
||||
int32_t ConstantCurrent;
|
||||
uint16_t VoltLimit;
|
||||
/** mode parameter **/
|
||||
uint16_t cycleNumber;
|
||||
uint8_t charge;
|
||||
int32_t constantCurrent;
|
||||
int32_t Currentmax;
|
||||
int32_t sti_v1;
|
||||
int32_t sti_v2;
|
||||
int32_t sti_v3;
|
||||
int32_t sti_v4;
|
||||
int32_t sti_v5;
|
||||
int32_t sti_v6;
|
||||
int32_t sti_v7;
|
||||
int32_t sti_t1;
|
||||
int32_t sti_t2;
|
||||
int32_t sti_t3;
|
||||
int32_t sti_t4;
|
||||
int32_t sti_t5;
|
||||
int32_t sti_t6;
|
||||
int32_t sti_t7;
|
||||
uint16_t sti_cy;
|
||||
uint16_t sti_loop;
|
||||
|
||||
/** Resister Measure **/
|
||||
uint8_t ResisterMeter;
|
||||
uint16_t StepTime;
|
||||
|
||||
// elite function
|
||||
uint8_t eliteFxn;
|
||||
uint8_t AdcChannel;
|
||||
|
||||
uint8_t CycleNumber;
|
||||
/* EIS DAC parameter */
|
||||
uint8_t DAC_type;
|
||||
uint16_t VAmpSet; // DAC Voltage Amplitude
|
||||
|
||||
uint8_t VoVi_Switch;
|
||||
/* EIS ADC parameter */
|
||||
uint8_t HSTIAGainLv;
|
||||
uint8_t HSTIAAutoGainEnable;
|
||||
uint8_t LPTIAGainLv;
|
||||
uint8_t LPTIAAutoGainEnable;
|
||||
} instru = {0};
|
||||
|
||||
} INSTRUCTION = {0};
|
||||
/** Iin, Vin, Vout **/
|
||||
#define EIS_HSTIA 0x00
|
||||
#define EIS_LPTIA 0x01
|
||||
#define EIS_HSDAC 0x02
|
||||
#define EIS_LPDAC 0x03
|
||||
#define VOUT_DAC 0x04
|
||||
#define IIN_ADC 0x05
|
||||
#define VIN_ADC 0x06
|
||||
#define HIGH_Z 0x07
|
||||
|
||||
/** ADC Iin gain level **/
|
||||
#define I_GAIN_3M 0x07 // largest gain
|
||||
#define I_GAIN_100K 0x08
|
||||
#define I_GAIN_3K 0x09
|
||||
#define I_GAIN_100R 0x0A // the least gain
|
||||
#define I_GAIN_AUTO 0x04
|
||||
|
||||
// EIS LPTIA Iin Gain Level //
|
||||
#define LPRTIA_512K 0x00
|
||||
#define LPRTIA_12K 0x01
|
||||
#define LPRTIA_4K 0x02
|
||||
#define LPRTIA_200R 0x03
|
||||
#define LPRTIA_GAIN_AUTO 0x04
|
||||
|
||||
// EIS HSTIA Iin Gain Level
|
||||
#define HSRTIA_160K 0x00
|
||||
#define HSRTIA_20K 0x01
|
||||
#define HSRTIA_5K 0x02
|
||||
#define HSRTIA_200R 0x03
|
||||
#define HSRTIA_GAIN_AUTO 0x04
|
||||
|
||||
/** ADC Vin gain level **/
|
||||
#define VIN_GAIN_1M 0x00
|
||||
#define VIN_GAIN_30K 0x01
|
||||
#define VIN_GAIN_1K 0x02
|
||||
#define VIN_GAIN_AUTO 0x03
|
||||
|
||||
/** Vout gain level **/
|
||||
#define VOUT_GAIN_240K 0x00
|
||||
#define VOUT_GAIN_15K 0x01
|
||||
#define VOUT_GAIN_AUTO 0x02
|
||||
|
||||
/* DAC reset parameter */
|
||||
#define DAC_ZERO 25000
|
||||
#define EIS_HSDAC_ZERO 0x0800
|
||||
|
||||
// Step time macro
|
||||
#define STEPTIME_HALF_SEC 5000
|
||||
#define STEPTIME_ONE_SEC 10000
|
||||
#define STEPTIME_TWO_SEC 20000
|
||||
|
||||
/* AVG Number */
|
||||
#define AVG2 0
|
||||
#define AVG4 1
|
||||
#define AVG8 2
|
||||
#define AVG16 3
|
||||
|
||||
#define ADC1M6sps 0
|
||||
#define ADC800Ksps 1
|
||||
|
||||
#define Sinc3OSR5 0
|
||||
#define Sinc3OSR4 1
|
||||
#define Sinc3OSR2 2
|
||||
|
||||
#define Sinc2OSR22 0
|
||||
#define Sinc2OSR44 1
|
||||
#define Sinc2OSR89 2
|
||||
#define Sinc2OSR178 3
|
||||
#define Sinc2OSR267 4
|
||||
#define Sinc2OSR533 5
|
||||
#define Sinc2OSR640 6
|
||||
#define Sinc2OSR667 7
|
||||
#define Sinc2OSR800 8
|
||||
#define Sinc2OSR889 9
|
||||
#define Sinc2OSR1067 10
|
||||
#define Sinc2OSR1333 11
|
||||
|
||||
#define DFTNUM4 0
|
||||
#define DFTNUM8 1
|
||||
#define DFTNUM16 2
|
||||
#define DFTNUM32 3
|
||||
#define DFTNUM64 4
|
||||
#define DFTNUM128 5
|
||||
#define DFTNUM256 6
|
||||
#define DFTNUM512 7
|
||||
#define DFTNUM1024 8
|
||||
#define DFTNUM2048 9
|
||||
#define DFTNUM4096 10
|
||||
#define DFTNUM8192 11
|
||||
#define DFTNUM16384 12
|
||||
|
||||
#define AD5940_SYS_CLOCK 16000000
|
||||
#define Cutoff_Freq 37000000 // 210kHz
|
||||
|
||||
///* LPTIA gain Level */
|
||||
//#define LPRTIA200R 1 //Max 3mA
|
||||
//#define LPRTIA4K 5 //Max 220uA
|
||||
//#define LPRTIA12K 9 //Max 74uA
|
||||
//#define LPRTIA512K 26 //Max 1.76uA
|
||||
|
||||
static uint32_t HSRTIATable[4] = {160000, 20000, 5000, 200};
|
||||
|
||||
/* HSTIA gain level (feedback R value) */
|
||||
#define RTIA200R 0x00 // 200R
|
||||
#define RTIA1k 0x01 // 1k
|
||||
#define RTIA5k 0x02 // 5k
|
||||
#define RTIA10k 0x03 // 10k
|
||||
#define RTIA20k 0x04 // 20k
|
||||
#define RTIA40k 0x05 // 40k
|
||||
#define RTIA80k 0x06 // 80k
|
||||
#define RTIA160k 0x07 // 160k
|
||||
#define RTIAopen 0x08 // RTIA is open
|
||||
/*********************************************************************
|
||||
* @fn InitEliteInstruction
|
||||
*
|
||||
@@ -89,51 +220,86 @@ struct HEADSTAGE_INSTRUCTION {
|
||||
* @return None.
|
||||
*/
|
||||
static void InitEliteInstruction(){
|
||||
INSTRUCTION.chip_id = 0;
|
||||
INSTRUCTION.SampleRateIndex = 1;
|
||||
INSTRUCTION.SampleRate = 100;
|
||||
INSTRUCTION.VoltOrigin = DAC_ZERO;
|
||||
INSTRUCTION.VoltFinal = DAC_ZERO;
|
||||
INSTRUCTION.Step = 0x0005; // 0x0005 = 1mV
|
||||
INSTRUCTION.StepTime = STEPTIME_ONE_SEC; // about 0.5 sec
|
||||
INSTRUCTION.VoltConstant = DAC_ZERO; // is about 0V
|
||||
INSTRUCTION.ADCGainLevel = GAIN_AUTO;
|
||||
INSTRUCTION.AutoGainEnable = 1;
|
||||
INSTRUCTION.NotifyRate = STEPTIME_ONE_SEC/10;
|
||||
INSTRUCTION.ResisterMeter = RESISTER_METER_LARGE;
|
||||
INSTRUCTION.Charge = 1;
|
||||
INSTRUCTION.ConstantCurrent = 0x00000000;
|
||||
INSTRUCTION.VoltLimit = 0x0000;
|
||||
INSTRUCTION.eliteFxn = 0; // default is a null event
|
||||
INSTRUCTION.CycleNumber = 0;
|
||||
INSTRUCTION.VoVi_Switch = 0x01; //VoVi_Switch == 0 => user see Vo / VoVi_Switch == 1 => user see Vi
|
||||
instru.chip_id = 0;
|
||||
instru.eliteFxn = 0; //default is a null event
|
||||
instru.VsetRateIndex = 0;
|
||||
instru.VsetRate = 2;
|
||||
instru.Vset = 0;
|
||||
instru.VoltConstant = DAC_ZERO; //DAC_ZERO is about 0V
|
||||
instru.directionInit = 1; //0:reverse 1:forward
|
||||
instru.step = 0;
|
||||
instru.Ve1 = DAC_ZERO;
|
||||
instru.Ve2 = DAC_ZERO;
|
||||
instru.Vinit = 0;
|
||||
instru.Vmax = 0;
|
||||
instru.Vmin = 0;
|
||||
instru.notifyRateIndex = 100;
|
||||
instru.sampleRate = 15;
|
||||
instru.VoViSwitch = 0x01; //0:user see Vo 1: user see Vi
|
||||
instru.AutoGainEnable = 1;
|
||||
instru.VinAutoGainEnable = 1;
|
||||
instru.VoutAutoGainEnable = 1;
|
||||
instru.ADCGainLv = I_GAIN_AUTO;
|
||||
instru.VoutGainLevel = VOUT_GAIN_AUTO;
|
||||
instru.VinADCGainLv = VIN_GAIN_AUTO;
|
||||
instru.notifyRate = STEPTIME_ONE_SEC;
|
||||
instru.cycleNumber = 1;
|
||||
instru.charge = 1; //0:discharge 1:charge
|
||||
instru.constantCurrent = 0;
|
||||
instru.Currentmax = 0;
|
||||
instru.StepTime = STEPTIME_ONE_SEC;
|
||||
instru.AdcChannel = 0;
|
||||
|
||||
//EIS
|
||||
instru.f1 = 0;
|
||||
instru.f2 = 0;
|
||||
instru.fset = 0;
|
||||
instru.fmax = 0;
|
||||
instru.fmin = 0;
|
||||
instru.delay = 0;
|
||||
instru.scale = 0;
|
||||
instru.avgnum = 0;
|
||||
instru.dcbias = 0;
|
||||
instru.acamp = 0;
|
||||
instru.rtia = 0;
|
||||
instru.ppd = 1;
|
||||
instru.periodIndex = 0;
|
||||
instru.delayTime = 0;
|
||||
instru.settingIndex = 0;
|
||||
|
||||
|
||||
//pulse mode
|
||||
instru.sti_t1 = 0;
|
||||
instru.sti_t2 = 0;
|
||||
instru.sti_t3 = 0;
|
||||
instru.sti_t4 = 0;
|
||||
instru.sti_t5 = 0;
|
||||
instru.sti_t6 = 0;
|
||||
instru.sti_t7 = 0;
|
||||
instru.sti_v1 = DAC_ZERO;
|
||||
instru.sti_v2 = DAC_ZERO;
|
||||
instru.sti_v3 = DAC_ZERO;
|
||||
instru.sti_v4 = DAC_ZERO;
|
||||
instru.sti_v5 = DAC_ZERO;
|
||||
instru.sti_v6 = DAC_ZERO;
|
||||
instru.sti_v7 = DAC_ZERO;
|
||||
instru.sti_loop = 1;
|
||||
instru.sti_cy = 0;
|
||||
|
||||
// EIS DAC
|
||||
instru.VAmpSet = EIS_HSDAC_ZERO;
|
||||
instru.DAC_type = EIS_HSDAC;
|
||||
|
||||
// EIS ADC
|
||||
instru.HSTIAGainLv = 0;
|
||||
instru.HSTIAAutoGainEnable = 1;
|
||||
instru.LPTIAGainLv = 0;
|
||||
instru.LPTIAAutoGainEnable = 1;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* @fn GetInstructionParameter
|
||||
*
|
||||
* @brief Get Constant Current mode parameter.
|
||||
*
|
||||
* @param ins - instruction including current value and unit
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
static void GetInstructionParameter(uint8 *ins){
|
||||
// CurrentLV=0 => unit is nA
|
||||
// CurrentLV=1 => unit is uA
|
||||
// CurrentLV=2 => unit is mA
|
||||
// INSTRUCTION.CurrentLV = (*ins);
|
||||
|
||||
// ConstantCurrentRange=0 => current value is 0~499
|
||||
// ConstantCurrentRange=1 => current value is 500~999
|
||||
// INSTRUCTION.ConstantCurrentRange = (*ins) & 0x0F;
|
||||
|
||||
// ConstantCurrent divide ConstantCurrentRange into 50000 count (thus each count is 0.01)
|
||||
// e.g. 485.7 uA can be represent by
|
||||
// CurrentLV = 1 (unit is uA)
|
||||
// ConstantCurrentRange = 0 (current range is 0~499)
|
||||
// ConstantCurrent = 48570
|
||||
INSTRUCTION.ConstantCurrent = (uint32_t) (*(ins+1))<<24 | (uint32_t) (*(ins+2))<<16 | (uint32_t) (*(ins+3))<<8 | (uint32_t) (*(ins+4));
|
||||
#ifdef __cpulsplus
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
+21
-14
@@ -2,25 +2,33 @@
|
||||
#ifndef ELITEKEYDETECT
|
||||
#define ELITEKEYDETECT
|
||||
|
||||
#define CLOCK_ONE_SECOND 10000
|
||||
|
||||
static bool TurnOnElite(uint8_t key) {
|
||||
static uint16_t TurnOnCounter = 0;
|
||||
|
||||
if (key == 0) {
|
||||
// press 1 sec, power on LED
|
||||
// press 1 sec, power on LED, read bat power
|
||||
if (TurnOnCounter >= CLOCK_ONE_SECOND) {
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 1); // enable 5V
|
||||
TurnOn10V();
|
||||
LEDPowerON();
|
||||
return true;
|
||||
// headstage_battery_volt();
|
||||
// uint16_t bat = ((uint16_t)(NotifyVoltBat[2]) << 8 & 0xFF00 ) |
|
||||
// ((uint16_t)(NotifyVoltBat[3]) & 0x00FF);
|
||||
// if( bat < 768 && bat > 20){
|
||||
// PIN_setOutputValue(pin_handle, enable_5v, 0);
|
||||
// return false;
|
||||
// }else{
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 1); // enable 5V
|
||||
Elite_SPI_init();
|
||||
// TurnOn10V();
|
||||
ModeLED(BT_WAIT);
|
||||
AD5940_init();
|
||||
return true;
|
||||
// }
|
||||
} else {
|
||||
TurnOnCounter++;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
TurnOnCounter = 0;
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 0); // enable 5V
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 0); // disable 5V
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -34,7 +42,7 @@ static void EliteKeyPress(uint8_t key) {
|
||||
// press key => bight LED
|
||||
|
||||
if (ShutDownCounter == CLOCK_ONE_SECOND) {
|
||||
KeyWorkModeLED();
|
||||
KEYLED();
|
||||
}
|
||||
|
||||
// press 3~4 sec, shutdown 2650
|
||||
@@ -44,19 +52,18 @@ static void EliteKeyPress(uint8_t key) {
|
||||
}
|
||||
ShutDownCounter ++;
|
||||
} else {
|
||||
if (OriginEliteFxn == INSTRUCTION.eliteFxn) { // old function == currunt instruction
|
||||
if (OriginEliteFxn == instru.eliteFxn) { // old function == currunt instruction
|
||||
if (ShutDownCounter != 0) {
|
||||
// dark LED
|
||||
WorkModeLED();
|
||||
checkFlafLED();
|
||||
ShutDownCounter = 0;
|
||||
}
|
||||
} else { // old function != currunt instruction
|
||||
OriginEliteFxn = INSTRUCTION.eliteFxn;
|
||||
OriginEliteFxn = instru.eliteFxn;
|
||||
if (ShutDownCounter != 0) {
|
||||
ShutDownCounter = 0;
|
||||
}
|
||||
// dark mode LED
|
||||
WorkModeLED();
|
||||
checkFlafLED();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+149
-99
@@ -2,12 +2,10 @@
|
||||
#ifndef ELITELED
|
||||
#define ELITELED
|
||||
|
||||
#define DARKLED 0xE1
|
||||
#define LIGHTLED 0xE8
|
||||
static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue);
|
||||
#define LEDPowerON() LED_color(DARKLED, 0x00, 0xFA, 0x00)
|
||||
#define WORKLED() LED_color(0xE2, 0x00, 0x40, 0x40)
|
||||
#define KEYLED() LED_color(LIGHTLED, 0xF0, 0xA0, 0x00)
|
||||
#define DARKLED 0xE1
|
||||
#define LIGHTLED 0xE8
|
||||
|
||||
static void WorkModeLED();
|
||||
|
||||
static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue) {
|
||||
spi_LEDtxbuf[0] = 0x0000;
|
||||
@@ -23,57 +21,112 @@ static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue)
|
||||
LED_SPI(SPI_LED_SIZE, spi_LEDtxbuf, spi_LEDrxbuf);
|
||||
}
|
||||
|
||||
static void WorkModeLED() {
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IV_CURVE: {
|
||||
WORKLED();
|
||||
static void Elite_led_color(uint16_t color){
|
||||
switch (color) {
|
||||
case COLOR_RED: {
|
||||
LED_color(DARKLED, 0xFF, 0x00, 0x00);
|
||||
break;
|
||||
}
|
||||
case COLOR_ORANGE: {
|
||||
LED_color(DARKLED, 0xFF, 0x58, 0x09);
|
||||
break;
|
||||
}
|
||||
case COLOR_YELLOW: {
|
||||
LED_color(LIGHTLED, 0xFF, 0x80, 0x00);
|
||||
break;
|
||||
}
|
||||
case COLOR_GREEN: {
|
||||
LED_color(DARKLED, 0x00, 0xFA, 0x00);
|
||||
break;
|
||||
}
|
||||
case COLOR_YELLOWGREEN: {
|
||||
LED_color(DARKLED, 0x64, 0xA6, 0x00);
|
||||
break;
|
||||
}
|
||||
case COLOR_BLUE: {
|
||||
LED_color(DARKLED, 0x00, 0x00, 0xAA);
|
||||
break;
|
||||
}
|
||||
case COLOR_CYAN: {
|
||||
LED_color(DARKLED, 0x00, 0x40, 0x40);
|
||||
break;
|
||||
}
|
||||
case COLOR_MAGENTA: {
|
||||
LED_color(DARKLED, 0xFF, 0x00, 0x80);
|
||||
break;
|
||||
}
|
||||
case COLOR_PURPLE: {
|
||||
LED_color(DARKLED, 0xFF, 0x00, 0xFF);
|
||||
break;
|
||||
}
|
||||
case COLOR_WHITE: {
|
||||
LED_color(DARKLED, 0xCA, 0xFF, 0xFF);
|
||||
break;
|
||||
}
|
||||
case COLOR_BLACK: {
|
||||
LED_color(0x00, 0x00, 0x00, 0x00);
|
||||
break;
|
||||
}
|
||||
//dark LED
|
||||
case COLOR_YELLOW_DARK: {
|
||||
LED_color(DARKLED, 0xFF, 0x80, 0x00);
|
||||
break;
|
||||
}
|
||||
case COLOR_GREEN_DARK: {
|
||||
LED_color(DARKLED, 0x00, 0x33, 0x00);
|
||||
break;
|
||||
}
|
||||
case COLOR_BLUE_DARK: {
|
||||
LED_color(DARKLED, 0x00, 0x00, 0x33);
|
||||
break;
|
||||
}
|
||||
case COLOR_CYAN_DARK: {
|
||||
LED_color(DARKLED, 0x00, 0x10, 0x10);
|
||||
break;
|
||||
}
|
||||
case COLOR_PURPLE_DARK: {
|
||||
LED_color(DARKLED, 0x55, 0x00, 0x55);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ModeLED(uint16_t modeStatus) {
|
||||
btWaitLedFlag = 0;
|
||||
noEventLedFlag = 0;
|
||||
preWorkLedFlag = 0;
|
||||
workingLedFlag = 0;
|
||||
postWorkLedFlag = 0;
|
||||
|
||||
switch (modeStatus) {
|
||||
case BT_WAIT: {
|
||||
btWaitLedFlag = 1;
|
||||
BT_WAIT_LED();
|
||||
break;
|
||||
}
|
||||
case CV_CURVE: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case DIFFERENTIAL_PULSE_VOLTAMMETRY: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case SQUARE_WAVE_VOLTAMMETRY: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case VOLT_OUTPUT: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case VT_CURVE: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case IT_CURVE: {
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
WORKLED();
|
||||
break;
|
||||
}
|
||||
case VIS_RST: {
|
||||
case NO_EVENT: {
|
||||
noEventLedFlag = 1;
|
||||
LEDPowerON();
|
||||
break;
|
||||
}
|
||||
case ADC_TEST: {
|
||||
WORKLED();
|
||||
case PRE_WORK: {
|
||||
preWorkLedFlag = 1;
|
||||
Elite_led_color(COLOR_BLUE);
|
||||
break;
|
||||
}
|
||||
case READ_VOUT_VALUE: {
|
||||
WORKLED();
|
||||
case WORKING: {
|
||||
workingLedFlag = 1;
|
||||
WorkModeLED();
|
||||
break;
|
||||
}
|
||||
case POST_WORK: {
|
||||
postWorkLedFlag = 1;
|
||||
Elite_led_color(COLOR_BLUE);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
LEDPowerON();
|
||||
break;
|
||||
@@ -81,58 +134,55 @@ static void WorkModeLED() {
|
||||
}
|
||||
}
|
||||
|
||||
static void KeyWorkModeLED() {
|
||||
KEYLED();
|
||||
/*
|
||||
switch(INSTRUCTION.eliteFxn){
|
||||
case IV_CURVE:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case CV_CURVE:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case DIFFERENTIAL_PULSE_VOLTAMMETRY:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case SQUARE_WAVE_VOLTAMMETRY:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case VOLT_OUTPUT:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case VT_CURVE:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case IT_CURVE:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
|
||||
case VIS_RST:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
case ADC_TEST:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
|
||||
default:{
|
||||
LED_color(LIGHTLED, 0xF0, 0xF0, 0x00);
|
||||
break;
|
||||
}
|
||||
static void checkFlafLED()
|
||||
{
|
||||
if(btWaitLedFlag == 1){
|
||||
ModeLED(BT_WAIT);
|
||||
}
|
||||
else if(noEventLedFlag == 1){
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
else if(preWorkLedFlag == 1){
|
||||
ModeLED(PRE_WORK);
|
||||
}
|
||||
else if(workingLedFlag == 1){
|
||||
ModeLED(WORKING);
|
||||
}
|
||||
else if(postWorkLedFlag == 1){
|
||||
ModeLED(POST_WORK);
|
||||
}
|
||||
}
|
||||
|
||||
static void WorkModeLED()
|
||||
{
|
||||
switch (instru.eliteFxn) {
|
||||
case CURVE_EIS:
|
||||
case CURVE_EIS_CV:
|
||||
WORKLED();
|
||||
break;
|
||||
|
||||
case CURVE_CALI_ADC:
|
||||
if (instru.AdcChannel == IIN_ADC) {
|
||||
Elite_led_color(COLOR_RED);
|
||||
} else if (instru.AdcChannel == VIN_ADC) {
|
||||
Elite_led_color(COLOR_ORANGE);
|
||||
} else if (instru.AdcChannel == VOUT_DAC) {
|
||||
Elite_led_color(COLOR_BLUE);
|
||||
}else if (instru.AdcChannel == EIS_HSDAC) {
|
||||
Elite_led_color(COLOR_PURPLE_DARK);
|
||||
} else if (instru.AdcChannel == EIS_HSTIA) {
|
||||
Elite_led_color(COLOR_WHITE);
|
||||
} else if (instru.AdcChannel == EIS_LPTIA) {
|
||||
Elite_led_color(COLOR_RED);
|
||||
} else if (instru.AdcChannel == EIS_LPDAC) {
|
||||
Elite_led_color(COLOR_BLUE);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
|
||||
#ifndef ELITE_LATCH_INIT
|
||||
#define ELITE_LATCH_INIT
|
||||
|
||||
static void InitLH() {
|
||||
for (int i=0; i<LATCH_BUFF_SIZE; i++) {
|
||||
LH.LATCH0[i] = 0;
|
||||
LH.LATCH1[i] = 0;
|
||||
LH.LATCH2[i] = 0;
|
||||
}
|
||||
LH.LoadState = 0;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+97
-47
@@ -1,15 +1,19 @@
|
||||
|
||||
#ifndef ELITENOTIFY
|
||||
#define ELITENOTIFY
|
||||
|
||||
#include "headstage.h"
|
||||
|
||||
/**
|
||||
* notify data buffer.
|
||||
* the length equals to the characteristic 4 which value is 20 bytes.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ELITENOTIFY
|
||||
#define ELITENOTIFY
|
||||
|
||||
#include "headstage.h"
|
||||
|
||||
/*notify's input type*/
|
||||
#define NOTIFY_CURRENT 0
|
||||
#define NOTIFY_VOLT 1
|
||||
#define NOTIFY_IMPEDANCE 2
|
||||
#define NOTIFY_VOLT_BAT 3
|
||||
|
||||
#define NOT_BUF_OFFSET_INIT 8
|
||||
|
||||
@@ -17,19 +21,15 @@
|
||||
* the index where to start insert data into buffer.
|
||||
* start from 6.
|
||||
*/
|
||||
static size_t not_buf_offset = NOT_BUF_OFFSET_INIT;
|
||||
|
||||
static size_t not_buf_offset = NOT_BUF_OFFSET_INIT;
|
||||
static uint32_t not_time_stamp;
|
||||
|
||||
static uint8_t NotifyCurrent[4] = {0};
|
||||
static uint8_t NotifyVolt[4] = {0};
|
||||
static uint8_t NotifyImpedance[4] = {0};
|
||||
static uint8_t NotifyBatVolt = 0;
|
||||
|
||||
/**
|
||||
* counter of notify send.
|
||||
*/
|
||||
static uint32_t notify_counter = 0;
|
||||
static uint8_t NotifyCurrent[4] = {0};
|
||||
static uint8_t NotifyVolt[4] = {0};
|
||||
static uint8_t NotifyImpedance[4] = {0};
|
||||
static uint8_t NotifyVoltBat[4] = {0};
|
||||
static uint16_t NotifyCycleNumber = 0;
|
||||
static uint8_t finishMode = 0;
|
||||
|
||||
// ****************** New Notify Format ******************************** //
|
||||
/*
|
||||
@@ -82,18 +82,20 @@ static uint32_t notify_counter = 0;
|
||||
0xFF
|
||||
|
||||
* header = device ID
|
||||
* I = current (0.001nA), V = voltage (mV),
|
||||
* Z = impedance (k ohm), T = time (ms)
|
||||
* I = current (nA), V = voltage (uV),
|
||||
* Z = impedance (ohm), T = time (ms)
|
||||
*
|
||||
*
|
||||
*/
|
||||
static void SendNotify() {
|
||||
not_buf[0] = INSTRUCTION.chip_id;
|
||||
initDATBuf();
|
||||
|
||||
not_buf[0] = instru.chip_id;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
not_buf[i + 1] = NotifyCurrent[i];
|
||||
not_buf[i + 5] = NotifyVolt[i];
|
||||
not_buf[i + 9] = NotifyImpedance[i];
|
||||
not_buf[i + 1] = NotifyCurrent[i]; // 1 2 3 4
|
||||
not_buf[i + 5] = NotifyVolt[i]; // 5 6 7 8
|
||||
not_buf[i + 9] = NotifyImpedance[i]; //9 10 11 12
|
||||
}
|
||||
|
||||
// 1 Timestamp = 32 usec; 31 Timestamp ~= 1 msec
|
||||
@@ -104,39 +106,87 @@ static void SendNotify() {
|
||||
not_buf[15] = (not_time_stamp >> 16) & 0xff;
|
||||
not_buf[16] = (not_time_stamp >> 24) & 0xff;
|
||||
|
||||
// cyclic voltametry cycle number
|
||||
not_buf[17] = INSTRUCTION.CycleNumber;
|
||||
not_buf[17] = (NotifyCycleNumber >> 8) & 0xff;
|
||||
not_buf[18] = NotifyCycleNumber & 0xff;
|
||||
|
||||
//battery volt
|
||||
not_buf[18] = NotifyBatVolt;
|
||||
not_buf[19] = (finishMode << 7) & 0x80 | instru.ADCGainLv & 0x0F;
|
||||
|
||||
for (int i = 20; i < BLE_DAT_BUFF_SIZE; i++){
|
||||
not_buf[i] = 0;
|
||||
}
|
||||
|
||||
SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
|
||||
}
|
||||
|
||||
static void initDATBuf(){
|
||||
for (int i = 0; i < BLE_DAT_BUFF_SIZE; i++){
|
||||
not_buf[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void initINSBuf(){
|
||||
for (int i = 0; i < BLE_INS_BUFF_SIZE; i++){
|
||||
ins_buf[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void initCISBuf(){
|
||||
for (int i = 0; i < BLE_CIS_BUFF_SIZE; i++){
|
||||
cis_buf[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void initRawDataBuf(){
|
||||
not_time_stamp = 0;
|
||||
NotifyCycleNumber = 0;
|
||||
finishMode = 0;
|
||||
|
||||
for (int i = 0; i < 4; i++){
|
||||
NotifyCurrent[i] = 0;
|
||||
NotifyVolt[i] = 0;
|
||||
NotifyImpedance[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void FlushNotify(){
|
||||
not_buf[0] = INSTRUCTION.chip_id;
|
||||
initRawDataBuf();
|
||||
initDATBuf();
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
not_buf[i + 1] = 0;
|
||||
not_buf[i + 5] = 0;
|
||||
not_buf[i + 9] = 0;
|
||||
}
|
||||
|
||||
// 1 Timestamp = 32 usec; 31 Timestamp ~= 1 msec
|
||||
not_time_stamp = 0; // msec
|
||||
|
||||
not_buf[13] = not_time_stamp & 0xff;
|
||||
not_buf[14] = (not_time_stamp >> 8) & 0xff;
|
||||
not_buf[15] = (not_time_stamp >> 16) & 0xff;
|
||||
not_buf[16] = (not_time_stamp >> 24) & 0xff;
|
||||
|
||||
// cyclic voltametry cycle number
|
||||
not_buf[17] = 0x00;
|
||||
|
||||
//battery volt
|
||||
not_buf[18] = 0x00;
|
||||
not_buf[0] = instru.chip_id;
|
||||
|
||||
SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
|
||||
}
|
||||
|
||||
static void InputNotify(int NotifyType, int32_t Data){
|
||||
|
||||
switch (NotifyType) {
|
||||
case NOTIFY_CURRENT:
|
||||
NotifyCurrent[0] = (uint8_t)((Data & 0xFF000000) >> 24);
|
||||
NotifyCurrent[1] = (uint8_t)((Data & 0x00FF0000) >> 16);
|
||||
NotifyCurrent[2] = (uint8_t)((Data & 0x0000FF00) >> 8);
|
||||
NotifyCurrent[3] = (uint8_t)(Data & 0x000000FF);
|
||||
break;
|
||||
|
||||
case NOTIFY_IMPEDANCE:
|
||||
NotifyImpedance[0] = (uint8_t)((Data & 0xFF000000) >> 24);
|
||||
NotifyImpedance[1] = (uint8_t)((Data & 0x00FF0000) >> 16);
|
||||
NotifyImpedance[2] = (uint8_t)((Data & 0x0000FF00) >> 8);
|
||||
NotifyImpedance[3] = (uint8_t)(Data & 0x000000FF);
|
||||
break;
|
||||
|
||||
case NOTIFY_VOLT :
|
||||
NotifyVolt[0] = (uint8_t)((Data & 0xFF000000) >> 24);
|
||||
NotifyVolt[1] = (uint8_t)((Data & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t)((Data & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t)(Data & 0x000000FF);
|
||||
break;
|
||||
|
||||
case NOTIFY_VOLT_BAT :
|
||||
NotifyVoltBat[0] = (uint8_t)((Data & 0xFF000000) >> 24);
|
||||
NotifyVoltBat[1] = (uint8_t)((Data & 0x00FF0000) >> 16);
|
||||
NotifyVoltBat[2] = (uint8_t)((Data & 0x0000FF00) >> 8);
|
||||
NotifyVoltBat[3] = (uint8_t)(Data & 0x000000FF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
|
||||
#ifndef ELITERVout
|
||||
#define ELITERVout
|
||||
|
||||
static void RVout_Plot(RVoutMode *RVout) {
|
||||
// ADC gain is don't care when measuring voltage
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
|
||||
// read ADC VoutVolt
|
||||
ReadVoutVolt(spi_ADC_rxbuf);
|
||||
|
||||
// decode ADC value and put it into notify buffer
|
||||
RVout->_MeasureData = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_DAC, spi_ADC_rxbuf);
|
||||
|
||||
NotifyVolt[0] = (uint8_t) (RVout->_MeasureData >> 24);
|
||||
NotifyVolt[1] = (uint8_t) ((RVout->_MeasureData & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t) ((RVout->_MeasureData & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t) (RVout->_MeasureData & 0x000000FF);
|
||||
}
|
||||
|
||||
#endif
|
||||
+34
-73
@@ -3,26 +3,26 @@
|
||||
#define ELITERESET
|
||||
|
||||
static void reset() {
|
||||
InitFlag();
|
||||
InitCT();
|
||||
mode_init = true;
|
||||
megaStiEnable = false;
|
||||
PeriodicEvent = false; // is there an PeriodicEvent?
|
||||
Free_Work_Mode = true; // Free(WorkModeData)
|
||||
InitPeriodicEvent = true; // need to create a WorkModeData?
|
||||
|
||||
// IV/CV mode reset
|
||||
DiscardIVFirstData = 0;
|
||||
avg_number = 0;
|
||||
ADCRealCurrent_long = 0;
|
||||
InitGPT();
|
||||
initINSBuf();
|
||||
initDATBuf();
|
||||
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
AD5940_HWReset();
|
||||
AD5940_init();
|
||||
// AD5940_sftreset();
|
||||
|
||||
if (INSTRUCTION.eliteFxn == CONSTANT_CURRENT){
|
||||
INSTRUCTION.eliteFxn = 0;
|
||||
// PIN_setOutputValue(pin_handle, HIGH_Z_MODE, 0); // HIGH Z MODE // 1: close; 0: open;
|
||||
|
||||
}
|
||||
|
||||
LEDPowerON();
|
||||
for (int i = 0; i < BLE_INS_BUFF_SIZE; i++) {
|
||||
ins_buf[i] = 0;
|
||||
}
|
||||
HSTIAGainCtrl(HSRTIA_200R);
|
||||
LPTIAGainCtrl(LPRTIA_200R);
|
||||
HSDAC_GainControl(0x00);
|
||||
HSDAC_output(0x0800);
|
||||
|
||||
for (int i = 0; i < SPI_LED_SIZE; i++) {
|
||||
spi_LEDtxbuf[i] = 0;
|
||||
@@ -39,30 +39,28 @@ static void reset() {
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < BLE_DAT_BUFF_SIZE; i++) {
|
||||
not_buf[i] = 0;
|
||||
}
|
||||
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 1); // AD_CS HIGH
|
||||
ModeLED(NO_EVENT);
|
||||
CPUdelay(1600);
|
||||
}
|
||||
|
||||
static void Eliteinterrupt() {
|
||||
InitFlag();
|
||||
InitCT();
|
||||
mode_init = true;
|
||||
megaStiEnable = false;
|
||||
PeriodicEvent = false; // is there an PeriodicEvent?
|
||||
Free_Work_Mode = true; // Free(WorkModeData)
|
||||
InitPeriodicEvent = true; // need to create a WorkModeData?
|
||||
|
||||
// IV/CV mode reset
|
||||
DiscardIVFirstData = 0;
|
||||
avg_number = 0;
|
||||
ADCRealCurrent_long = 0;
|
||||
ADCGainControl(GAIN_AUTO);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
InitGPT();
|
||||
initINSBuf();
|
||||
initDATBuf();
|
||||
AD5940_HWReset();
|
||||
AD5940_init();
|
||||
|
||||
LEDPowerON();
|
||||
for (int i = 0; i < BLE_INS_BUFF_SIZE; i++) {
|
||||
ins_buf[i] = 0;
|
||||
}
|
||||
// HSTIAGainCtrl(HSRTIA_200R);
|
||||
// LPTIAGainCtrl(LPRTIA_200R);
|
||||
// HSDAC_GainControl(0x00);
|
||||
// HSDAC_output(0x0800);
|
||||
|
||||
for (int i = 0; i < SPI_LED_SIZE; i++) {
|
||||
spi_LEDtxbuf[i] = 0;
|
||||
@@ -79,45 +77,8 @@ static void Eliteinterrupt() {
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < BLE_DAT_BUFF_SIZE; i++) {
|
||||
not_buf[i] = 0;
|
||||
}
|
||||
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 1); // AD_CS HIGH
|
||||
ModeLED(NO_EVENT);
|
||||
CPUdelay(8000);
|
||||
}
|
||||
|
||||
static void CleanBuffer() {
|
||||
InitFlag();
|
||||
InitEliteInstruction();
|
||||
InitCT();
|
||||
DiscardIVFirstData = 0;
|
||||
avg_number = 0;
|
||||
ADCRealCurrent_long = 0;
|
||||
|
||||
for (int i = 0; i < SPI_LED_SIZE; i++) {
|
||||
spi_LEDtxbuf[i] = 0;
|
||||
spi_LEDrxbuf[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < SPI_DAC_SIZE; i++) {
|
||||
spi_DACtxbuf[i] = 0;
|
||||
spi_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < SPI_ADC_SIZE; i++) {
|
||||
spi_ADC_txbuf[i] = 0;
|
||||
spi_ADC_rxbuf[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < BLE_DAT_BUFF_SIZE; i++) {
|
||||
not_buf[i] = 0;
|
||||
}
|
||||
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
CPUdelay(8000);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+197
-13
@@ -16,7 +16,7 @@
|
||||
|
||||
/* application use SPI parameters and buffers */
|
||||
#define SPI_LED_SIZE 28
|
||||
#define SPI_DAC_SIZE 3
|
||||
#define SPI_DAC_SIZE 6
|
||||
#define SPI_ADC_SIZE 4
|
||||
|
||||
static uint16_t spi_LEDtxbuf[SPI_LED_SIZE] = {0};
|
||||
@@ -27,6 +27,8 @@ static uint8_t spi_rxbuf[SPI_DAC_SIZE] = {0};
|
||||
|
||||
static uint8_t spi_ADC_txbuf[SPI_ADC_SIZE] = {0};
|
||||
static uint8_t spi_ADC_rxbuf[SPI_ADC_SIZE] = {0};
|
||||
//
|
||||
//static uint32_t SeqCmdBuff;
|
||||
|
||||
/* system use SPI parameters */
|
||||
static SPI_Handle spiHandle0 = NULL; // SPI0 = LED
|
||||
@@ -36,11 +38,13 @@ static SPI_Params spiParams1;
|
||||
static SPI_Transaction LED_transaction;
|
||||
static SPI_Transaction ADC_DAC_transaction;
|
||||
|
||||
static void ELITE15_SPI_HOLD();
|
||||
static void ELITE15_SPI_CLOSE();
|
||||
|
||||
static void Elite_SPI_init(){
|
||||
SPI_init();
|
||||
SPI_Params_init(&spiParams0);
|
||||
spiParams0.bitRate = 2000; // 12k
|
||||
spiParams0.bitRate = 2000; // 2k
|
||||
spiParams0.mode = SPI_MASTER;
|
||||
spiParams0.dataSize = 16;
|
||||
spiParams0.frameFormat = SPI_POL0_PHA1;
|
||||
@@ -50,7 +54,8 @@ static void Elite_SPI_init(){
|
||||
spiParams1.bitRate = 1000000; // 1M
|
||||
spiParams1.mode = SPI_MASTER;
|
||||
spiParams1.dataSize = 8;
|
||||
spiParams1.frameFormat = SPI_POL0_PHA1;
|
||||
spiParams1.frameFormat = SPI_POL0_PHA0;
|
||||
|
||||
spiHandle1 = SPI_open(Board_SPI1, &spiParams1); // ADC DAC SPI
|
||||
}
|
||||
|
||||
@@ -63,26 +68,205 @@ static void LED_SPI(uint8_t length, uint16_t *spi_txbuf, uint16_t *spi_rxbuf) {
|
||||
}
|
||||
|
||||
static void ADC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 0); // CS_ADC
|
||||
|
||||
ADC_DAC_transaction.count = length;
|
||||
ADC_DAC_transaction.txBuf = spi_txbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 0); // ADC_CS LOW
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 1); // CS_ADC
|
||||
}
|
||||
|
||||
static void DAC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
ADC_DAC_transaction.count = length;
|
||||
ADC_DAC_transaction.txBuf = spi_txbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
ADC_DAC_transaction.count = length;
|
||||
ADC_DAC_transaction.txBuf = spi_txbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 0); // DAC_CS LOW
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
}
|
||||
|
||||
static void ELITE15_SPI_HOLD() {
|
||||
Elite_SPI_init();
|
||||
// #ifdef ELITE_PIN_1_5_RE
|
||||
// PIN_setOutputValue(pin_handle, D6, LH.LATCH0[6]); // ADC_CS
|
||||
// PIN_setOutputValue(pin_handle, D7, LH.LATCH0[7]); // DAC_CS
|
||||
// PIN_setOutputValue(pin_handle, D4, LH.LATCH0[4]); // update HIGH_Z_MODE
|
||||
// #endif
|
||||
//
|
||||
// PIN_setOutputValue(pin_handle, LOAD0, 1);
|
||||
// PIN_setOutputValue(pin_handle, LOAD1, 0);
|
||||
// PIN_setOutputValue(pin_handle, LOAD2, 0);
|
||||
}
|
||||
static void ELITE15_SPI_CLOSE() {
|
||||
// PIN_setOutputValue(pin_handle, LOAD0, 0);
|
||||
// PIN_setOutputValue(pin_handle, LOAD1, 0);
|
||||
// PIN_setOutputValue(pin_handle, LOAD2, 0);
|
||||
|
||||
SPI_close(spiHandle0);
|
||||
SPI_close(spiHandle1);
|
||||
}
|
||||
|
||||
/* Elite1.5 Calibration SPI */
|
||||
static void CAL_ADC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) {
|
||||
ADC_DAC_transaction.count = length;
|
||||
ADC_DAC_transaction.txBuf = spi_txbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 1); // CS_ADC
|
||||
}
|
||||
|
||||
static void CAL_LED_SPI(uint8_t length, uint16_t *spi_txbuf, uint16_t *spi_rxbuf) {
|
||||
LED_transaction.count = length;
|
||||
LED_transaction.txBuf = spi_txbuf;
|
||||
LED_transaction.rxBuf = spi_rxbuf;
|
||||
|
||||
SPI_transfer(spiHandle0, &LED_transaction);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef ELITE_VERSION_EIS
|
||||
/* define SPI command */
|
||||
// datasheet page 98
|
||||
#define SPICMD_SETADDR 0x20
|
||||
#define SPICMD_WRITEREG 0x2D
|
||||
#define SPICMD_READREG 0x6D
|
||||
|
||||
//define REG
|
||||
#define LPDACCON0 0x2128
|
||||
#define LPDACSW0 0x2124
|
||||
#define LPDACDAT0 0x2120
|
||||
#define LPREFBUFCON 0x2050
|
||||
#define SWMUX 0x235C
|
||||
#define LPTIASW0 0x20E4
|
||||
#define SWCON 0x200C
|
||||
#define HSDACCON 0x2010
|
||||
#define HSDACDAT 0x2048
|
||||
#define LPTIACON0 0x20EC
|
||||
#define HSTIACON 0x20FC
|
||||
#define AFECON 0x2000
|
||||
#define DSWFULLCON 0x2150
|
||||
#define NSWFULLCON 0x2154
|
||||
#define PSWFULLCON 0x2158
|
||||
#define TSWFULLCON 0x215C
|
||||
#define WGFCW 0x2030
|
||||
#define WGPHASE 0x2034
|
||||
#define WGOFFSET 0x2038
|
||||
#define WGAMPLITUDE 0x203C
|
||||
#define WGCON 0x2014
|
||||
#define DE0RESCON 0x20F8
|
||||
#define ADCCON 0x21A8
|
||||
#define DFTCON 0x20D0
|
||||
#define ADCFILTERCON 0x2044
|
||||
#define PMBW 0x22F0
|
||||
#define CLKSEL 0x0414
|
||||
#define CLKCON0 0x0408
|
||||
#define CLKCON0KEY 0x0420
|
||||
#define HSOSCCON 0x20BC
|
||||
#define ADCBUFCON 0x238C
|
||||
#define HSRTIACON 0x20F0
|
||||
#define ADCDAT 0x2074
|
||||
#define DFTREAL 0x2078
|
||||
#define DFTIMAG 0x207C
|
||||
|
||||
static void select_REG(uint16_t addr){
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 0);
|
||||
// CPUdelay(16000);
|
||||
|
||||
spi_DACtxbuf[0] = SPICMD_SETADDR;
|
||||
spi_DACtxbuf[1] = (uint8_t)((addr & 0xFF00) >> 8);
|
||||
spi_DACtxbuf[2] = (uint8_t)(addr & 0x00FF);
|
||||
|
||||
ADC_DAC_transaction.count = 3;
|
||||
ADC_DAC_transaction.txBuf = spi_DACtxbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
// CPUdelay(16000);
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 1);
|
||||
}
|
||||
|
||||
static void w16_REG(uint16_t data){
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 0);
|
||||
spi_DACtxbuf[0] = SPICMD_WRITEREG;
|
||||
spi_DACtxbuf[1] = (uint8_t)((data & 0xFF00) >> 8);
|
||||
spi_DACtxbuf[2] = (uint8_t)(data & 0x00FF);
|
||||
|
||||
ADC_DAC_transaction.count = 3;
|
||||
ADC_DAC_transaction.txBuf = spi_DACtxbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 1);
|
||||
}
|
||||
|
||||
static int16_t r16_REG(){
|
||||
int16_t ret;
|
||||
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 0);
|
||||
spi_DACtxbuf[0] = SPICMD_READREG;
|
||||
spi_DACtxbuf[1] = 0x00;
|
||||
spi_DACtxbuf[2] = 0x00;
|
||||
spi_DACtxbuf[3] = 0x00;
|
||||
|
||||
ADC_DAC_transaction.count = 4;
|
||||
ADC_DAC_transaction.txBuf = spi_DACtxbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
|
||||
ret = (int16_t)spi_rxbuf[2] << 8 | \
|
||||
(int16_t)spi_rxbuf[3];
|
||||
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void w32_REG(uint32_t data){
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 0);
|
||||
spi_DACtxbuf[0] = SPICMD_WRITEREG;
|
||||
spi_DACtxbuf[1] = (uint8_t)((data & 0xFF000000) >> 24);
|
||||
spi_DACtxbuf[2] = (uint8_t)((data & 0x00FF0000) >> 16);
|
||||
spi_DACtxbuf[3] = (uint8_t)((data & 0x0000FF00) >> 8);
|
||||
spi_DACtxbuf[4] = (uint8_t)(data & 0x000000FF);
|
||||
|
||||
ADC_DAC_transaction.count = 5;
|
||||
ADC_DAC_transaction.txBuf = spi_DACtxbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 1);
|
||||
}
|
||||
|
||||
static int32_t r32_REG(){
|
||||
int32_t ret;
|
||||
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 0);
|
||||
spi_DACtxbuf[0] = SPICMD_READREG;
|
||||
spi_DACtxbuf[1] = 0x00;
|
||||
spi_DACtxbuf[2] = 0x00;
|
||||
spi_DACtxbuf[3] = 0x00;
|
||||
spi_DACtxbuf[4] = 0x00;
|
||||
spi_DACtxbuf[5] = 0x00;
|
||||
|
||||
ADC_DAC_transaction.count = 6;
|
||||
ADC_DAC_transaction.txBuf = spi_DACtxbuf;
|
||||
ADC_DAC_transaction.rxBuf = spi_rxbuf;
|
||||
SPI_transfer(spiHandle1, &ADC_DAC_transaction);
|
||||
|
||||
ret = (int32_t)spi_rxbuf[2] << 24 | \
|
||||
(int32_t)spi_rxbuf[3] << 16 | \
|
||||
(int32_t)spi_rxbuf[4] << 8 | \
|
||||
(int32_t)spi_rxbuf[5];
|
||||
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // ELITE_EIS
|
||||
|
||||
#endif // ELITE_SPI
|
||||
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
|
||||
#ifndef ELITEVT
|
||||
#define ELITEVT
|
||||
|
||||
static void VT_Plot(VTMode *VT) {
|
||||
// ADC gain is don't care when measuring voltage
|
||||
INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
|
||||
// read ADC volt
|
||||
ReadVolt(spi_ADC_rxbuf);
|
||||
|
||||
// decode ADC value and put it into notify buffer
|
||||
VT->_MeasureData = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_VOLT, spi_ADC_rxbuf);
|
||||
|
||||
NotifyVolt[0] = (uint8_t) (VT->_MeasureData >> 24);
|
||||
NotifyVolt[1] = (uint8_t) ((VT->_MeasureData & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t) ((VT->_MeasureData & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t) (VT->_MeasureData & 0x000000FF);
|
||||
}
|
||||
|
||||
#endif
|
||||
+592
-629
File diff suppressed because it is too large
Load Diff
-109
@@ -1,109 +0,0 @@
|
||||
|
||||
#ifndef ELITEZT
|
||||
#define ELITEZT
|
||||
|
||||
static void ZT_notify(int32_t impedance);
|
||||
|
||||
// output a certain voltage e.g. 2v
|
||||
// and measure the input voltage
|
||||
// => calculate the resister
|
||||
// change the output voltage step
|
||||
// => get a R-T curve (with resolution = 1 sample/volt step )
|
||||
static void ZT_Plot(RTMode *RT) {
|
||||
// int32_t Real_Resister = 0;
|
||||
// static uint16_t CurrentMeasure=0, VoltMeasure=0;
|
||||
// uint8_t SPICurrent[SPI_ADC_SIZE]={0}, SPIVolt[SPI_ADC_SIZE]={0};
|
||||
// static uint8_t VoltCurrentSwitch = 0;
|
||||
|
||||
int32_t volt_32 = 0;
|
||||
int32_t current_32 = 0;
|
||||
int32_t resister_32 = 0;
|
||||
|
||||
if(INSTRUCTION.AutoGainEnable){
|
||||
current_32 = AutoGainReadCurrent(spi_ADC_rxbuf);
|
||||
}
|
||||
else{
|
||||
ReadCurrent(spi_ADC_rxbuf);
|
||||
current_32 = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
|
||||
|
||||
volt_32 = User2Real(INSTRUCTION.VoltConstant)*1e5;
|
||||
// ReadVolt(SPIVolt);
|
||||
// VoltMeasure = (uint16_t) (SPIVolt[0] << 8) | (uint16_t) (SPIVolt[1]);
|
||||
// volt_32 = DecodeADCVolt(VoltMeasure)*1e4;
|
||||
resister_32 = volt_32 / current_32;
|
||||
volt_32 = volt_32 / 1e2; //uV
|
||||
|
||||
NotifyVolt[0] = (uint8_t) (volt_32 >> 24);
|
||||
NotifyVolt[1] = (uint8_t) ((volt_32 & 0x00FF0000) >> 16);
|
||||
NotifyVolt[2] = (uint8_t) ((volt_32 & 0x0000FF00) >> 8);
|
||||
NotifyVolt[3] = (uint8_t) (volt_32 & 0x000000FF);
|
||||
|
||||
NotifyCurrent[0] = (uint8_t) (current_32 >> 24);
|
||||
NotifyCurrent[1] = (uint8_t) ((current_32 & 0x00FF0000) >> 16);
|
||||
NotifyCurrent[2] = (uint8_t) ((current_32 & 0x0000FF00) >> 8);
|
||||
NotifyCurrent[3] = (uint8_t) (current_32 & 0x000000FF);
|
||||
|
||||
NotifyImpedance[0] = (uint8_t) (resister_32 >> 24);
|
||||
NotifyImpedance[1] = (uint8_t) ((resister_32 & 0x00FF0000) >> 16);
|
||||
NotifyImpedance[2] = (uint8_t) ((resister_32 & 0x0000FF00) >> 8);
|
||||
NotifyImpedance[3] = (uint8_t) (resister_32 & 0x000000FF);
|
||||
|
||||
// set ADC GAIN
|
||||
// if(INSTRUCTION.ResisterMeter == RESISTER_METER_LARGE){
|
||||
// INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
// }
|
||||
// else if(INSTRUCTION.ResisterMeter == RESISTER_METER_MIDDLE2){
|
||||
// INSTRUCTION.ADCGainLevel = GAIN_200R;
|
||||
// }
|
||||
// else if(INSTRUCTION.ResisterMeter == RESISTER_METER_MIDDLE1){
|
||||
// INSTRUCTION.ADCGainLevel = GAIN_10K;
|
||||
// }
|
||||
// else{
|
||||
// INSTRUCTION.ADCGainLevel = GAIN_200K;
|
||||
// }
|
||||
// ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
|
||||
// Use 9-th measure value as real-measure value
|
||||
// because some value in the begin are garbage
|
||||
// if(VoltCurrentSwitch < 9){
|
||||
// ADCChannelSelect(ADC_CH_CURRENT);
|
||||
// CPUdelay(10);
|
||||
// ADC_read(SPICurrent);
|
||||
// VoltCurrentSwitch ++;
|
||||
// }
|
||||
// else if(VoltCurrentSwitch == 9){
|
||||
// // read current
|
||||
// ADCChannelSelect(ADC_CH_CURRENT);
|
||||
// CPUdelay(10);
|
||||
// ADC_read(SPICurrent);
|
||||
// CurrentMeasure = (uint16_t) (SPICurrent[0] << 8) | (uint16_t) (SPICurrent[1]);
|
||||
// VoltCurrentSwitch ++;
|
||||
// }
|
||||
// else if(VoltCurrentSwitch <18){
|
||||
// // read volt
|
||||
// ADCChannelSelect(ADC_CH_VOLT);
|
||||
// CPUdelay(10);
|
||||
// ADC_read(SPIVolt);
|
||||
// VoltCurrentSwitch++;
|
||||
// }
|
||||
// else if(VoltCurrentSwitch == 18){
|
||||
// // read volt
|
||||
// ADCChannelSelect(ADC_CH_VOLT);
|
||||
// CPUdelay(10);
|
||||
// ADC_read(SPIVolt);
|
||||
// VoltMeasure = (uint16_t) (SPIVolt[0] << 8) | (uint16_t) (SPIVolt[1]);
|
||||
// VoltCurrentSwitch++;
|
||||
// }
|
||||
// else{
|
||||
// VoltCurrentSwitch = 0;
|
||||
// }
|
||||
|
||||
// decode ADC value and put it into notify buffer
|
||||
// DecodeResister(INSTRUCTION.ADCGainLevel, CurrentMeasure, VoltMeasure);
|
||||
// Real_Resister = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
+146
-27
@@ -6,52 +6,171 @@
|
||||
#include <Board.h>
|
||||
#include <ti/drivers/PIN.h>
|
||||
|
||||
//#define ELITE_PIN_1_5
|
||||
//#define ELITE_PIN_1_5_RE
|
||||
#define ELITE_PIN_EIS
|
||||
|
||||
#ifdef ELITE_PIN_EIS
|
||||
/* SPI Board */
|
||||
#define Board_SPI0_MISO PIN_UNASSIGNED
|
||||
#define Board_SPI0_MOSI IOID_1
|
||||
#define Board_SPI0_CLK IOID_0
|
||||
#define Board_SPI0_MOSI IOID_4
|
||||
#define Board_SPI0_CLK IOID_3
|
||||
#define Board_SPI0_CS PIN_UNASSIGNED
|
||||
|
||||
#define Board_SPI1_MISO IOID_3
|
||||
#define Board_SPI1_MOSI IOID_2
|
||||
#define Board_SPI1_CLK IOID_4
|
||||
#define Board_SPI1_MISO IOID_1
|
||||
#define Board_SPI1_MOSI IOID_6
|
||||
#define Board_SPI1_CLK IOID_5
|
||||
#define Board_SPI1_CS PIN_UNASSIGNED
|
||||
|
||||
#define ADC_CS IOID_8
|
||||
#define DAC_CS IOID_9
|
||||
#define AD_CS IOID_10
|
||||
|
||||
#define Turnon200R IOID_5
|
||||
#define Turnon10K IOID_6
|
||||
//#define SD_MISO IOID_11
|
||||
//#define SD_CS IOID_8
|
||||
//#define SD_CLK IOID_7
|
||||
//#define SD_MOSI IOID_13
|
||||
|
||||
/* I2C */
|
||||
#ifdef ELITE_VERSION_1_4
|
||||
#define Board_I2C0_SCL0 IOID_7
|
||||
#define Board_I2C0_SDA0 IOID_1
|
||||
#endif
|
||||
#define switch_on IOID_14
|
||||
#define enable_5v IOID_9
|
||||
#define AD_reset IOID_13
|
||||
#define enable_10v PIN_UNASSIGNED
|
||||
#define HIGH_Z_MODE PIN_UNASSIGNED
|
||||
#define shutdown_6994 PIN_UNASSIGNED
|
||||
|
||||
#define Turnon_I_LARGE PIN_UNASSIGNED
|
||||
#define Turnon_I_MID PIN_UNASSIGNED
|
||||
#define Turnon_I_SMALL PIN_UNASSIGNED
|
||||
|
||||
#define Turnon_V_MID PIN_UNASSIGNED
|
||||
#define Turnon_V_SMALL PIN_UNASSIGNED
|
||||
|
||||
#define Turon_VOUT_SMALL PIN_UNASSIGNED
|
||||
|
||||
#define shutdown_6994 IOID_10
|
||||
#define switch_on IOID_11
|
||||
#define enable_10v IOID_12
|
||||
#define enable_5v IOID_13
|
||||
|
||||
PIN_Handle pin_handle;
|
||||
static PIN_State ZM_rst;
|
||||
|
||||
const PIN_Config BLE_IO[] = {
|
||||
//
|
||||
ADC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, // ADC_CS
|
||||
DAC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, // DAC_CS
|
||||
|
||||
enable_10v | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, // 10V_enable
|
||||
enable_5v | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, // 5V_enable
|
||||
shutdown_6994 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, // turn off power
|
||||
Turnon200R | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
|
||||
Turnon10K | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
|
||||
enable_5v | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,// 5V_enable
|
||||
AD_reset | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX,
|
||||
switch_on | PIN_INPUT_EN | PIN_PULLDOWN,
|
||||
AD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX,
|
||||
PIN_TERMINATE
|
||||
};
|
||||
|
||||
static void remove_elite_pin() {
|
||||
PIN_close(pin_handle);
|
||||
pin_handle = PIN_open(&ZM_rst, BLE_IO);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ELITE_PIN_1_5_RE
|
||||
/* SPI Board */
|
||||
#define Board_SPI0_MISO PIN_UNASSIGNED
|
||||
#define Board_SPI0_MOSI D1
|
||||
#define Board_SPI0_CLK D0
|
||||
#define Board_SPI0_CS PIN_UNASSIGNED
|
||||
|
||||
#define Board_SPI1_MISO IOID_1
|
||||
#define Board_SPI1_MOSI D3
|
||||
#define Board_SPI1_CLK D2
|
||||
#define Board_SPI1_CS PIN_UNASSIGNED
|
||||
|
||||
#define D0 IOID_3
|
||||
#define D1 IOID_4
|
||||
#define D2 IOID_5
|
||||
#define D3 IOID_6
|
||||
#define D4 IOID_7
|
||||
#define D5 IOID_8
|
||||
#define D6 IOID_9
|
||||
#define D7 IOID_10
|
||||
|
||||
#define LOAD0 IOID_13
|
||||
#define LOAD1 IOID_12
|
||||
#define LOAD2 IOID_11
|
||||
|
||||
#define ADC_CS LOAD0, D6
|
||||
#define DAC_CS LOAD0, D7
|
||||
#define ADC_DAC_SPI_MOSI LOAD0, D3
|
||||
#define ADC_DAC_SPI_CLK LOAD0, D2
|
||||
#define LED_MOSI LOAD0, D1
|
||||
#define LED_CLK LOAD0, D0
|
||||
#define MEM_CS LOAD0, D5
|
||||
|
||||
#ifdef ELITE_PIN_1_5
|
||||
#define MEM_HOLD LOAD0, D4
|
||||
#define HIGH_Z_MODE LOAD2, D5
|
||||
#endif
|
||||
#ifdef ELITE_PIN_1_5_RE
|
||||
#define MEM_HOLD LOAD1, D0
|
||||
#define HIGH_Z_MODE LOAD0, D4
|
||||
#endif
|
||||
|
||||
#define Turnon_I_MID LOAD2, D0
|
||||
#define Turnon_I_SMALL LOAD2, D4
|
||||
#define Turnon_I_LARGE LOAD2, D1
|
||||
#define Turnon_V_SMALL LOAD2, D2
|
||||
#define Turnon_V_MID LOAD2, D3
|
||||
#define Turon_VOUT_SMALL LOAD2, D7
|
||||
#define shutdown_6994 LOAD2, D6
|
||||
|
||||
//#define Turnon10K Turnon_I_MID
|
||||
//#define Turnon200R Turnon_I_LARGE
|
||||
|
||||
/* I2C */
|
||||
#ifdef ELITE_VERSION_1_4
|
||||
#define Board_I2C0_SCL0 PIN_UNASSIGNED
|
||||
#define Board_I2C0_SDA0 PIN_UNASSIGNED
|
||||
#endif
|
||||
|
||||
#define switch_on IOID_14
|
||||
#define enable_10v LOAD1, D5
|
||||
#define enable_5v LOAD1, D6
|
||||
|
||||
PIN_Handle pin_handle;
|
||||
static PIN_State ZM_rst;
|
||||
|
||||
const PIN_Config BLE_IO[] = {
|
||||
// D0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
// D1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
// D2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
// D3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
D4 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
D5 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
D6 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
D7 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
|
||||
LOAD0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
LOAD1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
LOAD2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
|
||||
switch_on | PIN_INPUT_EN | PIN_PULLDOWN, // to sense switch
|
||||
|
||||
PIN_TERMINATE
|
||||
};
|
||||
|
||||
static void add_elite_pin() {
|
||||
// PIN_Status elite15_status;
|
||||
PIN_add(pin_handle,
|
||||
D0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL);
|
||||
PIN_add(pin_handle,
|
||||
D1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL);
|
||||
PIN_add(pin_handle,
|
||||
D2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL);
|
||||
PIN_add(pin_handle,
|
||||
D3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL);
|
||||
|
||||
// if(elite15_status != PIN_SUCCESS) {
|
||||
// LED_color(DARKLED, 0x0F, 0x0F, 0x0F);
|
||||
// }
|
||||
}
|
||||
|
||||
static void remove_elite_pin() {
|
||||
PIN_close(pin_handle);
|
||||
pin_handle = PIN_open(&ZM_rst, BLE_IO);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @def BOOSTXL_CC2650MA_SPIName
|
||||
* @brief Enum of SPI names on the CC2650 Booster Pack
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
***********************************************************
|
||||
Read battery's method
|
||||
***********************************************************
|
||||
1.ReadADCBat(spi_ADC_rxbuf)
|
||||
let "spi_ADC_rxbuf" be 8000
|
||||
8000 * 187.5uV * 2 = 3000000uV = 3V ;
|
||||
2.AONBatMonBatteryVoltageGet()
|
||||
let "AONBatMonBatteryVoltageGet()" be 768
|
||||
768 * 125 / 320 / 100 = 768 / 256 = 3V ;
|
||||
|
||||
if you want to use first method, and get value 768
|
||||
conversion: 8000 * 187.5 * 1e-6 * 2 / 125 * 320 * 100 = 768
|
||||
=> 8000 * 12 / 125 = 768
|
||||
*/
|
||||
|
||||
#ifndef HEADSTAGE_BATT_H
|
||||
#define HEADSTAGE_BATT_H
|
||||
|
||||
#include <driverlib/aon_batmon.h>
|
||||
#define MAX_BATTERY_CAPACITY 4200
|
||||
|
||||
static uint8_t headstage_battery_percent() {
|
||||
static uint8_t battery_percent = 100;
|
||||
uint8_t internal_battery_percent;
|
||||
uint32_t internal_batt_sense = AONBatMonBatteryVoltageGet();
|
||||
internal_batt_sense = (internal_batt_sense * 125) >> 5;
|
||||
internal_batt_sense = (internal_batt_sense * 100) / MAX_BATTERY_CAPACITY;
|
||||
internal_battery_percent = internal_batt_sense & 0xFF;
|
||||
if (internal_battery_percent < battery_percent) battery_percent = internal_battery_percent;
|
||||
return battery_percent;
|
||||
}
|
||||
|
||||
static void headstage_battery_volt(){
|
||||
uint32_t bat_volt = 0;
|
||||
|
||||
ReadADCBat(spi_ADC_rxbuf);
|
||||
bat_volt = (uint32_t) (spi_ADC_rxbuf[0] << 8) | (uint32_t) (spi_ADC_rxbuf[1]);
|
||||
bat_volt = bat_volt * 12 / 125; //x * 187.5 * 1e-6 * 2 / 125 * 320 * 100 ;
|
||||
InputNotify(NOTIFY_VOLT_BAT, bat_volt);
|
||||
}
|
||||
|
||||
static void EliteADCBattery(){
|
||||
static uint8_t ADCSwitch = 0;
|
||||
if(ADCSwitch == 0){ /**read V**/
|
||||
ReadADCBat(spi_ADC_rxbuf);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 1){ /**read V**/
|
||||
ReadADCBat(spi_ADC_rxbuf);
|
||||
ADCSwitch++;
|
||||
}
|
||||
else if(ADCSwitch == 2){ /**read V(buffer)**/
|
||||
headstage_battery_volt();
|
||||
batteryCheck_flag = false;
|
||||
ADCSwitch = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void measureBat(){
|
||||
GPT.DeltaGptimerCounter = GPT.GptimerCounter - GPT.GptimerCounter0;
|
||||
GPT.GptimerCounter0 = GPT.GptimerCounter;
|
||||
|
||||
GPT.BatteryADCCounter = GPT.BatteryADCCounter + GPT.DeltaGptimerCounter;
|
||||
GPT.BatteryCheckCounter = GPT.BatteryCheckCounter + GPT.DeltaGptimerCounter;
|
||||
|
||||
if(GPT.BatteryCheckCounter >= 50000){//5min=3000000, 5s=50000
|
||||
GPT.BatteryCheckCounter = 0;
|
||||
batteryCheck_flag = true;
|
||||
}
|
||||
|
||||
if(GPT.BatteryADCCounter >= 15 && batteryCheck_flag){
|
||||
GPT.BatteryADCCounter = 0; //To get the data right, ADC must be delay 1.5ms
|
||||
batteryADC_flag = true;
|
||||
if(batteryADC_flag){
|
||||
EliteADCBattery();
|
||||
batteryADC_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t bat = ((uint16_t)(NotifyVoltBat[2]) << 8 & 0xFF00 ) |
|
||||
((uint16_t)(NotifyVoltBat[3]) & 0x00FF);
|
||||
if( bat < 768 && bat > 20){
|
||||
PIN_setOutputValue(pin_handle, enable_5v, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HEADSTAGE_BATT_H
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
#ifndef ELITE_DEF
|
||||
#define ELITE_DEF
|
||||
|
||||
// define BT instruction
|
||||
#define INS_TYPE_RIS 0x30
|
||||
#define INS_TYPE_VIS 0xC0
|
||||
#define INS_TYPE_CIS 0x70
|
||||
|
||||
// VIS (virtual instruction)
|
||||
#define VIS_RST 0xF0
|
||||
#define VIS_ASK 0x30
|
||||
#define VIS_STI 0xC0
|
||||
#define VIS_FUH 0x90
|
||||
#define VIS_INT 0x60
|
||||
#define VIS_DEVICE_SHINY 0x10
|
||||
#define VIS_SHINY_DIS 0x20
|
||||
|
||||
// RIS (real instruction)
|
||||
enum all_mode_e {
|
||||
|
||||
CURVE_EIS = 0xD1, //Should Change to 0xD1
|
||||
CURVE_EIS_CV = 0xD2,
|
||||
|
||||
CURVE_CALI_ADC = 0xF1, // Cali ADC - test //0x92,
|
||||
// CURVE_CALI_ADC = 0x92, // Cali ADC - test //0x92,
|
||||
|
||||
SET_SAMPLE_RATE = 0xE0, //0x70,
|
||||
// SET_SAMPLE_RATE = 0x70, //0x70,
|
||||
SET_ADC_DAC_GAIN = 0xE1, //0x80,
|
||||
// SET_ADC_DAC_GAIN = 0x80, //0x80,
|
||||
};
|
||||
|
||||
// CIS (control instruction)
|
||||
#define CIS_VERSION 0x40
|
||||
#define CIS_VOLT 0x10
|
||||
#define CIS_LED_TEST 0x70
|
||||
#define CIS_CALI 0x30
|
||||
#define CIS_CALI2 0x90
|
||||
|
||||
#define CTL_WRT 0x20
|
||||
#define CTL_RD 0x21
|
||||
#define CTL_RD_DFTR 0x78
|
||||
#define CTL_RD_DFTI 0x7C
|
||||
#define CTL_WRT_WGAMPL 0x3C
|
||||
#define CTL_WRT_TRAP 0x2c
|
||||
#define CTL_RESET 0x11
|
||||
#define CTL_IMPEDANCE 0x12
|
||||
#define CTL_CV3 0x13
|
||||
#define cali_LPTIA_setGain 0x29
|
||||
#define cali_LPDAC_voltout 0x39
|
||||
#define cali_HSDAC_amp 0x49
|
||||
#define cali_HSTIA_setGain 0x59
|
||||
#define cali_HSDAC_DC 0x69
|
||||
|
||||
// mode parameter
|
||||
#define STEP_TO_VSETRATE(step) step2VsetRate(step)
|
||||
#define VMAX(v1,v2) ((v1 >= v2) ? v1 : v2)
|
||||
#define VMIN(v1,v2) ((v1 < v2) ? v1 : v2)
|
||||
#define VDIRECTION(v1,v2) ((v1 > v2) ? 0 : 1)
|
||||
#define AFTER_READ_I 0
|
||||
#define AFTER_READ_V 1
|
||||
#define PARA_1 0x01
|
||||
#define PARA_2 0x02
|
||||
#define PARA_3 0x03
|
||||
#define PARA_4 0x04
|
||||
#define PARA_5 0x05
|
||||
#define PARA_6 0x06
|
||||
#define PARA_7 0x07
|
||||
#define PARA_8 0x08
|
||||
#define PARA_9 0x09
|
||||
#define PARA_10 0x0A
|
||||
#define PARA_11 0x0B
|
||||
#define PARA_12 0x0C
|
||||
#define PARA_13 0x0D
|
||||
#define PARA_14 0x0E
|
||||
#define PARA_15 0x0F
|
||||
#define PARA_16 0x10
|
||||
#define PARA_17 0x11
|
||||
|
||||
//Elite LED
|
||||
#define COLOR_BLACK 0x00
|
||||
#define COLOR_RED 0x01
|
||||
#define COLOR_ORANGE 0x02
|
||||
#define COLOR_YELLOW 0x03
|
||||
#define COLOR_GREEN 0x04
|
||||
#define COLOR_BLUE 0x05
|
||||
#define COLOR_CYAN 0x06
|
||||
#define COLOR_MAGENTA 0x07
|
||||
#define COLOR_PURPLE 0x08
|
||||
#define COLOR_WHITE 0x09
|
||||
#define COLOR_YELLOWGREEN 0x0A
|
||||
#define COLOR_YELLOW_DARK 0xF3
|
||||
#define COLOR_GREEN_DARK 0xF4
|
||||
#define COLOR_BLUE_DARK 0xF5
|
||||
#define COLOR_CYAN_DARK 0xF6
|
||||
#define COLOR_PURPLE_DARK 0xF8
|
||||
|
||||
#define LEDPowerON() Elite_led_color(COLOR_GREEN)
|
||||
#define WORKLED() Elite_led_color(COLOR_CYAN)
|
||||
#define KEYLED() Elite_led_color(COLOR_YELLOW)
|
||||
#define BT_WAIT_LED() Elite_led_color(COLOR_YELLOWGREEN)
|
||||
|
||||
|
||||
#define BT_WAIT 0x01
|
||||
#define NO_EVENT 0x02
|
||||
#define PRE_WORK 0x03
|
||||
#define WORKING 0x04
|
||||
#define POST_WORK 0x05
|
||||
|
||||
/* EIS define */
|
||||
// cutoff frequency of the filter in AD5940
|
||||
#define cutoff_auto 0x00
|
||||
#define cutoff_50k 0x01
|
||||
#define cutoff_100k 0x02
|
||||
#define cutoff_250k 0x03
|
||||
|
||||
#define LOW_PW_MODE 0x00
|
||||
#define HIGH_PW_MODE 0x01
|
||||
|
||||
|
||||
#define VALUE_ZERO_TO_ONE(_v) (_v == 0) ? 1 : _v
|
||||
#endif
|
||||
+645
@@ -0,0 +1,645 @@
|
||||
#include <math.h>
|
||||
|
||||
#ifndef ELITE_MODE_ADC_DAC
|
||||
#define ELITE_MODE_ADC_DAC
|
||||
|
||||
#define Vset instru.Vset
|
||||
|
||||
static void volt_out()
|
||||
{
|
||||
static int32_t DACOutCode;
|
||||
static int32_t DeltaVout;
|
||||
static int32_t Vout;
|
||||
|
||||
if (DACReset) {
|
||||
Vout = Vset;
|
||||
} else {
|
||||
DeltaVout = Vset - (Vout);
|
||||
Vout = Vout + DeltaVout;
|
||||
}
|
||||
|
||||
|
||||
if (Vout >= 1100000000) { //1100000000 = 5.5V
|
||||
Vout = 1100000000;
|
||||
} else if (Vout <= -1000000000) { //-1000000000 = -5V
|
||||
Vout = -1000000000;
|
||||
}
|
||||
|
||||
|
||||
instru.VoltConstant = Vout / 40000 + 25000; //5nV=>usercode
|
||||
DACOutCode = Usercode_Correction_to_DAC(instru.VoutGainLevel, instru.VoltConstant);
|
||||
DAC_outputV(DACOutCode);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void freq_out()
|
||||
{
|
||||
DAC_outputF(instru.fset);
|
||||
return;
|
||||
}
|
||||
|
||||
static void vscan_volt_out(void)
|
||||
{
|
||||
struct wm_cv_ctx_t *cv = (struct wm_cv_ctx_t *)wm_get();
|
||||
void *wm = wm_get();
|
||||
|
||||
/* in [5nV] ver */
|
||||
MEAS_VOUT(wm) = DAC_outputV(Vset);
|
||||
|
||||
if (Vset == cv->_Vinit && cv->bFirst){
|
||||
Elite_led_color(COLOR_ORANGE);
|
||||
CPUdelay(30000);
|
||||
Elite_led_color(COLOR_CYAN);
|
||||
}
|
||||
|
||||
// InputNotify(NOTIFY_VOLT, vscan);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void CalcuResistance()
|
||||
{
|
||||
/* Elite 100 = 100R
|
||||
Elite 1000 = 1KR
|
||||
Elite 10000 = 10KR
|
||||
Elite 100000 = 100KR
|
||||
Elite 1000000 = 1MR
|
||||
*/
|
||||
|
||||
struct wm_rt_ctx_t *rt = (struct wm_rt_ctx_t *)wm_get();
|
||||
struct wm_meas_t *m = &rt->measure;
|
||||
int64_t resist;
|
||||
int64_t volt = (int64_t)(m->_measureVout) ;
|
||||
int64_t current = (int64_t)(m->_measureCurrent);
|
||||
|
||||
resist = volt * 1000000 / current; //R = V / Iin; [mOhm]
|
||||
InputNotify(NOTIFY_IMPEDANCE, resist);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//////EIS PLOT RELATED FUNCTION START//////
|
||||
static uint8_t CalcDecade(uint32_t f1, uint32_t f2)
|
||||
{
|
||||
uint8_t decades; //max is 7
|
||||
decades = log10(f2/f1);
|
||||
return decades;
|
||||
}
|
||||
|
||||
static int32_t neg_18bit(int32_t ret)
|
||||
{
|
||||
// if (ret > 131072) {
|
||||
// ret = ret - 262144;
|
||||
// }
|
||||
ret &= 0x3FFFF;
|
||||
if (ret & (1 << 17)) {
|
||||
ret |= 0xFFFC0000;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//////EIS PLOT RELATED FUNCTION END//////
|
||||
|
||||
|
||||
static void DACenable(uint8_t afterRead)
|
||||
{
|
||||
void *wm = wm_get();
|
||||
|
||||
if (afterRead == AFTER_READ_I) {
|
||||
switch (instru.eliteFxn) {
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (afterRead == AFTER_READ_V) {
|
||||
switch (instru.eliteFxn) {
|
||||
case CURVE_EIS:
|
||||
freq_out();
|
||||
break;
|
||||
|
||||
case CURVE_EIS_CV:
|
||||
vscan_volt_out();
|
||||
break;
|
||||
|
||||
default:{
|
||||
Elite_led_color(COLOR_PURPLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void read_Iin_change_gain(void)
|
||||
{
|
||||
static uint8_t rec_cnt = 0;
|
||||
void *wm = wm_get();
|
||||
|
||||
if (instru.AutoGainEnable > 1)
|
||||
return;
|
||||
|
||||
/* read Iin and do NOT record the Iin after changing gain twice */
|
||||
MEAS_CURR(wm) = read_cali_Iin(spi_ADC_rxbuf);
|
||||
if (instru.AutoGainEnable) {
|
||||
AutoGainChangeIin(MEAS_CURR(wm));
|
||||
// AutoChangeLPTIAGain(MEAS_CURR(wm));
|
||||
} else {
|
||||
if (lastIinADCGainLevel != instru.ADCGainLv) {
|
||||
IinADCGainControl(instru.ADCGainLv);
|
||||
// LPTIAGainCtrl(instru.ADCGainLv);
|
||||
}
|
||||
}
|
||||
|
||||
if (record_flag == false) {
|
||||
rec_cnt++;
|
||||
}
|
||||
|
||||
if (rec_cnt == 2) {
|
||||
record_flag = true;
|
||||
rec_cnt = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void LPTIA_change_gain(void)
|
||||
{
|
||||
static uint8_t rec_cnt = 0;
|
||||
void *wm = wm_get();
|
||||
|
||||
if (instru.AutoGainEnable > 1)
|
||||
return;
|
||||
|
||||
/* read Iin and do NOT record the Iin after changing gain twice */
|
||||
MEAS_CURR(wm) = read_LPTIA_Iin();
|
||||
if (instru.AutoGainEnable) {
|
||||
AutoChangeLPTIAGain(MEAS_CURR(wm));
|
||||
} else {
|
||||
if (lastIinADCGainLevel != instru.ADCGainLv) {
|
||||
LPTIAGainCtrl(instru.ADCGainLv);
|
||||
}
|
||||
}
|
||||
|
||||
if (record_flag == false) {
|
||||
rec_cnt++;
|
||||
}
|
||||
|
||||
if (rec_cnt == 2) {
|
||||
record_flag = true;
|
||||
rec_cnt = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void HSTIA_change_gain(void)
|
||||
{
|
||||
// static uint8_t rec_cnt = 0;
|
||||
void *wm = wm_get();
|
||||
|
||||
if (instru.AutoGainEnable > 1)
|
||||
return;
|
||||
|
||||
/* read Iin and do NOT record the Iin after changing gain twice */
|
||||
MEAS_CURR(wm) = read_HSTIA_Iin();
|
||||
if (instru.AutoGainEnable) {
|
||||
AutoChangeHSTIAGain(MEAS_CURR(wm));
|
||||
} else {
|
||||
if (lastIinADCGainLevel != instru.ADCGainLv) {
|
||||
HSTIAGainCtrl(instru.ADCGainLv);
|
||||
}
|
||||
}
|
||||
|
||||
// if (record_flag == false) {
|
||||
// rec_cnt++;
|
||||
// }
|
||||
//
|
||||
// if (rec_cnt == 2) {
|
||||
// record_flag = true;
|
||||
// rec_cnt = 0;
|
||||
// }
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void read_Vin_change_gain(void)
|
||||
{
|
||||
static uint8_t rec_cnt = 0;
|
||||
void *wm = wm_get();
|
||||
|
||||
if (instru.AutoGainEnable > 1)
|
||||
return;
|
||||
|
||||
/* read Vin and do NOT record the Vin after changing gain twice */
|
||||
MEAS_VIN(wm) = read_cali_Vin(spi_ADC_rxbuf);
|
||||
if (instru.VinAutoGainEnable) {
|
||||
AutoGainChangeVin(MEAS_VIN(wm));
|
||||
} else {
|
||||
if (lastVinADCGainLv != instru.VinADCGainLv) {
|
||||
VinADCGainCtrl(instru.VinADCGainLv);
|
||||
}
|
||||
}
|
||||
|
||||
if (record_flag == false) {
|
||||
rec_cnt++;
|
||||
}
|
||||
|
||||
if (rec_cnt == 2) {
|
||||
record_flag = true;
|
||||
rec_cnt = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void read_Vout_change_gain(void)
|
||||
{
|
||||
static uint8_t rec_cnt = 0;
|
||||
void *wm = wm_get();
|
||||
|
||||
/* read Vout and do NOT record the Vout after changing gain twice */
|
||||
MEAS_VOUT(wm) = read_cali_Vout(spi_ADC_rxbuf);
|
||||
|
||||
if (record_flag == false) {
|
||||
rec_cnt++;
|
||||
}
|
||||
|
||||
if (rec_cnt == 2) {
|
||||
record_flag = true;
|
||||
rec_cnt = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void Iin_Vin_Vout_Plot(void)
|
||||
{
|
||||
static uint8_t ADC_cnt = 0;
|
||||
void *wm = wm_get();
|
||||
|
||||
/* the time for measuring battery */
|
||||
if (batteryCheck_flag) {
|
||||
EliteADCBattery();
|
||||
if (!batteryCheck_flag) {
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
ADC_cnt = 5;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* the time for Not measuring battery */
|
||||
/* ADC_cnt: 0 - read Iin and do NOT buffer the Iin after changing gain twice,
|
||||
* and output DAC, and read Vin, and increase ADC_cnt
|
||||
* 1 - read Vin and increase ADC_cnt
|
||||
* 2 - read Vin and do NOT buffer the Vin after changing gain twice,
|
||||
* and output DAC, and read Iin, and increase ADC_cnt
|
||||
* 3 - read Iin and reset ADC_cnt
|
||||
*/
|
||||
if (ADC_cnt == 0) {
|
||||
read_Iin_change_gain();
|
||||
DACenable(AFTER_READ_I);
|
||||
ReadADCVin(spi_ADC_rxbuf);
|
||||
ADC_cnt++;
|
||||
|
||||
} else if (ADC_cnt == 1) {
|
||||
ReadADCVin(spi_ADC_rxbuf);
|
||||
ADC_cnt++;
|
||||
|
||||
} else if (ADC_cnt == 2) {
|
||||
read_Vin_change_gain();
|
||||
DACenable(AFTER_READ_V);
|
||||
ReadADCVout(spi_ADC_rxbuf);
|
||||
ADC_cnt++;
|
||||
|
||||
} else if (ADC_cnt == 3) {
|
||||
ReadADCVout(spi_ADC_rxbuf);
|
||||
ADC_cnt++;
|
||||
|
||||
} else if (ADC_cnt == 4) {
|
||||
read_Vout_change_gain();
|
||||
DACenable(AFTER_READ_V); // to volt_out -> DACOutput(DACoutCode)
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
ADC_cnt++;
|
||||
|
||||
} else if (ADC_cnt == 5) {
|
||||
ReadADCIin(spi_ADC_rxbuf);
|
||||
ADC_cnt = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void CV_Plot(void)
|
||||
{
|
||||
struct wm_cv_ctx_t *cv = (struct wm_cv_ctx_t *)wm_get();
|
||||
static uint8_t ADC_cnt = 0;
|
||||
void *wm = wm_get();
|
||||
|
||||
if (ADC_cnt == 0) {
|
||||
DACenable(AFTER_READ_V);
|
||||
ADC_cnt++;
|
||||
|
||||
} else if (ADC_cnt == 1) {
|
||||
LPTIA_change_gain();
|
||||
ADC_cnt++;
|
||||
|
||||
} else if (ADC_cnt == 2) {
|
||||
read_LPTIA_Iin();
|
||||
ADC_cnt = 0;
|
||||
}
|
||||
InputNotify(NOTIFY_VOLT, MEAS_VOUT(wm));
|
||||
// InputNotify(NOTIFY_CURRENT, MEAS_CURR(wm));
|
||||
// InputNotify(NOTIFY_IMPEDANCE, instru.ADCGainLv);
|
||||
return;
|
||||
}
|
||||
|
||||
static void EIS_Plot(void) //real and imag impedance plot
|
||||
{
|
||||
struct wm_eis_ctx_t *eis = (struct wm_eis_ctx_t *)wm_get();
|
||||
static uint8_t ADC_cnt = 0;
|
||||
static int32_t realSum, imagSum = 0;
|
||||
int32_t avg_real, avg_imag = 0;
|
||||
static uint8_t avg_count, high_freq_cnt = 0;
|
||||
void *wm = wm_get();
|
||||
|
||||
if (fout_flag){
|
||||
DAC_outputF(Freq2DAC(instru.fset));
|
||||
EnDFTnADC(1);
|
||||
instru.sampleRate = CalcDelayTime(instru.fset);
|
||||
fout_flag = false;
|
||||
if (eis->_in_reset_flag) {
|
||||
avg_count = 0;
|
||||
high_freq_cnt = 0;
|
||||
realSum = 0;
|
||||
imagSum = 0;
|
||||
ADC_cnt = 0;
|
||||
eis->_in_reset_flag = false;
|
||||
}
|
||||
} else {
|
||||
if (ADC_cnt == 0){
|
||||
HSTIA_change_gain();
|
||||
if (gainChange_flag) {
|
||||
gainChange_flag = false;
|
||||
instru.sampleRate = CalcDelayTime(instru.fset);
|
||||
instru.real = 0;
|
||||
instru.imag = 0;
|
||||
ADC_cnt = 0;
|
||||
} else {
|
||||
instru.sampleRate = 15;
|
||||
ADC_cnt ++;
|
||||
}
|
||||
}
|
||||
else if (ADC_cnt == 1) {
|
||||
HSTIA_change_gain();
|
||||
if (firstFreq_flag) {
|
||||
if (instru.fset >= 10000000) {
|
||||
if (high_freq_cnt == 3) {
|
||||
firstFreq_flag = false;
|
||||
}
|
||||
high_freq_cnt ++;
|
||||
} else {
|
||||
firstFreq_flag = false;
|
||||
}
|
||||
instru.sampleRate = CalcDelayTime(instru.fset);
|
||||
instru.real = 0;
|
||||
instru.imag = 0;
|
||||
ADC_cnt = 0;
|
||||
} else {
|
||||
instru.sampleRate = 15;
|
||||
ADC_cnt ++;
|
||||
}
|
||||
}
|
||||
else if (ADC_cnt == 2) {
|
||||
realSum += instru.real;
|
||||
imagSum += instru.imag;
|
||||
avg_count++;
|
||||
instru.sampleRate = CalcDelayTime(instru.fset);
|
||||
if (avg_count == avgNumTable[instru.avgnum]){
|
||||
avg_real = (realSum + avg_count / 2) / avg_count;
|
||||
avg_imag = (imagSum + avg_count / 2) / avg_count;
|
||||
avg_count = 0;
|
||||
realSum = 0;
|
||||
imagSum = 0;
|
||||
EnDFTnADC(0);
|
||||
if(eis->_direction_up){
|
||||
if (instru.fset >= eis->_fmax) {
|
||||
PeriodicEvent = false;
|
||||
finishMode = 1;
|
||||
}
|
||||
} else {
|
||||
if (instru.fset <= eis->_fmin) {
|
||||
PeriodicEvent = false;
|
||||
finishMode = 1;
|
||||
}
|
||||
}
|
||||
notify_flag = true;
|
||||
high_freq_cnt = 0;
|
||||
}
|
||||
ADC_cnt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
InputNotify(NOTIFY_CURRENT, avg_imag);
|
||||
InputNotify(NOTIFY_VOLT, avg_real);
|
||||
InputNotify(NOTIFY_IMPEDANCE, instru.fset);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void cali_IT_plot(void) {
|
||||
void *wm = wm_get();
|
||||
|
||||
static int32_t ADCValueSUM = 0;
|
||||
static uint16_t cali_count = 0;
|
||||
static uint8_t ADC_cnt = 0;
|
||||
static uint8_t rec_cnt = 0;
|
||||
static uint16_t cali_count_max = 5000;
|
||||
int32_t ADCValueAVG = 0;
|
||||
int32_t temp = 0;
|
||||
|
||||
/* ADC_cnt: 0 - read Iin and do NOT buffer the Iin after changing gain twice
|
||||
* 1 - read Iin and increase ADC_cnt
|
||||
* 2 - read Iin and reset ADC_cnt
|
||||
*/
|
||||
if (ADC_cnt == 0) {
|
||||
if (instru.HSTIAAutoGainEnable) {
|
||||
temp = 0xFFFF;
|
||||
} else {
|
||||
// MEAS_CURR(wm) = (ReadRawADC() & 0x0000FFFF);
|
||||
temp = (ReadRealZ() & 0x0003FFFF);
|
||||
}
|
||||
|
||||
// switch (instru.AdcChannel) {
|
||||
// case EIS_HSTIA: {
|
||||
// if (instru.HSTIAGainLv == 0) {
|
||||
// cali_count_max = 5000;
|
||||
// } else {
|
||||
// cali_count_max = 1000;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// case EIS_LPTIA: {
|
||||
// if (instru.LPTIAGainLv == 0) {
|
||||
// cali_count_max = 5000;
|
||||
// } else {
|
||||
// cali_count_max = 1000;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// default:{
|
||||
// cali_count_max = 1000;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
cali_count_max = 3000;
|
||||
|
||||
if (record_flag == false) {
|
||||
rec_cnt++;
|
||||
} else {
|
||||
if (cali_count >= cali_count_max) {
|
||||
ADCValueAVG = ADCValueSUM / cali_count;
|
||||
|
||||
InputNotify(NOTIFY_CURRENT, ADCValueAVG);
|
||||
// InputNotify(NOTIFY_VOLT, ADCValueAVG);
|
||||
SendNotify();
|
||||
|
||||
uint8_t CIS_buf[9] = {0};
|
||||
CIS_buf[0] = instru.chip_id;
|
||||
CIS_buf[1] = (uint8_t) ((ADCValueAVG & 0xFF00) >> 8);
|
||||
CIS_buf[2] = (uint8_t) (ADCValueAVG & 0x00FF);
|
||||
CIS_buf[3] = 0x00;
|
||||
CIS_buf[4] = instru.HSTIAGainLv;
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, 9, CIS_buf);
|
||||
|
||||
PeriodicEvent = false;
|
||||
ADCValueSUM = 0;
|
||||
cali_count = 0;
|
||||
ModeLED(NO_EVENT);
|
||||
} else {
|
||||
cali_count++;
|
||||
ADCValueSUM = ADCValueSUM + temp;
|
||||
InputNotify(NOTIFY_CURRENT, temp);
|
||||
InputNotify(NOTIFY_VOLT, temp);
|
||||
// InputNotify(NOTIFY_IMPEDANCE, (int32_t)cali_count);
|
||||
}
|
||||
}
|
||||
|
||||
if (rec_cnt == 2) {
|
||||
record_flag = true;
|
||||
rec_cnt = 0;
|
||||
}
|
||||
ADC_cnt++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ADC_cnt == 1) {
|
||||
ReadRealZ();
|
||||
ADC_cnt++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ADC_cnt == 2) {
|
||||
ReadRealZ();
|
||||
ADC_cnt = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void cali_VT_plot(void) {
|
||||
void *wm = wm_get();
|
||||
|
||||
static int32_t ADCValueSUM = 0;
|
||||
static uint16_t cali_count = 0;
|
||||
static uint8_t ADC_cnt = 0;
|
||||
static uint8_t rec_cnt = 0;
|
||||
uint16_t cali_count_max = 0;
|
||||
int32_t ADCValueAVG = 0;
|
||||
int32_t temp = 0;
|
||||
|
||||
/* ADC_cnt: 0 - read Vin and do NOT buffer the Vin after changing gain twice
|
||||
* 1 - read Vin and increase ADC_cnt
|
||||
* 2 - read Vin and reset ADC_cnt
|
||||
*/
|
||||
if (ADC_cnt == 0) {
|
||||
if (instru.LPTIAAutoGainEnable) {
|
||||
// MEAS_VIN(wm) = 0xFFFF;
|
||||
temp = 0xFFFF;
|
||||
} else {
|
||||
// ReadADCVin(spi_ADC_rxbuf);
|
||||
// MEAS_VIN(wm) = (int32_t) (spi_ADC_rxbuf[0] << 8) | (int32_t) (spi_ADC_rxbuf[1]);
|
||||
temp = (ReadRealZ() & 0x0003FFFF);
|
||||
// if (lastVinADCGainLv != instru.VinADCGainLv) VinADCGainCtrl(instru.VinADCGainLv);
|
||||
}
|
||||
|
||||
// if (instru.VinADCGainLv == 0) {
|
||||
cali_count_max = 3000;
|
||||
// } else {
|
||||
// cali_count_max = 1000;
|
||||
// }
|
||||
|
||||
if (record_flag == false) {
|
||||
rec_cnt++;
|
||||
} else {
|
||||
if (cali_count >= cali_count_max) {
|
||||
ADCValueAVG = ADCValueSUM / cali_count;
|
||||
|
||||
InputNotify(NOTIFY_VOLT, ADCValueAVG);
|
||||
SendNotify();
|
||||
|
||||
uint8_t CIS_buf[9] = {0};
|
||||
CIS_buf[0] = instru.chip_id;
|
||||
CIS_buf[1] = (uint8_t) ((ADCValueAVG & 0xFF00) >> 8);
|
||||
CIS_buf[2] = (uint8_t) (ADCValueAVG & 0x00FF);
|
||||
CIS_buf[3] = 0x00;
|
||||
CIS_buf[4] = instru.VinADCGainLv;
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, 9, CIS_buf);
|
||||
|
||||
PeriodicEvent = false;
|
||||
ADCValueSUM = 0;
|
||||
cali_count = 0;
|
||||
ModeLED(NO_EVENT);
|
||||
} else {
|
||||
cali_count++;
|
||||
ADCValueSUM = ADCValueSUM + temp;
|
||||
InputNotify(NOTIFY_VOLT, temp);
|
||||
InputNotify(NOTIFY_CURRENT, ADCValueSUM);
|
||||
InputNotify(NOTIFY_IMPEDANCE, (int32_t)cali_count);
|
||||
}
|
||||
}
|
||||
|
||||
if (rec_cnt == 2) {
|
||||
record_flag = true;
|
||||
rec_cnt = 0;
|
||||
}
|
||||
ADC_cnt++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ADC_cnt == 1) {
|
||||
// ReadRealZ();
|
||||
ADC_cnt++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ADC_cnt == 2) {
|
||||
// ReadRealZ();
|
||||
ADC_cnt = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#ifndef HEADSTAGE_POWER_H
|
||||
#define HEADSTAGE_POWER_H
|
||||
|
||||
#include <ti/drivers/Power.h>
|
||||
#include <ti/drivers/power/PowerCC26XX.h>
|
||||
|
||||
#define headstage_power_shutdown() Power_shutdown(NULL, 0)
|
||||
|
||||
#endif // HEADSTAGE_POWER_H
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
|
||||
#ifndef VERSION_DATE
|
||||
#define VERSION_DATE
|
||||
|
||||
#define VERSION_DATE_YEAR 21
|
||||
#define VERSION_DATE_MONTH 8
|
||||
#define VERSION_DATE_DAY 30
|
||||
#define VERSION_DATE_HOUR 15
|
||||
#define VERSION_DATE_MINUTE 47
|
||||
|
||||
// this is NOT the version hash !!
|
||||
// it's the last version hash
|
||||
#define VERSION_HASH 8808490caa465cc94d14896de28763a5e5c4672b
|
||||
#define VERSION_GIT_BRANCH Elite_OBJ_0.2mv
|
||||
#endif
|
||||
+197
@@ -0,0 +1,197 @@
|
||||
#include "eis_cali_table.h"
|
||||
|
||||
/* SendCaliValue
|
||||
* 2~ : cutoff frequency
|
||||
* 4~5 : voltage amplitude
|
||||
* 2 : phase parameter a
|
||||
* 3 : phase parameter b
|
||||
* 4 : HSRTIA200R
|
||||
* 5 : HSRTIA5K
|
||||
* 6 : HSRTIA20K
|
||||
* 7 : HSRTIA160K
|
||||
*/
|
||||
|
||||
static void SendCaliValue0(void) {
|
||||
uint8_t cali_buf[BLE_CIS_BUFF_SIZE];
|
||||
|
||||
uint8_t index = 2;
|
||||
|
||||
cali_buf[1] = instru.chip_id;
|
||||
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.CutoffFreq >> 24) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.CutoffFreq >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.CutoffFreq >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.CutoffFreq & 0xFF;
|
||||
|
||||
// cali_buf[index++] = (uint8_t) CaliTable.Temp & 0xFF;
|
||||
|
||||
// cali_buf[index++] = (uint8_t) CaliTable.HSRTIA200R & 0xFF;
|
||||
//
|
||||
// cali_buf[index++] = (uint8_t) (CaliTable.HSRTIA5K >> 8) & 0xFF;
|
||||
// cali_buf[index++] = (uint8_t) CaliTable.HSRTIA5K & 0xFF;
|
||||
|
||||
// cali_buf[index++] = (uint8_t) (CaliTable.HSRTIA20K >> 8) & 0xFF;
|
||||
// cali_buf[index++] = (uint8_t) CaliTable.HSRTIA20K & 0xFF;
|
||||
//
|
||||
// cali_buf[index++] = (uint8_t) (CaliTable.HSRTIA160K >> 24) & 0xFF;
|
||||
// cali_buf[index++] = (uint8_t) (CaliTable.HSRTIA160K >> 16) & 0xFF;
|
||||
// cali_buf[index++] = (uint8_t) (CaliTable.HSRTIA160K >> 8) & 0xFF;
|
||||
// cali_buf[index++] = (uint8_t) CaliTable.HSRTIA160K & 0xFF;
|
||||
|
||||
cali_buf[0] = index - 1;
|
||||
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, 20, cali_buf);
|
||||
}
|
||||
|
||||
static void SendCaliValue1(void) {
|
||||
uint8_t cali_buf[BLE_CIS_BUFF_SIZE];
|
||||
|
||||
uint8_t filter_number1 = 2, index = 2;
|
||||
|
||||
cali_buf[1] = instru.chip_id;
|
||||
|
||||
for (int i = 0; i < filter_number1 ; i++) {
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ft[i].PhaseParaA >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ft[i].PhaseParaA >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ft[i].PhaseParaA >> 8)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Ft[i].PhaseParaA & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ft[i].PhaseParaB >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ft[i].PhaseParaB >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ft[i].PhaseParaB >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Ft[i].PhaseParaB & 0xFF;
|
||||
}
|
||||
|
||||
cali_buf[0] = index - 1;
|
||||
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, 20, cali_buf);
|
||||
}
|
||||
|
||||
static void SendCaliValue2(void) {
|
||||
uint8_t cali_buf[BLE_CIS_BUFF_SIZE];
|
||||
|
||||
uint8_t filter_number1 = 2, filter_number2 = 4, index = 2;
|
||||
|
||||
cali_buf[1] = instru.chip_id;
|
||||
|
||||
for (int i = filter_number1; i < filter_number2 ; i++) {
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ft[i].PhaseParaA >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ft[i].PhaseParaA >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ft[i].PhaseParaA >> 8)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Ft[i].PhaseParaA & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ft[i].PhaseParaB >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ft[i].PhaseParaB >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ft[i].PhaseParaB >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Ft[i].PhaseParaB & 0xFF;
|
||||
}
|
||||
|
||||
cali_buf[0] = index - 1;
|
||||
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, index, cali_buf);
|
||||
}
|
||||
|
||||
static void SendCaliValue3(void) {
|
||||
uint8_t cali_buf[BLE_CIS_BUFF_SIZE];
|
||||
|
||||
uint8_t index = 2;
|
||||
|
||||
cali_buf[1] = instru.chip_id;
|
||||
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[0].HSRTIA_a >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[0].HSRTIA_a >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[0].HSRTIA_a >> 8)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[0].HSRTIA_a & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[0].HSRTIA_b >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[0].HSRTIA_b >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[0].HSRTIA_b >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[0].HSRTIA_b & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[0].HSRTIA_c >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[0].HSRTIA_c >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[0].HSRTIA_c >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[0].HSRTIA_c & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[0].HSRTIA_d & 0xFF;
|
||||
|
||||
cali_buf[0] = index - 1;
|
||||
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, index, cali_buf);
|
||||
}
|
||||
|
||||
static void SendCaliValue4(void) {
|
||||
uint8_t cali_buf[BLE_CIS_BUFF_SIZE];
|
||||
|
||||
uint8_t index = 2;
|
||||
|
||||
cali_buf[1] = instru.chip_id;
|
||||
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[1].HSRTIA_a >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[1].HSRTIA_a >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[1].HSRTIA_a >> 8)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[1].HSRTIA_a & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[1].HSRTIA_b >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[1].HSRTIA_b >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[1].HSRTIA_b >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[1].HSRTIA_b & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[1].HSRTIA_c >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[1].HSRTIA_c >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[1].HSRTIA_c >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[1].HSRTIA_c & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[1].HSRTIA_d & 0xFF;
|
||||
|
||||
cali_buf[0] = index - 1;
|
||||
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, index, cali_buf);
|
||||
}
|
||||
|
||||
static void SendCaliValue5(void) {
|
||||
uint8_t cali_buf[BLE_CIS_BUFF_SIZE];
|
||||
|
||||
uint8_t index = 2;
|
||||
|
||||
cali_buf[1] = instru.chip_id;
|
||||
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[2].HSRTIA_a >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[2].HSRTIA_a >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[2].HSRTIA_a >> 8)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[2].HSRTIA_a & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[2].HSRTIA_b >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[2].HSRTIA_b >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[2].HSRTIA_b >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[2].HSRTIA_b & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[2].HSRTIA_c >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[2].HSRTIA_c >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[2].HSRTIA_c >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[2].HSRTIA_c & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[2].HSRTIA_d & 0xFF;
|
||||
|
||||
cali_buf[0] = index - 1;
|
||||
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, index, cali_buf);
|
||||
}
|
||||
|
||||
static void SendCaliValue6(void) {
|
||||
uint8_t cali_buf[BLE_CIS_BUFF_SIZE];
|
||||
|
||||
uint8_t index = 2;
|
||||
|
||||
cali_buf[1] = instru.chip_id;
|
||||
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[3].HSRTIA_a >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[3].HSRTIA_a >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[3].HSRTIA_a >> 8)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[3].HSRTIA_a & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[3].HSRTIA_b >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[3].HSRTIA_b >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[3].HSRTIA_b >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[3].HSRTIA_b & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[3].HSRTIA_c >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[3].HSRTIA_c >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[3].HSRTIA_c >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[3].HSRTIA_c & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[3].HSRTIA_d >> 24)& 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[3].HSRTIA_d >> 16) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Lv[3].HSRTIA_d >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Lv[3].HSRTIA_d & 0xFF;
|
||||
|
||||
cali_buf[0] = index - 1;
|
||||
|
||||
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, index, cali_buf);
|
||||
}
|
||||
+448
@@ -0,0 +1,448 @@
|
||||
#ifndef EIS_CALI_TABLE
|
||||
#define EIS_CALI_TABLE
|
||||
|
||||
#define BOARD_TEST
|
||||
|
||||
typedef struct _SingleFilterCali{
|
||||
uint32_t PhaseParaA;
|
||||
int32_t PhaseParaB;
|
||||
}SingleFilterCali;
|
||||
|
||||
typedef struct _SingleGainLvCali{
|
||||
long long HSTIA_coeff;
|
||||
long long HSTIA_offset;
|
||||
long long LPTIA_coeff;
|
||||
long long LPTIA_offset;
|
||||
uint32_t HSRTIA_a;
|
||||
int32_t HSRTIA_b;
|
||||
int32_t HSRTIA_c;
|
||||
uint32_t HSRTIA_d;
|
||||
uint16_t HSRTIA_root;
|
||||
}SingleGainLvCali;
|
||||
|
||||
struct _CaliTable{
|
||||
//CIS to Controller
|
||||
char DeviceName[25];
|
||||
uint32_t CutoffFreq;
|
||||
int32_t DAC_offset;
|
||||
SingleFilterCali Ft[7];
|
||||
|
||||
//EIS
|
||||
long long HSDAC_coeff;
|
||||
long long HSDAC_offset;
|
||||
long long LPDAC_coeff;
|
||||
long long LPDAC_offset;
|
||||
long long HSAMP_coeff;
|
||||
long long HSAMP_offset;
|
||||
SingleGainLvCali Lv[4];
|
||||
|
||||
}CaliTable =
|
||||
|
||||
#ifdef BOARD_TEST
|
||||
{
|
||||
//CIS to Controller
|
||||
.DeviceName = "BOARD_TEST",
|
||||
.CutoffFreq = 250000,
|
||||
.DAC_offset = 0, // * 200 [5n]
|
||||
|
||||
// hsrtia160k
|
||||
.Lv[0].HSRTIA_a = 0, // 1e8
|
||||
.Lv[0].HSRTIA_b = 1, // 1e8
|
||||
.Lv[0].HSRTIA_c = 0, // 1e4
|
||||
.Lv[0].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia20k
|
||||
.Lv[1].HSRTIA_a = 0, // 1e8
|
||||
.Lv[1].HSRTIA_b = 1, // 1e8
|
||||
.Lv[1].HSRTIA_c = 0, // 1e4
|
||||
.Lv[1].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia5k
|
||||
.Lv[2].HSRTIA_a = 0, //1e8
|
||||
.Lv[2].HSRTIA_b = 1, // 1e8
|
||||
.Lv[2].HSRTIA_c = 0, // 1e4
|
||||
.Lv[2].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia200r a*exp(bx) + c*exp(dx)
|
||||
.Lv[3].HSRTIA_a = 1,
|
||||
.Lv[3].HSRTIA_b = 0, // 1e6
|
||||
.Lv[3].HSRTIA_c = 1, // 1e5
|
||||
.Lv[3].HSRTIA_d = 0, // 1e6
|
||||
|
||||
.Ft[0].PhaseParaA = 15,
|
||||
.Ft[0].PhaseParaB = -9000,
|
||||
.Ft[1].PhaseParaA = 15,
|
||||
.Ft[1].PhaseParaB = -9000,
|
||||
.Ft[2].PhaseParaA = 15,
|
||||
.Ft[2].PhaseParaB = -9000,
|
||||
.Ft[3].PhaseParaA = 15,
|
||||
.Ft[3].PhaseParaB = -9000,
|
||||
|
||||
//only for EIS 1e10
|
||||
.HSAMP_coeff = 9703610267,
|
||||
.HSAMP_offset = -12815281473,
|
||||
|
||||
.LPDAC_coeff = 10000464997,
|
||||
.LPDAC_offset = -75871559054,
|
||||
|
||||
.HSDAC_coeff = 25196655311242,
|
||||
.HSDAC_offset = 19932276246516,
|
||||
|
||||
.Lv[0].HSTIA_coeff = 1,
|
||||
.Lv[0].HSTIA_offset = 0,
|
||||
.Lv[1].HSTIA_coeff = 1,
|
||||
.Lv[1].HSTIA_offset = 0,
|
||||
.Lv[2].HSTIA_coeff = 1,
|
||||
.Lv[2].HSTIA_offset = 0,
|
||||
.Lv[3].HSTIA_coeff = 1,
|
||||
.Lv[3].HSTIA_offset = 0,
|
||||
|
||||
.Lv[0].LPTIA_coeff = 1,
|
||||
.Lv[0].LPTIA_offset = 0,
|
||||
.Lv[1].LPTIA_coeff = 1,
|
||||
.Lv[1].LPTIA_offset = 0,
|
||||
.Lv[2].LPTIA_coeff = 1,
|
||||
.Lv[2].LPTIA_offset = 0,
|
||||
.Lv[3].LPTIA_coeff = 1,
|
||||
.Lv[3].LPTIA_offset = 0
|
||||
};
|
||||
|
||||
#elif defined(BOARD_A4_DA_32_D4_EF_CF)
|
||||
{
|
||||
.DeviceName = "BOARD_A4_DA_32_D4_EF_CF",
|
||||
.CutoffFreq = 271000,
|
||||
.DAC_offset = -19250, // * 200 [5n]
|
||||
|
||||
// hsrtia160k
|
||||
.Lv[0].HSRTIA_a = 0, // 1e8
|
||||
.Lv[0].HSRTIA_b = 8005810, // 1e8
|
||||
.Lv[0].HSRTIA_c = -171109, // 1e4
|
||||
.Lv[0].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia20k
|
||||
.Lv[1].HSRTIA_a = 357, // 1e8
|
||||
.Lv[1].HSRTIA_b = 57813915, // 1e8
|
||||
.Lv[1].HSRTIA_c = 1543941, // 1e4
|
||||
.Lv[1].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia5k
|
||||
.Lv[2].HSRTIA_a = 15417, //1e8
|
||||
.Lv[2].HSRTIA_b = -62720427, // 1e8
|
||||
.Lv[2].HSRTIA_c = 225612029, // 1e4
|
||||
.Lv[2].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia200r a*exp(bx) + c*exp(dx)
|
||||
.Lv[3].HSRTIA_a = 20450,
|
||||
.Lv[3].HSRTIA_b = 1611, // 1e6
|
||||
.Lv[3].HSRTIA_c = 4069, // 1e5
|
||||
.Lv[3].HSRTIA_d = 7499, // 1e6
|
||||
|
||||
.Ft[0].PhaseParaA = 141808, //1e10
|
||||
.Ft[0].PhaseParaB = -88304901, // 10000 Hz //1e6
|
||||
.Ft[1].PhaseParaA = 338333,
|
||||
.Ft[1].PhaseParaB = -89912194, // 100 Hz
|
||||
.Ft[2].PhaseParaA = 20541858,
|
||||
.Ft[2].PhaseParaB = -90000573, // 10 Hz
|
||||
.Ft[3].PhaseParaA = 100923290,
|
||||
.Ft[3].PhaseParaB = -90023337, // 0.01 Hz
|
||||
|
||||
//only for EIS 1e10
|
||||
.HSAMP_coeff = 9703610267,
|
||||
.HSAMP_offset = -12815281473,
|
||||
|
||||
.LPDAC_coeff = 10000464997,
|
||||
.LPDAC_offset = -75871559054,
|
||||
|
||||
.HSDAC_coeff = 25196655311242,
|
||||
.HSDAC_offset = 19932276246516,
|
||||
|
||||
.Lv[0].HSTIA_coeff = -1062,
|
||||
.Lv[0].HSTIA_offset = 67755568664846,
|
||||
.Lv[1].HSTIA_coeff = 23,
|
||||
.Lv[1].HSTIA_offset = 101767408723,
|
||||
.Lv[2].HSTIA_coeff = -31,
|
||||
.Lv[2].HSTIA_offset = 2037756,
|
||||
.Lv[3].HSTIA_coeff = -66623,
|
||||
.Lv[3].HSTIA_offset = 44299692,
|
||||
|
||||
.Lv[0].LPTIA_coeff = 1,
|
||||
.Lv[0].LPTIA_offset = 0,
|
||||
.Lv[1].LPTIA_coeff = 1,
|
||||
.Lv[1].LPTIA_offset = 0,
|
||||
.Lv[2].LPTIA_coeff = 1,
|
||||
.Lv[2].LPTIA_offset = 0,
|
||||
.Lv[3].LPTIA_coeff = 1,
|
||||
.Lv[3].LPTIA_offset = 0
|
||||
};
|
||||
|
||||
#elif defined(BOARD_A4_DA_32_D4_ED_BF)
|
||||
{
|
||||
.DeviceName = "BOARD_A4_DA_32_D4_ED_BF",
|
||||
.CutoffFreq = 262000,
|
||||
.DAC_offset = -19250, // * 200 [5n]
|
||||
|
||||
// hsrtia160k
|
||||
.Lv[0].HSRTIA_a = 0, // 1e8
|
||||
.Lv[0].HSRTIA_b = 8053030, // 1e8
|
||||
.Lv[0].HSRTIA_c = -217364, // 1e4
|
||||
.Lv[0].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia20k
|
||||
.Lv[1].HSRTIA_a = 350, // 1e8
|
||||
.Lv[1].HSRTIA_b = 58929847, // 1e8
|
||||
.Lv[1].HSRTIA_c = 1111691, // 1e4
|
||||
.Lv[1].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia5k
|
||||
.Lv[2].HSRTIA_a = 14842, //1e8
|
||||
.Lv[2].HSRTIA_b = -38831335, // 1e8
|
||||
.Lv[2].HSRTIA_c = 207680613, // 1e4
|
||||
.Lv[2].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia200r a*exp(bx) + c*exp(dx)
|
||||
.Lv[3].HSRTIA_a = 20160,
|
||||
.Lv[3].HSRTIA_b = 1609, // 1e6
|
||||
.Lv[3].HSRTIA_c = 1085, // 1e5
|
||||
.Lv[3].HSRTIA_d = 7883, // 1e6
|
||||
|
||||
.Ft[0].PhaseParaA = 144194, //1e10
|
||||
.Ft[0].PhaseParaB = -88614855, // 10000 Hz //1e6
|
||||
.Ft[1].PhaseParaA = 342333,
|
||||
.Ft[1].PhaseParaB = -89906917, // 100 Hz
|
||||
.Ft[2].PhaseParaA = 20561112,
|
||||
.Ft[2].PhaseParaB = -90006375, // 10 Hz
|
||||
.Ft[3].PhaseParaA = 100878445,
|
||||
.Ft[3].PhaseParaB = -90013670, // 0.01 Hz
|
||||
|
||||
//only for EIS 1e10
|
||||
.HSAMP_coeff = 9703610267,
|
||||
.HSAMP_offset = -12815281473,
|
||||
|
||||
.LPDAC_coeff = 10000464997,
|
||||
.LPDAC_offset = -75871559054,
|
||||
|
||||
.HSDAC_coeff = 25196655311242,
|
||||
.HSDAC_offset = 19932276246516,
|
||||
|
||||
.Lv[0].HSTIA_coeff = -1062,
|
||||
.Lv[0].HSTIA_offset = 67755568664846,
|
||||
.Lv[1].HSTIA_coeff = 23,
|
||||
.Lv[1].HSTIA_offset = 101767408723,
|
||||
.Lv[2].HSTIA_coeff = -31,
|
||||
.Lv[2].HSTIA_offset = 2037756,
|
||||
.Lv[3].HSTIA_coeff = -66623,
|
||||
.Lv[3].HSTIA_offset = 44299692,
|
||||
|
||||
.Lv[0].LPTIA_coeff = 1,
|
||||
.Lv[0].LPTIA_offset = 0,
|
||||
.Lv[1].LPTIA_coeff = 1,
|
||||
.Lv[1].LPTIA_offset = 0,
|
||||
.Lv[2].LPTIA_coeff = 1,
|
||||
.Lv[2].LPTIA_offset = 0,
|
||||
.Lv[3].LPTIA_coeff = 1,
|
||||
.Lv[3].LPTIA_offset = 0
|
||||
};
|
||||
|
||||
#elif defined(BOARD_A4_DA_32_D4_F0_59)
|
||||
{
|
||||
.DeviceName = "BOARD_A4_DA_32_D4_F0_59",
|
||||
.CutoffFreq = 265000,
|
||||
.DAC_offset = -19250, // * 200 [5n]
|
||||
|
||||
// hsrtia160k
|
||||
.Lv[0].HSRTIA_a = 0, // 1e8
|
||||
.Lv[0].HSRTIA_b = 7982677, // 1e8
|
||||
.Lv[0].HSRTIA_c = -220834, // 1e4
|
||||
.Lv[0].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia20k
|
||||
.Lv[1].HSRTIA_a = 386, // 1e8
|
||||
.Lv[1].HSRTIA_b = 56887373, // 1e8
|
||||
.Lv[1].HSRTIA_c = 2369927, // 1e4
|
||||
.Lv[1].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia5k
|
||||
.Lv[2].HSRTIA_a = 14859, //1e8
|
||||
.Lv[2].HSRTIA_b = -43698725, // 1e8
|
||||
.Lv[2].HSRTIA_c = 210542432, // 1e4
|
||||
.Lv[2].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia200r a*exp(bx) + c*exp(dx)
|
||||
.Lv[3].HSRTIA_a = 19600,
|
||||
.Lv[3].HSRTIA_b = 1637, // 1e6
|
||||
.Lv[3].HSRTIA_c = 659, // 1e5
|
||||
.Lv[3].HSRTIA_d = 8167, // 1e6
|
||||
|
||||
.Ft[0].PhaseParaA = 146177, //1e10
|
||||
.Ft[0].PhaseParaB = -88604805, // 10000 Hz //1e6
|
||||
.Ft[1].PhaseParaA = 342195,
|
||||
.Ft[1].PhaseParaB = -89912214, // 100 Hz
|
||||
.Ft[2].PhaseParaA = 20559398,
|
||||
.Ft[2].PhaseParaB = -90006634, // 10 Hz
|
||||
.Ft[3].PhaseParaA = 100415851,
|
||||
.Ft[3].PhaseParaB = -89982615, // 0.01 Hz
|
||||
|
||||
//only for EIS 1e10
|
||||
.HSAMP_coeff = 9703610267,
|
||||
.HSAMP_offset = -12815281473,
|
||||
|
||||
.LPDAC_coeff = 10000464997,
|
||||
.LPDAC_offset = -75871559054,
|
||||
|
||||
.HSDAC_coeff = 25196655311242,
|
||||
.HSDAC_offset = 19932276246516,
|
||||
|
||||
.Lv[0].HSTIA_coeff = -1062,
|
||||
.Lv[0].HSTIA_offset = 67755568664846,
|
||||
.Lv[1].HSTIA_coeff = 23,
|
||||
.Lv[1].HSTIA_offset = 101767408723,
|
||||
.Lv[2].HSTIA_coeff = -31,
|
||||
.Lv[2].HSTIA_offset = 2037756,
|
||||
.Lv[3].HSTIA_coeff = -66623,
|
||||
.Lv[3].HSTIA_offset = 44299692,
|
||||
|
||||
.Lv[0].LPTIA_coeff = 1,
|
||||
.Lv[0].LPTIA_offset = 0,
|
||||
.Lv[1].LPTIA_coeff = 1,
|
||||
.Lv[1].LPTIA_offset = 0,
|
||||
.Lv[2].LPTIA_coeff = 1,
|
||||
.Lv[2].LPTIA_offset = 0,
|
||||
.Lv[3].LPTIA_coeff = 1,
|
||||
.Lv[3].LPTIA_offset = 0
|
||||
};
|
||||
|
||||
#elif defined(BOARD_A4_DA_32_D4_ED_91)
|
||||
{
|
||||
.DeviceName = "BOARD_A4_DA_32_D4_ED_91",
|
||||
.CutoffFreq = 265550,
|
||||
.DAC_offset = -19250,
|
||||
|
||||
// hsrtia160k
|
||||
.Lv[0].HSRTIA_a = 0, // 1e8
|
||||
.Lv[0].HSRTIA_b = 7983901, // 1e8
|
||||
.Lv[0].HSRTIA_c = -217990, // 1e4
|
||||
.Lv[0].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia20k
|
||||
.Lv[1].HSRTIA_a = 338, // 1e8
|
||||
.Lv[1].HSRTIA_b = 58576686, // 1e8
|
||||
.Lv[1].HSRTIA_c = 1238326, // 1e4
|
||||
.Lv[1].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia5k
|
||||
.Lv[2].HSRTIA_a = 14554, //1e8
|
||||
.Lv[2].HSRTIA_b = -36919197, // 1e8
|
||||
.Lv[2].HSRTIA_c = 205602111, // 1e4
|
||||
.Lv[2].HSRTIA_d = 0,
|
||||
|
||||
// hsrtia200r a*exp(bx) + c*exp(dx)
|
||||
.Lv[3].HSRTIA_a = 19890,
|
||||
.Lv[3].HSRTIA_b = 1620, // 1e6
|
||||
.Lv[3].HSRTIA_c = 893, // 1e5
|
||||
.Lv[3].HSRTIA_d = 7970, // 1e6
|
||||
|
||||
.Ft[0].PhaseParaA = 146478, //1e10
|
||||
.Ft[0].PhaseParaB = -88583908, // 10000 Hz //1e6
|
||||
.Ft[1].PhaseParaA = 342341,
|
||||
.Ft[1].PhaseParaB = -89891632, // 100 Hz
|
||||
.Ft[2].PhaseParaA = 20576527,
|
||||
.Ft[2].PhaseParaB = -90009194, // 10 Hz
|
||||
.Ft[3].PhaseParaA = 100884331,
|
||||
.Ft[3].PhaseParaB = -90024204, // 0.01 Hz
|
||||
|
||||
//only for EIS 1e10
|
||||
.HSAMP_coeff = 9703610267,
|
||||
.HSAMP_offset = -12815281473,
|
||||
|
||||
.LPDAC_coeff = 10000464997,
|
||||
.LPDAC_offset = -75871559054,
|
||||
|
||||
.HSDAC_coeff = 25196655311242,
|
||||
.HSDAC_offset = 19932276246516,
|
||||
|
||||
.Lv[0].HSTIA_coeff = -1062,
|
||||
.Lv[0].HSTIA_offset = 67755568664846,
|
||||
.Lv[1].HSTIA_coeff = 23,
|
||||
.Lv[1].HSTIA_offset = 101767408723,
|
||||
.Lv[2].HSTIA_coeff = -31,
|
||||
.Lv[2].HSTIA_offset = 2037756,
|
||||
.Lv[3].HSTIA_coeff = -66623,
|
||||
.Lv[3].HSTIA_offset = 44299692,
|
||||
|
||||
.Lv[0].LPTIA_coeff = 1,
|
||||
.Lv[0].LPTIA_offset = 0,
|
||||
.Lv[1].LPTIA_coeff = 1,
|
||||
.Lv[1].LPTIA_offset = 0,
|
||||
.Lv[2].LPTIA_coeff = 1,
|
||||
.Lv[2].LPTIA_offset = 0,
|
||||
.Lv[3].LPTIA_coeff = 1,
|
||||
.Lv[3].LPTIA_offset = 0
|
||||
};
|
||||
|
||||
#elif defined(BOARD_A4_DA_32_D4_E7_D2)
|
||||
{
|
||||
.DeviceName = "BOARD_A4_DA_32_D4_E7_D2",
|
||||
.CutoffFreq = 275000,
|
||||
|
||||
.Ft[0].PhaseParaA = 155530, //1e10
|
||||
.Ft[0].PhaseParaB = -87720229, // 1e6
|
||||
.Ft[1].PhaseParaA = 341776,
|
||||
.Ft[1].PhaseParaB = -89919625,
|
||||
.Ft[2].PhaseParaA = 20542303,
|
||||
.Ft[2].PhaseParaB = -89997668,
|
||||
.Ft[3].PhaseParaA = 100310791,
|
||||
.Ft[3].PhaseParaB = -89988818,
|
||||
|
||||
|
||||
//only for EIS 1e8
|
||||
.HSAMP_coeff = 9745467306673,
|
||||
.HSAMP_offset = -11243183077,
|
||||
|
||||
.LPDAC_coeff = 1001472547,
|
||||
.LPDAC_offset = -395332002445,
|
||||
|
||||
.HSDAC_coeff = 2532582201433,
|
||||
.HSDAC_offset = 19873740865949,
|
||||
|
||||
.Lv[0].HSTIA_coeff = -4032141,
|
||||
.Lv[0].HSTIA_offset = 1040297509317,
|
||||
.Lv[1].HSTIA_coeff = -3181894,
|
||||
.Lv[1].HSTIA_offset = 820944361270,
|
||||
.Lv[2].HSTIA_coeff = -13482,
|
||||
.Lv[2].HSTIA_offset = 3480817953,
|
||||
.Lv[3].HSTIA_coeff = -333074,
|
||||
.Lv[3].HSTIA_offset = 85901359807,
|
||||
|
||||
.Lv[0].LPTIA_coeff = 1,
|
||||
.Lv[0].LPTIA_offset = 0,
|
||||
.Lv[1].LPTIA_coeff = 1,
|
||||
.Lv[1].LPTIA_offset = 0,
|
||||
.Lv[2].LPTIA_coeff = 1,
|
||||
.Lv[2].LPTIA_offset = 0,
|
||||
.Lv[3].LPTIA_coeff = 1,
|
||||
.Lv[3].LPTIA_offset = 0
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
static uint32_t Cali_LPDAC (uint32_t value) {
|
||||
uint32_t res;
|
||||
res = (uint32_t)(((int64_t)CaliTable.LPDAC_coeff * value + (int64_t)CaliTable.LPDAC_offset + 5e9) / 1e10);
|
||||
return res;
|
||||
}
|
||||
|
||||
static uint32_t Cali_HSAMP (uint16_t value) {
|
||||
uint32_t res;
|
||||
res = (uint32_t)(((int64_t)CaliTable.HSAMP_coeff * value + (int64_t)CaliTable.HSAMP_offset + 5e9) / 1e10);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static uint32_t Cali_HSTIA (uint32_t value, uint8_t gain_level) {
|
||||
uint32_t res;
|
||||
res = (uint32_t)(((int64_t)CaliTable.Lv[gain_level].HSTIA_coeff * value + (int64_t)CaliTable.Lv[gain_level].HSTIA_offset + 5e9) / 1e10);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
||||
+748
-560
File diff suppressed because it is too large
Load Diff
+16
-16
@@ -129,16 +129,16 @@ static void update_ins_sti_channel(uint8_t *buf, uint8 sti_chp, uint8 sti_chn) {
|
||||
|
||||
static void update_ins_buffer() {
|
||||
uint8 header = 0b10100000;
|
||||
uint8 amp_gain = (INSTRUCTION.amp_gain & 0b11) << 3;
|
||||
uint8 amp_lbf = INSTRUCTION.amp_low_band_freq & 0b111;
|
||||
uint8 amp_gain = (instru.amp_gain & 0b11) << 3;
|
||||
uint8 amp_lbf = instru.amp_low_band_freq & 0b111;
|
||||
uint8 channel = 0; // should be call update_ins_channel to modify this value
|
||||
uint8 chopper = (INSTRUCTION.chopper) ? 0b00001000 : 0;
|
||||
uint8 fast_settle = (INSTRUCTION.fast_settle) ? 0b00000100 : 0;
|
||||
uint8 sti_enable = (INSTRUCTION.work_mode != STI_MODE_DISABLE) ? 0b00000010 : 0;
|
||||
uint8 sti_volt_l = (INSTRUCTION.sti_volt & 0b11111) >> 4;
|
||||
uint8 sti_volt_h = (INSTRUCTION.sti_volt & 0b01111) << 4;
|
||||
uint8 sti_chp = INSTRUCTION.sti_channel_pmos & 0b1111;
|
||||
uint8 sti_chn = (INSTRUCTION.sti_channel_nmos & 0b1111) << 4;
|
||||
uint8 chopper = (instru.chopper) ? 0b00001000 : 0;
|
||||
uint8 fast_settle = (instru.fast_settle) ? 0b00000100 : 0;
|
||||
uint8 sti_enable = (instru.work_mode != STI_MODE_DISABLE) ? 0b00000010 : 0;
|
||||
uint8 sti_volt_l = (instru.sti_volt & 0b11111) >> 4;
|
||||
uint8 sti_volt_h = (instru.sti_volt & 0b01111) << 4;
|
||||
uint8 sti_chp = instru.sti_channel_pmos & 0b1111;
|
||||
uint8 sti_chn = (instru.sti_channel_nmos & 0b1111) << 4;
|
||||
uint8 clk_signal = 0; // should be call update_ins_clock to modify this value
|
||||
|
||||
spi_txbuf[0] = header | amp_gain | amp_lbf;
|
||||
@@ -193,7 +193,7 @@ static bool update_ins_rec_buffer() {
|
||||
* @param: buf: pointer of the SPI buffer.
|
||||
*/
|
||||
static void update_ins_sti_buffer() {
|
||||
switch (INSTRUCTION.work_mode) {
|
||||
switch (instru.work_mode) {
|
||||
case STI_MODE_POS:
|
||||
case STI_MODE_NEG:
|
||||
// copy [4:7]
|
||||
@@ -215,7 +215,7 @@ static void update_ins_sti_buffer() {
|
||||
update_ins_sti_enable(spi_txbuf, TRUE);
|
||||
// ins buf [4:7]
|
||||
update_ins_sti_enable(spi_txbuf + 4, TRUE);
|
||||
update_ins_sti_channel(spi_txbuf + 4, 0xF, INSTRUCTION.sti_channel_pmos);
|
||||
update_ins_sti_channel(spi_txbuf + 4, 0xF, instru.sti_channel_pmos);
|
||||
// ins buf [8:B]
|
||||
update_ins_sti_enable(spi_txbuf + 8, FALSE);
|
||||
break;
|
||||
@@ -238,13 +238,13 @@ static void update_ins_sti_buffer() {
|
||||
spi_txbuf[15] = spi_txbuf[3];
|
||||
// change content
|
||||
update_ins_sti_enable(spi_txbuf + 0, TRUE);
|
||||
update_ins_sti_channel(spi_txbuf + 0, INSTRUCTION.sti_channel_pmos, INSTRUCTION.sti_channel_nmos);
|
||||
update_ins_sti_channel(spi_txbuf + 0, instru.sti_channel_pmos, instru.sti_channel_nmos);
|
||||
// ins buf [4:7]
|
||||
update_ins_sti_enable(spi_txbuf + 4, TRUE);
|
||||
update_ins_sti_channel(spi_txbuf + 4, INSTRUCTION.sti_channel_nmos, INSTRUCTION.sti_channel_pmos);
|
||||
update_ins_sti_channel(spi_txbuf + 4, instru.sti_channel_nmos, instru.sti_channel_pmos);
|
||||
// ins buf [8:B]
|
||||
update_ins_sti_enable(spi_txbuf + 8, TRUE);
|
||||
update_ins_sti_channel(spi_txbuf + 8, 0xF, INSTRUCTION.sti_channel_nmos);
|
||||
update_ins_sti_channel(spi_txbuf + 8, 0xF, instru.sti_channel_nmos);
|
||||
// ins buf [C:F]
|
||||
update_ins_sti_enable(spi_txbuf + 12, FALSE);
|
||||
break;
|
||||
@@ -281,12 +281,12 @@ static void headstage_tni_update_instruction_callback(uint8_t ins_type, uint8_t
|
||||
}
|
||||
|
||||
static uint8_t *spi_transact_rec_instruction() {
|
||||
if (IS_REC_MODE(INSTRUCTION.work_mode)) {
|
||||
if (IS_REC_MODE(instru.work_mode)) {
|
||||
PIN_setOutputValue(pin_handle, IOID_13, 1); // DBS_P2S turn on
|
||||
headstage_spi_transaction(SPI_BUFFER_SIZE, spi_txbuf, spi_rxbuf);
|
||||
PIN_setOutputValue(pin_handle, IOID_13, 0); // DBS_P2S turn off
|
||||
|
||||
} else if (IS_ARM_MODE(INSTRUCTION.work_mode) && !adc_clock_signal) {
|
||||
} else if (IS_ARM_MODE(instru.work_mode) && !adc_clock_signal) {
|
||||
create_ramp(spi_rxbuf);
|
||||
}
|
||||
|
||||
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
|
||||
#ifndef VERSION_DATE
|
||||
#define VERSION_DATE
|
||||
|
||||
#define VERSION_DATE_YEAR 20
|
||||
#define VERSION_DATE_MONTH 2
|
||||
#define VERSION_DATE_DAY 25
|
||||
#define VERSION_DATE_HOUR 18
|
||||
#define VERSION_DATE_MINUTE 32
|
||||
|
||||
#endif
|
||||
+280
-190
@@ -20,8 +20,9 @@
|
||||
#include <ti/drivers/PIN.h>
|
||||
#include "board.h"
|
||||
#include "EliteWorkData.h"
|
||||
#include <driverlib/aon_batmon.h>
|
||||
|
||||
static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData);
|
||||
static void SimpleBLEPeripheral_performPeriodicTask(void);
|
||||
|
||||
static void SimpleBLEPeripheral_clockHandler(UArg arg) {
|
||||
// Store the event.
|
||||
@@ -34,6 +35,7 @@ static void SimpleBLEPeripheral_clockHandler(UArg arg) {
|
||||
static void elite_gptimer_callback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask) {
|
||||
events |= SBP_PERIODIC_EVT;
|
||||
Semaphore_post(semaphore);
|
||||
GPT.GptimerCounter++;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,16 +46,30 @@ static void ZM_init() {
|
||||
|
||||
// initialize
|
||||
pin_handle = PIN_open(&ZM_rst, BLE_IO);
|
||||
PIN_setOutputValue(pin_handle, AD_CS, 1); // AD_CS HIGH
|
||||
/*
|
||||
Init_Elite15_PIN();
|
||||
ELITE15_SPI_HOLD();
|
||||
|
||||
PIN_setOutputValue(pin_handle, shutdown_6994, 1); // OFF = 1 => turn off 6994
|
||||
PIN_setOutputValue(pin_handle, enable_10v, 0); // enable 10V
|
||||
|
||||
PIN_setOutputValue(pin_handle, ADC_CS, 1); // ADC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, DAC_CS, 1); // DAC_CS HIGH
|
||||
PIN_setOutputValue(pin_handle, shutdown_6994, 1); // OFF = 1 => turn off 6994
|
||||
PIN_setOutputValue(pin_handle, enable_10v, 0); // enable 10V
|
||||
PIN_setOutputValue(pin_handle, HIGH_Z_MODE, 0); // HIGH Z MODE // 1: close; 0: open;
|
||||
*/
|
||||
|
||||
InitEliteInstruction();
|
||||
ADCGainControl(GAIN_AUTO);
|
||||
|
||||
// init DAC, set output ~= 0 V
|
||||
// instru.VoutGainLevel = VOUT_GAIN_15K;
|
||||
// VoutGainControl(instru.VoutGainLevel);
|
||||
// DAC_outputV(Usercode_Correction_to_DAC(instru.VoutGainLevel, 25000));
|
||||
|
||||
/* when elite open, must change vin level,
|
||||
measure battery value will be right */
|
||||
// VinADCGainControl(VIN_GAIN_AUTO);
|
||||
|
||||
elite_gptimer_open();
|
||||
elite_gptimer_start();
|
||||
|
||||
// PIN_registerIntCb(pin_handle, switch_on_callback);
|
||||
// PIN_setInterrupt(pin_handle, switch_on | PIN_IRQ_POSEDGE);
|
||||
@@ -64,7 +80,7 @@ static void ZM_update_instruction_callback(uint8_t ins_type, uint8_t chip_ID, ui
|
||||
|
||||
static void DACCode2Real2Notify(uint16_t DACcode) {
|
||||
int32_t RealV;
|
||||
RealV = DAC_to_realV(DACcode);
|
||||
RealV = DAC_to_realV(instru.VoutGainLevel, DACcode);
|
||||
|
||||
NotifyVolt[0] = (uint8_t)((RealV & 0xFF000000) >> 24);
|
||||
NotifyVolt[1] = (uint8_t)((RealV & 0x00FF0000) >> 16);
|
||||
@@ -72,14 +88,15 @@ static void DACCode2Real2Notify(uint16_t DACcode) {
|
||||
NotifyVolt[3] = (uint8_t)(RealV & 0x000000FF);
|
||||
}
|
||||
|
||||
#define IsPeriodicMode() ( \
|
||||
(INSTRUCTION.eliteFxn == IV_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == CV_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == IT_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == VT_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == ZT_CURVE) || \
|
||||
(INSTRUCTION.eliteFxn == CONSTANT_CURRENT) || \
|
||||
(INSTRUCTION.eliteFxn == READ_VOUT_VALUE) \
|
||||
#define IsPeriodicMode() ( \
|
||||
(instru.eliteFxn == CURVE_EIS) || \
|
||||
(instru.eliteFxn == CURVE_EIS_CV) || \
|
||||
(instru.eliteFxn == CURVE_CALI_ADC) \
|
||||
)
|
||||
|
||||
#define Ve1MatchVe2Mode() ( \
|
||||
(instru.eliteFxn == CURVE_EIS) || \
|
||||
(instru.eliteFxn == CURVE_EIS_CV) \
|
||||
)
|
||||
|
||||
/*********************************************************************
|
||||
@@ -91,212 +108,285 @@ static void DACCode2Real2Notify(uint16_t DACcode) {
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
|
||||
if ( IsPeriodicMode() ){
|
||||
static void SimpleBLEPeripheral_performPeriodicTask(void) {
|
||||
if (IsPeriodicMode()) {
|
||||
if(instru.eliteFxn == CURVE_EIS){
|
||||
|
||||
// DAC counter
|
||||
if (CT.StepTimeCounter == INSTRUCTION.StepTime){
|
||||
CT.StepTimeCounter = 1;
|
||||
}
|
||||
else{
|
||||
CT.StepTimeCounter++;
|
||||
}
|
||||
GPT.DeltaGptimerCounter = GPT.GptimerCounter - GPT.GptimerCounter0;
|
||||
GPT.GptimerCounter0 = GPT.GptimerCounter;
|
||||
|
||||
// ADC counter
|
||||
if (CT.SampleRate_counter == INSTRUCTION.SampleRate){
|
||||
CT.SampleRate_counter = 1;
|
||||
}
|
||||
else{
|
||||
CT.SampleRate_counter++;
|
||||
}
|
||||
if (mode_init){
|
||||
GPT.SampleRateCounter = 0;
|
||||
mode_init = false;
|
||||
gainChange_flag = false;
|
||||
firstFreq_flag = true;
|
||||
fset_flag = true;
|
||||
fout_flag = true;
|
||||
firstTimeReset = true;
|
||||
notifyFirst_flag = true;
|
||||
DACReset = true;
|
||||
vscanReset = true;
|
||||
leadTimeReset = true;
|
||||
|
||||
// notify counter
|
||||
if (CT.NotifyCounter == INSTRUCTION.NotifyRate){
|
||||
CT.NotifyCounter = 1;
|
||||
}
|
||||
else{
|
||||
CT.NotifyCounter ++;
|
||||
}
|
||||
if (instru.f1 == instru.f2) {
|
||||
DAC_outputF(instru.f1);
|
||||
PeriodicEvent = false;
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
|
||||
/** Periodic Event **/
|
||||
// Default working flow is DAC out -> ADC read -> send notify
|
||||
// We will need a flag to control DAC, if we want to exchange to ADC -> DAC -> notify
|
||||
// This flag can be named by FxnNameDACReset
|
||||
|
||||
// In IV, CV, and func-gen mode, DAC will output voltage
|
||||
// else DAC do nothing.
|
||||
EliteDACControl(WorkModeData);
|
||||
|
||||
// Control ADC to sample rate
|
||||
EliteADCControl(WorkModeData);
|
||||
|
||||
// Notify control, check if we need to send notify
|
||||
EliteNotifyControl();
|
||||
|
||||
}
|
||||
|
||||
else if(INSTRUCTION.eliteFxn == VOLT_OUTPUT){
|
||||
// assign WorkModeData->VO = INSTRUCTION.VoltConstant
|
||||
WorkModeData->VO->_VoltOut = INSTRUCTION.VoltConstant;
|
||||
// UserCode -> DAC code -> DAC out
|
||||
DAC_outputV(Usercode_Correction_to_DAC(WorkModeData->VO->_VoltOut));
|
||||
// DAC_outputV(WorkModeData->VO->_VoltOut); // for voltage output calibration
|
||||
FreeWorkMode(WorkModeData);
|
||||
PeriodicEvent = false;
|
||||
InitPeriodicEvent = true;
|
||||
}
|
||||
else{
|
||||
PeriodicEvent = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void EliteDACControl(WorkMode *WorkModeData) {
|
||||
if (INSTRUCTION.eliteFxn == IV_CURVE) {
|
||||
// output a certain voltage and put it into NotifyVolt
|
||||
if(WorkModeData->IV->_VoVi_Switch == 0x00){ //user see Vout
|
||||
//DACCode2Real2Notify(VoltScan(WorkModeData));
|
||||
uint16_t DACcode;
|
||||
DACcode = VoltScan(WorkModeData);
|
||||
|
||||
}
|
||||
else if (WorkModeData->IV->_VoVi_Switch == 0x01){ //user see Vin
|
||||
VoltScan(WorkModeData);
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.eliteFxn == CV_CURVE){
|
||||
if (WorkModeData->CV->_VoVi_Switch == 0x00){
|
||||
DACCode2Real2Notify(VoltScan(WorkModeData));
|
||||
}
|
||||
else if (WorkModeData->CV->_VoVi_Switch == 0x01){
|
||||
VoltScan(WorkModeData);
|
||||
}
|
||||
}
|
||||
else if (INSTRUCTION.eliteFxn == ZT_CURVE){
|
||||
if(INSTRUCTION.ResisterMeter == RESISTER_METER_SMALL){
|
||||
// output 1V
|
||||
if (DACReset) {
|
||||
INSTRUCTION.VoltConstant = 25000 + 5000;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
DACReset = false;
|
||||
SetEISHIGHZ(1);
|
||||
}
|
||||
}
|
||||
else{
|
||||
// output 1V
|
||||
if (DACReset) {
|
||||
INSTRUCTION.VoltConstant = 25000 + 5000;
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
DACReset = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.eliteFxn == CONSTANT_CURRENT){
|
||||
if (DACReset) {
|
||||
DAC_outputV(Usercode_Correction_to_DAC(25000));
|
||||
DACReset = false;
|
||||
}
|
||||
CCModeVoltOut(WorkModeData->CC);
|
||||
}
|
||||
|
||||
else{
|
||||
// IT, VT need only ADC measure
|
||||
return;
|
||||
}
|
||||
}
|
||||
//vscan counter //fset counter
|
||||
if (fset_flag) {
|
||||
vscan_ctrl(); //set
|
||||
fset_flag = false;
|
||||
fout_flag = true;
|
||||
}
|
||||
|
||||
static void EliteADCControl(WorkMode *WorkModeData) {
|
||||
if (CT.SampleRate_counter == INSTRUCTION.SampleRate - 1) {
|
||||
switch (INSTRUCTION.eliteFxn) {
|
||||
case IV_CURVE:{
|
||||
IV_Plot(WorkModeData->IV);
|
||||
// IT_Plot(WorkModeData);
|
||||
break;
|
||||
//ADC counter
|
||||
GPT.SampleRateCounter = GPT.SampleRateCounter + GPT.DeltaGptimerCounter;
|
||||
if(GPT.SampleRateCounter >= instru.sampleRate){
|
||||
GPT.SampleRateCounter = 0; //To get right data, ADC must be delay 1.5ms
|
||||
ADC_flag = true;
|
||||
if(ADC_flag){
|
||||
EliteADCControl(); //read data
|
||||
ADC_flag = false;
|
||||
}
|
||||
}
|
||||
case CV_CURVE:{
|
||||
CV_Plot(WorkModeData->CV);
|
||||
break;
|
||||
}
|
||||
case IT_CURVE:{
|
||||
IT_Plot(WorkModeData);
|
||||
// NotifyReady = true;
|
||||
break;
|
||||
}
|
||||
case VT_CURVE:{
|
||||
// read volt through ADC and put it into notify buffer
|
||||
VT_Plot(WorkModeData->VT);
|
||||
// NotifyReady = true;
|
||||
break;
|
||||
}
|
||||
case ZT_CURVE:{
|
||||
ZT_Plot(WorkModeData->RT);
|
||||
// NotifyReady = true;
|
||||
break;
|
||||
}
|
||||
case CONSTANT_CURRENT:{
|
||||
CCModeReadCurrent(WorkModeData->CC);
|
||||
// CCModeReverseCurrent(WorkModeData->CC);
|
||||
break;
|
||||
}
|
||||
case READ_VOUT_VALUE:{
|
||||
RVout_Plot(WorkModeData->RVout);
|
||||
|
||||
/*uint8_t ReadVoutBuf[2] = {0};
|
||||
//Notify counter(Notify control, check if we need to send notify)
|
||||
//please don't put Notify counter before ADC counter, maybe get wrong data
|
||||
if(vscanReset){
|
||||
notify_flag = false;
|
||||
}
|
||||
if(notify_flag){
|
||||
SendNotify(); //send
|
||||
notify_flag = false;
|
||||
fset_flag = true;
|
||||
time0 = (Timestamp_get32()) / 31;
|
||||
time1 = 0;
|
||||
delta_time = 0;
|
||||
}
|
||||
|
||||
ADC_write(0xA4);
|
||||
ADC_read(ReadVoutBuf);
|
||||
SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, 2, ReadVoutBuf);*/
|
||||
break;
|
||||
mode_done(); //finishMode = 1, SendNotify(), Eliteinterrupt()
|
||||
} else {
|
||||
/** Periodic Event **/
|
||||
// Default working flow is vscan -> ADC read -> send notify
|
||||
// We will need a flag to control vscan, ADC and notify
|
||||
|
||||
static bool first_highz_flag = false;
|
||||
|
||||
GPT.DeltaGptimerCounter = GPT.GptimerCounter - GPT.GptimerCounter0;
|
||||
GPT.GptimerCounter0 = GPT.GptimerCounter;
|
||||
|
||||
if (mode_init) {
|
||||
GPT.SampleRateCounter = instru.sampleRate - 10;
|
||||
GPT.VscanRateCounter = instru.VsetRate - 1;
|
||||
mode_init = false;
|
||||
batteryADC_flag = false;
|
||||
record_flag = true;
|
||||
fset_flag = true;
|
||||
firstTimeReset = true;
|
||||
notifyFirst_flag = true;
|
||||
first_highz_flag = true;
|
||||
I_GAIN_100R_counter = 0;
|
||||
I_GAIN_3K_counter = 0;
|
||||
I_GAIN_100K_counter = 0;
|
||||
I_GAIN_3M_counter = 0;
|
||||
VIN_GAIN_1M_counter = 0;
|
||||
VIN_GAIN_30K_counter = 0;
|
||||
VIN_GAIN_1K_counter = 0;
|
||||
VOUT_GAIN_240K_counter = 0;
|
||||
VOUT_GAIN_15K_counter = 0;
|
||||
DACReset = true;
|
||||
vscanReset = true;
|
||||
leadTimeReset = true;
|
||||
|
||||
/*
|
||||
VinADCGainCtrl(instru.VinADCGainLv);
|
||||
IinADCGainControl(instru.ADCGainLv);
|
||||
VoutGainControl(instru.VoutGainLevel);
|
||||
*/
|
||||
|
||||
if (Ve1MatchVe2Mode()) {
|
||||
if (instru.Ve1 == instru.Ve2) {
|
||||
// DAC_outputV(Usercode_Correction_to_DAC(instru.VoutGainLevel, instru.Ve1));
|
||||
DAC_outputV(instru.Ve1);
|
||||
PeriodicEvent = false;
|
||||
SetEISHIGHZ(1);
|
||||
// PIN_setOutputValue(pin_handle, HIGH_Z_MODE, 0); // 0: open highz;
|
||||
ModeLED(NO_EVENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
default:{
|
||||
IT_Plot(WorkModeData);
|
||||
// NotifyReady = true;
|
||||
break;
|
||||
|
||||
GPT.LeadTimeCounter = GPT.LeadTimeCounter + GPT.DeltaGptimerCounter;
|
||||
if (leadTimeReset && GPT.LeadTimeCounter <= 2000) {
|
||||
vscanReset = true;
|
||||
if (first_highz_flag && GPT.LeadTimeCounter >= 1000) {
|
||||
SetEISHIGHZ(1); // // High Z | 1 off | 0 on
|
||||
// PIN_setOutputValue(pin_handle, HIGH_Z_MODE, 1); // HIGH Z MODE // 1: close; 0: open;
|
||||
first_highz_flag = false;
|
||||
}
|
||||
} else {
|
||||
if (notifyFirst_flag) {
|
||||
GPT.NotifyCounter = instru.notifyRate - 20;
|
||||
notifyFirst_flag = false;
|
||||
}
|
||||
vscanReset = false;
|
||||
leadTimeReset = false;
|
||||
}
|
||||
|
||||
//vscan counter //fset counter
|
||||
GPT.VscanRateCounter = GPT.VscanRateCounter + GPT.DeltaGptimerCounter;
|
||||
if (GPT.VscanRateCounter >= instru.VsetRate) {
|
||||
if (GPT.VscanRateCounter >= instru.VsetRate * 2) {
|
||||
GPT.GptimerMultiple = GPT.VscanRateCounter / instru.VsetRate;
|
||||
} else {
|
||||
GPT.GptimerMultiple = 1;
|
||||
}
|
||||
GPT.VscanRateCounter -= instru.VsetRate * GPT.GptimerMultiple; //To get right time
|
||||
vscan_flag = true;
|
||||
if (vscan_flag) {
|
||||
vscan_ctrl(); //set
|
||||
vscan_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
//ADC counter
|
||||
GPT.SampleRateCounter = GPT.SampleRateCounter + GPT.DeltaGptimerCounter;
|
||||
if(GPT.SampleRateCounter >= instru.sampleRate){
|
||||
GPT.SampleRateCounter = 0; //To get right data, ADC must be delay 1.5ms
|
||||
ADC_flag = true;
|
||||
if(ADC_flag){
|
||||
EliteADCControl(); //read data
|
||||
ADC_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Notify counter(Notify control, check if we need to send notify)
|
||||
//please don't put Notify counter before ADC counter, maybe get wrong data
|
||||
GPT.NotifyCounter = GPT.NotifyCounter + GPT.DeltaGptimerCounter;
|
||||
if(GPT.NotifyCounter >= instru.notifyRate){
|
||||
GPT.NotifyCounter -= instru.notifyRate; //To get right time
|
||||
notify_flag = true;
|
||||
if(vscanReset){
|
||||
notify_flag = false;
|
||||
}
|
||||
if(notify_flag){
|
||||
SendNotify(); //send
|
||||
notify_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
mode_done(); //finishMode = 1, SendNotify(), Eliteinterrupt()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void EliteNotifyControl() {
|
||||
if ((INSTRUCTION.eliteFxn == IV_CURVE) || (INSTRUCTION.eliteFxn == CV_CURVE)) {
|
||||
// output the last notify, and reset Elite
|
||||
static void EliteADCControl(void) //CURVE_IV => CC_Plot() | CURVE_CV => Iin_Vin_Vout_Plot
|
||||
{
|
||||
void *wm = wm_get();
|
||||
|
||||
switch (instru.eliteFxn) {
|
||||
case CURVE_EIS:
|
||||
EIS_Plot();
|
||||
break;
|
||||
|
||||
case CURVE_EIS_CV:
|
||||
CV_Plot();
|
||||
break;
|
||||
|
||||
case CURVE_CALI_ADC:
|
||||
if (instru.AdcChannel == IIN_ADC) {
|
||||
cali_IT_plot();
|
||||
} else if (instru.AdcChannel == VIN_ADC) {
|
||||
cali_VT_plot();
|
||||
} else if (instru.AdcChannel == VOUT_DAC) {
|
||||
cali_VT_plot();
|
||||
} else if (instru.AdcChannel == EIS_HSTIA) {
|
||||
cali_IT_plot();
|
||||
} else if (instru.AdcChannel == EIS_LPTIA) {
|
||||
cali_VT_plot();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void mode_done(void) //finishMode = 1, SendNotify(), Eliteinterrupt()
|
||||
{
|
||||
if (instru.eliteFxn == CURVE_EIS_CV) {
|
||||
if (!PeriodicEvent) {
|
||||
finishMode = 1;
|
||||
SendNotify();
|
||||
reset();
|
||||
} else if (CT.StepTimeCounter == INSTRUCTION.StepTime/2) {
|
||||
SendNotify();
|
||||
Eliteinterrupt();
|
||||
}
|
||||
}
|
||||
else if(INSTRUCTION.eliteFxn == CONSTANT_CURRENT){
|
||||
if(CT.NotifyCounter == INSTRUCTION.NotifyRate){
|
||||
SendNotify();
|
||||
} else if (instru.eliteFxn == CURVE_EIS){
|
||||
if (!PeriodicEvent) {
|
||||
Eliteinterrupt();
|
||||
}
|
||||
}
|
||||
else if (CT.SampleRate_counter == INSTRUCTION.SampleRate) {
|
||||
SendNotify();
|
||||
}
|
||||
}
|
||||
|
||||
static void vscan_ctrl(void)
|
||||
{
|
||||
switch (instru.eliteFxn) {
|
||||
case CURVE_EIS:
|
||||
eis_fscan();
|
||||
break;
|
||||
|
||||
static uint16_t StepCode2DACcode(uint16_t StepCode){
|
||||
return (StepCode * 0x0005 / 10);
|
||||
case CURVE_EIS_CV:
|
||||
cv_vscan();
|
||||
break;
|
||||
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t OldStep2NewStepTime(uint8_t StepTime) {
|
||||
static uint32_t OldStep2NewStepTime(uint32_t StepTime){
|
||||
uint8_t StepTimeLevel = 0;
|
||||
StepTimeLevel = StepTime / 0x12;
|
||||
|
||||
switch (StepTimeLevel) {
|
||||
case 0: { //0.5 sec
|
||||
return STEPTIME_HALF_SEC;
|
||||
}
|
||||
case 1: { //1 sec
|
||||
return STEPTIME_ONE_SEC;
|
||||
}
|
||||
case 2: { //2 sec
|
||||
return STEPTIME_TWO_SEC;
|
||||
}
|
||||
default: { //1 sec
|
||||
return STEPTIME_ONE_SEC;
|
||||
case 0: { //0.5 sec
|
||||
return STEPTIME_HALF_SEC;
|
||||
}
|
||||
case 1: { //1 sec
|
||||
return STEPTIME_ONE_SEC;
|
||||
}
|
||||
case 2: { //2 sec
|
||||
return STEPTIME_TWO_SEC;
|
||||
}
|
||||
default: { //1 sec
|
||||
return STEPTIME_ONE_SEC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void step2VsetRate(uint32_t step){
|
||||
/*step = 100 mv, index = 0, n = 2
|
||||
10 mv, index = 1, n = 10
|
||||
1 mv, index = 2, n = 100
|
||||
0.1 mv, index = 3, n = 1000
|
||||
0.01mv, index = 4, n = 10000 */
|
||||
|
||||
if(step >= 10000){
|
||||
instru.VsetRateIndex = 0;
|
||||
}else if (step >= 1000){
|
||||
instru.VsetRateIndex = 1;
|
||||
}else if (step >= 100){
|
||||
instru.VsetRateIndex = 2;
|
||||
}else if (step >= 10){
|
||||
instru.VsetRateIndex = 3;
|
||||
}else if (step >= 1){
|
||||
instru.VsetRateIndex = 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+40
-49
@@ -543,26 +543,22 @@ static void SimpleBLEPeripheral_init(void) {
|
||||
// static void detectKey_clockHandler(UArg arg);
|
||||
|
||||
static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
uint8_t key= 0;
|
||||
bool EliteOn = 0;
|
||||
uint16_t counter6994 = 0;
|
||||
batteryADC_flag = false;
|
||||
|
||||
#define CLOCK_ONE_SECOND 10000
|
||||
// Initialize application
|
||||
SimpleBLEPeripheral_init();
|
||||
headstage_init_device_info();
|
||||
|
||||
ZM_init();
|
||||
Elite_SPI_init();
|
||||
WorkMode *WorkModeData = CreateWorkMode();
|
||||
|
||||
uint8_t key = 0;
|
||||
uint16_t counter6994 = 0;
|
||||
bool EliteOn = 0;
|
||||
|
||||
// init DAC, set output ~= 0 V
|
||||
DAC_outputV(Usercode_Correction_to_DAC(25000));
|
||||
elite_gptimer_start();
|
||||
|
||||
// Application main loops
|
||||
for (;;) {
|
||||
GPT.GptimerCounter0 = GPT.GptimerCounter;
|
||||
|
||||
//headstage_battery_volt();
|
||||
headstage_init_device_info();
|
||||
|
||||
for (;;) { //keeps going until Periodic Event != True
|
||||
// Waits for a signal to the semaphore associated with the calling thread.
|
||||
// Note that the semaphore associated with a thread is signaled when a
|
||||
// message is queued to the message receive queue of the thread or when
|
||||
@@ -609,65 +605,48 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(events & SBP_PERIODIC_EVT){
|
||||
events &= ~SBP_PERIODIC_EVT;
|
||||
if (!PeriodicEvent) { // if there is no periodic event
|
||||
if (!PeriodicEvent) { // if there is no periodic event
|
||||
key = PIN_getInputValue(switch_on);
|
||||
if (EliteOn) {
|
||||
if (counter6994 < CLOCK_ONE_SECOND/2) { // counter6994 enable a IC after 35 counts
|
||||
if (counter6994 < CLOCK_ONE_SECOND*5) { // counter6994 enable a IC after 35 counts
|
||||
counter6994++;
|
||||
} else if (counter6994 == CLOCK_ONE_SECOND/2) {
|
||||
PIN_setOutputValue(pin_handle, shutdown_6994, 1); // OFF = 1 => turn off 6994
|
||||
// #ifdef ELITE_VERSION_1_4
|
||||
// SPI_close(spiHandle0);
|
||||
// I2Cinit();
|
||||
// I2C_close(I2Chandle);
|
||||
// spiHandle0 = SPI_open(Board_SPI0, &spiParams0); // LED SPI
|
||||
// #endif
|
||||
} else if (counter6994 == CLOCK_ONE_SECOND*5) {
|
||||
//PIN_setOutputValue(pin_handle, shutdown_6994, 0); // OFF = 1 => turn off 6994
|
||||
counter6994++;
|
||||
} else if (counter6994 > CLOCK_ONE_SECOND*5) {
|
||||
counter6994 = 0;
|
||||
}
|
||||
EliteKeyPress(key);
|
||||
if(Free_Work_Mode){
|
||||
FreeWorkMode(WorkModeData);
|
||||
InitEliteInstruction();
|
||||
ADCGainControl(INSTRUCTION.ADCGainLevel);
|
||||
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
|
||||
|
||||
// if(key != 0){ //detect Elite battery power when no periodic event
|
||||
// measureBat();
|
||||
// }
|
||||
if(Free_Work_Mode){
|
||||
wm_deinit();
|
||||
InitEliteInstruction();
|
||||
Free_Work_Mode = false;
|
||||
}
|
||||
} else {
|
||||
EliteOn = TurnOnElite(key);
|
||||
// AD5940_init();
|
||||
}
|
||||
}
|
||||
// if there is periodic event
|
||||
else {
|
||||
else { // if there is periodic event
|
||||
if(InitPeriodicEvent){
|
||||
InitWorkMode(WorkModeData);
|
||||
wm_init();
|
||||
InitPeriodicEvent = false;
|
||||
}
|
||||
|
||||
// Perform periodic application task
|
||||
SimpleBLEPeripheral_performPeriodicTask(WorkModeData);
|
||||
|
||||
// Turn off Elite if battery voltage < 3V
|
||||
// ReadBatVolt(spi_ADC_rxbuf);
|
||||
|
||||
SimpleBLEPeripheral_performPeriodicTask();
|
||||
key = PIN_getInputValue(switch_on);
|
||||
EliteKeyPress(key); // onPress=> key = 0; 1.lighten LED 2.long press shut down 2650
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// if (events & SBP_PERIODIC_EVT)
|
||||
// {
|
||||
// events &= ~SBP_PERIODIC_EVT;
|
||||
// Util_startClock(&periodicClock);
|
||||
// Perform periodic application task
|
||||
// SimpleBLEPeripheral_performPeriodicTask();
|
||||
// }
|
||||
|
||||
// headstage_gptimer_main_handle();
|
||||
|
||||
#ifdef FEATURE_OAD
|
||||
while (!Queue_empty(hOadQ)) {
|
||||
oadTargetWrite_t *oadWriteEvt = Queue_get(hOadQ);
|
||||
@@ -941,6 +920,17 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)
|
||||
|
||||
numActive = linkDB_NumActive();
|
||||
|
||||
// uint16_t cxnHandle;
|
||||
//
|
||||
// // requestedPDUSize = LL payload = L2CAP_header + ATT header + BLE_NOT_BUFF_SIZE = 7 + BLE_NOT_BUFF_SIZE //roy
|
||||
// uint16_t requestedPDUSize = 251; //251 roy
|
||||
// uint16_t requestTxTime = 2120; // (LL payload + 14) * 8 //2120 roy
|
||||
// GAPRole_GetParameter(GAPROLE_CONNHANDLE, &cxnHandle);
|
||||
//
|
||||
// if (SUCCESS == HCI_LE_SetDataLenCmd(cxnHandle, requestedPDUSize, requestTxTime)) {
|
||||
//// LED_color(DARKLED, 0xFF, 0x00, 0xFF);
|
||||
// }
|
||||
|
||||
// Use numActive to determine the connection handle of the last
|
||||
// connection
|
||||
if (linkDB_GetInfo(numActive - 1, &linkInfo) == SUCCESS) {
|
||||
@@ -975,11 +965,12 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)
|
||||
|
||||
case GAPROLE_WAITING:
|
||||
SimpleBLEPeripheral_freeAttRsp(bleNotConnected);
|
||||
|
||||
ModeLED(BT_WAIT);
|
||||
break;
|
||||
|
||||
case GAPROLE_WAITING_AFTER_TIMEOUT:
|
||||
SimpleBLEPeripheral_freeAttRsp(bleNotConnected);
|
||||
ModeLED(BT_WAIT);
|
||||
|
||||
#ifdef PLUS_BROADCASTER
|
||||
// Reset flag for next connection.
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
#input="./Elite_test.txt"
|
||||
input="D:/Elite/Calibration_data/$1.txt"
|
||||
output="./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteDeviceCorrection.h"
|
||||
|
||||
#variable
|
||||
declare -i current_line=79
|
||||
declare -i col_index=0
|
||||
declare -i row_index=0
|
||||
#declare -i coeff=1
|
||||
#declare -i offset=0
|
||||
|
||||
declare -i current_gain=0
|
||||
#declare -i vin_gain=0
|
||||
#declare -i vout_gain=0
|
||||
MAC="MAC"
|
||||
|
||||
#constant
|
||||
declare -i ADC_CURRENT_GAIN_NUMBER=3
|
||||
declare -i ADC_VOLTAGE_GAIN_NUMBER=1
|
||||
declare -i DAC_GAIN_NUMBER=1
|
||||
|
||||
while read -r line; do
|
||||
for word in $line; do
|
||||
# get device MAC
|
||||
if [ $row_index -eq 0 ] && [ $col_index -eq 1 ];then
|
||||
MAC=$word
|
||||
sed -i "${current_line} i {" "$output"
|
||||
sed -i "${current_line} i \\\n#ifdef BOARD_${MAC}" "$output"
|
||||
sed -i 's/:/_/g' "$output"
|
||||
current_line=$current_line+3
|
||||
fi
|
||||
|
||||
#get ADC current cali data
|
||||
declare -i Iin_range=2+$ADC_CURRENT_GAIN_NUMBER
|
||||
if [ $row_index -gt 1 ] && [ $row_index -lt $Iin_range ];then
|
||||
|
||||
if [ $col_index -eq 1 ];then
|
||||
sed -i "${current_line} i \\\t.ADC_current[${current_gain}].coeff = ($word)," "$output"
|
||||
current_line=$current_line+1
|
||||
|
||||
elif [ $col_index -eq 2 ];then
|
||||
sed -i "${current_line} i \\\t.ADC_current[${current_gain}].offset = ($word)," "$output"
|
||||
current_line=$current_line+1
|
||||
|
||||
if [ $current_gain -lt 2 ];then
|
||||
current_gain=$current_gain+1
|
||||
else
|
||||
current_gain=0
|
||||
fi
|
||||
fi
|
||||
|
||||
#get DAC Vout cali data
|
||||
declare -i Vout_range=$Iin_range+$DAC_GAIN_NUMBER
|
||||
elif [ $row_index -gt 1 ] && [ $row_index -lt $Vout_range ];then
|
||||
if [ $col_index -eq 1 ];then
|
||||
sed -i "${current_line} i \\\t.Usercode2DAC.coeff = ($word)," "$output"
|
||||
current_line=$current_line+1
|
||||
|
||||
elif [ $col_index -eq 2 ];then
|
||||
sed -i "${current_line} i \\\t.Usercode2DAC.offset = ($word)," "$output"
|
||||
current_line=$current_line+1
|
||||
fi
|
||||
|
||||
#get ADC Vin cali data
|
||||
declare -i Vin_range=$Vout_range+$ADC_VOLTAGE_GAIN_NUMBER
|
||||
elif [ $row_index -gt 1 ] && [ $row_index -lt $Vin_range ];then
|
||||
if [ $col_index -eq 1 ];then
|
||||
sed -i "${current_line} i \\\t.ADC_volt.coeff = ($word)," "$output"
|
||||
current_line=$current_line+1
|
||||
|
||||
elif [ $col_index -eq 2 ];then
|
||||
sed -i "${current_line} i \\\t.ADC_volt.offset = ($word)," "$output"
|
||||
current_line=$current_line+1
|
||||
fi
|
||||
fi
|
||||
|
||||
#update index
|
||||
if [ $col_index -lt 2 ];then
|
||||
col_index=$col_index+1
|
||||
else
|
||||
col_index=0
|
||||
row_index=$row_index+1
|
||||
fi
|
||||
done
|
||||
done < $input
|
||||
|
||||
sed -i "${current_line} i };" "$output"
|
||||
current_line=$current_line+1
|
||||
sed -i "${current_line} i #endif" "$output"
|
||||
Reference in New Issue
Block a user