Fixed Linux NKRO bitmap bug.

- Thanks hasu for pointing it out
- Keycode 50 is problematic under Linux, so removing (it's a duplicate keycode anyways)
This commit is contained in:
Jacob Alexander 2014-10-02 01:40:14 -07:00
parent fc84d45470
commit 0cbfe53794
6 changed files with 128 additions and 42 deletions

View file

@ -118,8 +118,8 @@ inline void usb_keyboard_send()
{
UEDATX = 0x03; // ID
// 4-164 (first 20 bytes)
for ( uint8_t byte = 0; byte < 20; byte++ )
// 4-49 (first 6 bytes)
for ( uint8_t byte = 0; byte < 6; byte++ )
UEDATX = USBKeys_Keys[ byte ];
UEINTX = 0; // Finished with ID
@ -131,18 +131,31 @@ inline void usb_keyboard_send()
{
UEDATX = 0x04; // ID
// 176-221 (last 6 bytes)
for ( uint8_t byte = 20; byte < 26; byte++ )
// 51-164 (Middle 15 bytes)
for ( uint8_t byte = 6; byte < 21; byte++ )
UEDATX = USBKeys_Keys[ byte ];
UEINTX = 0; // Finished with ID
USBKeys_Changed &= ~USBKeyChangeState_SecondaryKeys; // Mark sent
}
// Check tertiary key section
else if ( USBKeys_Changed & USBKeyChangeState_TertiaryKeys )
{
UEDATX = 0x05; // ID
// 176-221 (last 6 bytes)
for ( uint8_t byte = 21; byte < 27; byte++ )
UEDATX = USBKeys_Keys[ byte ];
UEINTX = 0; // Finished with ID
USBKeys_Changed &= ~USBKeyChangeState_TertiaryKeys; // Mark sent
}
// Check system control keys
else if ( USBKeys_Changed & USBKeyChangeState_System )
{
UEDATX = 0x05; // ID
UEDATX = 0x06; // ID
UEDATX = USBKeys_SysCtrl;
UEINTX = 0; // Finished with ID
@ -151,7 +164,7 @@ inline void usb_keyboard_send()
// Check consumer control keys
else if ( USBKeys_Changed & USBKeyChangeState_Consumer )
{
UEDATX = 0x06; // ID
UEDATX = 0x07; // ID
UEDATX = (uint8_t)(USBKeys_ConsCtrl & 0x00FF);
UEDATX = (uint8_t)(USBKeys_ConsCtrl >> 8);
UEINTX = 0; // Finished with ID