Skip to content

Commit

Permalink
[xrp] Add getter for XRP LED (wpilibsuite#7327)
Browse files Browse the repository at this point in the history
  • Loading branch information
Advay17 authored Nov 3, 2024
1 parent 44c0bbc commit 23e71e1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,13 @@ public boolean getUserButtonPressed() {
public void setLed(boolean value) {
m_led.set(value);
}

/**
* Gets state of the onboard LED.
*
* @return True if LED is active, false otherwise.
*/
public boolean getLed() {
return m_led.get();
}
}
4 changes: 4 additions & 0 deletions xrpVendordep/src/main/native/cpp/xrp/XRPOnBoardIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ bool XRPOnBoardIO::GetUserButtonPressed() {
void XRPOnBoardIO::SetLed(bool value) {
m_led.Set(value);
}

bool XRPOnBoardIO::GetLed() const {
return m_led.Get();
}
9 changes: 9 additions & 0 deletions xrpVendordep/src/main/native/include/frc/xrp/XRPOnBoardIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class XRPOnBoardIO {

/**
* Gets if the USER button is pressed.
*
* @return True if the USER button is currently pressed.
*/
bool GetUserButtonPressed();

Expand All @@ -43,6 +45,13 @@ class XRPOnBoardIO {
*/
void SetLed(bool value);

/**
* Gets the state of the yellow LED.
*
* @return True if LED is active, false otherwise.
*/
bool GetLed() const;

private:
frc::DigitalInput m_userButton{0};
frc::DigitalOutput m_led{1};
Expand Down

0 comments on commit 23e71e1

Please sign in to comment.