Skip to content

Commit 90bc8f4

Browse files
committed
Add connected function
1 parent 90768d1 commit 90bc8f4

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

keywords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ getRumbleRight KEYWORD2
4747
getLEDPatternID KEYWORD2
4848

4949
# USB I/O
50+
connected KEYWORD2
5051
send KEYWORD2
5152
receive KEYWORD2
5253

src/XInput.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,14 @@ uint8_t XInputGamepad::getLEDPatternID() const {
304304
return (uint8_t)ledPattern;
305305
}
306306

307+
boolean XInputGamepad::connected() {
308+
#ifdef USB_XINPUT
309+
return XInputUSB::connected();
310+
#else
311+
return false;
312+
#endif
313+
}
314+
307315
//Send an update packet to the PC
308316
size_t XInputGamepad::send() {
309317
if (!newData) return 0; // TX data hasn't changed

src/XInput.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class XInputGamepad {
104104
XInputLEDPattern getLEDPattern() const; // Returns LED pattern type
105105

106106
// USB IO
107+
boolean connected();
107108
size_t send();
108109
size_t receive();
109110

0 commit comments

Comments
 (0)