Major formatting changes (breaks diffs). No code changes.

The changes made in this commit do not affect any actual code,
    they are purely aesthetic. I ran clang-format with google style
    over all .h/.cpp files in wpilibc that weren't in wpilibC++Sim
    or gtest, and the eclipse formatter over all of the Java files
    using the Google eclipse formatting configuration.

Change-Id: I9627bca0bc103c398ecc1c5ba17467193291ae63
This commit is contained in:
James Kuszmaul
2015-06-25 15:07:55 -04:00
parent bd64d9a7ef
commit 7eb8550bdb
470 changed files with 89798 additions and 77287 deletions

View File

@@ -1,5 +1,6 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Copyright (c) FIRST 2008. All Rights Reserved.
*/
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
@@ -12,57 +13,55 @@
/**
* Common function for initializing the accelerometer.
*/
void AnalogAccelerometer::InitAccelerometer()
{
m_table = NULL;
m_voltsPerG = 1.0;
m_zeroGVoltage = 2.5;
HALReport(HALUsageReporting::kResourceType_Accelerometer, m_AnalogInput->GetChannel());
LiveWindow::GetInstance()->AddSensor("Accelerometer", m_AnalogInput->GetChannel(), this);
void AnalogAccelerometer::InitAccelerometer() {
m_table = NULL;
m_voltsPerG = 1.0;
m_zeroGVoltage = 2.5;
HALReport(HALUsageReporting::kResourceType_Accelerometer,
m_AnalogInput->GetChannel());
LiveWindow::GetInstance()->AddSensor("Accelerometer",
m_AnalogInput->GetChannel(), this);
}
/**
* Create a new instance of an accelerometer.
* The constructor allocates desired analog input.
* @param channel The channel number for the analog input the accelerometer is connected to
* @param channel The channel number for the analog input the accelerometer is
* connected to
*/
AnalogAccelerometer::AnalogAccelerometer(int32_t channel)
{
m_AnalogInput = new AnalogInput(channel);
m_allocatedChannel = true;
InitAccelerometer();
AnalogAccelerometer::AnalogAccelerometer(int32_t channel) {
m_AnalogInput = new AnalogInput(channel);
m_allocatedChannel = true;
InitAccelerometer();
}
/**
* Create a new instance of Accelerometer from an existing AnalogInput.
* Make a new instance of accelerometer given an AnalogInput. This is particularly
* useful if the port is going to be read as an analog channel as well as through
* Make a new instance of accelerometer given an AnalogInput. This is
* particularly
* useful if the port is going to be read as an analog channel as well as
* through
* the Accelerometer class.
* @param channel The existing AnalogInput object for the analog input the accelerometer is connected to
* @param channel The existing AnalogInput object for the analog input the
* accelerometer is connected to
*/
AnalogAccelerometer::AnalogAccelerometer(AnalogInput *channel)
{
if (channel == NULL)
{
wpi_setWPIError(NullParameter);
}
else
{
m_AnalogInput = channel;
InitAccelerometer();
}
m_allocatedChannel = false;
AnalogAccelerometer::AnalogAccelerometer(AnalogInput *channel) {
if (channel == NULL) {
wpi_setWPIError(NullParameter);
} else {
m_AnalogInput = channel;
InitAccelerometer();
}
m_allocatedChannel = false;
}
/**
* Delete the analog components used for the accelerometer.
*/
AnalogAccelerometer::~AnalogAccelerometer()
{
if (m_allocatedChannel)
{
delete m_AnalogInput;
}
AnalogAccelerometer::~AnalogAccelerometer() {
if (m_allocatedChannel) {
delete m_AnalogInput;
}
}
/**
@@ -72,67 +71,58 @@ AnalogAccelerometer::~AnalogAccelerometer()
*
* @return The current acceleration of the sensor in Gs.
*/
float AnalogAccelerometer::GetAcceleration() const
{
return (m_AnalogInput->GetAverageVoltage() - m_zeroGVoltage) / m_voltsPerG;
float AnalogAccelerometer::GetAcceleration() const {
return (m_AnalogInput->GetAverageVoltage() - m_zeroGVoltage) / m_voltsPerG;
}
/**
* Set the accelerometer sensitivity.
*
* This sets the sensitivity of the accelerometer used for calculating the acceleration.
* The sensitivity varies by accelerometer model. There are constants defined for various models.
* This sets the sensitivity of the accelerometer used for calculating the
* acceleration.
* The sensitivity varies by accelerometer model. There are constants defined
* for various models.
*
* @param sensitivity The sensitivity of accelerometer in Volts per G.
*/
void AnalogAccelerometer::SetSensitivity(float sensitivity)
{
m_voltsPerG = sensitivity;
void AnalogAccelerometer::SetSensitivity(float sensitivity) {
m_voltsPerG = sensitivity;
}
/**
* Set the voltage that corresponds to 0 G.
*
* The zero G voltage varies by accelerometer model. There are constants defined for various models.
* The zero G voltage varies by accelerometer model. There are constants defined
* for various models.
*
* @param zero The zero G voltage.
*/
void AnalogAccelerometer::SetZero(float zero)
{
m_zeroGVoltage = zero;
}
void AnalogAccelerometer::SetZero(float zero) { m_zeroGVoltage = zero; }
/**
* Get the Acceleration for the PID Source parent.
*
* @return The current acceleration in Gs.
*/
double AnalogAccelerometer::PIDGet() const
{
return GetAcceleration();
}
double AnalogAccelerometer::PIDGet() const { return GetAcceleration(); }
void AnalogAccelerometer::UpdateTable() {
if (m_table != NULL) {
m_table->PutNumber("Value", GetAcceleration());
}
if (m_table != NULL) {
m_table->PutNumber("Value", GetAcceleration());
}
}
void AnalogAccelerometer::StartLiveWindowMode() {
}
void AnalogAccelerometer::StartLiveWindowMode() {}
void AnalogAccelerometer::StopLiveWindowMode() {
}
void AnalogAccelerometer::StopLiveWindowMode() {}
std::string AnalogAccelerometer::GetSmartDashboardType() const {
return "Accelerometer";
return "Accelerometer";
}
void AnalogAccelerometer::InitTable(ITable *subTable) {
m_table = subTable;
UpdateTable();
m_table = subTable;
UpdateTable();
}
ITable * AnalogAccelerometer::GetTable() const {
return m_table;
}
ITable *AnalogAccelerometer::GetTable() const { return m_table; }