-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
122 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package frc.robot.util.bboard; | ||
|
||
import frc.robot.util.bboard.ButtonBoard.ButtonInfo; | ||
import frc.robot.util.bboard.ButtonBoard.SelectButtonInfo; | ||
|
||
public interface BBoardIO { | ||
public boolean isPressed(ButtonInfo button); | ||
public boolean isPressed(SelectButtonInfo<?> button); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package frc.robot.util.bboard; | ||
|
||
import edu.wpi.first.wpilibj.GenericHID; | ||
import frc.robot.util.bboard.ButtonBoard.ButtonInfo; | ||
import frc.robot.util.bboard.ButtonBoard.SelectButtonInfo; | ||
|
||
public class BBoardIOReal implements BBoardIO { | ||
private static GenericHID padOne = new GenericHID(2); | ||
private static GenericHID padTwo = new GenericHID(3); | ||
private static GenericHID padThree = new GenericHID(4); | ||
|
||
@Override | ||
public boolean isPressed(ButtonInfo buttonInfo) { | ||
int board = buttonInfo.board(); | ||
int button = buttonInfo.button(); | ||
return (board == 0 && padOne.getRawButtonPressed(button)) | ||
|| (board == 1 && padTwo.getRawButtonPressed(button)) | ||
|| (board == 2 && padThree.getRawButtonPressed(button)); | ||
} | ||
|
||
|
||
@Override | ||
public boolean isPressed(SelectButtonInfo<?> buttonInfo) { | ||
int board = buttonInfo.board(); | ||
int button = buttonInfo.button(); | ||
return (board == 0 && padOne.getRawButtonPressed(button)) | ||
|| (board == 1 && padTwo.getRawButtonPressed(button)) | ||
|| (board == 2 && padThree.getRawButtonPressed(button)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package frc.robot.util.bboard; | ||
|
||
import java.util.ArrayList; | ||
|
||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | ||
import frc.robot.util.bboard.ButtonBoard.ButtonInfo; | ||
import frc.robot.util.bboard.ButtonBoard.SelectButtonInfo; | ||
|
||
public class BBoardIOSim implements BBoardIO{ | ||
public BBoardIOSim() { | ||
SmartDashboard.putNumberArray("ButtonBoardSim/Pressed", new double[0]); | ||
} | ||
|
||
private ArrayList<ButtonInfo> pressedButtons = new ArrayList<>(); | ||
|
||
public void periodic(){ | ||
double[] pressed = SmartDashboard.getNumberArray("ButtonBoardSim/Pressed", new double[0]); | ||
pressedButtons.clear(); | ||
for (int i = 0; i < pressed.length - 1; i += 2) { | ||
pressedButtons.add(new ButtonInfo((int) pressed[i], (int) pressed[i + 1])); | ||
} | ||
SmartDashboard.putNumberArray("ButtonBoardSim/Pressed", new double[0]); | ||
} | ||
|
||
@Override | ||
public boolean isPressed(ButtonInfo button) { | ||
return pressedButtons.contains(button); | ||
} | ||
|
||
@Override | ||
public boolean isPressed(SelectButtonInfo<?> button) { | ||
return pressedButtons.contains(button.buttonInfo()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters