mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal,wpilib] Add function to control "Radio" LED (#6073)
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <hal/CAN.h>
|
||||
#include <hal/HALBase.h>
|
||||
#include <hal/LEDs.h>
|
||||
#include <hal/Power.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
@@ -230,6 +231,30 @@ units::celsius_t RobotController::GetCPUTemp() {
|
||||
return units::celsius_t{retVal};
|
||||
}
|
||||
|
||||
static_assert(RadioLEDState::kOff ==
|
||||
static_cast<RadioLEDState>(HAL_RadioLEDState::HAL_RadioLED_kOff));
|
||||
static_assert(
|
||||
RadioLEDState::kGreen ==
|
||||
static_cast<RadioLEDState>(HAL_RadioLEDState::HAL_RadioLED_kGreen));
|
||||
static_assert(RadioLEDState::kRed ==
|
||||
static_cast<RadioLEDState>(HAL_RadioLEDState::HAL_RadioLED_kRed));
|
||||
static_assert(
|
||||
RadioLEDState::kOrange ==
|
||||
static_cast<RadioLEDState>(HAL_RadioLEDState::HAL_RadioLED_kOrange));
|
||||
|
||||
void RobotController::SetRadioLEDState(RadioLEDState state) {
|
||||
int32_t status = 0;
|
||||
HAL_SetRadioLEDState(static_cast<HAL_RadioLEDState>(state), &status);
|
||||
FRC_CheckErrorStatus(status, "SetRadioLEDState");
|
||||
}
|
||||
|
||||
RadioLEDState RobotController::GetRadioLEDState() {
|
||||
int32_t status = 0;
|
||||
auto retVal = static_cast<RadioLEDState>(HAL_GetRadioLEDState(&status));
|
||||
FRC_CheckErrorStatus(status, "GetRadioLEDState");
|
||||
return retVal;
|
||||
}
|
||||
|
||||
CANStatus RobotController::GetCANStatus() {
|
||||
int32_t status = 0;
|
||||
float percentBusUtilization = 0;
|
||||
|
||||
Reference in New Issue
Block a user