refactor: major refactoring
This commit is contained in:
12
zh_pcf8574.c
12
zh_pcf8574.c
@ -22,7 +22,7 @@ static zh_vector_t _vector = {0};
|
||||
|
||||
static esp_err_t _zh_pcf8574_validate_config(const zh_pcf8574_init_config_t *config);
|
||||
static esp_err_t _zh_pcf8574_configure_i2c_device(const zh_pcf8574_init_config_t *config, zh_pcf8574_handle_t *handle);
|
||||
static esp_err_t _zh_pcf8574_configure_interrupts(const zh_pcf8574_init_config_t *config, const zh_pcf8574_handle_t *handle);
|
||||
static esp_err_t _zh_pcf8574_configure_interrupts(const zh_pcf8574_init_config_t *config, const zh_pcf8574_handle_t handle);
|
||||
static void _zh_pcf8574_isr_handler(void *arg);
|
||||
static void _zh_pcf8574_isr_processing_task(void *pvParameter);
|
||||
static esp_err_t _zh_pcf8574_read_register(zh_pcf8574_handle_t *handle, uint8_t *reg);
|
||||
@ -53,7 +53,7 @@ esp_err_t zh_pcf8574_init(const zh_pcf8574_init_config_t *config, zh_pcf8574_han
|
||||
ZH_PCF8574_LOGI("GPIO setup completed successfully.");
|
||||
if (config->interrupt_gpio < GPIO_NUM_MAX && config->interrupt_gpio > GPIO_NUM_NC && handle->gpio_work_mode != 0)
|
||||
{
|
||||
err = _zh_pcf8574_configure_interrupts(config, handle);
|
||||
err = _zh_pcf8574_configure_interrupts(config, *handle);
|
||||
if (err != ESP_OK)
|
||||
{
|
||||
handle->is_initialized = false;
|
||||
@ -151,7 +151,7 @@ static esp_err_t _zh_pcf8574_configure_i2c_device(const zh_pcf8574_init_config_t
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t _zh_pcf8574_configure_interrupts(const zh_pcf8574_init_config_t *config, const zh_pcf8574_handle_t *handle)
|
||||
static esp_err_t _zh_pcf8574_configure_interrupts(const zh_pcf8574_init_config_t *config, const zh_pcf8574_handle_t handle)
|
||||
{
|
||||
if (_interrupt_gpio != GPIO_NUM_MAX)
|
||||
{
|
||||
@ -189,7 +189,7 @@ static esp_err_t _zh_pcf8574_configure_interrupts(const zh_pcf8574_init_config_t
|
||||
tskNO_AFFINITY);
|
||||
if (x_err != pdPASS)
|
||||
{
|
||||
ZH_PCF8574_LOGE("Failed to create ISR processing task.");
|
||||
ZH_PCF8574_LOGE("Failed to create isr processing task.");
|
||||
vSemaphoreDelete(_interrupt_semaphore);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
@ -252,7 +252,7 @@ static void IRAM_ATTR _zh_pcf8574_isr_processing_task(void *pvParameter)
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
esp_err_t _zh_pcf8574_read_register(zh_pcf8574_handle_t *handle, uint8_t *reg)
|
||||
static esp_err_t _zh_pcf8574_read_register(zh_pcf8574_handle_t *handle, uint8_t *reg)
|
||||
{
|
||||
ZH_PCF8574_LOGI("PCF8574 read started.");
|
||||
ZH_PCF8574_CHECK(handle != NULL || reg != NULL, ESP_ERR_INVALID_ARG, "PCF8574 read failed. Invalid argument.");
|
||||
@ -274,7 +274,7 @@ esp_err_t _zh_pcf8574_read_register(zh_pcf8574_handle_t *handle, uint8_t *reg)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t _zh_pcf8574_write_register(zh_pcf8574_handle_t *handle, uint8_t reg)
|
||||
static esp_err_t _zh_pcf8574_write_register(zh_pcf8574_handle_t *handle, uint8_t reg)
|
||||
{
|
||||
ZH_PCF8574_LOGI("PCF8574 write started.");
|
||||
ZH_PCF8574_CHECK(handle != NULL, ESP_ERR_INVALID_ARG, "PCF8574 write failed. Invalid argument.");
|
||||
|
Reference in New Issue
Block a user