Bug in gpio_button_init ? Polarity & pull-up / pull-down

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

cross mob
user_108962310
Level 4
Level 4
10 likes received 10 likes given 5 likes given

Is there a bug in the `gpio_button_init` function?

The code is:

    return wiced_gpio_init( button->gpio, ( button->polarity == WICED_ACTIVE_HIGH )? INPUT_PULL_UP: INPUT_PULL_DOWN );

If a button is set up as active-low, so that the GPIO is connected to ground went it is pressed, shouldn't the micro therefor provide a pull UP, to restore the input to the non-active state?
And vice versa for active-high: GPIO goes high while button is pressed, then a pull DOWN is needed to return it to inactive when the button is released.

I ran into this when trying to set up the button_manager in SDK 5.1 .

0 Likes
1 Solution
AlanH_86
Employee
Employee
100 replies posted 50 replies posted 25 solutions authored

Yes that is a bug

I filed an internal case.

Alan

View solution in original post

3 Replies