2 #include "luat_msgbus.h"
4 #ifdef LUAT_FREERTOS_FULL_INCLUDE
5 #include "freertos/FreeRTOS.h"
6 #include "freertos/queue.h"
12 static QueueHandle_t xQueue
= {0};
14 void luat_msgbus_init(void) {
16 xQueue
= xQueueCreate(256, sizeof(rtos_msg_t
));
19 uint32_t luat_msgbus_put(rtos_msg_t
* msg
, size_t timeout
) {
22 return xQueueSendFromISR(xQueue
, msg
, NULL
) == pdTRUE
? 0 : 1;
24 uint32_t luat_msgbus_get(rtos_msg_t
* msg
, size_t timeout
) {
27 return xQueueReceive(xQueue
, msg
, timeout
) == pdTRUE
? 0 : 1;
29 uint32_t luat_msgbus_freesize(void) {
33 uint8_t luat_msgbus_is_empty(void) {
34 return uxQueueMessagesWaiting(xQueue
) == 0 ? 1 : 0;
37 uint8_t luat_msgbus_is_ready(void) {