Skip to content

[HID] Another small cleanup #3884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Sep 28, 2015

Applying some of the suggestion from @NicoHood and other clean-up as well.

  • HID.SendReport now use an unsigned parameter for lenght
  • Removed all weird u8 datatype (from HID only, USBCore not yet)
  • Removed unused PUSBReturn structure (is that used somewhere?)
  • Some other minor fix

/cc @facchinm @NicoHood

@cmaglie cmaglie added feature request A request to make an enhancement (not a bug fix) Library: HID The HID Arduino library labels Sep 28, 2015
@cmaglie cmaglie self-assigned this Sep 28, 2015
@cmaglie cmaglie added this to the Release 1.6.6 milestone Sep 28, 2015
@@ -85,19 +85,19 @@ void HID_::AppendDescriptor(HIDDescriptorListNode *node)
sizeof_hidReportDescriptor += (uint16_t)node->length;
}

void HID_::SendReport(u8 id, const void* data, int len)
void HID_::SendReport(uint8_t id, const void* data, const uint16_t len)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be int or you should change all underlying APIs as well. I know that this is sometimes good or bad but in this case we should keep the int. 32k bytes is far enough anyways.

@NicoHood
Copy link
Contributor

Looks good to me except the int vs uin16_t.

@cmaglie
Copy link
Member Author

cmaglie commented Sep 28, 2015

This should be int or you should change all underlying APIs as well. I know that this is sometimes good or bad but in this case we should keep the int. 32k bytes is far enough anyways.

my preference was to change it, but you're right, it's not worth doing it now.

I've rebased and merged everything except int -> uint16

@cmaglie cmaglie closed this Sep 28, 2015
@cmaglie cmaglie deleted the phid_cleanup branch September 28, 2015 15:08
@NicoHood
Copy link
Contributor

Maybe we will change this stuff later on but I dont think so.

Could you please try to get this working?
#3874 (comment)

Otherwise I really need a pluggable USB API change to get stuff working efficiently.

Similar to your last PR I'd merge those two also together:
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/PluggableUSB.h#L28-L43
Also I'd remove the pointer here. I believe a normal byte is enough here, this saves 2 more bytes:
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/PluggableUSB.h#L35

But before you do that I need to know if the code issue above can be solved. If not I'd like to change the Pluggable USB a bit, similar to my HID change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A request to make an enhancement (not a bug fix) Library: HID The HID Arduino library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants