mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Remove HAL_BaseInitialize (#1981)
This commit is contained in:
committed by
Peter Johnson
parent
a83fb47933
commit
a3820bbdfa
@@ -277,24 +277,6 @@ HAL_Bool HAL_GetBrownedOut(int32_t* status) {
|
||||
return !(watchdog->readStatus_PowerAlive(status));
|
||||
}
|
||||
|
||||
void HAL_BaseInitialize(int32_t* status) {
|
||||
static std::atomic_bool initialized{false};
|
||||
static wpi::mutex initializeMutex;
|
||||
// Initial check, as if it's true initialization has finished
|
||||
if (initialized) return;
|
||||
|
||||
std::scoped_lock lock(initializeMutex);
|
||||
// Second check in case another thread was waiting
|
||||
if (initialized) return;
|
||||
// image 4; Fixes errors caused by multiple processes. Talk to NI about this
|
||||
nFPGA::nRoboRIO_FPGANamespace::g_currentTargetClass =
|
||||
nLoadOut::kTargetClass_RoboRIO;
|
||||
|
||||
global.reset(tGlobal::create(status));
|
||||
watchdog.reset(tSysWatchdog::create(status));
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
static bool killExistingProgram(int timeout, int mode) {
|
||||
// Kill any previous robot programs
|
||||
std::fstream fs;
|
||||
@@ -368,8 +350,14 @@ HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode) {
|
||||
setNewDataSem(nullptr);
|
||||
});
|
||||
|
||||
// image 4; Fixes errors caused by multiple processes. Talk to NI about this
|
||||
nFPGA::nRoboRIO_FPGANamespace::g_currentTargetClass =
|
||||
nLoadOut::kTargetClass_RoboRIO;
|
||||
|
||||
int32_t status = 0;
|
||||
HAL_BaseInitialize(&status);
|
||||
global.reset(tGlobal::create(&status));
|
||||
watchdog.reset(tSysWatchdog::create(&status));
|
||||
|
||||
if (status != 0) return false;
|
||||
|
||||
HAL_InitializeDriverStation();
|
||||
|
||||
@@ -77,16 +77,6 @@ HAL_Bool HAL_GetSystemActive(int32_t* status);
|
||||
*/
|
||||
HAL_Bool HAL_GetBrownedOut(int32_t* status);
|
||||
|
||||
/**
|
||||
* The base HAL initialize function. Useful if you need to ensure the DS and
|
||||
* base HAL functions (the ones above this declaration in HAL.h) are properly
|
||||
* initialized. For normal programs and executables, please use HAL_Initialize.
|
||||
*
|
||||
* This is mainly expected to be use from libraries that are expected to be used
|
||||
* from LabVIEW, as it handles its own initialization for objects.
|
||||
*/
|
||||
void HAL_BaseInitialize(int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets a port handle for a specific channel.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user