From cb57ec9c02ffebe5abeba266eb9eaa3dfc2089d3 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 27 Nov 2022 02:05:04 +0000 Subject: [PATCH] Revert lib/usbhost changes (#19165) --- lib/usbhost/USB_Host_Shield_2.0/SPP.cpp | 2 +- .../examples/Bluetooth/PS3Multi/PS3Multi.ino | 2 +- .../examples/Bluetooth/WiiMulti/WiiMulti.ino | 2 +- .../USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h | 2 +- .../USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/usbhost/USB_Host_Shield_2.0/SPP.cpp b/lib/usbhost/USB_Host_Shield_2.0/SPP.cpp index 8169707661f..0f4ee5e9810 100644 --- a/lib/usbhost/USB_Host_Shield_2.0/SPP.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/SPP.cpp @@ -757,7 +757,7 @@ size_t SPP::write(const uint8_t *data, size_t size) { void SPP::write(const uint8_t *data, size_t size) { #endif for(uint8_t i = 0; i < size; i++) { - if(sppIndex >= ARRAY_SIZE(sppOutputBuffer)) + if(sppIndex >= sizeof (sppOutputBuffer) / sizeof (sppOutputBuffer[0])) send(); // Send the current data in the buffer sppOutputBuffer[sppIndex++] = data[i]; // All the bytes are put into a buffer and then send using the send() function } diff --git a/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino index 11833334d04..5ebfd7819c2 100644 --- a/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino @@ -19,7 +19,7 @@ USB Usb; BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so PS3BT *PS3[2]; // We will use this pointer to store the two instance, you can easily make it larger if you like, but it will use a lot of RAM! -const uint8_t length = ARRAY_SIZE(PS3); // Get the lenght of the array +const uint8_t length = sizeof(PS3) / sizeof(PS3[0]); // Get the lenght of the array bool printAngle[length]; bool oldControllerState[length]; diff --git a/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino index 93cd084651d..07c6f13d2bb 100644 --- a/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino @@ -19,7 +19,7 @@ USB Usb; BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so WII *Wii[2]; // We will use this pointer to store the two instance, you can easily make it larger if you like, but it will use a lot of RAM! -const uint8_t length = ARRAY_SIZE(Wii); // Get the lenght of the array +const uint8_t length = sizeof(Wii) / sizeof(Wii[0]); // Get the lenght of the array bool printAngle[length]; bool oldControllerState[length]; diff --git a/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h index 05dab14afe1..2400364e65f 100644 --- a/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h @@ -25,7 +25,7 @@ public: virtual void OnGamePadChanged(const GamePadEventData *evt); }; -#define RPT_GAMEPAD_LEN sizeof(GamePadEventData) +#define RPT_GAMEPAD_LEN sizeof(GamePadEventData)/sizeof(uint8_t) class JoystickReportParser : public HIDReportParser { diff --git a/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h index 7af18b88f71..57fbb033bf7 100644 --- a/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h @@ -38,7 +38,7 @@ public: virtual void OnScaleChanged(const ScaleEventData *evt); }; -#define RPT_SCALE_LEN sizeof(ScaleEventData) +#define RPT_SCALE_LEN sizeof(ScaleEventData)/sizeof(uint8_t) class ScaleReportParser : public HIDReportParser {