diff --git a/device/src/keyboard/key_scanner.c b/device/src/keyboard/key_scanner.c index 0e3c014ad..d9c7d67ac 100644 --- a/device/src/keyboard/key_scanner.c +++ b/device/src/keyboard/key_scanner.c @@ -10,7 +10,6 @@ #include "oled/oled_buffer.h" #include "logger.h" #include "key_states.h" -#include "keyboard/key_layout.h" #include "bool_array_converter.h" #include "legacy/module.h" #include "logger.h" @@ -21,6 +20,8 @@ #include "legacy/config_manager.h" #include "legacy/macros/keyid_parser.h" #include "attributes.h" +#include "legacy/layouts/key_layout.h" +#include "legacy/layouts/key_layout_80_to_universal.h" // Thread definitions @@ -115,7 +116,13 @@ static void scanKeys() { for (uint8_t rowId=0; rowId= 8) { + targetKeyId = KeyLayout_Uhk80_to_Universal[slotId][sourceIndex]; + } else { + targetKeyId = KeyLayout_Uhk80_to_Uhk60[slotId][sourceIndex]; + } if (targetKeyId < MAX_KEY_COUNT_PER_MODULE) { if (currentBacklightingMode == BacklightingMode_LedTest) { diff --git a/device/src/legacy/layouts/key_layout.c b/device/src/legacy/layouts/key_layout.c new file mode 120000 index 000000000..cebed70f0 --- /dev/null +++ b/device/src/legacy/layouts/key_layout.c @@ -0,0 +1 @@ +../../../../right/src/layouts/key_layout.c \ No newline at end of file diff --git a/device/src/legacy/layouts/key_layout.h b/device/src/legacy/layouts/key_layout.h new file mode 120000 index 000000000..4a2a0807a --- /dev/null +++ b/device/src/legacy/layouts/key_layout.h @@ -0,0 +1 @@ +../../../../right/src/layouts/key_layout.h \ No newline at end of file diff --git a/device/src/legacy/layouts/key_layout_60_to_universal.c b/device/src/legacy/layouts/key_layout_60_to_universal.c new file mode 120000 index 000000000..28f4b7df9 --- /dev/null +++ b/device/src/legacy/layouts/key_layout_60_to_universal.c @@ -0,0 +1 @@ +../../../../right/src/layouts/key_layout_60_to_universal.c \ No newline at end of file diff --git a/device/src/legacy/layouts/key_layout_60_to_universal.h b/device/src/legacy/layouts/key_layout_60_to_universal.h new file mode 120000 index 000000000..78f0fa4c2 --- /dev/null +++ b/device/src/legacy/layouts/key_layout_60_to_universal.h @@ -0,0 +1 @@ +../../../../right/src/layouts/key_layout_60_to_universal.h \ No newline at end of file diff --git a/device/src/legacy/layouts/key_layout_80_to_universal.c b/device/src/legacy/layouts/key_layout_80_to_universal.c new file mode 120000 index 000000000..745f8a106 --- /dev/null +++ b/device/src/legacy/layouts/key_layout_80_to_universal.c @@ -0,0 +1 @@ +../../../../right/src/layouts/key_layout_80_to_universal.c \ No newline at end of file diff --git a/device/src/legacy/layouts/key_layout_80_to_universal.h b/device/src/legacy/layouts/key_layout_80_to_universal.h new file mode 120000 index 000000000..0046c71e6 --- /dev/null +++ b/device/src/legacy/layouts/key_layout_80_to_universal.h @@ -0,0 +1 @@ +../../../../right/src/layouts/key_layout_80_to_universal.h \ No newline at end of file diff --git a/device/src/keyboard/key_layout.c b/right/src/layouts/key_layout.c similarity index 99% rename from device/src/keyboard/key_layout.c rename to right/src/layouts/key_layout.c index 9da4da243..18a7e436d 100644 --- a/device/src/keyboard/key_layout.c +++ b/right/src/layouts/key_layout.c @@ -1,5 +1,6 @@ #include "key_layout.h" +#ifdef __ZEPHYR__ const uint8_t KeyLayout_Uhk80_to_Uhk60[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { { // UHK60 keys @@ -159,3 +160,4 @@ const uint8_t KeyLayout_Uhk80_to_Uhk60[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { {}, {}, }; +#endif diff --git a/device/src/keyboard/key_layout.h b/right/src/layouts/key_layout.h similarity index 75% rename from device/src/keyboard/key_layout.h rename to right/src/layouts/key_layout.h index 435fbca0d..0d3730df7 100644 --- a/device/src/keyboard/key_layout.h +++ b/right/src/layouts/key_layout.h @@ -3,13 +3,14 @@ // Includes - #include "legacy/module.h" - #include "legacy/slot.h" + #include "module.h" + #include "slot.h" // Variables: - +#ifdef __ZEPHYR__ extern const uint8_t KeyLayout_Uhk80_to_Uhk60[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE]; +#endif // Functions: diff --git a/right/src/layouts/key_layout_60_to_universal.c b/right/src/layouts/key_layout_60_to_universal.c new file mode 100644 index 000000000..6f0ad6f33 --- /dev/null +++ b/right/src/layouts/key_layout_60_to_universal.c @@ -0,0 +1,99 @@ +#include "key_layout_60_to_universal.h" + +const uint8_t KeyLayout_Uhk60_to_Universal[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { + { + // UHK60 keys + [0] = 0, // 7 + [1] = 1, // 8 + [2] = 2, // 9 + [3] = 3, // 0 + [4] = 4, // - + [5] = 5, // = + [6] = 6, // backspace + + [14] = 7, // y + [7] = 8, // u + [8] = 9, // i + [9] = 10, // o + [10] = 11, // p + [11] = 12, // [ + [12] = 13, // ] + [13] = 14, // | + + [21] = 15, // h + [15] = 16, // j + [16] = 17, // k + [17] = 18, // l + [18] = 19, // ; + [19] = 20, // ' + [20] = 21, // enter + + [22] = 22, // n + [23] = 23, // m + [24] = 24, // , + [25] = 25, // . + [26] = 26, // / + [27] = 27, // shift + + [29] = 28, // space + [31] = 29, // fn + [32] = 30, // alt + [33] = 31, // super + [34] = 32, // ctrl + + [30] = 33, // inner case button + + // empty + [28] = 255, + }, + { + // UHK60 keys + + [0] = 0, // tilde + [1] = 1, // 1 + [2] = 2, // 2 + [3] = 3, // 3 + [4] = 4, // 4 + [5] = 5, // 5 + [6] = 6, // 6 + + + [7] = 7, // tab + [8] = 8, // q + [9] = 9, // w + [10] = 10, // e + [11] = 11, // r + [13] = 12, // t + + [14] = 13, // mouse + [15] = 14, // a + [16] = 15, // s + [17] = 16, // d + [18] = 17, // f + [20] = 18, // g + + [21] = 19, // shift + [22] = 20, // iso key + [23] = 21, // z + [24] = 22, // x + [25] = 23, // c + [26] = 24, // v + [27] = 25, // b + + [28] = 26, // ctrl + [29] = 27, // super + [30] = 28, // alt + [31] = 29, // fn + [33] = 30, // mod + + [32] = 31, // inner case button + + // unused + + [12] = 255, + [19] = 255, + [34] = 255, + }, + {}, + {}, +}; diff --git a/right/src/layouts/key_layout_60_to_universal.h b/right/src/layouts/key_layout_60_to_universal.h new file mode 100644 index 000000000..55d2921a2 --- /dev/null +++ b/right/src/layouts/key_layout_60_to_universal.h @@ -0,0 +1,19 @@ +#ifndef __KEY_LAYOUT_60_TO_UNIVERSAL_H__ +#define __KEY_LAYOUT_60_TO_UNIVERSAL_H__ + +// Includes + + #include "module.h" + #include "slot.h" + +// Variables: + + + extern const uint8_t KeyLayout_Uhk60_to_Universal[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE]; + +// Functions: + + + +#endif // __KEY_LAYOUT_H__ + diff --git a/right/src/layouts/key_layout_80_to_universal.c b/right/src/layouts/key_layout_80_to_universal.c new file mode 100644 index 000000000..450d124ae --- /dev/null +++ b/right/src/layouts/key_layout_80_to_universal.c @@ -0,0 +1,153 @@ +#include "key_layout_80_to_universal.h" + +#ifdef __ZEPHYR__ + +const uint8_t KeyLayout_Uhk80_to_Universal[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { + { + [0] = 35, // f7 + [1] = 36, // f8 + [2] = 37, // f9 + [3] = 38, // f10 + [4] = 39, // f11 + [5] = 40, // f12 + [6] = 41, // print + [8] = 42, // del + [9] = 43, // ins + + [10] = 0, // 7 + [11] = 1, // 8 + [12] = 2, // 9 + [13] = 3, // 0 + [14] = 4, // - + [15] = 5, // = + [16] = 6, // backspace + [18] = 44, // scrl lck + [19] = 45, // pause + + [30] = 7, // y + [20] = 8, // u + [21] = 9, // i + [22] = 10, // o + [23] = 11, // p + [24] = 12, // [ + [25] = 13, // ] + [26] = 14, // | + [28] = 46, // home + [29] = 47, // pg up + + [40] = 15, // h + [31] = 16, // j + [32] = 17, // k + [33] = 18, // l + [34] = 19, // ; + [35] = 20, // ' + [36] = 21, // enter + [38] = 48, // end + [39] = 49, // pg down + + [50] = 22, // n + [41] = 23, // m + [43] = 24, // , + [44] = 25, // . + [45] = 26, // / + [46] = 27, // shift + [47] = 50, // dbl arrow left + [48] = 51, // arrow up + [49] = 52, // dbl arrow right + + [51] = 28, // space + [42] = 29, // fn + [54] = 30, // alt + [55] = 31, // super + [56] = 32, // ctrl + [57] = 53, // arrow left + [58] = 54, // arrow down + [59] = 55, // arrow right + + [52] = 33, // inner case button + [53] = 34, // right case button + + // empty + [7] = 255, + [17] = 255, + [27] = 255, + [37] = 255, + }, + { + // UHK60 keys + + [0] = 33, // esc + [1] = 34, // f1 + [2] = 35, // f2 + [3] = 36, // f3 + [4] = 37, // f4 + [5] = 38, // f5 + [6] = 39, // f6 + + [7] = 0, // tilde + [8] = 1, // 1 + [9] = 2, // 2 + [10] = 3, // 3 + [11] = 4, // 4 + [12] = 5, // 5 + [13] = 6, // 6 + + + [14] = 7, // tab + [15] = 8, // q + [16] = 9, // w + [17] = 10, // e + [18] = 11, // r + [19] = 12, // t + + [21] = 13, // mouse + [22] = 14, // a + [23] = 15, // s + [24] = 16, // d + [25] = 17, // f + [26] = 18, // g + + [28] = 19, // shift + [29] = 20, // iso key + [30] = 21, // z + [31] = 22, // x + [32] = 23, // c + [33] = 24, // v + [34] = 25, // b + + [35] = 26, // ctrl + [36] = 27, // super + [37] = 28, // alt + [40] = 29, // fn + [41] = 30, // mod + + [39] = 31, // inner case button + [38] = 32, // left case button + + // unused + [20] = 255, + [27] = 255, + [42] = 255, + [43] = 255, + [44] = 255, + [45] = 255, + [46] = 255, + [47] = 255, + [48] = 255, + [49] = 255, + [50] = 255, + [51] = 255, + [52] = 255, + [53] = 255, + [54] = 255, + [55] = 255, + [56] = 255, + [57] = 255, + [58] = 255, + [59] = 255, + }, + {}, + {}, +}; + +#endif diff --git a/right/src/layouts/key_layout_80_to_universal.h b/right/src/layouts/key_layout_80_to_universal.h new file mode 100644 index 000000000..f35f952f8 --- /dev/null +++ b/right/src/layouts/key_layout_80_to_universal.h @@ -0,0 +1,21 @@ +#ifndef __KEY_LAYOUT_80_TO_UNIVERSAL_H__ +#define __KEY_LAYOUT_80_TO_UNIVERSAL_H__ + +// Includes + + #include "module.h" + #include "slot.h" + +// Variables: + + +#ifdef __ZEPHYR__ + extern const uint8_t KeyLayout_Uhk80_to_Universal[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE]; +#endif + +// Functions: + + + +#endif // __KEY_LAYOUT_H__ + diff --git a/right/src/ledmap.c b/right/src/ledmap.c index d3a5377a9..c61711c87 100644 --- a/right/src/ledmap.c +++ b/right/src/ledmap.c @@ -57,6 +57,7 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { MONO(6), // Backspace // Row 2 + MONO(32), // Y MONO(16), // U MONO(17), // I MONO(18), // O @@ -64,16 +65,15 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { MONO(20), // [ MONO(21), // ] MONO(22), // Backslash - MONO(32), // Y // Row 3 + MONO(48), // H MONO(33), // J MONO(34), // K MONO(35), // L MONO(36), // ; MONO(37), // ' MONO(38), // Enter - MONO(48), // H // Row 4 MONO(49), // N @@ -82,15 +82,16 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { MONO(52), // . MONO(53), // / MONO(54), // Right Shift - MONO(0), // Unused // Row 5 MONO(65), // Right Space - MONO(0), // Right Mod (no backlight) MONO(67), // Right Fn MONO(68), // Right Alt MONO(69), // Right Super MONO(70), // Right Control + + // Row 6 + MONO(0), // Right Mod (no backlight) }, // Left keyboard half @@ -114,7 +115,6 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { MONO(18), // W MONO(19), // E MONO(20), // R - MONO(0), // Unused MONO(22), // T // Row 3 @@ -123,7 +123,6 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { MONO(34), // S MONO(35), // D MONO(36), // F - MONO(0), // Unused MONO(38), // G // Row 4 @@ -140,9 +139,10 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { MONO(65), // Left Super MONO(66), // Left Alt MONO(67), // Left Fn - MONO(0), // Left Space (no backlight) MONO(69), // Left Mod - MONO(0), // Unused + + // Row 6 + MONO(0), // Left Space (no backlight) }, // Left module @@ -177,6 +177,7 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { RGB(0x95, 0xA5, 0x25), // = RGB(0x98, 0xA8, 0x28), // Backspace // Row 2 + RGB(0x9D, 0xAD, 0x2D), // Y RGB(0x99, 0xA9, 0x29), // U RGB(0x9A, 0xAA, 0x2A), // I RGB(0x9B, 0xAB, 0x2B), // O @@ -184,16 +185,15 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { RGB(0x60, 0x70, 0x80), // [ RGB(0x61, 0x71, 0x81), // ] RGB(0x62, 0x72, 0x82), // Backslash - RGB(0x9D, 0xAD, 0x2D), // Y // Row 3 + RGB(0x3D, 0x4D, 0x5D), // H RGB(0x30, 0x40, 0x50), // J RGB(0x31, 0x41, 0x51), // K RGB(0x32, 0x42, 0x52), // L RGB(0x33, 0x43, 0x53), // ; RGB(0x34, 0x44, 0x54), // ' RGB(0x35, 0x45, 0x55), // Enter - RGB(0x3D, 0x4D, 0x5D), // H // Row 4 RGB(0x39, 0x49, 0x59), // N @@ -202,15 +202,16 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { RGB(0x3C, 0x4C, 0x5C), // . RGB(0x38, 0x48, 0x58), // / RGB(0x63, 0x73, 0x83), // Right Shift - RGB(0x00, 0x00, 0x00), // Unused // Row 5 RGB(0x69, 0x79, 0x89), // Right Space - RGB(0x00, 0x00, 0x00), // Right Mod (no backlight) RGB(0x6A, 0x7A, 0x8A), // Right Fn RGB(0x68, 0x78, 0x88), // Right Alt RGB(0x64, 0x74, 0x84), // Right Super RGB(0x65, 0x75, 0x85), // Right Control + + // Row 6 + RGB(0x00, 0x00, 0x00), // Right Mod (no backlight) }, // Left keyboard half @@ -234,7 +235,6 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { RGB(0x04, 0x14, 0x24), // W RGB(0x08, 0x18, 0x28), // E RGB(0x0A, 0x1A, 0x2A), // R - RGB(0x00, 0x00, 0x00), // Unused RGB(0x0C, 0x1C, 0x2c), // T // Row 3 @@ -243,7 +243,6 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { RGB(0x05, 0x15, 0x25), // S RGB(0x09, 0x19, 0x29), // D RGB(0x0B, 0x1B, 0x2B), // F - RGB(0x00, 0x00, 0x00), // Unused RGB(0x0D, 0x1D, 0x2D), // G // Row 4 @@ -261,9 +260,10 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { RGB(0x33, 0x43, 0x53), // Left Super RGB(0x35, 0x45, 0x55), // Left Alt RGB(0x39, 0x49, 0x59), // Left Fn - RGB(0x00, 0x00, 0x00), // Left Space (no backlight) RGB(0x3C, 0x4C, 0x5C), // Left Mod - RGB(0x00, 0x00, 0x00), // Unused + + // Row 6 + RGB(0x00, 0x00, 0x00), // Left Space (no backlight) }, // Left module @@ -290,6 +290,7 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { RGB(14,13,15), // - RGB(32,31,33), // = RGB(194,193,195), // backspace + RGB(145,146,153), // y RGB(160,161,162), // u RGB(124,125,126), // i RGB(88,89,90), // o @@ -297,27 +298,26 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { RGB(16,17,18), // [ RGB(34,35,36), // ] RGB(196,197,198), // | - RGB(145,146,153), // y + RGB(147,148,149), // h RGB(109,110,117), // j RGB(73,74,81), // k RGB(37,38,45), // l RGB(1,2,9), // ; RGB(19,20,27), // ' RGB(181,182,189), // enter - RGB(147,148,149), // h RGB(151,150,152), // n RGB(111,112,113), // m RGB(39,40,41), // , RGB(3,4,5), // . RGB(21,22,23), // / RGB(183,184,185), // shift - RGB(0,0,0), // unused RGB(115,114,116), // space - RGB(79,78,80), // inner case button RGB(75,76,77), // fn RGB(7,6,8), // alt RGB(25,24,26), // super RGB(187,186,188), // ctrl + RGB(79,78,80), // inner case button + RGB(43,42,44), // right case button RGB(155,154,156), // f7 RGB(119,118,120), // f8 RGB(83,82,84), // f9 @@ -339,7 +339,6 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { RGB(97,96,98), // arrow left RGB(169,168,170), // arrow down RGB(133,132,134), // arrow right - RGB(43,42,44), // right case button }, // Left keyboard half @@ -356,14 +355,12 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { RGB(44,45,38), // w RGB(80,81,74), // e RGB(116,117,110), // r - RGB(0,0,0), // unused RGB(134,135,128), // t RGB(154,155,156), // mouse RGB(64,65,66), // a RGB(46,47,48), // s RGB(82,83,84), // d RGB(118,119,120), // f - RGB(0,0,0), // 19 RGB(136,137,138), // g RGB(190,191,192), // shift RGB(67,68,70), // isoKey @@ -376,8 +373,9 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { RGB(69,72,71), // super RGB(51,54,53), // alt RGB(141,144,143), // fn - RGB(123,126,125), // inner case button RGB(195,198,197), // mod + RGB(123,126,125), // inner case button + RGB(87,90,89), // left case button RGB(147,148,149), // esc RGB(57,58,59), // f1 RGB(39,40,41), // f2 @@ -385,7 +383,6 @@ static rgb_t LedMap[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = { RGB(111,112,113), // f4 RGB(129,130,131), // f5 RGB(183,184,185), // f6 - RGB(87,90,89), // left case button }, // Left module diff --git a/right/src/main.c b/right/src/main.c index c3d380296..e29efa71e 100644 --- a/right/src/main.c +++ b/right/src/main.c @@ -1,3 +1,4 @@ +#include "config_parser/parse_config.h" #include "keymap.h" #include "slave_drivers/is31fl3xxx_driver.h" #include "slave_drivers/uhk_module_driver.h" @@ -27,6 +28,7 @@ #include "config_parser/config_globals.h" #include "user_logic.h" #include "usb_descriptors/usb_descriptor_strings.h" +#include "layouts/key_layout_60_to_universal.h" static bool IsEepromInitialized = false; static bool IsConfigInitialized = false; @@ -88,8 +90,17 @@ void CopyRightKeystateMatrix(void) ++MatrixScanCounter; bool stateChanged = false; for (uint8_t keyId = 0; keyId < RIGHT_KEY_MATRIX_KEY_COUNT; keyId++) { - if (KeyStates[SlotId_RightKeyboardHalf][keyId].hardwareSwitchState != RightKeyMatrix.keyStates[keyId]) { - KeyStates[SlotId_RightKeyboardHalf][keyId].hardwareSwitchState = RightKeyMatrix.keyStates[keyId]; + uint8_t targetKeyId; + + // TODO: optimize this? This translation is quite costly :-/ + if (DataModelMajorVersion >= 8) { + targetKeyId = KeyLayout_Uhk60_to_Universal[SlotId_RightKeyboardHalf][keyId]; + } else { + targetKeyId = keyId; + } + + if (KeyStates[SlotId_RightKeyboardHalf][targetKeyId].hardwareSwitchState != RightKeyMatrix.keyStates[keyId]) { + KeyStates[SlotId_RightKeyboardHalf][targetKeyId].hardwareSwitchState = RightKeyMatrix.keyStates[keyId]; stateChanged = true; } } diff --git a/right/src/slave_drivers/uhk_module_driver.c b/right/src/slave_drivers/uhk_module_driver.c index ffb289a1c..a1c8405eb 100644 --- a/right/src/slave_drivers/uhk_module_driver.c +++ b/right/src/slave_drivers/uhk_module_driver.c @@ -25,6 +25,7 @@ #include "debug.h" #include "macros/core.h" #include "versioning.h" +#include "layouts/key_layout_60_to_universal.h" uhk_module_state_t UhkModuleStates[UHK_MODULE_MAX_SLOT_COUNT]; module_connection_state_t ModuleConnectionStates[UHK_MODULE_MAX_SLOT_COUNT]; @@ -129,8 +130,17 @@ void UhkModuleSlaveDriver_ProcessKeystates(uint8_t uhkModuleDriverId, uhk_module bool stateChanged = false; bool nonzeroDeltas = false; for (uint8_t keyId=0; keyId < uhkModuleState->keyCount; keyId++) { - if (KeyStates[slotId][keyId].hardwareSwitchState != keyStatesBuffer[keyId]) { - KeyStates[slotId][keyId].hardwareSwitchState = keyStatesBuffer[keyId]; + uint8_t targetKeyId; + + // TODO: optimize this? This translation is quite costly :-/ + if (DataModelMajorVersion >= 8 && uhkModuleDriverId == UhkModuleDriverId_LeftKeyboardHalf) { + targetKeyId = KeyLayout_Uhk60_to_Universal[SlotId_LeftKeyboardHalf][keyId]; + } else { + targetKeyId = keyId; + } + + if (KeyStates[slotId][targetKeyId].hardwareSwitchState != keyStatesBuffer[targetKeyId]) { + KeyStates[slotId][targetKeyId].hardwareSwitchState = keyStatesBuffer[targetKeyId]; stateChanged = true; } }