wip:
This commit is contained in:
parent
46019d0141
commit
fff4013b40
@ -73,6 +73,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
uint8_t i2c_address; // The i2c address of PCF8574 expander that caused the interrupt.
|
uint8_t i2c_address; // The i2c address of PCF8574 expander that caused the interrupt.
|
||||||
uint8_t gpio_number; // The GPIO that caused the interrupt.
|
uint8_t gpio_number; // The GPIO that caused the interrupt.
|
||||||
|
bool gpio_level; // The GPIO level that caused the interrupt.
|
||||||
} zh_pcf8574_event_on_isr_t;
|
} zh_pcf8574_event_on_isr_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1 +1 @@
|
|||||||
1.2.0
|
1.3.0
|
@ -223,6 +223,7 @@ static void IRAM_ATTR _zh_pcf8574_isr_processing_task(void *pvParameter)
|
|||||||
zh_pcf8574_event_on_isr_t event = {0};
|
zh_pcf8574_event_on_isr_t event = {0};
|
||||||
event.i2c_address = handle->i2c_address;
|
event.i2c_address = handle->i2c_address;
|
||||||
event.gpio_number = 0xFF;
|
event.gpio_number = 0xFF;
|
||||||
|
uint8_t old_reg = handle->gpio_status;
|
||||||
uint8_t reg_temp = 0;
|
uint8_t reg_temp = 0;
|
||||||
esp_err_t err = _zh_pcf8574_read_register(handle, ®_temp);
|
esp_err_t err = _zh_pcf8574_read_register(handle, ®_temp);
|
||||||
if (err != ESP_OK)
|
if (err != ESP_OK)
|
||||||
@ -232,9 +233,13 @@ static void IRAM_ATTR _zh_pcf8574_isr_processing_task(void *pvParameter)
|
|||||||
}
|
}
|
||||||
for (uint8_t j = 0; j <= 7; ++j)
|
for (uint8_t j = 0; j <= 7; ++j)
|
||||||
{
|
{
|
||||||
if (((handle->gpio_work_mode & _gpio_matrix[j]) != 0) && ((reg_temp & _gpio_matrix[j]) == 0))
|
if ((handle->gpio_work_mode & _gpio_matrix[j]) != 0)
|
||||||
|
{
|
||||||
|
if ((old_reg & _gpio_matrix[j]) != (reg_temp & _gpio_matrix[j]))
|
||||||
{
|
{
|
||||||
event.gpio_number = j;
|
event.gpio_number = j;
|
||||||
|
event.gpio_level = reg_temp & _gpio_matrix[j];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user