Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5632451f0cce
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f46b289240ca
Choose a head ref
  • 1 commit
  • 6 files changed
  • 1 contributor

Commits on Sep 11, 2020

  1. Copy the full SHA
    f46b289 View commit details
Showing with 64 additions and 3 deletions.
  1. +29 −3 scopehal/LeCroyOscilloscope.cpp
  2. +2 −0 scopehal/LeCroyOscilloscope.h
  3. +8 −0 scopehal/Oscilloscope.cpp
  4. +10 −0 scopehal/Oscilloscope.h
  5. +12 −0 scopehal/OscilloscopeChannel.cpp
  6. +3 −0 scopehal/OscilloscopeChannel.h
32 changes: 29 additions & 3 deletions scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -267,7 +267,9 @@ void LeCroyOscilloscope::AddDigitalChannels(unsigned int count)
m_digitalChannels.push_back(chan);
}

//Enable all of them
//Set the threshold to "user defined" vs using a canned family
m_transport->SendCommand("VBS? 'app.LogicAnalyzer.MSxxLogicFamily0 = \"USERDEFINED\" '");
m_transport->SendCommand("VBS? 'app.LogicAnalyzer.MSxxLogicFamily1 = \"USERDEFINED\" '");
}

/**
@@ -2560,12 +2562,12 @@ vector<Oscilloscope::DigitalBank> LeCroyOscilloscope::GetDigitalBanks()

if(m_hasLA)
{
for(size_t bank=0; bank<2; bank++)
for(size_t n=0; n<2; n++)
{
DigitalBank bank;

for(size_t i=0; i<8; i++)
bank.push_back(m_digitalChannels[i + bank*8]);
bank.push_back(m_digitalChannels[i + n*8]);

banks.push_back(bank);
}
@@ -2626,3 +2628,27 @@ float LeCroyOscilloscope::GetDigitalThreshold(size_t channel)

return atof(m_transport->ReadReply().c_str());
}

void LeCroyOscilloscope::SetDigitalHysteresis(size_t channel, float level)
{
lock_guard<recursive_mutex> lock(m_mutex);

char tmp[128];
if(channel <= m_digitalChannels[7]->GetIndex() )
snprintf(tmp, sizeof(tmp), "VBS? 'app.LogicAnalyzer.MSxxHysteresis0 = %e'", level);
else
snprintf(tmp, sizeof(tmp), "VBS? 'app.LogicAnalyzer.MSxxHysteresis1 = %e'", level);
m_transport->SendCommand(tmp);
}

void LeCroyOscilloscope::SetDigitalThreshold(size_t channel, float level)
{
lock_guard<recursive_mutex> lock(m_mutex);

char tmp[128];
if(channel <= m_digitalChannels[7]->GetIndex() )
snprintf(tmp, sizeof(tmp), "VBS? 'app.LogicAnalyzer.MSxxThreshold0 = %e'", level);
else
snprintf(tmp, sizeof(tmp), "VBS? 'app.LogicAnalyzer.MSxxThreshold1 = %e'", level);
m_transport->SendCommand(tmp);
}
2 changes: 2 additions & 0 deletions scopehal/LeCroyOscilloscope.h
Original file line number Diff line number Diff line change
@@ -182,6 +182,8 @@ class LeCroyOscilloscope
virtual bool IsDigitalThresholdConfigurable();
virtual float GetDigitalHysteresis(size_t channel);
virtual float GetDigitalThreshold(size_t channel);
virtual void SetDigitalHysteresis(size_t channel, float level);
virtual void SetDigitalThreshold(size_t channel, float level);

protected:
void BulkCheckChannelEnableState();
8 changes: 8 additions & 0 deletions scopehal/Oscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -412,3 +412,11 @@ float Oscilloscope::GetDigitalThreshold(size_t /*channel*/)
{
return 0.5;
}

void Oscilloscope::SetDigitalHysteresis(size_t /*channel*/, float /*level*/)
{
}

void Oscilloscope::SetDigitalThreshold(size_t /*channel*/, float /*level*/)
{
}
10 changes: 10 additions & 0 deletions scopehal/Oscilloscope.h
Original file line number Diff line number Diff line change
@@ -530,6 +530,16 @@ class Oscilloscope : public virtual Instrument
*/
virtual float GetDigitalThreshold(size_t channel);

/**
@brief Sets the hysteresis for a digital input
*/
virtual void SetDigitalHysteresis(size_t channel, float level);

/**
@brief Gets the threshold for a digital input
*/
virtual void SetDigitalThreshold(size_t channel, float level);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Configuration storage

12 changes: 12 additions & 0 deletions scopehal/OscilloscopeChannel.cpp
Original file line number Diff line number Diff line change
@@ -195,6 +195,18 @@ int64_t OscilloscopeChannel::GetDeskew()
return 0;
}

void OscilloscopeChannel::SetDigitalHysteresis(float level)
{
if(m_scope)
m_scope->SetDigitalHysteresis(m_index, level);
}

void OscilloscopeChannel::SetDigitalThreshold(float level)
{
if(m_scope)
m_scope->SetDigitalThreshold(m_index, level);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Accessors

3 changes: 3 additions & 0 deletions scopehal/OscilloscopeChannel.h
Original file line number Diff line number Diff line change
@@ -170,6 +170,9 @@ class OscilloscopeChannel
virtual Unit GetYAxisUnits()
{ return m_yAxisUnit; }

void SetDigitalHysteresis(float level);
void SetDigitalThreshold(float level);

protected:

/**