//Gpio_Inter.c
#include <stdio.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
#include "driver/gpio.h"
#define LED_1 2
#define BOTAO 15
int estado_botao = 0;
static void IRAM_ATTR gpio_isr_handler(void *args){
int pino = (int)args;
// printf("Botao Acionado\n");
gpio_set_level(LED_1, estado_botao);
estado_botao = !estado_botao;
}
void app_main(void)
{
gpio_set_direction(LED_1, GPIO_MODE_OUTPUT);
gpio_set_direction(BOTAO, GPIO_MODE_INPUT);
gpio_pulldown_dis(BOTAO);
gpio_pullup_en(BOTAO);
gpio_set_intr_type(BOTAO, GPIO_INTR_POSEDGE);
gpio_install_isr_service(0);
gpio_isr_handler_add(BOTAO, gpio_isr_handler, BOTAO);
/* while(true){
int estado_botao = gpio_get_level(BOTAO);
gpio_set_level(LED_1, estado_botao);
vTaskDelay(1000 / portTICK_PERIOD_MS);
} */
}