diff --git a/device/src/keyboard/key_scanner.c b/device/src/keyboard/key_scanner.c index 5bef4fe6c..65d614877 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 @@ -113,7 +114,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/state_sync.c b/device/src/state_sync.c index 26994d11f..927a20427 100644 --- a/device/src/state_sync.c +++ b/device/src/state_sync.c @@ -123,6 +123,7 @@ static state_sync_prop_t stateSyncProps[StateSyncPropertyId_Count] = { SIMPLE(MergeSensor, SyncDirection_LeftToRight, DirtyState_Clean, &MergeSensor_HalvesAreMerged), SIMPLE(FunctionalColors, SyncDirection_RightToLeft, DirtyState_Clean, &Cfg.KeyActionColors), SIMPLE(PowerMode, SyncDirection_RightToLeft, DirtyState_Clean, &CurrentPowerMode), + CUSTOM(Config, SyncDirection_RightToLeft, DirtyState_Clean), }; static void invalidateProperty(state_sync_prop_id_t propId) { @@ -332,6 +333,12 @@ static void receiveProperty(device_id_t src, state_sync_prop_id_t propId, const EventVector_Set(EventVector_LedMapUpdateNeeded); } break; + case StateSyncPropertyId_Config: + if (!isLocalUpdate) { + sync_command_config_t* buffer = (sync_command_config_t*)data; + DataModelVersion = buffer->dataModelVersion; + } + break; case StateSyncPropertyId_MergeSensor: break; default: @@ -469,6 +476,12 @@ static void prepareData(device_id_t dst, const uint8_t *propDataPtr, state_sync_ submitPreparedData(dst, propId, (const uint8_t *)&buffer, sizeof(buffer)); return; } break; + case StateSyncPropertyId_Config: { + sync_command_config_t buffer; + buffer.dataModelVersion = DataModelVersion; + submitPreparedData(dst, propId, (const uint8_t *)&buffer, sizeof(buffer)); + return; + } break; default: break; } @@ -511,6 +524,7 @@ static void updateProperty(state_sync_prop_id_t propId) { static bool handlePropertyUpdateRightToLeft() { UPDATE_AND_RETURN_IF_DIRTY(StateSyncPropertyId_ResetRightLeftLink); + UPDATE_AND_RETURN_IF_DIRTY(StateSyncPropertyId_Config); if (KeyBacklightBrightness != 0 && Cfg.BacklightingMode != BacklightingMode_ConstantRGB) { // Update relevant data @@ -642,6 +656,7 @@ void StateSync_ResetRightLeftLink(bool bidirectional) { invalidateProperty(StateSyncPropertyId_ResetRightLeftLink); } if (DEVICE_ID == DeviceId_Uhk80_Right) { + invalidateProperty(StateSyncPropertyId_Config); state_sync_prop_id_t first = StateSyncPropertyId_LayerActionFirst; state_sync_prop_id_t last = StateSyncPropertyId_LayerActionLast; for (state_sync_prop_id_t propId = first; propId <= last; propId++) { diff --git a/device/src/state_sync.h b/device/src/state_sync.h index 4d516a17e..cda8280a2 100644 --- a/device/src/state_sync.h +++ b/device/src/state_sync.h @@ -59,6 +59,10 @@ char firmwareChecksum[MD5_CHECKSUM_LENGTH]; } ATTR_PACKED sync_command_module_state_t; + typedef struct { + version_t dataModelVersion; + } sync_command_config_t; + // Draft for generic properties typedef enum { StateSyncPropertyId_LayerActionsLayer1 = 1, @@ -89,6 +93,7 @@ StateSyncPropertyId_MergeSensor, StateSyncPropertyId_FunctionalColors, StateSyncPropertyId_PowerMode, + StateSyncPropertyId_Config, StateSyncPropertyId_Count, } state_sync_prop_id_t; diff --git a/right/src/keymap.c b/right/src/keymap.c index 9882bc8bc..d54e6b8e8 100644 --- a/right/src/keymap.c +++ b/right/src/keymap.c @@ -135,6 +135,7 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_BACKSPACE }}, // Row 2 + { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_Y }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_U }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_I }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_O }}, @@ -142,16 +143,15 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_OPENING_BRACKET_AND_OPENING_BRACE }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_CLOSING_BRACKET_AND_CLOSING_BRACE }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_BACKSLASH_AND_PIPE }}, - { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_Y }}, // Row 3 + { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_H }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_J }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_K }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_L }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_SEMICOLON_AND_COLON }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_APOSTROPHE_AND_QUOTE }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_ENTER }}, - { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_H }}, // Row 4 { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_N }}, @@ -160,15 +160,15 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_DOT_AND_GREATER_THAN_SIGN }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_SLASH_AND_QUESTION_MARK }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_SHIFT }}, - { .type = KeyActionType_None }, // Row 5 { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_SPACE }}, - { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Mod, .mode = SwitchLayerMode_Hold }}, { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Fn , .mode = SwitchLayerMode_Hold }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_ALT }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_GUI }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_CONTROL }}, + { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Mod, .mode = SwitchLayerMode_Hold }}, + { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Fn2, .mode = SwitchLayerMode_HoldAndDoubleTapToggle }}, #if DEVICE_IS_UHK80 // Row 0 @@ -194,7 +194,6 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_ARROW}}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_DOWN_ARROW}}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_ARROW}}, - { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Fn2, .mode = SwitchLayerMode_HoldAndDoubleTapToggle }}, #endif }, @@ -216,7 +215,6 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_W }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_E }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_R }}, - { .type = KeyActionType_None }, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_T }}, // Row 3 @@ -225,7 +223,6 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_S }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_D }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_F }}, - { .type = KeyActionType_None }, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_G }}, // Row 4 @@ -242,8 +239,9 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_GUI }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_ALT }}, { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Fn, .mode = SwitchLayerMode_Hold }}, - { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_SPACE }}, { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Mod, .mode = SwitchLayerMode_Hold }}, + { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_SPACE }}, + { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Fn2, .mode = SwitchLayerMode_HoldAndDoubleTapToggle }}, #if DEVICE_IS_UHK80 // Row 0 @@ -254,7 +252,6 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_F4 }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_F5 }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_F6 }}, - { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Fn2, .mode = SwitchLayerMode_HoldAndDoubleTapToggle }}, #endif }, @@ -288,6 +285,7 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_DELETE }}, // Row 2 + { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_PAGE_UP }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_HOME }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_UP_ARROW }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_END }}, @@ -295,16 +293,15 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_PRINT_SCREEN }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_SCROLL_LOCK }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_PAUSE }}, - { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_PAGE_UP }}, // Row 3 + { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_PAGE_DOWN }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_ARROW }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_DOWN_ARROW }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_ARROW }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_INSERT }}, { .type = KeyActionType_None }, { .type = KeyActionType_None }, - { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_PAGE_DOWN }}, // Row 4 { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_ESCAPE }}, @@ -313,15 +310,14 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_None }, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_APPLICATION }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_SHIFT }}, - { .type = KeyActionType_None }, // Row 5 { .type = KeyActionType_None }, - { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Mod, .mode = SwitchLayerMode_Hold }}, { .type = KeyActionType_None }, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_ALT }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_GUI }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_CONTROL }}, + { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Mod, .mode = SwitchLayerMode_Hold }}, }, // Left keyboard half @@ -342,7 +338,6 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_T, .modifiers = HID_KEYBOARD_MODIFIER_LEFTCTRL }}, // [+] tab new { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_PAGE_DOWN, .modifiers = HID_KEYBOARD_MODIFIER_LEFTCTRL }}, // [>] tab next { .type = KeyActionType_None }, - { .type = KeyActionType_None }, // Row 3 { .type = KeyActionType_None }, @@ -351,7 +346,6 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_TAB, .modifiers = HID_KEYBOARD_MODIFIER_LEFTALT }}, // window switch { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_ARROW, .modifiers = HID_KEYBOARD_MODIFIER_LEFTCTRL | HID_KEYBOARD_MODIFIER_LEFTALT }}, // workspace next { .type = KeyActionType_None }, - { .type = KeyActionType_None }, // Row 4 { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_SHIFT }}, @@ -367,9 +361,9 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_GUI }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_ALT }}, { .type = KeyActionType_None }, - { .type = KeyActionType_None }, { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Mod, .mode = SwitchLayerMode_Hold }}, { .type = KeyActionType_None }, + { .type = KeyActionType_None }, }, // Left module @@ -402,6 +396,7 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_None }, // Row 2 + { .type = KeyActionType_None }, { .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = MEDIA_PLAY_PAUSE }}, { .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = MEDIA_VOLUME_UP }}, { .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = MEDIA_STOP }}, @@ -409,16 +404,15 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_None }, { .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_System, .scancode = SYSTEM_SLEEP }}, { .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_System, .scancode = SYSTEM_POWER_DOWN }}, - { .type = KeyActionType_None }, // Row 3 + { .type = KeyActionType_None }, { .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = MEDIA_PREVIOUS }}, { .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = MEDIA_VOLUME_DOWN }}, { .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = MEDIA_NEXT }}, { .type = KeyActionType_None }, { .type = KeyActionType_None }, { .type = KeyActionType_None }, - { .type = KeyActionType_None }, // Row 4 { .type = KeyActionType_None }, @@ -427,15 +421,14 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_None }, { .type = KeyActionType_None }, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_SHIFT }}, - { .type = KeyActionType_None }, // Row 5 { .type = KeyActionType_None }, - { .type = KeyActionType_None }, { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Fn, .mode = SwitchLayerMode_Hold }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_ALT }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_GUI }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_CONTROL }}, + { .type = KeyActionType_None }, }, // Left keyboard half @@ -456,7 +449,6 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = CONSUMER_BROWSER_REFRESH }}, { .type = KeyActionType_None }, { .type = KeyActionType_None }, - { .type = KeyActionType_None }, // Row 3 { .type = KeyActionType_None }, @@ -465,7 +457,6 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = CONSUMER_EXPLORER }}, { .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = CONSUMER_BROWSER_FORWARD }}, { .type = KeyActionType_None }, - { .type = KeyActionType_None }, // Row 4 { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_SHIFT }}, @@ -516,6 +507,7 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_None }, // Row 2 + { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_ScrollUp }, { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_Button_4 }, { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_MoveUp }, { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_Button_5 }, @@ -523,16 +515,15 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_None }, { .type = KeyActionType_None }, { .type = KeyActionType_None }, - { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_ScrollUp }, // Row 3 + { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_ScrollDown }, { .type = KeyActionType_Mouse, .mouseAction= SerializedMouseAction_MoveLeft }, { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_MoveDown }, { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_MoveRight }, { .type = KeyActionType_None }, { .type = KeyActionType_None }, { .type = KeyActionType_None }, - { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_ScrollDown }, // Row 4 { .type = KeyActionType_None }, @@ -541,15 +532,14 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_None }, { .type = KeyActionType_None }, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_SHIFT }}, - { .type = KeyActionType_None }, // Row 5 { .type = KeyActionType_None }, { .type = KeyActionType_None }, - { .type = KeyActionType_None }, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_ALT }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_GUI }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_RIGHT_CONTROL }}, + { .type = KeyActionType_None }, }, // Left keyboard half @@ -570,7 +560,6 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_None }, { .type = KeyActionType_None }, { .type = KeyActionType_None }, - { .type = KeyActionType_None }, // Row 3 { .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Mouse, .mode = SwitchLayerMode_HoldAndDoubleTapToggle }}, @@ -579,7 +568,6 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_MiddleClick }, { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_LeftClick }, { .type = KeyActionType_None }, - { .type = KeyActionType_None }, // Row 4 { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_SHIFT }}, @@ -595,8 +583,8 @@ key_action_t CurrentKeymap[LayerId_Count][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_GUI }}, { .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_ALT }}, { .type = KeyActionType_None }, - { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_Decelerate }, { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_Accelerate }, + { .type = KeyActionType_Mouse, .mouseAction = SerializedMouseAction_Decelerate }, { .type = KeyActionType_None }, }, 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 22371f298..2898435e1 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/ledmap.h b/right/src/ledmap.h index ee9cd1eac..a964a355e 100644 --- a/right/src/ledmap.h +++ b/right/src/ledmap.h @@ -30,8 +30,8 @@ } key_action_color_t; typedef enum { - LedMapIndex_LeftSlot_LeftShift = 21, - LedMapIndex_LeftSlot_IsoKey = 22, + LedMapIndex_LeftSlot_LeftShift = 19, + LedMapIndex_LeftSlot_IsoKey = 20, } led_map_index_t; typedef enum { diff --git a/right/src/macros/keyid_parser.c b/right/src/macros/keyid_parser.c index 7e8c63e5b..e038b6874 100644 --- a/right/src/macros/keyid_parser.c +++ b/right/src/macros/keyid_parser.c @@ -15,7 +15,7 @@ typedef struct { static const lookup_record_t lookup_table[] = { // ALWAYS keep the array sorted by `LC_ALL=C sort` {"", 255}, - {"'", 19}, + {"'", 20}, {",", 24}, {"-", 4}, {".", 25}, @@ -30,74 +30,74 @@ static const lookup_record_t lookup_table[] = { {"7", 0}, {"8", 1}, {"9", 2}, - {";", 18}, + {";", 19}, {"=", 5}, - {"[", 11}, - {"]", 12}, + {"[", 12}, + {"]", 13}, {"`", 64}, - {"a", 79}, - {"apostropheAndQuote", 19}, - {"b", 91}, + {"a", 78}, + {"apostropheAndQuote", 20}, + {"b", 89}, {"backspace", 6}, - {"c", 89}, - {"capsLock", 78}, - {"closingBracketAndClosingBrace", 12}, + {"c", 87}, + {"capsLock", 77}, + {"closingBracketAndClosingBrace", 13}, {"commaAndLessThanSign", 24}, - {"d", 81 }, + {"d", 80 }, {"delete", 42}, {"dotAndGreaterThanSign", 25}, {"downArrow", 54}, {"e", 74 }, {"end", 48}, - {"enter", 20}, + {"enter", 21}, {"equalAndPlus", 5}, - {"escape", 98}, - {"f", 82}, - {"f1", 99}, + {"escape", 97}, + {"f", 81}, + {"f1", 98}, {"f10", 38}, {"f11", 39}, {"f12", 40}, - {"f2", 100}, - {"f3", 101}, - {"f4", 102}, - {"f5", 103}, - {"f6", 104}, + {"f2", 99}, + {"f3", 100}, + {"f4", 101}, + {"f5", 102}, + {"f6", 103}, {"f7", 35}, {"f8", 36}, {"f9", 37}, - {"g", 84}, - {"graveAccentAndTilde", 63}, - {"h", 21}, + {"g", 82}, + {"graveAccentAndTilde", 64}, + {"h", 15}, {"home", 46}, - {"i", 8}, + {"i", 9}, {"insert", 43}, - {"isoKey", 86}, - {"j", 15}, - {"k", 16}, - {"l", 17}, - {"leftAlt", 94}, + {"isoKey", 84}, + {"j", 16}, + {"k", 17}, + {"l", 18}, + {"leftAlt", 92}, {"leftArrow", 53}, - {"leftCtrl", 92}, - {"leftFn", 95}, - {"leftFn2", 105}, - {"leftMod", 97}, + {"leftCtrl", 90}, + {"leftFn", 93}, + {"leftFn2", 96}, + {"leftMod", 94}, {"leftModule.key1", 128}, {"leftModule.key2", 129}, {"leftModule.key3", 130}, {"leftModule.leftButton", 131}, {"leftModule.middleButton", 132}, {"leftModule.rightButton", 133}, - {"leftMouse", 78}, - {"leftShift", 85}, - {"leftSpace", 96}, - {"leftSuper", 93}, + {"leftMouse", 77}, + {"leftShift", 83}, + {"leftSpace", 95}, + {"leftSuper", 91}, {"m", 23}, {"minusAndUnderscore", 4}, {"n", 22}, {"next", 52}, - {"o", 9}, - {"openingBracketAndOpeningBrace", 11}, - {"p", 10}, + {"o", 10}, + {"openingBracketAndOpeningBrace", 12}, + {"p", 11}, {"pageDown", 49}, {"pageUp", 47}, {"pause", 45}, @@ -105,31 +105,31 @@ static const lookup_record_t lookup_table[] = { {"print", 41}, {"q", 72}, {"r", 75}, - {"rightAlt", 32}, + {"rightAlt", 30}, {"rightArrow", 55}, - {"rightCtrl", 34}, - {"rightFn", 31}, - {"rightFn2", 56}, - {"rightMod", 30}, + {"rightCtrl", 32}, + {"rightFn", 29}, + {"rightFn2", 34}, + {"rightMod", 33}, {"rightModule.leftButton", 192}, {"rightModule.rightButton", 193}, {"rightShift", 27}, - {"rightSpace", 29}, - {"rightSuper", 33}, - {"s", 80}, + {"rightSpace", 28}, + {"rightSuper", 31}, + {"s", 79}, {"scrollLock", 44}, - {"semicolonAndColon", 18}, + {"semicolonAndColon", 19}, {"slashAndQuestionMark", 26}, - {"t", 77}, + {"t", 76}, {"tab", 71}, - {"u", 7}, + {"u", 8}, {"upArrow", 51}, - {"v", 90}, + {"v", 88}, {"w", 73}, - {"x", 88}, - {"y", 14}, - {"z", 87}, - {"|", 13}, + {"x", 86}, + {"y", 7}, + {"z", 85}, + {"|", 14}, }; static size_t lookup_size = sizeof(lookup_table)/sizeof(lookup_table[0]); diff --git a/right/src/main.c b/right/src/main.c index 1d244c0f4..d8e6aed63 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" #include "power_mode.h" static bool IsEepromInitialized = false; @@ -89,8 +91,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 (VERSION_AT_LEAST(DataModelVersion, 8, 2, 0)) { + 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 3d704438a..b88c58f54 100644 --- a/right/src/slave_drivers/uhk_module_driver.c +++ b/right/src/slave_drivers/uhk_module_driver.c @@ -1,4 +1,5 @@ #include +#include "config_parser/parse_config.h" #include "i2c_addresses.h" #include "i2c.h" @@ -25,6 +26,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 +131,21 @@ 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 ( + DEVICE_IS_UHK60 + && VERSION_AT_LEAST(DataModelVersion, 8, 2, 0) + && uhkModuleDriverId == UhkModuleDriverId_LeftKeyboardHalf + ) { + targetKeyId = KeyLayout_Uhk60_to_Universal[SlotId_LeftKeyboardHalf][keyId]; + } else { + targetKeyId = keyId; + } + + if (KeyStates[slotId][targetKeyId].hardwareSwitchState != keyStatesBuffer[keyId]) { + KeyStates[slotId][targetKeyId].hardwareSwitchState = keyStatesBuffer[keyId]; stateChanged = true; } } diff --git a/scripts/package.json b/scripts/package.json index 986fda36f..a645ed087 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -22,7 +22,7 @@ "firmwareVersion": "11.2.0", "deviceProtocolVersion": "4.10.0", "moduleProtocolVersion": "4.3.0", - "userConfigVersion": "8.1.0", + "userConfigVersion": "8.2.0", "hardwareConfigVersion": "1.0.0", "smartMacrosVersion": "2.5.0", "devices": [