Giter Site home page Giter Site logo

mauriciobarroso / button Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 1.0 44 KB

ESP-IDF component to drive multiple instances of tactile switches buttons

License: MIT License

CMake 0.60% C 99.40%
button debounce double-click esp-idf esp-idf-component esp32 esp32c3 esp32s2 esp32s3 multifunction oop switch tactile-switches

button's People

Contributors

mauriciobarroso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fherrera124

button's Issues

Example Usage?

Thank you for sharing this component. Do you happen to have any example usage code? If not, I can help create some for quicker usage.

GPIO isr service is already installed

Hello, I am trying to use your component and am encountering strange behavior.
When I use "button_init" more than once, I get the error E(343) gpio: gpio_install_isr_service(498): GPIO isr service is already installed.
The callback is triggered only by the last initialized button.
What's wrong?

I (313) button: Initializing button component...
I (323) gpio: GPIO[9]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
I (333) button: Initializing button component...
I (333) gpio: GPIO[8]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
E (343) gpio: gpio_install_isr_service(498): GPIO isr service already installed
I (353) button: Initializing button component...
I (363) gpio: GPIO[7]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
E (373) gpio: gpio_install_isr_service(498): GPIO isr service already installed
I (373) button: Adding callback for button...
I (383) button: Adding callback for button...
I (383) button: Adding callback for button...
I button: button 7 pressed for 190 ms
I (18243) button: BUTTON_SHORT_PRESS_BIT set
Button 3 single click
I button: button 9 pressed for 420 ms
I button: button 9 pressed for 200 ms
I button: button 8 pressed for 170 ms
I button: button 8 pressed for 160 ms
I button: button 7 pressed for 220 ms
I (55083) button: BUTTON_SHORT_PRESS_BIT set
Button 3 single click
I button: button 7 pressed for 210 ms
I (56813) button: BUTTON_SHORT_PRESS_BIT set
Button 3 single click

The code snippet is attached below:

    button_t button1;
    button_t button2;
    button_t button3;

    ESP_ERROR_CHECK(button_init(&button1,
                                BUTTON_DEC_PIN,
                                BUTTON_EDGE_FALLING,
                                tskIDLE_PRIORITY + 11,
                                configMINIMAL_STACK_SIZE * 4));

    ESP_ERROR_CHECK(button_init(&button2,
                                BUTTON_INC_PIN,
                                BUTTON_EDGE_FALLING,
                                tskIDLE_PRIORITY + 11,
                                configMINIMAL_STACK_SIZE * 4));

    ESP_ERROR_CHECK(button_init(&button3,
                                BUTTON_PREV_PIN,
                                BUTTON_EDGE_FALLING,
                                tskIDLE_PRIORITY + 11,
                                configMINIMAL_STACK_SIZE * 4));

    button_add_cb(&button1, BUTTON_CLICK_SINGLE, button1_cb, "Button 1 single click");
    button_add_cb(&button2, BUTTON_CLICK_SINGLE, button1_cb, "Button 2 single click");
    button_add_cb(&button3, BUTTON_CLICK_SINGLE, button1_cb, "Button 3 single click");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.