Skip to content

For your consideration: Proof of concept ISR version #16

@malachib

Description

@malachib

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions