ngscopeclient v0.1-rc1
SiglentFunctionGenerator.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
4* *
5* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
6* All rights reserved. *
7* *
8* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
9* following conditions are met: *
10* *
11* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
12* following disclaimer. *
13* *
14* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
15* following disclaimer in the documentation and/or other materials provided with the distribution. *
16* *
17* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
18* derived from this software without specific prior written permission. *
19* *
20* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
21* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
22* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
24* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
26* POSSIBILITY OF SUCH DAMAGE. *
27* *
28***********************************************************************************************************************/
29
37#ifndef SiglentFunctionGenerator_h
38#define SiglentFunctionGenerator_h
39
45{
46public:
49
50 //Device information
51 virtual unsigned int GetInstrumentTypes() const override;
52 virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override;
53
54 virtual bool AcquireData() override;
55
56 virtual void FlushConfigCache() override;
57
58 virtual std::vector<WaveShape> GetAvailableWaveformShapes(int chan) override;
59
60 virtual bool GetFunctionChannelActive(int chan) override;
61 virtual void SetFunctionChannelActive(int chan, bool on) override;
62
63 virtual float GetFunctionChannelDutyCycle(int chan) override;
64 virtual void SetFunctionChannelDutyCycle(int chan, float duty) override;
65
66 virtual float GetFunctionChannelAmplitude(int chan) override;
67 virtual void SetFunctionChannelAmplitude(int chan, float amplitude) override;
68
69 virtual float GetFunctionChannelOffset(int chan) override;
70 virtual void SetFunctionChannelOffset(int chan, float offset) override;
71
72 virtual float GetFunctionChannelFrequency(int chan) override;
73 virtual void SetFunctionChannelFrequency(int chan, float hz) override;
74
75 virtual WaveShape GetFunctionChannelShape(int chan) override;
76 virtual void SetFunctionChannelShape(int chan, WaveShape shape) override;
77
78 virtual bool HasFunctionRiseFallTimeControls(int chan) override;
79
80 virtual OutputImpedance GetFunctionChannelOutputImpedance(int chan) override;
81 virtual void SetFunctionChannelOutputImpedance(int chan, OutputImpedance z) override;
82
83public:
84 static std::string GetDriverNameInternal();
85 GENERATOR_INITPROC(SiglentFunctionGenerator)
86
87protected:
88
89 //Config cache
90 bool m_cachedFrequencyValid[2];
91 int64_t m_cachedFrequency[2];
92 bool m_cachedEnableStateValid[2];
93 bool m_cachedOutputEnable[2];
94 bool m_cachedAmplitudeValid[2];
95 float m_cachedAmplitude[2];
96 bool m_cachedOffsetValid[2];
97 float m_cachedOffset[2];
98 OutputImpedance m_cachedImpedance[2];
99 bool m_cachedImpedanceValid[2];
100
101 WaveShape m_cachedWaveShape[2];
102 bool m_cachedWaveShapeValid[2];
103
104 std::string RemoveHeader(const std::string& str);
105
106 void ParseOutputState(const std::string& str, size_t i);
107 void ParseBasicWaveform(const std::string& str, size_t i);
108};
109
110#endif
WaveShape
Predefined waveform shapes.
Definition: FunctionGenerator.h:55
OutputImpedance
Nominal output impedance for a function generator channel.
Definition: FunctionGenerator.h:259
An SCPI-based function generator.
Definition: SCPIFunctionGenerator.h:38
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47
A Siglent SDG function generator.
Definition: SiglentFunctionGenerator.h:45
virtual float GetFunctionChannelDutyCycle(int chan) override
Gets the duty cycle for a function generator output.
Definition: SiglentFunctionGenerator.cpp:507
virtual bool AcquireData() override
Pull data from the instrument.
Definition: SiglentFunctionGenerator.cpp:80
virtual WaveShape GetFunctionChannelShape(int chan) override
Gets the waveform shape for a function generator output.
Definition: SiglentFunctionGenerator.cpp:350
void ParseOutputState(const std::string &str, size_t i)
Parse the response to an OUTP? query.
Definition: SiglentFunctionGenerator.cpp:128
virtual void SetFunctionChannelOutputImpedance(int chan, OutputImpedance z) override
Sets the currently selected output impedance for a function generator output (if supported)
Definition: SiglentFunctionGenerator.cpp:544
virtual unsigned int GetInstrumentTypes() const override
Returns a bitfield describing the set of instrument types that this instrument supports.
Definition: SiglentFunctionGenerator.cpp:67
virtual void FlushConfigCache() override
Instruments are allowed to cache configuration settings to reduce round trip queries to the device.
Definition: SiglentFunctionGenerator.cpp:93
virtual float GetFunctionChannelOffset(int chan) override
Gets the DC offset for a function generator output.
Definition: SiglentFunctionGenerator.cpp:312
void ParseBasicWaveform(const std::string &str, size_t i)
Parse the response to a BSWV? query.
Definition: SiglentFunctionGenerator.cpp:153
virtual void SetFunctionChannelAmplitude(int chan, float amplitude) override
Sets the amplitude for a function generator output.
Definition: SiglentFunctionGenerator.cpp:304
virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override
Returns a bitfield describing the set of instrument types that a given channel supports.
Definition: SiglentFunctionGenerator.cpp:72
virtual float GetFunctionChannelFrequency(int chan) override
Gets the frequency for a function generator output.
Definition: SiglentFunctionGenerator.cpp:331
virtual bool HasFunctionRiseFallTimeControls(int chan) override
Determines if the function generator allows control over rise/fall times.
Definition: SiglentFunctionGenerator.cpp:528
virtual void SetFunctionChannelDutyCycle(int chan, float duty) override
Sets the duty cycle for a function generator output.
Definition: SiglentFunctionGenerator.cpp:516
virtual void SetFunctionChannelActive(int chan, bool on) override
Turns a function generator channel on or off.
Definition: SiglentFunctionGenerator.cpp:282
virtual bool GetFunctionChannelActive(int chan) override
Returns true if the function generator channel's output is enabled.
Definition: SiglentFunctionGenerator.cpp:271
virtual float GetFunctionChannelAmplitude(int chan) override
Gets the amplitude for a function generator output.
Definition: SiglentFunctionGenerator.cpp:293
virtual void SetFunctionChannelOffset(int chan, float offset) override
Sets the DC offset for a function generator output.
Definition: SiglentFunctionGenerator.cpp:323
virtual std::vector< WaveShape > GetAvailableWaveformShapes(int chan) override
Query the set of available pre-defined waveforms for this generator.
Definition: SiglentFunctionGenerator.cpp:233
virtual void SetFunctionChannelFrequency(int chan, float hz) override
Sets the frequency for a function generator output.
Definition: SiglentFunctionGenerator.cpp:342
virtual void SetFunctionChannelShape(int chan, WaveShape shape) override
Sets the waveform shape for a function generator output.
Definition: SiglentFunctionGenerator.cpp:363
virtual OutputImpedance GetFunctionChannelOutputImpedance(int chan) override
Gets the currently selected output impedance for a function generator output (if supported)
Definition: SiglentFunctionGenerator.cpp:533