-
-
Notifications
You must be signed in to change notification settings - Fork 7k
[PluggableHID] API simplification proposal #3840
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,16 +42,12 @@ | |
#define HID_REPORT_DESCRIPTOR_TYPE 0x22 | ||
#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23 | ||
|
||
typedef struct __attribute__((packed)) { | ||
uint8_t length; | ||
const void* descriptor; | ||
} HID_Descriptor; | ||
|
||
class HIDDescriptorListNode { | ||
public: | ||
HIDDescriptorListNode *next = NULL; | ||
const HID_Descriptor * cb; | ||
HIDDescriptorListNode(const HID_Descriptor *ncb) {cb = ncb;} | ||
HIDDescriptorListNode(const void *d, uint16_t l) : data(d), length(l) { } | ||
uint8_t length; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. uint16_t? Also this could be const (avr as well)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It should allow for descriptors >256.
Mbah, does it really matter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes. but its uint8_t. look ;D Its not about changing permissions, its about code style, debugging and compiler optimization. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahhh, right good catch! ;-) |
||
const void* data; | ||
}; | ||
|
||
class HID_ | ||
|
@@ -90,4 +86,4 @@ typedef struct | |
|
||
#define WEAK __attribute__ ((weak)) | ||
|
||
#endif | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why you always use int in the Arduino programs? uint16_t would make life much easier in most cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, since I'm not the author of the USB stack. I guess the reason is that
USBD_SendControl
returns-1
in case of failure.(well, for the sake of precision, it seems that
USBD_SendControl
in the SAM core will never returns-1
but the equivalent function in the AVR core,USB_SendControl
does, probably this is something that has been inherited when the USB stack has been ported from AVR to SAM).To fix this we probably should handle the error condition, and eventually return -1 if one call to
USB(D)_SendControl
fails.