mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Change hal sim to use spinlocks (#1291)
This makes callback registration completely thread safe. This patch also uses templates and macros to dramatically reduce the amount of manual boilerplate.
This commit is contained in:
@@ -28,7 +28,7 @@ HAL_CompressorHandle HAL_InitializeCompressor(int32_t module, int32_t* status) {
|
||||
// As compressors can have unlimited objects, just create a
|
||||
// handle with the module number as the index.
|
||||
|
||||
SimPCMData[module].SetCompressorInitialized(true);
|
||||
SimPCMData[module].compressorInitialized = true;
|
||||
return (HAL_CompressorHandle)createHandle(static_cast<int16_t>(module),
|
||||
HAL_HandleEnum::Compressor, 0);
|
||||
}
|
||||
@@ -46,7 +46,7 @@ HAL_Bool HAL_GetCompressor(HAL_CompressorHandle compressorHandle,
|
||||
return false;
|
||||
}
|
||||
|
||||
return SimPCMData[index].GetCompressorOn();
|
||||
return SimPCMData[index].compressorOn;
|
||||
}
|
||||
|
||||
void HAL_SetCompressorClosedLoopControl(HAL_CompressorHandle compressorHandle,
|
||||
@@ -58,7 +58,7 @@ void HAL_SetCompressorClosedLoopControl(HAL_CompressorHandle compressorHandle,
|
||||
return;
|
||||
}
|
||||
|
||||
SimPCMData[index].SetClosedLoopEnabled(value);
|
||||
SimPCMData[index].closedLoopEnabled = value;
|
||||
}
|
||||
|
||||
HAL_Bool HAL_GetCompressorClosedLoopControl(
|
||||
@@ -70,7 +70,7 @@ HAL_Bool HAL_GetCompressorClosedLoopControl(
|
||||
return false;
|
||||
}
|
||||
|
||||
return SimPCMData[index].GetClosedLoopEnabled();
|
||||
return SimPCMData[index].closedLoopEnabled;
|
||||
}
|
||||
|
||||
HAL_Bool HAL_GetCompressorPressureSwitch(HAL_CompressorHandle compressorHandle,
|
||||
@@ -82,7 +82,7 @@ HAL_Bool HAL_GetCompressorPressureSwitch(HAL_CompressorHandle compressorHandle,
|
||||
return false;
|
||||
}
|
||||
|
||||
return SimPCMData[index].GetPressureSwitch();
|
||||
return SimPCMData[index].pressureSwitch;
|
||||
}
|
||||
|
||||
double HAL_GetCompressorCurrent(HAL_CompressorHandle compressorHandle,
|
||||
@@ -94,7 +94,7 @@ double HAL_GetCompressorCurrent(HAL_CompressorHandle compressorHandle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
return SimPCMData[index].GetCompressorCurrent();
|
||||
return SimPCMData[index].compressorCurrent;
|
||||
}
|
||||
HAL_Bool HAL_GetCompressorCurrentTooHighFault(
|
||||
HAL_CompressorHandle compressorHandle, int32_t* status) {
|
||||
|
||||
Reference in New Issue
Block a user