Interrupt GPIO for Pulse Counter

Hi. I would like to do Pulse Counter with mgos_gpio_set_int_handler

What I did is

mgos_gpio_setup_input(19, MGOS_GPIO_PULL_UP);
mgos_gpio_set_int_handler(19, MGOS_GPIO_INT_EDGE_NEG, PulseUpdate, NULL);

But when state is LOW it still counting how to make it count only 1 ?

Thanks you

Besides the fact that you should enable the interrupt after setting its handler, your code looks OK to me.
Chip pull-ups are usually weak, did you check voltage is OK at the pin ? Maybe your hardware is loading the pin and the pull-up is too weak.

It already have HW PullUP on PCB. It seem like MGOS_GPIO_INT_EDGE_NEG are working like So it keep count if pin is still at LOW Stage.

But it work!! if I used

mgos_gpio_set_button_handler(19, MGOS_GPIO_PULL_UP, MGOS_GPIO_INT_EDGE_NEG, 20, PulseUpdate, NULL);

Is mgos_gpio_set_button_handler are include interrupt itself ? or I need to declare mgos_gpio_enable_int(19);

button handlers have a debouncer and the source code is available at github. I didn’t see any difference in how the button sets the pin and what you did, but I might have overlooked something.

when I try to keep used mgos_gpio_set_button_handler for my pulse counter at high speed pulse 200ms/pulse it got error at 30% that did not count

The whole idea of a debouncer is to reject pulses coming from contact bouncing, so it will not work for a pulse counter.
The comment was regarding the facts that a) the code is available and b) the pin is initialized as you did, so it does work.