diff --git a/include/zh_pcf8574.h b/include/zh_pcf8574.h index 120f810..ff29a30 100755 --- a/include/zh_pcf8574.h +++ b/include/zh_pcf8574.h @@ -22,8 +22,8 @@ */ #define ZH_PCF8574_INIT_CONFIG_DEFAULT() \ { \ - .task_priority = 10, \ - .stack_size = 2048, \ + .task_priority = 1, \ + .stack_size = configMINIMAL_STACK_SIZE, \ .i2c_address = 0xFF, \ .p0_gpio_work_mode = ZH_PCF8574_GPIO_OUTPUT, \ .p1_gpio_work_mode = ZH_PCF8574_GPIO_OUTPUT, \ @@ -63,8 +63,8 @@ extern "C" */ typedef struct { - uint8_t task_priority; /*!< Task priority for the PCF8574 expander isr processing. @note It is not recommended to set a value less than 10. */ - uint16_t stack_size; /*!< Stack size for task for the PCF8574 expander isr processing processing. @note The minimum size is 2048 bytes. */ + uint8_t task_priority; /*!< Task priority for the PCF8574 expander isr processing. @note Minimum value is 1. */ + uint16_t stack_size; /*!< Stack size for task for the PCF8574 expander isr processing processing. @note The minimum size is configMINIMAL_STACK_SIZE. */ uint8_t i2c_address; /*!< Expander I2C address. */ bool p0_gpio_work_mode; /*!< Expander GPIO PO work mode. */ bool p1_gpio_work_mode; /*!< Expander GPIO P1 work mode. */ diff --git a/zh_pcf8574.c b/zh_pcf8574.c index 2d66dad..cd28018 100755 --- a/zh_pcf8574.c +++ b/zh_pcf8574.c @@ -203,7 +203,7 @@ static esp_err_t _zh_pcf8574_validate_config(const zh_pcf8574_init_config_t *con { ZH_ERROR_CHECK(config != NULL, ESP_ERR_INVALID_ARG, NULL, "Initial config is NULL."); ZH_ERROR_CHECK((config->i2c_address >= 0x20 && config->i2c_address <= 0x27) || (config->i2c_address >= 0x38 && config->i2c_address <= 0x3F), ESP_ERR_INVALID_ARG, NULL, "Invalid I2C address."); - ZH_ERROR_CHECK(config->task_priority >= 10 && config->stack_size >= 2048, ESP_ERR_INVALID_ARG, NULL, "Invalid task settings."); + ZH_ERROR_CHECK(config->task_priority >= 1 && config->stack_size >= configMINIMAL_STACK_SIZE, ESP_ERR_INVALID_ARG, NULL, "Invalid task settings."); ZH_ERROR_CHECK(config->interrupt_gpio <= GPIO_NUM_MAX, ESP_ERR_INVALID_ARG, NULL, "Invalid GPIO number."); ZH_ERROR_CHECK(config->i2c_handle != NULL, ESP_ERR_INVALID_ARG, NULL, "Invalid I2C handle."); return ESP_OK;