Skip to content

Commit d13aadc

Browse files
committed
[HID] removed HIDDescriptor field
The field is now built on-the-fly on the stack and sent over USB. This change increase Flash usage and decrease SRAM usage: before: 6114 / 241 after: 6152 / 216 (removed HIDDescriptor field) delta: +38 / -25 SRAM is a much more scarse resource and this change free up to about 10% of the "base" usage.
1 parent 214b260 commit d13aadc

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

Diff for: hardware/arduino/avr/libraries/HID/HID.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ HID_ HID;
2626
int HID_::getInterface(uint8_t* interfaceNum)
2727
{
2828
*interfaceNum += 1; // uses 1
29-
hidInterface = {
29+
HIDDescriptor hidInterface = {
3030
D_INTERFACE(interface(), 1, 3, 0, 0),
3131
D_HIDREPORT(descriptorSize),
3232
D_ENDPOINT(USB_ENDPOINT_IN(endpoint()), USB_ENDPOINT_TYPE_INTERRUPT, USB_EP_SIZE, 0x01)

Diff for: hardware/arduino/avr/libraries/HID/HID.h

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ class HID_ : public PUSBListNode
8484
bool setup(USBSetup& setup, uint8_t interfaceNum);
8585

8686
private:
87-
HIDDescriptor hidInterface;
8887
uint8_t epType[1];
8988

9089
HIDDescriptorListNode* rootNode;

0 commit comments

Comments
 (0)