From 017efbf4ab2b5bbd3bc32769f2250f7e8bc7be65 Mon Sep 17 00:00:00 2001 From: 24cteahan <24cteahan@xbhs.net> Date: Tue, 14 Nov 2023 15:28:26 -0500 Subject: [PATCH] added web doc code --- HelpPage/doc/docs/apis/Gamepads.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/HelpPage/doc/docs/apis/Gamepads.md b/HelpPage/doc/docs/apis/Gamepads.md index ae0b5dac28e1..e1ac815da38e 100644 --- a/HelpPage/doc/docs/apis/Gamepads.md +++ b/HelpPage/doc/docs/apis/Gamepads.md @@ -12,4 +12,32 @@ There are two: ## Usage To use the gamepads, use the method named `get` + the name of the button or stick. -Axes return `double` and buttons return `boolean`. \ No newline at end of file +Axes return `double` and buttons return `boolean`. + +## Button Registry + +First you must enable the feature, so add this to the `construct()` function of the `OperationMode`: +```java +Devices.enableButtonRegistration(); +``` + +To register a button, use the method `registerButton` in the `Devices` class. + +```java +Devices.controller#.registerButton(GamepadRequestInput.Button , "Button Usage") +``` + +If a button isn't registered, or you attempt to register a button twice the opmode will fail. +To search for a button use the method `searchForButton` in the `Devices` class. + +```java +Devices.controller#.buttonSearch("Button Usage") +``` + +See the Buttoner.java Opmode to see sample code + +If you want a list of buttons and their uses, possibly to print to the driver station, use the method `getButtonRegistry` in the `Devices` class. + +```java +Devices.genList(); +``` \ No newline at end of file