Skip to content

Commit 23e71e1

Browse files
authored
[xrp] Add getter for XRP LED (wpilibsuite#7327)
1 parent 44c0bbc commit 23e71e1

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

xrpVendordep/src/main/java/edu/wpi/first/wpilibj/xrp/XRPOnBoardIO.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,13 @@ public boolean getUserButtonPressed() {
3838
public void setLed(boolean value) {
3939
m_led.set(value);
4040
}
41+
42+
/**
43+
* Gets state of the onboard LED.
44+
*
45+
* @return True if LED is active, false otherwise.
46+
*/
47+
public boolean getLed() {
48+
return m_led.get();
49+
}
4150
}

xrpVendordep/src/main/native/cpp/xrp/XRPOnBoardIO.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ bool XRPOnBoardIO::GetUserButtonPressed() {
1818
void XRPOnBoardIO::SetLed(bool value) {
1919
m_led.Set(value);
2020
}
21+
22+
bool XRPOnBoardIO::GetLed() const {
23+
return m_led.Get();
24+
}

xrpVendordep/src/main/native/include/frc/xrp/XRPOnBoardIO.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class XRPOnBoardIO {
3535

3636
/**
3737
* Gets if the USER button is pressed.
38+
*
39+
* @return True if the USER button is currently pressed.
3840
*/
3941
bool GetUserButtonPressed();
4042

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

48+
/**
49+
* Gets the state of the yellow LED.
50+
*
51+
* @return True if LED is active, false otherwise.
52+
*/
53+
bool GetLed() const;
54+
4655
private:
4756
frc::DigitalInput m_userButton{0};
4857
frc::DigitalOutput m_led{1};

0 commit comments

Comments
 (0)