Button Debounce in Firmware

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
PhGi_2174146
Level 3
Level 3
First like received First like given

We're using an 20736S and we're trying to differentiate between a single, double, and triple button press.  We're getting some extra triggering of the interrupt on the button due to bouncing.  We do have a pull down resistor on the pin, and we're configuring the pin using gpio_configurePin (we're using P4 in this case) with:

GPIO_INPUT_ENABLE | GPIO_EN_INT_RISING_EDGE | GPIO_PULL_DOWN, GPIO_PIN_INPUT_LOW

We've also setup the port in the BLE_PROFILE_GPIO_CFG with:

GPIO_INPUT  | GPIO_INIT_LOW  | GPIO_BUTTON | GPIO_INT

It's my understanding that there's debouncing logic already in the firmware and we'd like to try to use that before writing our own.  Do we have to do anything special to use the firmware capability, or should we be using different configuration settings.  We've tried a variety of different settings but none seem to make a difference.

Thank you.

0 Likes
1 Solution

Thanks for the information!  It looks like we needed something that spanned more than a few milliseconds so we implemented our own that seems to be working fine.

Best,

Phill

View solution in original post

0 Likes
3 Replies