[Answered] Meaning of GPIO_PULLUP_PULLDOWN

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

[Answered] Meaning of GPIO_PULLUP_PULLDOWN

Postby kolban » Wed Nov 02, 2016 5:32 am

Looking at the GPIO API I see a function called gpio_set_pull_mode(). I'm wondering how to describe this function. For input, I can imagine no signal (floating input) being treated as high with "pull up" and low with "pull down". What then does the option GPIO_PULLUP_PULLDOWN mean?

Does this function have any semantics for GPIO pins flagged as "output"?
Last edited by kolban on Wed Dec 28, 2016 10:56 pm, edited 1 time in total.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Meaning of GPIO_PULLUP_PULLDOWN

Postby kolban » Wed Dec 28, 2016 1:46 am

*bump*
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Meaning of GPIO_PULLUP_PULLDOWN

Postby ESP_Angus » Wed Dec 28, 2016 9:53 pm

This took me a moment to understand as well, had to check with coworkers. Setting GPIO_PULLUP_PULLDOWN turns on both pull-up and pull-down resistors, which pulls the pin voltage to approximately VCC/2.

Not useful for digital GPIO functions, but you can use this to bias the input when sampling an analog signal.

Who is online

Users browsing this forum: ccrause and 255 guests