Skip to content
Snippets Groups Projects
Commit e97992ee authored by jsiegle's avatar jsiegle
Browse files

Add option of enabling ADCs in Rhythm interface

parent c4c5df8f
Branches
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ RHD2000Thread::RHD2000Thread(SourceNode* sn) : DataThread(sn), isTransmitting(fa ...@@ -28,6 +28,7 @@ RHD2000Thread::RHD2000Thread(SourceNode* sn) : DataThread(sn), isTransmitting(fa
fastSettleEnabled(false), chipRegisters(30000.0f), dspEnabled(true), boardSampleRate(30000.0f), fastSettleEnabled(false), chipRegisters(30000.0f), dspEnabled(true), boardSampleRate(30000.0f),
desiredDspCutoffFreq(0.5f), desiredUpperBandwidth(7500.0f), desiredLowerBandwidth(1.0f), desiredDspCutoffFreq(0.5f), desiredUpperBandwidth(7500.0f), desiredLowerBandwidth(1.0f),
savedSampleRateIndex(16), audioOutputL(-1), audioOutputR(-1), dacOutputShouldChange(false), savedSampleRateIndex(16), audioOutputL(-1), audioOutputR(-1), dacOutputShouldChange(false),
acquireAdcChannels(false),
cableLengthPortA(0.914f), cableLengthPortB(0.914f), cableLengthPortC(0.914f), cableLengthPortD(0.914f) // default is 3 feet (0.914 m) cableLengthPortA(0.914f), cableLengthPortB(0.914f), cableLengthPortC(0.914f), cableLengthPortD(0.914f) // default is 3 feet (0.914 m)
{ {
evalBoard = new Rhd2000EvalBoard; evalBoard = new Rhd2000EvalBoard;
...@@ -381,7 +382,6 @@ int RHD2000Thread::getNumChannels() ...@@ -381,7 +382,6 @@ int RHD2000Thread::getNumChannels()
} }
/* /*
if (chipRegisters->adcAux1En){ // no public function to read these? fix this in some way if (chipRegisters->adcAux1En){ // no public function to read these? fix this in some way
numChannels += 1; numChannels += 1;
...@@ -395,6 +395,12 @@ int RHD2000Thread::getNumChannels() ...@@ -395,6 +395,12 @@ int RHD2000Thread::getNumChannels()
*/ */
} }
if (acquireAdcChannels)
{
numChannels += 8; // add 8 channels for the ADCs
}
if (numChannels > 0) if (numChannels > 0)
return numChannels; return numChannels;
else else
...@@ -503,6 +509,15 @@ void RHD2000Thread::assignAudioOut(int dacChannel, int dataChannel) ...@@ -503,6 +509,15 @@ void RHD2000Thread::assignAudioOut(int dacChannel, int dataChannel)
} }
void RHD2000Thread::enableAdcs(bool t)
{
acquireAdcChannels = t;
dataBuffer->resize(getNumChannels(), 10000);
}
void RHD2000Thread::setSampleRate(int sampleRateIndex, bool isTemporary) void RHD2000Thread::setSampleRate(int sampleRateIndex, bool isTemporary)
{ {
...@@ -857,6 +872,16 @@ bool RHD2000Thread::updateBuffer() ...@@ -857,6 +872,16 @@ bool RHD2000Thread::updateBuffer()
thisSample[channel] = auxBuffer[channel]; thisSample[channel] = auxBuffer[channel];
} }
if (acquireAdcChannels)
{
for (int adcChan = 0; adcChan < 8; ++adcChan) {
channel++;
// ADC waveform units = volts
thisSample[channel] =
0.000050354 * float(dataBlock->boardAdcData[adcChan][samp]);
}
}
} }
......
...@@ -78,6 +78,7 @@ public: ...@@ -78,6 +78,7 @@ public:
int getNumEventChannels(); int getNumEventChannels();
void assignAudioOut(int dacChannel, int dataChannel); void assignAudioOut(int dacChannel, int dataChannel);
void enableAdcs(bool);
bool isAcquisitionActive(); bool isAcquisitionActive();
...@@ -102,6 +103,7 @@ private: ...@@ -102,6 +103,7 @@ private:
bool isTransmitting; bool isTransmitting;
bool dacOutputShouldChange; bool dacOutputShouldChange;
bool acquireAdcChannels;
bool fastSettleEnabled; bool fastSettleEnabled;
......
...@@ -82,6 +82,12 @@ RHD2000Editor::RHD2000Editor(GenericProcessor* parentNode, ...@@ -82,6 +82,12 @@ RHD2000Editor::RHD2000Editor(GenericProcessor* parentNode,
audioLabel->setColour(Label::textColourId, Colours::darkgrey); audioLabel->setColour(Label::textColourId, Colours::darkgrey);
addAndMakeVisible(audioLabel); addAndMakeVisible(audioLabel);
adcButton = new UtilityButton("ADC 1-8", Font("Small Text", 13, Font::plain));
adcButton->setRadius(3.0f);
adcButton->setBounds(180, 70,65,18);
adcButton->addListener(this);
adcButton->setClickingTogglesState(true);
addAndMakeVisible(adcButton);
} }
...@@ -114,6 +120,10 @@ void RHD2000Editor::buttonEvent(Button* button) ...@@ -114,6 +120,10 @@ void RHD2000Editor::buttonEvent(Button* button)
} else if (button == electrodeButtons[1]) } else if (button == electrodeButtons[1])
{ {
channelSelector->setRadioStatus(true); channelSelector->setRadioStatus(true);
} else if (button == adcButton)
{
board->enableAdcs(button->getToggleState());
getEditorViewport()->makeEditorVisible(this, false, true);
} }
} }
...@@ -132,6 +142,30 @@ void RHD2000Editor::channelChanged(int chan) ...@@ -132,6 +142,30 @@ void RHD2000Editor::channelChanged(int chan)
} }
} }
void RHD2000Editor::startAcquisition()
{
channelSelector->startAcquisition();
rescanButton->setEnabledState(false);
adcButton->setEnabledState(false);
acquisitionIsActive = true;
}
void RHD2000Editor::stopAcquisition()
{
channelSelector->stopAcquisition();
rescanButton->setEnabledState(true);
adcButton->setEnabledState(true);
acquisitionIsActive = false;
}
// Bandwidth Options -------------------------------------------------------------------- // Bandwidth Options --------------------------------------------------------------------
BandwidthInterface::BandwidthInterface(RHD2000Thread* board_, BandwidthInterface::BandwidthInterface(RHD2000Thread* board_,
......
...@@ -56,6 +56,9 @@ public: ...@@ -56,6 +56,9 @@ public:
void scanPorts(); void scanPorts();
void startAcquisition();
void stopAcquisition();
void channelChanged(int chan); void channelChanged(int chan);
private: private:
...@@ -67,6 +70,7 @@ private: ...@@ -67,6 +70,7 @@ private:
ScopedPointer<BandwidthInterface> bandwidthInterface; ScopedPointer<BandwidthInterface> bandwidthInterface;
ScopedPointer<UtilityButton> rescanButton; ScopedPointer<UtilityButton> rescanButton;
ScopedPointer<UtilityButton> adcButton;
ScopedPointer<Label> audioLabel; ScopedPointer<Label> audioLabel;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment