Configure GPIO by Registers - ESP32-S2
Posted: Tue Nov 01, 2022 11:21 pm
I'm starting to develop with the ESP32-S2, and I have many doubts about how to control the GPIO directly through the registers (I'm used to working like this with atmega328p chips).
My goal is to set the GPIOS as inputs and outputs, read the state of the pin and change its logic state through registers, I don't want to use the functions in C, gpio_set_direction, gpio_set_level and gpio_get_level.
Atmega328p used registers like DDRD, PORTD and PIND. I expected to find equivalent registers in the ESP32-S2 datasheet or a similar path, but I can't find the necessary information for that, so below I'm leaving my specific questions.
1° - How do I define by the registers that the GPIO38 will be an input or output?
2° - How do I set by registers that the GPIO38 will go to the high or low logical state?
My goal is to set the GPIOS as inputs and outputs, read the state of the pin and change its logic state through registers, I don't want to use the functions in C, gpio_set_direction, gpio_set_level and gpio_get_level.
Atmega328p used registers like DDRD, PORTD and PIND. I expected to find equivalent registers in the ESP32-S2 datasheet or a similar path, but I can't find the necessary information for that, so below I'm leaving my specific questions.
1° - How do I define by the registers that the GPIO38 will be an input or output?
2° - How do I set by registers that the GPIO38 will go to the high or low logical state?