mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +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
@@ -19,14 +19,6 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Create an instance of a digital output.
|
||||
*
|
||||
* Create a digital output given a channel.
|
||||
*
|
||||
* @param channel The digital channel 0-9 are on-board, 10-25 are on the MXP
|
||||
* port
|
||||
*/
|
||||
DigitalOutput::DigitalOutput(int channel) {
|
||||
m_pwmGenerator = HAL_kInvalidHandle;
|
||||
if (!SensorUtil::CheckDigitalChannel(channel)) {
|
||||
@@ -51,9 +43,6 @@ DigitalOutput::DigitalOutput(int channel) {
|
||||
SetName("DigitalOutput", channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Free the resources associated with a digital output.
|
||||
*/
|
||||
DigitalOutput::~DigitalOutput() {
|
||||
if (StatusIsFatal()) return;
|
||||
// Disable the PWM in case it was running.
|
||||
@@ -62,13 +51,6 @@ DigitalOutput::~DigitalOutput() {
|
||||
HAL_FreeDIOPort(m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of a digital output.
|
||||
*
|
||||
* Set the value of a digital output to either one (true) or zero (false).
|
||||
*
|
||||
* @param value 1 (true) for high, 0 (false) for disabled
|
||||
*/
|
||||
void DigitalOutput::Set(bool value) {
|
||||
if (StatusIsFatal()) return;
|
||||
|
||||
@@ -77,11 +59,6 @@ void DigitalOutput::Set(bool value) {
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value being output from the Digital Output.
|
||||
*
|
||||
* @return the state of the digital output.
|
||||
*/
|
||||
bool DigitalOutput::Get() const {
|
||||
if (StatusIsFatal()) return false;
|
||||
|
||||
@@ -91,19 +68,8 @@ bool DigitalOutput::Get() const {
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The GPIO channel number that this object represents.
|
||||
*/
|
||||
int DigitalOutput::GetChannel() const { return m_channel; }
|
||||
|
||||
/**
|
||||
* Output a single pulse on the digital output line.
|
||||
*
|
||||
* Send a single pulse on the digital output line where the pulse duration is
|
||||
* specified in seconds. Maximum pulse length is 0.0016 seconds.
|
||||
*
|
||||
* @param length The pulse length in seconds
|
||||
*/
|
||||
void DigitalOutput::Pulse(double length) {
|
||||
if (StatusIsFatal()) return;
|
||||
|
||||
@@ -112,11 +78,6 @@ void DigitalOutput::Pulse(double length) {
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the pulse is still going.
|
||||
*
|
||||
* Determine if a previously started pulse is still going.
|
||||
*/
|
||||
bool DigitalOutput::IsPulsing() const {
|
||||
if (StatusIsFatal()) return false;
|
||||
|
||||
@@ -126,16 +87,6 @@ bool DigitalOutput::IsPulsing() const {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the PWM frequency of the PWM output on a Digital Output line.
|
||||
*
|
||||
* The valid range is from 0.6 Hz to 19 kHz. The frequency resolution is
|
||||
* logarithmic.
|
||||
*
|
||||
* There is only one PWM frequency for all digital channels.
|
||||
*
|
||||
* @param rate The frequency to output all digital output PWM signals.
|
||||
*/
|
||||
void DigitalOutput::SetPWMRate(double rate) {
|
||||
if (StatusIsFatal()) return;
|
||||
|
||||
@@ -144,19 +95,6 @@ void DigitalOutput::SetPWMRate(double rate) {
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable a PWM Output on this line.
|
||||
*
|
||||
* Allocate one of the 6 DO PWM generator resources from this module.
|
||||
*
|
||||
* Supply the initial duty-cycle to output so as to avoid a glitch when first
|
||||
* starting.
|
||||
*
|
||||
* The resolution of the duty cycle is 8-bit for low frequencies (1kHz or less)
|
||||
* but is reduced the higher the frequency of the PWM signal is.
|
||||
*
|
||||
* @param initialDutyCycle The duty-cycle to start generating. [0..1]
|
||||
*/
|
||||
void DigitalOutput::EnablePWM(double initialDutyCycle) {
|
||||
if (m_pwmGenerator != HAL_kInvalidHandle) return;
|
||||
|
||||
@@ -175,11 +113,6 @@ void DigitalOutput::EnablePWM(double initialDutyCycle) {
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
/**
|
||||
* Change this line from a PWM output back to a static Digital Output line.
|
||||
*
|
||||
* Free up one of the 6 DO PWM generator resources that were in use.
|
||||
*/
|
||||
void DigitalOutput::DisablePWM() {
|
||||
if (StatusIsFatal()) return;
|
||||
if (m_pwmGenerator == HAL_kInvalidHandle) return;
|
||||
@@ -197,14 +130,6 @@ void DigitalOutput::DisablePWM() {
|
||||
m_pwmGenerator = HAL_kInvalidHandle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the duty-cycle that is being generated on the line.
|
||||
*
|
||||
* The resolution of the duty cycle is 8-bit for low frequencies (1kHz or less)
|
||||
* but is reduced the higher the frequency of the PWM signal is.
|
||||
*
|
||||
* @param dutyCycle The duty-cycle to change to. [0..1]
|
||||
*/
|
||||
void DigitalOutput::UpdateDutyCycle(double dutyCycle) {
|
||||
if (StatusIsFatal()) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user