2 Commits

Author SHA1 Message Date
dfebb15213 perf: updated isr handler 2025-08-14 11:54:45 +03:00
8c6460a1d1 doc: update example 2025-08-12 12:13:30 +03:00
4 changed files with 6 additions and 9 deletions

View File

@@ -118,7 +118,7 @@ int main(void)
return 0; return 0;
} }
void zh_avr_pcf8574_event_handler(zh_avr_pcf8574_event_on_isr_t *event) // Required only if used input GPIO interrupts. void zh_avr_pcf8574_event_handler(zh_avr_pcf8574_event_on_isr_t *event) // Do not delete! Leave blank if interrupts are not used.
{ {
printf("Interrupt happened on device address 0x%02X on GPIO number %d at level %d.\n", event->i2c_address, event->gpio_number, event->gpio_level); printf("Interrupt happened on device address 0x%02X on GPIO number %d at level %d.\n", event->i2c_address, event->gpio_number, event->gpio_level);
printf("Interrupt Task Remaining Stack Size %d.\n", uxTaskGetStackHighWaterMark(NULL)); printf("Interrupt Task Remaining Stack Size %d.\n", uxTaskGetStackHighWaterMark(NULL));

View File

@@ -133,7 +133,7 @@ extern "C"
/** /**
* @brief PCF8574 ISR handler. * @brief PCF8574 ISR handler.
*/ */
void zh_avr_pcf8574_isr_handler(void); BaseType_t zh_avr_pcf8574_isr_handler(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -1 +1 @@
1.0.0 1.1.0

View File

@@ -129,17 +129,14 @@ static avr_err_t _zh_avr_pcf8574_configure_interrupts(const zh_avr_pcf8574_init_
return AVR_OK; return AVR_OK;
} }
void zh_avr_pcf8574_isr_handler(void) BaseType_t zh_avr_pcf8574_isr_handler(void)
{
if ((PIND & (1 << _interrupt_gpio)) == 0)
{ {
BaseType_t xHigherPriorityTaskWoken = pdFALSE; BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xSemaphoreGiveFromISR(_interrupt_semaphore, &xHigherPriorityTaskWoken); if ((PIND & (1 << _interrupt_gpio)) == 0)
if (xHigherPriorityTaskWoken == pdTRUE)
{ {
portYIELD(); xSemaphoreGiveFromISR(_interrupt_semaphore, &xHigherPriorityTaskWoken);
};
} }
return xHigherPriorityTaskWoken;
} }
static void _zh_avr_pcf8574_isr_processing_task(void *pvParameter) static void _zh_avr_pcf8574_isr_processing_task(void *pvParameter)