Merge commit '186c2c432c2ba896e921f1ad4ff436a6466560b3' into dev
This commit is contained in:
commit
ef6e8e52a7
2 changed files with 5 additions and 4 deletions
|
|
@ -82,7 +82,7 @@ void loop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RawHIDEvent(void) {
|
void RawHIDEvent(uint8_t num) {
|
||||||
// This event is called via interrupt.
|
// This event is called via interrupt.
|
||||||
// Do not use print inside, or other long function calls!
|
// Do not use print inside, or other long function calls!
|
||||||
// If you not use this event function,
|
// If you not use this event function,
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@ static const uint8_t _hidReportDescriptorRawHID[] PROGMEM = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Weak implementation of the Event function
|
// Weak implementation of the Event function
|
||||||
void RawHIDEvent(void) __attribute__ ((weak));
|
void RawHIDEvent(uint8_t num) __attribute__ ((weak));
|
||||||
void RawHIDEvent(void){
|
void RawHIDEvent(uint8_t num){
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,6 +122,7 @@ bool RawHID_::setup(USBSetup& setup)
|
||||||
{
|
{
|
||||||
// Get the data length information and the corresponding bytes
|
// Get the data length information and the corresponding bytes
|
||||||
int length = setup.wLength;
|
int length = setup.wLength;
|
||||||
|
uint8_t num = 0;
|
||||||
while(length)
|
while(length)
|
||||||
{
|
{
|
||||||
// Dont receive more than the USB EP has to offer
|
// 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
|
// Write data to fit to the end (not the beginning) of the array
|
||||||
USB_RecvControl(data + (sizeof(data) - recvLength), recvLength);
|
USB_RecvControl(data + (sizeof(data) - recvLength), recvLength);
|
||||||
dataLength = recvLength;
|
dataLength = recvLength;
|
||||||
RawHIDEvent();
|
RawHIDEvent(num++);
|
||||||
}
|
}
|
||||||
// Do not read the data, flag an error to the USB Host
|
// 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
|
// TODO always return no error, even if data was discarded? -> use break then
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue