diff --git a/wpilibc/src/main/native/include/frc/GenericHID.h b/wpilibc/src/main/native/include/frc/GenericHID.h index aae10cf217..f1ac24ae62 100644 --- a/wpilibc/src/main/native/include/frc/GenericHID.h +++ b/wpilibc/src/main/native/include/frc/GenericHID.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */ +/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ @@ -62,6 +62,9 @@ class GenericHID : public ErrorBase { * the state of each button. The appropriate button is returned as a boolean * value. * + * This method returns true if the button is being held down at the time + * that this method is being called. + * * @param button The button number to be read (starting at 1) * @return The state of the button. */ @@ -71,6 +74,10 @@ class GenericHID : public ErrorBase { * Whether the button was pressed since the last check. Button indexes begin * at 1. * + * This method returns true if the button went from not pressed to held down + * since the last time this method was called. This is useful if you only + * want to call a function once when you press the button. + * * @param button The button index, beginning at 1. * @return Whether the button was pressed since the last check. */ @@ -80,6 +87,10 @@ class GenericHID : public ErrorBase { * Whether the button was released since the last check. Button indexes begin * at 1. * + * This method returns true if the button went from held down to not pressed + * since the last time this method was called. This is useful if you only + * want to call a function once when you release the button. + * * @param button The button index, beginning at 1. * @return Whether the button was released since the last check. */ diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/GenericHID.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/GenericHID.java index 0f884b90da..5f00bfd41b 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/GenericHID.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/GenericHID.java @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ @@ -127,6 +127,9 @@ public abstract class GenericHID { *
The buttons are returned in a single 16 bit value with one bit representing the state of * each button. The appropriate button is returned as a boolean value. * + *
This method returns true if the button is being held down at the time + * that this method is being called. + * * @param button The button number to be read (starting at 1) * @return The state of the button. */ @@ -138,6 +141,10 @@ public abstract class GenericHID { * Whether the button was pressed since the last check. Button indexes begin at * 1. * + *
This method returns true if the button went from not pressed to held down + * since the last time this method was called. This is useful if you only + * want to call a function once when you press the button. + * * @param button The button index, beginning at 1. * @return Whether the button was pressed since the last check. */ @@ -149,6 +156,10 @@ public abstract class GenericHID { * Whether the button was released since the last check. Button indexes begin at * 1. * + *
This method returns true if the button went from held down to not pressed + * since the last time this method was called. This is useful if you only + * want to call a function once when you release the button. + * * @param button The button index, beginning at 1. * @return Whether the button was released since the last check. */