Permalink
Browse files

Update to BioPatRec TRE

  • Loading branch information...
1 parent 67ef65b commit 3694c103774ea36bea6cbded5c0e1fc74ca07fa1 @maxoc maxoc committed Aug 6, 2015
Showing with 24,586 additions and 17,516 deletions.
  1. +32 −32 BioPatRec.m
  2. +68 −0 Comm/AFE/Acquire_tWs.m
  3. +88 −0 Comm/AFE/ConnectDevice.m
  4. +108 −108 Comm/AFE/NI_USB6009/InitNI.m
  5. +104 −104 Comm/AFE/NI_USB6009/Init_NI_AI.m
  6. +237 −237 Comm/AFE/NI_USB6009/NI_DataShow.m
  7. +305 −305 Comm/AFE/SBI/DAQShow_SBI.m
  8. +123 −123 Comm/AFE/SBI/InitSBI_NI.m
  9. +100 −100 Comm/AFE/SBI/TestSBI_NI_USB6009.m
  10. +101 −0 Comm/AFE/SetDeviceStartAcquisition.m
  11. +46 −0 Comm/AFE/StopAcquisition.m
  12. +39 −39 Comm/ALC/VCP_Piccolo/Connect_ALC.m
  13. +37 −37 Comm/ALC/VCP_Piccolo/TestConnectionALC.m
  14. +127 −127 Comm/ALC/VCP_Piccolo/TestPWMusingSCIbyCycling.m
  15. +54 −54 Comm/ALC/VCP_Piccolo/Update2PWMusingSCI.m
  16. +61 −61 Comm/ALC/VCP_Piccolo/UpdateAllPWMusingSCI.m
  17. +79 −79 Comm/ALC/VCP_Piccolo/UpdatePWMusingSCI_PanTilt.m
  18. +49 −48 {Control → Comm}/ConnectVRE.m
  19. +48 −47 {Control → Comm}/DisconnectVRE.m
  20. +97 −97 Comm/GetMovementCombination.m
  21. BIN Comm/Keys/GUI_SendKeys.fig
  22. +178 −8 Comm/Keys/GUI_SendKeys.m
  23. +34 −34 {Control → Comm}/ResetVRE.m
  24. +65 −65 Comm/SendKeys.m
  25. BIN Comm/VRE/GUI_Test_VRE.fig
  26. +81 −22 Comm/VRE/GUI_Test_VRE.m
  27. +31 −31 Comm/VRE/Ogre.log
  28. +6 −6 Comm/limitMovements.def
  29. +0 −8 Comm/motors.def
  30. +0 −25 Comm/movements.def
  31. +74 −74 Control/ActivateMotors.m
  32. +77 −77 Control/ApplyControl.m
  33. +78 −78 Control/ApplyProportionalControl.m
  34. +62 −0 Control/BayesianFusion.m
  35. +38 −0 Control/BufferOutput.m
  36. +88 −88 Control/CalculateDesiredSpeedPercent.m
  37. +13 −0 Control/CombinedControl.m
  38. +178 −178 Control/GUI_ControlParameters.m
  39. BIN Control/GUI_ProportionalControl.fig
  40. +496 −0 Control/GUI_ProportionalControl.m
  41. BIN Control/GUI_Sensors.fig
  42. +242 −0 Control/GUI_Sensors.m
  43. BIN Control/GUI_SingleMotorTest.fig
  44. +1,016 −0 Control/GUI_SingleMotorTest.m
  45. +44 −0 Control/InitBayesianFusion.m
  46. +50 −0 Control/InitCombinedControl.m
  47. +37 −37 Control/InitControl.m
  48. +102 −102 Control/InitControl_new.m
  49. +57 −0 Control/InitMF_Hand_DC_Hardcoded.m
  50. +32 −0 Control/InitMajorityVoteSimultaneous.m
  51. +38 −38 {Comm → Control}/InitMotors.m
  52. +50 −44 {Comm → Control}/InitMovements.m
  53. +93 −93 Control/InitOutBuffer.m
  54. +49 −49 Control/InitPropControl.m
  55. +40 −40 Control/InitRamp.m
  56. +40 −0 Control/InitRampModified.m
  57. +4 −0 Control/InitRampModified2.m
  58. +3 −0 Control/InitRampModified3.m
  59. +46 −0 Control/InitSensors.m
  60. +42 −42 Control/MajorityVote.m
  61. +65 −0 Control/MajorityVoteSimultaneous.m
  62. +68 −74 Control/MotorsOff.m
  63. +61 −99 Control/MotorsOn.m
  64. +103 −103 Control/MoveMotor.m
  65. +49 −0 Control/MoveMotorWifi.m
  66. +98 −98 Control/Ramp.m
  67. +131 −0 Control/RampModified.m
  68. +61 −0 Control/RampModified2.m
  69. +44 −0 Control/RampModified3.m
  70. +55 −55 Control/ReInitControl.m
  71. +44 −0 Control/ReadSensors.m
  72. +100 −100 Control/ReadValidControlAlgs.m
  73. +3 −0 Control/SPC/motors.def
  74. +25 −0 Control/SPC/movements.def
  75. +51 −0 Control/SendMotorCommand.m
  76. +93 −93 Control/ShortMotorActivation.m
  77. +33 −33 Control/StopMotor.m
  78. +17 −0 Control/TestConnection.m
  79. +59 −59 Control/VREActivation.m
  80. +89 −27 Control/ValidControlAlgs.txt
  81. +39 −39 {Comm → Control}/motor.m
  82. +54 −54 {Comm → Control}/movement.m
  83. +35 −0 Control/sensor.m
  84. BIN GUI_BioPatRec.fig
  85. +22 −5 GUI_BioPatRec.m
  86. +20 −20 LICENSE.txt
  87. +73 −73 PatRec/ANN/ANN_Accuracy.m
  88. +221 −212 PatRec/ANN/ANN_Perceptron.m
  89. +109 −73 PatRec/ANN/Backp/Backpropagation.m
  90. +79 −79 PatRec/ANN/Eval/EvaluateANN.m
  91. +64 −64 PatRec/ANN/Eval/FastTestANN.m
  92. +50 −50 PatRec/ANN/Eval/FitnessANN.m
  93. +65 −65 PatRec/ANN/Eval/FullTestANN.m
  94. +74 −74 PatRec/ANN/Eval/ValidateANN.m
  95. +64 −64 PatRec/ANN/InitANN_Perceptron.m
  96. +40 −40 PatRec/ANN/MLPTest.m
  97. +69 −69 PatRec/ANN/PSO/InitPSO_MLP.m
  98. +93 −93 PatRec/ANN/PSO/PSO_MLP.m
  99. +49 −49 PatRec/ANN/PSO/Pos2W.m
  100. +203 −132 PatRec/Accuracy_patRec.m
  101. +7 −7 PatRec/ContainsMovementNames.m
  102. BIN PatRec/GUI_PatRec.fig
  103. +974 −163 PatRec/GUI_PatRec.m
  104. BIN PatRec/GUI_TacTest.fig
  105. BIN PatRec/GUI_TestPatRec_Mov2Mov.fig
  106. +517 −93 PatRec/GUI_TestPatRec_Mov2Mov.m
  107. +116 −116 PatRec/LDA/DiscriminantAccuracy.m
  108. +71 −71 PatRec/LDA/DiscriminantAnalysis.m
  109. +60 −60 PatRec/LDA/DiscriminantTest.m
  110. +142 −142 PatRec/Load_patRec.m
  111. +84 −83 PatRec/Load_recSession.m
  112. +50 −50 PatRec/Load_sigFeatures.m
  113. +53 −53 PatRec/Load_treated_data.m
  114. +489 −449 PatRec/MotionTest.m
  115. +118 −118 PatRec/MotionTestResults.m
  116. +164 −164 PatRec/MotionTest_Legacy.m
  117. +56 −56 PatRec/Normalization/NormalizeSet.m
  118. +36 −36 PatRec/Normalization/NormalizeSets_Mean0Std1.m
  119. +49 −49 PatRec/Normalization/NormalizeSets_Mean0Var1.m
  120. +45 −45 PatRec/Normalization/NormalizeSets_Midrange0Range2.m
  121. +67 −67 PatRec/Normalization/NormalizeSets_TrV.m
  122. +72 −72 PatRec/Normalization/NormalizeSets_UnitaryRange.m
  123. +37 −34 PatRec/Normalization/NormalizeSets_normLog.m
  124. +230 −205 PatRec/OfflinePatRec.m
  125. +88 −102 PatRec/OfflinePatRecTraining.m
  126. +66 −69 PatRec/OneShotPatRec.m
  127. +70 −62 PatRec/OneShotPatRecClassifier.m
  128. +99 −94 PatRec/OneShotRealtimePatRec.m
  129. +36 −0 PatRec/PCA/ApplyFeatureReduction.m
  130. +36 −0 PatRec/PCA/FeatureReduction.m
  131. +78 −0 PatRec/PCA/PCAFeatureReduction.m
  132. +31 −0 PatRec/PCA/PCATest.m
  133. +39 −39 PatRec/PSO/InitVelocities.m
  134. +48 −48 PatRec/PSO/UpdateVel.m
  135. +61 −61 PatRec/RFN/Get_connMat_TrV.m
  136. +64 −64 PatRec/RFN/Get_connMat_eMean.m
  137. +31 −31 PatRec/RFN/PSO/DecodeConnMat.m
  138. +82 −82 PatRec/RFN/PSO/InitPSO_RFN.m
  139. +102 −102 PatRec/RFN/PSO/PSO_RFN.m
  140. +71 −71 PatRec/RFN/RFN.m
  141. +53 −53 PatRec/RFN/RegulationFeedback.m
  142. +102 −102 PatRec/RFN/RegulationFeedbackAcc.m
  143. +66 −66 PatRec/RFN/RegulationFeedbackFit.m
  144. +95 −95 PatRec/RFN/RegulationFeedbackTest.m
  145. +59 −59 PatRec/RFN/RegulationFeedback_thOut.m
  146. +46 −46 PatRec/Rand_TrainingData.m
  147. +47 −47 PatRec/Rand_sigFeatures.m
  148. +394 −357 PatRec/RealtimePatRec.m
  149. +168 −168 PatRec/RealtimePatRec_Legacy.m
  150. +53 −53 PatRec/SOM/Batch Training/BatchNeighborFunction.m
  151. +80 −80 PatRec/SOM/Batch Training/BatchTrainig.m
  152. +51 −51 PatRec/SOM/Batch Training/NeuronCoordinates.m
  153. +40 −40 PatRec/SOM/Batch Training/NeuronDistances.m
  154. +133 −124 PatRec/SOM/EvaluateSOM.m
  155. +95 −95 PatRec/SOM/FastTestSOM.m
  156. +105 −105 PatRec/SOM/FullTestSOM.m
  157. +42 −42 PatRec/SOM/GetNeuronLabel.m
  158. +119 −119 PatRec/SOM/InitSOM.m
  159. +32 −32 PatRec/SOM/RandomWeights.m
  160. +96 −96 PatRec/SOM/SOMTest.m
  161. +77 −77 PatRec/SOM/SOM_Mapping.m
  162. +30 −30 PatRec/SOM/Stochastic Training/Eta.m
  163. +35 −35 PatRec/SOM/Stochastic Training/FindClosest.m
  164. +28 −28 PatRec/SOM/Stochastic Training/Sigma.m
  165. +52 −52 PatRec/SOM/Stochastic Training/StochasticNeighborFunction.m
  166. +60 −58 PatRec/SOM/Stochastic Training/StochasticTraining.m
  167. +51 −51 PatRec/SOM/Stochastic Training/UpdateWeights.m
  168. +26 −26 PatRec/SOM/VectorDistance.m
  169. +92 −92 PatRec/SOM/Visiulaize U-matrix/CreateUDMat.m
  170. +100 −100 PatRec/SOM/Visiulaize U-matrix/GetColor.m
  171. +51 −51 PatRec/SOM/Visiulaize U-matrix/PlotUDMatrix.m
  172. +93 −93 PatRec/SOM/Visiulaize U-matrix/ShowUDMatrix.m
  173. +46 −46 PatRec/SOM/Visiulaize U-matrix/SyntaxNeuron.m
  174. +56 −56 PatRec/SOM/Visiulaize U-matrix/UDMatCoords.m
  175. +134 −125 PatRec/SSOM/EvaluateSSOM.m
  176. +60 −60 PatRec/SSOM/FastTestSSOM.m
  177. +78 −78 PatRec/SSOM/FullTestSSOM.m
  178. +120 −120 PatRec/SSOM/InitSSOM.m
  179. +85 −85 PatRec/SSOM/SSOM Batch Training/SSOMBatchTrainig.m
  180. +62 −60 PatRec/SSOM/SSOM Stochastic Training/SSOMStochasticTraining.m
  181. +64 −64 PatRec/SSOM/SSOMTest.m
  182. +82 −82 PatRec/SSOM/SSOM_Mapping.m
  183. +54 −45 PatRec/SignalProcessing_RealtimePatRec.m
  184. +47 −47 PatRec/SoftMax.m
  185. +156 −155 PatRec/TacTestResults.m
  186. +88 −88 PatRec/Topologies/PatRec_AgoAntagonist.m
  187. +106 −79 PatRec/Topologies/PatRec_AgoAntagonistAndMixed.m
  188. +59 −59 PatRec/Topologies/PatRec_AllAndOne.m
  189. +48 −48 PatRec/Topologies/PatRec_OneVsAll.m
  190. +48 −0 PatRec/Topologies/PatRec_OneVsAllT.m
  191. +72 −72 PatRec/Topologies/PatRec_OneVsOne.m
  192. +114 −0 PatRec/Topologies/PatRec_OneVsOneDoF.m
  193. +33 −33 PatRec/Topologies/PatRec_SingleClassifier.m
  194. +168 −0 PatRec/UseDefaults.m
  195. +78 −78 SigFeatures/ExtractSets_Stack.m
  196. +115 −115 SigFeatures/ExtractSets_Stack_MixRest.m
  197. +175 −175 SigFeatures/ExtractSets_Stack_MixRestEqual.m
  198. +40 −40 SigFeatures/ExtractSigFeature.m
  199. +41 −0 SigFeatures/ExtractSigFeatureVar.m
  200. +108 −95 SigFeatures/GetAllSigFeatures.m
  201. +61 −50 SigFeatures/GetFFT.m
  202. +57 −57 SigFeatures/GetSetsLables_Stack.m
  203. +99 −99 SigFeatures/GetSets_Stack.m
  204. +161 −161 SigFeatures/GetSets_Stack_IndvMov.m
  205. +180 −180 SigFeatures/GetSets_Stack_MixedOut.m
  206. +493 −493 SigFeatures/GetSigFeatures.m
  207. +39 −0 SigFeatures/GetSigFeatures_tcard.m
  208. +51 −51 SigFeatures/GetSigFeatures_tren.m
  209. +45 −45 SigFeatures/LoadFeaturesIDs.m
  210. +57 −53 SigFeatures/features.def
  211. +44 −44 SigRecordings/Compatibility_recSession.m
  212. +85 −95 SigRecordings/DataShow.m
  213. +213 −0 SigRecordings/FastRecordingSession.m
  214. BIN SigRecordings/GUI_AFEselection.fig
  215. +171 −330 SigRecordings/GUI_AFEselection.m
  216. BIN SigRecordings/GUI_RecordingSession.fig
  217. +17 −8 SigRecordings/GUI_RecordingSession.m
  218. +13 −2 SigRecordings/GUI_RecordingSessionShow.m
  219. BIN SigRecordings/GUI_Recordings.fig
  220. +367 −374 SigRecordings/GUI_Recordings.m
  221. +350 −0 SigRecordings/ObtainRampMax.m
  222. +265 −0 SigRecordings/ObtainRampMin.m
  223. +536 −719 SigRecordings/RecordingSession.m
  224. +656 −656 SigRecordings/RecordingSession_Legacy.m
  225. +177 −0 SigRecordings/RecordingSession_ShowData.m
  226. +52 −52 SigRecordings/Split_recSession_Ch_Independent.m
  227. +86 −0 SigTreatment/AddNoise_recSession.m
  228. +92 −92 SigTreatment/AddRestAsMovement.m
  229. +36 −0 SigTreatment/ApplySignalSeparation.m
  230. +55 −55 SigTreatment/Compatibility_treated_data.m
  231. +36 −0 SigTreatment/ComputeSignalSeparation.m
  232. +41 −0 SigTreatment/Downsample_recSession.m
  233. +32 −32 SigTreatment/Frequency Filters/ApplyButterFilter.m
  234. +62 −62 SigTreatment/Frequency Filters/ApplyFilters.m
  235. +38 −38 SigTreatment/Frequency Filters/BSbutterPLHarmonics.m
  236. +39 −37 SigTreatment/Frequency Filters/Filter50hz.m
  237. +36 −36 SigTreatment/Frequency Filters/FilterBP.m
  238. +38 −38 SigTreatment/Frequency Filters/FilterBP_EMG.m
  239. +42 −42 SigTreatment/Frequency Filters/FilterData.m
  240. +39 −39 SigTreatment/Frequency Filters/FilterHP80hz.m
  241. BIN SigTreatment/GUI_SigTreatment.fig
  242. +132 −3 SigTreatment/GUI_SigTreatment.m
  243. +116 −116 SigTreatment/GetData.m
  244. +141 −0 SigTreatment/ICA/ICA.m
  245. +64 −0 SigTreatment/ICA/ICAPreprocess.m
  246. +67 −0 SigTreatment/PlotFFT.m
  247. +107 −74 SigTreatment/PreProcessing.m
  248. +65 −65 SigTreatment/RemoveTransient_cTp.m
  249. +66 −0 SigTreatment/Scale_recSession.m
  250. +33 −0 SigTreatment/SignalSeparationRealtime.m
  251. +52 −52 SigTreatment/Spatial Filters/SpatialFilterDDF.m
  252. +60 −60 SigTreatment/Spatial Filters/SpatialFilterDDFAbs.m
  253. +48 −48 SigTreatment/Spatial Filters/SpatialFilterSDF.m
  254. +73 −0 SigTreatment/Spatial Filters/SpatialFilter_1.m
  255. +29 −29 SigTreatment/Split_recSession_Ch.m
  256. +32 −32 SigTreatment/Split_recSession_Mov.m
  257. +86 −72 SigTreatment/TreatData.m
  258. +80 −80 VRE/CalculatePathLength.m
  259. +111 −111 VRE/CreateMovMatrix.m
  260. +88 −0 VRE/CurrentPosition.m
  261. +64 −64 VRE/MoveSS.m
  262. +460 −387 VRE/TACTest.m
  263. +145 −145 VRE/TrackStateSpace.m
  264. +47 −0 VRE/UpdateTAC/CalculateTacPath.m
  265. +11 −0 VRE/UpdateTAC/GetMovementFromName.m
  266. +23 −0 VRE/UpdateTAC/ShortToName.m
  267. +13 −13 VRE/bin/Release/ogre.cfg
  268. +17 −17 VRE/bin/Release/plugins.cfg
  269. +2 −2 VRE/bin/Release/quakemap.cfg
  270. +16 −16 VRE/bin/Release/resources.cfg
  271. +37 −37 VRE/bin/Release/samples.cfg
  272. +16 −16 VRE/bin/media/materials/scripts/Arm.material
  273. +18 −18 VRE/bin/media/materials/scripts/tacArm.material
