Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[espressif/keyboard_button] How to handle previously pressed keycodes? (AEGHB-685) #370

Closed
3 tasks done
Junanjunan opened this issue Jun 12, 2024 · 2 comments
Closed
3 tasks done

Comments

@Junanjunan
Copy link

Junanjunan commented Jun 12, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

(Really thank you for answering key combination event question last time.)

With keyboard_button_create function, gpio pins that configured become active.
After that, when I press keycodes and release keycodes, it is a little different from usual keyboard.

I will explain that ASCII instead of gpio number.
I press 'a' and after that press 'b' without release 'a'.
Now, the pressed keys are 'a' and 'b'.
And, if I release 'b', mcu recognize 'a' is pressed, so mcu reports 'a' to pc.

Another usual keyboard does not operate like that,
In usual keyboards, when I release 'b' in situation 'a' and 'b' are pressed,
usual keyboards recognize all keys are released even if I don't release 'a' key.

So, I wonder that I can handle that like usual keyboards with some options or function in your library.
Or, do I have to handle it with personally?

@github-actions github-actions bot changed the title [espressif/keyboard_button] How to handle previously pressed keycodes? [espressif/keyboard_button] How to handle previously pressed keycodes? (AEGHB-685) Jun 12, 2024
@lijunru-hub
Copy link
Contributor

This component will report a series of data whenever the key state changes (any key press/release).

You can choose to handle only key press events and ignore key release events.

static void keyboard_cb(keyboard_btn_handle_t kbd_handle, keyboard_btn_report_t kbd_report, void *user_data)
{
    /*!< progress with key pressed */
    if (kbd_report.key_change_num > 0) {
       
    }

    /*!< progress with key release*/
    if (kbd_report.key_change_num < 0) {
       
    }
}

Junanjunan added a commit to Junanjunan/esp that referenced this issue Jun 12, 2024
With changed event trigger, it is enable to ignore previously pressed keycodes
like usual keyboard

Issue and comment link
 -> espressif/esp-iot-solution#370
Junanjunan added a commit to Junanjunan/esp that referenced this issue Jun 12, 2024
With changed event trigger, it is enable to ignore previously pressed keycodes like usual keyboard

Issue and comment link
 -> espressif/esp-iot-solution#370
@Junanjunan
Copy link
Author

Really so thank you about corret and fast answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants