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

Commits on Sep 14, 2020

  1. Copy the full SHA
    39ae34a View commit details
Showing with 119 additions and 7 deletions.
  1. +47 −0 scopehal/AgilentEdgeTrigger.cpp
  2. +59 −0 scopehal/AgilentEdgeTrigger.h
  3. +12 −7 scopehal/AgilentOscilloscope.cpp
  4. +1 −0 scopehal/CMakeLists.txt
47 changes: 47 additions & 0 deletions scopehal/AgilentEdgeTrigger.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/***********************************************************************************************************************
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2020 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
* following conditions are met: *
* *
* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other materials provided with the distribution. *
* *
* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
***********************************************************************************************************************/

#include "scopehal.h"
#include "AgilentEdgeTrigger.h"

using namespace std;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

AgilentEdgeTrigger::AgilentEdgeTrigger(Oscilloscope* scope)
: EdgeTrigger(scope)
{
m_parameters[m_typename].AddEnumValue("Alternating", EDGE_ALTERNATING);
}

AgilentEdgeTrigger::~AgilentEdgeTrigger()
{

}
59 changes: 59 additions & 0 deletions scopehal/AgilentEdgeTrigger.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/***********************************************************************************************************************
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2020 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
* following conditions are met: *
* *
* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other materials provided with the distribution. *
* *
* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
***********************************************************************************************************************/

/**
@file
@author Andrew D. Zonenberg
@brief Declaration of AgilentEdgeTrigger
*/
#ifndef AgilentEdgeTrigger_h
#define AgilentEdgeTrigger_h

#include "EdgeTrigger.h"

/**
@brief Edge trigger for Agilent oscilloscopes. Supports an "alternating" mode that seems unique to them.
*/
class AgilentEdgeTrigger : public EdgeTrigger
{
public:
AgilentEdgeTrigger(Oscilloscope* scope);
virtual ~AgilentEdgeTrigger();

enum AgilentEdgeType
{
EDGE_ALTERNATING = EDGE_ANY + 1 //trigger on rising edge, then falling, then rising, etc
};

void SetTypeExt(AgilentEdgeType type)
{ m_parameters[m_typename].SetIntVal(type); }
};

#endif

19 changes: 12 additions & 7 deletions scopehal/AgilentOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@

#include "scopehal.h"
#include "AgilentOscilloscope.h"
#include "EdgeTrigger.h"
#include "AgilentEdgeTrigger.h"

using namespace std;

@@ -694,16 +694,16 @@ void AgilentOscilloscope::PullTrigger()
void AgilentOscilloscope::PullEdgeTrigger()
{
//Clear out any triggers of the wrong type
if( (m_trigger != NULL) && (dynamic_cast<EdgeTrigger*>(m_trigger) != NULL) )
if( (m_trigger != NULL) && (dynamic_cast<AgilentEdgeTrigger*>(m_trigger) != NULL) )
{
delete m_trigger;
m_trigger = NULL;
}

//Create a new trigger if necessary
if(m_trigger == NULL)
m_trigger = new EdgeTrigger(this);
EdgeTrigger* et = dynamic_cast<EdgeTrigger*>(m_trigger);
m_trigger = new AgilentEdgeTrigger(this);
AgilentEdgeTrigger* et = dynamic_cast<AgilentEdgeTrigger*>(m_trigger);

lock_guard<recursive_mutex> lock(m_mutex);

@@ -729,8 +729,8 @@ void AgilentOscilloscope::PullEdgeTrigger()
et->SetType(EdgeTrigger::EDGE_FALLING);
else if (reply == "EITH")
et->SetType(EdgeTrigger::EDGE_ANY);

// TODO: support "ALT" when the API allows
else if (reply == "ALT")
et->SetTypeExt(AgilentEdgeTrigger::EDGE_ALTERNATING);
}

void AgilentOscilloscope::PushTrigger()
@@ -759,7 +759,7 @@ void AgilentOscilloscope::PushEdgeTrigger(EdgeTrigger* trig)
m_transport->SendCommand(tmp);

//Slope
switch(trig->GetType())
switch((int)trig->GetType())
{
case EdgeTrigger::EDGE_RISING:
m_transport->SendCommand("TRIG:SLOPE POS");
@@ -770,6 +770,11 @@ void AgilentOscilloscope::PushEdgeTrigger(EdgeTrigger* trig)
case EdgeTrigger::EDGE_ANY:
m_transport->SendCommand("TRIG:SLOPE EITH");
break;

case AgilentEdgeTrigger::EDGE_ALTERNATING:
m_transport->SendCommand("TRIG:SLOPE ALT");
break;

default:
return;
}
1 change: 1 addition & 0 deletions scopehal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ set(SCOPEHAL_SOURCES
FlowGraphNode.cpp
Trigger.cpp
EdgeTrigger.cpp
AgilentEdgeTrigger.cpp

Instrument.cpp
FunctionGenerator.cpp