123456789101112131415161718192021222324252627282930313233 |
- #include "json_queue.h"
- #if 0
- //往队列中写入数据多处写一处读,所以调用该函数需要进入临界区
- void string_queue_send_json(uint8_t *string,uint32_t stringLength)
- {
- //将string打包为结构体信息
- StringInfo message;
- message.p=malloc(stringLength+1);
- memcpy(message.p,string,stringLength);
-
- uint8_t err;
- err=OSQPost(JsonQ,(void *)&message);
- switch(err)
- {
- case OS_ERR_NONE:
- break;
- case OS_ERR_Q_FULL:
- break;
- }
- }
- //从队列中读出数据string用完需要释放空间
- void string_queue_recv_json(uint8_t *string,uint32_t stringLength)
- {
- StringInfo *message;
- uint8_t err;
- message=OSQPend(JsonQ,100,&err);
- }
- #endif
|