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

How do I use the button component with the keypad? (AEGHB-369) #292

Closed
3 tasks done
ertekinsener opened this issue Sep 1, 2023 · 4 comments
Closed
3 tasks done

Comments

@ertekinsener
Copy link

  • 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.

Environment

  • Development Kit: [ESP32-DevKitC]
  • Kit version : [v1]
  • Module or chip used: [ESP32 S3]
  • IDF version : v5.0.2
  • Build System: [Make|CMake]
  • Compiler version : 11.2.0
  • Operating System: [Windows]
  • Power Supply: [USB]

Problem Description

How can I use button components with keypads? I tried to handle it with button_custom_get_key_value . I couldn't do it because the function takes the gpio number as a parameter.

A detailed explanation of the keypads I am trying to use is available at this link: https://lastminuteengineers.com/arduino-keypad-tutorial/

Thanks for your answers

@github-actions github-actions bot changed the title How do I use the button component with the keypad? How do I use the button component with the keypad? (AEGHB-369) Sep 1, 2023
@leeebo leeebo added the button label Sep 11, 2023
@lijunru-hub
Copy link
Contributor

The default GPIO detection for buttons is not suitable for a matrix keyboard. You need to use the button_custom_config_t in the button component to create a custom button. Set the priv field to your current key's custom identifier, and then you need to create 16 button objects (4x4 matrix). The button will automatically invoke the button_custom_get_key_value function you've configured and pass priv to it. Within that function, you should determine if a key is pressed and return its status.

@ertekinsener
Copy link
Author

Thank you for your reply. I did as you said and managed to get it to work. Do you plan to add keypad support to the library in the future?

Secondly, " TEST_CASE("gpio button test", "[button][iot]")" What does this do? I couldn't find it in the documentation.

@leeebo
Copy link
Collaborator

leeebo commented Sep 13, 2023

@ertekinsener TEST_CASE("gpio button test", "[button][iot]") is used for component unit test, you can refer the doc https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/unit-tests.html

@lijunru-hub
Copy link
Contributor

Components button support matrix keypad on version 3.1.0

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

No branches or pull requests

3 participants