mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Add HAL specific version of wpi_setError (#2055)
Cleans up error writing, and allows fewer headers to be included in many of the wpilibc cpp files. This removes all usages of the hal/HAL.h header.
This commit is contained in:
committed by
Peter Johnson
parent
326aecc9a0
commit
9bcff37b93
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "frc/Threads.h"
|
||||
|
||||
#include <hal/HAL.h>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <hal/Threads.h>
|
||||
|
||||
#include "frc/ErrorBase.h"
|
||||
@@ -19,7 +19,7 @@ int GetThreadPriority(std::thread& thread, bool* isRealTime) {
|
||||
HAL_Bool rt = false;
|
||||
auto native = thread.native_handle();
|
||||
auto ret = HAL_GetThreadPriority(&native, &rt, &status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
wpi_setGlobalHALError(status);
|
||||
*isRealTime = rt;
|
||||
return ret;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ int GetCurrentThreadPriority(bool* isRealTime) {
|
||||
int32_t status = 0;
|
||||
HAL_Bool rt = false;
|
||||
auto ret = HAL_GetCurrentThreadPriority(&rt, &status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
wpi_setGlobalHALError(status);
|
||||
*isRealTime = rt;
|
||||
return ret;
|
||||
}
|
||||
@@ -37,14 +37,14 @@ bool SetThreadPriority(std::thread& thread, bool realTime, int priority) {
|
||||
int32_t status = 0;
|
||||
auto native = thread.native_handle();
|
||||
auto ret = HAL_SetThreadPriority(&native, realTime, priority, &status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
wpi_setGlobalHALError(status);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool SetCurrentThreadPriority(bool realTime, int priority) {
|
||||
int32_t status = 0;
|
||||
auto ret = HAL_SetCurrentThreadPriority(realTime, priority, &status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
wpi_setGlobalHALError(status);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user