Skip to content

Commit e125b60

Browse files
committed
Add USB receive callback
1 parent 87b5507 commit e125b60

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/XInput.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,16 @@ struct XInputMap_Rumble {
167167
static const XInputMap_Rumble RumbleLeft(3, 0); // Large motor
168168
static const XInputMap_Rumble RumbleRight(4, 1); // Small motor
169169

170+
// --------------------------------------------------------
171+
// XInput USB Receive Callback |
172+
// --------------------------------------------------------
173+
174+
#ifdef USB_XINPUT
175+
static void XInputLib_Receive_Callback() {
176+
XInput.receive();
177+
}
178+
#endif
179+
170180

171181
// --------------------------------------------------------
172182
// XInputGamepad Class (API) |
@@ -176,6 +186,9 @@ XInputGamepad::XInputGamepad() :
176186
tx(), rumble() // Zero initialize arrays
177187
{
178188
reset();
189+
#ifdef USB_XINPUT
190+
XInputUSB::setRecvCallback(XInputLib_Receive_Callback);
191+
#endif
179192
}
180193

181194
void XInputGamepad::press(XInputControl button) {

0 commit comments

Comments
 (0)