Skip to content

Commit

Permalink
[hal] Fix formatting of HAL_ENUM enums (NFC) (#6114)
Browse files Browse the repository at this point in the history
  • Loading branch information
auscompgeek authored Dec 30, 2023
1 parent af46034 commit 0718376
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 40 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
Macros:
- 'HAL_ENUM(name)=enum name'
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
Expand Down
2 changes: 0 additions & 2 deletions hal/src/main/native/include/hal/Accelerometer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* @{
*/

// clang-format off
/**
* The acceptable accelerometer ranges.
*/
Expand All @@ -21,7 +20,6 @@ HAL_ENUM(HAL_AccelerometerRange) {
HAL_AccelerometerRange_k4G = 1,
HAL_AccelerometerRange_k8G = 2,
};
// clang-format on

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 0 additions & 2 deletions hal/src/main/native/include/hal/AnalogTrigger.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* @{
*/

// clang-format off
/**
* The type of analog trigger to trigger on.
*/
Expand All @@ -24,7 +23,6 @@ HAL_ENUM(HAL_AnalogTriggerType) {
HAL_Trigger_kRisingPulse = 2,
HAL_Trigger_kFallingPulse = 3
};
// clang-format on

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 0 additions & 2 deletions hal/src/main/native/include/hal/CANAPITypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* @{
*/

// clang-format off
/**
* The CAN device type.
*
Expand Down Expand Up @@ -60,5 +59,4 @@ HAL_ENUM(HAL_CANManufacturer) {
HAL_CAN_Man_kAndyMark = 15,
HAL_CAN_Man_kVividHosting = 16
};
// clang-format on
/** @} */
2 changes: 0 additions & 2 deletions hal/src/main/native/include/hal/Counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* @{
*/

// clang-format off
/**
* The counter mode.
*/
Expand All @@ -25,7 +24,6 @@ HAL_ENUM(HAL_Counter_Mode) {
HAL_Counter_kPulseLength = 2,
HAL_Counter_kExternalDirection = 3
};
// clang-format on

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 0 additions & 2 deletions hal/src/main/native/include/hal/DMA.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* @{
*/

// clang-format off
/**
* The DMA Read Status.
*/
Expand All @@ -22,7 +21,6 @@ HAL_ENUM(HAL_DMAReadStatus) {
HAL_DMA_TIMEOUT = 2,
HAL_DMA_ERROR = 3,
};
// clang-format on

/**
* Buffer for containing all DMA data for a specific sample.
Expand Down
2 changes: 0 additions & 2 deletions hal/src/main/native/include/hal/DriverStationTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ struct HAL_ControlWord {
};
typedef struct HAL_ControlWord HAL_ControlWord;

// clang-format off
HAL_ENUM(HAL_AllianceStationID) {
HAL_AllianceStationID_kUnknown = 0,
HAL_AllianceStationID_kRed1,
Expand All @@ -57,7 +56,6 @@ HAL_ENUM(HAL_MatchType) {
HAL_kMatchType_qualification,
HAL_kMatchType_elimination,
};
// clang-format on

/* The maximum number of axes that will be stored in a single HALJoystickAxes
* struct. This is used for allocating buffers, not bounds checking, since
Expand Down
2 changes: 0 additions & 2 deletions hal/src/main/native/include/hal/Encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* @{
*/

// clang-format off
/**
* The type of index pulse for the encoder.
*/
Expand All @@ -34,7 +33,6 @@ HAL_ENUM(HAL_EncoderEncodingType) {
HAL_Encoder_k2X,
HAL_Encoder_k4X
};
// clang-format on

#ifdef __cplusplus
extern "C" {
Expand Down
8 changes: 5 additions & 3 deletions hal/src/main/native/include/hal/HALBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
* @{
*/

// clang-format off
HAL_ENUM(HAL_RuntimeType) { HAL_Runtime_RoboRIO, HAL_Runtime_RoboRIO2, HAL_Runtime_Simulation };
// clang-format on
HAL_ENUM(HAL_RuntimeType) {
HAL_Runtime_RoboRIO,
HAL_Runtime_RoboRIO2,
HAL_Runtime_Simulation
};

#ifdef __cplusplus
extern "C" {
Expand Down
8 changes: 5 additions & 3 deletions hal/src/main/native/include/hal/I2CTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
* @{
*/

// clang-format off
HAL_ENUM(HAL_I2CPort) { HAL_I2C_kInvalid = -1, HAL_I2C_kOnboard, HAL_I2C_kMXP };
// clang-format on
HAL_ENUM(HAL_I2CPort) {
HAL_I2C_kInvalid = -1,
HAL_I2C_kOnboard,
HAL_I2C_kMXP
};

#ifdef __cplusplus
namespace hal {
Expand Down
8 changes: 6 additions & 2 deletions hal/src/main/native/include/hal/LEDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
#pragma once
#include "hal/Types.h"

HAL_ENUM(HAL_RadioLEDState){HAL_RadioLED_kOff = 0, HAL_RadioLED_kGreen = 1,
HAL_RadioLED_kRed = 2, HAL_RadioLED_kOrange = 3};
HAL_ENUM(HAL_RadioLEDState) {
HAL_RadioLED_kOff = 0,
HAL_RadioLED_kGreen = 1,
HAL_RadioLED_kRed = 2,
HAL_RadioLED_kOrange = 3
};

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 0 additions & 2 deletions hal/src/main/native/include/hal/PowerDistribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* @{
*/

// clang-format off
/**
* The types of power distribution devices.
*/
Expand All @@ -24,7 +23,6 @@ HAL_ENUM(HAL_PowerDistributionType) {
HAL_PowerDistributionType_kCTRE = 1,
HAL_PowerDistributionType_kRev = 2,
};
// clang-format on

#define HAL_DEFAULT_POWER_DISTRIBUTION_MODULE -1

Expand Down
10 changes: 5 additions & 5 deletions hal/src/main/native/include/hal/REVPH.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
/**
* The compressor configuration type
*/
HAL_ENUM(HAL_REVPHCompressorConfigType){
HAL_REVPHCompressorConfigType_kDisabled = 0,
HAL_REVPHCompressorConfigType_kDigital = 1,
HAL_REVPHCompressorConfigType_kAnalog = 2,
HAL_REVPHCompressorConfigType_kHybrid = 3,
HAL_ENUM(HAL_REVPHCompressorConfigType) {
HAL_REVPHCompressorConfigType_kDisabled = 0,
HAL_REVPHCompressorConfigType_kDigital = 1,
HAL_REVPHCompressorConfigType_kAnalog = 2,
HAL_REVPHCompressorConfigType_kHybrid = 3,
};

/**
Expand Down
4 changes: 0 additions & 4 deletions hal/src/main/native/include/hal/SPITypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* @{
*/

// clang-format off
HAL_ENUM(HAL_SPIPort) {
HAL_SPI_kInvalid = -1,
HAL_SPI_kOnboardCS0,
Expand All @@ -23,16 +22,13 @@ HAL_ENUM(HAL_SPIPort) {
HAL_SPI_kOnboardCS3,
HAL_SPI_kMXP
};
// clang-format on

// clang-format off
HAL_ENUM(HAL_SPIMode) {
HAL_SPI_kMode0 = 0,
HAL_SPI_kMode1 = 1,
HAL_SPI_kMode2 = 2,
HAL_SPI_kMode3 = 3,
};
// clang-format on

#ifdef __cplusplus
namespace hal {
Expand Down
2 changes: 0 additions & 2 deletions hal/src/main/native/include/hal/SerialPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
* @{
*/

// clang-format off
HAL_ENUM(HAL_SerialPort) {
HAL_SerialPort_Onboard = 0,
HAL_SerialPort_MXP = 1,
HAL_SerialPort_USB1 = 2,
HAL_SerialPort_USB2 = 3
};
// clang-format on

#ifdef __cplusplus
extern "C" {
Expand Down
8 changes: 3 additions & 5 deletions hal/src/main/native/include/hal/SimDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@
/**
* Direction of a simulated value (from the perspective of user code).
*/
// clang-format off
HAL_ENUM(HAL_SimValueDirection) {
HAL_SimValueInput = 0, /**< input to user code from the simulator */
HAL_SimValueOutput, /**< output from user code to the simulator */
HAL_SimValueBidir /**< bidirectional between user code and simulator */
HAL_SimValueInput = 0, /**< input to user code from the simulator */
HAL_SimValueOutput, /**< output from user code to the simulator */
HAL_SimValueBidir /**< bidirectional between user code and simulator */
};
// clang-format on

#ifdef __cplusplus
extern "C" {
Expand Down

0 comments on commit 0718376

Please sign in to comment.