diff --git a/right/src/usb_report_updater.c b/right/src/usb_report_updater.c index a7c826d..7710b85 100644 --- a/right/src/usb_report_updater.c +++ b/right/src/usb_report_updater.c @@ -285,6 +285,8 @@ static uint8_t secondaryRoleState = SecondaryRoleState_Released; static uint8_t secondaryRoleSlotId; static uint8_t secondaryRoleKeyId; static secondary_role_t secondaryRole; +static bool simulateKeypresses = false; +static bool sendChar = false; static void updateActiveUsbReports(void) { @@ -319,6 +321,16 @@ static void updateActiveUsbReports(void) return; } + key_state_t *testKeyState = &KeyStates[SlotId_LeftKeyboardHalf][0]; + if (!testKeyState->previous && testKeyState->current && activeLayer == LayerId_Fn) { + simulateKeypresses = !simulateKeypresses; + } + + if (simulateKeypresses) { + sendChar = !sendChar; + ActiveUsbBasicKeyboardReport->scancodes[basicScancodeIndex++] = sendChar ? HID_KEYBOARD_SC_A : HID_KEYBOARD_SC_B; + } + for (uint8_t slotId=0; slotId