diff --git a/Source/Processors/DataThreads/RHD2000Thread.cpp b/Source/Processors/DataThreads/RHD2000Thread.cpp index 6b6bfe0b6dc0ff6f6ac6b7e88a55a7e3cc6f70fb..c754d3e980445a83f45430fd6b8721340b2633c5 100644 --- a/Source/Processors/DataThreads/RHD2000Thread.cpp +++ b/Source/Processors/DataThreads/RHD2000Thread.cpp @@ -36,6 +36,7 @@ RHD2000Thread::RHD2000Thread(SourceNode* sn) : DataThread(sn), isTransmitting(fa dataBuffer = new DataBuffer(2, 10000); // start with 2 channels and automatically resize // Open Opal Kelly XEM6010 board. + // Returns 1 if successful, -1 if FrontPanel cannot be loaded, and -2 if XEM6010 can't be found. int return_code = evalBoard->open(); if (return_code == 1) @@ -54,7 +55,7 @@ RHD2000Thread::RHD2000Thread(SourceNode* sn) : DataThread(sn), isTransmitting(fa initializeBoard(); // automatically find connected headstages - scanPorts(); // do this after the editor has been created? + scanPorts(); // things would run more smoothly if this were done after the editor has been created } } @@ -70,6 +71,9 @@ RHD2000Thread::~RHD2000Thread() evalBoard->setLedDisplay(ledArray); } + if (deviceFound) + evalBoard->resetFpga(); + deleteAndZero(dataBlock); } diff --git a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp index 80d84aa07c4c213fbfcef2e1a8f372f91086fa73..3b294bbf73242ebd1fe994be74e88d68afbc194c 100755 --- a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp +++ b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp @@ -173,6 +173,12 @@ bool Rhd2000EvalBoard::uploadFpgaBitfile(string filename) return(true); } +// Uses the Opal Kelly library to reset the FPGA +void Rhd2000EvalBoard::resetFpga() +{ + dev->ResetFPGA(); +} + // Reads system clock frequency from Opal Kelly board (in MHz). Should be 100 MHz for normal // Rhythm operation. double Rhd2000EvalBoard::getSystemClockFreq() const diff --git a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h index 51df0829f41c1dc30a63ee35611a5eb2ca76134d..3866324016a9463d2ab67462f9dd5e7f0942e52e 100755 --- a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h +++ b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h @@ -153,6 +153,8 @@ public: bool readDataBlocks(int numBlocks, queue<Rhd2000DataBlock> &dataQueue); int queueToFile(queue<Rhd2000DataBlock> &dataQueue, std::ofstream& saveOut); + void resetFpga(); + private: okCFrontPanel* dev; AmplifierSampleRate sampleRate;