mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
Finish clang-tidy cleanups (#3003)
* Add .clang-tidy configuration. * A separate .clang-tidy is used for hal includes to suppress modernize-use-using (as these are C headers). * Add NOLINT where necessary for a clean run. * Add clang-tidy job to lint-format workflow. This workflow is now only run on PRs. To reduce runtime, clang-tidy is only run on files changed in the PR. Two wpilibc changes; both are unlikely to break user code: * BuiltInAccelerometer: Make SetRange() final * Counter: Make SetMaxPeriod() final After these cleanups, the only file that does not run cleanly is cscore_raw_cv.h due to it not being standalone.
This commit is contained in:
@@ -6,11 +6,10 @@
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace hal {
|
||||
namespace init {
|
||||
namespace hal::init {
|
||||
extern std::atomic_bool HAL_IsInitialized;
|
||||
extern void RunInitialize();
|
||||
static inline void CheckInit() {
|
||||
inline void CheckInit() {
|
||||
if (HAL_IsInitialized.load(std::memory_order_relaxed)) {
|
||||
return;
|
||||
}
|
||||
@@ -52,5 +51,4 @@ extern void InitializeSerialPort();
|
||||
extern void InitializeSolenoid();
|
||||
extern void InitializeSPI();
|
||||
extern void InitializeThreads();
|
||||
} // namespace init
|
||||
} // namespace hal
|
||||
} // namespace hal::init
|
||||
|
||||
@@ -155,7 +155,7 @@ void SerialHelper::CoiteratedSort(
|
||||
}
|
||||
}
|
||||
}
|
||||
vec = sortedVec;
|
||||
vec.swap(sortedVec);
|
||||
}
|
||||
|
||||
void SerialHelper::QueryHubPaths(int32_t* status) {
|
||||
|
||||
75
hal/src/main/native/include/hal/.clang-tidy
Normal file
75
hal/src/main/native/include/hal/.clang-tidy
Normal file
@@ -0,0 +1,75 @@
|
||||
Checks:
|
||||
'bugprone-assert-side-effect,
|
||||
bugprone-bool-pointer-implicit-conversion,
|
||||
bugprone-copy-constructor-init,
|
||||
bugprone-dangling-handle,
|
||||
bugprone-dynamic-static-initializers,
|
||||
bugprone-exception-escape,
|
||||
bugprone-forward-declaration-namespace,
|
||||
bugprone-forwarding-reference-overload,
|
||||
bugprone-inaccurate-erase,
|
||||
bugprone-incorrect-roundings,
|
||||
bugprone-integer-division,
|
||||
bugprone-lambda-function-name,
|
||||
bugprone-misplaced-operator-in-strlen-in-alloc,
|
||||
bugprone-misplaced-widening-cast,
|
||||
bugprone-move-forwarding-reference,
|
||||
bugprone-multiple-statement-macro,
|
||||
bugprone-parent-virtual-call,
|
||||
bugprone-posix-return,
|
||||
bugprone-sizeof-container,
|
||||
bugprone-sizeof-expression,
|
||||
bugprone-spuriously-wake-up-functions,
|
||||
bugprone-string-constructor,
|
||||
bugprone-string-integer-assignment,
|
||||
bugprone-string-literal-with-embedded-nul,
|
||||
bugprone-suspicious-enum-usage,
|
||||
bugprone-suspicious-include,
|
||||
bugprone-suspicious-memset-usage,
|
||||
bugprone-suspicious-missing-comma,
|
||||
bugprone-suspicious-semicolon,
|
||||
bugprone-suspicious-string-compare,
|
||||
bugprone-throw-keyword-missing,
|
||||
bugprone-too-small-loop-variable,
|
||||
bugprone-undefined-memory-manipulation,
|
||||
bugprone-undelegated-constructor,
|
||||
bugprone-unhandled-self-assignment,
|
||||
bugprone-unused-raii,
|
||||
bugprone-virtual-near-miss,
|
||||
cert-dcl58-cpp,
|
||||
cert-err52-cpp,
|
||||
cert-err60-cpp,
|
||||
cert-mem57-cpp,
|
||||
cert-oop57-cpp,
|
||||
cert-oop58-cpp,
|
||||
clang-diagnostic-*,
|
||||
-clang-diagnostic-deprecated-declarations,
|
||||
-clang-diagnostic-#warnings,
|
||||
-clang-diagnostic-pedantic,
|
||||
clang-analyzer-*,
|
||||
cppcoreguidelines-slicing,
|
||||
google-build-namespaces,
|
||||
google-explicit-constructor,
|
||||
google-global-names-in-headers,
|
||||
google-readability-avoid-underscore-in-googletest-name,
|
||||
google-readability-casting,
|
||||
google-runtime-operator,
|
||||
llvm-twine-local,
|
||||
misc-definitions-in-headers,
|
||||
misc-misplaced-const,
|
||||
misc-new-delete-overloads,
|
||||
misc-non-copyable-objects,
|
||||
modernize-avoid-bind,
|
||||
modernize-concat-nested-namespaces,
|
||||
modernize-make-shared,
|
||||
modernize-make-unique,
|
||||
modernize-pass-by-value,
|
||||
modernize-use-default-member-init,
|
||||
modernize-use-noexcept,
|
||||
modernize-use-nullptr,
|
||||
modernize-use-override,
|
||||
readability-braces-around-statements'
|
||||
FormatStyle: file
|
||||
CheckOptions:
|
||||
- key: bugprone-dangling-handle
|
||||
value: 'wpi::StringRef;wpi::Twine'
|
||||
@@ -125,9 +125,8 @@ static inline bool isHandleCorrectVersion(HAL_Handle handle, int16_t version) {
|
||||
* @return true if the handle is proper version and type, otherwise
|
||||
* false.
|
||||
*/
|
||||
static inline int16_t getHandleTypedIndex(HAL_Handle handle,
|
||||
HAL_HandleEnum enumType,
|
||||
int16_t version) {
|
||||
inline int16_t getHandleTypedIndex(HAL_Handle handle, HAL_HandleEnum enumType,
|
||||
int16_t version) {
|
||||
if (!isHandleType(handle, enumType)) {
|
||||
return InvalidHandleIndex;
|
||||
}
|
||||
@@ -155,7 +154,7 @@ static inline int16_t getHandleTypedIndex(HAL_Handle handle,
|
||||
* @param handle the port handle
|
||||
* @return the port channel
|
||||
*/
|
||||
static inline int16_t getPortHandleChannel(HAL_PortHandle handle) {
|
||||
inline int16_t getPortHandleChannel(HAL_PortHandle handle) {
|
||||
if (!isHandleType(handle, HAL_HandleEnum::Port)) {
|
||||
return InvalidHandleIndex;
|
||||
}
|
||||
@@ -169,7 +168,7 @@ static inline int16_t getPortHandleChannel(HAL_PortHandle handle) {
|
||||
* @param handle the port handle
|
||||
* @return the port module
|
||||
*/
|
||||
static inline int16_t getPortHandleModule(HAL_PortHandle handle) {
|
||||
inline int16_t getPortHandleModule(HAL_PortHandle handle) {
|
||||
if (!isHandleType(handle, HAL_HandleEnum::Port)) {
|
||||
return InvalidHandleIndex;
|
||||
}
|
||||
@@ -183,7 +182,7 @@ static inline int16_t getPortHandleModule(HAL_PortHandle handle) {
|
||||
* @param handle the port handle
|
||||
* @return the port SPI channel
|
||||
*/
|
||||
static inline int16_t getPortHandleSPIEnable(HAL_PortHandle handle) {
|
||||
inline int16_t getPortHandleSPIEnable(HAL_PortHandle handle) {
|
||||
if (!isHandleType(handle, HAL_HandleEnum::Port)) {
|
||||
return InvalidHandleIndex;
|
||||
}
|
||||
|
||||
@@ -108,104 +108,104 @@ typedef enum {
|
||||
* Represents the resulting status of a function call through its return value.
|
||||
* 0 is success, negative values are errors, and positive values are warnings.
|
||||
*/
|
||||
typedef int32_t NiFpga_Status;
|
||||
typedef int32_t NiFpga_Status; // NOLINT
|
||||
|
||||
/**
|
||||
* No errors or warnings.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_Success = 0;
|
||||
constexpr NiFpga_Status NiFpga_Status_Success = 0;
|
||||
|
||||
/**
|
||||
* The timeout expired before the FIFO operation could complete.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FifoTimeout = -50400;
|
||||
constexpr NiFpga_Status NiFpga_Status_FifoTimeout = -50400;
|
||||
|
||||
/**
|
||||
* No transfer is in progress because the transfer was aborted by the client.
|
||||
* The operation could not be completed as specified.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_TransferAborted = -50405;
|
||||
constexpr NiFpga_Status NiFpga_Status_TransferAborted = -50405;
|
||||
|
||||
/**
|
||||
* A memory allocation failed. Try again after rebooting.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_MemoryFull = -52000;
|
||||
constexpr NiFpga_Status NiFpga_Status_MemoryFull = -52000;
|
||||
|
||||
/**
|
||||
* An unexpected software error occurred.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_SoftwareFault = -52003;
|
||||
constexpr NiFpga_Status NiFpga_Status_SoftwareFault = -52003;
|
||||
|
||||
/**
|
||||
* A parameter to a function was not valid. This could be a NULL pointer, a bad
|
||||
* value, etc.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_InvalidParameter = -52005;
|
||||
constexpr NiFpga_Status NiFpga_Status_InvalidParameter = -52005;
|
||||
|
||||
/**
|
||||
* A required resource was not found. The NiFpga.* library, the RIO resource, or
|
||||
* some other resource may be missing.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ResourceNotFound = -52006;
|
||||
constexpr NiFpga_Status NiFpga_Status_ResourceNotFound = -52006;
|
||||
|
||||
/**
|
||||
* A required resource was not properly initialized. This could occur if
|
||||
* NiFpga_Initialize was not called or a required NiFpga_IrqContext was not
|
||||
* reserved.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ResourceNotInitialized = -52010;
|
||||
constexpr NiFpga_Status NiFpga_Status_ResourceNotInitialized = -52010;
|
||||
|
||||
/**
|
||||
* A hardware failure has occurred. The operation could not be completed as
|
||||
* specified.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_HardwareFault = -52018;
|
||||
constexpr NiFpga_Status NiFpga_Status_HardwareFault = -52018;
|
||||
|
||||
/**
|
||||
* The FPGA is already running.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaAlreadyRunning = -61003;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaAlreadyRunning = -61003;
|
||||
|
||||
/**
|
||||
* An error occurred downloading the VI to the FPGA device. Verify that
|
||||
* the target is connected and powered and that the resource of the target
|
||||
* is properly configured.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_DownloadError = -61018;
|
||||
constexpr NiFpga_Status NiFpga_Status_DownloadError = -61018;
|
||||
|
||||
/**
|
||||
* The bitfile was not compiled for the specified resource's device type.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_DeviceTypeMismatch = -61024;
|
||||
constexpr NiFpga_Status NiFpga_Status_DeviceTypeMismatch = -61024;
|
||||
|
||||
/**
|
||||
* An error was detected in the communication between the host computer and the
|
||||
* FPGA target.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_CommunicationTimeout = -61046;
|
||||
constexpr NiFpga_Status NiFpga_Status_CommunicationTimeout = -61046;
|
||||
|
||||
/**
|
||||
* The timeout expired before any of the IRQs were asserted.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_IrqTimeout = -61060;
|
||||
constexpr NiFpga_Status NiFpga_Status_IrqTimeout = -61060;
|
||||
|
||||
/**
|
||||
* The specified bitfile is invalid or corrupt.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_CorruptBitfile = -61070;
|
||||
constexpr NiFpga_Status NiFpga_Status_CorruptBitfile = -61070;
|
||||
|
||||
/**
|
||||
* The requested FIFO depth is invalid. It is either 0 or an amount not
|
||||
* supported by the hardware.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_BadDepth = -61072;
|
||||
constexpr NiFpga_Status NiFpga_Status_BadDepth = -61072;
|
||||
|
||||
/**
|
||||
* The number of FIFO elements is invalid. Either the number is greater than the
|
||||
* depth of the host memory DMA FIFO, or more elements were requested for
|
||||
* release than had been acquired.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_BadReadWriteCount = -61073;
|
||||
constexpr NiFpga_Status NiFpga_Status_BadReadWriteCount = -61073;
|
||||
|
||||
/**
|
||||
* A hardware clocking error occurred. A derived clock lost lock with its base
|
||||
@@ -218,62 +218,62 @@ static const NiFpga_Status NiFpga_Status_BadReadWriteCount = -61073;
|
||||
* generated from free-running, on-board sources, please contact National
|
||||
* Instruments technical support at ni.com/support.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ClockLostLock = -61083;
|
||||
constexpr NiFpga_Status NiFpga_Status_ClockLostLock = -61083;
|
||||
|
||||
/**
|
||||
* The operation could not be performed because the FPGA is busy. Stop all
|
||||
* activities on the FPGA before requesting this operation. If the target is in
|
||||
* Scan Interface programming mode, put it in FPGA Interface programming mode.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusy = -61141;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusy = -61141;
|
||||
|
||||
/**
|
||||
* The operation could not be performed because the FPGA is busy operating in
|
||||
* FPGA Interface C API mode. Stop all activities on the FPGA before requesting
|
||||
* this operation.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusyFpgaInterfaceCApi = -61200;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusyFpgaInterfaceCApi = -61200;
|
||||
|
||||
/**
|
||||
* The chassis is in Scan Interface programming mode. In order to run FPGA VIs,
|
||||
* you must go to the chassis properties page, select FPGA programming mode, and
|
||||
* deploy settings.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusyScanInterface = -61201;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusyScanInterface = -61201;
|
||||
|
||||
/**
|
||||
* The operation could not be performed because the FPGA is busy operating in
|
||||
* FPGA Interface mode. Stop all activities on the FPGA before requesting this
|
||||
* operation.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusyFpgaInterface = -61202;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusyFpgaInterface = -61202;
|
||||
|
||||
/**
|
||||
* The operation could not be performed because the FPGA is busy operating in
|
||||
* Interactive mode. Stop all activities on the FPGA before requesting this
|
||||
* operation.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusyInteractive = -61203;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusyInteractive = -61203;
|
||||
|
||||
/**
|
||||
* The operation could not be performed because the FPGA is busy operating in
|
||||
* Emulation mode. Stop all activities on the FPGA before requesting this
|
||||
* operation.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusyEmulation = -61204;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusyEmulation = -61204;
|
||||
|
||||
/**
|
||||
* LabVIEW FPGA does not support the Reset method for bitfiles that allow
|
||||
* removal of implicit enable signals in single-cycle Timed Loops.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ResetCalledWithImplicitEnableRemoval =
|
||||
constexpr NiFpga_Status NiFpga_Status_ResetCalledWithImplicitEnableRemoval =
|
||||
-61211;
|
||||
|
||||
/**
|
||||
* LabVIEW FPGA does not support the Abort method for bitfiles that allow
|
||||
* removal of implicit enable signals in single-cycle Timed Loops.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_AbortCalledWithImplicitEnableRemoval =
|
||||
constexpr NiFpga_Status NiFpga_Status_AbortCalledWithImplicitEnableRemoval =
|
||||
-61212;
|
||||
|
||||
/**
|
||||
@@ -282,7 +282,7 @@ static const NiFpga_Status NiFpga_Status_AbortCalledWithImplicitEnableRemoval =
|
||||
* Pass the NiFpga_CloseAttribute_NoResetIfLastSession attribute to NiFpga_Close
|
||||
* instead of 0.
|
||||
*/
|
||||
static const NiFpga_Status
|
||||
constexpr NiFpga_Status
|
||||
NiFpga_Status_CloseAndResetCalledWithImplicitEnableRemoval = -61213;
|
||||
|
||||
/**
|
||||
@@ -290,14 +290,14 @@ static const NiFpga_Status
|
||||
* Timed Loops, LabVIEW FPGA does not support this method prior to running the
|
||||
* bitfile.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ImplicitEnableRemovalButNotYetRun =
|
||||
constexpr NiFpga_Status NiFpga_Status_ImplicitEnableRemovalButNotYetRun =
|
||||
-61214;
|
||||
|
||||
/**
|
||||
* Bitfiles that allow removal of implicit enable signals in single-cycle Timed
|
||||
* Loops can run only once. Download the bitfile again before re-running the VI.
|
||||
*/
|
||||
static const NiFpga_Status
|
||||
constexpr NiFpga_Status
|
||||
NiFpga_Status_RunAfterStoppedCalledWithImplicitEnableRemoval = -61215;
|
||||
|
||||
/**
|
||||
@@ -306,8 +306,7 @@ static const NiFpga_Status
|
||||
* protocol. If you are generating your clocks internally, please contact
|
||||
* National Instruments Technical Support.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_GatedClockHandshakingViolation =
|
||||
-61216;
|
||||
constexpr NiFpga_Status NiFpga_Status_GatedClockHandshakingViolation = -61216;
|
||||
|
||||
/**
|
||||
* The number of elements requested must be less than or equal to the number of
|
||||
@@ -315,7 +314,7 @@ static const NiFpga_Status NiFpga_Status_GatedClockHandshakingViolation =
|
||||
* fewer unacquired elements left in the FIFO than are being requested. Release
|
||||
* some acquired elements before acquiring more elements.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ElementsNotPermissibleToBeAcquired =
|
||||
constexpr NiFpga_Status NiFpga_Status_ElementsNotPermissibleToBeAcquired =
|
||||
-61219;
|
||||
|
||||
/**
|
||||
@@ -323,12 +322,12 @@ static const NiFpga_Status NiFpga_Status_ElementsNotPermissibleToBeAcquired =
|
||||
* discovery mode. Wait for configuration or discovery to complete and retry
|
||||
* your operation.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusyConfiguration = -61252;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusyConfiguration = -61252;
|
||||
|
||||
/**
|
||||
* An unexpected internal error occurred.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_InternalError = -61499;
|
||||
constexpr NiFpga_Status NiFpga_Status_InternalError = -61499;
|
||||
|
||||
/**
|
||||
* The NI-RIO driver was unable to allocate memory for a FIFO. This can happen
|
||||
@@ -337,52 +336,52 @@ static const NiFpga_Status NiFpga_Status_InternalError = -61499;
|
||||
* to reconfigure the controller with a greater maximum FIFO depth. For more
|
||||
* information, refer to the NI KnowledgeBase article 65OF2ERQ.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_TotalDmaFifoDepthExceeded = -63003;
|
||||
constexpr NiFpga_Status NiFpga_Status_TotalDmaFifoDepthExceeded = -63003;
|
||||
|
||||
/**
|
||||
* Access to the remote system was denied. Use MAX to check the Remote Device
|
||||
* Access settings under Software>>NI-RIO>>NI-RIO Settings on the remote system.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_AccessDenied = -63033;
|
||||
constexpr NiFpga_Status NiFpga_Status_AccessDenied = -63033;
|
||||
|
||||
/**
|
||||
* The NI-RIO software on the host is not compatible with the software on the
|
||||
* target. Upgrade the NI-RIO software on the host in order to connect to this
|
||||
* target.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_HostVersionMismatch = -63038;
|
||||
constexpr NiFpga_Status NiFpga_Status_HostVersionMismatch = -63038;
|
||||
|
||||
/**
|
||||
* A connection could not be established to the specified remote device. Ensure
|
||||
* that the device is on and accessible over the network, that NI-RIO software
|
||||
* is installed, and that the RIO server is running and properly configured.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_RpcConnectionError = -63040;
|
||||
constexpr NiFpga_Status NiFpga_Status_RpcConnectionError = -63040;
|
||||
|
||||
/**
|
||||
* The RPC session is invalid. The target may have reset or been rebooted. Check
|
||||
* the network connection and retry the operation.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_RpcSessionError = -63043;
|
||||
constexpr NiFpga_Status NiFpga_Status_RpcSessionError = -63043;
|
||||
|
||||
/**
|
||||
* The operation could not complete because another session is accessing the
|
||||
* FIFO. Close the other session and retry.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FifoReserved = -63082;
|
||||
constexpr NiFpga_Status NiFpga_Status_FifoReserved = -63082;
|
||||
|
||||
/**
|
||||
* A Configure FIFO, Stop FIFO, Read FIFO, or Write FIFO function was called
|
||||
* while the host had acquired elements of the FIFO. Release all acquired
|
||||
* elements before configuring, stopping, reading, or writing.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FifoElementsCurrentlyAcquired = -63083;
|
||||
constexpr NiFpga_Status NiFpga_Status_FifoElementsCurrentlyAcquired = -63083;
|
||||
|
||||
/**
|
||||
* A function was called using a misaligned address. The address must be a
|
||||
* multiple of the size of the datatype.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_MisalignedAccess = -63084;
|
||||
constexpr NiFpga_Status NiFpga_Status_MisalignedAccess = -63084;
|
||||
|
||||
/**
|
||||
* The FPGA Read/Write Control Function is accessing a control or indicator
|
||||
@@ -390,7 +389,7 @@ static const NiFpga_Status NiFpga_Status_MisalignedAccess = -63084;
|
||||
* Refer to the hardware documentation for the limitations on data types for
|
||||
* this target.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ControlOrIndicatorTooLarge = -63085;
|
||||
constexpr NiFpga_Status NiFpga_Status_ControlOrIndicatorTooLarge = -63085;
|
||||
|
||||
/**
|
||||
* A valid .lvbitx bitfile is required. If you are using a valid .lvbitx
|
||||
@@ -398,14 +397,14 @@ static const NiFpga_Status NiFpga_Status_ControlOrIndicatorTooLarge = -63085;
|
||||
* Determine which version of LabVIEW was used to make the bitfile, update your
|
||||
* software to that version or later, and try again.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_BitfileReadError = -63101;
|
||||
constexpr NiFpga_Status NiFpga_Status_BitfileReadError = -63101;
|
||||
|
||||
/**
|
||||
* The specified signature does not match the signature of the bitfile. If the
|
||||
* bitfile has been recompiled, regenerate the C API and rebuild the
|
||||
* application.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_SignatureMismatch = -63106;
|
||||
constexpr NiFpga_Status NiFpga_Status_SignatureMismatch = -63106;
|
||||
|
||||
/**
|
||||
* The bitfile you are trying to use is incompatible with the version
|
||||
@@ -415,33 +414,33 @@ static const NiFpga_Status NiFpga_Status_SignatureMismatch = -63106;
|
||||
* with the same version of NI-RIO that is currently installed on the
|
||||
* target and/or host.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_IncompatibleBitfile = -63107;
|
||||
constexpr NiFpga_Status NiFpga_Status_IncompatibleBitfile = -63107;
|
||||
|
||||
/**
|
||||
* Either the supplied resource name is invalid as a RIO resource name, or the
|
||||
* device was not found. Use MAX to find the proper resource name for the
|
||||
* intended device.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_InvalidResourceName = -63192;
|
||||
constexpr NiFpga_Status NiFpga_Status_InvalidResourceName = -63192;
|
||||
|
||||
/**
|
||||
* The requested feature is not supported.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FeatureNotSupported = -63193;
|
||||
constexpr NiFpga_Status NiFpga_Status_FeatureNotSupported = -63193;
|
||||
|
||||
/**
|
||||
* The NI-RIO software on the target system is not compatible with this
|
||||
* software. Upgrade the NI-RIO software on the target system.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_VersionMismatch = -63194;
|
||||
constexpr NiFpga_Status NiFpga_Status_VersionMismatch = -63194;
|
||||
|
||||
/**
|
||||
* The session is invalid or has been closed.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_InvalidSession = -63195;
|
||||
constexpr NiFpga_Status NiFpga_Status_InvalidSession = -63195;
|
||||
|
||||
/**
|
||||
* The maximum number of open FPGA sessions has been reached. Close some open
|
||||
* sessions.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_OutOfHandles = -63198;
|
||||
constexpr NiFpga_Status NiFpga_Status_OutOfHandles = -63198;
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace hal {
|
||||
namespace init {
|
||||
namespace hal::init {
|
||||
extern std::atomic_bool HAL_IsInitialized;
|
||||
extern void RunInitialize();
|
||||
static inline void CheckInit() {
|
||||
inline void CheckInit() {
|
||||
if (HAL_IsInitialized.load(std::memory_order_relaxed)) {
|
||||
return;
|
||||
}
|
||||
@@ -74,5 +73,4 @@ extern void InitializeSolenoid();
|
||||
extern void InitializeSPI();
|
||||
extern void InitializeThreads();
|
||||
|
||||
} // namespace init
|
||||
} // namespace hal
|
||||
} // namespace hal::init
|
||||
|
||||
@@ -73,5 +73,6 @@ TEST(AnalogInSimTests, TestAnalogInInitialization) {
|
||||
EXPECT_TRUE(HAL_kInvalidHandle != analogInHandle);
|
||||
EXPECT_EQ(0, status);
|
||||
EXPECT_STREQ("Initialized", gTestAnalogInCallbackName.c_str());
|
||||
HALSIM_CancelAnalogInInitializedCallback(INDEX_TO_TEST, callbackId);
|
||||
}
|
||||
} // namespace hal
|
||||
|
||||
@@ -73,5 +73,6 @@ TEST(AnalogOutSimTests, TestAnalogOutInitialization) {
|
||||
EXPECT_TRUE(HAL_kInvalidHandle != analogOutHandle);
|
||||
EXPECT_EQ(0, status);
|
||||
EXPECT_STREQ("Initialized", gTestAnalogOutCallbackName.c_str());
|
||||
HALSIM_CancelAnalogOutInitializedCallback(INDEX_TO_TEST, callbackId);
|
||||
}
|
||||
} // namespace hal
|
||||
|
||||
@@ -73,6 +73,7 @@ TEST(DigitalIoSimTests, TestDigitalIoInitialization) {
|
||||
EXPECT_TRUE(HAL_kInvalidHandle != digitalIoHandle);
|
||||
EXPECT_EQ(0, status);
|
||||
EXPECT_STREQ("Initialized", gTestDigitalIoCallbackName.c_str());
|
||||
HALSIM_CancelDIOInitializedCallback(INDEX_TO_TEST, callbackId);
|
||||
}
|
||||
|
||||
} // namespace hal
|
||||
|
||||
@@ -71,5 +71,6 @@ TEST(PWMSimTests, TestPwmInitialization) {
|
||||
EXPECT_TRUE(HAL_kInvalidHandle != pwmHandle);
|
||||
EXPECT_EQ(0, status);
|
||||
EXPECT_STREQ("Initialized", gTestPwmCallbackName.c_str());
|
||||
HALSIM_CancelPWMInitializedCallback(INDEX_TO_TEST, callbackId);
|
||||
}
|
||||
} // namespace hal
|
||||
|
||||
@@ -71,6 +71,7 @@ TEST(RelaySimTests, TestRelayInitialization) {
|
||||
EXPECT_TRUE(HAL_kInvalidHandle != pdpHandle);
|
||||
EXPECT_EQ(0, status);
|
||||
EXPECT_STREQ("InitializedForward", gTestRelayCallbackName.c_str());
|
||||
HALSIM_CancelRelayInitializedForwardCallback(INDEX_TO_TEST, callbackId);
|
||||
}
|
||||
|
||||
} // namespace hal
|
||||
|
||||
Reference in New Issue
Block a user