From 971b3bb74113fc1bcd52122ba167849bded8ad99 Mon Sep 17 00:00:00 2001 From: David Madison Date: Sat, 9 Mar 2019 15:51:24 -0500 Subject: Moved send above recv in Xinput API header Logical reordering, no functional change --- cores/arduino/xinput/USB_XInput_API.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cores') diff --git a/cores/arduino/xinput/USB_XInput_API.h b/cores/arduino/xinput/USB_XInput_API.h index 0a8fa43..9f2e686 100644 --- a/cores/arduino/xinput/USB_XInput_API.h +++ b/cores/arduino/xinput/USB_XInput_API.h @@ -38,8 +38,8 @@ public: // API static bool connected(void); static int available(void); - static int recv(void *buffer, uint8_t nbytes); static int send(const void *buffer, uint8_t nbytes); + static int recv(void *buffer, uint8_t nbytes); static void setRecvCallback(void(*callback)(void)); // Non-API Data -- cgit v1.2.3-18-g5258 From 55cf0e1003a3a53b8f9948a4aa95275687b46ab4 Mon Sep 17 00:00:00 2001 From: David Madison Date: Sat, 9 Mar 2019 15:52:15 -0500 Subject: Switch 'available' return type to uint8_t This function never returns an error (-1), and the number of bytes available will never be a negative number. --- cores/arduino/xinput/USB_XInput_API.cpp | 2 +- cores/arduino/xinput/USB_XInput_API.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'cores') diff --git a/cores/arduino/xinput/USB_XInput_API.cpp b/cores/arduino/xinput/USB_XInput_API.cpp index 678692d..ffd818c 100644 --- a/cores/arduino/xinput/USB_XInput_API.cpp +++ b/cores/arduino/xinput/USB_XInput_API.cpp @@ -34,7 +34,7 @@ boolean XInputUSB::connected() { return USBDevice.configured(); } -int XInputUSB::available() { +uint8_t XInputUSB::available() { return USB_Available(XINPUT_RX_ENDPOINT); } diff --git a/cores/arduino/xinput/USB_XInput_API.h b/cores/arduino/xinput/USB_XInput_API.h index 9f2e686..11fa100 100644 --- a/cores/arduino/xinput/USB_XInput_API.h +++ b/cores/arduino/xinput/USB_XInput_API.h @@ -37,9 +37,9 @@ class XInputUSB { public: // API static bool connected(void); - static int available(void); - static int send(const void *buffer, uint8_t nbytes); - static int recv(void *buffer, uint8_t nbytes); + static uint8_t available(void); + static int send(const void *buffer, uint8_t nbytes); + static int recv(void *buffer, uint8_t nbytes); static void setRecvCallback(void(*callback)(void)); // Non-API Data -- cgit v1.2.3-18-g5258