]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Output/pjrcUSB/avr/usb_keyboard_serial.c
Fixed Linux NKRO bitmap bug.
[kiibohd-controller.git] / Output / pjrcUSB / avr / usb_keyboard_serial.c
index 63a8f7288cb51e9a35f71a9f9a08671c0780c830..9c2324ee3437e6722556e11de9e70ae0cb0d30c2 100644 (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