// Copyright 2018-2025 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include #include #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/queue.h" #include "driver/gpio.h" #include "esp_log.h" #include "esp_system.h" static const char *TAG = "main"; /** * Brief: * This test code shows how to configure gpio and how to use gpio interrupt. * * GPIO status: * GPIO15: output * GPIO16: output * GPIO4: input, pulled up, interrupt from rising edge and falling edge * GPIO5: input, pulled up, interrupt from rising edge. * * Test: * Connect GPIO15 with GPIO4 * Connect GPIO16 with GPIO5 * Generate pulses on GPIO15/16, that triggers interrupt on GPIO4/5 * */ #define GPIO_OUTPUT_IO_0 15 #define GPIO_OUTPUT_IO_1 16 #define GPIO_OUTPUT_PIN_SEL ((1ULL<