mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
[wpilib, hal] Add function to read the RSL state (#5312)
This commit is contained in:
@@ -423,6 +423,15 @@ HAL_Bool HAL_GetBrownedOut(int32_t* status) {
|
||||
return !(watchdog->readStatus_PowerAlive(status));
|
||||
}
|
||||
|
||||
HAL_Bool HAL_GetRSLState(int32_t* status) {
|
||||
hal::init::CheckInit();
|
||||
if (!global) {
|
||||
*status = NiFpga_Status_ResourceNotInitialized;
|
||||
return false;
|
||||
}
|
||||
return global->readLEDs_RSL(status);
|
||||
}
|
||||
|
||||
static bool killExistingProgram(int timeout, int mode) {
|
||||
// Kill any previous robot programs
|
||||
std::fstream fs;
|
||||
|
||||
@@ -136,6 +136,21 @@ Java_edu_wpi_first_hal_HAL_getBrownedOut
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_HAL
|
||||
* Method: getRSLState
|
||||
* Signature: ()Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_edu_wpi_first_hal_HAL_getRSLState
|
||||
(JNIEnv* env, jclass)
|
||||
{
|
||||
int32_t status = 0;
|
||||
bool val = HAL_GetRSLState(&status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_HAL
|
||||
* Method: getPortWithModule
|
||||
|
||||
@@ -172,6 +172,13 @@ uint64_t HAL_GetFPGATime(int32_t* status);
|
||||
*/
|
||||
uint64_t HAL_ExpandFPGATime(uint32_t unexpandedLower, int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets the current state of the Robot Signal Light (RSL)
|
||||
* @param[out] status the error code, or 0 for success
|
||||
* @return The current state of the RSL- true if on, false if off
|
||||
*/
|
||||
HAL_Bool HAL_GetRSLState(int32_t* status);
|
||||
|
||||
/**
|
||||
* Call this to start up HAL. This is required for robot programs.
|
||||
*
|
||||
|
||||
@@ -328,6 +328,10 @@ HAL_Bool HAL_GetBrownedOut(int32_t* status) {
|
||||
return false; // Figure out if we need to detect a brownout condition
|
||||
}
|
||||
|
||||
HAL_Bool HAL_GetRSLState(int32_t* status) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode) {
|
||||
static std::atomic_bool initialized{false};
|
||||
static wpi::mutex initializeMutex;
|
||||
|
||||
Reference in New Issue
Block a user