Skip to content
Snippets Groups Projects
Commit 7d9b3089 authored by Josh Siegle's avatar Josh Siegle
Browse files

Updated FPGAThread for use with Custom FPGA acquisition module

parent 7ac17078
Branches
Tags v0.2.7
No related merge requests found
File added
......@@ -55,6 +55,9 @@ void DataThread::run() {
}
DataBuffer* DataThread::getBufferAddress() {
std::cout << "Setting buffer address to " << dataBuffer << std::endl;
return dataBuffer;
}
......
......@@ -55,27 +55,48 @@ FPGAThread::FPGAThread(SourceNode* sn) : DataThread(sn),
std::cout << "FPGA interface initialized." << std::endl;
std::cout << "DataBuffer address is " << dataBuffer << std::endl;
dataBuffer = new DataBuffer(32, 10000);
startThread();
std::cout << "DataBuffer address is " << dataBuffer << std::endl;
//deviceFound = true;
//startThread();
}
FPGAThread::~FPGAThread() {
stopThread(500);
std::cout << "FPGA interface destroyed." << std::endl;
// probably not the best way to do this:
delete dataBuffer;
deleteAndZero(dataBuffer);
delete dev;
dev = 0;
dataBuffer = 0;
}
bool FPGAThread::startAcquisition()
{
startThread();
//isTransmitting = true;
return true;
}
bool FPGAThread::stopAcquisition()
{
if (isThreadRunning()) {
signalThreadShouldExit();
}
return true;
}
bool FPGAThread::updateBuffer() {
dev->ReadFromPipeOut(0xA0, sizeof(pBuffer), pBuffer);
......@@ -107,7 +128,8 @@ bool FPGAThread::updateBuffer() {
j += 3;
//thisSample[n] = float( hi - 256)/256;
thisSample[n] = float(float(hi)*256 + lo - 32768)/32768;
uint16 samp = ((hi << 8) + lo);
thisSample[n] = (float(samp) - 32768.0f)/92768.0f;
}
dataBuffer->addToBuffer(thisSample,1);
......@@ -115,6 +137,7 @@ bool FPGAThread::updateBuffer() {
j++; // keep scanning for timecodes
}
return true;
}
......
......@@ -55,8 +55,8 @@ public:
~FPGAThread();
bool foundInputSource() {return true;}
bool startAcquisition() {return true;}
bool stopAcquisition() {return true;}
bool startAcquisition();
bool stopAcquisition();
int getNumChannels() {return 32;}
float getSampleRate() {return 25000.0;}
......@@ -69,12 +69,10 @@ private:
int m_u32SegmentSize;
unsigned char pBuffer[500000]; // request a 1MB block of data
unsigned char pBuffer[50000]; // request a 1MB block of data
bool isRunning;
DataBuffer* dataBuffer;
float thisSample[32];
int numchannels;
......
......@@ -305,7 +305,8 @@ GenericProcessor* ProcessorGraph::createProcessorFromDescription(String& descrip
if (processorType.equalsIgnoreCase("Sources")) {
if (subProcessorType.equalsIgnoreCase("Intan Demo Board") ||
subProcessorType.equalsIgnoreCase("File Reader")) {
subProcessorType.equalsIgnoreCase("File Reader") ||
subProcessorType.equalsIgnoreCase("Custom FPGA")) {
// only one Intan Demo Board at a time, please
if (!processorWithSameNameExists(subProcessorType)) {
......@@ -330,6 +331,7 @@ GenericProcessor* ProcessorGraph::createProcessorFromDescription(String& descrip
} else if (processorType.equalsIgnoreCase("Filters")) {
if (subProcessorType.equalsIgnoreCase("Bandpass Filter")) {
std::cout << "Creating a new filter." << std::endl;
processor = new FilterNode();
......
......@@ -30,6 +30,9 @@ SourceNode::SourceNode(const String& name_)
dataThread(0), inputBuffer(0),
sourceCheckInterval(2000), wasDisabled(true)
{
std::cout << "creating source node." << std::endl;
if (getName().equalsIgnoreCase("Intan Demo Board")) {
dataThread = new IntanThread(this);
} else if (getName().equalsIgnoreCase("Custom FPGA")) {
......@@ -61,7 +64,9 @@ void SourceNode::updateSettings()
{
if (inputBuffer == 0 && dataThread != 0)
{
inputBuffer = dataThread->getBufferAddress();
std::cout << "Input buffer address is " << inputBuffer << std::endl;
}
}
......
......@@ -26,7 +26,7 @@
LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* n) : processor(n),
xBuffer(0), yBuffer(0),
plotHeight(40), selectedChan(-1), screenBufferIndex(0),
timebase(1.0f), displayGain(5.0f), displayBufferIndex(0)
timebase(1.0f), displayGain(15.0f), displayBufferIndex(0)
{
nChans = processor->getNumInputs();
......
......@@ -53,7 +53,7 @@ ProcessorList::ProcessorList() : isDragging(false),
ProcessorListItem* sources = new ProcessorListItem("Sources");
sources->addSubItem(new ProcessorListItem("Intan Demo Board"));
sources->addSubItem(new ProcessorListItem("Signal Generator"));
//sources->addSubItem(new ProcessorListItem("Custom FPGA"));
sources->addSubItem(new ProcessorListItem("Custom FPGA"));
sources->addSubItem(new ProcessorListItem("File Reader"));
sources->addSubItem(new ProcessorListItem("Event Generator"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment