diff --git a/McuLib/src/McuLog.c b/McuLib/src/McuLog.c index 797d14b..aaea394 100644 --- a/McuLib/src/McuLog.c +++ b/McuLib/src/McuLog.c @@ -332,14 +332,22 @@ static void LockUnlockCallback(void *data, bool lock) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; if (lock) { +#if McuLib_CONFIG_CPU_IS_ESP32 + if (xPortInIsrContext()) { +#else if (xPortIsInsideInterrupt()) { +#endif xSemaphoreTakeFromISR(McuLog_ConfigData.McuLog_Mutex, &xHigherPriorityTaskWoken); portYIELD_FROM_ISR(xHigherPriorityTaskWoken); } else { (void)xSemaphoreTakeRecursive(McuLog_ConfigData.McuLog_Mutex, portMAX_DELAY); } } else { +#if McuLib_CONFIG_CPU_IS_ESP32 + if (xPortInIsrContext()) { +#else if (xPortIsInsideInterrupt()) { +#endif xSemaphoreGiveFromISR(McuLog_ConfigData.McuLog_Mutex, &xHigherPriorityTaskWoken); portYIELD_FROM_ISR(xHigherPriorityTaskWoken); } else { @@ -480,4 +488,3 @@ void McuLog_Deinit(void) { } #endif /* McuLog_CONFIG_IS_ENABLED */ -