Is there anyway to get access to GPIO input value in boot loader_start.c?

TimLee
Posts: 8
Joined: Tue May 29, 2018 7:21 pm

Is there anyway to get access to GPIO input value in boot loader_start.c?

Postby TimLee » Tue May 29, 2018 7:25 pm

I'm trying to get a value from a GPIO during the boot stage to decide which partition I would like to jump into.
I've tried to include driver/gpio.h and link driver/gpio.c but it compiled failed with cannot find GPIO in gpio.o
so I've checked rom/gpio.h and find there are a not documented function GPIO_INPUT_GET which I can use.
but I can only get 1 from this function no matter how I tried.

So is there any way I can get a valid value from a GPIO here(in application I use it with input mode and pulldown set to true).

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

Re: Is there anyway to get access to GPIO input value in boot loader_start.c?

Postby ESP_Angus » Wed May 30, 2018 1:27 am

Hi Tim,

You can use the GPIO_INPUT_GET(N) macro to read a GPIO input pin via ROM code functions:
https://github.com/espressif/esp-idf/bl ... gpio.h#L64

It's also possible to read the GPIO registers directly, but there's not much point unless you need very fast reads in a tight loop.


TimLee
Posts: 8
Joined: Tue May 29, 2018 7:21 pm

Re: Is there anyway to get access to GPIO input value in boot loader_start.c?

Postby TimLee » Wed May 30, 2018 7:13 am

Didn't noticed that, that's really helpful, thx very much :)

Who is online

Users browsing this forum: Google [Bot], warren and 13 guests