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:
Thad House
2019-11-08 22:53:20 -08:00
committed by Peter Johnson
parent 326aecc9a0
commit 9bcff37b93
84 changed files with 421 additions and 377 deletions

View File

@@ -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;
}