#include #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "driver/gpio.h" #include "esp_log.h" #include "sdkconfig.h" #include "freertos/queue.h" #define PMU_INPUT_PIN (gpio_num_t)CONFIG_PMU_INTERRUPT_PIN /*!< axp power chip interrupt Pin*/ #define PMU_INPUT_PIN_SEL (1ULL<= ESP_IDF_VERSION_VAL(5,0,0)) && defined(CONFIG_XPOWERS_ESP_IDF_NEW_API)) ESP_ERROR_CHECK(i2c_init()); ESP_LOGI(TAG, "I2C initialized successfully"); #endif ESP_ERROR_CHECK(pmu_init()); xTaskCreate(pmu_handler_task, "App/pwr", 4 * 1024, NULL, 10, NULL); ESP_LOGI(TAG, "Run..."); } static void pmu_handler_task(void *args) { uint32_t io_num; while (1) { if (xQueueReceive(gpio_evt_queue, &io_num, portMAX_DELAY)) { pmu_isr_handler(); } } }