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:
Tyler Veness
2018-05-31 20:47:15 -07:00
committed by Peter Johnson
parent d9971a705a
commit 8c680a26f8
234 changed files with 9936 additions and 9309 deletions

View File

@@ -13,14 +13,6 @@
using namespace frc;
/**
* Constructor.
*
* @param pwmChannel The PWM channel that the Nidec Brushless controller is
* attached to. 0-9 are on-board, 10-19 are on the MXP port.
* @param dioChannel The DIO channel that the Nidec Brushless controller is
* attached to. 0-9 are on-board, 10-25 are on the MXP port.
*/
NidecBrushless::NidecBrushless(int pwmChannel, int dioChannel)
: m_safetyHelper(this), m_dio(dioChannel), m_pwm(pwmChannel) {
AddChild(&m_dio);
@@ -36,14 +28,6 @@ NidecBrushless::NidecBrushless(int pwmChannel, int dioChannel)
SetName("Nidec Brushless", pwmChannel);
}
/**
* Set the PWM value.
*
* The PWM value is set using a range of -1.0 to 1.0, appropriately scaling the
* value for the FPGA.
*
* @param speed The speed value between -1.0 and 1.0 to set.
*/
void NidecBrushless::Set(double speed) {
if (!m_disabled) {
m_speed = speed;
@@ -53,98 +37,49 @@ void NidecBrushless::Set(double speed) {
m_safetyHelper.Feed();
}
/**
* Get the recently set value of the PWM.
*
* @return The most recently set value for the PWM between -1.0 and 1.0.
*/
double NidecBrushless::Get() const { return m_speed; }
void NidecBrushless::SetInverted(bool isInverted) { m_isInverted = isInverted; }
bool NidecBrushless::GetInverted() const { return m_isInverted; }
/**
* Write out the PID value as seen in the PIDOutput base object.
*
* @param output Write out the PWM value as was found in the PIDController
*/
void NidecBrushless::PIDWrite(double output) { Set(output); }
/**
* Set the safety expiration time.
*
* @param timeout The timeout (in seconds) for this motor object
*/
void NidecBrushless::SetExpiration(double timeout) {
m_safetyHelper.SetExpiration(timeout);
}
/**
* Return the safety expiration time.
*
* @return The expiration time value.
*/
double NidecBrushless::GetExpiration() const {
return m_safetyHelper.GetExpiration();
}
/**
* Check if the motor is currently alive or stopped due to a timeout.
*
* @return a bool value that is true if the motor has NOT timed out and should
* still be running.
*/
bool NidecBrushless::IsAlive() const { return m_safetyHelper.IsAlive(); }
/**
* Stop the motor. This is called by the MotorSafetyHelper object when it has a
* timeout for this PWM and needs to stop it from running. Calling Set() will
* re-enable the motor.
*/
void NidecBrushless::StopMotor() {
m_dio.UpdateDutyCycle(0.5);
m_pwm.SetDisabled();
}
/**
* Check if motor safety is enabled.
*
* @return True if motor safety is enforced for this object
*/
bool NidecBrushless::IsSafetyEnabled() const {
return m_safetyHelper.IsSafetyEnabled();
}
void NidecBrushless::SetSafetyEnabled(bool enabled) {
m_safetyHelper.SetSafetyEnabled(enabled);
}
void NidecBrushless::GetDescription(wpi::raw_ostream& desc) const {
desc << "Nidec " << GetChannel();
}
/**
* Disable the motor. The Enable() function must be called to re-enable
* the motor.
*/
void NidecBrushless::Disable() {
m_disabled = true;
m_dio.UpdateDutyCycle(0.5);
m_pwm.SetDisabled();
}
/**
* Re-enable the motor after Disable() has been called. The Set()
* function must be called to set a new motor speed.
*/
void NidecBrushless::StopMotor() {
m_dio.UpdateDutyCycle(0.5);
m_pwm.SetDisabled();
}
void NidecBrushless::Enable() { m_disabled = false; }
/**
* Gets the channel number associated with the object.
*
* @return The channel number.
*/
void NidecBrushless::PIDWrite(double output) { Set(output); }
void NidecBrushless::SetExpiration(double timeout) {
m_safetyHelper.SetExpiration(timeout);
}
double NidecBrushless::GetExpiration() const {
return m_safetyHelper.GetExpiration();
}
bool NidecBrushless::IsAlive() const { return m_safetyHelper.IsAlive(); }
void NidecBrushless::SetSafetyEnabled(bool enabled) {
m_safetyHelper.SetSafetyEnabled(enabled);
}
bool NidecBrushless::IsSafetyEnabled() const {
return m_safetyHelper.IsSafetyEnabled();
}
void NidecBrushless::GetDescription(wpi::raw_ostream& desc) const {
desc << "Nidec " << GetChannel();
}
int NidecBrushless::GetChannel() const { return m_pwm.GetChannel(); }
void NidecBrushless::InitSendable(SendableBuilder& builder) {