Merge commit '186c2c432c2ba896e921f1ad4ff436a6466560b3' into dev

This commit is contained in:
NicoHood 2015-11-07 11:09:04 +01:00
commit ef6e8e52a7
2 changed files with 5 additions and 4 deletions

View file

@ -82,7 +82,7 @@ void loop() {
}
}
void RawHIDEvent(void) {
void RawHIDEvent(uint8_t num) {
// This event is called via interrupt.
// Do not use print inside, or other long function calls!
// If you not use this event function,

View file

@ -48,8 +48,8 @@ static const uint8_t _hidReportDescriptorRawHID[] PROGMEM = {
};
// Weak implementation of the Event function
void RawHIDEvent(void) __attribute__ ((weak));
void RawHIDEvent(void){
void RawHIDEvent(uint8_t num) __attribute__ ((weak));
void RawHIDEvent(uint8_t num){
// Empty
}
@ -122,6 +122,7 @@ bool RawHID_::setup(USBSetup& setup)
{
// Get the data length information and the corresponding bytes
int length = setup.wLength;
uint8_t num = 0;
while(length)
{
// Dont receive more than the USB EP has to offer
@ -143,7 +144,7 @@ bool RawHID_::setup(USBSetup& setup)
// Write data to fit to the end (not the beginning) of the array
USB_RecvControl(data + (sizeof(data) - recvLength), recvLength);
dataLength = recvLength;
RawHIDEvent();
RawHIDEvent(num++);
}
// Do not read the data, flag an error to the USB Host
// TODO always return no error, even if data was discarded? -> use break then