Compare commits

..

619 Commits

Author SHA1 Message Date
yichin 87ee5ad165 update cali script 2020-03-16 17:13:32 +08:00
YiChin 59a4d9dafe ship version(0.2mV) 2020-02-25 18:32:13 +08:00
yichin 1d8d987d22 don't care 2020-02-25 10:38:03 +08:00
yichin 5538e13e69 Merge remote-tracking branch 'origin/Elite_0213_0.2mv_sinica_roy' into Elite_0213_0.2mv_sinica_roy 2020-02-25 10:08:58 +08:00
YiChin 1b75ccb056 send IV CV 's V(uV) (Theoretical value) 2020-02-21 17:57:26 +08:00
YiChin 131051e227 CV 1~4mV debug 2020-02-21 15:57:15 +08:00
YiChin e0e116b1d1 take away NotifyImpedance 2020-02-19 18:31:44 +08:00
YiChin 9a9cf40c74 return version from CIS 2020-02-19 16:01:18 +08:00
YiChin 246052bf9c return version from CIS 2020-02-19 15:48:05 +08:00
yichin 66229c2821 Merge remote-tracking branch 'origin/Elite_0213_0.2mv_sinica_roy' into Elite_0213_0.2mv_sinica_roy
# Conflicts:
#	simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteDeviceCorrection.h
2020-02-19 13:29:32 +08:00
YiChin 347259fe7e don't care 2020-02-19 13:18:11 +08:00
YiChin d1b3aa9506 RTmode:1K bug ok 2020-02-19 11:53:05 +08:00
yichin 6cdecd9e87 BOARD_SATURN 2020-02-19 11:30:13 +08:00
YiChin 56937a0780 IVmode: VoltStep 0.2mv ok 2020-02-19 10:04:59 +08:00
YiChin cb1ca49985 boards calibration data_20200217 2020-02-19 10:02:11 +08:00
YiChin 7e9dfbc4c2 test 2020-02-18 18:38:50 +08:00
YiChin d86b008bb1 test 2020-02-18 11:47:11 +08:00
Roy ceac955327 test:CV can't run 2020-02-17 17:51:31 +08:00
yichin 64effd5a02 board C64C calibration data 2020-02-17 12:33:01 +08:00
YiChin c7d531f0a5 test data:NotifyImpedance 2020-02-17 12:27:08 +08:00
YiChin 37caa92565 test data:NotifyImpedance 2020-02-17 11:28:25 +08:00
YiChin 4c04c57728 don't care 2020-02-14 17:33:36 +08:00
YiChin 9bc16f7687 VoltStep 0.2mv OK 2020-02-14 16:41:55 +08:00
YiChin e11eae5302 test 2020-02-14 11:36:15 +08:00
YiChin 2269a2b4d7 test 2020-02-13 17:47:04 +08:00
YiChin 3ffa567f1b test:device Identify 2020-02-11 15:57:38 +08:00
YiChin de4d766ed5 test:device Identify 2020-02-10 16:42:23 +08:00
YiChin 7b5d46edff test:device Identify 2020-02-10 16:27:40 +08:00
YiChin 7399ddce01 battery function take away 2020-02-06 15:28:51 +08:00
YiChin 7e16a54533 CVmode overflow debug(Vin) 2020-02-06 10:08:26 +08:00
YiChin 778495a07a IVmode can stop 2020-02-06 09:56:33 +08:00
YiChin 527a90f732 calibration data 2020-02-06 09:44:01 +08:00
Benny Liu 4e01c27e8e calibration data of board_C5F3 2020-01-13 17:30:38 +08:00
Benny Liu a71e456e81 calibration data of various boards 2020-01-13 16:40:01 +08:00
royluo df1c1f9f7e CV mode cyclenumber debug with Vin 2020-01-06 17:44:22 +08:00
royluo 06584e7d1c change ADC level 2019-12-31 10:56:11 +08:00
royluo 5ea5b16d89 add Bat() 2019-12-31 10:54:27 +08:00
Benny Liu 10e2d12bc2 calibration data of various boards 2019-12-25 16:55:49 +08:00
Benny Liu 857388b204 change to Vin 2019-12-25 15:41:05 +08:00
royluo 78d788cab2 IV and CV mode with Vout version 2019-12-20 12:13:22 +08:00
royluo 02185083f5 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-12-20 12:06:34 +08:00
royluo aeca114c5f IV and CV mode with Vin version
(add ReadVout)
2019-12-20 12:04:59 +08:00
Benny Liu 7b4f2b5828 update BOARD_KUMA & BOARD_MINO calibration data. 2019-12-20 12:04:16 +08:00
YiChin 7b075f40a3 BOARD_KUMA & BOARD_MINO calibration data 2019-12-19 15:55:00 +08:00
yichin 6c68c67f0e annotation test CVcurve use led 2019-12-19 12:50:43 +08:00
Benny Liu fd9f0ef321 upload BOARD_BIGBROTHER calibration data 2019-12-17 19:01:30 +08:00
yichin cb44628316 Fucking Benny use my branch to calibrate 2019-12-17 16:23:07 +08:00
weiting2 63fd8cf1df flush notify buffer, cycle number should be 0x00, not 0xFF 2019-12-13 14:57:30 +08:00
Benny Liu cc39131466 don't care 2019-12-13 14:23:34 +08:00
Benny Liu e71e064846 Merge branch 'Elite_OBJ_Version' of https://gitlab.com/bioproscientific/bioprocc2650 into Elite_OBJ_Version 2019-12-13 11:22:34 +08:00
Benny Liu 1356a8c8af calibration usage 2019-12-13 11:22:16 +08:00
weiting2 d9b6340f23 reset ADC gain and DAC when press "Stop" button 2019-12-12 12:26:38 +08:00
weiting2 2709baf8e8 flush notify buffer after stop 2019-12-11 15:59:30 +08:00
weiting2 046fae3617 flush notify buffer before start 2019-12-11 15:58:59 +08:00
YiChin 688868fb48 flush notify buffer before start 2019-12-11 14:29:26 +08:00
weiting2 5967b6ebc6 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-12-11 13:22:41 +08:00
weiting2 d9e9a2102e flush timestamp register before start PeriodicEvent 2019-12-11 13:22:26 +08:00
105042004 065517a7cc test CV curve 2019-12-06 18:09:13 +08:00
105042004 0691725819 test CV curve 2019-12-06 17:34:04 +08:00
105042004 5954a965dc test CVcurve use led 2019-12-06 16:28:59 +08:00
105042004 788aca30ef test CV curve 2019-12-06 16:01:01 +08:00
weiting2 bda30b15b5 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-12-06 10:25:37 +08:00
weiting2 32523d6f88 fix ADC level 2019-12-06 10:25:20 +08:00
Benny Liu 300707871e Merge branch 'Elite_OBJ_Version' of https://gitlab.com/bioproscientific/bioprocc2650 into Elite_OBJ_Version 2019-12-03 15:35:17 +08:00
Benny Liu b21bdf57be calibration data for board KELLY 2019-12-03 15:35:08 +08:00
105042004 3067a5eafe CV test 2019-11-29 19:06:29 +08:00
105042004 ec4e48725c CV test 2019-11-29 18:54:16 +08:00
105042004 8322623699 test CV 2019-11-29 18:34:32 +08:00
105042004 c588d4d377 test CV curve 2019-11-29 18:21:40 +08:00
105042004 9e23b67e03 CV curve add VinVout switch 2019-11-29 17:40:37 +08:00
weiting2 0d4f77d25a add comment for CC mode 2019-11-28 19:09:51 +08:00
YiChin 0a16b06c78 11/28 NCKU version
[IV] return Vin
[CC] after reach Vmax/min, Iset = 0
2019-11-28 11:10:26 +08:00
weiting2 c6b6ff420d [CC] after Vin reach Vmax/min, Vout=VMax 2019-11-27 21:38:48 +08:00
YiChin 221c301739 CC Mode should add a DONE flag 2019-11-27 21:33:09 +08:00
weiting2 5355e584a3 fix CC stop condition 2019-11-27 19:19:25 +08:00
weiting2 9fa2c0eb1a fixup! This is a stable version. 11/28 sell to NCKU with CC mode IV mode return Vin 2019-11-27 19:12:44 +08:00
weiting2 03a1e5a633 fixup! This is a stable version. 11/28 sell to NCKU with CC mode IV mode return Vin 2019-11-27 18:58:27 +08:00
weiting2 968150e9b7 fixup! This is a stable version. 11/28 sell to NCKU with CC mode IV mode return Vin 2019-11-27 18:53:33 +08:00
weiting2 ef7484569d Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-11-27 17:25:43 +08:00
weiting2 9cc483da5a This is a stable version.
11/28 sell to NCKU with CC mode
IV mode return Vin
2019-11-27 17:22:54 +08:00
weiting2 eb9609da00 [CC] use INS.VoltLimit store CC mode limit volt 2019-11-27 17:20:35 +08:00
weiting2 ea5c79cd77 [CC] use INS.VoltLimit store CC mode limit volt 2019-11-27 17:02:54 +08:00
weiting2 4d4a0f5ce3 [CC] use INS.VoltLimit store CC mode limit volt 2019-11-27 16:39:15 +08:00
weiting2 cbeef5d00b [CC] use INS.VoltLimit store CC mode limit volt 2019-11-27 16:21:59 +08:00
weiting2 433e9d27ec [CC] use INS.VoltLimit store CC mode limit volt 2019-11-27 16:14:26 +08:00
weiting2 1e039a988a [CC] what's wrong 2019-11-27 15:48:05 +08:00
weiting2 393051bfec [IV] default output Volt is Vin instead of Vout 2019-11-27 14:03:47 +08:00
weiting2 d0b51aef7a Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-11-27 12:47:02 +08:00
YiChin c5e6739632 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-11-27 12:45:57 +08:00
YiChin b91fdc6d3f delete neu 2019-11-27 12:45:25 +08:00
weiting2 d62b879a17 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-11-27 12:42:27 +08:00
weiting2 31306ee2a9 [IV] default output Volt is Vin instead of Vout 2019-11-27 10:32:50 +08:00
Benny Liu 0346e37e50 calibration data of various boards 2019-11-26 18:52:14 +08:00
weiting2 f004c60964 [IV] default output Volt is Vin instead of Vout 2019-11-26 15:55:41 +08:00
YiChin 61c7827d93 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-11-22 17:52:20 +08:00
105042004 4fcb7594d7 test 2019-11-22 17:51:45 +08:00
YiChin 4d71181d78 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-11-22 17:43:35 +08:00
105042004 ed5e6d82fb test IV 2019-11-22 17:43:09 +08:00
YiChin efc23e1393 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-11-22 17:35:33 +08:00
105042004 d8ce4418ae test realV 2019-11-22 17:26:30 +08:00
YiChin fc5cebe638 Merge branch 'Elite_OBJ_Version' of C:\ti with conflicts. 2019-11-22 17:22:32 +08:00
105042004 fb7811559b test IV curve 2019-11-22 17:01:23 +08:00
YiChin a2e7049aa6 test IV Vinout 2019-11-22 16:55:09 +08:00
105042004 f9e6fa7ad0 IV curve add Vin Vout select 2019-11-22 13:02:34 +08:00
Benny Liu e89dbd2f5c calibration data 2019-11-20 18:39:20 +08:00
Benny Liu 0b59913870 calibration data 2019-11-19 18:35:14 +08:00
YiChin d2e11c947a [RT] fix Vout value 2019-11-19 15:28:19 +08:00
weiting2 8c6968ec05 [CC] using new IUC 2019-11-18 16:28:23 +08:00
weiting2 b864235e5c Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-11-18 15:08:44 +08:00
YiChin bd15523916 Every thing well done 2019-11-18 15:08:09 +08:00
YiChin 2f61a9ce99 [CV] auto gain solved 2019-11-18 14:40:10 +08:00
YiChin ed2edccbc1 [CV] auto gain not solve yet 2019-11-18 14:28:11 +08:00
weiting2 59dc27dfda [CV] Try AutoGain 2019-11-18 14:21:30 +08:00
YiChin 1f1b20f92f steptime = 0.5sec bug fix 2019-11-18 14:12:52 +08:00
weiting2 9a511e0fc1 [CV] Try AutoGain 2019-11-18 12:02:53 +08:00
YiChin dff4082ea9 [CV] try to fix auto 2019-11-18 11:36:33 +08:00
YiChin a4e62ac39e [IV] Auto gain work 2019-11-18 11:11:23 +08:00
YiChin e119cfceb8 [IV] Auto gain work 2019-11-18 10:55:03 +08:00
YiChin 308d1c6ef3 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version
# Conflicts:
#	simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteIVCurve.h
2019-11-18 09:53:17 +08:00
weiting2 89cd606529 [IV] Try AutoGain 2019-11-18 09:50:03 +08:00
YiChin 0ed0c08878 [IV] AutoGain would block reading volt, WHY 2019-11-16 12:31:13 +08:00
weiting2 f1a3c290e9 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-11-16 10:32:54 +08:00
weiting2 47af16a2e2 [IV] Try AutoGain 2019-11-16 10:32:35 +08:00
105042004 3f885decac add measurevolt for PS 2019-11-15 14:10:26 +08:00
weiting2 fb58112ba7 [IV] three-wire stable version 2019-11-14 18:25:21 +08:00
weiting2 9928f5281f [IV] read Vin origin data 2019-11-14 18:02:19 +08:00
weiting2 cf2944f651 [IV] read Vin origin data 2019-11-14 17:16:51 +08:00
weiting2 5cfdec63e2 [IV] read Vin origin data 2019-11-14 16:53:35 +08:00
weiting2 5defc984c2 [IV] read Vin origin data 2019-11-14 16:44:52 +08:00
weiting2 a0f7eff938 [IV] read Vin origin data 2019-11-14 16:19:44 +08:00
weiting2 31a2dd0891 [IV] read Vin origin data 2019-11-14 16:14:47 +08:00
YiChin 67b9a5be85 [IV] notify no data whyyyyyy 2019-11-14 16:12:14 +08:00
weiting2 837bd99e86 [IV] read Vin origin data 2019-11-14 15:59:20 +08:00
YiChin 507386a231 error fix 2019-11-14 15:54:14 +08:00
YiChin 11b155070d add wood/dirt star 2019-11-14 15:47:47 +08:00
YiChin 91a9a315e4 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version
# Conflicts:
#	simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteITCurve.h
2019-11-14 15:46:46 +08:00
weiting2 85e2f6cf9d [IV] try to report Vin 2019-11-14 15:45:07 +08:00
YiChin f3301069ef [IV] todo : fix auto gain 2019-11-14 13:47:33 +08:00
YiChin 7c1f558687 [IV] todo : fix auto gain 2019-11-14 12:58:14 +08:00
weiting2 448a81bdf7 [IV] try to solve auto gain 2019-11-14 11:53:20 +08:00
YiChin 2712a2fa73 error fix 2019-11-14 10:26:41 +08:00
weiting2 8151053d08 [IV] Vo = Vo - I*100R 2019-11-14 10:13:56 +08:00
weiting2 5e8f0af363 [CC] delete old code
[CCC] add CCC mode
2019-11-13 13:22:49 +08:00
YiChin 006d1c26b3 stable version fix Iin error 2019-11-13 11:38:33 +08:00
YiChin 46f080e642 stable version VERY NICE 2019-11-13 11:25:35 +08:00
YiChin 6088b102f8 stable version CC mode must autogain 2019-11-12 20:55:06 +08:00
YiChin 7a59623930 CC mode GAIN_10K work fine? 2019-11-11 17:53:02 +08:00
weiting2 4789a32fd4 [CC] Do not use auto gain in CC mode 2019-11-11 17:23:44 +08:00
weiting2 4b6bea5f41 test ADC gain instruction 2019-11-11 16:25:00 +08:00
weiting2 da2b97dcf1 NotifyReady not done
TODO: Vmax, Vmin in CC
2019-11-11 14:18:39 +08:00
YiChin 6aee724a7c NotifyReady flag can not work?! 2019-11-11 13:57:45 +08:00
weiting2 f1765d957c comment some useless function 2019-11-11 13:44:30 +08:00
YiChin 19e760f9cc NotifyReady flag can not work?! 2019-11-11 13:31:55 +08:00
weiting2 04c7e8d640 [headstage] add NotifyReady flag 2019-11-11 12:39:21 +08:00
weiting2 813ef50bf5 [headstage] add NotifyReady flag 2019-11-11 11:32:04 +08:00
YiChin 8bc43f1bb0 [CC] This is a stable version 2019-11-11 11:06:55 +08:00
weiting2 50acc23eb1 [CC mode] read Vin 2019-11-11 10:52:21 +08:00
YiChin a26bad68a6 [CC] everything well, return Vin works ^^ 2019-11-11 10:46:13 +08:00
weiting2 f5796e8ac5 [CC mode] read Vin 2019-11-11 10:26:13 +08:00
YiChin c862e6790f [CC] everything well, NEED RETURN VIN 2019-11-08 17:38:55 +08:00
YiChin fb43ec6ac3 [CC] Vin + V_(Iin-GND) = battery V 2019-11-08 16:09:09 +08:00
weiting2 e1aa33e6cb [CC mode] read Vin 2019-11-08 13:34:32 +08:00
YiChin fb3060a220 [VT, IT] default sample rate 100
[CC] notify rate 10
2019-11-08 13:09:07 +08:00
weiting2 be40ac25dc [CC mode] read Vin 2019-11-08 12:44:39 +08:00
YiChin 5a29b161ac [CC mode] return Vin has trouble 2019-11-08 11:24:56 +08:00
weiting2 caee6602a8 add potential state mode 2019-11-07 15:15:50 +08:00
weiting2 12c4908881 [CC mode] Vmax, Vmin
[headstage] flag, counter init function
2019-11-07 14:30:26 +08:00
YiChin cb0b0fafd0 [CC mode] return Vout - I*R 2019-11-07 10:58:57 +08:00
YiChin 633b3424e1 CC mode can work with little error 2019-11-06 20:24:46 +08:00
weiting2 c75a147392 CC mode return Vin 2019-11-06 12:17:41 +08:00
YiChin 1e71de284c try to return Vin 2019-11-06 12:11:44 +08:00
weiting2 3bfadb0ea5 CC mode notify gone 2019-11-06 11:15:12 +08:00
YiChin a22a1aa656 Vout bug solved; no notify in CC 2019-11-06 11:05:22 +08:00
weiting2 ac8f1af1cc try fix Vout mode bug 2019-11-06 10:30:20 +08:00
YiChin 42b5edd2bf find error 2019-11-06 10:14:25 +08:00
weiting2 cafa70e740 try fix Vout mode bug 2019-11-06 10:01:58 +08:00
alan576 7ecc6063ac [CCMode] TODO list :VMax & VMin 2019-11-05 23:57:27 +08:00
alan576 1c5e586bd9 [CCMode] return Vin instead of VOut 2019-11-05 23:55:47 +08:00
alan576 9861067a17 [CCMode] check IUC-Measure value (step value) 2019-11-05 23:46:44 +08:00
alan576 295abacf7c Add notify counter 2019-11-05 23:40:56 +08:00
YiChin 6b5dfcc12a James test CCmode 2019-11-05 19:23:35 +08:00
weiting2 8aab5b5aab IV/CV mode current auto gain problem 2019-11-05 18:51:07 +08:00
YiChin 776e40b639 James test CCmode 2019-11-05 18:39:46 +08:00
weiting2 a97909625d IV/CV mode current auto gain problem 2019-11-05 17:18:37 +08:00
YiChin 259170af20 James test CCmode 2019-11-05 17:05:28 +08:00
YiChin b929433eef James test CCmode 2019-11-05 11:52:59 +08:00
weiting2 b166235c21 IV/CV mode current auto gain problem 2019-11-05 10:26:19 +08:00
YiChin 37ad0160d0 IV/CV auto gain should more smooth 2019-11-04 18:23:31 +08:00
weiting2 d40891396d IV/CV mode current auto gain problem 2019-11-04 17:21:29 +08:00
weiting2 4f31028d1a VO free WMD bug 2019-11-04 17:19:35 +08:00
weiting2 8727b7d2eb try to fix IV mode 2019-11-04 17:09:32 +08:00
weiting2 39e012de64 try to fix IV mode 2019-11-04 16:54:41 +08:00
weiting2 48e566dea4 try to fix IV mode 2019-11-04 13:27:44 +08:00
weiting2 3f617786ef try to fix IV mode 2019-11-04 12:11:13 +08:00
YiChin 080ca80f2b IV/CV has an auto gain prob 2019-11-04 11:47:16 +08:00
weiting2 4875bb271a try to fix IV mode 2019-11-04 11:43:31 +08:00
YiChin b0ac5bb6e6 IV/CV has an auto gain prob 2019-11-04 11:25:09 +08:00
YiChin 8b6a402d47 error fix 2019-11-04 10:11:56 +08:00
weiting2 aefb2cffbb Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-11-04 09:44:21 +08:00
weiting2 6934d858fe free WMD and NULL it 2019-11-04 09:44:07 +08:00
YiChin bc28dedc64 IVmode stop and call reset() 2019-11-01 19:30:30 +08:00
105042004 92b81cb47f check limit 2019-11-01 18:47:01 +08:00
105042004 e9b5414ab0 set _LimitVlaue to 1e5 2019-11-01 18:28:06 +08:00
YiChin d3f6a6521a fix ITmode bug 2019-11-01 18:23:58 +08:00
105042004 13efb6c32a add limit to IVmode 2019-11-01 17:35:04 +08:00
YiChin 18e4cac845 all mode can work 2019-11-01 14:07:04 +08:00
YiChin f6a474e537 error fix 2019-11-01 12:17:28 +08:00
weiting2 311bbdd809 test CCMode 2019-11-01 12:05:25 +08:00
weiting2 e47cf7c3db test CCMode 2019-11-01 11:57:09 +08:00
YiChin b27718a30f error fix 2019-11-01 11:46:12 +08:00
YiChin be79bec5e0 error fix 2019-11-01 11:28:14 +08:00
weiting2 a551eb1143 delete Set & Get QQQ 2019-11-01 11:21:03 +08:00
weiting2 ddc51481b8 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-11-01 10:16:23 +08:00
weiting2 d8a567c607 WHY VStop so many problem?!!!!! 2019-11-01 10:16:07 +08:00
YiChin 776d8074b1 what's wrong with IV->SetVStop ? 2019-10-31 19:24:24 +08:00
YiChin e0f937be45 what's wrong with IV->SetVStop ? 2019-10-31 18:23:40 +08:00
weiting2 2d7bbb74aa WHY VStop so many problem?!!!!! 2019-10-31 18:02:20 +08:00
weiting2 03367a76cf set init value by SetValue fxn 2019-10-31 17:40:45 +08:00
YiChin 8fffec3116 debug Set & Get Fxn in IV 2019-10-31 16:46:16 +08:00
weiting2 d7210e3b5a set init value by SetValue fxn 2019-10-31 16:41:57 +08:00
weiting2 82834f30b0 remove static in union 2019-10-31 16:10:06 +08:00
weiting2 50fbaa5bc7 remove static in union 2019-10-31 16:02:51 +08:00
weiting2 696f6447dc debug IVMode DAC out 2019-10-31 15:51:39 +08:00
weiting2 60734c69b4 debug IVMode DAC out 2019-10-31 15:37:30 +08:00
weiting2 ddf22de09b Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-10-31 14:22:48 +08:00
weiting2 e169ed1d44 check IV init 2019-10-31 14:22:37 +08:00
YiChin 55759938da Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-10-31 13:47:06 +08:00
YiChin 45de2e6825 do not free WM 2019-10-31 13:46:54 +08:00
weiting2 4c0e7e2149 IT support both auto/non-auto mode 2019-10-31 13:46:15 +08:00
weiting2 b63989ca78 remember to free memory 2019-10-31 11:26:33 +08:00
weiting2 c2df81dd3b remember to free memory 2019-10-31 11:26:23 +08:00
YiChin 7d6a0ce845 error fix 2019-10-31 11:16:29 +08:00
weiting2 2c9105eb0a remember to free memory 2019-10-31 10:44:06 +08:00
weiting2 0d705b7d28 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-10-30 19:03:17 +08:00
weiting2 266e597e19 add CCMode in OOC struct 2019-10-30 19:02:58 +08:00
105042004 92d49c1f93 change CV IV curve function 2019-10-30 19:00:54 +08:00
weiting2 c40adb3b64 add CCMode in OOC struct 2019-10-30 18:49:01 +08:00
weiting2 44e5f54c50 using union 2019-10-30 16:50:20 +08:00
weiting2 c642325859 using union 2019-10-30 16:35:57 +08:00
weiting2 c3adc55aec using union 2019-10-30 16:24:21 +08:00
weiting2 8700625d69 using union 2019-10-30 16:18:35 +08:00
weiting2 bc4dcfbe7d using union 2019-10-30 16:17:06 +08:00
weiting2 43170a4282 using union 2019-10-30 16:14:22 +08:00
weiting2 3652e19a3d using union 2019-10-30 16:03:27 +08:00
weiting2 36e6a47472 using union 2019-10-30 15:31:18 +08:00
weiting2 c71c55ecf1 using union 2019-10-30 14:48:00 +08:00
weiting2 57a5b2b4f5 Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-10-30 14:38:48 +08:00
weiting2 0da311941b malloc only once 2019-10-30 14:38:27 +08:00
105042004 7965a4cc1d rewrite small error 2019-10-30 14:32:18 +08:00
105042004 551f9de36b add LIMIT to IV mode 2019-10-30 14:29:34 +08:00
weiting2 fa8f0202e9 malloc only once 2019-10-30 12:23:08 +08:00
YiChin ee35c54dec should be stable 2019-10-29 14:58:24 +08:00
weiting2 031b98a6d5 VT/IT/VOut using OOC struct 2019-10-29 14:54:40 +08:00
weiting2 82ab990f0b VT/IT/VOut using OOC struct 2019-10-29 14:19:11 +08:00
weiting2 38774d9201 VT/IT/VOut using OOC struct 2019-10-29 14:14:34 +08:00
YiChin 6845963c8b should be stable 2019-10-29 12:30:28 +08:00
YiChin 4e4ce66318 bug fix 2019-10-29 12:26:26 +08:00
YiChin 6fe44a536f bug fix 2019-10-29 12:14:20 +08:00
YiChin 07272963bf bug fix 2019-10-29 12:14:04 +08:00
weiting2 80dbc64452 VT/IT/VOut using OOC struct 2019-10-29 12:04:49 +08:00
weiting2 3a8c5d843a VT/IT/VOut using OOC struct 2019-10-29 11:58:50 +08:00
weiting2 bf4baa8200 VT/IT/VOut using OOC struct 2019-10-29 11:53:34 +08:00
YiChin bf2b1b9d3e error fix 2019-10-29 11:52:22 +08:00
weiting2 03391b4fb3 VT/IT/VOut using OOC struct with unknown error 2019-10-29 11:43:33 +08:00
YiChin 9040e85dbb error fix 2019-10-29 11:39:23 +08:00
YiChin 85021a88b0 error fix 2019-10-29 11:34:55 +08:00
weiting2 a5df1c227e VT/IT/VOut using OOC struct 2019-10-29 11:18:16 +08:00
weiting2 8213d9fb19 VT/IT/VOut using OOC struct 2019-10-29 11:01:57 +08:00
YiChin 14c424571a Merge remote-tracking branch 'origin/Elite_OBJ_Version' into Elite_OBJ_Version 2019-10-29 09:57:26 +08:00
YiChin 8a94a57843 error fix 2019-10-29 09:56:50 +08:00
weiting2 a58f787253 VT/IT using OOC struct 2019-10-28 19:00:09 +08:00
weiting2 6c839b22d9 VT/IT using OOC struct 2019-10-28 17:53:49 +08:00
YiChin c086de7cf4 OOC compile pass 2019-10-28 17:31:25 +08:00
YiChin 3c5f4d9bb4 OOC error fix 2019-10-28 16:51:48 +08:00
weiting2 f3037c7959 OOC struct 2019-10-28 16:09:33 +08:00
YiChin 5a519d5fb5 OOC error fix 2019-10-28 16:07:06 +08:00
weiting2 a16543ee57 OOC struct 2019-10-28 12:41:59 +08:00
YiChin 9d281ce999 error fix 2019-10-28 12:06:44 +08:00
weiting2 d97b3ad6b0 OOC struct 2019-10-28 11:59:03 +08:00
YiChin cad1763981 error fix 2019-10-28 11:52:05 +08:00
weiting2 092c02940d OOC struct 2019-10-28 11:20:44 +08:00
weiting2 0a19abd0e8 first attempt to pointer of pointer 2019-10-24 12:10:08 +08:00
YiChin 284cfe6d05 double pointer attempt 2019-10-24 11:52:34 +08:00
weiting2 3298b6226b first attempt to pointer of pointer 2019-10-24 11:48:19 +08:00
YiChin dfcaf2d908 double pointer attempt 2019-10-24 11:45:00 +08:00
weiting2 d517318a67 first attempt to pointer of pointer 2019-10-24 11:36:59 +08:00
weiting2 d0aa520329 Merge branch 'Elite_master' of https://gitlab.com/bioproscientific/bioprocc2650 into Elite_master 2019-10-24 11:02:41 +08:00
weiting2 9a875b8459 first attempt to pointer of pointer 2019-10-24 10:59:19 +08:00
YiChin 73ac2f5c90 should be a stable version 2019-10-24 10:17:24 +08:00
YiChin efcb1132de auto gain seems done
need more test
2019-10-23 18:42:17 +08:00
YiChin 7492ed161d auto gain prob 2019-10-23 17:05:25 +08:00
YiChin ae7ec2e5ce auto gain prob 2019-10-23 16:42:28 +08:00
weiting2 63fde4bdbc TODO: IV CV add Imax 2019-10-23 14:04:35 +08:00
YiChin 32ccb8838f add water star data 2019-10-23 11:14:00 +08:00
YiChin 5b6fd53830 CV underflow done? 2019-10-23 10:42:53 +08:00
YiChin 86eef98b13 CV still underflow, implement auto gain on IV CV IT RT 2019-10-22 18:15:35 +08:00
YiChin 3fdbfcf39f CV still underflow 2019-10-22 15:25:41 +08:00
weiting2 847ea9f3c0 IV underflow 2019-10-22 14:56:01 +08:00
weiting2 25bd5b5ebe auto gain 2019-10-22 14:27:27 +08:00
YiChin 335fe6a9a4 IV CV still underflow 2019-10-22 12:28:48 +08:00
YiChin 6a0480613c fix CC mode feedback bug 2019-10-22 11:55:16 +08:00
YiChin 300fb9a44c fix IV CV underflow if Vfinal = -5V 2019-10-22 11:41:38 +08:00
weiting2 4fac2aa380 update board 21 2019-10-22 10:11:44 +08:00
YiChin d2ab4c1fe8 RT done, UI should X1e5 for every resister value 2019-10-21 19:01:24 +08:00
YiChin 6048e10ab7 RT done, UI should X1e5 for every resister value 2019-10-21 18:28:00 +08:00
weiting2 6bd94e3f73 gain switch in RT mode 2019-10-21 17:52:22 +08:00
YiChin fc302d4c75 should modify DAC usercode 2019-10-21 16:53:49 +08:00
weiting2 26a35a1446 gain switch in RT mode 2019-10-21 14:45:53 +08:00
YiChin 8f2eda7281 The least gain can not witch to max gain in one step 2019-10-21 12:20:44 +08:00
weiting2 e26a97a32f Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-10-21 11:38:49 +08:00
weiting2 5bdb0b04da gain switch in one cycle, debug 2019-10-21 11:38:31 +08:00
YiChin 8f8407601e error fix 2019-10-21 11:31:47 +08:00
YiChin 4c6dbcf98d error fix 2019-10-21 11:26:40 +08:00
weiting2 20ccd5de56 gain switch in one cycle 2019-10-21 11:24:59 +08:00
weiting2 3c3ad8ccc7 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve
# Conflicts:
#	simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteITCurve.h
2019-10-21 11:21:42 +08:00
weiting2 1030d6625b TODO: gain switch in one cycle 2019-10-21 11:20:46 +08:00
weiting2 326f3eb6b6 LED shows ADC gain state 2019-10-21 10:57:26 +08:00
YiChin 9dd7228eb5 clean warning 2019-10-21 10:51:13 +08:00
weiting2 59ac6b9909 add ReadCurrent() 2019-10-21 10:37:33 +08:00
YiChin e24ce8e5d5 auto gain done 2019-10-21 10:26:52 +08:00
weiting2 8720300bfc small-mid range gain switch test 2019-10-21 10:11:10 +08:00
weiting2 23fc75a236 small-mid range gain switch test 2019-10-18 18:06:13 +08:00
weiting2 80c25267cb all range auto scale 2019-10-18 17:49:31 +08:00
YiChin 81d1aff615 maybe auto gain should read data after circuit stable 2019-10-18 16:27:00 +08:00
weiting2 3221fe6492 largest and mid gain switch, considering negative current 2019-10-18 16:07:22 +08:00
weiting2 4ca7d5b681 try easy auto-scale ADC gain 2019-10-18 15:55:23 +08:00
weiting2 49677aa5b1 try easy auto-scale ADC gain 2019-10-18 15:30:46 +08:00
YiChin bbfef99a65 maybe auto gain should read data after circuit stable 2019-10-18 15:12:20 +08:00
weiting2 05f11fd147 try easy auto-scale ADC gain 2019-10-18 14:26:40 +08:00
YiChin f0aedf786d CC mode done 2019-10-17 18:15:37 +08:00
weiting2 a12146a479 CC mode bug fix 2019-10-17 16:26:55 +08:00
weiting2 410bef2e23 CC mode bug fix 2019-10-17 16:03:15 +08:00
YiChin 17c6a506cb error fix 2019-10-17 15:42:38 +08:00
weiting2 0b9c945aee change IUC and CC mode BT instruction 2019-10-17 15:08:31 +08:00
YiChin 53ef219d6e [CC] battery test perfect, should add +- current in UI 2019-10-17 11:38:53 +08:00
YiChin a14b2480db [CC] battery test perfect, should add +- current in UI 2019-10-17 11:11:25 +08:00
YiChin 89368d5352 CC mode mA done 2019-10-16 17:36:48 +08:00
YiChin f7903a0a31 CC mode earth 2019-10-16 17:03:24 +08:00
YiChin 56f42d21c5 CC mode earth 2019-10-16 17:01:15 +08:00
YiChin 52a8baad08 CC mode mA 2019-10-16 15:01:05 +08:00
YiChin 7acdbf6e78 [CC] seems done 2019-10-16 14:10:10 +08:00
YiChin 393394be6f [CC] seems done 2019-10-16 12:25:30 +08:00
YiChin b7f305e378 [CC] discharge fine, charge doesn't work 2019-10-16 11:50:26 +08:00
weiting2 cad8a78164 check IUC-Measure difference 2019-10-16 10:48:27 +08:00
YiChin 0c4ebcac79 [CC] discharge fine, charge doesn't work 2019-10-16 10:41:17 +08:00
YiChin e700657d5d [CC] discharge fine, charge doesn't work 2019-10-15 18:16:17 +08:00
YiChin ea9fb92d53 [CC] discharge fine, charge doesn't work 2019-10-15 18:12:18 +08:00
YiChin ba215c7ca9 pointer->value compare error 2019-10-15 16:54:48 +08:00
YiChin 564dc6e266 test cc mode notify 2019-10-15 15:43:13 +08:00
weiting2 86a2e54694 trans IUC current update 2019-10-15 14:21:57 +08:00
YiChin 358950bec0 CC mode read, done 2019-10-15 12:17:53 +08:00
weiting2 de2cb269b7 check measure current 2019-10-14 18:42:24 +08:00
YiChin 151e829973 test IUC 2019-10-14 17:50:35 +08:00
YiChin 19121b55a7 test IUC 2019-10-14 17:34:25 +08:00
alan 31f03582a3 check notify 2019-10-14 17:27:10 +08:00
alan 0859f6da6d check notify 2019-10-14 17:12:27 +08:00
YiChin 120b7086e5 USA demo version 2019-10-14 10:05:43 +08:00
YiChin d393872d8c [CV] done 2019-10-10 17:28:29 +08:00
YiChin 3ab9afdcd3 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-10-10 17:27:25 +08:00
YiChin 8812b4c103 [CV] done 2019-10-10 17:27:00 +08:00
Benny Liu 4cccced7ac calibration data for European 2019-10-09 18:40:09 +08:00
alan 7b3d342be6 [CV] Test turn back measure current 2019-10-09 16:50:26 +08:00
alan 97409c88c3 [IV][IT][VT][RT][Vout] work fine
[CV] turn direction has an offset bug
2019-10-08 19:01:03 +08:00
Benny Liu 1d675d9d78 calibration data 2019-10-08 18:57:00 +08:00
Benny Liu 1774a255d8 Merge branch 'Elite_ZTcurve' of https://gitlab.com/bioproscientific/bioprocc2650 into Elite_ZTcurve 2019-10-08 18:48:34 +08:00
Benny Liu 1863016b63 calibration data of various boards 2019-10-08 18:48:24 +08:00
YiChin 1e89a540a1 macro CAPS 2019-10-08 18:00:57 +08:00
alan 5daa67e054 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-10-08 17:56:23 +08:00
alan 05ce7f7f44 [IV][CV] get sample after wait 0.1 sec 2019-10-08 17:56:08 +08:00
YiChin 9391c700a1 macro CAPS 2019-10-08 16:38:27 +08:00
YiChin 16c4ecf9f2 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-10-08 16:34:58 +08:00
alan 7280f76fae [Test] CC mode Vout = Iconstant 2019-10-08 16:33:52 +08:00
YiChin 3a5d40a5d9 kelly macro CAPS 2019-10-08 11:56:22 +08:00
alan 40dd596fef CV mode debug 2019-10-08 10:15:59 +08:00
YiChin 56b240b101 CC mode can read current and set IUC correctly 2019-10-07 18:21:42 +08:00
alan bf36103499 test CCmode output Volt 2019-10-07 16:39:20 +08:00
YiChin 477144dc24 delete gain switch LED 2019-10-05 14:31:26 +08:00
alan 0aa45cfedc Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-10-05 14:12:41 +08:00
alan 4691345831 test CCmode output Volt 2019-10-05 14:12:22 +08:00
Benny Liu 8445f8c263 board BAY_BAY calibration data 2019-10-05 12:09:52 +08:00
Benny Liu 7176f91a3f fix error 2019-10-05 11:32:58 +08:00
Benny Liu e37065ce91 board Kelly calibration data 2019-10-05 11:29:46 +08:00
YiChin 2537b76256 error fix 2019-10-05 10:47:47 +08:00
alan 59e275c997 test switch ADC gain 2019-10-05 10:07:56 +08:00
105042004 bfe61896e8 BAYBAY Kwlly Iin callibration 2019-10-04 19:13:43 +08:00
alan 0ad8b13db2 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-10-04 16:42:26 +08:00
alan 3c8abc04a8 ADC test WITHOUT avg 2019-10-04 16:42:08 +08:00
Benny Liu a48cf75c90 Merge branch 'Elite_ZTcurve' of https://gitlab.com/bioproscientific/bioprocc2650 into Elite_ZTcurve 2019-10-04 15:22:34 +08:00
alan 4f7017d5b2 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-10-04 15:16:58 +08:00
alan 79f0d57161 ADC test with avg 2019-10-04 15:16:42 +08:00
Benny Liu d76e8e6f3f Merge branch 'Elite_ZTcurve' of https://gitlab.com/bioproscientific/bioprocc2650 into Elite_ZTcurve 2019-10-04 15:08:43 +08:00
Benny Liu b6147c1fe5 fish_vet calibration data 2019-10-04 15:08:32 +08:00
YiChin 4bbd92127a Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-10-04 15:03:31 +08:00
YiChin 337c2aef8d add CV curve 2019-10-04 15:03:11 +08:00
alan e943d22a5f Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-10-04 14:47:27 +08:00
alan bceb8b9134 ADC test with avg 2019-10-04 14:47:09 +08:00
YiChin 14adc8a768 10/4 demo version 2019-10-04 14:00:21 +08:00
YiChin 7c44ad2272 10/6 demo version 2019-10-04 11:22:07 +08:00
alan c8272dd455 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-10-04 09:51:34 +08:00
YiChin cb2aa2126b 10/6 demo version 2019-10-03 18:35:55 +08:00
YiChin f74a412611 10/6 demo version 2019-10-03 18:18:23 +08:00
YiChin f0b92f8578 ADD 517 CORRECTION DATA 2019-10-03 18:14:15 +08:00
YiChin e7cae7dc21 10/6 demo version 2019-10-03 16:49:57 +08:00
YiChin 1c41bd7a45 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-10-03 12:58:31 +08:00
YiChin a671a4916d 10/6 demo version 2019-10-03 12:57:18 +08:00
alan 15ea1488c9 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-10-02 18:27:06 +08:00
Benny Liu f92dd743ef triceratops calibration data 2019-10-02 18:03:19 +08:00
alan eddbe3980a 10/6 demo version 2019-10-02 17:49:06 +08:00
Benny Liu b27df1489b Merge branch 'Elite_ZTcurve' of https://gitlab.com/bioproscientific/bioprocc2650 into Elite_ZTcurve 2019-10-02 17:46:35 +08:00
YiChin dc3f2ee046 10/6 demo version 2019-10-02 16:47:43 +08:00
YiChin ba7f03daeb 10/6 demo version 2019-10-02 16:19:14 +08:00
YiChin 079500faff 10/6 demo version 2019-10-02 16:13:21 +08:00
YiChin ce0defe5e9 RT mode demo prepare 2019-10-02 15:40:53 +08:00
alan 7b1bcd5147 Elite 1.4-re CCmode test read current 2019-10-02 14:01:34 +08:00
alan 787eb5dce1 Elite 1.4-re CCmode test read current 2019-10-02 12:04:45 +08:00
YiChin 9d73fab37e CC MDOE error fix 2019-10-02 11:31:39 +08:00
alan 6a833aabee Elite 1.4-re CCmode test read current 2019-10-01 18:42:42 +08:00
alan e40d0896b8 Elite 1.4-re CCmode test read current 2019-10-01 17:56:47 +08:00
alan c265eb0118 Elite 1.4-re CCmode test read current 2019-10-01 17:41:38 +08:00
alan cead3b0b5c Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve
# Conflicts:
#	simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteCCMode.h
2019-10-01 17:22:56 +08:00
alan 238c09befd Elite 1.4-re CCmode test read current 2019-10-01 17:22:18 +08:00
YiChin de1867d523 CC MDOE error fix 2019-10-01 17:19:06 +08:00
YiChin 906e02e265 CC MDOE error fix 2019-10-01 16:47:14 +08:00
Benny Liu 307308825e time test 2019-10-01 16:24:30 +08:00
YiChin aaf166d187 CC MDOE error fix 2019-10-01 15:59:39 +08:00
YiChin 38ff1f8c2b CC MDOE error fix 2019-10-01 15:12:18 +08:00
YiChin 82f58b3255 CC MDOE error fix 2019-10-01 14:40:35 +08:00
alan 31d22f02e1 Elite 1.4-re CCmode test read current 2019-10-01 14:28:43 +08:00
alan ff1f517af5 Elite 1.4-re CCmode test read current 2019-10-01 09:53:10 +08:00
alan fb340fbec6 Elite 1.4-re CCmode test 2019-09-30 17:40:55 +08:00
YiChin e208bfd4d9 CC MDOE error fix 2019-09-30 16:33:57 +08:00
alan b9f4967a23 Elite 1.4-re CCmode test 2019-09-30 16:12:10 +08:00
YiChin 539a388ec4 CC MDOE error fix 2019-09-30 16:10:02 +08:00
alan f770ba8783 Elite 1.4-re CCmode test 2019-09-30 15:37:16 +08:00
alan 6d2ef3e106 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-09-30 15:19:49 +08:00
alan e483c58f10 Elite 1.4-re CCmode test 2019-09-30 15:19:28 +08:00
YiChin b07c10bb53 CC MDOE error fix 2019-09-30 15:13:50 +08:00
alan bb10a463dc Elite 1.4-re CCmode test 2019-09-30 14:58:46 +08:00
YiChin 93e0db98fc CC MDOE error fix 2019-09-30 14:40:36 +08:00
YiChin 51fc4553a3 CC MDOE error fix 2019-09-30 14:31:15 +08:00
alan 5184fe76e7 Elite 1.4-re CCmode test 2019-09-30 14:26:45 +08:00
alan ee264a6f18 Elite 1.4-re CCmode test 2019-09-27 18:05:24 +08:00
YiChin d290201085 CC MDOE 2019-09-27 17:51:45 +08:00
alan 5ab5bdc301 Elite 1.4-re CCmode test 2019-09-27 17:37:10 +08:00
alan de995e2cec Elite 1.4-re CCmode test 2019-09-27 17:31:46 +08:00
alan 81fb68264c Elite 1.4-re CCmode test 2019-09-27 17:01:40 +08:00
alan b05a245cf4 Elite 1.4-re CCmode test 2019-09-27 16:35:22 +08:00
alan f3376a2ab3 Elite 1.4-re CCmode test 2019-09-27 15:25:22 +08:00
alan 48faeeaf1d Elite 1.4-re CCmode test 2019-09-27 15:11:57 +08:00
alan 5560899c94 Elite 1.4-re CCmode test 2019-09-27 14:41:31 +08:00
YiChin 85e7b34da1 CC MDOE 2019-09-27 13:08:57 +08:00
YiChin 013a2b9ede CC MDOE 2019-09-27 12:52:56 +08:00
alan e984572847 Elite 1.4-re CCmode test 2019-09-27 11:09:38 +08:00
alan 591c01bb98 Elite 1.4-re CCmode test 2019-09-27 10:49:14 +08:00
alan 7b053c506e Elite 1.4-re CCmode test 2019-09-27 10:48:22 +08:00
alan e8fcdc18da Merge remote-tracking branch 'remotes/origin/Elite_GPTimer' into Elite_ZTcurve 2019-09-27 10:41:34 +08:00
alan b65ff2383a Elite 1.4-re gptimer test 2019-09-26 18:05:28 +08:00
alan b69e9017bf Elite 1.4-re gptimer test 2019-09-26 17:07:59 +08:00
YiChin 09a40e1912 turn on/off with new clock done 2019-09-26 16:45:46 +08:00
alan 6fa630e6e4 Elite 1.4-re gptimer test 2019-09-26 16:03:48 +08:00
alan 95d3c0bbc4 Elite 1.4-re gptimer test 2019-09-26 15:45:19 +08:00
YiChin 9bf2ab20a8 gptimer_open has no bug 2019-09-26 15:35:22 +08:00
alan 15a10b2405 Elite 1.4-re gptimer test 2019-09-26 15:20:27 +08:00
YiChin a4093cdc70 gptimer_open has a bug 2019-09-26 15:08:53 +08:00
alan 8713d743e1 Elite 1.4-re gptimer test 2019-09-26 15:03:55 +08:00
YiChin 4d3129782e gptimer_open has a bug 2019-09-26 14:46:52 +08:00
alan 53ed3f7d6c Elite 1.4-re gptimer test 2019-09-26 12:17:42 +08:00
alan 91d68e665b Elite 1.4-re gptimer test 2019-09-26 11:32:03 +08:00
alan 0bc606c3a8 Elite 1.4-re gptimer test 2019-09-26 11:12:28 +08:00
alan d19b709324 Elite 1.4-re gptimer test 2019-09-26 11:11:40 +08:00
alan 74742ca45b Elite 1.4-re gptimer test 2019-09-26 11:10:05 +08:00
YiChin 2678b0c02f smallZ-T curve 2019-09-26 11:06:55 +08:00
alan 5576c071c5 Elite 1.4-re gptimer test 2019-09-26 10:52:01 +08:00
alan 27c51a6c54 Elite 1.4-re gptimer test 2019-09-26 10:43:02 +08:00
alan 98c4a62130 Elite 1.4-re genius correction test 2019-09-25 12:18:03 +08:00
alan 7bf8620baf Elite 1.4-re genius correction test 2019-09-25 12:11:33 +08:00
alan 1f742b24df Elite 1.4-re try compile gptimer 2019-09-25 11:59:50 +08:00
Benny Liu 3ac1d77651 Genius calibration data 2019-09-25 11:59:13 +08:00
YiChin ae74c4e5cd fix error 2019-09-25 11:36:48 +08:00
alan 434be00a44 Elite 1.4-re try compile gptimer 2019-09-25 11:26:28 +08:00
Benny Liu 0b365f098d Elite Genius board calibration data 2019-09-25 10:30:39 +08:00
YiChin 54e1aab5fc RT class leader 2019-09-24 18:50:37 +08:00
alan 76c8b49553 Elite 1.4-re RT mode 2019-09-23 18:36:56 +08:00
YiChin 085d51adcf RT class leader 2019-09-23 18:33:46 +08:00
alan 0b75801ed6 Elite 1.4-re RT mode 2019-09-23 18:01:45 +08:00
alan eb712ed4bb Elite 1.4-re RT mode 2019-09-23 17:55:52 +08:00
alan c6f6f4c8f7 Elite 1.4-re RT mode 2019-09-23 17:25:14 +08:00
alan ab8c29021d Elite 1.4-re RT mode 2019-09-23 16:48:50 +08:00
alan 62961eeaa4 Elite 1.4-re RT mode 2019-09-23 16:39:35 +08:00
alan b32c3048d7 Elite 1.4-re RT mode 2019-09-23 16:33:38 +08:00
alan bc18b12227 Elite 1.4-re RT mode 2019-09-23 16:09:48 +08:00
YiChin 28734c52a4 RT class leader 2019-09-23 16:03:03 +08:00
alan cd38d00496 Elite 1.4-re RT mode 2019-09-23 15:51:54 +08:00
alan e613ae4542 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-09-23 15:28:43 +08:00
YiChin 4439a83382 RT class leader 2019-09-23 15:20:56 +08:00
YiChin 64ef6657be RT class leader 2019-09-23 10:24:00 +08:00
alan 35760ace39 Elite 1.4-re RT mode 2019-09-20 18:29:42 +08:00
alan 72e6e9acae Elite 1.4-re RT mode 2019-09-20 18:25:21 +08:00
alan eecc7236ad Elite 1.4-re RT mode 2019-09-20 15:12:03 +08:00
alan bdb280c029 Elite 1.4-re RT mode 2019-09-20 14:01:30 +08:00
YiChin 77b1259bf3 bug fix 2019-09-20 11:36:06 +08:00
YiChin 6b9ffacb89 bug fix 2019-09-19 18:58:04 +08:00
YiChin 523a98cf8a bug fix 2019-09-19 16:57:34 +08:00
YiChin 98db6a0390 bug fix 2019-09-19 11:05:53 +08:00
YiChin 164d5209eb bug fix 2019-09-19 10:29:52 +08:00
alan 4b8a1960dd Elite 1.4-re RT mode 2019-09-18 17:17:00 +08:00
alan 2e25a129d6 Elite 1.4-re RT mode 2019-09-18 12:24:18 +08:00
YiChin 3fc2ccbc6a ZT should work 2019-09-18 11:37:24 +08:00
YiChin 78853da803 ZT should work 2019-09-17 18:38:10 +08:00
YiChin 4668654d3c ZT should work 2019-09-17 12:07:09 +08:00
YiChin 55503b209b ZT clean buf has a bug 2019-09-17 10:53:24 +08:00
alan 0fdd8bf693 Elite 1.4-re RT mode with 4 level (small resister 2019-09-16 18:45:41 +08:00
YiChin a6459e4302 ZT clean buf has a bug 2019-09-16 18:40:23 +08:00
YiChin b256a61876 CC studio is a FUCKING stupid IDE, F U C K 2019-09-16 18:01:25 +08:00
alan a59c70f75b Elite 1.4-re RT mode with 4 level (small resister 2019-09-16 17:49:29 +08:00
YiChin 59f608a4d0 bug fix 2019-09-16 17:45:58 +08:00
YiChin 70543a2bd5 bug fix 2019-09-16 15:14:07 +08:00
YiChin 7743b6ef62 bug fix 2019-09-16 12:17:43 +08:00
alan a7f3120fb9 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-09-16 12:09:40 +08:00
alan 16525b0d19 Elite 1.4-re RT mode with 4 level (small resister 2019-09-16 12:09:21 +08:00
YiChin c96b9db716 using long long in correction 2019-09-12 10:20:12 +08:00
YiChin a8bdface95 using long long in correction 2019-09-11 12:13:25 +08:00
YiChin ea8bf21ffd using long long in correction 2019-09-11 11:41:52 +08:00
YiChin 24efe9d896 using long long in correction 2019-09-11 11:41:23 +08:00
alan 3ae0520f39 Elite 1.4-re test ZT_curve branch 2019-09-11 10:06:48 +08:00
alan 035ca66237 Elite 1.4-re debug VT 2019-09-05 17:20:44 +08:00
alan 66fd1a5f2f Elite 1.4-re debug VT 2019-09-05 12:23:11 +08:00
alan ba4a082834 Elite 1.4-re debug VT 2019-09-05 12:16:23 +08:00
alan ac7b4e8ac3 Elite 1.4-re debug VT 2019-09-05 12:07:29 +08:00
alan 7e79b2e12c Elite 1.4-re debug VT 2019-09-05 11:45:20 +08:00
YiChin 0da686a78b add new correction data 2019-09-05 11:20:59 +08:00
alan 474e3cb8d9 Elite 1.4-re IV avg out at steptime-1 2019-09-05 10:35:49 +08:00
alan e649bd9a25 Elite 1.4-re RT comment 2019-09-05 10:26:44 +08:00
alan 1f5bf25d16 Elite 1.4-re Vorigin Vfinal use usercode 2019-09-04 18:52:49 +08:00
alan 14cc86bce1 Elite 1.4-re Vorigin Vfinal use usercode 2019-09-04 18:43:41 +08:00
alan 5f636db5ed Elite 1.4-re fix function pointer error (*self) 2019-09-04 14:58:41 +08:00
alan 72c84deb85 Elite 1.4-re fix function pointer error (*self) 2019-09-04 14:51:16 +08:00
alan a0cc1cf228 Elite 1.4-re fix function pointer error (*self) 2019-09-04 14:35:01 +08:00
alan 41b35655a6 Elite 1.4-re fix function pointer error 2019-09-04 14:25:10 +08:00
YiChin 68169aed0d fix error 2019-09-04 14:09:21 +08:00
alan 645b971b6b Elite 1.4-re fix function pointer error 2019-09-04 13:55:32 +08:00
YiChin f669739b4e fix error 2019-09-04 13:01:34 +08:00
alan 9f5912c649 Elite 1.4-re IUC compare with real I 2019-09-04 12:55:19 +08:00
alan 8dac9ea12c Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-09-04 12:48:21 +08:00
alan 9f2e6547d2 Elite 1.4-re IUC compare with real I 2019-09-04 12:47:56 +08:00
YiChin 164be3061d Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-09-04 12:44:52 +08:00
YiChin f4acbf75d8 fix error 2019-09-04 12:44:22 +08:00
alan a3f710f398 Elite 1.4-re IUC compare with real I 2019-09-04 12:25:37 +08:00
alan fdd9ee173c Elite 1.4-re IUC compare with real I 2019-09-04 12:07:41 +08:00
alan 5c581869da Elite 1.4-re IUC compare with real I 2019-09-04 12:07:06 +08:00
alan f1bb7e6217 Elite 1.4-re add function pointer 2019-09-04 11:16:02 +08:00
alan bc553c66af Elite 1.4-re step time macro 2019-09-03 18:21:18 +08:00
alan 2bb80a06ed Elite 1.4-re merge with IVtest branch 2019-09-03 18:19:59 +08:00
alan d44dd996a7 Elite 1.4-re merge with IVtest branch 2019-09-03 18:16:32 +08:00
alan 36de918cfc Elite 1.4-re IUC to real nA/pA 2019-09-03 18:14:25 +08:00
alan 4b45002129 Elite 1.4-re fix error 2019-09-03 17:11:16 +08:00
alan 2d23da34c2 Elite 1.4-re split every function into .h file 2019-09-03 17:03:23 +08:00
alan ff58ec8a1e Elite 1.4-re split every function into .h file 2019-09-03 17:01:46 +08:00
alan 6ae419b537 Elite 1.4-re add CCmode 2019-09-03 16:22:08 +08:00
alan 96350c19c2 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-09-03 12:39:07 +08:00
alan ab52989e0e Elite 1.4-re add CCmode 2019-09-03 12:38:49 +08:00
alan 035f01fb0a Elite 1.4-re add CCmode 2019-09-03 11:41:30 +08:00
alan e235fd3adf Elite 1.4-re add CCmode 2019-09-03 11:23:21 +08:00
105042004 272d0e423d fix Impedance_Calculate() 2019-09-03 11:11:37 +08:00
alan e227b395f9 Elite 1.4-re add CCmode 2019-09-02 18:50:59 +08:00
YiChin 91d8d1a4d0 add ZTcurve impedance calculation function 2019-08-30 18:16:14 +08:00
alan c5543e777a Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-08-30 15:05:37 +08:00
alan ddfcd11fb4 Elite 1.4-re ZT_plot not finish yet 2019-08-30 15:05:19 +08:00
YiChin 03ef7ef734 fix error 2019-08-30 12:34:17 +08:00
alan 4d84788f51 Elite 1.4-re fix error 2019-08-30 12:15:15 +08:00
YiChin 6d48245d82 fix error 2019-08-30 12:08:31 +08:00
YiChin a2070d1073 Merge remote-tracking branch 'origin/Elite_ZTcurve' into Elite_ZTcurve 2019-08-30 11:52:39 +08:00
YiChin 40bb5b8e0a fix error 2019-08-30 11:49:45 +08:00
alan ac3bee4609 Elite 1.4-re fix error 2019-08-30 11:40:29 +08:00
alan 4166c2721c Elite 1.4-re add (instruction, LED, reset...).h file 2019-08-30 11:26:47 +08:00
alan 8455fe9422 Elite 1.4-re stepcode to DAC code 2019-08-29 17:11:55 +08:00
alan ed3a24a9c9 Elite 1.4-re stepcode to DAC code 2019-08-29 17:04:31 +08:00
alan d93464e970 Elite 1.4-re step reset value = 1mV 2019-08-29 16:57:22 +08:00
105042004 0909855fbb fix 10e3 2019-08-29 16:52:16 +08:00
alan dc32d4fb13 Elite 1.4-re delete 1.3 DACout function 2019-08-29 16:15:36 +08:00
alan 36e0be6f9b Elite 1.4-re FXN_GEN type VS bitwise priority? 2019-08-29 16:09:39 +08:00
105042004 ea5355f413 fix CHAO I correction 2019-08-29 15:09:21 +08:00
105042004 27960395de Merge branch 'Elite_IVtest' of https://gitlab.com/bioproscientific/bioprocc2650 into Elite_IVtest 2019-08-29 14:33:26 +08:00
105042004 cdbcb85640 add CHAO I DAC correction code 2019-08-29 14:32:54 +08:00
alan db2d8e4217 Elite 1.4-re clean warning 2019-08-29 12:38:33 +08:00
alan 1b9aedf7a0 Elite 1.4-re clean warning 2019-08-29 12:24:40 +08:00
alan 1cba7efeeb Elite 1.4-re interrupt function 2019-08-29 12:20:21 +08:00
alan ec7e721fcc Elite 1.4-re reformat 2019-08-29 12:16:28 +08:00
YiChin dcfb390243 fix format bug 2019-08-29 12:03:00 +08:00
alan 2cd7161694 Elite 1.4-re have a format bug 2019-08-29 11:58:14 +08:00
105042004 a84ec8c438 fix IV curve 2019-08-29 11:43:46 +08:00
105042004 33805dd480 fix IV curve 2019-08-29 11:41:53 +08:00
alan a033919d47 Elite 1.4-re IV mode with LED hint 2019-08-29 11:30:09 +08:00
alan 72674329bc Elite 1.4-re DAC control and IV mode notify 2019-08-29 11:07:56 +08:00
alan 6d690d80da Merge remote-tracking branch 'origin/Elite_IVtest' into Elite_IVtest
# Conflicts:
#	simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/impedance_meter.h
2019-08-29 11:07:49 +08:00
alan e607ae50e1 Elite 1.4-re DAC control and IV mode notify 2019-08-29 11:05:12 +08:00
105042004 750c13ee00 test IV current 2019-08-29 10:54:37 +08:00
105042004 b66a5c1cc5 test IV current 2019-08-29 10:45:46 +08:00
105042004 732ef11d7f test IV current 2019-08-29 10:38:10 +08:00
105042004 1187ead2cf test IV current 2019-08-29 10:31:28 +08:00
105042004 c6ddc19fdc fix average 2019-08-28 18:53:30 +08:00
105042004 e864d8fc10 fix average 2019-08-28 18:52:23 +08:00
YiChin 3a0d730c11 push 2019-08-28 16:36:29 +08:00
alan 773b9f5e48 Elite 1.4-re move include "XXX.h" 2019-08-28 16:26:38 +08:00
alan 3218b3a531 Elite 1.4-re move include "XXX.h" 2019-08-28 16:19:24 +08:00
alan 658ed58412 Elite 1.4-re IV-current avg has a bug; move include "XXX.h" 2019-08-28 16:13:19 +08:00
105042004 9d288dee41 fix IV notify 2019-08-28 14:40:56 +08:00
105042004 e975789be4 fix IV notify 2019-08-28 14:40:44 +08:00
105042004 bf2ef89a7f fix correction data init 2019-08-28 14:10:29 +08:00
105042004 f81aa9a47b fix correction_data 2019-08-28 13:02:03 +08:00
alan 2a82ac65e2 Elite 1.4-re correction struct 2019-08-28 12:45:24 +08:00
105042004 6a506898a8 fix correction_data init 2019-08-28 12:26:45 +08:00
105042004 8606e0ca9d fix Correction data 2019-08-28 12:10:46 +08:00
105042004 5951d1c9e2 switch to chao i 2019-08-28 11:54:01 +08:00
105042004 e741d1b252 Merge branch 'Elite_IVtest' of https://gitlab.com/bioproscientific/bioprocc2650 into Elite_IVtest 2019-08-28 11:53:19 +08:00
105042004 f85d687a77 add DAC correction data 2019-08-28 11:52:54 +08:00
alan 142b006c63 Elite 1.4-re use old format notify 2019-08-28 11:42:15 +08:00
alan 5e59e60b4e Merge remote-tracking branch 'origin/Elite_IVtest' into Elite_IVtest 2019-08-28 11:36:29 +08:00
alan 4a37fa8668 Elite 1.4-re write notify comment 2019-08-28 10:49:49 +08:00
36 changed files with 5112 additions and 1430 deletions
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configurations XML_version="1.2" id="configurations_0">
<configuration XML_version="1.2" id="configuration_0">
<instance XML_version="1.2" desc="Texas Instruments XDS100v3 USB Debug Probe" href="connections/TIXDS100v3_Dot7_Connection.xml" id="Texas Instruments XDS100v3 USB Debug Probe" xml="TIXDS100v3_Dot7_Connection.xml" xmlpath="connections"/>
<connection XML_version="1.2" id="Texas Instruments XDS100v3 USB Debug Probe">
<instance XML_version="1.2" href="drivers/tixds100v2icepick_c.xml" id="drivers" xml="tixds100v2icepick_c.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds100v2cs_dap.xml" id="drivers" xml="tixds100v2cs_dap.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds100v2cortexM.xml" id="drivers" xml="tixds100v2cortexM.xml" xmlpath="drivers"/>
<property Type="choicelist" Value="2" id="The Converter Usage">
<choice Name="Generate 1149.7 2-pin advanced modes" value="enable">
<property Type="choicelist" Value="1" id="The Converter 1149.7 Frequency">
<choice Name="Overclock with user specified value" value="unused">
<property Type="choicelist" Value="5" id="-- Choose a value from 1.0MHz to 50.0MHz"/>
</choice>
</property>
<property Type="choicelist" Value="5" id="The Target Scan Format"/>
</choice>
</property>
<platform XML_version="1.2" id="platform_0">
<instance XML_version="1.2" desc="CC2640F128" href="devices/cc2640f128.xml" id="CC2640F128" xml="cc2640f128.xml" xmlpath="devices"/>
</platform>
</connection>
</configuration>
</configurations>
@@ -0,0 +1,9 @@
The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
on the device and connection settings specified in your project on the Properties > General page.
Please note that in automatic target-configuration management, changes to the project's device and/or
connection settings will either modify an existing or generate a new target-configuration file. Thus,
if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
you may create your own target-configuration file for this project and manage it manually. You can
always switch back to automatic target-configuration management by checking the "Manage the project's
target-configuration automatically" checkbox on the project's Properties > General page.
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configurations XML_version="1.2" id="configurations_0">
<configuration XML_version="1.2" id="configuration_0">
<instance XML_version="1.2" desc="Texas Instruments XDS100v3 USB Debug Probe" href="connections/TIXDS100v3_Dot7_Connection.xml" id="Texas Instruments XDS100v3 USB Debug Probe" xml="TIXDS100v3_Dot7_Connection.xml" xmlpath="connections"/>
<connection XML_version="1.2" id="Texas Instruments XDS100v3 USB Debug Probe">
<instance XML_version="1.2" href="drivers/tixds100v2icepick_c.xml" id="drivers" xml="tixds100v2icepick_c.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds100v2cs_dap.xml" id="drivers" xml="tixds100v2cs_dap.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds100v2cortexM.xml" id="drivers" xml="tixds100v2cortexM.xml" xmlpath="drivers"/>
<property Type="choicelist" Value="2" id="The Converter Usage">
<choice Name="Generate 1149.7 2-pin advanced modes" value="enable">
<property Type="choicelist" Value="1" id="The Converter 1149.7 Frequency">
<choice Name="Overclock with user specified value" value="unused">
<property Type="choicelist" Value="5" id="-- Choose a value from 1.0MHz to 50.0MHz"/>
</choice>
</property>
<property Type="choicelist" Value="5" id="The Target Scan Format"/>
</choice>
</property>
<platform XML_version="1.2" id="platform_0">
<instance XML_version="1.2" desc="CC2640F128" href="devices/cc2640f128.xml" id="CC2640F128" xml="cc2640f128.xml" xmlpath="devices"/>
</platform>
</connection>
</configuration>
</configurations>
@@ -0,0 +1,9 @@
The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
on the device and connection settings specified in your project on the Properties > General page.
Please note that in automatic target-configuration management, changes to the project's device and/or
connection settings will either modify an existing or generate a new target-configuration file. Thus,
if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
you may create your own target-configuration file for this project and manage it manually. You can
always switch back to automatic target-configuration management by checking the "Manage the project's
target-configuration automatically" checkbox on the project's Properties > General page.
@@ -9,6 +9,6 @@
<linkerCommandFile value="cc26x0f128.cmd"/>
<rts value="libc.a"/>
<createSlaveProjects value=""/>
<connection value="common/targetdb/connections/TIXDS100v3_Dot7_Connection.xml"/>
<connection value="common/targetdb/connections/TIXDS110_Connection.xml"/>
<isTargetManual value="false"/>
</projectOptions>
@@ -15,8 +15,8 @@
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Default.1209999684" name="FlashROM" parent="com.ti.ccstudio.buildDefinitions.TMS470.Default" postannouncebuildStep="" postbuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TOOLS_BLE}/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${ORG_PROJ_DIR}/../../ccs/config/ccs_compiler_defines.bcfg ${ORG_PROJ_DIR}/../../ccs/config/ccs_linker_defines.cmd" preannouncebuildStep="" prebuildStep="&quot;${TOOLS_BLE}/lib_search/lib_search.exe&quot; ${ORG_PROJ_DIR}/build_config.opt &quot;${TOOLS_BLE}/lib_search/params_split_cc2640.xml&quot; ${SRC_BLE_CORE}/../blelib &quot;${ORG_PROJ_DIR}/../../ccs/config/lib_linker.cmd&quot;">
<folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Default.1209999684." name="/" resourcePath="">
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain.929750171" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1008890994">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1479696404" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain.958553711" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.2088015050">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.2112506999" 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"/>
@@ -26,17 +26,17 @@
<listOptionValue builtIn="false" value="LINKER_COMMAND_FILE="/>
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.201372544" 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.1951196199" 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.20903631" 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.1176131016" 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.647279085" 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.1443871767" 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.227818129" 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.784155377" 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.494285153" 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.581550859" 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.1288777730" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH" valueType="includePath">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.101349069" 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.572884961" 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.50794417" 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.783335843" 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.341974501" 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.274225680" 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.529764162" 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.1837039616" 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.1393115220" 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.2112471580" 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.152832201" 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="${SRC_EX}/examples/simple_peripheral/cc26xx/stack"/>
<listOptionValue builtIn="false" value="${SRC_EX}/common/cc26xx"/>
@@ -60,7 +60,7 @@
<listOptionValue builtIn="false" value="${SRC_EX}/profiles/roles"/>
<listOptionValue builtIn="false" value="${CC26XXWARE}"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.986125825" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE" valueType="definedSymbols">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.1361895403" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE" valueType="definedSymbols">
<listOptionValue builtIn="false" value="CC26XX"/>
<listOptionValue builtIn="false" value="POWER_SAVING"/>
<listOptionValue builtIn="false" value="CC26XXWARE"/>
@@ -81,60 +81,60 @@
<listOptionValue builtIn="false" value="xTESTMODES"/>
<listOptionValue builtIn="false" value="xTEST_BLEBOARD"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.372638078" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.C99" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS.201347726" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS" valueType="stringList">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.1555958931" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.C99" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS.1144396572" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS" valueType="stringList">
<listOptionValue builtIn="false" value="48"/>
<listOptionValue builtIn="false" value="16004"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING.73314177" 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.1546809951" 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.1126279750" 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.1492280006" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE.538453952" 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.12083718" 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.1432753391" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE.1345637669" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE" valueType="stringList">
<listOptionValue builtIn="false" value="${SRC_EX}/config/build_components.opt"/>
<listOptionValue builtIn="false" value="${ORG_PROJ_DIR}/build_config.opt"/>
</option>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS.313905687" 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.1129729173" 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.156783227" 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.538375181" 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.1884548091" 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.682104615" 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.662317863" 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.728508440" 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.1008890994" 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.1873600405" 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.1359172875" 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.1355177509" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE" value="&quot;${ProjName}.map&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.829303802" 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.1078356909" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY" valueType="libs">
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.2088015050" 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.1079333148" 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.1347544490" 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.136883143" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE" value="&quot;${ProjName}.map&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.1510359183" 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.1331488920" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY" valueType="libs">
<listOptionValue builtIn="false" value="libc.a"/>
<listOptionValue builtIn="false" value="${ORG_PROJ_DIR}/../../ccs/config/lib_linker.cmd"/>
<listOptionValue builtIn="false" value="${ROM}/ble_rom_releases/04242014/ble_rom_patch.symbols"/>
<listOptionValue builtIn="false" value="${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH.1707930214" 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.1835383942" 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.59164041" 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.821225577" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS" valueType="stringList">
<listOptionValue builtIn="false" value="16002-D"/>
<listOptionValue builtIn="false" value="10247-D"/>
<listOptionValue builtIn="false" value="10325-D"/>
<listOptionValue builtIn="false" value="10229-D"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.11567165" 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.1727810233" 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.1385277262" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO" value="&quot;${ProjName}_linkInfo.xml&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.ENTRY_POINT.1153340314" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.ENTRY_POINT" value="startup_entry" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.450995330" 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.1827942626" 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.1279238428" 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.526125450" 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.581803256" 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.1390204935" 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.1601082213" 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.351715800" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO" value="&quot;${ProjName}_linkInfo.xml&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.ENTRY_POINT.90863272" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.ENTRY_POINT" value="startup_entry" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.1779672459" 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.1701763005" 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.687564793" 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.1056923280" 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.73723664" 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.947560992" name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.1295209583" 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.110293046" 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.1122561921" 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.1766088709" name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.494132983" 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.1603693219" 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.1153492005" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT" value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.INTEL" valueType="enumerated"/>
</tool>
</toolChain>
</folderInfo>
@@ -12,6 +12,7 @@
<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"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/simple_peripheral_cc2650em_stack"/>
</listAttribute>
@@ -1,19 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configurations XML_version="1.2" id="configurations_0">
<configuration XML_version="1.2" id="Texas Instruments XDS100v3 USB Debug Probe_0">
<instance XML_version="1.2" desc="Texas Instruments XDS100v3 USB Debug Probe_0" href="connections/TIXDS100v3_Dot7_Connection.xml" id="Texas Instruments XDS100v3 USB Debug Probe_0" xml="TIXDS100v3_Dot7_Connection.xml" xmlpath="connections"/>
<connection XML_version="1.2" id="Texas Instruments XDS100v3 USB Debug Probe_0">
<instance XML_version="1.2" href="drivers/tixds100v2icepick_c.xml" id="drivers" xml="tixds100v2icepick_c.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds100v2cs_dap.xml" id="drivers" xml="tixds100v2cs_dap.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds100v2cortexM.xml" id="drivers" xml="tixds100v2cortexM.xml" xmlpath="drivers"/>
<property Type="choicelist" Value="2" id="The Converter Usage">
<choice Name="Generate 1149.7 2-pin advanced modes" value="enable">
<property Type="choicelist" Value="1" id="The Converter 1149.7 Frequency">
<choice Name="Overclock with user specified value" value="unused">
<property Type="choicelist" Value="5" id="-- Choose a value from 1.0MHz to 50.0MHz"/>
</choice>
</property>
<property Type="choicelist" Value="5" id="The Target Scan Format"/>
<configuration XML_version="1.2" id="Texas Instruments XDS110 USB Debug Probe_0">
<instance XML_version="1.2" desc="Texas Instruments XDS110 USB Debug Probe_0" href="connections/TIXDS110_Connection.xml" id="Texas Instruments XDS110 USB Debug Probe_0" xml="TIXDS110_Connection.xml" xmlpath="connections"/>
<connection XML_version="1.2" id="Texas Instruments XDS110 USB Debug Probe_0">
<instance XML_version="1.2" href="drivers/tixds510icepick_c.xml" id="drivers" xml="tixds510icepick_c.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds510cs_dap.xml" id="drivers" xml="tixds510cs_dap.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds510cortexM.xml" id="drivers" xml="tixds510cortexM.xml" xmlpath="drivers"/>
<property Type="choicelist" Value="1" id="Power Selection">
<choice Name="Probe supplied power" value="1">
<property Type="stringfield" Value="3.3" id="Voltage Level"/>
</choice>
</property>
<property Type="choicelist" Value="0" id="JTAG Signal Isolation"/>
<property Type="choicelist" Value="4" id="SWD Mode Settings">
<choice Name="cJTAG (1149.7) 2-pin advanced modes" value="enable">
<property Type="choicelist" Value="1" id="XDS110 Aux Port"/>
</choice>
</property>
<platform XML_version="1.2" id="platform_0">
@@ -62,24 +62,29 @@ static void ADC_read(uint8_t *ADCdata){
static void ADCGainControl(uint8_t ADCLevel){
if(ADCLevel == 0){
// ADC gain level = 0, using 200R resister
// ADC gain level = 0, using 200K resister
PIN_setOutputValue(pin_handle, Turnon10K, 0);
PIN_setOutputValue(pin_handle, Turnon100R, 0);
PIN_setOutputValue(pin_handle, Turnon200R, 0);
}
else if(ADCLevel == 1){
// ADC gain level = 1, using 10K resister
PIN_setOutputValue(pin_handle, Turnon10K, 1);
PIN_setOutputValue(pin_handle, Turnon100R, 0);
PIN_setOutputValue(pin_handle, Turnon200R, 0);
}
else if(ADCLevel == 2){
// ADC gain level = 2, using 100R resister
// ADC gain level = 2, using 200R resister
PIN_setOutputValue(pin_handle, Turnon10K, 0);
PIN_setOutputValue(pin_handle, Turnon100R, 1);
PIN_setOutputValue(pin_handle, Turnon200R, 1);
}
else if(ADCLevel == 3){
// ADC gain level = 0, auto gain (using 200R resister)
PIN_setOutputValue(pin_handle, Turnon10K, 0);
PIN_setOutputValue(pin_handle, Turnon200R, 1);
}
else{
// default using 200R resister
PIN_setOutputValue(pin_handle, Turnon10K, 0);
PIN_setOutputValue(pin_handle, Turnon100R, 0);
PIN_setOutputValue(pin_handle, Turnon200R, 1);
}
}
@@ -121,4 +126,216 @@ static void ADCChannelSelect(uint8_t ADCChannel){
}
}
static void ReadVolt(uint8_t *buf){
// Read data twice since the first data we get is previous data
ADCChannelSelect(ADC_CH_VOLT);
CPUdelay(10);
ADC_read(buf);
ADCChannelSelect(ADC_CH_VOLT);
CPUdelay(10);
ADC_read(buf);
}
static void ReadVoutVolt(uint8_t *buf){
// Read data twice since the first data we get is previous data
ADCChannelSelect(ADC_CH_DAC);
CPUdelay(10);
ADC_read(buf);
ADCChannelSelect(ADC_CH_DAC);
CPUdelay(10);
ADC_read(buf);
}
static void ReadCurrent(uint8_t *buf){
// Read data twice since the first data we get is previous data
ADCGainControl(INSTRUCTION.ADCGainLevel);
ADCChannelSelect(ADC_CH_CURRENT);
CPUdelay(10);
ADC_read(buf);
ADCChannelSelect(ADC_CH_CURRENT);
CPUdelay(10);
ADC_read(buf);
}
static void ReadBatVolt(uint8_t *buf){
// Read data twice since the first data we get is previous data
ADCChannelSelect(ADC_CH_BAT);
CPUdelay(10);
ADC_read(buf);
ADCChannelSelect(ADC_CH_BAT);
CPUdelay(10);
ADC_read(buf);
}
// theoretical boundary <20, 10~500, >100 (uA)
#define GAIN_SMALL_BOUNDARY 40000 // 40 uA = 40,000,000 pA
#define GAIN_MID_BOUNDARY1 20000 // 20 uA = 20,000,000 pA
#define GAIN_MID_BOUNDARY2 400000 // 400 uA = 400,000,000 pA
#define GAIN_LARGE_BOUNDARY 200000 // 200 uA = 200,000 nA
//#define GAIN_SMALL_BOUNDARY 8000 // 8 uA = 8,000,000 pA
//#define GAIN_MID_BOUNDARY1 3000 // 3 uA = 3,000,000 pA
//#define GAIN_MID_BOUNDARY2 90000 // 90 uA = 90,000,000 pA
//#define GAIN_LARGE_BOUNDARY 70000 // 70 uA = 70,000 nA
static int32_t AutoGainReadCurrent(uint8_t *buf){
int32_t Real_Current = 0;
if(INSTRUCTION.ADCGainLevel == GAIN_AUTO){
INSTRUCTION.ADCGainLevel = GAIN_200R;
}
if(INSTRUCTION.ADCGainLevel == GAIN_200R){
uint8_t CurrentCount1 = 0;
while(CurrentCount1 < 5){
ReadCurrent(spi_ADC_rxbuf);
CurrentCount1++;
if(CurrentCount1 == 5){
ReadCurrent(spi_ADC_rxbuf);
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
break;
}
}
// switch to mid range current
if(Real_Current < GAIN_LARGE_BOUNDARY && Real_Current > -1*GAIN_LARGE_BOUNDARY){
uint8_t CurrentCount = 0;
// switch to small range current
if (Real_Current < GAIN_MID_BOUNDARY1 && Real_Current > -1*GAIN_MID_BOUNDARY1){
INSTRUCTION.ADCGainLevel = GAIN_200K;
while(CurrentCount < 5){
ReadCurrent(spi_ADC_rxbuf);
CurrentCount++;
if(CurrentCount == 5){
ReadCurrent(spi_ADC_rxbuf);
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
break;
}
}
}else{
CurrentCount = 0;
INSTRUCTION.ADCGainLevel = GAIN_10K;
while(CurrentCount < 5){
ReadCurrent(spi_ADC_rxbuf);
CurrentCount++;
if(CurrentCount == 5){
ReadCurrent(spi_ADC_rxbuf);
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
break;
}
}
}
// LED_color(DARKLED, 0x00, 0xFF, 0x00);
// // switch to small range current
// if (Real_Current < GAIN_MID_BOUNDARY1 && Real_Current > -1*GAIN_MID_BOUNDARY1){
// INSTRUCTION.ADCGainLevel = GAIN_200K;
// ReadCurrent(spi_ADC_rxbuf);
// Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
// LED_color(DARKLED, 0xFF, 0x00, 0x00);
// }
}
}
else if(INSTRUCTION.ADCGainLevel == GAIN_10K){
uint8_t CurrentCount1 = 0;
while(CurrentCount1 < 3){
ReadCurrent(spi_ADC_rxbuf);
CurrentCount1++;
if(CurrentCount1 == 3){
ReadCurrent(spi_ADC_rxbuf);
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
break;
}
}
// switch to large range current
if(Real_Current > GAIN_MID_BOUNDARY2 || Real_Current < -1*GAIN_MID_BOUNDARY2){
uint8_t CurrentCount = 0;
INSTRUCTION.ADCGainLevel = GAIN_200R;
while(CurrentCount < 3){
ReadCurrent(spi_ADC_rxbuf);
CurrentCount++;
if(CurrentCount == 3){
ReadCurrent(spi_ADC_rxbuf);
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
break;
}
}
}
// switch to small range current
else if (Real_Current < GAIN_MID_BOUNDARY1 && Real_Current > -1*GAIN_MID_BOUNDARY1){
uint8_t CurrentCount = 0;
INSTRUCTION.ADCGainLevel = GAIN_200K;
while(CurrentCount < 3){
ReadCurrent(spi_ADC_rxbuf);
CurrentCount++;
if(CurrentCount == 3){
ReadCurrent(spi_ADC_rxbuf);
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
break;
}
}
}
}
else if(INSTRUCTION.ADCGainLevel == GAIN_200K){
uint8_t CurrentCount1 = 0;
while(CurrentCount1 < 5){
ReadCurrent(spi_ADC_rxbuf);
CurrentCount1++;
if(CurrentCount1 == 5){
ReadCurrent(spi_ADC_rxbuf);
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
break;
}
}
//Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
// switch to mid range current
if(Real_Current > GAIN_SMALL_BOUNDARY || Real_Current < -1*GAIN_SMALL_BOUNDARY){
uint8_t CurrentCount = 0;
// switch to large range current
if(Real_Current > GAIN_MID_BOUNDARY2 || Real_Current < -1*GAIN_MID_BOUNDARY2){
INSTRUCTION.ADCGainLevel = GAIN_200R;
while(CurrentCount < 5){
ReadCurrent(spi_ADC_rxbuf);
CurrentCount++;
if(CurrentCount == 5){
ReadCurrent(spi_ADC_rxbuf);
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
break;
}
}
}else{
CurrentCount = 0;
INSTRUCTION.ADCGainLevel = GAIN_10K;
while(CurrentCount < 5){
ReadCurrent(spi_ADC_rxbuf);
CurrentCount++;
if(CurrentCount == 5){
ReadCurrent(spi_ADC_rxbuf);
Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
break;
}
}
}
// switch to large range current
// if(Real_Current > GAIN_MID_BOUNDARY2 || Real_Current < -1*GAIN_MID_BOUNDARY2){
// INSTRUCTION.ADCGainLevel = GAIN_200R;
// ReadCurrent(spi_ADC_rxbuf);
// Real_Current = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADC_CH_CURRENT, spi_ADC_rxbuf);
// }
}
}
return Real_Current;
}
#endif
@@ -0,0 +1,32 @@
#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
@@ -0,0 +1,132 @@
#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
@@ -0,0 +1,598 @@
#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
@@ -2,41 +2,38 @@
#ifndef EliteDAC
#define EliteDAC
static bool DACreset = true;
/* DAC reset parameter */
#define DACzero 0x85B2
#define DACposMax 0x0000
#define DACnegMax 0xFFFF
static bool DACReset;
#ifdef ELITE_VERSION_1_3
#define DACOUT 0x30
static void DAC_outputV(uint16_t voltLV) {
// C = command, X = don't care, D = data
// CCCC XXXX = command
// DDDD DDDD = v1
// DDDD XXXX = v2
uint8_t v1, v2 = 0;
v1 = (uint8_t) (voltLV >> 4) & 0xFF;
v2 = (uint8_t) ((voltLV & 0x000F) << 4) & 0xF0;
spi_DACtxbuf[0] = command;
spi_DACtxbuf[1] = v1;
spi_DACtxbuf[2] = v2;
for (int i = 3; i < SPI_DAC_SIZE; i++) {
spi_DACtxbuf[i] = 0;
}
DAC_SPI(SPI_DAC_SIZE, spi_DACtxbuf, spi_rxbuf);
}
#endif
//#ifdef ELITE_VERSION_1_3
//#define DACOUT 0x30
//
//static void DAC_outputV(uint16_t voltLV) {
// // C = command, X = don't care, D = data
// // CCCC XXXX = command
// // DDDD DDDD = v1
// // DDDD XXXX = v2
//
// uint8_t v1, v2 = 0;
// v1 = (uint8_t) (voltLV >> 4) & 0xFF;
// v2 = (uint8_t) ((voltLV & 0x000F) << 4) & 0xF0;
//
// spi_DACtxbuf[0] = command;
// spi_DACtxbuf[1] = v1;
// spi_DACtxbuf[2] = v2;
// for (int i = 3; i < SPI_DAC_SIZE; i++) {
// spi_DACtxbuf[i] = 0;
// }
//
// DAC_SPI(SPI_DAC_SIZE, spi_DACtxbuf, spi_rxbuf);
//}
//#endif
#ifdef ELITE_VERSION_1_4
#define DACCLS 0x02
#define DACOUT 0x31
static void DAC_outputV(uint16_t voltLV) {
static uint16_t DAC_outputV(uint16_t voltLV) {
// C = command, X = don't care, D = data
// CCCC CCCC = command
// DDDD DDDD = v1
@@ -55,8 +52,14 @@ static void DAC_outputV(uint16_t voltLV) {
spi_DACtxbuf[2] = v2;
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;
}
#endif
@@ -0,0 +1,22 @@
#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;
}
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;
}
#endif
@@ -0,0 +1,38 @@
/* Copyright (c) 2019. BioPro. Scientific.
*/
#ifndef HEADSTAGE_GPTIMER_H
#define HEADSTAGE_GPTIMER_H
#include <Board.h>
#include <ti/drivers/timer/GPTimerCC26XX.h>
#include <ti/sysbios/BIOS.h>
#include <xdc/runtime/Types.h>
#define EVT_PERIODIC_GPTIMER EVT_PERIODIC_0
static GPTimerCC26XX_Handle gptimer_handle;
static void elite_gptimer_callback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask);
#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 elite_gptimer_open() \
do { \
GPTimerCC26XX_Params params; \
GPTimerCC26XX_Params_init(&params); \
params.width = GPT_CONFIG_16BIT; \
params.mode = GPT_MODE_PERIODIC_DOWN; \
params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF; \
gptimer_handle = GPTimerCC26XX_open(Board_GPTIMER0A, &params); \
Types_FreqHz freq; \
BIOS_getCpuFreq(&freq); \
GPTimerCC26XX_Value loadVal = freq.lo / 1000 - 1; /*47999*/ \
GPTimerCC26XX_setLoadValue(gptimer_handle, loadVal); \
GPTimerCC26XX_setLoadValue(gptimer_handle, CLOCK_FREQ); /* 0.1 ms*/ \
GPTimerCC26XX_registerInterrupt(gptimer_handle, elite_gptimer_callback, GPT_INT_TIMEOUT); \
} while (0)
#endif // HEADSTAGE_GPTIMER_H
@@ -0,0 +1,84 @@
#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
@@ -0,0 +1,263 @@
#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);
}
// IV plot mode
else {
Voltage = OneWayVoltScan(WorkModeData->IV);
}
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
@@ -0,0 +1,139 @@
#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
/*==============================
==== headstage instruction ====
=============================*/
struct HEADSTAGE_INSTRUCTION {
/** chip ID */
uint8_t chip_id;
/** Sample rate **/
// SampleRate = SampleRateTable[SampleRateIndex]
uint8_t SampleRateIndex;
uint32_t SampleRate;
/** 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
uint16_t VoltConstant;
/** ADC parameter **/
uint8_t ADCGainLevel;
uint8_t AutoGainEnable;
/** Notify parameter **/
uint16_t NotifyRate;
/** Constant Current Parameter **/
// Charge is a bool; true => current > 0, vice versa
uint8_t Charge;
int32_t ConstantCurrent;
uint16_t VoltLimit;
/** Resister Measure **/
uint8_t ResisterMeter;
// elite function
uint8_t eliteFxn;
uint8_t CycleNumber;
uint8_t VoVi_Switch;
} INSTRUCTION = {0};
/*********************************************************************
* @fn InitEliteInstruction
*
* @brief Init all INSTRUCTION variable.
*
* @param None.
*
* @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
}
/*********************************************************************
* @fn GetInstructionParameter
*
* @brief Get Constant Current mode parameter.
*
* @param ins - instruction including current value and unit
*
* @return None.
*/
static void GetInstructionParameter(uint8 *ins){
// CurrentLV=0 => unit is nA
// CurrentLV=1 => unit is uA
// CurrentLV=2 => unit is mA
// INSTRUCTION.CurrentLV = (*ins);
// ConstantCurrentRange=0 => current value is 0~499
// ConstantCurrentRange=1 => current value is 500~999
// INSTRUCTION.ConstantCurrentRange = (*ins) & 0x0F;
// ConstantCurrent divide ConstantCurrentRange into 50000 count (thus each count is 0.01)
// e.g. 485.7 uA can be represent by
// CurrentLV = 1 (unit is uA)
// ConstantCurrentRange = 0 (current range is 0~499)
// ConstantCurrent = 48570
INSTRUCTION.ConstantCurrent = (uint32_t) (*(ins+1))<<24 | (uint32_t) (*(ins+2))<<16 | (uint32_t) (*(ins+3))<<8 | (uint32_t) (*(ins+4));
}
#endif
@@ -0,0 +1,70 @@
#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
if (TurnOnCounter >= CLOCK_ONE_SECOND) {
PIN_setOutputValue(pin_handle, enable_5v, 1); // enable 5V
TurnOn10V();
LEDPowerON();
return true;
} else {
TurnOnCounter++;
return false;
}
} else {
TurnOnCounter = 0;
PIN_setOutputValue(pin_handle, enable_5v, 0); // enable 5V
return false;
}
}
static void EliteKeyPress(uint8_t key) {
static uint16_t ShutDownCounter = 0;
static uint8_t OriginEliteFxn = 0;
if (key == 0) {
// key = 0 if press
// press key => bight LED
if (ShutDownCounter == CLOCK_ONE_SECOND) {
KeyWorkModeLED();
}
// press 3~4 sec, shutdown 2650
else if (ShutDownCounter > (CLOCK_ONE_SECOND*3) ) {
LED_color(DARKLED, 0xFF, 0xFF, 0x00);
PIN_setOutputValue(pin_handle, enable_5v, 0); // disable 5V
}
ShutDownCounter ++;
} else {
if (OriginEliteFxn == INSTRUCTION.eliteFxn) { // old function == currunt instruction
if (ShutDownCounter != 0) {
// dark LED
WorkModeLED();
ShutDownCounter = 0;
}
} else { // old function != currunt instruction
OriginEliteFxn = INSTRUCTION.eliteFxn;
if (ShutDownCounter != 0) {
ShutDownCounter = 0;
}
// dark mode LED
WorkModeLED();
}
}
}
static void TurnOn10V() {
If10Von = true;
PIN_setOutputValue(pin_handle, enable_10v, 1);
CPUdelay(8000);
}
#endif
@@ -0,0 +1,138 @@
#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)
static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue) {
spi_LEDtxbuf[0] = 0x0000;
spi_LEDtxbuf[1] = 0x0000;
for (int i = 2; i < SPI_LED_SIZE - 2; i += 2) {
spi_LEDtxbuf[i] = 0xE000 | ((uint16_t)bright << 8) | blue;
spi_LEDtxbuf[i + 1] = ((uint16_t)green << 8) | red;
}
spi_LEDtxbuf[SPI_LED_SIZE - 2] = 0xffff;
spi_LEDtxbuf[SPI_LED_SIZE - 1] = 0xffff;
LED_SPI(SPI_LED_SIZE, spi_LEDtxbuf, spi_LEDrxbuf);
}
static void WorkModeLED() {
switch (INSTRUCTION.eliteFxn) {
case IV_CURVE: {
WORKLED();
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: {
LEDPowerON();
break;
}
case ADC_TEST: {
WORKLED();
break;
}
case READ_VOUT_VALUE: {
WORKLED();
break;
}
default: {
LEDPowerON();
break;
}
}
}
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;
}
}
*/
}
#endif
@@ -24,12 +24,44 @@ 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;
// ****************** New Notify Format ******************************** //
/*
* Notify format
*
*
| | 1 | 2 | 3 |
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
-----------------------------------------------------------------
| header |
| current |
| voltage or impedance |
| mode & gain |
| time stamp |
| cycle number |
mode & gain
this byte include Elite working mode and ADC gain level
we use "(mode & 0xF0) | (gain & 0x0F)" to encode these two information
cycle number
for cyclic voltammetry use, we save it as channel number.
0xFF
* header = device ID
* I = current (0.001nA), V = voltage (mV),
* Z = impedance (k ohm), T = time (ms)
*
*
*/
// ********* End New Format Notify ***************************************** //
/*
* Notify format
@@ -55,6 +87,56 @@ static uint32_t notify_counter = 0;
*
*
*/
static void SendNotify() {
not_buf[0] = INSTRUCTION.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];
}
// 1 Timestamp = 32 usec; 31 Timestamp ~= 1 msec
not_time_stamp = (Timestamp_get32()) / 31; // 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] = INSTRUCTION.CycleNumber;
//battery volt
not_buf[18] = NotifyBatVolt;
SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
}
static void FlushNotify(){
not_buf[0] = INSTRUCTION.chip_id;
for (int i = 0; i < 4; i++) {
not_buf[i + 1] = 0;
not_buf[i + 5] = 0;
not_buf[i + 9] = 0;
}
// 1 Timestamp = 32 usec; 31 Timestamp ~= 1 msec
not_time_stamp = 0; // msec
not_buf[13] = not_time_stamp & 0xff;
not_buf[14] = (not_time_stamp >> 8) & 0xff;
not_buf[15] = (not_time_stamp >> 16) & 0xff;
not_buf[16] = (not_time_stamp >> 24) & 0xff;
// cyclic voltametry cycle number
not_buf[17] = 0x00;
//battery volt
not_buf[18] = 0x00;
SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
}
#endif
@@ -0,0 +1,22 @@
#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
@@ -0,0 +1,123 @@
#ifndef ELITERESET
#define ELITERESET
static void reset() {
InitFlag();
InitCT();
// IV/CV mode reset
DiscardIVFirstData = 0;
avg_number = 0;
ADCRealCurrent_long = 0;
ADCGainControl(INSTRUCTION.ADCGainLevel);
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
if (INSTRUCTION.eliteFxn == CONSTANT_CURRENT){
INSTRUCTION.eliteFxn = 0;
}
LEDPowerON();
for (int i = 0; i < BLE_INS_BUFF_SIZE; i++) {
ins_buf[i] = 0;
}
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(1600);
}
static void Eliteinterrupt() {
InitFlag();
InitCT();
// IV/CV mode reset
DiscardIVFirstData = 0;
avg_number = 0;
ADCRealCurrent_long = 0;
ADCGainControl(GAIN_AUTO);
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
LEDPowerON();
for (int i = 0; i < BLE_INS_BUFF_SIZE; i++) {
ins_buf[i] = 0;
}
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);
}
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
@@ -0,0 +1,22 @@
#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
@@ -0,0 +1,655 @@
/**
*
* struct WorkMode{
* // Measure Only
* ITMode;
* VTMode;
*
* // Measure + VoltOut
* RTMode;
* IVMode;
* CVMode;
*
* // Volt out only
* VOutMode
* }
*
* -------------------------------
* // Measure Only
* struct ITMode{
* MeasureData
* SetMeasureData()
* GetMeasureData()
* }
*
* -------------------------------
* // VoltOut parameter
* stuct VOutMode{
* Vout_UC
* VoltOrigin
* Vstop;
* Step;
* StepTime;
* CycleNumber;
* }
*
*/
#ifndef ELITE_WORK_DATA
#define ELITE_WORK_DATA
#include "EliteInstruction.h"
#define IV_CURVE 0b00010000
#define CV_CURVE 0b00100000
#define VOLT_OUTPUT 0b00110000
#define ZT_CURVE 0b01000000
#define VT_CURVE 0b01010000
#define IT_CURVE 0b01100000
#define SET_SAMPLE_RATE 0b01110000
#define SET_ADC_GAIN 0b10000000
#define DIFFERENTIAL_PULSE_VOLTAMMETRY 0b10100000
#define SQUARE_WAVE_VOLTAMMETRY 0b10110000
#define POTENTIAL_STATE 0b11000000
#define CONSTANT_CURRENT 0b11010000
#define READ_VOUT_VALUE 0b11100000
static bool Free_Work_Mode = false;
typedef void (*InitWorkData) ();
/***** Template of Measure and VoltOut parameter *****/
#define MEASURE \
int32_t _MeasureData; \
uint16_t _VoVi_Switch
// void (*SetMeasureData) (struct Measure *, int32_t); \
// int32_t (*GetMeasureData) (struct Measure *)
/* VoltOut is an UserCode */
/* VOrigin, VStop, Step are all UserCode */
#define VOUT_PARA \
uint16_t _VoltOut; \
uint16_t _VOrigin; \
uint16_t _VStop; \
uint16_t _Step; \
uint16_t _StepTime; \
uint16_t _CycleNumber
// void (*SetVoltOut) (struct VoltOutPara *, uint16_t); \
// uint16_t (*GetVoltOut) (struct VoltOutPara *); \
// void (*SetVOrigin) (struct VoltOutPara *, uint16_t); \
// uint16_t (*GetVOrigin) (struct VoltOutPara *); \
// void (*SetVStop) (struct VoltOutPara *, uint16_t); \
// uint16_t (*GetVStop) (struct VoltOutPara *); \
// void (*SetStep) (struct VoltOutPara *, uint16_t); \
// uint16_t (*GetStep) (struct VoltOutPara *); \
// void (*SetStepTime) (struct VoltOutPara *, uint16_t); \
// uint16_t (*GetStepTime) (struct VoltOutPara *); \
// void (*SetCycleNumber) (struct VoltOutPara *, uint16_t); \
// uint16_t (*GetCycleNumber) (struct VoltOutPara *)
/* CC Mode parameter
* @ Measure : measure current value (nA)
* @ Charge : Charge or Discharge
* @ BatteryV : Vin measure battery voltage (mV)
* @ value : constant current setting.
* Current value divide current level into 3,000,001 pieces
* 1,500,000 is zero point; 3,000,000 is 15mA
* Current = (value - 1,500,000)/100,000 mA
* @ Done : Done = false => Ignore Vmin condition;
* Done will be true, if BatteryV <= Vmin last for about 12sec in discharge mode
* @ VMax : voltage upper bound in charge mode
* CC->value will set to zero if BatteryV >= VMax in charge mode
* @ VMin : voltage lower bound in charge mode
* CC->value will set to zero if BatteryV <=> VMin in charge mode
* Note that VMax and VMin are always larger or equal to zero
* @_Transform2RealnA : transform a current user code (IUC) to real current in nA
*/
#define CC_PARA \
MEASURE; \
uint8_t Charge; \
int32_t BatteryV; \
int32_t value; \
uint16_t Done; \
uint16_t VMax; \
uint16_t VMin; \
int32_t (*_Transform2RealnA)(struct CCModePara *)
#define LIMIT \
uint32_t _LimitValue; \
void (*SetLimitValue) (struct Limit *, uint32_t); \
uint32_t (*GetLimitValue) (struct Limit*)
struct Measure{
MEASURE;
};
struct VoltOutPara{
VOUT_PARA;
};
struct Limit{
LIMIT;
};
struct CCModePara{
CC_PARA;
};
/***** End of Measure and VoltOut parameter *****/
/***** Measure Only Mode *****/
//void _SetMeasureData(struct Measure *self, int32_t Data){
// self->_MeasureData = Data;
//}
//
//int32_t _GetMeasureData(struct Measure *self){
// return self->_MeasureData;
//}
/**** Limit Mode ****/
//LimitValue
void _SetLimitValue(struct Limit *self, uint32_t LimitValue){
self->_LimitValue = LimitValue;
}
uint32_t _GetLimitValue(struct Limit *self){
return self->_LimitValue;
}
/* IT Mode Data */
typedef struct _ITMode{
MEASURE;
LIMIT;
}ITMode;
ITMode * InitITMode(){
ITMode *ret = malloc(sizeof(ITMode));
ret->_MeasureData = 0;
// ret->SetMeasureData = &_SetMeasureData;
// ret->GetMeasureData = &_GetMeasureData;
ret->_LimitValue = 0;
ret->SetLimitValue = &_SetLimitValue;
ret->GetLimitValue = &_GetLimitValue;
return ret;
}
/* End of IT Mode Data */
/* VT Mode Data */
typedef struct _VTMode{
MEASURE;
}VTMode;
VTMode * InitVTMode(){
VTMode *ret = malloc(sizeof(VTMode));
ret->_MeasureData = 0;
// ret->SetMeasureData = &_SetMeasureData;
// ret->GetMeasureData = &_GetMeasureData;
return ret;
}
/* End of VT Mode Data */
/* ReadVOut Mode Data */
typedef struct _RVoutMode{
MEASURE;
}RVoutMode;
RVoutMode * InitRVoutMode(){
RVoutMode *ret = malloc(sizeof(RVoutMode));
ret->_MeasureData = 0;
// ret->SetMeasureData = &_SetMeasureData;
// ret->GetMeasureData = &_GetMeasureData;
return ret;
}
/* End of ReadVOut Mode Data */
/***** End of Measure Only Mode *****/
/**** VoltOut Only Mode ****/
//// VoltOut
//void _SetVoltOut(struct VoltOutPara *self, uint16_t VoltOut){
// self->_VoltOut = VoltOut;
//}
//uint16_t _GetVoltOut(struct VoltOutPara *self){
// return self->_VoltOut;
//}
//
//// VOrigin
//void _SetVOrigin(struct VoltOutPara *self, uint16_t VOrigin){
// self->_VOrigin = VOrigin;
//}
//uint16_t _GetVOrigin(struct VoltOutPara *self){
// return self->_VOrigin;
//}
//
//// VStop
//void _SetVStop(struct VoltOutPara *self, uint16_t VStop){
// self->_VStop = VStop;
//}
//uint16_t _GetVStop(struct VoltOutPara *self){
// return self->_VStop;
//}
//
//// Step
//void _SetStep(struct VoltOutPara *self, uint16_t Step){
// self->_Step = Step;
//}
//uint16_t _GetStep(struct VoltOutPara *self){
// return self->_Step;
//}
//
//// StepTime
//void _SetStepTime(struct VoltOutPara *self, uint16_t StepTime){
// self->_StepTime = StepTime;
//}
//uint16_t _GetStepTime(struct VoltOutPara *self){
// return self->_StepTime;
//}
//
//// CycleNumber
//void _SetCycleNumber(struct VoltOutPara *self, uint16_t CycleNumber){
// self->_CycleNumber = CycleNumber;
//}
//uint16_t _GetCycleNumber(struct VoltOutPara *self){
// return self->_CycleNumber;
//}
/* VoltOut Mode Data */
typedef struct _VoltOutMode{
VOUT_PARA;
}VoltOutMode;
VoltOutMode *InitVoltOutMode(){
VoltOutMode *ret = malloc(sizeof(VoltOutMode));
ret->_VoltOut = INSTRUCTION.VoltConstant; // 25000 is DAC_ZERO
ret->_VOrigin = DAC_ZERO;
ret->_VStop = DAC_ZERO;
ret->_Step = 0;
ret->_StepTime = 10000; // STEPTIME_ONE_SEC
ret->_CycleNumber = 1;
// ret->SetVoltOut = &_SetVoltOut;
// ret->GetVoltOut = &_GetVoltOut;
// ret->SetVOrigin = &_SetVOrigin;
// ret->GetVOrigin = &_GetVOrigin;
// ret->SetVStop = &_SetVStop;
// ret->GetVStop = &_GetVStop;
// ret->SetStep = &_SetStep;
// ret->GetStep = &_GetStep;
// ret->SetStepTime = &_SetStepTime;
// ret->GetStepTime = &_GetStepTime;
// ret->SetCycleNumber = &_SetCycleNumber;
// ret->GetCycleNumber = &_GetCycleNumber;
return ret;
}
/* End of VoltOut Mode Data */
/**** End of VoltOut Only Mode ****/
/**** Measure + VoltOut Mode ****/
/* IV Mode Data */
typedef struct _IVMode{
MEASURE;
int32_t MeasureVolt;
VOUT_PARA;
LIMIT;
int32_t _MeasureBatvolt;
}IVMode;
IVMode *InitIVMode(){
IVMode *ret = malloc(sizeof(IVMode));
ret->_MeasureData = 0;
ret->MeasureVolt = (INSTRUCTION.VoltOrigin - DAC_ZERO)/5;
ret->_VoVi_Switch = INSTRUCTION.VoVi_Switch;
ret->_VoltOut = DAC_ZERO;
ret->_VOrigin = INSTRUCTION.VoltOrigin;
ret->_VStop = INSTRUCTION.VoltFinal;
ret->_Step = INSTRUCTION.Step;
ret->_StepTime = INSTRUCTION.StepTime;
ret->_CycleNumber = 1;
ret->_MeasureBatvolt = 0;
// ret->SetVoltOut = &_SetVoltOut;
// ret->GetVoltOut = &_GetVoltOut;
// ret->SetVOrigin = &_SetVOrigin;
// ret->GetVOrigin = &_GetVOrigin;
// ret->SetVStop = &_SetVStop;
// ret->GetVStop = &_GetVStop;
// ret->SetStep = &_SetStep;
// ret->GetStep = &_GetStep;
// ret->SetStepTime = &_SetStepTime;
// ret->GetStepTime = &_GetStepTime;
// ret->SetCycleNumber = &_SetCycleNumber;
// ret->GetCycleNumber = &_GetCycleNumber;
ret->_LimitValue = 1e5;
ret->SetLimitValue = &_SetLimitValue;
ret->GetLimitValue = &_GetLimitValue;
return ret;
}
/* End of IV Mode Data */
/* RT Mode Data */
typedef struct _RTMode{
MEASURE;
VOUT_PARA;
}RTMode;
RTMode * InitRTMode(){
RTMode *ret = malloc(sizeof(RTMode));
ret->_MeasureData = 0;
// ret->SetMeasureData = &_SetMeasureData;
// ret->GetMeasureData = &_GetMeasureData;
ret->_VoltOut = DAC_ZERO; // 25000 is DAC_ZERO
ret->_VOrigin = DAC_ZERO;
ret->_VStop = DAC_ZERO;
ret->_Step = 0;
ret->_StepTime = 10000; // STEPTIME_ONE_SEC
ret->_CycleNumber = 1;
// ret->SetVoltOut = &_SetVoltOut;
// ret->GetVoltOut = &_GetVoltOut;
// ret->SetVOrigin = &_SetVOrigin;
// ret->GetVOrigin = &_GetVOrigin;
// ret->SetVStop = &_SetVStop;
// ret->GetVStop = &_GetVStop;
// ret->SetStep = &_SetStep;
// ret->GetStep = &_GetStep;
// ret->SetStepTime = &_SetStepTime;
// ret->GetStepTime = &_GetStepTime;
// ret->SetCycleNumber = &_SetCycleNumber;
// ret->GetCycleNumber = &_GetCycleNumber;
return ret;
}
/* End of RT Mode Data */
/* CV Mode*/
typedef struct _CVMode{
MEASURE;
int32_t MeasureVolt;
VOUT_PARA;
int32_t _MeasureBatvolt;
}CVMode;
CVMode * InitCVMode(){
CVMode *ret = malloc(sizeof(CVMode));
ret->_MeasureData = (INSTRUCTION.VoltOrigin- DAC_ZERO)/5;
// ret->SetMeasureData = &_SetMeasureData;
// ret->GetMeasureData = &_GetMeasureData;
ret->MeasureVolt = 20000;
ret->_VoltOut = DAC_ZERO; // 25000 is DAC_ZERO
ret->_VOrigin = INSTRUCTION.VoltOrigin;
ret->_VStop = INSTRUCTION.VoltFinal;
ret->_Step = INSTRUCTION.Step;
ret->_StepTime = INSTRUCTION.StepTime; // STEPTIME_ONE_SEC
ret->_CycleNumber = INSTRUCTION.CycleNumber;
ret->_VoVi_Switch = INSTRUCTION.VoVi_Switch;
ret->_MeasureBatvolt = 0;
// ret->SetVoltOut = &_SetVoltOut;
// ret->GetVoltOut = &_GetVoltOut;
// ret->SetVOrigin = &_SetVOrigin;
// ret->GetVOrigin = &_GetVOrigin;
// ret->SetVStop = &_SetVStop;
// ret->GetVStop = &_GetVStop;
// ret->SetStep = &_SetStep;
// ret->GetStep = &_GetStep;
// ret->SetStepTime = &_SetStepTime;
// ret->GetStepTime = &_GetStepTime;
// ret->SetCycleNumber = &_SetCycleNumber;
// ret->GetCycleNumber = &_GetCycleNumber;
return ret;
}
/*End of CV Mode*/
/* Const Current Mode */
#define CC_ZERO_POINT 0
#define MAX_DAC_UC 50000
#define MIN_DAC_UC 0
/*********************************************************************
* @struct Constant Current Code
*
* @brief A struct to handle CC mode command
*/
typedef struct _CCMode{
CC_PARA;
}CCMode;
/*********************************************************************
* @fn Transform2RealnA
*
* @brief transform an IUC into real current value in nA.
*
* @param self, which is an IUC
*
* @return an int32_t current value in nA
*/
int32_t _Transform2RealnA(struct CCModePara *self){
int32_t IUCReal;
// self->value : 0 ~ 1500000 (which is 0 ~ 1500000 (10nA) )
if(self->Charge){
IUCReal = (self->value - CC_ZERO_POINT) * 10;
}
else{
IUCReal = -1 * (self->value - CC_ZERO_POINT) * 10;
}
return IUCReal;
}
CCMode * InitCCMode(){
CCMode *ret = malloc(sizeof(CCMode));
ret->_MeasureData = 0;
ret->Charge = INSTRUCTION.Charge;
ret->BatteryV = 0;
ret->Done = 0;
ret->value = INSTRUCTION.ConstantCurrent;
ret->VMax = INSTRUCTION.VoltLimit + DAC_ZERO;
ret->VMin = INSTRUCTION.VoltLimit + DAC_ZERO;
ret->_Transform2RealnA = &_Transform2RealnA;
return ret;
}
/*End of Const Current Mode Mode*/
/* Cycle CC Mode */
typedef struct _CCCMode{
CC_PARA;
/* Vmax and Vmin */
// Vmax protect battery charge
// Vmin protect battery discharge, uint = mV
/* Charge/Discharge Current */
int32_t ChargeCurrent;
int32_t DischargeCurrent;
uint8_t CycleNumber;
bool StandBy;
uint32_t StandByTime;
}CCCMode;
CCCMode * InitCCCMode(){
CCCMode *ret = malloc(sizeof(CCCMode));
ret->_MeasureData = 0;
ret->Charge = 1;
ret->BatteryV = 0;
ret->value = CC_ZERO_POINT;
ret->VMax = MAX_DAC_UC; // max DAC UserCode
ret->VMin = MIN_DAC_UC; // min DAC UserCode
ret->ChargeCurrent = 0;
ret->DischargeCurrent = 0;
ret->CycleNumber = 0;
ret->StandBy = false;
ret->StandByTime = 0;
ret->_Transform2RealnA = &_Transform2RealnA;
return ret;
}
/* End of Cycle CC Mode */
/** Potential State Mode **/
typedef struct _PS{
// measure
MEASURE; // circuit current
int32_t ReferenceVolt;
int32_t _MeasureVolt;
VOUT_PARA;
}PSMode;
PSMode *InitPSMode(){
PSMode *ret = malloc(sizeof(PSMode));
ret->_MeasureData = 0;
// ret->SetMeasureData = &_SetMeasureData;
// ret->GetMeasureData = &_GetMeasureData;
ret->ReferenceVolt = 0;
ret->_MeasureVolt = INSTRUCTION.VoltOrigin;
ret->_VoltOut = DAC_ZERO; // 25000 is DAC_ZERO
ret->_VOrigin = INSTRUCTION.VoltOrigin;
ret->_VStop = INSTRUCTION.VoltFinal;
ret->_Step = INSTRUCTION.Step;
ret->_StepTime = INSTRUCTION.StepTime; // STEPTIME_ONE_SEC
ret->_CycleNumber = INSTRUCTION.CycleNumber;
return ret;
}
/** End of Potential State Mode **/
typedef union _WorkMode{
// Measure only
ITMode *IT;
VTMode *VT;
// Output Only
VoltOutMode *VO;
// Measure + Output
IVMode *IV;
CVMode *CV;
RTMode *RT;
CCMode *CC;
// CCCMode *CCC;
PSMode *PS;
//test mode
RVoutMode *RVout;
}WorkMode;
WorkMode *CreateWorkMode(){
WorkMode *ret = malloc(sizeof(WorkMode));
return ret;
}
void InitWorkMode(WorkMode *WM){
switch(INSTRUCTION.eliteFxn){
case IV_CURVE:
WM->IV = InitIVMode();
break;
case CV_CURVE:
WM->CV = InitCVMode();
break;
case VOLT_OUTPUT:
WM->VO = InitVoltOutMode();
break;
case ZT_CURVE:
WM->RT = InitRTMode();
break;
case VT_CURVE:
WM->VT = InitVTMode();
break;
case IT_CURVE:
WM->IT = InitITMode();
break;
case CONSTANT_CURRENT:
WM->CC = InitCCMode();
break;
// case CYCLE_CONSTANT_CURRENT:
// WM->CCC = InitCCCMode();
// break;
case READ_VOUT_VALUE:
WM->RVout = InitRVoutMode();
break;
default:
WM->VT = InitVTMode();
break;
}
}
void FreeWorkMode(WorkMode *WM){
switch(INSTRUCTION.eliteFxn){
case IV_CURVE:
if(WM->IV != NULL){
free(WM->IV);
WM->IV = NULL;
}
break;
case CV_CURVE:
if(WM->CV != NULL){
free(WM->CV);
WM->CV = NULL;
}
break;
case VOLT_OUTPUT:
if(WM->VO != NULL){
free(WM->VO);
WM->VO = NULL;
}
break;
case ZT_CURVE:
if(WM->RT != NULL){
free(WM->RT);
WM->RT = NULL;
}
break;
case VT_CURVE:
if(WM->VT != NULL){
free(WM->VT);
WM->VT = NULL;
}
break;
case IT_CURVE:
if(WM->IT != NULL){
free(WM->IT);
WM->IT = NULL;
}
break;
case CONSTANT_CURRENT:
if(WM->CC != NULL){
free(WM->CC);
WM->CC = NULL;
}
break;
case READ_VOUT_VALUE:
if(WM->RVout != NULL){
free(WM->RVout);
WM->RVout = NULL;
}
break;
// case CYCLE_CONSTANT_CURRENT:
// if(WM->CCC != NULL){
// free(WM->CCC);
// WM->CCC = NULL;
// }
// break;
default:
if(WM->IV != NULL){
free(WM->IV);
WM->IV = NULL;
}
break;
}
// free(WM);
}
#endif
@@ -0,0 +1,109 @@
#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
@@ -20,7 +20,7 @@
#define ADC_CS IOID_8
#define DAC_CS IOID_9
#define Turnon100R IOID_5
#define Turnon200R IOID_5
#define Turnon10K IOID_6
/* I2C */
@@ -45,7 +45,7 @@ const PIN_Config BLE_IO[] = {
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
Turnon100R | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
Turnon200R | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
Turnon10K | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
switch_on | PIN_INPUT_EN | PIN_PULLDOWN,
@@ -59,7 +59,7 @@ VIS_FUH = 0b1001_0000 # 9x flush
VIS_INT = 0b0110_0000 # 6x interrupt
VIS_SHIFT_200K = 0b1010_0000 # Ax shift gear to 200K
VIS_SHIFT_10K = 0b1110_0000 # Ex shift gear to 10K
VIS_SHIFT_100R = 0b1000_0000 # 8x shift gear to 100R
VIS_SHIFT_200R = 0b1000_0000 # 8x shift gear to 100R
=========================
@@ -190,14 +190,14 @@ MUX
PGA
programmable gain amplifier configuration
(Full Scale Range = FSR)
000 = FSR is 6.144 V
001 = FSR is 4.096 V
010 = FSR is 2.048 V (default)
011 = FSR is 1.024 V
100 = FSR is 0.512 V
101 = FSR is 0.256 V
110 = FSR is 0.256 V
111 = FSR is 0.256 V
000 = FSR is 6.144 V
001 = FSR is 4.096 V
010 = FSR is 2.048 V (default)
011 = FSR is 1.024 V
100 = FSR is 0.512 V
101 = FSR is 0.256 V
110 = FSR is 0.256 V
111 = FSR is 0.256 V
M
ADC operating mode
@@ -375,10 +375,11 @@ characteristic change event
// product information
#define DEVICE_NAME "Elite-ZM-v1.4-re"
#define MAJOR_PRODUCT_NUMBER 0
#define MINOR_PRODUCT_NUMBER 2
#define MAJOR_VERSION_NUMBER 1
#define MINOR_VERSION_NUMBER 2
#define MAJOR_PRODUCT_NUMBER 0 //0:Elite ,1:Neulive
#define MINOR_PRODUCT_NUMBER 2 //1:Elite_legacy(Ori_Neulive) 2:Elite_zm 3:Elite_bat
#define MAJOR_VERSION_NUMBER 1 //1
#define MINOR_VERSION_NUMBER 2 //2 (1.2:support 1.2~1.4-re)
//0310 //bat1.0
#define ELITE_VERSION_1_4
//#define ELITE_VERSION_1_3
@@ -402,21 +403,12 @@ characteristic change event
#endif // ICALL_EVENTS
#include <ti/sysbios/hal/Hwi.h>
#include <ti/sysbios/knl/Queue.h>
#include "EliteADC.h"
#include "EliteDAC.h"
#include "EliteSPI.h"
#include "Elite_PIN.h"
#define DARKLED 0xE1
#define LIGHTLED 0xE8
static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue);
#define LEDPowerON() LED_color(DARKLED, 0x00, 0xFA, 0x00)
#ifdef ELITE_VERSION_1_4
#include "EliteI2C.h"
#endif
#ifdef USE_ICALL
#include <icall.h>
#else
@@ -426,11 +418,11 @@ static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue);
// Internal Events for RTOS application
#ifndef RTOSPARA
#define RTOSPARA
#define SBP_STATE_CHANGE_EVT 0x0001
#define SBP_CHAR_CHANGE_EVT 0x0002
#define SBP_PERIODIC_EVT 0x0004
#define SBP_CONN_EVT_END_EVT 0x0008
#define SBP_KEY_CHANGE_EVT 0x0010
#define SBP_STATE_CHANGE_EVT 0x0001
#define SBP_CHAR_CHANGE_EVT 0x0002
#define SBP_PERIODIC_EVT 0x0004
#define SBP_CONN_EVT_END_EVT 0x0008
#define SBP_KEY_CHANGE_EVT 0x0010
#endif
static Clock_Struct periodicClock;
@@ -440,6 +432,7 @@ static Clock_Struct periodicClock;
#include "simple_gatt_profile.h"
static bool PeriodicEvent = false;
static bool InitPeriodicEvent = true;
static ICall_Semaphore semaphore;
static uint16_t events;
@@ -500,60 +493,7 @@ static uint8 channel_table[CHANNEL_COUNT] = {0};
*/
static int8 channel_pointer = -1;
static uint8_t not_buf[BLE_DAT_BUFF_SIZE] = {0};
/*==============================
==== headstage instruction ====
=============================*/
struct HEADSTAGE_INSTRUCTION {
/** chip ID */
uint8_t chip_id;
/** RATE. ADC clock/sampling rate value*/
uint32_t adc_clock_rate;
/** CS **/
uint8_t chip_select;
// ADC
/** SS **/
uint8_t single_short;
/** MUX **/
uint8_t multi_config;
/** PGA **/
uint8_t gain_amp_config;
/** M **/
uint8_t operating_mode;
/** DR **/
uint8_t adc_data_rate;
uint8_t temp_sensor;
uint8_t pullup_R_enable;
uint8_t no_operation;
uint8_t reserved;
// LED
uint8_t global;
uint8_t blue;
uint8_t green;
uint8_t red;
// elite function
uint8_t eliteFxn;
uint8_t CycleNumber;
} INSTRUCTION = {0};
static uint8_t cis_buf[BLE_CIS_BUFF_SIZE] = {0};
/*=====================================
==== headstage function prototype ====
@@ -598,9 +538,11 @@ static void ADC_test_read(uint8_t *ADCdata); // for auto shifting
static void ADCGainControl(uint8_t ADCLevel);
static void ADCChannelSelect(uint8_t ADCChannel);
static int32_t DecodeADCVolt(uint16_t ADC_measure);
static int32_t DecodeADCVoutVolt(uint16_t ADC_measure);
static int32_t DecodeADCCurrent(uint8_t ADCGain, uint16_t ADC_measure);
static void Impedance_Calculate(uint16_t Voltage, int32_t Current);
static int32_t DecodeADCValue(uint8_t ADCGain, uint8_t ADCChannel, uint8_t *ADC_raw);
static void ADC_overflow(uint8_t gain, uint8_t *rawdata);
static void ADC_overflow(uint8_t gain, uint8_t *rawdata);
// DAC function
static uint16_t Usercode_Correction_to_DAC(uint16_t usercode);
@@ -637,50 +579,50 @@ static void set_update_instruction_callback(update_instruction_callback_type cal
#define VIS_INT 0b01100000
#define VIS_SHIFT_200K 0b10100000
#define VIS_SHIFT_10K 0b11100000
#define VIS_SHIFT_100R 0b10000000
#define VIS_SHIFT_200R 0b10000000
#define VIS_DEVICE_SHINY 0b00010000
#define VIS_SHINY_DIS 0b00100000
// real instruction
#define IVCurve 0b00010000
#define CyclicVoltammetry 0b00100000
#define fxnGen 0b00110000
#define ZTCurve 0b01000000
#define VTCurve 0b01010000
#define ITCurve 0b01100000
#define SetSampleRate 0b01110000
#define SetADCGain 0b10000000
#define DifferentialPulseVoltammetry 0b10100000
#define SquareWaveVoltammetry 0b10110000
#define PotentialState 0b11000000
#define IV_CURVE 0b00010000
#define CV_CURVE 0b00100000
#define VOLT_OUTPUT 0b00110000
#define ZT_CURVE 0b01000000
#define VT_CURVE 0b01010000
#define IT_CURVE 0b01100000
#define SET_SAMPLE_RATE 0b01110000
#define SET_ADC_GAIN 0b10000000
#define DIFFERENTIAL_PULSE_VOLTAMMETRY 0b10100000
#define SQUARE_WAVE_VOLTAMMETRY 0b10110000
#define POTENTIAL_STATE 0b11000000
#define CONSTANT_CURRENT 0b11010000
#define READ_VOUT_VALUE 0b11100000
#define CYCLE_CONSTANT_CURRENT 0b11110000
// CIS instruction
#define CIS_VERSION 0x40
// test instruction
#define ADCTEST 0b10010000
#define ADC_TEST 0b10010000
// DAC and ADC function
static void DAC_outputV(uint16_t voltLV);
static uint16_t DAC_outputV(uint16_t voltLV);
static int32_t DAC_to_realV(uint16_t DACcode);
// input parameter
static uint16_t VoltOrigin = DACzero;
static uint16_t VoltFinal = DACposMax;
static uint16_t Step = 0x009E; // 10 => 0xA0 ~= 30.5 mv
static uint16_t DACUserCode = 0x0000;
static uint16_t SampleRateTable[6] = {1, 10, 100, 500, 1000, 10000}; // 1 =>100 Hz, 10000=>0.01 Hz
static uint16_t SampleRate = 1;
static uint16_t SampleRate_counter = 1;
static uint32_t SampleRateTable[6] = {100, 1000, 10000, 50000, 100000, 1000000}; // 100 =>100 Hz, 1000000=>0.01 Hz
// record value for IV curve to calculate average current
static int16_t avg_number = 1;
static int32_t ADCRealCurrent = 0;
static int32_t ADCRealCurrent_avg = 0;
static uint8_t DiscardIVFirstData = 1;
static uint16_t avg_number = 0;
static long long ADCRealCurrent_long = 0;
#define GAIN_200K 0x00
#define GAIN_10K 0x01
#define GAIN_200R 0x02
#define GAIN_AUTO 0x03
static uint8_t ADCGainLevel = GAIN_200K;
// Constant Current Mode function
static uint8_t CCModeDACEnable = 0;
static int32_t CCModeReadCurrent();
static int32_t CCModeVoltOut();
static void CCCurrent2IUC();
// for DPVCurve SWVCurve
static uint16_t Amplitude;
@@ -689,32 +631,42 @@ static uint16_t PulseWidth_16;
static uint8_t PulsePeriod;
static uint16_t PulsePeriod_16;
static uint8_t StepTime = 20; // 0x30 = 2'd48 ~= 2 second, 24 = 0x18 = 1 sec
static uint16_t StepTime_16 = 0;
static uint8_t StepTimeCounter = 1;
// counter
struct _CT{
uint32_t SampleRate_counter;
uint16_t StepTimeCounter;
uint16_t NotifyCounter;
uint32_t StandByCounter;
}CT = {0};
//static bool NotifyReady = false;
static void InitFlag();
static void InitCT();
#include "EliteWorkData.h"
// real instruction fxn
static uint16_t VoltScan(); // used in I-V and cyclic
static void Notify_IV(uint16_t Voltage); // send notify voltage after VoltScan()
static uint16_t VoltScan(WorkMode *WorkModeData); // used in I-V and cyclic
static void DACCode2Real2Notify(uint16_t DACcode); // send notify voltage after VoltScan()
static void fxn_Gen();
static void ZT_plot(uint16_t outV, uint16_t inV);
static void VT_Plot();
static int32_t IT_Plot();
//static void VOLT_OUTPUT();
static void ZT_Plot(RTMode *RT);
static void VT_Plot(VTMode *VT);
static int32_t IT_PlotIT_Plot(WorkMode *WorkModeData);
static void RVout_Plot(RVoutMode *RVout);
// the following fxn do the same thing
// IVCurve_T is called if Vorigin > Vfinal, vice versa
static uint16_t OldDAC2UserCode(uint16_t OldDAC);
static uint16_t StepCode2DACcode(uint16_t StepCode);
static uint8_t OldStep2NewStep(uint8_t OldStep);
static uint8_t OldStep2NewStepTime(uint8_t StepTime);
static uint16_t OldStep2NewStepTime(uint8_t StepTime);
static uint8_t IVdone = 0;
static uint16_t IVCurve_T();
static uint16_t IVCurve_T2();
static uint16_t OneWayVoltScan(IVMode *IV);
static void ramp_test();
static uint16_t DPVCurve();
static uint16_t CVCurve();
static uint16_t SWVCurve();
static uint16_t DPVCurve(WorkMode *WorkModeData);
static uint16_t CVCurve(CVMode *CV);
static uint16_t SWVCurve(WorkMode *WorkModeData);
static void reset();
static void Eliteinterrupt();
@@ -725,6 +677,34 @@ static void SendNotify();
static bool If10Von = false;
static void TurnOn10V();
#include "EliteInstruction.h"
#include "EliteADC.h"
#include "EliteDAC.h"
#include "EliteSPI.h"
#include "Elite_PIN.h"
#ifdef ELITE_VERSION_1_4
#include "EliteI2C.h"
#endif
#include "EliteDeviceCorrection.h"
#include "EliteNotify.h"
#include "EliteFlagCTInit.h"
#include "EliteReset.h"
#include "EliteLED.h"
#include "EliteKeyDetect.h"
#include "EliteCCMode.h"
#include "EliteIVCurve.h"
#include "EliteCVCurve.h"
#include "EliteITCurve.h"
#include "EliteVTCurve.h"
#include "EliteZTCurve.h"
#include "EliteCCCMode.h"
#include "impedance_meter.h"
#include "EliteReadVout.h"
#include "headstage_version.h"
// update instruction for Z meter
static void update_ZM_instruction(uint8 *ins) {
uint8_t ins_type = ins[0] & 0b11110000;
@@ -732,9 +712,7 @@ static void update_ZM_instruction(uint8 *ins) {
INSTRUCTION.chip_id = chip_ID;
uint8_t oper = ins[1] & 0xF0; // this is don't care in RIS
uint8_t data_length = ins[1] & 0x0F;
DACreset = true;
// uint8_t data_length = ins[1] & 0x0F;
if (!If10Von) {
// TurnOn10V();
@@ -744,52 +722,59 @@ static void update_ZM_instruction(uint8 *ins) {
/*** These are real instruction ***/
case INS_TYPE_RIS: {
switch (ins[2]) {
case IVCurve: {
CleanBuffer();
INSTRUCTION.eliteFxn = IVCurve;
DACreset = true;
case IV_CURVE: {
// CleanBuffer();
INSTRUCTION.eliteFxn = IV_CURVE;
DACReset = true;
INSTRUCTION.SampleRate = 100;
if (ins[3] | ins[4]) {
VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
VoltOrigin = Usercode_Correction_to_DAC(VoltOrigin);
}
if (ins[5] | ins[6]) {
VoltFinal = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
VoltFinal = Usercode_Correction_to_DAC(VoltFinal);
}
// if (ins[3] | ins[4]) {
INSTRUCTION.VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
// INSTRUCTION.VoltOrigin = Usercode_Correction_to_DAC(INSTRUCTION.VoltOrigin);
// }
// if (ins[5] | ins[6]) {
INSTRUCTION.VoltFinal = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
// INSTRUCTION.VoltFinal = Usercode_Correction_to_DAC(INSTRUCTION.VoltFinal);
// }
if (ins[7] | ins[8]) {
Step = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
Step = Usercode_Correction_to_DAC(Step);
}
if (ins[9]) {
StepTime = ins[9];
StepTime = OldStep2NewStepTime(StepTime);
INSTRUCTION.Step = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
// NotifyImpedance[2] = (uint8_t)((INSTRUCTION.Step & 0xFF00)>>8);
// NotifyImpedance[3] = (uint8_t)(INSTRUCTION.Step & 0x00FF);
INSTRUCTION.Step = StepCode2DACcode(INSTRUCTION.Step);
}
// if (ins[9]) {
INSTRUCTION.StepTime = ins[9];
INSTRUCTION.StepTime = OldStep2NewStepTime(INSTRUCTION.StepTime);
// }
// if(ins[10]) {
//INSTRUCTION.VoVi_Switch = ins[10];
INSTRUCTION.VoVi_Switch = 0x01;
// }
break;
}
case DifferentialPulseVoltammetry: {
CleanBuffer();
INSTRUCTION.eliteFxn = DifferentialPulseVoltammetry;
DACreset = true;
case DIFFERENTIAL_PULSE_VOLTAMMETRY: {
// CleanBuffer();
INSTRUCTION.eliteFxn = DIFFERENTIAL_PULSE_VOLTAMMETRY;
DACReset = true;
if (ins[3] | ins[4]) {
VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
VoltOrigin = Usercode_Correction_to_DAC(VoltOrigin);
INSTRUCTION.VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
INSTRUCTION.VoltOrigin = Usercode_Correction_to_DAC(INSTRUCTION.VoltOrigin);
}
if (ins[5] | ins[6]) {
VoltFinal = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
VoltFinal = Usercode_Correction_to_DAC(VoltFinal);
INSTRUCTION.VoltFinal = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
INSTRUCTION.VoltFinal = Usercode_Correction_to_DAC(INSTRUCTION.VoltFinal);
}
if (ins[7] | ins[8]) {
Step = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
Step = Usercode_Correction_to_DAC(Step);
INSTRUCTION.Step = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
INSTRUCTION.Step = StepCode2DACcode(INSTRUCTION.Step);
}
if (ins[9]) {
StepTime = ins[9];
StepTime = OldStep2NewStepTime(StepTime);
INSTRUCTION.StepTime = ins[9];
INSTRUCTION.StepTime = OldStep2NewStepTime(INSTRUCTION.StepTime);
}
if (ins[10] | ins[11]) {
Amplitude = ((uint16_t)(ins[10]) << 8) | (uint16_t)(ins[11]);
@@ -801,29 +786,32 @@ static void update_ZM_instruction(uint8 *ins) {
if (ins[13]) {
PulseWidth = ins[13];
}
if(ins[14]) {
INSTRUCTION.VoVi_Switch = ins[14];
}
break;
}
case SquareWaveVoltammetry: {
CleanBuffer();
INSTRUCTION.eliteFxn = SquareWaveVoltammetry;
DACreset = true;
case SQUARE_WAVE_VOLTAMMETRY: {
// CleanBuffer();
INSTRUCTION.eliteFxn = SQUARE_WAVE_VOLTAMMETRY;
DACReset = true;
if (ins[3] | ins[4]) {
VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
VoltOrigin = Usercode_Correction_to_DAC(VoltOrigin);
INSTRUCTION.VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
INSTRUCTION.VoltOrigin = Usercode_Correction_to_DAC(INSTRUCTION.VoltOrigin);
}
if (ins[5] | ins[6]) {
VoltFinal = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
VoltFinal = Usercode_Correction_to_DAC(VoltFinal);
INSTRUCTION.VoltFinal = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
INSTRUCTION.VoltFinal = Usercode_Correction_to_DAC(INSTRUCTION.VoltFinal);
}
if (ins[7] | ins[8]) {
Step = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
Step = Usercode_Correction_to_DAC(Step);
INSTRUCTION.Step = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
INSTRUCTION.Step = StepCode2DACcode(INSTRUCTION.Step);
}
if (ins[9]) {
StepTime = ins[9];
StepTime = OldStep2NewStepTime(StepTime);
INSTRUCTION.StepTime = ins[9];
INSTRUCTION.StepTime = OldStep2NewStepTime(INSTRUCTION.StepTime);
}
if (ins[10] | ins[11]) {
Amplitude = ((uint16_t)(ins[10]) << 8) | (uint16_t)(ins[11]);
@@ -832,116 +820,169 @@ static void update_ZM_instruction(uint8 *ins) {
if (ins[12]) {
PulseWidth = ins[12];
}
if ( ins[13]) {
INSTRUCTION.VoVi_Switch = ins[13];
}
break;
}
case CyclicVoltammetry: {
CleanBuffer();
INSTRUCTION.eliteFxn = CyclicVoltammetry;
DACreset = true;
case CV_CURVE: {
// CleanBuffer();
INSTRUCTION.eliteFxn = CV_CURVE;
DACReset = true;
INSTRUCTION.SampleRate = 100;
if (ins[3] | ins[4]) {
VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
VoltOrigin = Usercode_Correction_to_DAC(VoltOrigin);
}
if (ins[5] | ins[6]) {
VoltFinal = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
VoltFinal = Usercode_Correction_to_DAC(VoltFinal);
}
// if (ins[3] | ins[4]) {
INSTRUCTION.VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
// INSTRUCTION.VoltOrigin = Usercode_Correction_to_DAC(INSTRUCTION.VoltOrigin);
// }
// if (ins[5] | ins[6]) {
INSTRUCTION.VoltFinal = ((uint16_t)(ins[5]) << 8) | (uint16_t)(ins[6]);
// INSTRUCTION.VoltFinal = Usercode_Correction_to_DAC(INSTRUCTION.VoltFinal);
// }
if (ins[7] | ins[8]) {
Step = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
Step = Usercode_Correction_to_DAC(Step);
}
if (ins[9]) {
StepTime = ins[9];
StepTime = OldStep2NewStepTime(StepTime);
INSTRUCTION.Step = ((uint16_t)(ins[7]) << 8) | (uint16_t)(ins[8]);
INSTRUCTION.Step = StepCode2DACcode(INSTRUCTION.Step);
}
// if (ins[9]) {
INSTRUCTION.StepTime = ins[9];
INSTRUCTION.StepTime = OldStep2NewStepTime(INSTRUCTION.StepTime);
// }
if (ins[10]) {
INSTRUCTION.CycleNumber = ins[10];
}
// if(ins[11]) {
//INSTRUCTION.VoVi_Switch = ins[11];
INSTRUCTION.VoVi_Switch = 0x01;
// }
break;
}
case fxnGen: {
INSTRUCTION.eliteFxn = fxnGen;
uint16_t volt = 0;
int32_t RealV = 0;
volt = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
// DAC_outputV(DACOUT, volt); //delete 'command' parameter
volt = Usercode_Correction_to_DAC(volt);
DAC_outputV(volt);
// RealV = DAC_to_realV(volt);
case VOLT_OUTPUT: {
INSTRUCTION.eliteFxn = VOLT_OUTPUT;
INSTRUCTION.VoltConstant = ( ((uint16_t)(ins[3])) << 8) | (uint16_t)(ins[4]);
break;
}
// impedance test
case ZTCurve: {
CleanBuffer();
INSTRUCTION.eliteFxn = ZTCurve;
case ZT_CURVE: {
// CleanBuffer();
INSTRUCTION.eliteFxn = ZT_CURVE;
// INSTRUCTION.VoltConstant = ( ((uint16_t)(ins[3])) << 8) | (uint16_t)(ins[4]);
break;
}
case VTCurve: {
CleanBuffer();
INSTRUCTION.eliteFxn = VTCurve;
StepTime = 0x01;
case VT_CURVE: {
// CleanBuffer();
INSTRUCTION.eliteFxn = VT_CURVE;
// SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
// VT_Plot(); // enable 10v = 0
break;
}
case ITCurve: {
CleanBuffer();
INSTRUCTION.eliteFxn = ITCurve;
StepTime = 0x01;
// IT_Plot(); // enable 10v = 1
case IT_CURVE: {
// CleanBuffer();
INSTRUCTION.eliteFxn = IT_CURVE;
// IT_Plot(); // enable 10v = 1
break;
}
case SetSampleRate: {
uint8_t index = 0;
index = ins[3];
SampleRate = SampleRateTable[index];
SampleRate_counter = 1;
case SET_SAMPLE_RATE: {
INSTRUCTION.SampleRateIndex = ins[3];
INSTRUCTION.SampleRate = SampleRateTable[INSTRUCTION.SampleRateIndex];
CT.SampleRate_counter = 1;
break;
}
case PotentialState: {
INSTRUCTION.eliteFxn = PotentialState;
case POTENTIAL_STATE: {
INSTRUCTION.eliteFxn = POTENTIAL_STATE;
// test
not_buf[0] = ins[3];
not_buf[1] = ins[4];
not_buf[2] = ins[5];
not_buf[3] = ins[6];
// SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
// SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
break;
}
case SetADCGain: {
ADCGainLevel = ins[3];
case CONSTANT_CURRENT:{
INSTRUCTION.eliteFxn = CONSTANT_CURRENT;
INSTRUCTION.SampleRate = 2;
INSTRUCTION.Charge = ins[3];
INSTRUCTION.VoltLimit = ((uint16_t) ins[4] << 8) | ((uint16_t) ins[5]);
INSTRUCTION.ConstantCurrent = ( (uint32_t) (ins[6])<<24 | (uint32_t) (ins[7])<<16 | (uint32_t) (ins[8])<<8 | (uint32_t) (ins[9]) );
INSTRUCTION.NotifyRate = 1000;
// if(!INSTRUCTION.Charge){
// INSTRUCTION.VoltConstant = 50000;
// }
// GetInstructionParameter(ins+2);
// CCCurrent2IUC();
break;
}
case ADCTEST: {
INSTRUCTION.eliteFxn = ADCTEST;
case CYCLE_CONSTANT_CURRENT:{
break;
}
case SET_ADC_GAIN: {
INSTRUCTION.ADCGainLevel = ins[3];
if(INSTRUCTION.ADCGainLevel != GAIN_AUTO){
INSTRUCTION.AutoGainEnable = 0;
}
else{
INSTRUCTION.AutoGainEnable = 1;
}
// if(INSTRUCTION.ADCGainLevel == GAIN_200R){
// LED_color(DARKLED, 0x0F, 0x00, 0x00);
// }
// else if(INSTRUCTION.ADCGainLevel == GAIN_10K){
// LED_color(DARKLED, 0x0F, 0x00, 0x0F);
// }
// else if(INSTRUCTION.ADCGainLevel == GAIN_200K){
// LED_color(DARKLED, 0x0F, 0x02, 0xFF);
// }
break;
}
case READ_VOUT_VALUE:{
// INSTRUCTION.ResisterMeter = ins[3];
INSTRUCTION.eliteFxn = READ_VOUT_VALUE;
/*uint8_t ReadVoutBuf[2] = {0};
ADC_write(0xA4);
ADC_read(ReadVoutBuf);
SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, 2, ReadVoutBuf);*/
break;
}
case ADC_TEST: {
INSTRUCTION.eliteFxn = ADC_TEST;
int32_t ADCRealValue = 0;
uint8_t CIS_buf[9] = {0};
ADCGainControl(ins[3]);
ADCChannelSelect(ins[4]);
CPUdelay(1600);
ADC_read(spi_ADC_rxbuf);
// for(int i=0 ; i<10 ; i++){
ADCGainControl(ins[3]);
ADCChannelSelect(ins[4]);
CPUdelay(10);
ADC_read(spi_ADC_rxbuf);
// CPUdelay(10);
//
// ADCValueTemp = ( uint16_t) (spi_ADC_rxbuf[0]) << 8 | (uint16_t) (spi_ADC_rxbuf[1]);
// ADCValueAVG = ADCValueAVG + ADCValueTemp;
// }
// ADCValueAVG = ADCValueAVG / 10;
// ADCValueTemp = (uint16_t) (ADCValueAVG);
CIS_buf[0] = chip_ID;
for (int i = 0; i < 4; i++) {
CIS_buf[i + 1] = spi_ADC_rxbuf[i];
for(int i=0; i<4 ; i++){
CIS_buf[i+1] = spi_ADC_rxbuf[i];
}
// CIS_buf[1] = (uint8_t) ((ADCValueTemp & 0xFF00) >> 8);
// CIS_buf[2] = (uint8_t) (ADCValueTemp & 0x00FF);
// CIS_buf[3] = spi_ADC_rxbuf[2];
// CIS_buf[4] = spi_ADC_rxbuf[3];
// decode ADC measure value
ADCRealValue = DecodeADCValue(ins[3], ins[4], spi_ADC_rxbuf);
@@ -1002,6 +1043,9 @@ static void update_ZM_instruction(uint8 *ins) {
}
case VIS_STI: {
for(int i=0 ; i<12 ; i++){
FlushNotify();
}
PeriodicEvent = true;
break;
}
@@ -1013,30 +1057,58 @@ static void update_ZM_instruction(uint8 *ins) {
case VIS_INT: {
Eliteinterrupt();
for(int i=0 ; i<12 ; i++){
FlushNotify();
}
break;
}
case VIS_SHIFT_200K: {
PIN_setOutputValue(pin_handle, Turnon10K, 0);
PIN_setOutputValue(pin_handle, Turnon100R, 0);
PIN_setOutputValue(pin_handle, Turnon200R, 0);
LED_color(DARKLED, 0xFF, 0xB4, 0x00);
break;
}
case VIS_SHIFT_10K: {
PIN_setOutputValue(pin_handle, Turnon10K, 1);
PIN_setOutputValue(pin_handle, Turnon100R, 0);
PIN_setOutputValue(pin_handle, Turnon200R, 0);
LED_color(DARKLED, 0x14, 0xC8, 0xFF);
break;
}
case VIS_SHIFT_100R: {
case VIS_SHIFT_200R: {
PIN_setOutputValue(pin_handle, Turnon10K, 0);
PIN_setOutputValue(pin_handle, Turnon100R, 1);
PIN_setOutputValue(pin_handle, Turnon200R, 1);
LED_color(DARKLED, 0xFF, 0xFF, 0xFF);
break;
}
case VIS_DEVICE_SHINY:{
LED_color(DARKLED, 0xFF, 0x00, 0xFF);
// uint8_t deviceShinySwitch = (ins[2] & 0b11110000) >> 4;//1:open 0:close
// if(deviceShinySwitch == 1){
// LED_color(DARKLED, 0xFF, 0x00, 0xFF);
// }else if(deviceShinySwitch == 0){
// if(PeriodicEvent){
// WORKLED();
// }else if(!PeriodicEvent){
// LEDPowerON();
// }
// }
break;
}
case VIS_SHINY_DIS:{
if(PeriodicEvent){
WORKLED();
}else if(!PeriodicEvent){
LEDPowerON();
}
break;
}
default: {
break;
}
@@ -1050,6 +1122,19 @@ static void update_ZM_instruction(uint8 *ins) {
I2CWrite(0x01, 0xAB);
break;
}
case CIS_VERSION:{
cis_buf[0] = VERSION_DATE_YEAR;
cis_buf[1] = VERSION_DATE_MONTH;
cis_buf[2] = VERSION_DATE_DAY;
cis_buf[3] = VERSION_DATE_HOUR;
cis_buf[4] = VERSION_DATE_MINUTE;
SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, BLE_CIS_BUFF_SIZE, cis_buf);
break;
}
}
break;
}
@@ -1166,12 +1251,12 @@ static void headstage_gptimer_callback(GPTimerCC26XX_Handle handle, GPTimerCC26X
/*=======================================
==== headstage specific declaration ====
======================================*/
#include "EliteDeviceCorrection.h"
#include "EliteNotify.h"
#include "impedance_meter.h"
/*========================
==== gap information ====
p information ====
=======================*/
#ifndef DEVICE_NAME
@@ -0,0 +1,11 @@
#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
@@ -102,6 +102,7 @@
#include "simple_peripheral.h"
#include "EliteGPTimer.h"
#include "headstage.h"
#if defined(USE_FPGA) || defined(DEBUG_SW_TRACE)
@@ -527,6 +528,8 @@ static void SimpleBLEPeripheral_init(void) {
HCI_LE_ReadMaxDataLenCmd();
}
#include "EliteWorkData.h"
/*********************************************************************
* @fn SimpleBLEPeripheral_taskFxn
*
@@ -540,20 +543,23 @@ static void SimpleBLEPeripheral_init(void) {
// static void detectKey_clockHandler(UArg arg);
static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
#define CLOCK_ONE_SECOND 10000
// Initialize application
SimpleBLEPeripheral_init();
headstage_init_device_info();
// headstage_gptimer_init();
ZM_init();
Elite_SPI_init();
WorkMode *WorkModeData = CreateWorkMode();
uint8_t key = 0;
uint8_t counter6994 = 0;
uint16_t counter6994 = 0;
bool EliteOn = 0;
Util_constructClock(&periodicClock, SimpleBLEPeripheral_clockHandler, SBP_PERIODIC_EVT_PERIOD, 0, false, SBP_PERIODIC_EVT); // create a clock clockduration = 42(~=0.01 sec)
Util_startClock(&periodicClock); // start the clock, timeup => call SimpleBLEPeripheral_clockHandler => wake up the device
// init DAC, set output ~= 0 V
DAC_outputV(Usercode_Correction_to_DAC(25000));
elite_gptimer_start();
// Application main loops
for (;;) {
@@ -602,16 +608,16 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
ICall_free(pMsg);
}
}
}
if(events & SBP_PERIODIC_EVT){
events &= ~SBP_PERIODIC_EVT;
if (!PeriodicEvent) { // if there is no periodic event
Util_startClock(&periodicClock); // manually restart the clock
key = PIN_getInputValue(switch_on);
if (EliteOn) {
if (counter6994 < 175) { // counter6994 enable a IC after 35 counts
if (counter6994 < CLOCK_ONE_SECOND/2) { // counter6994 enable a IC after 35 counts
counter6994++;
} else if (counter6994 == 175) {
} 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();
@@ -621,26 +627,37 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
counter6994++;
}
EliteKeyPress(key);
if(Free_Work_Mode){
FreeWorkMode(WorkModeData);
InitEliteInstruction();
ADCGainControl(INSTRUCTION.ADCGainLevel);
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
Free_Work_Mode = false;
}
} else {
EliteOn = TurnOnElite(key);
}
// if(DAC_reset) DAC_outputV(0x0000); //set DAC to 0v when no periodic event
} else { // if there is periodic event
Util_startClock(&periodicClock); // manually restart the clock
SimpleBLEPeripheral_performPeriodicTask();
}
// if there is periodic event
else {
if(InitPeriodicEvent){
InitWorkMode(WorkModeData);
InitPeriodicEvent = false;
}
// Perform periodic application task
SimpleBLEPeripheral_performPeriodicTask(WorkModeData);
// Turn off Elite if battery voltage < 3V
// ReadBatVolt(spi_ADC_rxbuf);
key = PIN_getInputValue(switch_on);
EliteKeyPress(key); // onPress=> key = 0; 1.lighten LED 2.long press shut down 2650
}
}
// if(events & SBP_PERIODIC_EVT){
// Util_startClock(&periodicClock);
// events &= ~SBP_PERIODIC_EVT;
// // Perform periodic application task
// SimpleBLEPeripheral_performPeriodicTask();
// }
// if (events & SBP_PERIODIC_EVT)
// {
// events &= ~SBP_PERIODIC_EVT;
+91
View File
@@ -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"