fix(platform): initialize gpio isr service once
This commit is contained in:
@@ -56,13 +56,8 @@ static esp_err_t battery_charge_interrupt_start(void)
|
|||||||
return ESP_ERR_NOT_SUPPORTED;
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t err = gpio_install_isr_service(0);
|
esp_err_t err = gpio_set_intr_type((gpio_num_t)CONFIG_TQ_BATTERY_CHARGE_GPIO,
|
||||||
if (err != ESP_OK && err != ESP_ERR_INVALID_STATE) {
|
GPIO_INTR_ANYEDGE);
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = gpio_set_intr_type((gpio_num_t)CONFIG_TQ_BATTERY_CHARGE_GPIO,
|
|
||||||
GPIO_INTR_ANYEDGE);
|
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -622,11 +622,6 @@ esp_err_t control_plane_start_key_input_task(void)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t err = gpio_install_isr_service(0);
|
|
||||||
if (err != ESP_OK && err != ESP_ERR_INVALID_STATE) {
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s_gpio_irq_queue == NULL) {
|
if (s_gpio_irq_queue == NULL) {
|
||||||
s_gpio_irq_queue = xQueueCreate(CONFIG_TQ_KEY_IRQ_QUEUE_LEN,
|
s_gpio_irq_queue = xQueueCreate(CONFIG_TQ_KEY_IRQ_QUEUE_LEN,
|
||||||
sizeof(control_plane_gpio_irq_event_t));
|
sizeof(control_plane_gpio_irq_event_t));
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "driver/gpio.h"
|
||||||
#include "esp_app_desc.h"
|
#include "esp_app_desc.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "nvs.h"
|
#include "nvs.h"
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
|
|
||||||
static const char *TAG = "platform_core";
|
static const char *TAG = "platform_core";
|
||||||
static bool s_initialized;
|
static bool s_initialized;
|
||||||
|
static bool s_gpio_isr_service_installed;
|
||||||
static bool s_storage_ready;
|
static bool s_storage_ready;
|
||||||
static const char *k_identity_nvs_namespace = "ota";
|
static const char *k_identity_nvs_namespace = "ota";
|
||||||
|
|
||||||
@@ -33,6 +35,21 @@ static const char *const s_known_nvs_namespaces[] = {
|
|||||||
"fortune",
|
"fortune",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static esp_err_t platform_gpio_isr_service_init(void)
|
||||||
|
{
|
||||||
|
if (s_gpio_isr_service_installed) {
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t err = gpio_install_isr_service(0);
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_gpio_isr_service_installed = true;
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t platform_read_firmware_version(char *out, size_t out_len)
|
esp_err_t platform_read_firmware_version(char *out, size_t out_len)
|
||||||
{
|
{
|
||||||
if (out == NULL || out_len == 0U) {
|
if (out == NULL || out_len == 0U) {
|
||||||
@@ -139,6 +156,12 @@ esp_err_t platform_init(void)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t err = platform_gpio_isr_service_init();
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "GPIO ISR service init failed: %s", esp_err_to_name(err));
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
platform_power_hold_init();
|
platform_power_hold_init();
|
||||||
|
|
||||||
esp_err_t io_effects_err = platform_io_effects_init();
|
esp_err_t io_effects_err = platform_io_effects_init();
|
||||||
@@ -147,7 +170,7 @@ esp_err_t platform_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_TQ_STEPPER_ENABLE
|
#if CONFIG_TQ_STEPPER_ENABLE
|
||||||
esp_err_t err = platform_stepper_driver_init();
|
err = platform_stepper_driver_init();
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user