irqhandler.cpp: bugfix irq flag handling

This commit is contained in:
Verkehrsrot 2019-12-26 13:25:59 +01:00
parent dbed27fb32
commit ed1b06dd2e

View File

@ -8,7 +8,7 @@ void irqHandler(void *pvParameters) {
configASSERT(((uint32_t)pvParameters) == 1); // FreeRTOS check configASSERT(((uint32_t)pvParameters) == 1); // FreeRTOS check
uint32_t InterruptStatus; static uint32_t InterruptStatus = 0x00;
static bool mask_irq = false; static bool mask_irq = false;
// task remains in blocked state until it is notified by an irq // task remains in blocked state until it is notified by an irq
@ -37,49 +37,65 @@ void irqHandler(void *pvParameters) {
// button pressed? // button pressed?
#ifdef HAS_BUTTON #ifdef HAS_BUTTON
if (InterruptStatus & BUTTON_IRQ) if (InterruptStatus & BUTTON_IRQ) {
readButton(); readButton();
InterruptStatus &= ~BUTTON_IRQ;
}
#endif #endif
// display needs refresh? // display needs refresh?
#ifdef HAS_DISPLAY #ifdef HAS_DISPLAY
if (InterruptStatus & DISPLAY_IRQ) if (InterruptStatus & DISPLAY_IRQ) {
refreshTheDisplay(); refreshTheDisplay();
InterruptStatus &= ~DISPLAY_IRQ;
}
#endif #endif
// LED Matrix display needs refresh? // LED Matrix display needs refresh?
#ifdef HAS_MATRIX_DISPLAY #ifdef HAS_MATRIX_DISPLAY
if (InterruptStatus & MATRIX_DISPLAY_IRQ) if (InterruptStatus & MATRIX_DISPLAY_IRQ) {
refreshTheMatrixDisplay(); refreshTheMatrixDisplay();
InterruptStatus &= ~MATRIX_DISPLAY_IRQ;
}
#endif #endif
// BME sensor data to be read? // BME sensor data to be read?
#if (HAS_BME) #if (HAS_BME)
if (InterruptStatus & BME_IRQ) if (InterruptStatus & BME_IRQ) {
bme_storedata(&bme_status); bme_storedata(&bme_status);
InterruptStatus &= ~BME_IRQ;
}
#endif #endif
// are cyclic tasks due? // are cyclic tasks due?
if (InterruptStatus & CYCLIC_IRQ) if (InterruptStatus & CYCLIC_IRQ) {
doHousekeeping(); doHousekeeping();
InterruptStatus &= ~CYCLIC_IRQ;
}
#if (TIME_SYNC_INTERVAL) #if (TIME_SYNC_INTERVAL)
// is time to be synced? // is time to be synced?
if (InterruptStatus & TIMESYNC_IRQ) { if (InterruptStatus & TIMESYNC_IRQ) {
now(); // ensure sysTime is recent now(); // ensure sysTime is recent
calibrateTime(); calibrateTime();
InterruptStatus &= ~TIMESYNC_IRQ;
} }
#endif #endif
// do we have a power event? // do we have a power event?
#if (HAS_PMU) #if (HAS_PMU)
if (InterruptStatus & PMU_IRQ) if (InterruptStatus & PMU_IRQ) {
AXP192_powerevent_IRQ(); AXP192_powerevent_IRQ();
InterruptStatus &= ~PMU_IRQ;
}
#endif #endif
// is time to send the payload? // is time to send the payload?
if (InterruptStatus & SENDCYCLE_IRQ) if (InterruptStatus & SENDCYCLE_IRQ) {
sendData(); sendData();
InterruptStatus &= ~SENDCYCLE_IRQ;
}
} }
} }