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

For your consideration: Proof of concept ISR version #16

Open
malachib opened this issue Apr 28, 2022 · 0 comments
Open

For your consideration: Proof of concept ISR version #16

malachib opened this issue Apr 28, 2022 · 0 comments

Comments

@malachib
Copy link

Hi guys, yesterday I put together just as the title says a functional prototype of the ISR flavor of this debouncing code

Find it here https://github.com/malachi-iot/esp32-button/blob/exp-isr-working1/src/button_isr.c

As a prototype, it lacks a number of important qualities such as:

  • Crit section protection
  • Configurability
  • Optimization
  • General cleanliness

However it does work well for my single button scenario. The general approach is a direct morph of the existing code. In essence:

  1. Edge detection ISR notices incoming GPIOs and triggers a hardware timer ISR
  2. Hardware timer does most of the familiar stuff you see in the RTOS task, but without an RTOS task

I don't love that we're essentially "ticking" in phase 2 as @X-Ryl669 pointed out in #15 . I'm undecided if it's worth the extra complexity for this approach vs an RTOS task. Undoubtedly this approach is leaner. I hurt my brain yesterday trying to "detickify" the thing, so screw it :)

I invite comment, discussion, approval or disapproval. If the general notion is liked, I will clean it up and make it production worthy and do a PR

Test code is here https://github.com/malachi-iot/esp32-button/tree/exp-isr-working1/test/interactive/isr

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

1 participant