Run clang-format on the entire repo
This patch clang-formats the entire repo. Third-party code is
excluded.
I needed to fix up the .clang-format file so that all the header
includes are ordered properly. I could have sworn that it used to work
without the extra modification, but I guess not.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I64bb9f2c795401393f9dfe2fefc4f04cb36b52f6
diff --git a/frc971/wpilib/ADIS16470.cc b/frc971/wpilib/ADIS16470.cc
index d43d2fb..95d5baf 100644
--- a/frc971/wpilib/ADIS16470.cc
+++ b/frc971/wpilib/ADIS16470.cc
@@ -2,9 +2,10 @@
#include <cinttypes>
+#include "glog/logging.h"
+
#include "aos/containers/sized_array.h"
#include "aos/time/time.h"
-#include "glog/logging.h"
#include "hal/HAL.h"
namespace frc971 {
diff --git a/frc971/wpilib/ahal/AnalogInput.cc b/frc971/wpilib/ahal/AnalogInput.cc
index 7482476..7574715 100644
--- a/frc971/wpilib/ahal/AnalogInput.cc
+++ b/frc971/wpilib/ahal/AnalogInput.cc
@@ -6,13 +6,13 @@
/*----------------------------------------------------------------------------*/
#include "frc971/wpilib/ahal/AnalogInput.h"
-#include "hal/AnalogInput.h"
#include <sstream>
+#include "frc971/wpilib/ahal/WPIErrors.h"
+#include "hal/AnalogInput.h"
#include "hal/HAL.h"
#include "hal/Ports.h"
-#include "frc971/wpilib/ahal/WPIErrors.h"
using namespace frc;
diff --git a/frc971/wpilib/ahal/AnalogInput.h b/frc971/wpilib/ahal/AnalogInput.h
index 4540bbe..c4a4e94 100644
--- a/frc971/wpilib/ahal/AnalogInput.h
+++ b/frc971/wpilib/ahal/AnalogInput.h
@@ -10,8 +10,8 @@
#include <memory>
#include <string>
-#include "hal/Types.h"
#include "frc971/wpilib/ahal/SensorBase.h"
+#include "hal/Types.h"
namespace frc {
diff --git a/frc971/wpilib/ahal/AnalogTrigger.cc b/frc971/wpilib/ahal/AnalogTrigger.cc
index bd63189..aeaf6ce 100644
--- a/frc971/wpilib/ahal/AnalogTrigger.cc
+++ b/frc971/wpilib/ahal/AnalogTrigger.cc
@@ -7,12 +7,12 @@
#include "frc971/wpilib/ahal/AnalogTrigger.h"
-#include <memory>
-#include <utility>
-
#include <hal/FRCUsageReporting.h>
#include <hal/HAL.h>
+#include <memory>
+#include <utility>
+
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/Base.h"
#include "frc971/wpilib/ahal/DutyCycle.h"
@@ -25,7 +25,7 @@
m_ownsAnalog = true;
}
-AnalogTrigger::AnalogTrigger(AnalogInput* input) {
+AnalogTrigger::AnalogTrigger(AnalogInput *input) {
m_analogInput = input;
int32_t status = 0;
m_trigger = HAL_InitializeAnalogTrigger(input->m_port, &status);
@@ -40,7 +40,7 @@
HAL_Report(HALUsageReporting::kResourceType_AnalogTrigger, index + 1);
}
-AnalogTrigger::AnalogTrigger(DutyCycle* input) {
+AnalogTrigger::AnalogTrigger(DutyCycle *input) {
m_dutyCycle = input;
int32_t status = 0;
m_trigger = HAL_InitializeAnalogTriggerDutyCycle(input->m_handle, &status);
@@ -72,7 +72,7 @@
std::swap(m_ownsAnalog, rhs.m_ownsAnalog);
}
-AnalogTrigger& AnalogTrigger::operator=(AnalogTrigger&& rhs) {
+AnalogTrigger &AnalogTrigger::operator=(AnalogTrigger &&rhs) {
m_trigger = std::move(rhs.m_trigger);
std::swap(m_analogInput, rhs.m_analogInput);
std::swap(m_dutyCycle, rhs.m_dutyCycle);
diff --git a/frc971/wpilib/ahal/AnalogTrigger.h b/frc971/wpilib/ahal/AnalogTrigger.h
index 9fad5db..fdc12de 100644
--- a/frc971/wpilib/ahal/AnalogTrigger.h
+++ b/frc971/wpilib/ahal/AnalogTrigger.h
@@ -7,10 +7,10 @@
#pragma once
-#include <memory>
-
#include <hal/Types.h>
+#include <memory>
+
#include "frc971/wpilib/ahal/AnalogTriggerOutput.h"
namespace frc {
@@ -24,13 +24,13 @@
public:
explicit AnalogTrigger(int channel);
- explicit AnalogTrigger(AnalogInput* channel);
- explicit AnalogTrigger(DutyCycle* dutyCycle);
+ explicit AnalogTrigger(AnalogInput *channel);
+ explicit AnalogTrigger(DutyCycle *dutyCycle);
virtual ~AnalogTrigger();
- AnalogTrigger(AnalogTrigger&& rhs);
- AnalogTrigger& operator=(AnalogTrigger&& rhs);
+ AnalogTrigger(AnalogTrigger &&rhs);
+ AnalogTrigger &operator=(AnalogTrigger &&rhs);
void SetLimitsVoltage(double lower, double upper);
@@ -55,8 +55,8 @@
private:
hal::Handle<HAL_AnalogTriggerHandle> m_trigger;
- AnalogInput* m_analogInput = nullptr;
- DutyCycle* m_dutyCycle = nullptr;
+ AnalogInput *m_analogInput = nullptr;
+ DutyCycle *m_dutyCycle = nullptr;
bool m_ownsAnalog = false;
};
diff --git a/frc971/wpilib/ahal/AnalogTriggerOutput.cc b/frc971/wpilib/ahal/AnalogTriggerOutput.cc
index 1bbef1b..cbe40ba 100644
--- a/frc971/wpilib/ahal/AnalogTriggerOutput.cc
+++ b/frc971/wpilib/ahal/AnalogTriggerOutput.cc
@@ -35,7 +35,7 @@
int AnalogTriggerOutput::GetChannel() const { return m_trigger->GetIndex(); }
-AnalogTriggerOutput::AnalogTriggerOutput(const AnalogTrigger& trigger,
+AnalogTriggerOutput::AnalogTriggerOutput(const AnalogTrigger &trigger,
AnalogTriggerType outputType)
: m_trigger(&trigger), m_outputType(outputType) {
HAL_Report(HALUsageReporting::kResourceType_AnalogTriggerOutput,
diff --git a/frc971/wpilib/ahal/AnalogTriggerOutput.h b/frc971/wpilib/ahal/AnalogTriggerOutput.h
index 8896f37..687d9de 100644
--- a/frc971/wpilib/ahal/AnalogTriggerOutput.h
+++ b/frc971/wpilib/ahal/AnalogTriggerOutput.h
@@ -7,8 +7,8 @@
#pragma once
-#include "hal/AnalogTrigger.h"
#include "frc971/wpilib/ahal/DigitalSource.h"
+#include "hal/AnalogTrigger.h"
namespace frc {
@@ -66,7 +66,7 @@
// Uses pointer rather than smart pointer because a user can not construct
// an AnalogTriggerOutput themselves and because the AnalogTriggerOutput
// should always be in scope at the same time as an AnalogTrigger.
- const AnalogTrigger* m_trigger;
+ const AnalogTrigger *m_trigger;
AnalogTriggerType m_outputType;
};
diff --git a/frc971/wpilib/ahal/Compressor.cc b/frc971/wpilib/ahal/Compressor.cc
index ba04e52..97f8af1 100644
--- a/frc971/wpilib/ahal/Compressor.cc
+++ b/frc971/wpilib/ahal/Compressor.cc
@@ -155,7 +155,8 @@
int32_t status = 0;
bool value;
- value = HAL_GetCTREPCMCompressorCurrentTooHighFault(m_compressorHandle, &status);
+ value =
+ HAL_GetCTREPCMCompressorCurrentTooHighFault(m_compressorHandle, &status);
if (status) {
wpi_setWPIError(Timeout);
@@ -179,8 +180,8 @@
int32_t status = 0;
bool value;
- value =
- HAL_GetCTREPCMCompressorCurrentTooHighStickyFault(m_compressorHandle, &status);
+ value = HAL_GetCTREPCMCompressorCurrentTooHighStickyFault(m_compressorHandle,
+ &status);
if (status) {
wpi_setWPIError(Timeout);
@@ -204,7 +205,8 @@
int32_t status = 0;
bool value;
- value = HAL_GetCTREPCMCompressorShortedStickyFault(m_compressorHandle, &status);
+ value =
+ HAL_GetCTREPCMCompressorShortedStickyFault(m_compressorHandle, &status);
if (status) {
wpi_setWPIError(Timeout);
@@ -247,7 +249,8 @@
int32_t status = 0;
bool value;
- value = HAL_GetCTREPCMCompressorNotConnectedStickyFault(m_compressorHandle, &status);
+ value = HAL_GetCTREPCMCompressorNotConnectedStickyFault(m_compressorHandle,
+ &status);
if (status) {
wpi_setWPIError(Timeout);
@@ -267,7 +270,8 @@
int32_t status = 0;
bool value;
- value = HAL_GetCTREPCMCompressorNotConnectedFault(m_compressorHandle, &status);
+ value =
+ HAL_GetCTREPCMCompressorNotConnectedFault(m_compressorHandle, &status);
if (status) {
wpi_setWPIError(Timeout);
diff --git a/frc971/wpilib/ahal/Compressor.h b/frc971/wpilib/ahal/Compressor.h
index c358ce1..7f46bc5 100644
--- a/frc971/wpilib/ahal/Compressor.h
+++ b/frc971/wpilib/ahal/Compressor.h
@@ -10,8 +10,8 @@
#include <memory>
#include <string>
-#include "hal/Types.h"
#include "frc971/wpilib/ahal/SensorBase.h"
+#include "hal/Types.h"
namespace frc {
diff --git a/frc971/wpilib/ahal/Counter.cc b/frc971/wpilib/ahal/Counter.cc
index 8e91c82..5b4ce97 100644
--- a/frc971/wpilib/ahal/Counter.cc
+++ b/frc971/wpilib/ahal/Counter.cc
@@ -7,11 +7,11 @@
#include "frc971/wpilib/ahal/Counter.h"
-#include "hal/HAL.h"
#include "frc971/wpilib/ahal/AnalogTrigger.h"
#include "frc971/wpilib/ahal/Base.h"
#include "frc971/wpilib/ahal/DigitalInput.h"
#include "frc971/wpilib/ahal/WPIErrors.h"
+#include "hal/HAL.h"
using namespace frc;
@@ -31,7 +31,7 @@
ClearDownSource();
}
-Counter::Counter(DigitalSource* source) : Counter(kTwoPulse) {
+Counter::Counter(DigitalSource *source) : Counter(kTwoPulse) {
SetUpSource(source);
ClearDownSource();
}
@@ -41,13 +41,13 @@
ClearDownSource();
}
-Counter::Counter(const AnalogTrigger& trigger) : Counter(kTwoPulse) {
+Counter::Counter(const AnalogTrigger &trigger) : Counter(kTwoPulse) {
SetUpSource(trigger.CreateOutput(AnalogTriggerType::kState));
ClearDownSource();
}
-Counter::Counter(EncodingType encodingType, DigitalSource* upSource,
- DigitalSource* downSource, bool inverted)
+Counter::Counter(EncodingType encodingType, DigitalSource *upSource,
+ DigitalSource *downSource, bool inverted)
: Counter(encodingType,
std::shared_ptr<DigitalSource>(upSource,
NullDeleter<DigitalSource>()),
@@ -96,7 +96,7 @@
SetUpSource(std::make_shared<DigitalInput>(channel));
}
-void Counter::SetUpSource(AnalogTrigger* analogTrigger,
+void Counter::SetUpSource(AnalogTrigger *analogTrigger,
AnalogTriggerType triggerType) {
SetUpSource(std::shared_ptr<AnalogTrigger>(analogTrigger,
NullDeleter<AnalogTrigger>()),
@@ -109,7 +109,7 @@
SetUpSource(analogTrigger->CreateOutput(triggerType));
}
-void Counter::SetUpSource(DigitalSource* source) {
+void Counter::SetUpSource(DigitalSource *source) {
SetUpSource(
std::shared_ptr<DigitalSource>(source, NullDeleter<DigitalSource>()));
}
@@ -125,7 +125,7 @@
HAL_CHECK_STATUS(status);
}
-void Counter::SetUpSource(DigitalSource& source) {
+void Counter::SetUpSource(DigitalSource &source) {
SetUpSource(
std::shared_ptr<DigitalSource>(&source, NullDeleter<DigitalSource>()));
}
@@ -157,7 +157,7 @@
SetDownSource(std::make_shared<DigitalInput>(channel));
}
-void Counter::SetDownSource(AnalogTrigger* analogTrigger,
+void Counter::SetDownSource(AnalogTrigger *analogTrigger,
AnalogTriggerType triggerType) {
SetDownSource(std::shared_ptr<AnalogTrigger>(analogTrigger,
NullDeleter<AnalogTrigger>()),
@@ -170,12 +170,12 @@
SetDownSource(analogTrigger->CreateOutput(triggerType));
}
-void Counter::SetDownSource(DigitalSource* source) {
+void Counter::SetDownSource(DigitalSource *source) {
SetDownSource(
std::shared_ptr<DigitalSource>(source, NullDeleter<DigitalSource>()));
}
-void Counter::SetDownSource(DigitalSource& source) {
+void Counter::SetDownSource(DigitalSource &source) {
SetDownSource(
std::shared_ptr<DigitalSource>(&source, NullDeleter<DigitalSource>()));
}
diff --git a/frc971/wpilib/ahal/Counter.h b/frc971/wpilib/ahal/Counter.h
index b2c6ecb..1f7c4e0 100644
--- a/frc971/wpilib/ahal/Counter.h
+++ b/frc971/wpilib/ahal/Counter.h
@@ -10,11 +10,11 @@
#include <memory>
#include <string>
-#include "hal/Counter.h"
-#include "hal/Types.h"
#include "frc971/wpilib/ahal/AnalogTrigger.h"
#include "frc971/wpilib/ahal/CounterBase.h"
#include "frc971/wpilib/ahal/SensorBase.h"
+#include "hal/Counter.h"
+#include "hal/Types.h"
namespace frc {
@@ -80,7 +80,7 @@
* @param source A pointer to the existing DigitalSource object. It will be
* set as the Up Source.
*/
- explicit Counter(DigitalSource* source);
+ explicit Counter(DigitalSource *source);
/**
* Create an instance of a counter from a Digital Source (such as a Digital
@@ -107,7 +107,7 @@
*
* @param trigger The reference to the existing AnalogTrigger object.
*/
- explicit Counter(const AnalogTrigger& trigger);
+ explicit Counter(const AnalogTrigger &trigger);
/**
* Create an instance of a Counter object.
@@ -121,8 +121,8 @@
* source
* @param inverted True to invert the output (reverse the direction)
*/
- Counter(EncodingType encodingType, DigitalSource* upSource,
- DigitalSource* downSource, bool inverted);
+ Counter(EncodingType encodingType, DigitalSource *upSource,
+ DigitalSource *downSource, bool inverted);
/**
* Create an instance of a Counter object.
@@ -141,8 +141,8 @@
~Counter() override;
- Counter(Counter&&) = default;
- Counter& operator=(Counter&&) = default;
+ Counter(Counter &&) = default;
+ Counter &operator=(Counter &&) = default;
/**
* Set the upsource for the counter as a digital input channel.
@@ -160,7 +160,7 @@
* @param triggerType The analog trigger output that will trigger the
* counter.
*/
- void SetUpSource(AnalogTrigger* analogTrigger, AnalogTriggerType triggerType);
+ void SetUpSource(AnalogTrigger *analogTrigger, AnalogTriggerType triggerType);
/**
* Set the up counting source to be an analog trigger.
@@ -173,7 +173,7 @@
void SetUpSource(std::shared_ptr<AnalogTrigger> analogTrigger,
AnalogTriggerType triggerType);
- void SetUpSource(DigitalSource* source);
+ void SetUpSource(DigitalSource *source);
/**
* Set the source object that causes the counter to count up.
@@ -191,7 +191,7 @@
*
* @param source Reference to the DigitalSource object to set as the up source
*/
- void SetUpSource(DigitalSource& source);
+ void SetUpSource(DigitalSource &source);
/**
* Set the edge sensitivity on an up counting source.
@@ -224,7 +224,7 @@
* @param triggerType The analog trigger output that will trigger the
* counter.
*/
- void SetDownSource(AnalogTrigger* analogTrigger,
+ void SetDownSource(AnalogTrigger *analogTrigger,
AnalogTriggerType triggerType);
/**
@@ -245,7 +245,7 @@
*
* @param source Pointer to the DigitalSource object to set as the down source
*/
- void SetDownSource(DigitalSource* source);
+ void SetDownSource(DigitalSource *source);
/**
* Set the source object that causes the counter to count down.
@@ -255,7 +255,7 @@
* @param source Reference to the DigitalSource object to set as the down
* source
*/
- void SetDownSource(DigitalSource& source);
+ void SetDownSource(DigitalSource &source);
void SetDownSource(std::shared_ptr<DigitalSource> source);
diff --git a/frc971/wpilib/ahal/DigitalGlitchFilter.cc b/frc971/wpilib/ahal/DigitalGlitchFilter.cc
index 83e6201..2b48fc9 100644
--- a/frc971/wpilib/ahal/DigitalGlitchFilter.cc
+++ b/frc971/wpilib/ahal/DigitalGlitchFilter.cc
@@ -10,10 +10,11 @@
#include <algorithm>
#include <array>
+#include "glog/logging.h"
+
#include "frc971/wpilib/ahal/Counter.h"
#include "frc971/wpilib/ahal/Encoder.h"
#include "frc971/wpilib/ahal/WPIErrors.h"
-#include "glog/logging.h"
#include "hal/Constants.h"
#include "hal/DIO.h"
#include "hal/HAL.h"
@@ -31,7 +32,8 @@
m_channelIndex = std::distance(m_filterAllocated.begin(), index);
*index = true;
- HAL_Report(HALUsageReporting::kResourceType_DigitalGlitchFilter, m_channelIndex);
+ HAL_Report(HALUsageReporting::kResourceType_DigitalGlitchFilter,
+ m_channelIndex);
}
DigitalGlitchFilter::~DigitalGlitchFilter() {
diff --git a/frc971/wpilib/ahal/DigitalGlitchFilter.h b/frc971/wpilib/ahal/DigitalGlitchFilter.h
index d31b9d5..0dd1ffb 100644
--- a/frc971/wpilib/ahal/DigitalGlitchFilter.h
+++ b/frc971/wpilib/ahal/DigitalGlitchFilter.h
@@ -39,7 +39,8 @@
void SetPeriodCycles(int fpga_cycles);
void SetPeriodNanoSeconds(uint64_t nanoseconds);
- // Sets the filter period such that it will work well for an input at a maxmium frequency of hz.
+ // Sets the filter period such that it will work well for an input at a
+ // maxmium frequency of hz.
void SetPeriodHz(int hz);
int GetPeriodCycles();
diff --git a/frc971/wpilib/ahal/DigitalInput.cc b/frc971/wpilib/ahal/DigitalInput.cc
index d922cae..9e97a5d 100644
--- a/frc971/wpilib/ahal/DigitalInput.cc
+++ b/frc971/wpilib/ahal/DigitalInput.cc
@@ -10,10 +10,10 @@
#include <limits>
#include <sstream>
+#include "frc971/wpilib/ahal/WPIErrors.h"
#include "hal/DIO.h"
#include "hal/HAL.h"
#include "hal/Ports.h"
-#include "frc971/wpilib/ahal/WPIErrors.h"
using namespace frc;
diff --git a/frc971/wpilib/ahal/DigitalOutput.cc b/frc971/wpilib/ahal/DigitalOutput.cc
index ac00df3..389cfae 100644
--- a/frc971/wpilib/ahal/DigitalOutput.cc
+++ b/frc971/wpilib/ahal/DigitalOutput.cc
@@ -10,10 +10,10 @@
#include <limits>
#include <sstream>
+#include "frc971/wpilib/ahal/WPIErrors.h"
#include "hal/DIO.h"
#include "hal/HAL.h"
#include "hal/Ports.h"
-#include "frc971/wpilib/ahal/WPIErrors.h"
using namespace frc;
@@ -80,10 +80,10 @@
}
/**
- * Gets the value being output from the Digital Output.
- *
- * @return the state of the digital output.
- */
+ * Gets the value being output from the Digital Output.
+ *
+ * @return the state of the digital output.
+ */
bool DigitalOutput::Get() const {
if (StatusIsFatal()) return false;
diff --git a/frc971/wpilib/ahal/DigitalOutput.h b/frc971/wpilib/ahal/DigitalOutput.h
index c6139ce..4d882c7 100644
--- a/frc971/wpilib/ahal/DigitalOutput.h
+++ b/frc971/wpilib/ahal/DigitalOutput.h
@@ -10,8 +10,8 @@
#include <memory>
#include <string>
-#include "hal/Types.h"
#include "frc971/wpilib/ahal/DigitalSource.h"
+#include "hal/Types.h"
namespace frc {
diff --git a/frc971/wpilib/ahal/DigitalSource.h b/frc971/wpilib/ahal/DigitalSource.h
index f5ece9c..48fa26e 100644
--- a/frc971/wpilib/ahal/DigitalSource.h
+++ b/frc971/wpilib/ahal/DigitalSource.h
@@ -7,8 +7,8 @@
#pragma once
-#include "hal/Types.h"
#include "frc971/wpilib/ahal/InterruptableSensorBase.h"
+#include "hal/Types.h"
namespace frc {
diff --git a/frc971/wpilib/ahal/DriverStation.cc b/frc971/wpilib/ahal/DriverStation.cc
index 8762203..967ebb4 100644
--- a/frc971/wpilib/ahal/DriverStation.cc
+++ b/frc971/wpilib/ahal/DriverStation.cc
@@ -13,11 +13,12 @@
#include <string_view>
#include "FRC_NetworkCommunication/FRCComm.h"
+#include "wpi/SmallString.h"
+
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/WPIErrors.h"
#include "hal/HAL.h"
#include "hal/Power.h"
-#include "wpi/SmallString.h"
using namespace frc;
diff --git a/frc971/wpilib/ahal/DriverStation.h b/frc971/wpilib/ahal/DriverStation.h
index 8bcdcf1..cd520f8 100644
--- a/frc971/wpilib/ahal/DriverStation.h
+++ b/frc971/wpilib/ahal/DriverStation.h
@@ -9,14 +9,14 @@
#include <atomic>
// #include <condition_variable>
-#include <memory>
#include <functional>
+#include <memory>
#include <string>
#include <string_view>
#include <thread>
-#include "hal/DriverStation.h"
#include "frc971/wpilib/ahal/SensorBase.h"
+#include "hal/DriverStation.h"
namespace frc {
@@ -33,8 +33,10 @@
static DriverStation &GetInstance();
static void ReportError(const std::string_view &error);
static void ReportWarning(const std::string_view &error);
- static void ReportError(bool is_error, int code, const std::string_view &error,
- const std::string_view &location, const std::string_view &stack);
+ static void ReportError(bool is_error, int code,
+ const std::string_view &error,
+ const std::string_view &location,
+ const std::string_view &stack);
static const int kJoystickPorts = 6;
diff --git a/frc971/wpilib/ahal/DutyCycle.cc b/frc971/wpilib/ahal/DutyCycle.cc
index b400cf3..f795f78 100644
--- a/frc971/wpilib/ahal/DutyCycle.cc
+++ b/frc971/wpilib/ahal/DutyCycle.cc
@@ -8,8 +8,8 @@
#include "frc971/wpilib/ahal/DutyCycle.h"
#include <hal/DutyCycle.h>
-#include <hal/HAL.h>
#include <hal/FRCUsageReporting.h>
+#include <hal/HAL.h>
#include "frc971/wpilib/ahal/Base.h"
#include "frc971/wpilib/ahal/DigitalSource.h"
@@ -17,7 +17,7 @@
using namespace frc;
-DutyCycle::DutyCycle(DigitalSource* source)
+DutyCycle::DutyCycle(DigitalSource *source)
: m_source{source, NullDeleter<DigitalSource>()} {
if (m_source == nullptr) {
wpi_setWPIError(NullParameter);
@@ -26,7 +26,7 @@
}
}
-DutyCycle::DutyCycle(DigitalSource& source)
+DutyCycle::DutyCycle(DigitalSource &source)
: m_source{&source, NullDeleter<DigitalSource>()} {
InitDutyCycle();
}
diff --git a/frc971/wpilib/ahal/DutyCycle.h b/frc971/wpilib/ahal/DutyCycle.h
index 88d6a54..3f99d94 100644
--- a/frc971/wpilib/ahal/DutyCycle.h
+++ b/frc971/wpilib/ahal/DutyCycle.h
@@ -7,10 +7,10 @@
#pragma once
-#include <memory>
-
#include <hal/Types.h>
+#include <memory>
+
namespace frc {
class DigitalSource;
class AnalogTrigger;
@@ -41,7 +41,7 @@
*
* @param source The DigitalSource to use.
*/
- explicit DutyCycle(DigitalSource& source);
+ explicit DutyCycle(DigitalSource &source);
/**
* Constructs a DutyCycle input from a DigitalSource input.
*
@@ -49,7 +49,7 @@
*
* @param source The DigitalSource to use.
*/
- explicit DutyCycle(DigitalSource* source);
+ explicit DutyCycle(DigitalSource *source);
/**
* Constructs a DutyCycle input from a DigitalSource input.
*
@@ -64,8 +64,8 @@
*/
virtual ~DutyCycle();
- DutyCycle(DutyCycle&&) = default;
- DutyCycle& operator=(DutyCycle&&) = default;
+ DutyCycle(DutyCycle &&) = default;
+ DutyCycle &operator=(DutyCycle &&) = default;
/**
* Get the frequency of the duty cycle signal.
diff --git a/frc971/wpilib/ahal/Encoder.cc b/frc971/wpilib/ahal/Encoder.cc
index 417792d..76a7163 100644
--- a/frc971/wpilib/ahal/Encoder.cc
+++ b/frc971/wpilib/ahal/Encoder.cc
@@ -7,9 +7,9 @@
#include "frc971/wpilib/ahal/Encoder.h"
-#include "hal/HAL.h"
#include "frc971/wpilib/ahal/DigitalInput.h"
#include "frc971/wpilib/ahal/WPIErrors.h"
+#include "hal/HAL.h"
using namespace frc;
diff --git a/frc971/wpilib/ahal/ErrorBase.h b/frc971/wpilib/ahal/ErrorBase.h
index f0dfe3e..ef1dd5d 100644
--- a/frc971/wpilib/ahal/ErrorBase.h
+++ b/frc971/wpilib/ahal/ErrorBase.h
@@ -12,42 +12,42 @@
#include <wpi/mutex.h>
// Forward declared manually to avoid needing to pull in entire HAL header.
-extern "C" const char* HAL_GetErrorMessage(int32_t code);
+extern "C" const char *HAL_GetErrorMessage(int32_t code);
#define wpi_setErrnoErrorWithContext(context) \
this->SetErrnoError((context), __FILE__, __FUNCTION__, __LINE__)
#define wpi_setErrnoError() wpi_setErrnoErrorWithContext("")
-#define wpi_setImaqErrorWithContext(code, context) \
- do { \
+#define wpi_setImaqErrorWithContext(code, context) \
+ do { \
} while (0)
-#define wpi_setErrorWithContext(code, context) \
- do { \
+#define wpi_setErrorWithContext(code, context) \
+ do { \
} while (0)
-#define wpi_setErrorWithContextRange(code, min, max, req, context) \
- do { \
+#define wpi_setErrorWithContextRange(code, min, max, req, context) \
+ do { \
} while (0)
-#define wpi_setHALError(code) \
- do { \
+#define wpi_setHALError(code) \
+ do { \
} while (0)
-#define wpi_setHALErrorWithRange(code, min, max, req) \
- do { \
+#define wpi_setHALErrorWithRange(code, min, max, req) \
+ do { \
} while (0)
#define wpi_setError(code) wpi_setErrorWithContext(code, "")
-#define wpi_setStaticErrorWithContext(object, code, context) \
- do { \
+#define wpi_setStaticErrorWithContext(object, code, context) \
+ do { \
} while (0)
#define wpi_setStaticError(object, code) \
wpi_setStaticErrorWithContext(object, code, "")
-#define wpi_setGlobalErrorWithContext(code, context) \
- do { \
+#define wpi_setGlobalErrorWithContext(code, context) \
+ do { \
} while (0)
-#define wpi_setGlobalHALError(code) \
- do { \
+#define wpi_setGlobalHALError(code) \
+ do { \
} while (0)
#define wpi_setGlobalError(code) wpi_setGlobalErrorWithContext(code, "")
diff --git a/frc971/wpilib/ahal/InterruptableSensorBase.cc b/frc971/wpilib/ahal/InterruptableSensorBase.cc
index 59eb962..06ee513 100644
--- a/frc971/wpilib/ahal/InterruptableSensorBase.cc
+++ b/frc971/wpilib/ahal/InterruptableSensorBase.cc
@@ -7,8 +7,9 @@
#include "frc971/wpilib/ahal/InterruptableSensorBase.h"
-#include "frc971/wpilib/ahal/WPIErrors.h"
#include "glog/logging.h"
+
+#include "frc971/wpilib/ahal/WPIErrors.h"
#include "hal/HAL.h"
using namespace frc;
diff --git a/frc971/wpilib/ahal/PWM.cc b/frc971/wpilib/ahal/PWM.cc
index 7184643..3c42bc4 100644
--- a/frc971/wpilib/ahal/PWM.cc
+++ b/frc971/wpilib/ahal/PWM.cc
@@ -6,12 +6,13 @@
/*----------------------------------------------------------------------------*/
#include "hal/PWM.h"
-#include "frc971/wpilib/ahal/PWM.h"
#include <sstream>
-#include "frc971/wpilib/ahal/WPIErrors.h"
#include "glog/logging.h"
+
+#include "frc971/wpilib/ahal/PWM.h"
+#include "frc971/wpilib/ahal/WPIErrors.h"
#include "hal/HAL.h"
#include "hal/Ports.h"
diff --git a/frc971/wpilib/ahal/PWM.h b/frc971/wpilib/ahal/PWM.h
index c6e7a25..5c13d35 100644
--- a/frc971/wpilib/ahal/PWM.h
+++ b/frc971/wpilib/ahal/PWM.h
@@ -10,8 +10,8 @@
#include <memory>
#include <string>
-#include "hal/Types.h"
#include "frc971/wpilib/ahal/SensorBase.h"
+#include "hal/Types.h"
namespace frc {
diff --git a/frc971/wpilib/ahal/PowerDistributionPanel.cc b/frc971/wpilib/ahal/PowerDistributionPanel.cc
index 39087fb..e9487e7 100644
--- a/frc971/wpilib/ahal/PowerDistributionPanel.cc
+++ b/frc971/wpilib/ahal/PowerDistributionPanel.cc
@@ -9,10 +9,10 @@
#include <sstream>
-#include "hal/HAL.h"
-#include "hal/PowerDistribution.h"
-#include "hal/Ports.h"
#include "frc971/wpilib/ahal/WPIErrors.h"
+#include "hal/HAL.h"
+#include "hal/Ports.h"
+#include "hal/PowerDistribution.h"
using namespace frc;
#define WPI_LIB_FATAL_ERROR(tag, msg)
diff --git a/frc971/wpilib/ahal/PowerDistributionPanel.h b/frc971/wpilib/ahal/PowerDistributionPanel.h
index dc80158..7471a78 100644
--- a/frc971/wpilib/ahal/PowerDistributionPanel.h
+++ b/frc971/wpilib/ahal/PowerDistributionPanel.h
@@ -7,11 +7,11 @@
#pragma once
+#include <hal/Types.h>
+
#include <memory>
#include <string>
-#include <hal/Types.h>
-
#include "frc971/wpilib/ahal/SensorBase.h"
namespace frc {
diff --git a/frc971/wpilib/ahal/Relay.cc b/frc971/wpilib/ahal/Relay.cc
index 51241be..13aa13a 100644
--- a/frc971/wpilib/ahal/Relay.cc
+++ b/frc971/wpilib/ahal/Relay.cc
@@ -6,13 +6,13 @@
/*----------------------------------------------------------------------------*/
#include "hal/Relay.h"
-#include "frc971/wpilib/ahal/Relay.h"
#include <sstream>
+#include "frc971/wpilib/ahal/Relay.h"
+#include "frc971/wpilib/ahal/WPIErrors.h"
#include "hal/HAL.h"
#include "hal/Ports.h"
-#include "frc971/wpilib/ahal/WPIErrors.h"
using namespace frc;
@@ -51,7 +51,8 @@
}
if (m_direction == kBothDirections || m_direction == kReverseOnly) {
int32_t status = 0;
- m_reverseHandle = HAL_InitializeRelayPort(portHandle, false, nullptr, &status);
+ m_reverseHandle =
+ HAL_InitializeRelayPort(portHandle, false, nullptr, &status);
if (status != 0) {
wpi_setErrorWithContextRange(status, 0, HAL_GetNumRelayChannels(),
channel, HAL_GetErrorMessage(status));
diff --git a/frc971/wpilib/ahal/Relay.h b/frc971/wpilib/ahal/Relay.h
index 389947c..0eb10ca 100644
--- a/frc971/wpilib/ahal/Relay.h
+++ b/frc971/wpilib/ahal/Relay.h
@@ -10,8 +10,8 @@
#include <memory>
#include <string>
-#include "hal/Types.h"
#include "frc971/wpilib/ahal/SensorBase.h"
+#include "hal/Types.h"
namespace frc {
diff --git a/frc971/wpilib/ahal/RobotBase.cc b/frc971/wpilib/ahal/RobotBase.cc
index 3cc39df..3640191 100644
--- a/frc971/wpilib/ahal/RobotBase.cc
+++ b/frc971/wpilib/ahal/RobotBase.cc
@@ -9,9 +9,9 @@
#include <cstdio>
-#include "hal/HAL.h"
#include "frc971/wpilib/ahal/DriverStation.h"
#include "frc971/wpilib/ahal/WPILibVersion.h"
+#include "hal/HAL.h"
using namespace frc;
diff --git a/frc971/wpilib/ahal/RobotBase.h b/frc971/wpilib/ahal/RobotBase.h
index 5b4ce5b..4cb3d8a 100644
--- a/frc971/wpilib/ahal/RobotBase.h
+++ b/frc971/wpilib/ahal/RobotBase.h
@@ -12,8 +12,8 @@
#include <thread>
#include "aos/realtime.h"
-#include "hal/HAL.h"
#include "frc971/wpilib/ahal/Base.h"
+#include "hal/HAL.h"
namespace frc {
diff --git a/frc971/wpilib/ahal/SPI.cc b/frc971/wpilib/ahal/SPI.cc
index 8568210..874858b 100644
--- a/frc971/wpilib/ahal/SPI.cc
+++ b/frc971/wpilib/ahal/SPI.cc
@@ -8,13 +8,14 @@
#include "frc971/wpilib/ahal/SPI.h"
#include <hal/SPI.h>
-#include <wpi/SmallVector.h>
-#include <wpi/mutex.h>
#include <cstring>
#include <utility>
#include "absl/types/span.h"
+#include <wpi/SmallVector.h>
+#include <wpi/mutex.h>
+
#include "frc971/wpilib/ahal/DigitalSource.h"
#include "frc971/wpilib/ahal/WPIErrors.h"
diff --git a/frc971/wpilib/ahal/SPI.h b/frc971/wpilib/ahal/SPI.h
index 542db80..6151ded 100644
--- a/frc971/wpilib/ahal/SPI.h
+++ b/frc971/wpilib/ahal/SPI.h
@@ -8,13 +8,13 @@
#pragma once
#include <hal/SPITypes.h>
-#include <wpi/deprecated.h>
#include <cstdint>
#include <memory>
#include <span>
#include "absl/types/span.h"
+#include <wpi/deprecated.h>
namespace frc {
diff --git a/frc971/wpilib/ahal/SensorBase.cc b/frc971/wpilib/ahal/SensorBase.cc
index 111e4c6..4716187 100644
--- a/frc971/wpilib/ahal/SensorBase.cc
+++ b/frc971/wpilib/ahal/SensorBase.cc
@@ -8,6 +8,7 @@
#include "frc971/wpilib/ahal/SensorBase.h"
#include "FRC_NetworkCommunication/LoadOut.h"
+
#include "frc971/wpilib/ahal/WPIErrors.h"
#include "hal/AnalogInput.h"
#include "hal/AnalogOutput.h"
diff --git a/frc971/wpilib/ahal/TalonFX.cc b/frc971/wpilib/ahal/TalonFX.cc
index fe29089..ccd30db 100644
--- a/frc971/wpilib/ahal/TalonFX.cc
+++ b/frc971/wpilib/ahal/TalonFX.cc
@@ -39,4 +39,3 @@
HAL_Report(HALUsageReporting::kResourceType_VictorSP, GetChannel());
}
-
diff --git a/frc971/wpilib/buffered_pcm.cc b/frc971/wpilib/buffered_pcm.cc
index 8f5a3d9..f356722 100644
--- a/frc971/wpilib/buffered_pcm.cc
+++ b/frc971/wpilib/buffered_pcm.cc
@@ -3,9 +3,9 @@
#include <cinttypes>
#include "aos/logging/logging.h"
+#include "hal/CTREPCM.h"
#include "hal/HAL.h"
#include "hal/Ports.h"
-#include "hal/CTREPCM.h"
namespace frc971 {
namespace wpilib {
diff --git a/frc971/wpilib/buffered_pcm.h b/frc971/wpilib/buffered_pcm.h
index 033ded6..f743371 100644
--- a/frc971/wpilib/buffered_pcm.h
+++ b/frc971/wpilib/buffered_pcm.h
@@ -1,10 +1,10 @@
#ifndef FRC971_WPILIB_BUFFERED_PCM_H_
#define FRC971_WPILIB_BUFFERED_PCM_H_
-#include <memory>
-
#include <hal/HAL.h>
+#include <memory>
+
#include "frc971/wpilib/buffered_solenoid.h"
namespace frc971 {
diff --git a/frc971/wpilib/buffered_solenoid.cc b/frc971/wpilib/buffered_solenoid.cc
index c07a7cd..a4b337e 100644
--- a/frc971/wpilib/buffered_solenoid.cc
+++ b/frc971/wpilib/buffered_solenoid.cc
@@ -5,9 +5,7 @@
namespace frc971 {
namespace wpilib {
-void BufferedSolenoid::Set(bool value) {
- pcm_->DoSet(number_, value);
-}
+void BufferedSolenoid::Set(bool value) { pcm_->DoSet(number_, value); }
} // namespace wpilib
} // namespace frc971
diff --git a/frc971/wpilib/dma.cc b/frc971/wpilib/dma.cc
index a2b2d20..cff1ac1 100644
--- a/frc971/wpilib/dma.cc
+++ b/frc971/wpilib/dma.cc
@@ -4,10 +4,11 @@
#include <cstring>
#include <type_traits>
+#include "glog/logging.h"
+
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/DigitalSource.h"
#include "frc971/wpilib/ahal/Encoder.h"
-#include "glog/logging.h"
#include "hal/HAL.h"
// Interface to the roboRIO FPGA's DMA features.
diff --git a/frc971/wpilib/drivetrain_writer.h b/frc971/wpilib/drivetrain_writer.h
index c27638f..195b5a3 100644
--- a/frc971/wpilib/drivetrain_writer.h
+++ b/frc971/wpilib/drivetrain_writer.h
@@ -2,7 +2,6 @@
#define FRC971_WPILIB_DRIVETRAIN_WRITER_H_
#include "aos/commonmath.h"
-
#include "frc971/control_loops/drivetrain/drivetrain_output_generated.h"
#include "frc971/wpilib/ahal/PWM.h"
#include "frc971/wpilib/loop_output_handler.h"
diff --git a/frc971/wpilib/encoder_and_potentiometer.h b/frc971/wpilib/encoder_and_potentiometer.h
index 5089620..7ee85e1 100644
--- a/frc971/wpilib/encoder_and_potentiometer.h
+++ b/frc971/wpilib/encoder_and_potentiometer.h
@@ -7,12 +7,10 @@
#include "aos/macros.h"
#include "aos/time/time.h"
-
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/Counter.h"
#include "frc971/wpilib/ahal/DigitalSource.h"
#include "frc971/wpilib/ahal/Encoder.h"
-
#include "frc971/wpilib/dma.h"
#include "frc971/wpilib/dma_edge_counting.h"
diff --git a/frc971/wpilib/fpga_time_conversion.h b/frc971/wpilib/fpga_time_conversion.h
index 9862918..51cc7a9 100644
--- a/frc971/wpilib/fpga_time_conversion.h
+++ b/frc971/wpilib/fpga_time_conversion.h
@@ -1,11 +1,12 @@
#ifndef FRC971_WPILIB_FPGA_TIME_CONVERSION_H_
#define FRC971_WPILIB_FPGA_TIME_CONVERSION_H_
-#include <optional>
#include <chrono>
+#include <optional>
+
+#include "glog/logging.h"
#include "aos/time/time.h"
-#include "glog/logging.h"
#include "hal/cpp/fpga_clock.h"
namespace frc971 {
diff --git a/frc971/wpilib/interrupt_edge_counting.h b/frc971/wpilib/interrupt_edge_counting.h
index dd48f2d..5ea8df5 100644
--- a/frc971/wpilib/interrupt_edge_counting.h
+++ b/frc971/wpilib/interrupt_edge_counting.h
@@ -9,7 +9,6 @@
#include "aos/logging/logging.h"
#include "aos/macros.h"
#include "aos/stl_mutex/stl_mutex.h"
-
#include "frc971/wpilib/ahal/DigitalInput.h"
#include "frc971/wpilib/ahal/Encoder.h"
diff --git a/frc971/wpilib/sensor_reader.cc b/frc971/wpilib/sensor_reader.cc
index bb99dc8..f8bfb5a 100644
--- a/frc971/wpilib/sensor_reader.cc
+++ b/frc971/wpilib/sensor_reader.cc
@@ -128,7 +128,8 @@
last_monotonic_now_ = monotonic_now;
monotonic_clock::time_point last_tick_timepoint = GetPWMStartTime();
- VLOG(1) << "Start time " << last_tick_timepoint << " period " << period_.count();
+ VLOG(1) << "Start time " << last_tick_timepoint << " period "
+ << period_.count();
if (last_tick_timepoint == monotonic_clock::min_time) {
return;
}
@@ -137,7 +138,8 @@
((monotonic_now - chrono::microseconds(FLAGS_pwm_offset) -
last_tick_timepoint) /
period_) *
- period_ + chrono::microseconds(FLAGS_pwm_offset);
+ period_ +
+ chrono::microseconds(FLAGS_pwm_offset);
VLOG(1) << "Now " << monotonic_now << " tick " << last_tick_timepoint;
// If it's over 1/2 of a period back in time, that's wrong. Move it
// forwards to now.
@@ -149,8 +151,7 @@
// after the falling edge. This gives us a little bit of buffer for
// errors in waking up. The PWM cycle starts at the falling edge of the
// PWM pulse.
- const auto next_time =
- last_tick_timepoint + period_;
+ const auto next_time = last_tick_timepoint + period_;
timer_handler_->Setup(next_time, period_);
}