Skip to content

Commit 7fae672

Browse files
committed
AgilentOscilloscope: finished adding Doxygen comments
1 parent 8a29a06 commit 7fae672

File tree

2 files changed

+141
-8
lines changed

2 files changed

+141
-8
lines changed

scopehal/AgilentOscilloscope.cpp

Lines changed: 113 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ AgilentOscilloscope::~AgilentOscilloscope()
178178
{
179179
}
180180

181+
/**
182+
@brief Set up the operating mode for a channel
183+
184+
@param channel The channel to configure
185+
*/
181186
void AgilentOscilloscope::ConfigureWaveform(string channel)
182187
{
183188
//Select the channel to apply settings to
@@ -194,6 +199,7 @@ void AgilentOscilloscope::ConfigureWaveform(string channel)
194199
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
195200
// Accessors
196201

202+
///@brief Return the constant driver name "agilent".
197203
string AgilentOscilloscope::GetDriverNameInternal()
198204
{
199205
return "agilent";
@@ -231,16 +237,39 @@ void AgilentOscilloscope::FlushConfigCache()
231237
m_trigger = NULL;
232238
}
233239

240+
/**
241+
@brief Check if a channel is analog
242+
243+
@param i Channel index
244+
245+
@return True if analog, false if digital
246+
*/
234247
bool AgilentOscilloscope::IsAnalogChannel(size_t i)
235248
{
236249
return GetOscilloscopeChannel(i)->GetType(0) == Stream::STREAM_TYPE_ANALOG;
237250
}
238251

239-
size_t AgilentOscilloscope::GetDigitalPodIndex(size_t i) {
252+
/**
253+
@brief Get the digital pod number given a channel number
254+
255+
@param i Channel index
256+
257+
@return Pod number
258+
*/
259+
size_t AgilentOscilloscope::GetDigitalPodIndex(size_t i)
260+
{
240261
return ((i - m_digitalChannelBase) / 8) + 1;
241262
}
242263

243-
std::string AgilentOscilloscope::GetDigitalPodName(size_t i) {
264+
/**
265+
@brief Get the digital pod name given a channel number
266+
267+
@param i Channel index
268+
269+
@return Pod name
270+
*/
271+
std::string AgilentOscilloscope::GetDigitalPodName(size_t i)
272+
{
244273
return "POD" + to_string(GetDigitalPodIndex(i));
245274
}
246275

@@ -561,6 +590,13 @@ Oscilloscope::TriggerMode AgilentOscilloscope::PollTrigger()
561590
}
562591
}
563592

593+
/**
594+
@brief Download waveform data from a single channel
595+
596+
@param channel Name of the channel
597+
598+
@return Raw waveform data
599+
*/
564600
vector<uint8_t> AgilentOscilloscope::GetWaveformData(string channel)
565601
{
566602
lock_guard<recursive_mutex> lock(m_mutex);
@@ -586,6 +622,13 @@ vector<uint8_t> AgilentOscilloscope::GetWaveformData(string channel)
586622
return buf;
587623
}
588624

625+
/**
626+
@brief Get the waveform preamble for a single channel
627+
628+
@param channel Name of the channel
629+
630+
@return Preamble data
631+
*/
589632
AgilentOscilloscope::WaveformPreamble AgilentOscilloscope::GetWaveformPreamble(string channel)
590633
{
591634
WaveformPreamble ret;
@@ -602,9 +645,18 @@ AgilentOscilloscope::WaveformPreamble AgilentOscilloscope::GetWaveformPreamble(s
602645
return ret;
603646
}
604647

648+
/**
649+
@brief Convert raw data from a digital pod into waveform objects
650+
651+
@param[out] pending_waveforms Resulting digital waveforms
652+
@param[in] data The raw sample data
653+
@param[in] preamble Preamble of the waveform
654+
@param chan_start Index of the first channel in the pod
655+
*/
605656
void AgilentOscilloscope::ProcessDigitalWaveforms(
606657
map<int, vector<WaveformBase*>> &pending_waveforms,
607-
vector<uint8_t> &data, AgilentOscilloscope::WaveformPreamble &preamble,
658+
vector<uint8_t> &data,
659+
AgilentOscilloscope::WaveformPreamble &preamble,
608660
size_t chan_start)
609661
{
610662
for (int i = 0; i < 8; i++)
@@ -797,7 +849,8 @@ bool AgilentOscilloscope::IsTriggerArmed()
797849
return m_triggerArmed;
798850
}
799851

800-
static std::map<uint64_t, double> sampleRateToDuration {
852+
static std::map<uint64_t, double> sampleRateToDuration
853+
{
801854
// Map sample rates to corresponding maximum on-screen time duration setting
802855
{8000 , 500},
803856
{20000 , 200},
@@ -896,6 +949,12 @@ uint64_t AgilentOscilloscope::GetSampleDepth()
896949
return depth;
897950
}
898951

952+
/**
953+
@brief Simultaneously set sample rate and memory depth
954+
955+
@param rate Sample rate, in samples per second
956+
@param depth Acquisition memory depth
957+
*/
899958
void AgilentOscilloscope::SetSampleRateAndDepth(uint64_t rate, uint64_t depth)
900959
{
901960
// Look up the maximum capture duration for the requested sample rate
@@ -1024,6 +1083,9 @@ void AgilentOscilloscope::PullEdgeTrigger()
10241083
GetTriggerSlope(et, m_transport->ReadReply());
10251084
}
10261085

1086+
/**
1087+
@brief Reads settings for an Nth-edge-burst trigger from the instrument
1088+
*/
10271089
void AgilentOscilloscope::PullNthEdgeBurstTrigger()
10281090
{
10291091
//Clear out any triggers of the wrong type
@@ -1065,6 +1127,9 @@ void AgilentOscilloscope::PullNthEdgeBurstTrigger()
10651127
bt->SetEdgeNumber(stoi(m_transport->ReadReply()));
10661128
}
10671129

1130+
/**
1131+
@brief Reads settings for a pulse width trigger from the instrument
1132+
*/
10681133
void AgilentOscilloscope::PullPulseWidthTrigger()
10691134
{
10701135
//Clear out any triggers of the wrong type
@@ -1135,6 +1200,9 @@ void AgilentOscilloscope::PullPulseWidthTrigger()
11351200

11361201
/**
11371202
@brief Processes the slope for an edge or edge-derived trigger
1203+
1204+
@param trig Trigger to configure
1205+
@param reply Response from the instrument
11381206
*/
11391207
void AgilentOscilloscope::GetTriggerSlope(EdgeTrigger* trig, string reply)
11401208
{
@@ -1152,6 +1220,9 @@ void AgilentOscilloscope::GetTriggerSlope(EdgeTrigger* trig, string reply)
11521220

11531221
/**
11541222
@brief Processes the slope for an Nth edge burst trigger
1223+
1224+
@param trig Trigger to configure
1225+
@param reply Response from the instrument
11551226
*/
11561227
void AgilentOscilloscope::GetTriggerSlope(NthEdgeBurstTrigger* trig, string reply)
11571228
{
@@ -1164,7 +1235,9 @@ void AgilentOscilloscope::GetTriggerSlope(NthEdgeBurstTrigger* trig, string repl
11641235
}
11651236

11661237
/**
1167-
@brief Parses a trigger condition
1238+
@brief Converts a trigger condition from a string to a Trigger::Condition
1239+
1240+
@param reply Response from the instrument
11681241
*/
11691242
Trigger::Condition AgilentOscilloscope::GetCondition(string reply)
11701243
{
@@ -1181,6 +1254,11 @@ Trigger::Condition AgilentOscilloscope::GetCondition(string reply)
11811254
return Trigger::CONDITION_LESS;
11821255
}
11831256

1257+
/**
1258+
@brief Figures out what kind of probe is connected to a channel
1259+
1260+
@param i Channel index
1261+
*/
11841262
void AgilentOscilloscope::GetProbeType(size_t i)
11851263
{
11861264
{
@@ -1224,6 +1302,8 @@ void AgilentOscilloscope::PushTrigger()
12241302

12251303
/**
12261304
@brief Pushes settings for an edge trigger to the instrument
1305+
1306+
@param trig The trigger
12271307
*/
12281308
void AgilentOscilloscope::PushEdgeTrigger(EdgeTrigger* trig)
12291309
{
@@ -1244,6 +1324,8 @@ void AgilentOscilloscope::PushEdgeTrigger(EdgeTrigger* trig)
12441324

12451325
/**
12461326
@brief Pushes settings for a Nth edge burst trigger to the instrument
1327+
1328+
@param trig The trigger
12471329
*/
12481330
void AgilentOscilloscope::PushNthEdgeBurstTrigger(NthEdgeBurstTrigger* trig)
12491331
{
@@ -1260,6 +1342,8 @@ void AgilentOscilloscope::PushNthEdgeBurstTrigger(NthEdgeBurstTrigger* trig)
12601342

12611343
/**
12621344
@brief Pushes settings for a pulse width trigger to the instrument
1345+
1346+
@param trig The trigger
12631347
*/
12641348
void AgilentOscilloscope::PushPulseWidthTrigger(PulseWidthTrigger* trig)
12651349
{
@@ -1285,6 +1369,12 @@ void AgilentOscilloscope::PushPulseWidthTrigger(PulseWidthTrigger* trig)
12851369
}
12861370
}
12871371

1372+
/**
1373+
@brief Send a trigger condition to the instrument
1374+
1375+
@param path SCPI path of the parameter to set
1376+
@param cond Trigger condition
1377+
*/
12881378
void AgilentOscilloscope::PushCondition(string path, Trigger::Condition cond)
12891379
{
12901380
string cond_str;
@@ -1305,11 +1395,23 @@ void AgilentOscilloscope::PushCondition(string path, Trigger::Condition cond)
13051395
m_transport->SendCommand(path + " " + cond_str);
13061396
}
13071397

1398+
/**
1399+
@brief Send a floating-point value to the instrument
1400+
1401+
@param path SCPI path of the parameter to set
1402+
@param f The value to send
1403+
*/
13081404
void AgilentOscilloscope::PushFloat(string path, float f)
13091405
{
13101406
m_transport->SendCommand(path + " " + to_string_sci(f));
13111407
}
13121408

1409+
/**
1410+
@brief Send a trigger slope to the instrument
1411+
1412+
@param path SCPI path of the parameter to set
1413+
@param slope The desired slope
1414+
*/
13131415
void AgilentOscilloscope::PushSlope(string path, EdgeTrigger::EdgeType slope)
13141416
{
13151417
string slope_str;
@@ -1333,6 +1435,12 @@ void AgilentOscilloscope::PushSlope(string path, EdgeTrigger::EdgeType slope)
13331435
m_transport->SendCommand(path + " " + slope_str);
13341436
}
13351437

1438+
/**
1439+
@brief Send a trigger slope to the instrument
1440+
1441+
@param path SCPI path of the parameter to set
1442+
@param slope The desired slope
1443+
*/
13361444
void AgilentOscilloscope::PushSlope(string path, NthEdgeBurstTrigger::EdgeType slope)
13371445
{
13381446
string slope_str;

scopehal/AgilentOscilloscope.h

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,43 @@ class AgilentOscilloscope : public virtual SCPIOscilloscope
132132
SmartProbe
133133
};
134134

135-
//config cache
135+
///@brief Map of channel ID to offset
136136
std::map<size_t, float> m_channelOffsets;
137+
138+
///@brief Map of channel ID to voltage range
137139
std::map<size_t, float> m_channelVoltageRanges;
140+
141+
///@brief Map of channel ID to voltage range
138142
std::map<size_t, OscilloscopeChannel::CouplingType> m_channelCouplings;
143+
144+
///@brief Map of channel ID to attenuation
139145
std::map<size_t, double> m_channelAttenuations;
146+
147+
///@brief Map of channel ID to bandwidth limit
140148
std::map<size_t, int> m_channelBandwidthLimits;
149+
150+
///@brief Map of channel ID to enable flag
141151
std::map<int, bool> m_channelsEnabled;
152+
153+
///@brief Map of channel ID to probe type
142154
std::map<size_t, ProbeType> m_probeTypes;
143155

156+
///@brief True if m_sampleDepth is valid, false if not
144157
bool m_sampleDepthValid;
158+
159+
///@brief Acquisition memory depth
145160
uint64_t m_sampleDepth;
161+
162+
///@brief True if m_sampleRate is valid, false if not
146163
bool m_sampleRateValid;
164+
165+
///@brief Acquisition sample rate
147166
uint64_t m_sampleRate;
148167

168+
///@brief True if trigger is armed, false if idle
149169
bool m_triggerArmed;
170+
171+
///@brief True if trigger is one-shot (single or forced), false if idle
150172
bool m_triggerOneShot;
151173

152174
void PullEdgeTrigger();
@@ -167,9 +189,13 @@ class AgilentOscilloscope : public virtual SCPIOscilloscope
167189
void PushSlope(std::string path, NthEdgeBurstTrigger::EdgeType slope);
168190

169191
private:
192+
193+
///@brief Map of sample rates to maximum on-screen record length
170194
static std::map<uint64_t, uint64_t> m_sampleRateToDuration;
171195

172-
struct WaveformPreamble {
196+
///@brief Preamble of a waveform
197+
struct WaveformPreamble
198+
{
173199
unsigned int format;
174200
unsigned int type;
175201
size_t length;
@@ -194,7 +220,6 @@ class AgilentOscilloscope : public virtual SCPIOscilloscope
194220
size_t chan_start);
195221
void SetSampleRateAndDepth(uint64_t rate, uint64_t depth);
196222

197-
198223
public:
199224
static std::string GetDriverNameInternal();
200225
OSCILLOSCOPE_INITPROC(AgilentOscilloscope)

0 commit comments

Comments
 (0)