mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Moved C++ comments from source files to headers (#1111)
Also sorted functions in C++ sources to match order in related headers.
This commit is contained in:
committed by
Peter Johnson
parent
d9971a705a
commit
8c680a26f8
@@ -18,13 +18,6 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Construct an analog output on the given channel.
|
||||
*
|
||||
* All analog outputs are located on the MXP port.
|
||||
*
|
||||
* @param channel The channel number on the roboRIO to represent.
|
||||
*/
|
||||
AnalogOutput::AnalogOutput(int channel) {
|
||||
if (!SensorUtil::CheckAnalogOutputChannel(channel)) {
|
||||
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange,
|
||||
@@ -51,23 +44,8 @@ AnalogOutput::AnalogOutput(int channel) {
|
||||
SetName("AnalogOutput", m_channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*
|
||||
* Frees analog output resource.
|
||||
*/
|
||||
AnalogOutput::~AnalogOutput() { HAL_FreeAnalogOutputPort(m_port); }
|
||||
|
||||
/**
|
||||
* Get the channel of this AnalogOutput.
|
||||
*/
|
||||
int AnalogOutput::GetChannel() { return m_channel; }
|
||||
|
||||
/**
|
||||
* Set the value of the analog output.
|
||||
*
|
||||
* @param voltage The output value in Volts, from 0.0 to +5.0
|
||||
*/
|
||||
void AnalogOutput::SetVoltage(double voltage) {
|
||||
int32_t status = 0;
|
||||
HAL_SetAnalogOutput(m_port, voltage, &status);
|
||||
@@ -75,11 +53,6 @@ void AnalogOutput::SetVoltage(double voltage) {
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the voltage of the analog output
|
||||
*
|
||||
* @return The value in Volts, from 0.0 to +5.0
|
||||
*/
|
||||
double AnalogOutput::GetVoltage() const {
|
||||
int32_t status = 0;
|
||||
double voltage = HAL_GetAnalogOutput(m_port, &status);
|
||||
@@ -89,6 +62,8 @@ double AnalogOutput::GetVoltage() const {
|
||||
return voltage;
|
||||
}
|
||||
|
||||
int AnalogOutput::GetChannel() { return m_channel; }
|
||||
|
||||
void AnalogOutput::InitSendable(SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Analog Output");
|
||||
builder.AddDoubleProperty("Value", [=]() { return GetVoltage(); },
|
||||
|
||||
Reference in New Issue
Block a user