Skip to content

Commit cc7e002

Browse files
committed
Added doxygen comments to UartTrigger
1 parent 631bd3c commit cc7e002

File tree

2 files changed

+85
-8
lines changed

2 files changed

+85
-8
lines changed

scopehal/UartTrigger.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/***********************************************************************************************************************
22
* *
3-
* libscopehal v0.1 *
3+
* libscopehal *
44
* *
5-
* Copyright (c) 2012-2023 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -27,6 +27,13 @@
2727
* *
2828
***********************************************************************************************************************/
2929

30+
/**
31+
@file
32+
@author Andrew D. Zonenberg
33+
@brief Implementation of UartTrigger
34+
@ingroup triggers
35+
*/
36+
3037
#include "scopehal.h"
3138
#include "UartTrigger.h"
3239
#include "SiglentSCPIOscilloscope.h"
@@ -36,6 +43,11 @@ using namespace std;
3643
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3744
// Construction / destruction
3845

46+
/**
47+
@brief Creates a new UART trigger
48+
49+
@param scope Scope to create the trigger for
50+
*/
3951
UartTrigger::UartTrigger(Oscilloscope* scope)
4052
: SerialTrigger(scope)
4153
{
@@ -78,6 +90,7 @@ UartTrigger::~UartTrigger()
7890
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7991
// Accessors
8092

93+
///@brief Returns the trigger name "UART"
8194
string UartTrigger::GetTriggerName()
8295
{
8396
return "UART";

scopehal/UartTrigger.h

Lines changed: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/***********************************************************************************************************************
22
* *
3-
* libscopehal v0.1 *
3+
* libscopehal *
44
* *
5-
* Copyright (c) 2012-2021 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -31,6 +31,7 @@
3131
@file
3232
@author Andrew D. Zonenberg
3333
@brief Declaration of UartTrigger
34+
@ingroup triggers
3435
*/
3536
#ifndef UartTrigger_h
3637
#define UartTrigger_h
@@ -49,63 +50,116 @@
4950

5051
/**
5152
@brief Trigger when a UART sees a certain data pattern
53+
@ingroup triggers
5254
*/
5355
class UartTrigger : public SerialTrigger
5456
{
5557
public:
5658
UartTrigger(Oscilloscope* scope);
5759
virtual ~UartTrigger();
5860

61+
///@brief Type of parity to use
5962
enum ParityType
6063
{
64+
///@brief No parity
6165
PARITY_NONE,
66+
67+
///@brief Odd parity
6268
PARITY_ODD,
69+
70+
///@brief Even parity
6371
PARITY_EVEN,
64-
PARITY_MARK,
65-
PARITY_SPACE
72+
73+
///@brief Mark parity
74+
PARITY_MARK,
75+
76+
///@brief Space parity
77+
PARITY_SPACE
6678
};
6779

80+
/**
81+
@brief Set the parity for the trigger
82+
83+
@param type Selected parity mode
84+
*/
6885
void SetParityType(ParityType type)
6986
{ m_parameters[m_ptypename].SetIntVal(type); }
7087

88+
///@brief Get the currently selected parity mode
7189
ParityType GetParityType()
7290
{ return (ParityType) m_parameters[m_ptypename].GetIntVal(); }
7391

92+
///@brief What kind of pattern to match
7493
enum MatchType
7594
{
95+
///@brief Match on a data byte
7696
TYPE_DATA,
97+
98+
///@brief Match on a parity error
7799
TYPE_PARITY_ERR,
78-
TYPE_START,
79-
TYPE_STOP
100+
101+
///@brief Match on a start bit
102+
TYPE_START,
103+
104+
///@brief Match on a stop bit
105+
TYPE_STOP
80106
};
81107

108+
/**
109+
@brief Sets the match mode for the trigger
110+
111+
@param type Type of pattern to look for
112+
*/
82113
void SetMatchType(MatchType type)
83114
{ m_parameters[m_typename].SetIntVal(type); }
84115

116+
///@brief Returns the currently selected match mode
85117
MatchType GetMatchType()
86118
{ return (MatchType) m_parameters[m_typename].GetIntVal(); }
87119

120+
///@brief Polarity of the port
88121
enum Polarity
89122
{
123+
///@brief Idle high, pull low to send a bit
90124
IDLE_HIGH,
125+
126+
///@brief Idle low, pull high to send a bit
91127
IDLE_LOW
92128
};
93129

130+
/**
131+
@brief Sets the UART polarity
132+
133+
@param type Desired polarity
134+
*/
94135
void SetPolarity(Polarity type)
95136
{ m_parameters[m_polarname].SetIntVal(type); }
96137

138+
///@brief Get the current trigger polarity
97139
Polarity GetPolarity()
98140
{ return (Polarity) m_parameters[m_polarname].GetIntVal(); }
99141

142+
///@brief Get the current baud rate
100143
int64_t GetBitRate()
101144
{ return m_parameters[m_baudname].GetIntVal(); }
102145

146+
/**
147+
@brief Sets the baud rate
148+
149+
@param t Desired baud rate
150+
*/
103151
void SetBitRate(int64_t t)
104152
{ m_parameters[m_baudname].SetIntVal(t); }
105153

154+
///@brief Get the length of the stop bit, in UI
106155
float GetStopBits()
107156
{ return m_parameters[m_stopname].GetFloatVal(); }
108157

158+
/**
159+
@brief Set the length of the stop bit
160+
161+
@param n Length of the stop bit, in UI
162+
*/
109163
void SetStopBits(float n)
110164
{ m_parameters[m_stopname].SetFloatVal(n); }
111165

@@ -115,10 +169,20 @@ class UartTrigger : public SerialTrigger
115169
TRIGGER_INITPROC(UartTrigger);
116170

117171
protected:
172+
173+
///@brief Name of the "baud rate" parameter
118174
std::string m_baudname;
175+
176+
///@brief Name of the "parity type" parameter
119177
std::string m_ptypename;
178+
179+
///@brief Name of the "match type" parameter
120180
std::string m_typename;
181+
182+
///@brief Name of the "stop bits" parameter
121183
std::string m_stopname;
184+
185+
///@brief Name of the "polarity" parameter
122186
std::string m_polarname;
123187
};
124188

0 commit comments

Comments
 (0)