From d064ac0cc9ebd958b6c9e85a080b4efc57885096 Mon Sep 17 00:00:00 2001 From: shayo <shay.ohayon@gmail.com> Date: Fri, 19 Dec 2014 16:07:14 -0500 Subject: [PATCH] Fixed DAC output in SpikeSorter --- Builds/VisualStudio2013/open-ephys.sln | 20 ++++++++++++++----- Builds/VisualStudio2013/open-ephys.vcxproj | 4 ++-- .../Processors/DataThreads/RHD2000Thread.cpp | 2 +- .../rhythm-api/rhd2000evalboard.cpp | 11 ++++++++-- .../DataThreads/rhythm-api/rhd2000evalboard.h | 3 ++- .../GenericProcessor/GenericProcessor.cpp | 13 +++++++++++- 6 files changed, 41 insertions(+), 12 deletions(-) diff --git a/Builds/VisualStudio2013/open-ephys.sln b/Builds/VisualStudio2013/open-ephys.sln index 59a9d10ba..662031ed0 100644 --- a/Builds/VisualStudio2013/open-ephys.sln +++ b/Builds/VisualStudio2013/open-ephys.sln @@ -1,21 +1,31 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -Project("{5A05F353-1D63-394C-DFB0-981BB2309002}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}" +VisualStudioVersion = 12.0.30501.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Debug64|Win32 = Debug64|Win32 Debug64|x64 = Debug64|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + Release64|Win32 = Release64|Win32 Release64|x64 = Release64|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|Win32.ActiveCfg = Debug|Win32 {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|Win32.Build.0 = Debug|Win32 - {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.ActiveCfg = Release|Win32 - {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.Build.0 = Release|Win32 + {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|x64.ActiveCfg = Debug|Win32 + {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|Win32.ActiveCfg = Debug64|x64 {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|x64.ActiveCfg = Debug64|x64 {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|x64.Build.0 = Debug64|x64 + {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.ActiveCfg = Release|Win32 + {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.Build.0 = Release|Win32 + {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|x64.ActiveCfg = Release|Win32 + {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|Win32.ActiveCfg = Release64|x64 {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|x64.ActiveCfg = Release64|x64 {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|x64.Build.0 = Release64|x64 EndGlobalSection diff --git a/Builds/VisualStudio2013/open-ephys.vcxproj b/Builds/VisualStudio2013/open-ephys.vcxproj index a49659461..568ba25cc 100644 --- a/Builds/VisualStudio2013/open-ephys.vcxproj +++ b/Builds/VisualStudio2013/open-ephys.vcxproj @@ -216,7 +216,7 @@ <OutputFile>$(IntDir)\open-ephys.bsc</OutputFile> </Bscmake> <PostBuildEvent> - <Command>copy "..\..\Resources\DLLs\VS2013\*.dll" "$(OutDir)"</Command> + <Command>copy "..\..\Resources\DLLs\Win64\*.dll" "$(OutDir)"</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release64|x64'"> @@ -263,7 +263,7 @@ <OutputFile>$(IntDir)\open-ephys.bsc</OutputFile> </Bscmake> <PostBuildEvent> - <Command>copy "..\..\Resources\DLLs\VS2013\*.dll" "$(OutDir)"</Command> + <Command>copy "..\..\Resources\DLLs\Win64\*.dll" "$(OutDir)"</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemGroup> diff --git a/Source/Processors/DataThreads/RHD2000Thread.cpp b/Source/Processors/DataThreads/RHD2000Thread.cpp index 920cbb89e..9f357018b 100644 --- a/Source/Processors/DataThreads/RHD2000Thread.cpp +++ b/Source/Processors/DataThreads/RHD2000Thread.cpp @@ -187,7 +187,7 @@ void RHD2000Thread::setDACchannel(int dacOutput, int stream, int channel) dacStream[dacOutput] = stream; dacChannelsToUpdate[dacOutput] = true; dacOutputShouldChange = true; - evalBoard->updateDacAssignment(dacOutput, channel); // doesn't really change anything, but keep things in sync... + evalBoard->updateDacAssignment(dacOutput, stream,channel); // doesn't really change anything, but keep things in sync... } Array<int> RHD2000Thread::getDACchannels() diff --git a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp index 686aaa173..5d7452ca6 100755 --- a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp +++ b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp @@ -49,9 +49,11 @@ Rhd2000EvalBoard::Rhd2000EvalBoard() dataStreamEnabled[i] = 0; } dacChannelAssignment = new int[8]; + dacStreamAssignment = new int[8]; dacChannelThreshold = new float[8]; for (int k=0;k<8;k++) { + dacStreamAssignment[k] = -1; dacChannelAssignment[k] = -1; dacChannelThreshold[k] =0; } @@ -61,6 +63,9 @@ Rhd2000EvalBoard::Rhd2000EvalBoard() Rhd2000EvalBoard::~Rhd2000EvalBoard() { if (dev != 0) delete dev; + delete dacChannelAssignment; + delete dacChannelThreshold; + delete dacStreamAssignment; } // Find an Opal Kelly XEM6010-LX45 board attached to a USB port and open it. @@ -1123,7 +1128,7 @@ void Rhd2000EvalBoard::selectDacDataStream(int dacChannel, int stream) cerr << "Error in Rhd2000EvalBoard::selectDacDataStream: stream out of range." << endl; return; } - + dacStreamAssignment[dacChannel] = stream; switch (dacChannel) { case 0: @@ -1212,9 +1217,11 @@ int Rhd2000EvalBoard::gecDacDataChannel(int dacChannel) return dacChannelAssignment[dacChannel]; } -void Rhd2000EvalBoard::updateDacAssignment(int dacChannel, int channel) +void Rhd2000EvalBoard::updateDacAssignment(int dacChannel, int stream, int channel) { + dacStreamAssignment[dacChannel] = stream; dacChannelAssignment[dacChannel] = channel; + //selectDacDataStream } // Assign a particular amplifier channel (0-31) to a DAC channel (0-7). diff --git a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h index 61b3aa0fb..3d670a18f 100755 --- a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h +++ b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h @@ -160,7 +160,7 @@ public: void selectDacDataChannel(int dacChannel, int dataChannel); int gecDacDataChannel(int dacChannel); - void updateDacAssignment(int dacChannel, int channel); + void updateDacAssignment(int dacChannel, int stream, int channel); void enableExternalFastSettle(bool enable); void setExternalFastSettleChannel(int channel); void setFastSettleByTTL(bool state); @@ -179,6 +179,7 @@ private: int numDataStreams; // total number of data streams currently enabled int dataStreamEnabled[MAX_NUM_DATA_STREAMS]; // 0 (disabled) or 1 (enabled) int *dacChannelAssignment; + int *dacStreamAssignment; float *dacChannelThreshold; bool fast_settle_enabled; diff --git a/Source/Processors/GenericProcessor/GenericProcessor.cpp b/Source/Processors/GenericProcessor/GenericProcessor.cpp index d2dc5d1d0..b2c65ac69 100755 --- a/Source/Processors/GenericProcessor/GenericProcessor.cpp +++ b/Source/Processors/GenericProcessor/GenericProcessor.cpp @@ -353,6 +353,13 @@ void GenericProcessor::update() int numChan = getNumOutputs(); int numADC_Chan = getDefaultADCoutputs(); + + Array<channelType> types; + Array<int> stream, orig; + Array<float> gains; + StringArray names; + getChannelsInfo(names, types, stream, orig, gains); + for (int i = 0; i < numChan; i++) { Channel* ch = new Channel(this, i); @@ -368,7 +375,11 @@ void GenericProcessor::update() if (i >= numChan-numADC_Chan) ch->setType(ADC_CHANNEL); - + if (i < stream.size()) + { + ch->originalStream = stream[i]; + ch->originalChannel = orig[i]; + } ch->sampleRate = getDefaultSampleRate(); // if (ch->isADCchannel) -- GitLab