diff --git a/hal/src/main/native/cpp/handles/HandlesInternal.cpp b/hal/src/main/native/cpp/handles/HandlesInternal.cpp index 062a0db585..4813533847 100644 --- a/hal/src/main/native/cpp/handles/HandlesInternal.cpp +++ b/hal/src/main/native/cpp/handles/HandlesInternal.cpp @@ -52,11 +52,11 @@ void HandleBase::ResetGlobalHandles() { HAL_Handle createHandle(int16_t index, HAL_HandleEnum handleType, int16_t version) { if (index < 0) { - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } uint8_t hType = static_cast(handleType); if (hType == 0 || hType > 127) { - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } // set last 8 bits, then shift to first 8 bits HAL_Handle handle = hType; diff --git a/hal/src/main/native/cpp/jni/AddressableLEDJNI.cpp b/hal/src/main/native/cpp/jni/AddressableLEDJNI.cpp index 6bbbde33f0..12c6a3e921 100644 --- a/hal/src/main/native/cpp/jni/AddressableLEDJNI.cpp +++ b/hal/src/main/native/cpp/jni/AddressableLEDJNI.cpp @@ -53,7 +53,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_AddressableLEDJNI_free (JNIEnv* env, jclass, jint handle) { - if (handle != HAL_kInvalidHandle) { + if (handle != HAL_INVALID_HANDLE) { HAL_FreeAddressableLED(static_cast(handle)); } } diff --git a/hal/src/main/native/cpp/jni/AlertJNI.cpp b/hal/src/main/native/cpp/jni/AlertJNI.cpp index 68b619d505..61df81fee8 100644 --- a/hal/src/main/native/cpp/jni/AlertJNI.cpp +++ b/hal/src/main/native/cpp/jni/AlertJNI.cpp @@ -51,7 +51,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_AlertJNI_destroyAlert (JNIEnv* env, jclass, jint alertHandle) { - if (alertHandle != HAL_kInvalidHandle) { + if (alertHandle != HAL_INVALID_HANDLE) { HAL_DestroyAlert((HAL_AlertHandle)alertHandle); } } diff --git a/hal/src/main/native/cpp/jni/AnalogInputJNI.cpp b/hal/src/main/native/cpp/jni/AnalogInputJNI.cpp index 28d9fbe062..0d80c4ba6c 100644 --- a/hal/src/main/native/cpp/jni/AnalogInputJNI.cpp +++ b/hal/src/main/native/cpp/jni/AnalogInputJNI.cpp @@ -42,7 +42,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_AnalogInputJNI_freeAnalogInputPort (JNIEnv* env, jclass, jint id) { - if (id != HAL_kInvalidHandle) { + if (id != HAL_INVALID_HANDLE) { HAL_FreeAnalogInputPort((HAL_AnalogInputHandle)id); } } diff --git a/hal/src/main/native/cpp/jni/CANAPIJNI.cpp b/hal/src/main/native/cpp/jni/CANAPIJNI.cpp index 240d803b7c..20ce4f57b8 100644 --- a/hal/src/main/native/cpp/jni/CANAPIJNI.cpp +++ b/hal/src/main/native/cpp/jni/CANAPIJNI.cpp @@ -48,7 +48,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_CANAPIJNI_cleanCAN (JNIEnv* env, jclass, jint handle) { - if (handle != HAL_kInvalidHandle) { + if (handle != HAL_INVALID_HANDLE) { HAL_CleanCAN(static_cast(handle)); } } diff --git a/hal/src/main/native/cpp/jni/CTREPCMJNI.cpp b/hal/src/main/native/cpp/jni/CTREPCMJNI.cpp index c3913168e3..f81c1c61dd 100644 --- a/hal/src/main/native/cpp/jni/CTREPCMJNI.cpp +++ b/hal/src/main/native/cpp/jni/CTREPCMJNI.cpp @@ -40,7 +40,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_CTREPCMJNI_free (JNIEnv* env, jclass, jint handle) { - if (handle != HAL_kInvalidHandle) { + if (handle != HAL_INVALID_HANDLE) { HAL_FreeCTREPCM(handle); } } diff --git a/hal/src/main/native/cpp/jni/CounterJNI.cpp b/hal/src/main/native/cpp/jni/CounterJNI.cpp index c16ceab5f7..acd438fa88 100644 --- a/hal/src/main/native/cpp/jni/CounterJNI.cpp +++ b/hal/src/main/native/cpp/jni/CounterJNI.cpp @@ -42,7 +42,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_CounterJNI_freeCounter (JNIEnv* env, jclass, jint id) { - if (id != HAL_kInvalidHandle) { + if (id != HAL_INVALID_HANDLE) { HAL_FreeCounter((HAL_CounterHandle)id); } } diff --git a/hal/src/main/native/cpp/jni/DIOJNI.cpp b/hal/src/main/native/cpp/jni/DIOJNI.cpp index 29c11ee841..cc82e6eec8 100644 --- a/hal/src/main/native/cpp/jni/DIOJNI.cpp +++ b/hal/src/main/native/cpp/jni/DIOJNI.cpp @@ -56,7 +56,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_DIOJNI_freeDIOPort (JNIEnv* env, jclass, jint id) { - if (id != HAL_kInvalidHandle) { + if (id != HAL_INVALID_HANDLE) { HAL_FreeDIOPort((HAL_DigitalHandle)id); } } @@ -213,7 +213,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_DIOJNI_freeDigitalPWM (JNIEnv* env, jclass, jint id) { - if (id != HAL_kInvalidHandle) { + if (id != HAL_INVALID_HANDLE) { HAL_FreeDigitalPWM((HAL_DigitalPWMHandle)id); } } diff --git a/hal/src/main/native/cpp/jni/DutyCycleJNI.cpp b/hal/src/main/native/cpp/jni/DutyCycleJNI.cpp index d894f64cb8..de3e6d663f 100644 --- a/hal/src/main/native/cpp/jni/DutyCycleJNI.cpp +++ b/hal/src/main/native/cpp/jni/DutyCycleJNI.cpp @@ -37,7 +37,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_DutyCycleJNI_free (JNIEnv*, jclass, jint handle) { - if (handle != HAL_kInvalidHandle) { + if (handle != HAL_INVALID_HANDLE) { HAL_FreeDutyCycle(static_cast(handle)); } } diff --git a/hal/src/main/native/cpp/jni/EncoderJNI.cpp b/hal/src/main/native/cpp/jni/EncoderJNI.cpp index 254b8e3be6..3ad0003175 100644 --- a/hal/src/main/native/cpp/jni/EncoderJNI.cpp +++ b/hal/src/main/native/cpp/jni/EncoderJNI.cpp @@ -42,7 +42,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_EncoderJNI_freeEncoder (JNIEnv* env, jclass, jint id) { - if (id != HAL_kInvalidHandle) { + if (id != HAL_INVALID_HANDLE) { HAL_FreeEncoder((HAL_EncoderHandle)id); } } diff --git a/hal/src/main/native/cpp/jni/NotifierJNI.cpp b/hal/src/main/native/cpp/jni/NotifierJNI.cpp index f3af7e5dd9..e4dd9a5e00 100644 --- a/hal/src/main/native/cpp/jni/NotifierJNI.cpp +++ b/hal/src/main/native/cpp/jni/NotifierJNI.cpp @@ -74,7 +74,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_NotifierJNI_destroyNotifier (JNIEnv* env, jclass, jint notifierHandle) { - if (notifierHandle != HAL_kInvalidHandle) { + if (notifierHandle != HAL_INVALID_HANDLE) { HAL_DestroyNotifier((HAL_NotifierHandle)notifierHandle); } } diff --git a/hal/src/main/native/cpp/jni/PWMJNI.cpp b/hal/src/main/native/cpp/jni/PWMJNI.cpp index 1e6ce47723..96d410225b 100644 --- a/hal/src/main/native/cpp/jni/PWMJNI.cpp +++ b/hal/src/main/native/cpp/jni/PWMJNI.cpp @@ -55,7 +55,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_PWMJNI_freePWMPort (JNIEnv* env, jclass, jint id) { - if (id != HAL_kInvalidHandle) { + if (id != HAL_INVALID_HANDLE) { HAL_FreePWMPort((HAL_DigitalHandle)id); } } diff --git a/hal/src/main/native/cpp/jni/PowerDistributionJNI.cpp b/hal/src/main/native/cpp/jni/PowerDistributionJNI.cpp index 035c124fe3..14ae824806 100644 --- a/hal/src/main/native/cpp/jni/PowerDistributionJNI.cpp +++ b/hal/src/main/native/cpp/jni/PowerDistributionJNI.cpp @@ -50,7 +50,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_PowerDistributionJNI_free (JNIEnv*, jclass, jint handle) { - if (handle != HAL_kInvalidHandle) { + if (handle != HAL_INVALID_HANDLE) { HAL_CleanPowerDistribution(handle); } } diff --git a/hal/src/main/native/cpp/jni/SerialPortJNI.cpp b/hal/src/main/native/cpp/jni/SerialPortJNI.cpp index 4f1abe6fe5..18bf4d19f0 100644 --- a/hal/src/main/native/cpp/jni/SerialPortJNI.cpp +++ b/hal/src/main/native/cpp/jni/SerialPortJNI.cpp @@ -305,7 +305,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_SerialPortJNI_serialClose (JNIEnv* env, jclass, jint handle) { - if (handle != HAL_kInvalidHandle) { + if (handle != HAL_INVALID_HANDLE) { HAL_CloseSerial(static_cast(handle)); } } diff --git a/hal/src/main/native/cpp/jni/SimDeviceJNI.cpp b/hal/src/main/native/cpp/jni/SimDeviceJNI.cpp index e450037d1e..3ce8382a1e 100644 --- a/hal/src/main/native/cpp/jni/SimDeviceJNI.cpp +++ b/hal/src/main/native/cpp/jni/SimDeviceJNI.cpp @@ -62,7 +62,7 @@ JNIEXPORT void JNICALL Java_org_wpilib_hardware_hal_SimDeviceJNI_freeSimDevice (JNIEnv*, jclass, jint handle) { - if (handle != HAL_kInvalidHandle) { + if (handle != HAL_INVALID_HANDLE) { HAL_FreeSimDevice(handle); } } diff --git a/hal/src/main/native/cpp/jni/simulation/BufferCallbackStore.cpp b/hal/src/main/native/cpp/jni/simulation/BufferCallbackStore.cpp index 5ff43305f2..693c98ed0e 100644 --- a/hal/src/main/native/cpp/jni/simulation/BufferCallbackStore.cpp +++ b/hal/src/main/native/cpp/jni/simulation/BufferCallbackStore.cpp @@ -91,7 +91,7 @@ SIM_JniHandle sim::AllocateBufferCallback( auto handle = callbackHandles->Allocate(callbackStore); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { return -1; } diff --git a/hal/src/main/native/cpp/jni/simulation/CallbackStore.cpp b/hal/src/main/native/cpp/jni/simulation/CallbackStore.cpp index c7e5f3b281..856e1136d4 100644 --- a/hal/src/main/native/cpp/jni/simulation/CallbackStore.cpp +++ b/hal/src/main/native/cpp/jni/simulation/CallbackStore.cpp @@ -100,7 +100,7 @@ SIM_JniHandle sim::AllocateCallback(JNIEnv* env, jint index, jobject callback, auto handle = callbackHandles->Allocate(callbackStore); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { return -1; } @@ -142,7 +142,7 @@ SIM_JniHandle sim::AllocateChannelCallback( auto handle = callbackHandles->Allocate(callbackStore); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { return -1; } @@ -186,7 +186,7 @@ SIM_JniHandle sim::AllocateCallbackNoIndex( auto handle = callbackHandles->Allocate(callbackStore); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { return -1; } diff --git a/hal/src/main/native/cpp/jni/simulation/ConstBufferCallbackStore.cpp b/hal/src/main/native/cpp/jni/simulation/ConstBufferCallbackStore.cpp index b8f5d9758b..b067f73427 100644 --- a/hal/src/main/native/cpp/jni/simulation/ConstBufferCallbackStore.cpp +++ b/hal/src/main/native/cpp/jni/simulation/ConstBufferCallbackStore.cpp @@ -84,7 +84,7 @@ SIM_JniHandle sim::AllocateConstBufferCallback( auto handle = callbackHandles->Allocate(callbackStore); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { return -1; } diff --git a/hal/src/main/native/cpp/jni/simulation/OpModeOptionsCallbackStore.cpp b/hal/src/main/native/cpp/jni/simulation/OpModeOptionsCallbackStore.cpp index e0e1ca091d..74cfb325df 100644 --- a/hal/src/main/native/cpp/jni/simulation/OpModeOptionsCallbackStore.cpp +++ b/hal/src/main/native/cpp/jni/simulation/OpModeOptionsCallbackStore.cpp @@ -81,7 +81,7 @@ SIM_JniHandle sim::AllocateOpModeOptionsCallback( auto handle = callbackHandles->Allocate(callbackStore); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { return -1; } diff --git a/hal/src/main/native/cpp/jni/simulation/SimDeviceDataJNI.cpp b/hal/src/main/native/cpp/jni/simulation/SimDeviceDataJNI.cpp index 0f77a3bb89..2acf435570 100644 --- a/hal/src/main/native/cpp/jni/simulation/SimDeviceDataJNI.cpp +++ b/hal/src/main/native/cpp/jni/simulation/SimDeviceDataJNI.cpp @@ -211,7 +211,7 @@ static SIM_JniHandle AllocateDeviceCallback( auto handle = deviceCallbackHandles->Allocate(callbackStore); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { return -1; } @@ -268,7 +268,7 @@ static SIM_JniHandle AllocateValueCallback( auto handle = valueCallbackHandles->Allocate(callbackStore); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { return -1; } diff --git a/hal/src/main/native/include/wpi/hal/SimDevice.hpp b/hal/src/main/native/include/wpi/hal/SimDevice.hpp index 5edc99b7eb..0b2a8195a4 100644 --- a/hal/src/main/native/include/wpi/hal/SimDevice.hpp +++ b/hal/src/main/native/include/wpi/hal/SimDevice.hpp @@ -54,7 +54,7 @@ class SimValue { * * @return False if handle is empty, true if handle is valid. */ - explicit operator bool() const { return m_handle != HAL_kInvalidHandle; } + explicit operator bool() const { return m_handle != HAL_INVALID_HANDLE; } /** * Get the internal device handle. @@ -78,7 +78,7 @@ class SimValue { void SetValue(const HAL_Value& value) { HAL_SetSimValue(m_handle, value); } protected: - HAL_SimValueHandle m_handle = HAL_kInvalidHandle; + HAL_SimValueHandle m_handle = HAL_INVALID_HANDLE; }; /** @@ -350,7 +350,7 @@ class SimDevice { SimDevice(const char* name, int index, int channel); ~SimDevice() { - if (m_handle != HAL_kInvalidHandle) { + if (m_handle != HAL_INVALID_HANDLE) { HAL_FreeSimDevice(m_handle); } } @@ -359,12 +359,12 @@ class SimDevice { SimDevice& operator=(const SimDevice&) = delete; SimDevice(SimDevice&& rhs) : m_handle(rhs.m_handle) { - rhs.m_handle = HAL_kInvalidHandle; + rhs.m_handle = HAL_INVALID_HANDLE; } SimDevice& operator=(SimDevice&& rhs) { m_handle = rhs.m_handle; - rhs.m_handle = HAL_kInvalidHandle; + rhs.m_handle = HAL_INVALID_HANDLE; return *this; } @@ -374,7 +374,7 @@ class SimDevice { * * @return False if handle is empty, true if handle is valid. */ - explicit operator bool() const { return m_handle != HAL_kInvalidHandle; } + explicit operator bool() const { return m_handle != HAL_INVALID_HANDLE; } /** * Get the internal device handle. @@ -580,7 +580,7 @@ class SimDevice { } protected: - HAL_SimDeviceHandle m_handle = HAL_kInvalidHandle; + HAL_SimDeviceHandle m_handle = HAL_INVALID_HANDLE; }; } // namespace wpi::hal diff --git a/hal/src/main/native/include/wpi/hal/Types.h b/hal/src/main/native/include/wpi/hal/Types.h index 554aacdf47..7c93550d3b 100644 --- a/hal/src/main/native/include/wpi/hal/Types.h +++ b/hal/src/main/native/include/wpi/hal/Types.h @@ -12,7 +12,7 @@ * @{ */ -#define HAL_kInvalidHandle 0 +#define HAL_INVALID_HANDLE 0 typedef int32_t HAL_Handle; diff --git a/hal/src/main/native/include/wpi/hal/Types.hpp b/hal/src/main/native/include/wpi/hal/Types.hpp index 76c17acb5a..dc0206b0fd 100644 --- a/hal/src/main/native/include/wpi/hal/Types.hpp +++ b/hal/src/main/native/include/wpi/hal/Types.hpp @@ -12,7 +12,7 @@ namespace wpi::hal { * Will free the handle if FreeFunction is provided */ template + int32_t CInvalid = HAL_INVALID_HANDLE> class Handle { public: Handle() = default; diff --git a/hal/src/main/native/include/wpi/hal/handles/DigitalHandleResource.hpp b/hal/src/main/native/include/wpi/hal/handles/DigitalHandleResource.hpp index 06be830c8d..ff7b511729 100644 --- a/hal/src/main/native/include/wpi/hal/handles/DigitalHandleResource.hpp +++ b/hal/src/main/native/include/wpi/hal/handles/DigitalHandleResource.hpp @@ -57,14 +57,14 @@ DigitalHandleResource::Allocate( int16_t index, HAL_HandleEnum enumValue, THandle* handle, int32_t* status) { // don't acquire the lock if we can fail early. if (index < 0 || index >= size) { - *handle = HAL_kInvalidHandle; + *handle = HAL_INVALID_HANDLE; *status = RESOURCE_OUT_OF_RANGE; return nullptr; } std::scoped_lock lock(m_handleMutexes[index]); // check for allocation, otherwise allocate and return a valid handle if (m_structures[index] != nullptr) { - *handle = HAL_kInvalidHandle; + *handle = HAL_INVALID_HANDLE; *status = RESOURCE_IS_ALLOCATED; return m_structures[index]; } diff --git a/hal/src/main/native/include/wpi/hal/handles/IndexedClassedHandleResource.hpp b/hal/src/main/native/include/wpi/hal/handles/IndexedClassedHandleResource.hpp index 01a1349a9b..e8282ead06 100644 --- a/hal/src/main/native/include/wpi/hal/handles/IndexedClassedHandleResource.hpp +++ b/hal/src/main/native/include/wpi/hal/handles/IndexedClassedHandleResource.hpp @@ -62,13 +62,13 @@ IndexedClassedHandleResource::Allocate( // don't acquire the lock if we can fail early. if (index < 0 || index >= size) { *status = RESOURCE_OUT_OF_RANGE; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } std::scoped_lock lock(m_handleMutexes[index]); // check for allocation, otherwise allocate and return a valid handle if (m_structures[index] != nullptr) { *status = RESOURCE_IS_ALLOCATED; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } m_structures[index] = toSet; return static_cast( diff --git a/hal/src/main/native/include/wpi/hal/handles/IndexedHandleResource.hpp b/hal/src/main/native/include/wpi/hal/handles/IndexedHandleResource.hpp index 819294037d..ad263565e2 100644 --- a/hal/src/main/native/include/wpi/hal/handles/IndexedHandleResource.hpp +++ b/hal/src/main/native/include/wpi/hal/handles/IndexedHandleResource.hpp @@ -60,14 +60,14 @@ IndexedHandleResource::Allocate( // don't acquire the lock if we can fail early. if (index < 0 || index >= size) { *status = RESOURCE_OUT_OF_RANGE; - *handle = HAL_kInvalidHandle; + *handle = HAL_INVALID_HANDLE; return nullptr; } std::scoped_lock lock(m_handleMutexes[index]); // check for allocation, otherwise allocate and return a valid handle if (m_structures[index] != nullptr) { *status = RESOURCE_IS_ALLOCATED; - *handle = HAL_kInvalidHandle; + *handle = HAL_INVALID_HANDLE; return m_structures[index]; } m_structures[index] = std::make_shared(); diff --git a/hal/src/main/native/include/wpi/hal/handles/LimitedClassedHandleResource.hpp b/hal/src/main/native/include/wpi/hal/handles/LimitedClassedHandleResource.hpp index 55fda70461..af405cf8f7 100644 --- a/hal/src/main/native/include/wpi/hal/handles/LimitedClassedHandleResource.hpp +++ b/hal/src/main/native/include/wpi/hal/handles/LimitedClassedHandleResource.hpp @@ -67,7 +67,7 @@ LimitedClassedHandleResource::Allocate( return static_cast(createHandle(i, enumValue, m_version)); } } - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } template ::Allocate() { return static_cast(createHandle(i, enumValue, m_version)); } } - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } template ::Allocate( } } if (i >= INT16_MAX) { - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } m_structures.push_back(structure); diff --git a/hal/src/main/native/sim/AddressableLED.cpp b/hal/src/main/native/sim/AddressableLED.cpp index 1fb0fc086a..4a8e030e3d 100644 --- a/hal/src/main/native/sim/AddressableLED.cpp +++ b/hal/src/main/native/sim/AddressableLED.cpp @@ -30,7 +30,7 @@ HAL_AddressableLEDHandle HAL_InitializeAddressableLED( wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for AddressableLED", 0, kNumAddressableLEDs, channel); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_DigitalHandle handle; @@ -47,7 +47,7 @@ HAL_AddressableLEDHandle HAL_InitializeAddressableLED( "Invalid Index for AddressableLED", 0, kNumAddressableLEDs, channel); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } port->channel = static_cast(channel); diff --git a/hal/src/main/native/sim/Alert.cpp b/hal/src/main/native/sim/Alert.cpp index 9cf5538a55..25c520d416 100644 --- a/hal/src/main/native/sim/Alert.cpp +++ b/hal/src/main/native/sim/Alert.cpp @@ -52,9 +52,9 @@ HAL_AlertHandle HAL_CreateAlert(const WPI_String* group, const WPI_String* text, std::shared_ptr alert = std::make_shared( wpi::util::to_string_view(group), wpi::util::to_string_view(text), level); HAL_AlertHandle handle = alertHandles->Allocate(alert); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { *status = HAL_HANDLE_ERROR; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } return handle; } diff --git a/hal/src/main/native/sim/AnalogInput.cpp b/hal/src/main/native/sim/AnalogInput.cpp index abbd0ffe97..755cef541c 100644 --- a/hal/src/main/native/sim/AnalogInput.cpp +++ b/hal/src/main/native/sim/AnalogInput.cpp @@ -24,7 +24,7 @@ HAL_AnalogInputHandle HAL_InitializeAnalogInputPort( *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange( status, "Invalid Index for Analog Input", 0, kNumAnalogInputs, channel); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_AnalogInputHandle handle; @@ -39,7 +39,7 @@ HAL_AnalogInputHandle HAL_InitializeAnalogInputPort( "Invalid Index for Analog Input", 0, kNumAnalogInputs, channel); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } analog_port->channel = static_cast(channel); diff --git a/hal/src/main/native/sim/CANAPI.cpp b/hal/src/main/native/sim/CANAPI.cpp index d04afcd816..87d0ce2bf2 100644 --- a/hal/src/main/native/sim/CANAPI.cpp +++ b/hal/src/main/native/sim/CANAPI.cpp @@ -72,16 +72,16 @@ HAL_CANHandle HAL_InitializeCAN(int32_t busId, HAL_CANManufacturer manufacturer, if (busId < 0 || busId > wpi::hal::kNumCanBuses) { *status = PARAMETER_OUT_OF_RANGE; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } auto can = std::make_shared(); auto handle = canHandles->Allocate(can); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { *status = NO_AVAILABLE_RESOURCES; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } can->busId = busId; diff --git a/hal/src/main/native/sim/CTREPCM.cpp b/hal/src/main/native/sim/CTREPCM.cpp index df59cf64bc..9a26f21cf9 100644 --- a/hal/src/main/native/sim/CTREPCM.cpp +++ b/hal/src/main/native/sim/CTREPCM.cpp @@ -52,7 +52,7 @@ HAL_CTREPCMHandle HAL_InitializeCTREPCM(int32_t busId, int32_t module, "Invalid Index for CTRE PCM", 0, kNumCTREPCMModules - 1, module); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } pcm->previousAllocation = allocationLocation ? allocationLocation : ""; diff --git a/hal/src/main/native/sim/DIO.cpp b/hal/src/main/native/sim/DIO.cpp index 38934257b7..8bf3a24d8e 100644 --- a/hal/src/main/native/sim/DIO.cpp +++ b/hal/src/main/native/sim/DIO.cpp @@ -40,7 +40,7 @@ HAL_DigitalHandle HAL_InitializeDIOPort(int32_t channel, HAL_Bool input, *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for DIO", 0, kNumDigitalChannels, channel); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_DigitalHandle handle; @@ -56,7 +56,7 @@ HAL_DigitalHandle HAL_InitializeDIOPort(int32_t channel, HAL_Bool input, wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for DIO", 0, kNumDigitalChannels, channel); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } port->channel = static_cast(channel); @@ -94,15 +94,15 @@ void HAL_SetDIOSimDevice(HAL_DigitalHandle handle, HAL_SimDeviceHandle device) { HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t* status) { auto handle = digitalPWMHandles->Allocate(); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { *status = NO_AVAILABLE_RESOURCES; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } auto id = digitalPWMHandles->Get(handle); if (id == nullptr) { // would only occur on thread issue. *status = HAL_HANDLE_ERROR; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } *id = static_cast(getHandleIndex(handle)); diff --git a/hal/src/main/native/sim/DutyCycle.cpp b/hal/src/main/native/sim/DutyCycle.cpp index 5c1b95af11..5be29264c7 100644 --- a/hal/src/main/native/sim/DutyCycle.cpp +++ b/hal/src/main/native/sim/DutyCycle.cpp @@ -42,7 +42,7 @@ HAL_DutyCycleHandle HAL_InitializeDutyCycle(int32_t channel, int32_t* status) { wpi::hal::init::CheckInit(); - HAL_DutyCycleHandle handle = HAL_kInvalidHandle; + HAL_DutyCycleHandle handle = HAL_INVALID_HANDLE; auto dutyCycle = dutyCycleHandles->Allocate(channel, &handle, status); if (*status != 0) { @@ -53,7 +53,7 @@ HAL_DutyCycleHandle HAL_InitializeDutyCycle(int32_t channel, wpi::hal::SetLastErrorIndexOutOfRange( status, "Invalid Index for Duty Cycle", 0, kNumDutyCycles, channel); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } int16_t index = getHandleIndex(handle); diff --git a/hal/src/main/native/sim/Encoder.cpp b/hal/src/main/native/sim/Encoder.cpp index e13015ab95..4bbc3e05d1 100644 --- a/hal/src/main/native/sim/Encoder.cpp +++ b/hal/src/main/native/sim/Encoder.cpp @@ -71,7 +71,7 @@ HAL_EncoderHandle HAL_InitializeEncoder(int32_t aChannel, int32_t bChannel, HAL_EncoderEncodingType encodingType, int32_t* status) { wpi::hal::init::CheckInit(); - HAL_Handle nativeHandle = HAL_kInvalidHandle; + HAL_Handle nativeHandle = HAL_INVALID_HANDLE; if (encodingType == HAL_EncoderEncodingType::HAL_ENCODER_4X_ENCODING) { // k4x, allocate encoder nativeHandle = fpgaEncoderHandles->Allocate(); @@ -79,19 +79,19 @@ HAL_EncoderHandle HAL_InitializeEncoder(int32_t aChannel, int32_t bChannel, // k2x or k1x, allocate counter nativeHandle = counterHandles->Allocate(); } - if (nativeHandle == HAL_kInvalidHandle) { + if (nativeHandle == HAL_INVALID_HANDLE) { *status = NO_AVAILABLE_RESOURCES; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } auto handle = encoderHandles->Allocate(); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { *status = NO_AVAILABLE_RESOURCES; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } auto encoder = encoderHandles->Get(handle); if (encoder == nullptr) { // would only occur on thread issue *status = HAL_HANDLE_ERROR; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } int16_t index = getHandleIndex(handle); SimEncoderData[index].digitalChannelA = aChannel; @@ -106,9 +106,9 @@ HAL_EncoderHandle HAL_InitializeEncoder(int32_t aChannel, int32_t bChannel, encoder->distancePerPulse = 1.0; if (encodingType == HAL_EncoderEncodingType::HAL_ENCODER_4X_ENCODING) { encoder->fpgaHandle = nativeHandle; - encoder->counterHandle = HAL_kInvalidHandle; + encoder->counterHandle = HAL_INVALID_HANDLE; } else { - encoder->fpgaHandle = HAL_kInvalidHandle; + encoder->fpgaHandle = HAL_INVALID_HANDLE; encoder->counterHandle = nativeHandle; } return handle; diff --git a/hal/src/main/native/sim/Notifier.cpp b/hal/src/main/native/sim/Notifier.cpp index 2c6cd1ea8d..c079c8ddbc 100644 --- a/hal/src/main/native/sim/Notifier.cpp +++ b/hal/src/main/native/sim/Notifier.cpp @@ -216,9 +216,9 @@ HAL_NotifierHandle HAL_CreateNotifier(int32_t* status) { std::shared_ptr notifier = std::make_shared(); HAL_NotifierHandle handle = notifierInstance->owner.GetThread()->m_handles.Allocate(notifier); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { *status = HAL_HANDLE_ERROR; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } wpi::util::CreateSignalObject(handle); return handle; diff --git a/hal/src/main/native/sim/PWM.cpp b/hal/src/main/native/sim/PWM.cpp index 35536618a3..d34a6febf6 100644 --- a/hal/src/main/native/sim/PWM.cpp +++ b/hal/src/main/native/sim/PWM.cpp @@ -30,7 +30,7 @@ HAL_DigitalHandle HAL_InitializePWMPort(int32_t channel, *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for PWM", 0, kNumPWMChannels, channel); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } uint8_t origChannel = static_cast(channel); @@ -54,7 +54,7 @@ HAL_DigitalHandle HAL_InitializePWMPort(int32_t channel, wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for PWM", 0, kNumPWMChannels, channel); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } port->channel = origChannel; diff --git a/hal/src/main/native/sim/PowerDistribution.cpp b/hal/src/main/native/sim/PowerDistribution.cpp index 42c121e7c3..94f8bb5cbb 100644 --- a/hal/src/main/native/sim/PowerDistribution.cpp +++ b/hal/src/main/native/sim/PowerDistribution.cpp @@ -35,7 +35,7 @@ HAL_PowerDistributionHandle HAL_InitializePowerDistribution( *status = PARAMETER_OUT_OF_RANGE; wpi::hal::SetLastError( status, "Automatic PowerDistributionType must have default module"); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } // TODO Make this not matter @@ -53,7 +53,7 @@ HAL_PowerDistributionHandle HAL_InitializePowerDistribution( wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for REV PDH", 1, kNumREVPDHModules, module); } - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } wpi::hal::init::CheckInit(); SimPowerDistributionData[module].initialized = true; @@ -62,7 +62,7 @@ HAL_PowerDistributionHandle HAL_InitializePowerDistribution( if (*status != 0) { HAL_CleanCAN(handle); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } return handle; diff --git a/hal/src/main/native/sim/REVPH.cpp b/hal/src/main/native/sim/REVPH.cpp index 14fc6c8f02..52eb0f7441 100644 --- a/hal/src/main/native/sim/REVPH.cpp +++ b/hal/src/main/native/sim/REVPH.cpp @@ -44,7 +44,7 @@ HAL_REVPHHandle HAL_InitializeREVPH(int32_t busId, int32_t module, *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for REV PH", 1, kNumREVPHModules, module); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_REVPHHandle handle; @@ -59,7 +59,7 @@ HAL_REVPHHandle HAL_InitializeREVPH(int32_t busId, int32_t module, wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for REV PH", 1, kNumREVPHModules, module); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } pcm->previousAllocation = allocationLocation ? allocationLocation : ""; diff --git a/hal/src/main/native/sim/SerialPort.cpp b/hal/src/main/native/sim/SerialPort.cpp index 43c319687c..bec8668aeb 100644 --- a/hal/src/main/native/sim/SerialPort.cpp +++ b/hal/src/main/native/sim/SerialPort.cpp @@ -14,14 +14,14 @@ extern "C" { HAL_SerialPortHandle HAL_InitializeSerialPort(HAL_SerialPort port, int32_t* status) { wpi::hal::init::CheckInit(); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_SerialPortHandle HAL_InitializeSerialPortDirect(HAL_SerialPort port, const char* portName, int32_t* status) { wpi::hal::init::CheckInit(); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } int HAL_GetSerialFD(HAL_SerialPortHandle handle, int32_t* status) { diff --git a/hal/src/main/native/systemcore/AddressableLED.cpp b/hal/src/main/native/systemcore/AddressableLED.cpp index d0a022bfe4..fb687c2331 100644 --- a/hal/src/main/native/systemcore/AddressableLED.cpp +++ b/hal/src/main/native/systemcore/AddressableLED.cpp @@ -92,7 +92,7 @@ HAL_AddressableLEDHandle HAL_InitializeAddressableLED( *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange( status, "Invalid Index for AddressableLED", 0, kNumSmartIo, channel); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_DigitalHandle handle; @@ -108,7 +108,7 @@ HAL_AddressableLEDHandle HAL_InitializeAddressableLED( wpi::hal::SetLastErrorIndexOutOfRange( status, "Invalid Index for AddressableLED", 0, kNumSmartIo, channel); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } port->channel = channel; @@ -116,7 +116,7 @@ HAL_AddressableLEDHandle HAL_InitializeAddressableLED( *status = port->InitializeMode(SmartIoMode::AddressableLED); if (*status != 0) { smartIoHandles->Free(handle, HAL_HandleEnum::ADDRESSABLE_LED); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } port->previousAllocation = allocationLocation ? allocationLocation : ""; diff --git a/hal/src/main/native/systemcore/Alert.cpp b/hal/src/main/native/systemcore/Alert.cpp index deb1d9d1b9..03c8fc6b9d 100644 --- a/hal/src/main/native/systemcore/Alert.cpp +++ b/hal/src/main/native/systemcore/Alert.cpp @@ -52,9 +52,9 @@ HAL_AlertHandle HAL_CreateAlert(const WPI_String* group, const WPI_String* text, std::shared_ptr alert = std::make_shared( wpi::util::to_string_view(group), wpi::util::to_string_view(text), level); HAL_AlertHandle handle = alertHandles->Allocate(alert); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { *status = HAL_HANDLE_ERROR; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } return handle; } diff --git a/hal/src/main/native/systemcore/AnalogInput.cpp b/hal/src/main/native/systemcore/AnalogInput.cpp index 1ee4ca25cb..36ac56f5e1 100644 --- a/hal/src/main/native/systemcore/AnalogInput.cpp +++ b/hal/src/main/native/systemcore/AnalogInput.cpp @@ -31,7 +31,7 @@ HAL_AnalogInputHandle HAL_InitializeAnalogInputPort( *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for Analog", 0, kNumSmartIo, channel); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_DigitalHandle handle; @@ -47,7 +47,7 @@ HAL_AnalogInputHandle HAL_InitializeAnalogInputPort( wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for Analog", 0, kNumSmartIo, channel); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } port->channel = channel; @@ -55,7 +55,7 @@ HAL_AnalogInputHandle HAL_InitializeAnalogInputPort( *status = port->InitializeMode(SmartIoMode::AnalogInput); if (*status != 0) { smartIoHandles->Free(handle, HAL_HandleEnum::ANALOG_INPUT); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } port->previousAllocation = allocationLocation ? allocationLocation : ""; diff --git a/hal/src/main/native/systemcore/CAN.cpp b/hal/src/main/native/systemcore/CAN.cpp index 44090e8fb2..3837440ac9 100644 --- a/hal/src/main/native/systemcore/CAN.cpp +++ b/hal/src/main/native/systemcore/CAN.cpp @@ -428,7 +428,7 @@ HAL_CANStreamHandle HAL_CAN_OpenStreamSession(int32_t busId, uint32_t messageId, int32_t* status) { if (busId < 0 || busId >= wpi::hal::kNumCanBuses) { *status = PARAMETER_OUT_OF_RANGE; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } auto can = std::make_shared(maxMessages, busId, @@ -436,9 +436,9 @@ HAL_CANStreamHandle HAL_CAN_OpenStreamSession(int32_t busId, uint32_t messageId, auto handle = canStreamHandles->Allocate(can); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { *status = NO_AVAILABLE_RESOURCES; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } std::scoped_lock lock{canState->readMutex[can->canBusId]}; diff --git a/hal/src/main/native/systemcore/CANAPI.cpp b/hal/src/main/native/systemcore/CANAPI.cpp index 086088531d..c927579df5 100644 --- a/hal/src/main/native/systemcore/CANAPI.cpp +++ b/hal/src/main/native/systemcore/CANAPI.cpp @@ -60,16 +60,16 @@ HAL_CANHandle HAL_InitializeCAN(int32_t busId, HAL_CANManufacturer manufacturer, if (busId < 0 || busId > wpi::hal::kNumCanBuses) { *status = PARAMETER_OUT_OF_RANGE; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } auto can = std::make_shared(); auto handle = canHandles->Allocate(can); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { *status = NO_AVAILABLE_RESOURCES; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } can->busId = busId; diff --git a/hal/src/main/native/systemcore/CTREPCM.cpp b/hal/src/main/native/systemcore/CTREPCM.cpp index b227d0b835..556da4a5b0 100644 --- a/hal/src/main/native/systemcore/CTREPCM.cpp +++ b/hal/src/main/native/systemcore/CTREPCM.cpp @@ -192,14 +192,14 @@ HAL_CTREPCMHandle HAL_InitializeCTREPCM(int32_t busId, int32_t module, "Invalid Index for CTRE PCM", 0, kNumCTREPCMModules - 1, module); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } pcm->canHandle = HAL_InitializeCAN(busId, manufacturer, module, deviceType, status); if (*status != 0) { pcmHandles->Free(handle); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } std::memset(&pcm->oneShot, 0, sizeof(pcm->oneShot)); @@ -211,7 +211,7 @@ HAL_CTREPCMHandle HAL_InitializeCTREPCM(int32_t busId, int32_t module, HAL_SetCTREPCMClosedLoopControl(handle, true, status); if (*status != 0) { HAL_FreeCTREPCM(handle); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } return handle; } diff --git a/hal/src/main/native/systemcore/CTREPDP.cpp b/hal/src/main/native/systemcore/CTREPDP.cpp index 1f1b077066..4b6e0c9af9 100644 --- a/hal/src/main/native/systemcore/CTREPDP.cpp +++ b/hal/src/main/native/systemcore/CTREPDP.cpp @@ -136,7 +136,7 @@ HAL_PDPHandle HAL_InitializePDP(int32_t busId, int32_t module, *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for CTRE PDP", 0, kNumCTREPDPModules - 1, module); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_PDPHandle handle; @@ -151,14 +151,14 @@ HAL_PDPHandle HAL_InitializePDP(int32_t busId, int32_t module, "Invalid Index for CTRE PDP", 0, kNumCTREPDPModules - 1, module); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } pdp->canHandle = HAL_InitializeCAN(busId, manufacturer, module, deviceType, status); if (*status != 0) { pdpHandles->Free(handle); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } pdp->previousAllocation = allocationLocation ? allocationLocation : ""; diff --git a/hal/src/main/native/systemcore/Counter.cpp b/hal/src/main/native/systemcore/Counter.cpp index 49b59dc113..e8fbfb5039 100644 --- a/hal/src/main/native/systemcore/Counter.cpp +++ b/hal/src/main/native/systemcore/Counter.cpp @@ -31,7 +31,7 @@ HAL_CounterHandle HAL_InitializeCounter(int channel, HAL_Bool risingEdge, *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for Counter", 0, kNumSmartIo, channel); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_CounterHandle handle; @@ -47,7 +47,7 @@ HAL_CounterHandle HAL_InitializeCounter(int channel, HAL_Bool risingEdge, wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for Counter", 0, kNumSmartIo, channel); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } port->channel = channel; @@ -57,7 +57,7 @@ HAL_CounterHandle HAL_InitializeCounter(int channel, HAL_Bool risingEdge, : SmartIoMode::SingleCounterFalling); if (*status != 0) { smartIoHandles->Free(handle, HAL_HandleEnum::COUNTER); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } port->previousAllocation = allocationLocation ? allocationLocation : ""; diff --git a/hal/src/main/native/systemcore/DIO.cpp b/hal/src/main/native/systemcore/DIO.cpp index 3b1abb5321..07ee2348c9 100644 --- a/hal/src/main/native/systemcore/DIO.cpp +++ b/hal/src/main/native/systemcore/DIO.cpp @@ -33,7 +33,7 @@ HAL_DigitalHandle HAL_InitializeDIOPort(int32_t channel, HAL_Bool input, *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for DIO", 0, kNumSmartIo, channel); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_DigitalHandle handle; @@ -49,7 +49,7 @@ HAL_DigitalHandle HAL_InitializeDIOPort(int32_t channel, HAL_Bool input, wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for DIO", 0, kNumSmartIo, channel); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } port->channel = channel; @@ -58,7 +58,7 @@ HAL_DigitalHandle HAL_InitializeDIOPort(int32_t channel, HAL_Bool input, : SmartIoMode::DigitalOutput); if (*status != 0) { smartIoHandles->Free(handle, HAL_HandleEnum::DIO); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } port->previousAllocation = allocationLocation ? allocationLocation : ""; @@ -96,7 +96,7 @@ void HAL_SetDIOSimDevice(HAL_DigitalHandle handle, HAL_SimDeviceHandle device) { HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t* status) { *status = HAL_HANDLE_ERROR; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } void HAL_FreeDigitalPWM(HAL_DigitalPWMHandle pwmGenerator) {} diff --git a/hal/src/main/native/systemcore/DutyCycle.cpp b/hal/src/main/native/systemcore/DutyCycle.cpp index e2c6424e81..4647d6cce6 100644 --- a/hal/src/main/native/systemcore/DutyCycle.cpp +++ b/hal/src/main/native/systemcore/DutyCycle.cpp @@ -31,7 +31,7 @@ HAL_DutyCycleHandle HAL_InitializeDutyCycle(int32_t channel, *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for DutyCycle", 0, kNumSmartIo, channel); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_DigitalHandle handle; @@ -47,7 +47,7 @@ HAL_DutyCycleHandle HAL_InitializeDutyCycle(int32_t channel, wpi::hal::SetLastErrorIndexOutOfRange( status, "Invalid Index for DutyCycle", 0, kNumSmartIo, channel); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } port->channel = channel; @@ -55,7 +55,7 @@ HAL_DutyCycleHandle HAL_InitializeDutyCycle(int32_t channel, *status = port->InitializeMode(SmartIoMode::PwmInput); if (*status != 0) { smartIoHandles->Free(handle, HAL_HandleEnum::DUTY_CYCLE); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } port->previousAllocation = allocationLocation ? allocationLocation : ""; diff --git a/hal/src/main/native/systemcore/Encoder.cpp b/hal/src/main/native/systemcore/Encoder.cpp index c5a9a00964..a4b2a7d9fa 100644 --- a/hal/src/main/native/systemcore/Encoder.cpp +++ b/hal/src/main/native/systemcore/Encoder.cpp @@ -22,7 +22,7 @@ HAL_EncoderHandle HAL_InitializeEncoder(int32_t aChannel, int32_t bChannel, int32_t* status) { wpi::hal::init::CheckInit(); *status = HAL_HANDLE_ERROR; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } void HAL_FreeEncoder(HAL_EncoderHandle encoderHandle) {} diff --git a/hal/src/main/native/systemcore/Notifier.cpp b/hal/src/main/native/systemcore/Notifier.cpp index 66fe172a47..839204aa68 100644 --- a/hal/src/main/native/systemcore/Notifier.cpp +++ b/hal/src/main/native/systemcore/Notifier.cpp @@ -142,9 +142,9 @@ HAL_NotifierHandle HAL_CreateNotifier(int32_t* status) { std::shared_ptr notifier = std::make_shared(); HAL_NotifierHandle handle = notifierInstance->owner.GetThread()->m_handles.Allocate(notifier); - if (handle == HAL_kInvalidHandle) { + if (handle == HAL_INVALID_HANDLE) { *status = HAL_HANDLE_ERROR; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } wpi::util::CreateSignalObject(handle); return handle; diff --git a/hal/src/main/native/systemcore/PWM.cpp b/hal/src/main/native/systemcore/PWM.cpp index 267f654b0c..d20b940e0a 100644 --- a/hal/src/main/native/systemcore/PWM.cpp +++ b/hal/src/main/native/systemcore/PWM.cpp @@ -35,7 +35,7 @@ HAL_DigitalHandle HAL_InitializePWMPort(int32_t channel, *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for PWM", 0, kNumSmartIo, channel); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_DigitalHandle handle; @@ -51,7 +51,7 @@ HAL_DigitalHandle HAL_InitializePWMPort(int32_t channel, wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for PWM", 0, kNumSmartIo, channel); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } port->channel = channel; @@ -59,14 +59,14 @@ HAL_DigitalHandle HAL_InitializePWMPort(int32_t channel, *status = port->InitializeMode(SmartIoMode::PwmOutput); if (*status != 0) { smartIoHandles->Free(handle, HAL_HandleEnum::PWM); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } // Disable the PWM output. HAL_SetPWMPulseTimeMicroseconds(handle, 0, status); if (*status != 0) { smartIoHandles->Free(handle, HAL_HandleEnum::PWM); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } port->previousAllocation = allocationLocation ? allocationLocation : ""; diff --git a/hal/src/main/native/systemcore/PowerDistribution.cpp b/hal/src/main/native/systemcore/PowerDistribution.cpp index 818fb09d6a..05a94651ca 100644 --- a/hal/src/main/native/systemcore/PowerDistribution.cpp +++ b/hal/src/main/native/systemcore/PowerDistribution.cpp @@ -27,7 +27,7 @@ HAL_PowerDistributionHandle HAL_InitializePowerDistribution( *status = PARAMETER_OUT_OF_RANGE; wpi::hal::SetLastError( status, "Automatic PowerDistributionType must have default module"); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } uint64_t waitTime = wpi::hal::GetDSInitializeTime() + 400000; @@ -44,7 +44,7 @@ HAL_PowerDistributionHandle HAL_InitializePowerDistribution( // Try PDP first auto pdpHandle = HAL_InitializePDP(busId, 0, allocationLocation, status); - if (pdpHandle != HAL_kInvalidHandle) { + if (pdpHandle != HAL_INVALID_HANDLE) { *status = 0; HAL_GetPDPVoltage(pdpHandle, status); if (*status == 0 || *status == HAL_CAN_TIMEOUT) { diff --git a/hal/src/main/native/systemcore/REVPDH.cpp b/hal/src/main/native/systemcore/REVPDH.cpp index d5fe5c6f08..6688a79f52 100644 --- a/hal/src/main/native/systemcore/REVPDH.cpp +++ b/hal/src/main/native/systemcore/REVPDH.cpp @@ -196,7 +196,7 @@ HAL_REVPDHHandle HAL_InitializeREVPDH(int32_t busId, int32_t module, *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for REV PDH", 1, kNumREVPDHModules, module); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_REVPDHHandle handle; @@ -210,7 +210,7 @@ HAL_REVPDHHandle HAL_InitializeREVPDH(int32_t busId, int32_t module, wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for REV PDH", 1, kNumREVPDHModules, module); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } HAL_CANHandle hcan = @@ -218,7 +218,7 @@ HAL_REVPDHHandle HAL_InitializeREVPDH(int32_t busId, int32_t module, if (*status != 0) { REVPDHHandles->Free(handle); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } hpdh->previousAllocation = allocationLocation ? allocationLocation : ""; diff --git a/hal/src/main/native/systemcore/REVPH.cpp b/hal/src/main/native/systemcore/REVPH.cpp index 9552896340..33433978bd 100644 --- a/hal/src/main/native/systemcore/REVPH.cpp +++ b/hal/src/main/native/systemcore/REVPH.cpp @@ -199,7 +199,7 @@ HAL_REVPHHandle HAL_InitializeREVPH(int32_t busId, int32_t module, *status = RESOURCE_OUT_OF_RANGE; wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for REV PH", 1, kNumREVPHModules, module); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_REVPHHandle handle; @@ -213,7 +213,7 @@ HAL_REVPHHandle HAL_InitializeREVPH(int32_t busId, int32_t module, wpi::hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for REV PH", 1, kNumREVPHModules, module); } - return HAL_kInvalidHandle; // failed to allocate. Pass error back. + return HAL_INVALID_HANDLE; // failed to allocate. Pass error back. } HAL_CANHandle hcan = @@ -221,7 +221,7 @@ HAL_REVPHHandle HAL_InitializeREVPH(int32_t busId, int32_t module, if (*status != 0) { REVPHHandles->Free(handle); - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } hph->previousAllocation = allocationLocation ? allocationLocation : ""; diff --git a/hal/src/main/native/systemcore/SerialPort.cpp b/hal/src/main/native/systemcore/SerialPort.cpp index ec80897776..485eb4f68f 100644 --- a/hal/src/main/native/systemcore/SerialPort.cpp +++ b/hal/src/main/native/systemcore/SerialPort.cpp @@ -34,13 +34,13 @@ HAL_SerialPortHandle HAL_InitializeSerialPort(HAL_SerialPort port, // wpi::hal::init::CheckInit(); *status = HAL_HANDLE_ERROR; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } HAL_SerialPortHandle HAL_InitializeSerialPortDirect(HAL_SerialPort port, const char* portName, int32_t* status) { *status = HAL_HANDLE_ERROR; - return HAL_kInvalidHandle; + return HAL_INVALID_HANDLE; } void HAL_CloseSerial(HAL_SerialPortHandle handle) {} diff --git a/hal/src/test/native/cpp/can/CANTest.cpp b/hal/src/test/native/cpp/can/CANTest.cpp index f8a3a2f482..381ea36f61 100644 --- a/hal/src/test/native/cpp/can/CANTest.cpp +++ b/hal/src/test/native/cpp/can/CANTest.cpp @@ -20,7 +20,7 @@ struct CANTestStore { } ~CANTestStore() { - if (handle != HAL_kInvalidHandle) { + if (handle != HAL_INVALID_HANDLE) { HAL_CleanCAN(handle); } } diff --git a/hal/src/test/native/cpp/mockdata/AnalogInDataTest.cpp b/hal/src/test/native/cpp/mockdata/AnalogInDataTest.cpp index 9889e9b079..56f6c78175 100644 --- a/hal/src/test/native/cpp/mockdata/AnalogInDataTest.cpp +++ b/hal/src/test/native/cpp/mockdata/AnalogInDataTest.cpp @@ -41,7 +41,7 @@ TEST(AnalogInSimTest, AnalogInInitialization) { channel = 8000; gTestAnalogInCallbackName = "Unset"; analogInHandle = HAL_InitializeAnalogInputPort(channel, nullptr, &status); - EXPECT_EQ(HAL_kInvalidHandle, analogInHandle); + EXPECT_EQ(HAL_INVALID_HANDLE, analogInHandle); EXPECT_EQ(HAL_USE_LAST_ERROR, status); HAL_GetLastError(&status); EXPECT_EQ(RESOURCE_OUT_OF_RANGE, status); @@ -52,7 +52,7 @@ TEST(AnalogInSimTest, AnalogInInitialization) { channel = INDEX_TO_TEST; gTestAnalogInCallbackName = "Unset"; analogInHandle = HAL_InitializeAnalogInputPort(channel, nullptr, &status); - EXPECT_TRUE(HAL_kInvalidHandle != analogInHandle); + EXPECT_TRUE(HAL_INVALID_HANDLE != analogInHandle); EXPECT_EQ(0, status); EXPECT_STREQ("Initialized", gTestAnalogInCallbackName.c_str()); @@ -61,7 +61,7 @@ TEST(AnalogInSimTest, AnalogInInitialization) { channel = INDEX_TO_TEST; gTestAnalogInCallbackName = "Unset"; analogInHandle = HAL_InitializeAnalogInputPort(channel, nullptr, &status); - EXPECT_EQ(HAL_kInvalidHandle, analogInHandle); + EXPECT_EQ(HAL_INVALID_HANDLE, analogInHandle); EXPECT_EQ(HAL_USE_LAST_ERROR, status); HAL_GetLastError(&status); EXPECT_EQ(RESOURCE_IS_ALLOCATED, status); @@ -78,7 +78,7 @@ TEST(AnalogInSimTest, AnalogInInitialization) { channel = INDEX_TO_TEST; gTestAnalogInCallbackName = "Unset"; analogInHandle = HAL_InitializeAnalogInputPort(channel, nullptr, &status); - EXPECT_TRUE(HAL_kInvalidHandle != analogInHandle); + EXPECT_TRUE(HAL_INVALID_HANDLE != analogInHandle); EXPECT_EQ(0, status); EXPECT_STREQ("Initialized", gTestAnalogInCallbackName.c_str()); HALSIM_CancelAnalogInInitializedCallback(INDEX_TO_TEST, callbackId); diff --git a/hal/src/test/native/cpp/mockdata/DIODataTest.cpp b/hal/src/test/native/cpp/mockdata/DIODataTest.cpp index b2ddd6dcbb..85fc66139f 100644 --- a/hal/src/test/native/cpp/mockdata/DIODataTest.cpp +++ b/hal/src/test/native/cpp/mockdata/DIODataTest.cpp @@ -41,7 +41,7 @@ TEST(DigitalIoSimTest, DigitalIoInitialization) { channel = 8000; gTestDigitalIoCallbackName = "Unset"; digitalIoHandle = HAL_InitializeDIOPort(channel, true, nullptr, &status); - EXPECT_EQ(HAL_kInvalidHandle, digitalIoHandle); + EXPECT_EQ(HAL_INVALID_HANDLE, digitalIoHandle); EXPECT_EQ(HAL_USE_LAST_ERROR, status); HAL_GetLastError(&status); EXPECT_EQ(RESOURCE_OUT_OF_RANGE, status); @@ -52,7 +52,7 @@ TEST(DigitalIoSimTest, DigitalIoInitialization) { channel = INDEX_TO_TEST; gTestDigitalIoCallbackName = "Unset"; digitalIoHandle = HAL_InitializeDIOPort(channel, true, nullptr, &status); - EXPECT_TRUE(HAL_kInvalidHandle != digitalIoHandle); + EXPECT_TRUE(HAL_INVALID_HANDLE != digitalIoHandle); EXPECT_EQ(0, status); EXPECT_STREQ("Initialized", gTestDigitalIoCallbackName.c_str()); @@ -61,7 +61,7 @@ TEST(DigitalIoSimTest, DigitalIoInitialization) { channel = INDEX_TO_TEST; gTestDigitalIoCallbackName = "Unset"; digitalIoHandle = HAL_InitializeDIOPort(channel, true, nullptr, &status); - EXPECT_EQ(HAL_kInvalidHandle, digitalIoHandle); + EXPECT_EQ(HAL_INVALID_HANDLE, digitalIoHandle); EXPECT_EQ(HAL_USE_LAST_ERROR, status); HAL_GetLastError(&status); EXPECT_EQ(RESOURCE_IS_ALLOCATED, status); @@ -78,7 +78,7 @@ TEST(DigitalIoSimTest, DigitalIoInitialization) { channel = INDEX_TO_TEST; gTestDigitalIoCallbackName = "Unset"; digitalIoHandle = HAL_InitializeDIOPort(channel, true, nullptr, &status); - EXPECT_TRUE(HAL_kInvalidHandle != digitalIoHandle); + EXPECT_TRUE(HAL_INVALID_HANDLE != digitalIoHandle); EXPECT_EQ(0, status); EXPECT_STREQ("Initialized", gTestDigitalIoCallbackName.c_str()); HALSIM_CancelDIOInitializedCallback(INDEX_TO_TEST, callbackId); diff --git a/hal/src/test/native/cpp/mockdata/PCMDataTest.cpp b/hal/src/test/native/cpp/mockdata/PCMDataTest.cpp index 32ceb6e66b..dd9dab3128 100644 --- a/hal/src/test/native/cpp/mockdata/PCMDataTest.cpp +++ b/hal/src/test/native/cpp/mockdata/PCMDataTest.cpp @@ -40,7 +40,7 @@ TEST(PCMDataTest, PCMInitialization) { module = 8000; gTestSolenoidCallbackName = "Unset"; pcmHandle = HAL_InitializeCTREPCM(0, module, nullptr, &status); - EXPECT_EQ(HAL_kInvalidHandle, pcmHandle); + EXPECT_EQ(HAL_INVALID_HANDLE, pcmHandle); EXPECT_EQ(HAL_USE_LAST_ERROR, status); HAL_GetLastError(&status); EXPECT_EQ(RESOURCE_OUT_OF_RANGE, status); @@ -51,7 +51,7 @@ TEST(PCMDataTest, PCMInitialization) { module = MODULE_TO_TEST; gTestSolenoidCallbackName = "Unset"; pcmHandle = HAL_InitializeCTREPCM(0, module, nullptr, &status); - EXPECT_TRUE(HAL_kInvalidHandle != pcmHandle); + EXPECT_TRUE(HAL_INVALID_HANDLE != pcmHandle); EXPECT_EQ(0, status); EXPECT_STREQ("Initialized", gTestSolenoidCallbackName.c_str()); @@ -60,7 +60,7 @@ TEST(PCMDataTest, PCMInitialization) { module = MODULE_TO_TEST; gTestSolenoidCallbackName = "Unset"; pcmHandle = HAL_InitializeCTREPCM(0, module, nullptr, &status); - EXPECT_EQ(HAL_kInvalidHandle, pcmHandle); + EXPECT_EQ(HAL_INVALID_HANDLE, pcmHandle); EXPECT_EQ(HAL_USE_LAST_ERROR, status); HAL_GetLastError(&status); EXPECT_EQ(RESOURCE_IS_ALLOCATED, status); @@ -78,7 +78,7 @@ TEST(PCMDataTest, PCMInitialization) { module = MODULE_TO_TEST; gTestSolenoidCallbackName = "Unset"; pcmHandle = HAL_InitializeCTREPCM(0, module, nullptr, &status); - EXPECT_TRUE(HAL_kInvalidHandle != pcmHandle); + EXPECT_TRUE(HAL_INVALID_HANDLE != pcmHandle); EXPECT_EQ(0, status); EXPECT_STREQ("Initialized", gTestSolenoidCallbackName.c_str()); } diff --git a/hal/src/test/native/cpp/mockdata/PWMDataTest.cpp b/hal/src/test/native/cpp/mockdata/PWMDataTest.cpp index c0bc14e94e..29842e2ccd 100644 --- a/hal/src/test/native/cpp/mockdata/PWMDataTest.cpp +++ b/hal/src/test/native/cpp/mockdata/PWMDataTest.cpp @@ -40,7 +40,7 @@ TEST(PWMSimTest, PwmInitialization) { channel = 8000; gTestPwmCallbackName = "Unset"; pwmHandle = HAL_InitializePWMPort(channel, nullptr, &status); - EXPECT_EQ(HAL_kInvalidHandle, pwmHandle); + EXPECT_EQ(HAL_INVALID_HANDLE, pwmHandle); EXPECT_EQ(HAL_USE_LAST_ERROR, status); HAL_GetLastError(&status); EXPECT_EQ(RESOURCE_OUT_OF_RANGE, status); @@ -51,7 +51,7 @@ TEST(PWMSimTest, PwmInitialization) { channel = INDEX_TO_TEST; gTestPwmCallbackName = "Unset"; pwmHandle = HAL_InitializePWMPort(channel, nullptr, &status); - EXPECT_TRUE(HAL_kInvalidHandle != pwmHandle); + EXPECT_TRUE(HAL_INVALID_HANDLE != pwmHandle); EXPECT_EQ(0, status); EXPECT_STREQ("Initialized", gTestPwmCallbackName.c_str()); @@ -60,7 +60,7 @@ TEST(PWMSimTest, PwmInitialization) { channel = INDEX_TO_TEST; gTestPwmCallbackName = "Unset"; pwmHandle = HAL_InitializePWMPort(channel, nullptr, &status); - EXPECT_EQ(HAL_kInvalidHandle, pwmHandle); + EXPECT_EQ(HAL_INVALID_HANDLE, pwmHandle); EXPECT_EQ(HAL_USE_LAST_ERROR, status); HAL_GetLastError(&status); EXPECT_EQ(RESOURCE_IS_ALLOCATED, status); @@ -76,7 +76,7 @@ TEST(PWMSimTest, PwmInitialization) { channel = INDEX_TO_TEST; gTestPwmCallbackName = "Unset"; pwmHandle = HAL_InitializePWMPort(channel, nullptr, &status); - EXPECT_TRUE(HAL_kInvalidHandle != pwmHandle); + EXPECT_TRUE(HAL_INVALID_HANDLE != pwmHandle); EXPECT_EQ(0, status); EXPECT_STREQ("Initialized", gTestPwmCallbackName.c_str()); HALSIM_CancelPWMInitializedCallback(INDEX_TO_TEST, callbackId); diff --git a/wpilibc/src/main/native/cpp/framework/TimedRobot.cpp b/wpilibc/src/main/native/cpp/framework/TimedRobot.cpp index 2224a3aa4b..1b1199a4b1 100644 --- a/wpilibc/src/main/native/cpp/framework/TimedRobot.cpp +++ b/wpilibc/src/main/native/cpp/framework/TimedRobot.cpp @@ -71,7 +71,7 @@ void TimedRobot::StartCompetition() { void TimedRobot::EndCompetition() { HAL_DestroyNotifier(m_notifier); - m_notifier = HAL_kInvalidHandle; + m_notifier = HAL_INVALID_HANDLE; } TimedRobot::TimedRobot(wpi::units::second_t period) @@ -91,7 +91,7 @@ TimedRobot::TimedRobot(wpi::units::hertz_t frequency) : TimedRobot{1 / frequency} {} TimedRobot::~TimedRobot() { - if (m_notifier != HAL_kInvalidHandle) { + if (m_notifier != HAL_INVALID_HANDLE) { HAL_DestroyNotifier(m_notifier); } } diff --git a/wpilibc/src/main/native/cpp/hardware/discrete/DigitalOutput.cpp b/wpilibc/src/main/native/cpp/hardware/discrete/DigitalOutput.cpp index bd5a0a9f9a..294cfc176b 100644 --- a/wpilibc/src/main/native/cpp/hardware/discrete/DigitalOutput.cpp +++ b/wpilibc/src/main/native/cpp/hardware/discrete/DigitalOutput.cpp @@ -17,7 +17,7 @@ using namespace wpi; DigitalOutput::DigitalOutput(int channel) { - m_pwmGenerator = HAL_kInvalidHandle; + m_pwmGenerator = HAL_INVALID_HANDLE; if (!SensorUtil::CheckDigitalChannel(channel)) { throw WPILIB_MakeError(err::ChannelIndexOutOfRange, "Channel {}", channel); } @@ -33,7 +33,7 @@ DigitalOutput::DigitalOutput(int channel) { } DigitalOutput::~DigitalOutput() { - if (m_handle != HAL_kInvalidHandle) { + if (m_handle != HAL_INVALID_HANDLE) { // Disable the PWM in case it was running. try { DisablePWM(); @@ -80,7 +80,7 @@ void DigitalOutput::SetPWMRate(double rate) { } void DigitalOutput::EnablePPS(double dutyCycle) { - if (m_pwmGenerator != HAL_kInvalidHandle) { + if (m_pwmGenerator != HAL_INVALID_HANDLE) { return; } @@ -97,7 +97,7 @@ void DigitalOutput::EnablePPS(double dutyCycle) { } void DigitalOutput::EnablePWM(double initialDutyCycle) { - if (m_pwmGenerator != HAL_kInvalidHandle) { + if (m_pwmGenerator != HAL_INVALID_HANDLE) { return; } @@ -114,7 +114,7 @@ void DigitalOutput::EnablePWM(double initialDutyCycle) { } void DigitalOutput::DisablePWM() { - if (m_pwmGenerator == HAL_kInvalidHandle) { + if (m_pwmGenerator == HAL_INVALID_HANDLE) { return; } @@ -127,7 +127,7 @@ void DigitalOutput::DisablePWM() { HAL_FreeDigitalPWM(m_pwmGenerator); - m_pwmGenerator = HAL_kInvalidHandle; + m_pwmGenerator = HAL_INVALID_HANDLE; } void DigitalOutput::UpdateDutyCycle(double dutyCycle) { diff --git a/wpilibc/src/main/native/cpp/hardware/discrete/PWM.cpp b/wpilibc/src/main/native/cpp/hardware/discrete/PWM.cpp index ef14596982..ae49b30196 100644 --- a/wpilibc/src/main/native/cpp/hardware/discrete/PWM.cpp +++ b/wpilibc/src/main/native/cpp/hardware/discrete/PWM.cpp @@ -35,7 +35,7 @@ PWM::PWM(int channel, bool registerSendable) { } PWM::~PWM() { - if (m_handle != HAL_kInvalidHandle) { + if (m_handle != HAL_INVALID_HANDLE) { SetDisabled(); } } diff --git a/wpilibc/src/main/native/cpp/hardware/pneumatic/PneumaticHub.cpp b/wpilibc/src/main/native/cpp/hardware/pneumatic/PneumaticHub.cpp index 9a4e715cd8..33e96c9962 100644 --- a/wpilibc/src/main/native/cpp/hardware/pneumatic/PneumaticHub.cpp +++ b/wpilibc/src/main/native/cpp/hardware/pneumatic/PneumaticHub.cpp @@ -91,7 +91,7 @@ class PneumaticHub::DataStore { uint32_t m_reservedMask{0}; bool m_compressorReserved{false}; wpi::util::mutex m_reservedLock; - PneumaticHub m_moduleObject{0, HAL_kInvalidHandle, 0}; + PneumaticHub m_moduleObject{0, HAL_INVALID_HANDLE, 0}; std::array m_oneShotDurMs{0_ms}; }; diff --git a/wpilibc/src/main/native/cpp/hardware/pneumatic/PneumaticsControlModule.cpp b/wpilibc/src/main/native/cpp/hardware/pneumatic/PneumaticsControlModule.cpp index dd0f644355..0dbf71d0a8 100644 --- a/wpilibc/src/main/native/cpp/hardware/pneumatic/PneumaticsControlModule.cpp +++ b/wpilibc/src/main/native/cpp/hardware/pneumatic/PneumaticsControlModule.cpp @@ -64,7 +64,7 @@ class PneumaticsControlModule::DataStore { uint32_t m_reservedMask{0}; bool m_compressorReserved{false}; wpi::util::mutex m_reservedLock; - PneumaticsControlModule m_moduleObject{0, HAL_kInvalidHandle, 0}; + PneumaticsControlModule m_moduleObject{0, HAL_INVALID_HANDLE, 0}; }; PneumaticsControlModule::PneumaticsControlModule(int busId) diff --git a/wpilibc/src/main/native/cpp/opmode/PeriodicOpMode.cpp b/wpilibc/src/main/native/cpp/opmode/PeriodicOpMode.cpp index 14cd15af33..c14fd39836 100644 --- a/wpilibc/src/main/native/cpp/opmode/PeriodicOpMode.cpp +++ b/wpilibc/src/main/native/cpp/opmode/PeriodicOpMode.cpp @@ -30,7 +30,7 @@ PeriodicOpMode::Callback::Callback(std::function func, period * period) {} PeriodicOpMode::~PeriodicOpMode() { - if (m_notifier != HAL_kInvalidHandle) { + if (m_notifier != HAL_INVALID_HANDLE) { HAL_DestroyNotifier(m_notifier); } } @@ -147,7 +147,7 @@ void PeriodicOpMode::OpModeRun(int64_t opModeId) { void PeriodicOpMode::OpModeStop() { HAL_DestroyNotifier(m_notifier); - m_notifier = HAL_kInvalidHandle; + m_notifier = HAL_INVALID_HANDLE; } void PeriodicOpMode::PrintLoopOverrunMessage() { diff --git a/wpilibc/src/main/native/cpp/system/Notifier.cpp b/wpilibc/src/main/native/cpp/system/Notifier.cpp index b4e4e0b44d..5cb975e56f 100644 --- a/wpilibc/src/main/native/cpp/system/Notifier.cpp +++ b/wpilibc/src/main/native/cpp/system/Notifier.cpp @@ -120,13 +120,13 @@ Notifier::Notifier(Notifier&& rhs) : m_thread(std::move(rhs.m_thread)), m_notifier(rhs.m_notifier.load()), m_callback(std::move(rhs.m_callback)) { - rhs.m_notifier = HAL_kInvalidHandle; + rhs.m_notifier = HAL_INVALID_HANDLE; } Notifier& Notifier::operator=(Notifier&& rhs) { m_thread = std::move(rhs.m_thread); m_notifier = rhs.m_notifier.load(); - rhs.m_notifier = HAL_kInvalidHandle; + rhs.m_notifier = HAL_INVALID_HANDLE; m_callback = std::move(rhs.m_callback); return *this; } diff --git a/wpilibc/src/main/python/wpilib/src/rpy/Notifier.cpp b/wpilibc/src/main/python/wpilib/src/rpy/Notifier.cpp index a1a61f35a5..f87728a0c7 100644 --- a/wpilibc/src/main/python/wpilib/src/rpy/Notifier.cpp +++ b/wpilibc/src/main/python/wpilib/src/rpy/Notifier.cpp @@ -106,13 +106,13 @@ PyNotifier::PyNotifier(PyNotifier &&rhs) : m_thread(std::move(rhs.m_thread)), m_notifier(rhs.m_notifier.load()), m_handler(std::move(rhs.m_handler)) { - rhs.m_notifier = HAL_kInvalidHandle; + rhs.m_notifier = HAL_INVALID_HANDLE; } PyNotifier &PyNotifier::operator=(PyNotifier &&rhs) { m_thread = std::move(rhs.m_thread); m_notifier = rhs.m_notifier.load(); - rhs.m_notifier = HAL_kInvalidHandle; + rhs.m_notifier = HAL_INVALID_HANDLE; m_handler = std::move(rhs.m_handler); return *this; }