File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131#include < XInput.h>
3232
3333void setup () {
34-
34+ XInput. begin ();
3535}
3636
3737void loop () {
Original file line number Diff line number Diff line change @@ -114,10 +114,10 @@ void setup() {
114114 pinMode (Pin_DpadLeft, INPUT_PULLUP);
115115 pinMode (Pin_DpadRight, INPUT_PULLUP);
116116
117- // Set joystick range to the ADC max
118- XInput.setJoystickRange (0 , ADC_Max);
119-
117+ XInput.setJoystickRange (0 , ADC_Max); // Set joystick range to the ADC
120118 XInput.setAutoSend (false ); // Wait for all controls before sending
119+
120+ XInput.begin ();
121121}
122122
123123void loop () {
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ void setup() {
4444 // Set callback function. Function must have a 'void' return type
4545 // and take a single uint8_t as an argument
4646 XInput.setReceiveCallback (rumbleCallback);
47+
48+ XInput.begin ();
4749}
4850
4951void loop () {
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ double angle = 0.0;
7575void setup () {
7676 pinMode (SafetyPin, INPUT_PULLUP);
7777 XInput.setAutoSend (false ); // Wait for all controls before sending
78+
79+ XInput.begin ();
7880}
7981
8082void loop () {
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ void setup() {
4343
4444 XInput.setAutoSend (false ); // Wait for all controls before sending
4545
46+ XInput.begin ();
47+
4648 while (!classic.connect ()) {
4749 delay (1000 ); // Controller not connected
4850 }
Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ XInputLEDPattern KEYWORD1
2121# Methods and Functions (KEYWORD2)
2222#######################################
2323
24+ # Setup
25+ begin KEYWORD2
26+ reset KEYWORD2
27+
2428# Set Control Data
2529press KEYWORD2
2630release KEYWORD2
@@ -61,7 +65,6 @@ setJoystickRange KEYWORD2
6165setRange KEYWORD2
6266
6367# Other
64- reset KEYWORD2
6568printDebug KEYWORD2
6669
6770#######################################
Original file line number Diff line number Diff line change @@ -203,6 +203,10 @@ XInputGamepad::XInputGamepad() :
203203#endif
204204}
205205
206+ void XInputGamepad::begin () {
207+ // Empty for now
208+ }
209+
206210void XInputGamepad::press (uint8_t button) {
207211 setButton (button, true );
208212}
Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ class XInputGamepad {
7878public:
7979 XInputGamepad ();
8080
81+ void begin ();
82+
8183 // Set Control Surfaces
8284 void press (uint8_t button);
8385 void release (uint8_t button);
You can’t perform that action at this time.
0 commit comments