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. */
/*----------------------------------------------------------------------------*/
@@ -15,25 +16,23 @@
* Creates a digital input given a channel. Common creation routine for all
* constructors.
*/
void DigitalInput::InitDigitalInput(uint32_t channel)
{
m_table = NULL;
char buf[64];
void DigitalInput::InitDigitalInput(uint32_t channel) {
m_table = NULL;
char buf[64];
if (!CheckDigitalChannel(channel))
{
snprintf(buf, 64, "Digital Channel %d", channel);
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf);
return;
}
m_channel = channel;
if (!CheckDigitalChannel(channel)) {
snprintf(buf, 64, "Digital Channel %d", channel);
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf);
return;
}
m_channel = channel;
int32_t status = 0;
allocateDIO(m_digital_ports[channel], true, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
int32_t status = 0;
allocateDIO(m_digital_ports[channel], true, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
LiveWindow::GetInstance()->AddSensor("DigitalInput", channel, this);
HALReport(HALUsageReporting::kResourceType_DigitalInput, channel);
LiveWindow::GetInstance()->AddSensor("DigitalInput", channel, this);
HALReport(HALUsageReporting::kResourceType_DigitalInput, channel);
}
/**
@@ -42,98 +41,74 @@ void DigitalInput::InitDigitalInput(uint32_t channel)
*
* @param channel The DIO channel 0-9 are on-board, 10-25 are on the MXP port
*/
DigitalInput::DigitalInput(uint32_t channel)
{
InitDigitalInput(channel);
}
DigitalInput::DigitalInput(uint32_t channel) { InitDigitalInput(channel); }
/**
* Free resources associated with the Digital Input class.
*/
DigitalInput::~DigitalInput()
{
if (StatusIsFatal()) return;
if (m_interrupt != NULL)
{
int32_t status = 0;
cleanInterrupts(m_interrupt, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
m_interrupt = NULL;
m_interrupts->Free(m_interruptIndex);
}
DigitalInput::~DigitalInput() {
if (StatusIsFatal()) return;
if (m_interrupt != NULL) {
int32_t status = 0;
cleanInterrupts(m_interrupt, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
m_interrupt = NULL;
m_interrupts->Free(m_interruptIndex);
}
int32_t status = 0;
freeDIO(m_digital_ports[m_channel], &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
int32_t status = 0;
freeDIO(m_digital_ports[m_channel], &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
}
/**
* Get the value from a digital input channel.
* Retrieve the value of a single digital input channel from the FPGA.
*/
bool DigitalInput::Get() const
{
int32_t status = 0;
bool value = getDIO(m_digital_ports[m_channel], &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
return value;
bool DigitalInput::Get() const {
int32_t status = 0;
bool value = getDIO(m_digital_ports[m_channel], &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
return value;
}
/**
* @return The GPIO channel number that this object represents.
*/
uint32_t DigitalInput::GetChannel() const
{
return m_channel;
}
uint32_t DigitalInput::GetChannel() const { return m_channel; }
/**
* @return The value to be written to the channel field of a routing mux.
*/
uint32_t DigitalInput::GetChannelForRouting() const
{
return GetChannel();
}
uint32_t DigitalInput::GetChannelForRouting() const { return GetChannel(); }
/**
* @return The value to be written to the module field of a routing mux.
*/
uint32_t DigitalInput::GetModuleForRouting() const
{
return 0;
}
uint32_t DigitalInput::GetModuleForRouting() const { return 0; }
/**
* @return The value to be written to the analog trigger field of a routing mux.
*/
bool DigitalInput::GetAnalogTriggerForRouting() const
{
return false;
}
bool DigitalInput::GetAnalogTriggerForRouting() const { return false; }
void DigitalInput::UpdateTable() {
if (m_table != NULL) {
m_table->PutBoolean("Value", Get());
}
if (m_table != NULL) {
m_table->PutBoolean("Value", Get());
}
}
void DigitalInput::StartLiveWindowMode() {
void DigitalInput::StartLiveWindowMode() {}
}
void DigitalInput::StopLiveWindowMode() {
}
void DigitalInput::StopLiveWindowMode() {}
std::string DigitalInput::GetSmartDashboardType() const {
return "DigitalInput";
return "DigitalInput";
}
void DigitalInput::InitTable(ITable *subTable) {
m_table = subTable;
UpdateTable();
m_table = subTable;
UpdateTable();
}
ITable * DigitalInput::GetTable() const {
return m_table;
}
ITable *DigitalInput::GetTable() const { return m_table; }