|
|
@@ -1,5 +1,6 @@
|
|
|
#include "luat_base.h"
|
|
|
#include "luat_msgbus.h"
|
|
|
+#include "luat_rtos.h"
|
|
|
|
|
|
#ifdef LUAT_FREERTOS_FULL_INCLUDE
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
@@ -19,7 +20,18 @@ void luat_msgbus_init(void) {
|
|
|
uint32_t luat_msgbus_put(rtos_msg_t* msg, size_t timeout) {
|
|
|
if (xQueue == NULL)
|
|
|
return 1;
|
|
|
- return xQueueSendFromISR(xQueue, msg, NULL) == pdTRUE ? 0 : 1;
|
|
|
+ if (luat_rtos_get_ipsr())
|
|
|
+ {
|
|
|
+ BaseType_t pxHigherPriorityTaskWoken;
|
|
|
+ if (xQueueSendFromISR(xQueue, msg, &pxHigherPriorityTaskWoken) != pdPASS)
|
|
|
+ return -1;
|
|
|
+ portYIELD_FROM_ISR(pxHigherPriorityTaskWoken);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return xQueueSend(xQueue, msg, NULL) == pdTRUE ? 0 : 1;
|
|
|
+ }
|
|
|
}
|
|
|
uint32_t luat_msgbus_get(rtos_msg_t* msg, size_t timeout) {
|
|
|
if (xQueue == NULL)
|