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: b63e7bd9efb7
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5632451f0cce
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Sep 11, 2020

  1. Copy the full SHA
    eb1a522 View commit details
  2. Copy the full SHA
    5632451 View commit details
Showing with 161 additions and 0 deletions.
  1. +76 −0 scopehal/LeCroyOscilloscope.cpp
  2. +10 −0 scopehal/LeCroyOscilloscope.h
  3. +34 −0 scopehal/Oscilloscope.cpp
  4. +41 −0 scopehal/Oscilloscope.h
76 changes: 76 additions & 0 deletions scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -2550,3 +2550,79 @@ bool LeCroyOscilloscope::SetInterleaving(bool combine)

return m_interleaving;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Logic analyzer configuration

vector<Oscilloscope::DigitalBank> LeCroyOscilloscope::GetDigitalBanks()
{
vector<DigitalBank> banks;

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

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

banks.push_back(bank);
}
}

return banks;
}

Oscilloscope::DigitalBank LeCroyOscilloscope::GetDigitalBank(size_t channel)
{
DigitalBank ret;
if(m_hasLA)
{
if(channel <= m_digitalChannels[7]->GetIndex() )
{
for(size_t i=0; i<8; i++)
ret.push_back(m_digitalChannels[i]);
}
else
{
for(size_t i=0; i<8; i++)
ret.push_back(m_digitalChannels[i+8]);
}
}
return ret;
}

bool LeCroyOscilloscope::IsDigitalHysteresisConfigurable()
{
return true;
}

bool LeCroyOscilloscope::IsDigitalThresholdConfigurable()
{
return true;
}

float LeCroyOscilloscope::GetDigitalHysteresis(size_t channel)
{
lock_guard<recursive_mutex> lock(m_mutex);

if(channel <= m_digitalChannels[7]->GetIndex() )
m_transport->SendCommand("VBS? 'return = app.LogicAnalyzer.MSxxHysteresis0'");
else
m_transport->SendCommand("VBS? 'return = app.LogicAnalyzer.MSxxHysteresis1'");

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

float LeCroyOscilloscope::GetDigitalThreshold(size_t channel)
{
lock_guard<recursive_mutex> lock(m_mutex);

if(channel <= m_digitalChannels[7]->GetIndex() )
m_transport->SendCommand("VBS? 'return = app.LogicAnalyzer.MSxxThreshold0'");
else
m_transport->SendCommand("VBS? 'return = app.LogicAnalyzer.MSxxThreshold1'");

return atof(m_transport->ReadReply().c_str());
}
10 changes: 10 additions & 0 deletions scopehal/LeCroyOscilloscope.h
Original file line number Diff line number Diff line change
@@ -173,6 +173,16 @@ class LeCroyOscilloscope
virtual void SetDeskewForChannel(size_t channel, int64_t skew);
virtual int64_t GetDeskewForChannel(size_t channel);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Logic analyzer configuration

virtual std::vector<DigitalBank> GetDigitalBanks();
virtual DigitalBank GetDigitalBank(size_t channel);
virtual bool IsDigitalHysteresisConfigurable();
virtual bool IsDigitalThresholdConfigurable();
virtual float GetDigitalHysteresis(size_t channel);
virtual float GetDigitalThreshold(size_t channel);

protected:
void BulkCheckChannelEnableState();

34 changes: 34 additions & 0 deletions scopehal/Oscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -378,3 +378,37 @@ bool Oscilloscope::CanInterleave()

return true;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Logic analyzer configuration (default no-op for scopes without MSO feature)

vector<Oscilloscope::DigitalBank> Oscilloscope::GetDigitalBanks()
{
vector<DigitalBank> ret;
return ret;
}

Oscilloscope::DigitalBank Oscilloscope::GetDigitalBank(size_t /*channel*/)
{
return DigitalBank();
}

bool Oscilloscope::IsDigitalHysteresisConfigurable()
{
return false;
}

bool Oscilloscope::IsDigitalThresholdConfigurable()
{
return false;
}

float Oscilloscope::GetDigitalHysteresis(size_t /*channel*/)
{
return 0.1;
}

float Oscilloscope::GetDigitalThreshold(size_t /*channel*/)
{
return 0.5;
}
41 changes: 41 additions & 0 deletions scopehal/Oscilloscope.h
Original file line number Diff line number Diff line change
@@ -489,6 +489,47 @@ class Oscilloscope : public virtual Instrument
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Sequenced triggering

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Logic analyzer configuration

typedef std::vector<OscilloscopeChannel*> DigitalBank;

/**
@brief Gets the digital channel banks for this instrument.
A bank is a set of one or more channels all sharing a common threshold and hysteresis setting.
*/
virtual std::vector<DigitalBank> GetDigitalBanks();

/**
@brief Gets the bank containing a given channel
*/
virtual DigitalBank GetDigitalBank(size_t channel);

/**
@brief Checks if digital input hysteresis is configurable or fixed.
@return true if configurable, false if fixed
*/
virtual bool IsDigitalHysteresisConfigurable();

/**
@brief Checks if digital input threshold is configurable or fixed.
@return true if configurable, false if fixed
*/
virtual bool IsDigitalThresholdConfigurable();

/**
@brief Gets the hysteresis for a digital input
*/
virtual float GetDigitalHysteresis(size_t channel);

/**
@brief Gets the threshold for a digital input
*/
virtual float GetDigitalThreshold(size_t channel);

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