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

Commits on Nov 14, 2020

  1. Initial definition of analog bank and ADC mode APIs. Not implemented …

    …by any instruments yet, but no-op defaults are provided. Fixes #340.
    azonenberg committed Nov 14, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    cca8393 View commit details
  2. Copy the full SHA
    98f04c9 View commit details
Showing with 152 additions and 1 deletion.
  1. +54 −0 scopehal/LeCroyOscilloscope.cpp
  2. +11 −0 scopehal/LeCroyOscilloscope.h
  3. +44 −0 scopehal/Oscilloscope.cpp
  4. +43 −1 scopehal/Oscilloscope.h
54 changes: 54 additions & 0 deletions scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -3336,6 +3336,60 @@ bool LeCroyOscilloscope::SetInterleaving(bool combine)
return m_interleaving;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Analog bank configuration

bool LeCroyOscilloscope::IsADCModeConfigurable()
{
//HDO9000 is the only known LeCroy model with programmable ADC resolution
return (m_modelid == MODEL_HDO_9K);
}

vector<string> LeCroyOscilloscope::GetADCModeNames(size_t /*channel*/)
{
vector<string> ret;
ret.push_back("HD Off");
ret.push_back("HD On");
return ret;
}

size_t LeCroyOscilloscope::GetADCMode(size_t /*channel*/)
{
if(m_modelid != MODEL_HDO_9K)
return 0;

lock_guard<recursive_mutex> lock(m_mutex);
m_transport->SendCommand("VBS? 'return = app.Acquisition.Horizontal.HiResolutionModeActive'");
string reply = Trim(m_transport->ReadReply().c_str());

if(reply == "HDOn")
return 1;
else
return 0;
}

void LeCroyOscilloscope::SetADCMode(size_t /*channel*/, size_t mode)
{
if(m_modelid != MODEL_HDO_9K)
return;

lock_guard<recursive_mutex> lock(m_mutex);

if(mode == 1)
m_transport->SendCommand("VBS 'app.Acquisition.Horizontal.HiResolutionModeActive = \"HDOn\"'");
else
{
m_transport->SendCommand("VBS 'app.Acquisition.Horizontal.HiResolutionModeActive = \"HDOff\"'");

//Disable all interpolation
for(size_t i=0; i<m_analogChannelCount; i++)
{
m_transport->SendCommand(string("VBS 'app.Acquisition.") + m_channels[i]->GetHwname() +
".Interpolation = \"NONE\"'");
}
}
}

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

11 changes: 11 additions & 0 deletions scopehal/LeCroyOscilloscope.h
Original file line number Diff line number Diff line change
@@ -207,6 +207,17 @@ class LeCroyOscilloscope
virtual void SetDigitalHysteresis(size_t channel, float level);
virtual void SetDigitalThreshold(size_t channel, float level);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ADC bit depth configuration

//All currently supported LeCroy scopes have only one analog bank (same ADC config for all channels)
//so no need to override those

virtual bool IsADCModeConfigurable();
virtual std::vector<std::string> GetADCModeNames(size_t channel);
virtual size_t GetADCMode(size_t channel);
virtual void SetADCMode(size_t channel, size_t mode);

protected:
void PullDropoutTrigger();
void PullEdgeTrigger();
44 changes: 44 additions & 0 deletions scopehal/Oscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -461,6 +461,50 @@ void Oscilloscope::SetDigitalThreshold(size_t /*channel*/, float /*level*/)
{
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Analog channel configuration

vector<Oscilloscope::AnalogBank> Oscilloscope::GetAnalogBanks()
{
vector<AnalogBank> ret;
ret.push_back(GetAnalogBank(0));
return ret;
}

Oscilloscope::AnalogBank Oscilloscope::GetAnalogBank(size_t /*channel*/)
{
AnalogBank ret;
for(size_t i=0; i<m_channels.size(); i++)
{
auto chan = m_channels[i];
if(chan->GetType() == OscilloscopeChannel::CHANNEL_TYPE_ANALOG)
ret.push_back(chan);
}
return ret;
}

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

vector<string> Oscilloscope::GetADCModeNames(size_t /*channel*/)
{
vector<string> ret;
ret.push_back("Default");
return ret;
}

size_t Oscilloscope::GetADCMode(size_t /*channel*/)
{
return 0;
}

void Oscilloscope::SetADCMode(size_t /*channel*/, size_t /*mode*/)
{
//no-op
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Trigger configuration

44 changes: 43 additions & 1 deletion scopehal/Oscilloscope.h
Original file line number Diff line number Diff line change
@@ -523,6 +523,48 @@ class Oscilloscope : public virtual Instrument
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Sequenced triggering

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ADC bit depth configuration

typedef std::vector<OscilloscopeChannel*> AnalogBank;

/**
@brief Gets the analog banks for this instrument.
A bank is a set of one or more channels all sharing a common ADC configuration.
*/
virtual std::vector<AnalogBank> GetAnalogBanks();

/**
@brief Gets the bank containing a given channel.
*/
virtual AnalogBank GetAnalogBank(size_t channel);

/**
@brief Returns true if the ADC is configurable, false if it can only run in one mode.
*/
virtual bool IsADCModeConfigurable();

/**
@brief Gets the names of the ADC modes for the bank a given channel is located in.
ADC mode names are usually descriptive, like "12 bit, 640 Msps max" or "8 bit, 1 Gsps max"; but some instruments
may use more generic
@param channel Index of the channel to query modes for
*/
virtual std::vector<std::string> GetADCModeNames(size_t channel);

/**
@brief Gets the ADC mode for a channel
*/
virtual size_t GetADCMode(size_t channel);

/**
@brief Sets the ADC mode for a channel
*/
virtual void SetADCMode(size_t channel, size_t mode);

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

@@ -536,7 +578,7 @@ class Oscilloscope : public virtual Instrument
virtual std::vector<DigitalBank> GetDigitalBanks();

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