Contentious change to Arduino USB HID implementation - don't

automatically send a key report on every change. Let calling code
decide when. This breaks normal sketches, but makes a keyboard
much faster
pull/18/head
Jesse Vincent 10 years ago
parent 01c94640dd
commit f0fe7a41a5

@ -554,7 +554,6 @@ uint8_t USBPutChar(uint8_t c);
if (!addKeycodeToReport(k)) { if (!addKeycodeToReport(k)) {
return 0; return 0;
} }
sendReport(&_keyReport);
} }
size_t Keyboard_::addKeycodeToReport(uint8_t k) size_t Keyboard_::addKeycodeToReport(uint8_t k)
@ -700,7 +699,6 @@ size_t Keyboard_::releaseKeycode(uint8_t k)
if (!removeKeycodeFromReport(k)) { if (!removeKeycodeFromReport(k)) {
return 0; return 0;
} }
sendReport(&_keyReport);
} }
size_t Keyboard_::removeKeycodeFromReport(uint8_t k) size_t Keyboard_::removeKeycodeFromReport(uint8_t k)
@ -781,6 +779,10 @@ size_t Keyboard_::release(uint8_t k)
void Keyboard_::releaseAll(void) void Keyboard_::releaseAll(void)
{ {
memset(&_keyReport, 0x00, sizeof(_keyReport)); memset(&_keyReport, 0x00, sizeof(_keyReport));
sendCurrentReport();
}
void Keyboard_::sendCurrentReport(void) {
sendReport(&_keyReport); sendReport(&_keyReport);
} }

@ -233,6 +233,7 @@ public:
virtual void releaseAll(void); virtual void releaseAll(void);
virtual size_t systemControl(uint8_t k); virtual size_t systemControl(uint8_t k);
virtual size_t consumerControl(uint8_t k); virtual size_t consumerControl(uint8_t k);
void sendCurrentReport(void);
}; };
extern Keyboard_ Keyboard; extern Keyboard_ Keyboard;

Loading…
Cancel
Save