Enabled BootKeyboard by default, now dynamically chooses the protocol type
This commit is contained in:
parent
67904276e5
commit
3ed2577dac
6 changed files with 21 additions and 12 deletions
|
|
@ -12,10 +12,12 @@ The idea is to enable enhanced USB functions to almost all 'standard' Arduino bo
|
|||
* Mega (with HoodLoader2)
|
||||
* Leonardo
|
||||
* (Pro)Micro
|
||||
* Any other 8u2/16u/at90usb162/32u2/32u4 compatible board
|
||||
* Any other 8u2/16u2/at90usb8/162/32u2/32u4 compatible board
|
||||
|
||||
**Supported HID devices:**
|
||||
* Keyboard with Leds out (modifiers + 6 keys pressed at the same time)
|
||||
* Teensy Keyboard with different keyboard layouts (german, french and many more)
|
||||
* BootKeyboard protocol for Improved/Teensy Keyboard (works under BIOS)
|
||||
* NKRO Keyboard with Leds out (press up to 113 keys at the same time)
|
||||
* Mouse (5 buttons, move, wheel)
|
||||
* Absolute Mouse
|
||||
|
|
@ -88,6 +90,7 @@ Version History
|
|||
* Added HID out report in general (RAW HID preparation)
|
||||
* Added a few key definitions
|
||||
* Uses .alinkage custom IDE option
|
||||
* Added BootKeyboard support (BIOS compatibility)
|
||||
|
||||
2.3 Release (never released)
|
||||
* Updated Libraries
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ THE SOFTWARE.
|
|||
#endif
|
||||
|
||||
#define HID_KEYBOARD_LEDS_ENABLED
|
||||
//#define USE_BOOT_KEYBOARD_PROTOCOL
|
||||
#define USE_BOOT_KEYBOARD_PROTOCOL
|
||||
|
||||
//#define LAYOUT_US_ENGLISH
|
||||
//#define LAYOUT_CANADIAN_FRENCH
|
||||
|
|
|
|||
|
|
@ -102,10 +102,12 @@ void Keyboard_::sendReport(HID_KeyboardReport_Data_t* keys)
|
|||
// Call the inherited function.
|
||||
// This wrapper still saves us some bytes
|
||||
#if defined(USE_BOOT_KEYBOARD_PROTOCOL)
|
||||
HID.SendReport(HID_REPORTID_NONE, keys,sizeof(HID_KeyboardReport_Data_t));
|
||||
#else
|
||||
SendReport(keys,sizeof(HID_KeyboardReport_Data_t));
|
||||
if(getProtocol() != 1){
|
||||
SendRawReport(keys,sizeof(HID_KeyboardReport_Data_t));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
SendReport(keys,sizeof(HID_KeyboardReport_Data_t));
|
||||
}
|
||||
|
||||
#if defined(HID_KEYBOARD_LEDS_ENABLED)
|
||||
|
|
|
|||
|
|
@ -2,10 +2,7 @@
|
|||
#include "PluggableUSB.h"
|
||||
#include "HIDDevice.h"
|
||||
#include "HID.h"
|
||||
|
||||
#ifdef kkk
|
||||
#error
|
||||
#endif
|
||||
#include "HID-Project.h"
|
||||
|
||||
#if defined(USBCON)
|
||||
|
||||
|
|
@ -19,6 +16,10 @@ void HIDDevice::SendReport(const void* data, int len){
|
|||
HID.SendReport(reportID, data, len);
|
||||
}
|
||||
|
||||
void HIDDevice::SendRawReport(const void* data, int len){
|
||||
HID.SendReport(HID_REPORTID_NONE, data, len);
|
||||
}
|
||||
|
||||
void HIDDevice::setReportData(const void* data, int len){
|
||||
// Discard this information if its not implemented by the HIDDevice
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ protected:
|
|||
// Could be used and inherited public for custom, professional usage, like raw Keyboard
|
||||
// As an alternative you may still call the HID singleton.
|
||||
void SendReport(const void* data, int len);
|
||||
void SendRawReport(const void* data, int len);
|
||||
uint8_t getProtocol(void);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -254,10 +254,12 @@ void usb_keyboard_class::set_media(uint8_t c)
|
|||
void usb_keyboard_class::send_now(void)
|
||||
{
|
||||
#if defined(USE_BOOT_KEYBOARD_PROTOCOL)
|
||||
HID.SendReport(HID_REPORTID_NONE, keyboard_report_data,sizeof(keyboard_report_data));
|
||||
#else
|
||||
SendReport(keyboard_report_data,sizeof(keyboard_report_data));
|
||||
if(getProtocol() != 1){
|
||||
SendRawReport(keyboard_report_data,sizeof(keyboard_report_data));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
SendReport(keyboard_report_data,sizeof(keyboard_report_data));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue