chegewara / EspTinyUSB

ESP32S2 native USB library. Implemented few common classes, like MIDI, CDC, HID or DFU (update).
MIT License
473 stars 70 forks source link

Release only one of the keys #153

Open alonso240 opened 3 months ago

alonso240 commented 3 months ago

Hello.

First of all, thank you very much for the fantastic libraries.

I'm trying to make an ESP32-S3 behave as a keyboard+mouse.

Everything works correctly, but I have a question.

I want that when I hold down a button, the keyboard key is also pressed, I achieve that with "sendPress".

If, for example, I hold down the "A" and "S" keys, I release the "S" key and hold down the "A" key. How do I do it?

If I execute "sendRelease", as I understand it stops pressing all the keys.

Sorry for my English from Google Translate!!!

Thank you so much!!!!

Greetings.

chegewara commented 3 months ago

Hi, when 2nd time you send sendPress() with only A OS should interpret it like you released S

alonso240 commented 3 months ago

So:

If I send "sendPress(A)" and then send "sendPress(B)" it would not add the presses (A and B).

I deactivate "A" and press "B"?

chegewara commented 3 months ago

Yes Library is prepared to send only 1 key pressed at a time, so if you send another key press, the previous should be detected as released/de-pressed.