Skip to content

Commit

Permalink
Merge pull request hathach#2473 from kaidegit/patch-1
Browse files Browse the repository at this point in the history
use rt-thread 5+ mq recv api
  • Loading branch information
HiFiPhile authored Mar 13, 2024
2 parents 1577572 + 27c1254 commit 7c66f9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/osal/osal_rtthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2020 tfx2001 ([email protected])
* Copyright (c) 2020 yekai ([email protected])
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -111,9 +112,12 @@ TU_ATTR_ALWAYS_INLINE static inline osal_queue_t osal_queue_create(osal_queue_de
}

TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_receive(osal_queue_t qhdl, void *data, uint32_t msec) {

rt_tick_t tick = rt_tick_from_millisecond((rt_int32_t) msec);
#if RT_VERSION_MAJOR >= 5
return rt_mq_recv(qhdl, data, qhdl->msg_size, tick) > 0;
#else
return rt_mq_recv(qhdl, data, qhdl->msg_size, tick) == RT_EOK;
#endif /* RT_VERSION_MAJOR >= 5 */
}

TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_send(osal_queue_t qhdl, void const *data, bool in_isr) {
Expand Down

0 comments on commit 7c66f9b

Please sign in to comment.