fix: 对不支持weak的bsp, luat_http_client_onevent报重复定义了
[LuatOS.git] / luat / cmsis_os2 / luat_msgbus_cmsis_os2.c
blob48ace6e4a71371d959de92008abc18b4112c0f55
2 #include "luat_msgbus.h"
4 #include "cmsis_os2.h"
6 #define LUAT_MSGBUS_MAXCOUNT 0xFF
7 //#define LUAT_MSGBUS_MAXSIZE 8
8 static osMessageQueueId_t queue = {0};
10 void luat_msgbus_init(void) {
11 if (!queue) {
12 queue = osMessageQueueNew(LUAT_MSGBUS_MAXCOUNT, sizeof(rtos_msg_t), NULL);
15 uint32_t luat_msgbus_put(rtos_msg_t* msg, size_t timeout) {
16 if (queue == NULL)
17 return 1;
18 return osMessageQueuePut(queue, msg, 0, timeout);
20 uint32_t luat_msgbus_get(rtos_msg_t* msg, size_t timeout) {
21 if (queue == NULL)
22 return 1;
23 return osMessageQueueGet(queue, msg, 0, timeout);
25 uint32_t luat_msgbus_freesize(void) {
26 if (queue == NULL)
27 return 1;
28 return osMessageQueueGetSpace(queue);