View
@@ -1,32 +1,32 @@
-% ---------------------------- Copyright Notice ---------------------------
-% This file is part of BioPatRec © which is open and free software under
-% the GNU Lesser General Public License (LGPL). See the file "LICENSE" for
-% the full license governing this code and copyrights.
-%
-% BioPatRec was initially developed by Max J. Ortiz C. at Integrum AB and
-% Chalmers University of Technology. All authors’ contributions must be kept
-% acknowledged below in the section "Updates % Contributors".
-%
-% Would you like to contribute to science and sum efforts to improve
-% amputees’ quality of life? Join this project! or, send your comments to:
-% maxo@chalmers.se.
-%
-% The entire copyright notice must be kept in this or any source file
-% linked to BioPatRec. This will ensure communication with all authors and
-% acknowledge contributions here and in the project web page (optional).
-%
-% -------------------------- Function Description -------------------------
-% BioPatRec is a research platform for testing and development of
-% algorithms for prosthetic control. This function call the main GUI.
-% For more information and documention visit:
-% http://code.google.com/p/biopatrec/
-%
-% ------------------------- Updates & Contributors ------------------------
-% 2009-04-02 / Max Ortiz / Creation of EMG_AQ
-% 2011-22-06 / Max Ortiz / Software name changed from EMG_AQ to BioPatRec
-
-close all;
-clear all;
-
-%EMG_AQ
-GUI_BioPatRec;
+% ---------------------------- Copyright Notice ---------------------------
+% This file is part of BioPatRec © which is open and free software under
+% the GNU Lesser General Public License (LGPL). See the file "LICENSE" for
+% the full license governing this code and copyrights.
+%
+% BioPatRec was initially developed by Max J. Ortiz C. at Integrum AB and
+% Chalmers University of Technology. All authors’ contributions must be kept
+% acknowledged below in the section "Updates % Contributors".
+%
+% Would you like to contribute to science and sum efforts to improve
+% amputees’ quality of life? Join this project! or, send your comments to:
+% maxo@chalmers.se.
+%
+% The entire copyright notice must be kept in this or any source file
+% linked to BioPatRec. This will ensure communication with all authors and
+% acknowledge contributions here and in the project web page (optional).
+%
+% -------------------------- Function Description -------------------------
+% BioPatRec is a research platform for testing and development of
+% algorithms for prosthetic control. This function call the main GUI.
+% For more information and documention visit:
+% http://code.google.com/p/biopatrec/
+%
+% ------------------------- Updates & Contributors ------------------------
+% 2009-04-02 / Max Ortiz / Creation of EMG_AQ
+% 2011-22-06 / Max Ortiz / Software name changed from EMG_AQ to BioPatRec
+
+close all;
+clear all;
+
+%EMG_AQ
+GUI_BioPatRec;
View
@@ -0,0 +1,68 @@
+% ---------------------------- Copyright Notice ---------------------------
+% This file is part of BioPatRec © which is open and free software under
+% the GNU Lesser General Public License (LGPL). See the file "LICENSE" for
+% the full license governing this code and copyrights.
+%
+% BioPatRec was initially developed by Max J. Ortiz C. at Integrum AB and
+% Chalmers University of Technology. All authors’ contributions must be kept
+% acknowledged below in the section "Updates % Contributors".
+%
+% Would you like to contribute to science and sum efforts to improve
+% amputees’ quality of life? Join this project! or, send your comments to:
+% maxo@chalmers.se.
+%
+% The entire copyright notice must be kept in this or any source file
+% linked to BioPatRec. This will ensure communication with all authors and
+% acknowledge contributions here and in the project web page (optional).
+% ------------------- Function Description ------------------
+% Function to Record Exc Sessions
+%
+% --------------------------Updates--------------------------
+% 2015-1-12 / Enzo Mastinu / Divided the RecordingSession function into
+ % several functions: ConnectDevice(),
+ % SetDeviceStartAcquisition(),
+ % Acquire_tWs(), StopAcquisition(). This functions
+ % has been moved to COMM/AFE folder, into this new script.
+
+% 20xx-xx-xx / Author / Comment
+
+
+
+% It acquire tWs samples from the selected device
+function cData = Acquire_tWs(deviceName, obj, nCh, tWs)
+
+ cData = zeros(tWs,nCh); % this is the data structure that the function must return
+ ampPP = 0.0005;
+ offVector = 0:nCh-1;
+ offVector = offVector .* ampPP;
+
+
+ %%%%% ADS1299 %%%%%
+ if strcmp(deviceName, 'ADS1299')
+ LSBweight = double(4.5/(24*8388607)); % ADS1299: if gain is set on 24 V/V
+ for sampleNr = 1:tWs
+ % 27bytes package mode
+ byteData = fread(obj,27,'char'); % Acquire 27 bytes packet from Tiva (and from ADS1299), 3 status bytes + 3 byte (24bit) for each channel
+ value = [65536 256 1]*reshape(byteData(4:end), 3, 8); % all channels data are now available on value vector, byteData(4:end) means throw away status bytes
+ for k = 1:nCh
+ if value(k) > 8388607 % the data must be converted from 2's complement
+ value(k) = value(k) - 2^24;
+ end
+ cData(sampleNr,k) = value(k) * LSBweight;
+ end
+ end
+ end
+
+ %%%%% INTAN RHA2216 %%%%%
+ if strcmp(deviceName, 'RHA2216')
+ LSBweight = double(2.5/(200*65535)); % Intan differential gain is 200 V/V
+ for sampleNr = 1:tWs
+ value16 = fread(obj,nCh,'uint16');
+ for k = 1:nCh
+% cData(sampleNr,k) = value16(k) - 16384; % Centers data and scales it to fit the graphs
+ cData(sampleNr,k) = value16(k)*LSBweight; % Convert data into volt
+ end
+ end
+ end
+
+end
View
@@ -0,0 +1,88 @@
+% ---------------------------- Copyright Notice ---------------------------
+% This file is part of BioPatRec © which is open and free software under
+% the GNU Lesser General Public License (LGPL). See the file "LICENSE" for
+% the full license governing this code and copyrights.
+%
+% BioPatRec was initially developed by Max J. Ortiz C. at Integrum AB and
+% Chalmers University of Technology. All authors’ contributions must be kept
+% acknowledged below in the section "Updates % Contributors".
+%
+% Would you like to contribute to science and sum efforts to improve
+% amputees’ quality of life? Join this project! or, send your comments to:
+% maxo@chalmers.se.
+%
+% The entire copyright notice must be kept in this or any source file
+% linked to BioPatRec. This will ensure communication with all authors and
+% acknowledge contributions here and in the project web page (optional).
+% ------------------- Function Description ------------------
+% Function to Record Exc Sessions
+%
+% --------------------------Updates--------------------------
+% 2015-1-12 / Enzo Mastinu / Divided the RecordingSession function into
+ % several functions: ConnectDevice(),
+ % SetDeviceStartAcquisition(),
+ % Acquire_tWs(), StopAcquisition(). This functions
+ % has been moved to COMM/AFE folder, into this new script.
+
+
+% 20xx-xx-xx / Author / Comment
+
+
+
+% it creates IP object and sets the buffersize depending on the device that has been chose
+function obj = ConnectDevice(handles)
+
+ deviceName = handles.deviceName;
+ ComPortType = handles.ComPortType;
+ if strcmp(ComPortType, 'COM')
+ ComPortName = handles.ComPortName;
+ end
+ sF = handles.sF;
+ sT = handles.sT;
+ nCh = handles.nCh;
+ sTall = handles.sTall;
+
+ % Delete previous connection objects
+ if exist('obj')
+ fclose(obj);
+ delete(obj);
+ end
+
+ %%%%% WiFi %%%%%
+ if strcmp(ComPortType, 'WiFi')
+ %%%%% TI ADS1299 %%%%%
+ if strcmp(deviceName, 'ADS1299')
+ obj = tcpip('192.168.100.10',65100,'NetworkRole','client'); % WIICOM
+ obj.InputBufferSize = sTall*sF*27; % 27bytes data package
+ end
+ %%%%% INTAN RHA2216 %%%%%
+ if strcmp(deviceName, 'RHA2216')
+ obj = tcpip('192.168.100.10',65100,'NetworkRole','client'); % WIICOM
+ obj.InputBufferSize = sT*sF*nCh*2;
+ end
+ end
+
+ %%%%% COM %%%%%
+ if strcmp(ComPortType, 'COM')
+ %%%%% TI ADS1299 %%%%%
+ if strcmp(deviceName, 'ADS1299')
+ obj = serial (ComPortName, 'baudrate', 2500000, 'databits', 8, 'byteorder', 'bigEndian');
+ obj.InputBufferSize = sTall*sF*27; % 27bytes data package
+ end
+ %%%%% INTAN RHA2216 %%%%%
+ if strcmp(deviceName, 'RHA2216')
+ obj = serial (ComPortName, 'baudrate', 1250000, 'databits', 8, 'byteorder', 'bigEndian');
+ obj.InputBufferSize = sT*sF*nCh*2;
+ end
+ end
+
+ % Open the connection
+ fopen(obj);
+
+ % Read available data and discard it
+ if obj.BytesAvailable > 1
+ fread(obj,obj.BytesAvailable,'uint8');
+ end
+% disp(obj);
+
+end
Oops, something went wrong.

0 comments on commit 3694c10

Please sign in to comment.